void g2Controller::DrawComponent(const char* ElementName, int DestX, int DestY, int DestW, int DestH) { // Are we allowed to draw? if(!IsVisible) return; // Get the texture points and default component size float tx, ty, tw, th; bool IsFound = GetTheme()->GetComponent(ElementName, &tx, &ty, &tw, &th, NULL, NULL); g2Assert(IsFound, "Unable to retrieve a component's (ID: %d) texture information", ElementName); // Draw DrawComponent(DestX, DestY, DestW, DestH, tx, ty, tw, th); }
ECode Context::GetDrawable( /* [in] */ Int32 id, /* [out] */ IDrawable** drawable) { VALIDATE_NOT_NULL(drawable) *drawable = NULL; AutoPtr<IResourcesTheme> theme; FAIL_RETURN(GetTheme((IResourcesTheme**)&theme)) AutoPtr<IResources> resources; FAIL_RETURN(GetResources((IResources**) &resources)); return resources->GetDrawable(id, theme, drawable); }
void nuiWindow::Invalidate() { if (mpParent) { nuiRect bigrect(GetRect()); nuiTheme* pTheme = GetTheme(); NGL_ASSERT(pTheme); pTheme->AdjustWindowRect(bigrect, GetFlags(), true, true); pTheme->Release(); mpParent->InvalidateRect(bigrect); } nuiSimpleContainer::Invalidate(); }
void CXTPShortcutListBox::OnPaint() { CPaintDC dc(this); // device context for painting // Get the client rect. CXTPClientRect rcClient(this); // Paint to a memory device context to help // eliminate screen flicker. CXTPBufferDC memDC(dc); memDC.FillSolidRect(rcClient, GetTheme()->m_crgBack); // Now let the window do its default painting... CWnd::DefWindowProc (WM_PAINT, (WPARAM)memDC.m_hDC, 0); }
QStringList MacStyle::keys() const { QString mstyle = "Macintosh"; if(Collection c=NewCollection()) { GetTheme(c); Str255 str; long int s = 256; if(!GetCollectionItem(c, kThemeNameTag, 0, &s, &str)) mstyle += " (" + p2qstring(str) + ")"; } QStringList list; list << mstyle; return list; }
void g2Controller::DrawComponent(g2ThemeElement ElementType, int DestX, int DestY) { // Are we allowed to draw? if(!IsVisible) return; // Get the texture points and default component size float tx, ty, tw, th; int width, height; GLuint textID; bool IsFound = GetTheme()->GetComponent(ElementType, &tx, &ty, &tw, &th, &width, &height, &textID); g2Assert(IsFound, "Unable to retrieve a component's (ID: %d) texture information", (int)ElementType); // Draw DrawComponent(DestX, DestY, width, height, tx, ty, tw, th, textID); }
void g2RadioGroup::GetCollisionRect(int* Width, int* Height) { // Get the size of a radio button int RadioWidth; GetTheme()->GetComponentSize(g2Theme_RadioButton, &RadioWidth, Height); *Height = (*Height + 1) * OptionCount; *Width = 0; // For each option, save the biggest text length for(int i = 0; i < OptionCount; i++) { // Get current labels length int LabelWidth = Labels[i]->GetWidth() + RadioWidth + 1; if(LabelWidth > *Width) *Width = LabelWidth; } }
void g2RadioGroup::Render(int pX, int pY) { // Get the size of a radio button int RadioHeight; GetTheme()->GetComponentSize(g2Theme_RadioButton, NULL, &RadioHeight); // For each option; draw with a pixel buffer for(int i = 0; i < OptionCount; i++) { // Draw the radio button if(GetDisabled()) DrawComponent((i == ActiveIndex) ? g2Theme_RadioButton_Pressed_Disabled : g2Theme_RadioButton_Disabled, pX, pY + i * (RadioHeight + 1)); else DrawComponent((i == ActiveIndex) ? g2Theme_RadioButton_Pressed : g2Theme_RadioButton, pX, pY + i * (RadioHeight + 1)); } // Note that labels self-draw as they are registered as children }
int g2LabelEdit::LengthToCursor() { // Total length int TotalLength = 0; // Starting from the given index, keep going down the text buffer for(int i = ViewIndex; i < CursorIndex; i++) { // Get the size of the current character int CharacterWidth; GetTheme()->GetCharacterSize(TextBuffer[i], &CharacterWidth); // Add to total length TotalLength += CharacterWidth + g2LabelEdit_CharacterSpacing; } // Send the entire length return TotalLength; }
void g2Controller::DrawCharacter(int DestX, int DestY, float ScaleW, float ScaleH, float R, float G, float B, float A, char Character) { // Are we allowed to draw? if(!IsVisible) return; // Set the current color and alpha // (Note we are using the args, not the class members, as values) glColor4f(R, G, B, A); // Get the texture points float tx, ty, tw, th; int width, height; GLuint textID; GetTheme()->GetCharacter(Character, &tx, &ty, &tw, &th, &width, &height, &textID); // Scale width = int(float(width) * ScaleW); height = int(float(height) * ScaleH); // Bind texture glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, textID); // Draw at this position glBegin(GL_QUADS); glTexCoord2f(tx, ty); glVertex2f(DestX + 0, DestY + 0); glTexCoord2f(tx, ty + th); glVertex2f(DestX + 0, DestY + height); glTexCoord2f(tx + tw, ty + th); glVertex2f(DestX + width, DestY + height); glTexCoord2f(tx + tw, ty); glVertex2f(DestX + width, DestY + 0); glEnd(); // Release texture glDisable(GL_TEXTURE_2D); }
void CXTPCalendarViewGroup::AdjustLayout2(CDC* pDC, const CRect& rcGroup) { CXTPCalendarTheme* pTheme = XTP_SAFE_GET2(GetViewDay_(), GetView_(), GetTheme(), NULL); ASSERT(pTheme); //XTP_SAFE_CALL4(pTheme, Get_mw_ViewPart(), GetDayPart(), GetGroupPart(), AdjustLayout(this, pDC, rcGroup)); m_Layout.m_rcGroup = rcGroup; int nCount = GetViewEventsCount(); for (int i = 0; i < nCount; i++) { CXTPCalendarViewEvent* pVEvent = GetViewEvent_(i); ASSERT(pVEvent); if (pVEvent) { pVEvent->AdjustLayout2(pDC, rcGroup, i); } } }
BOOL CXTPCalendarWeekViewDay::HitTestEx(CPoint pt, XTP_CALENDAR_HITTESTINFO_WEEK_VIEW* pHitTest) { if (!pHitTest) { ASSERT(FALSE); return FALSE; } if (m_Layout.m_rcExpandSign.PtInRect(pt)) { if (XTP_SAFE_GET4(GetView(), GetTheme(), GetWeekViewPart(), GetDayPart(), HitTestExpandDayButton(this, &pt), 0)) { FillHitTestEx(pHitTest); pHitTest->uHitCode = xtpCalendarHitTestDayExpandButton; return TRUE; } } return TBase::HitTestEx(pt, pHitTest); }
// Rendering: bool nuiWindow::Draw(nuiDrawContext* pContext) { pContext->PushState(); pContext->ResetState(); nuiWindowManager* pRoot = dynamic_cast<nuiWindowManager*>(mpParent); pContext->EnableBlending(false); if (!mRawWindow) { nuiTheme* pTheme = GetTheme(); NGL_ASSERT(pTheme); pTheme->DrawWindowShade(pContext, mRect.Size(), nuiColor(1.0f, 1.0f, 1.0f, GetMixedAlpha()), IsParentActive()); pContext->PushClipping(); pContext->Clip(GetRect().Size()); pContext->EnableClipping(true); if (pRoot->GetActiveWindow() == this) { if (mMoving) pTheme->DrawMovingWindow(pContext, this); else pTheme->DrawActiveWindow(pContext, this); } else pTheme->DrawWindow(pContext,this); pTheme->Release(); pContext->PopClipping(); } DrawChildren(pContext); return true; }
bool nuiPopupMenu::Draw(nuiDrawContext* pContext) { nuiRect r = GetRect(); NGL_ASSERT(!mRects.empty()); nuiMenuRect* pRect = mRects[0]; nuiTheme* pTheme = GetTheme(); NGL_ASSERT(pTheme); pTheme->DrawMenuWindow(pContext, pRect->mRect, this); if (pRect->mpSBar->IsVisible()) DrawChild(pContext, pRect->mpSBar); //it++; if (mShowFirstNode) { nuiWidgetPtr pWidget = mpTree->GetElement(); NGL_ASSERT(pWidget); nuiRect rect = pWidget->GetRect(); //Draw the main menu item (tree root item) pContext->SetFillColor(GetColor(eMenuTitleBg)); pContext->DrawRect(rect, eStrokeAndFillShape); pContext->EnableBlending(true); nuiReflection ref(1.0f, .4f); ref.Draw(pContext, rect); pContext->EnableBlending(false); DrawChild(pContext, pWidget); } DrawTree(pContext, mpTree, 0); pTheme->Release(); return true; }
void g2Controller::DrawComponentStretch(const char* ElementName, int DestX, int DestY, int Width) { // Get the source texture coordinates of the element float SourceX, SourceY, SourceWidth, SourceHeight; int OutWidth, OutHeight; GetTheme()->GetComponent(ElementName, &SourceX, &SourceY, &SourceWidth, &SourceHeight, &OutWidth, &OutHeight); // Compute the three-component's placement and width // Left, middle, right int X1 = DestX; int W1 = OutWidth / 3; float SourceWidthLeft = SourceWidth / 3.0f; if(Width < W1 * 2) { W1 = Width / 2; SourceWidthLeft *= float(W1) / float(float(OutWidth) / 3.0f); } int X2 = X1 + W1; int W2 = fmax(0, Width - 2 * W1); float SourceWidthMiddle = SourceWidth / 100.0f; int X3 = X2 + W2; int W3 = Width - W1 - W2; float SourceWidthRight = SourceWidth / 3.0f; if(Width < W3 * 2) { W3 = Width / 2; SourceWidthRight *= float(W3) / float(float(OutWidth) / 3.0f); } // Draw the left, middle, right DrawComponent(X1, DestY, W1, OutHeight, SourceX, SourceY, SourceWidthLeft, SourceHeight); DrawComponent(X2, DestY, W2, OutHeight, SourceX + SourceWidthLeft, SourceY, SourceWidthMiddle, SourceHeight); DrawComponent(X3, DestY, W3, OutHeight, SourceX + SourceWidth - SourceWidthLeft, SourceY, SourceWidthLeft, SourceHeight); }
bool nuiMatrixView::Draw(nuiDrawContext* pContext) { pContext->ResetState(); nuiTheme* pTheme = GetTheme(); NGL_ASSERT(pTheme); nuiSize matrixWidth = 0.f; nuiSize matrixHeight = 0.f; nuiSize headerWidth = 0.0f; if (mWidths.size() > 0) headerWidth+= mWidths[0]; if (mVGaps.size() > 0) headerWidth += 2*mVGaps[0]; nuiSize headerHeight = 0.0f; if (mHeights.size() > 0) headerHeight += mHeights[0]; if (mHGaps.size() > 0) headerHeight += 2*mHGaps[0]; nuiRect mxrect; // matrix positions (different depending on headers visibility) uint matrixFirstColumn=0; nuiSize matrixFirstX=0.0f; if (mRowHeader) { matrixFirstColumn=1; matrixFirstX=headerWidth; } uint matrixFirstRow=0; nuiSize matrixFirstY=0.0f; if (mColumnHeader) { matrixFirstRow=1; matrixFirstY=headerHeight; } // compute matrix size for (uint i = matrixFirstColumn; i < mWidths.size(); i++) { matrixWidth += mVGaps[i]; matrixWidth += mWidths[i]; matrixWidth += mVGaps[i]; } for (uint j = matrixFirstRow; j < mHeights.size(); j++) { if (!mRowVisible[j]) continue; matrixHeight += mHGaps[j]; matrixHeight += mHeights[j]; matrixHeight += mHGaps[j]; } nuiGrid::Draw (pContext); // draw selection boxes pContext->EnableBlending(true); pContext->SetBlendFunc(nuiBlendTransp); std::map<nuiMatrixViewItem*, bool>::iterator itr; for (itr = mSelectedItems.begin(); itr != mSelectedItems.end(); ++itr) { nuiMatrixViewItem* item = itr->first; nuiRect rect = item->GetRect(); uint32 size = item->GetDesc().GetSelectionSize(); pContext->SetStrokeColor(item->GetDesc().GetSelectionColor()); pContext->SetStrokeColor(item->GetDesc().GetSelectionColor()); pContext->SetLineWidth(size); pContext->DrawRect(rect, eStrokeShape); } pTheme->Release(); return true; }
void CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { GetTheme(pParams->m_pWidget)->DrawBackground(pParams); }
bool CXFA_FWLTheme::IsCustomizedLayout(IFWL_Widget* pWidget) { return GetTheme(pWidget)->IsCustomizedLayout(pWidget); }
void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) { switch (dwCapacity) { case CFWL_WidgetCapacity::Font: { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { return pWidget->GetDataAcc()->GetFDEFont(); } break; } case CFWL_WidgetCapacity::FontSize: { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { m_fCapacity = pWidget->GetDataAcc()->GetFontSize(); return &m_fCapacity; } break; } case CFWL_WidgetCapacity::TextColor: { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { m_dwCapacity = pWidget->GetDataAcc()->GetTextColor(); return &m_dwCapacity; } break; } case CFWL_WidgetCapacity::LineHeight: { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { m_fCapacity = pWidget->GetDataAcc()->GetLineHeight(); return &m_fCapacity; } break; } case CFWL_WidgetCapacity::ScrollBarWidth: { m_fCapacity = 9; return &m_fCapacity; } case CFWL_WidgetCapacity::UIMargin: { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); if (pWidget) { CXFA_LayoutItem* pItem = pWidget; CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); pWidgetAcc->GetUIMargin(m_Rect); if (CXFA_Para para = pWidgetAcc->GetPara()) { m_Rect.left += para.GetMarginLeft(); if (pWidgetAcc->IsMultiLine()) { m_Rect.width += para.GetMarginRight(); } } if (!pItem->GetPrev()) { if (pItem->GetNext()) { m_Rect.height = 0; } } else if (!pItem->GetNext()) { m_Rect.top = 0; } else { m_Rect.top = 0; m_Rect.height = 0; } } return &m_Rect; } case CFWL_WidgetCapacity::SpaceAboveBelow: { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); if (pWidget) { CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); if (CXFA_Para para = pWidgetAcc->GetPara()) { m_SizeAboveBelow.x = para.GetSpaceAbove(); m_SizeAboveBelow.y = para.GetSpaceBelow(); } } return &m_SizeAboveBelow; } default: break; } int dwCapValue = static_cast<int>(dwCapacity); if (pThemePart->m_pWidget->GetClassID() == FWL_Type::MonthCalendar && dwCapValue >= static_cast<int>(CFWL_WidgetCapacity::Today) && dwCapValue <= static_cast<int>(CFWL_WidgetCapacity::December)) { if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { IXFA_AppProvider* pAppProvider = pWidget->GetAppProvider(); m_wsResource.clear(); switch (dwCapacity) { case CFWL_WidgetCapacity::Sun: pAppProvider->LoadString(XFA_IDS_StringWeekDay_Sun, m_wsResource); break; case CFWL_WidgetCapacity::Mon: pAppProvider->LoadString(XFA_IDS_StringWeekDay_Mon, m_wsResource); break; case CFWL_WidgetCapacity::Tue: pAppProvider->LoadString(XFA_IDS_StringWeekDay_Tue, m_wsResource); break; case CFWL_WidgetCapacity::Wed: pAppProvider->LoadString(XFA_IDS_StringWeekDay_Wed, m_wsResource); break; case CFWL_WidgetCapacity::Thu: pAppProvider->LoadString(XFA_IDS_StringWeekDay_Thu, m_wsResource); break; case CFWL_WidgetCapacity::Fri: pAppProvider->LoadString(XFA_IDS_StringWeekDay_Fri, m_wsResource); break; case CFWL_WidgetCapacity::Sat: pAppProvider->LoadString(XFA_IDS_StringWeekDay_Sat, m_wsResource); break; case CFWL_WidgetCapacity::January: pAppProvider->LoadString(XFA_IDS_StringMonth_Jan, m_wsResource); break; case CFWL_WidgetCapacity::February: pAppProvider->LoadString(XFA_IDS_StringMonth_Feb, m_wsResource); break; case CFWL_WidgetCapacity::March: pAppProvider->LoadString(XFA_IDS_StringMonth_March, m_wsResource); break; case CFWL_WidgetCapacity::April: pAppProvider->LoadString(XFA_IDS_StringMonth_April, m_wsResource); break; case CFWL_WidgetCapacity::May: pAppProvider->LoadString(XFA_IDS_StringMonth_May, m_wsResource); break; case CFWL_WidgetCapacity::June: pAppProvider->LoadString(XFA_IDS_StringMonth_June, m_wsResource); break; case CFWL_WidgetCapacity::July: pAppProvider->LoadString(XFA_IDS_StringMonth_July, m_wsResource); break; case CFWL_WidgetCapacity::August: pAppProvider->LoadString(XFA_IDS_StringMonth_Aug, m_wsResource); break; case CFWL_WidgetCapacity::September: pAppProvider->LoadString(XFA_IDS_StringMonth_Sept, m_wsResource); break; case CFWL_WidgetCapacity::October: pAppProvider->LoadString(XFA_IDS_StringMonth_Oct, m_wsResource); break; case CFWL_WidgetCapacity::November: pAppProvider->LoadString(XFA_IDS_StringMonth_Nov, m_wsResource); break; case CFWL_WidgetCapacity::December: pAppProvider->LoadString(XFA_IDS_StringMonth_Dec, m_wsResource); break; case CFWL_WidgetCapacity::Today: pAppProvider->LoadString(XFA_IDS_String_Today, m_wsResource); break; default: break; } if (!m_wsResource.IsEmpty()) return &m_wsResource; } } return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); }
void g2TextField::GetCollisionRect(int* Width, int* Height) { // Current GUI position and size GetTheme()->GetComponentSize(g2Theme_TextField, NULL, Height); *Width = GetWidth(); }
bool nuiWindow::MouseMoved(nuiSize X, nuiSize Y) { nuiSize dx, dy; LocalToLocal(GetParent(), X, Y); dx = X - mClickX; dy = Y - mClickY; if (mMoving == ePreMove) { if (abs((int)dx) > WINDOW_MINIMOVE || abs((int)dy) > WINDOW_MINIMOVE) { mMoving = eMove; SetAlpha(0.5f); } else return true; } mClickX = X; mClickY = Y; if (mMoving == eMove) { nuiRect wRect = GetIdealRect(); wRect.RoundToNearest(); nuiRect woriginal = wRect; switch (mClickPos) { case nuiCenter: { wRect.Move(dx, dy); } break; case nuiTopLeft: { wRect.mTop += dy; wRect.mLeft += dx; if (wRect.GetHeight() < mMinimumHeight) wRect.mTop += wRect.GetHeight() - mMinimumHeight; if (wRect.GetWidth() < mMinimumWidth) wRect.mLeft += wRect.GetWidth() - mMinimumWidth; } break; case nuiBottomLeft: { wRect.mBottom += dy; wRect.mLeft += dx; if (wRect.GetHeight() < mMinimumHeight) wRect.SetSize(wRect.GetWidth(), mMinimumHeight); if (wRect.GetWidth() < mMinimumWidth) wRect.mLeft += wRect.GetWidth() - mMinimumWidth; } break; case nuiLeft: { wRect.mLeft += dx; if (wRect.GetWidth() < mMinimumWidth) wRect.mLeft += wRect.GetWidth() - mMinimumWidth; } break; case nuiTopRight: { wRect.mTop += dy; wRect.mRight += dx; if (wRect.GetHeight() < mMinimumHeight) wRect.mTop += wRect.GetHeight() - mMinimumHeight; if (wRect.GetWidth() < mMinimumWidth) wRect.SetSize(mMinimumWidth, wRect.GetHeight()); } break; case nuiBottomRight: { wRect.mBottom += dy; wRect.mRight += dx; if (wRect.GetWidth() < mMinimumWidth) wRect.SetSize(mMinimumWidth, wRect.GetHeight()); if (wRect.GetHeight() < mMinimumHeight) wRect.SetSize(wRect.GetWidth(), mMinimumHeight); } break; case nuiRight: { wRect.mRight += dx; if (wRect.GetWidth() < mMinimumWidth) wRect.SetSize(mMinimumWidth, wRect.GetHeight()); } break; case nuiTop: { wRect.mTop += dy; if (wRect.GetHeight() < mMinimumHeight) wRect.mTop += wRect.GetHeight() - mMinimumHeight; } break; case nuiBottom: { wRect.mBottom += dy; if (wRect.GetHeight() < mMinimumHeight) wRect.SetSize(wRect.GetWidth(), mMinimumHeight); } break; default: return true; break; } wRect.RoundToNearest(); if (mpManager) mpManager->ValidateWindowRect(wRect); if (GetRect().GetWidth() == wRect.GetWidth() && GetRect().GetHeight() == wRect.GetHeight()) SetUserPos(wRect.mLeft, wRect.mTop); else SetUserRect(wRect); return true; } else { if (IsInsideFromParent(X,Y)) { nuiRect _Rect = GetRect(); _Rect.Transform(GetMatrix()); nuiTheme* pTheme = GetTheme(); NGL_ASSERT(pTheme); mClickPos= pTheme->GetWindowPart(_Rect, X, Y, GetFlags(), false); pTheme->Release(); SetMouseCursor(eCursorDoNotSet); switch (mClickPos) { case nuiCenter: if (!mNoMove) SetMouseCursor(eCursorHand); break; case nuiTopLeft: if (!mNoResize) SetMouseCursor(eCursorResizeNW); break; case nuiBottomLeft: if (!mNoResize) SetMouseCursor(eCursorResizeSW); break; case nuiLeft: if (!mNoResize) SetMouseCursor(eCursorResizeW); break; case nuiTopRight: if (!mNoResize) SetMouseCursor(eCursorResizeNE); break; case nuiBottomRight: if (!mNoResize) SetMouseCursor(eCursorResizeSE); break; case nuiRight: if (!mNoResize) SetMouseCursor(eCursorResizeE); break; case nuiTop: if (!mNoResize) SetMouseCursor(eCursorResizeN); break; case nuiBottom: if (!mNoResize) SetMouseCursor(eCursorResizeS); break; default: break; } } } return true; // Always block mouse event that are not from this window }
void g2LabelEdit::Render(int pX, int pY) { // Ignore if not null if(TextBuffer == NULL) return; // Total offset from the far left int OffsetX = 0; // For each character... for(size_t i = ViewIndex; i < strlen(TextBuffer); i++) { // Get target character and width int CharWidth; GetTheme()->GetCharacterSize(TextBuffer[i], &CharWidth, NULL); // Stop drawing if this one or the next character is out of bounds if((OffsetX + CharWidth) >= Width) break; // Draw shadow if on if(Shadow) { // Get active color for shadow float Sr, Sg, Sb; GetColor(&Sr, &Sg, &Sb); DrawCharacter(pX + OffsetX + 1, pY + 1, 1.0f, 1.0f, Sr, Sg, Sb, 0.2f, TextBuffer[i]); } // Render text normally DrawCharacter(pX + OffsetX, pY, TextBuffer[i]); // Grow the offset OffsetX += CharWidth + g2LabelEdit_CharacterSpacing; } // Draw the blinking cursor if(( (GetActive() && !GetDisabled()) || CursorAlwaysVisible ) && CursorState) { // Reset offset for rendering again OffsetX = 0; // Go through each character attempting to render for(size_t i = ViewIndex; i <= strlen(TextBuffer); i++) { // Draw and stop at the cursor index if((int)i == CursorIndex) { DrawCharacter(pX + OffsetX - 1, pY, '|'); break; } // Grow offset int CharWidth; GetTheme()->GetCharacterSize(TextBuffer[i], &CharWidth, NULL); OffsetX += CharWidth + g2LabelEdit_CharacterSpacing; } } // Done with rendering... }
void CXTPCalendarWeekViewDay::AdjustLayout2(CDC* pDC, const CRect& rcDay) { TBase::AdjustLayout(pDC, rcDay); XTP_SAFE_CALL4(GetView(), GetTheme(), GetWeekViewPart(), GetDayPart(), AdjustLayout(this, pDC, rcDay)); }
g2ProgressBar* g2Panel::AddProgressBar(int x, int y) { g2ProgressBar* NewProgress = new g2ProgressBar(this, GetTheme()); NewProgress->SetPos(x, y); return NewProgress; }
void g2LabelEdit::GetCollisionRect(int* Width, int* Height) { *Width = this->Width; *Height = GetTheme()->GetCharacterHeight(); }
bool nuiPopupMenu::DrawTree(nuiDrawContext* pContext, nuiTreeNode* pTree, uint depth) { nuiTreeNode* pChildNode; nuiTreeNode* pOpenedNode = NULL; nuiWidget* pChildWidget; nuiRect WidgetRect; NGL_ASSERT(depth < mRects.size()); nuiMenuRect* pRect= mRects[depth]; NGL_ASSERT(pTree); nuiTheme* pTheme = GetTheme(); NGL_ASSERT(pTheme); if (pTree != mpTree) // then Draw a new rect for this depth { pTheme->DrawMenuWindow(pContext, pRect->mRect, this); if (pRect->mpSBar->IsVisible(false)) DrawChild(pContext, pRect->mpSBar); } uint32 count = pTree->GetChildrenCount(); for (uint32 i = 0; i < count; i++) { pChildNode = dynamic_cast<nuiTreeNode*>(pTree->GetChild(i)); pChildWidget = pChildNode->GetElement(); WidgetRect = pChildWidget->GetRect(); if (pChildNode->IsSelected() || pChildNode->IsOpened()) { nuiSize TreeHandleSize = pRect->mHasNonEmpty ? NUI_POPUP_TREE_HANDLE_SIZE : 0.f; nuiRect r = WidgetRect; r.SetSize(WidgetRect.GetWidth()+TreeHandleSize, WidgetRect.GetHeight()); pTheme->DrawSelectionBackground(pContext, r, this); } if (!pChildNode->IsEmpty()) { nuiRect r = WidgetRect; r.Move(WidgetRect.GetWidth(), 0); r.SetSize(NUI_POPUP_TREE_HANDLE_SIZE-4.f, r.GetHeight()); pContext->SetFillColor(GetColor(eTreeViewHandle)); pTheme->DrawTreeHandle(pContext, r, false, NUI_POPUP_TREE_HANDLE_SIZE-4.f); } DrawChild(pContext, pChildWidget); if (pChildNode->IsSelected() || pChildNode->IsOpened()) { nuiSize TreeHandleSize = pRect->mHasNonEmpty ? NUI_POPUP_TREE_HANDLE_SIZE : 0.f; nuiRect r = WidgetRect; r.SetSize(WidgetRect.GetWidth()+TreeHandleSize, WidgetRect.GetHeight()); pTheme->DrawSelectionForeground(pContext, r, this); } if (pChildNode->IsOpened()) { pOpenedNode = pChildNode; } } if (pRect->mpSBar->IsVisible(false)) { SetFillColor(pContext, eMenuBg); SetStrokeColor(pContext, eNormalTextFg); pContext->EnableBlending(true); nuiGradient grad; nuiColor bg(GetColor(eMenuBg)); grad.AddStop(bg, 1); bg.Multiply(0); grad.AddStop(bg, 0); if (pRect->mpSBar->GetRange().GetValue() + pRect->mpSBar->GetRange().GetPageSize() < pRect->mpSBar->GetRange().GetMaximum()) { nuiRect r(pRect->mRect.Left() + 2, mRect.Bottom() - AUTOSCROLL_HEIGHT * 2, pRect->mRect.GetWidth() - SB_WIDTH - 2, AUTOSCROLL_HEIGHT * 2); pContext->DrawGradient(grad, r, 0, mRect.Bottom() - AUTOSCROLL_HEIGHT * 2, 0, mRect.Bottom()); float w = pRect->mRect.GetWidth() - SB_WIDTH; float x = pRect->mRect.Left(); float y = mRect.Bottom() - AUTOSCROLL_HEIGHT; float s = 8; pContext->DrawLine(x + w/2 - s, y + 4, x + w/2 + s, y + 4); pContext->DrawLine(x + w/2 + s, y + 4, x + w/2, y + 4 + s); pContext->DrawLine(x + w/2, y + 4 + s, x + w/2 - s, y + 4); } if (pRect->mpSBar->GetRange().GetValue() > pRect->mpSBar->GetRange().GetMinimum()) { nuiRect r(pRect->mRect.Left() + 2, 0.0f, pRect->mRect.GetWidth() - SB_WIDTH - 2, AUTOSCROLL_HEIGHT * 2); pContext->DrawGradient(grad, r, 0, AUTOSCROLL_HEIGHT * 2, 0, 0); float w = pRect->mRect.GetWidth() - SB_WIDTH; float x = pRect->mRect.Left(); float s = 8; pContext->DrawLine(x + w/2, 4, x + w/2 - s, 4 + s); pContext->DrawLine(x + w/2 - s, 4 + s, x + w/2 + s, 4 + s); pContext->DrawLine(x + w/2 + s, 4 + s, x + w/2, 4); } pContext->EnableBlending(false); } if (pOpenedNode) DrawTree(pContext, pOpenedNode, depth+1); pTheme->Release(); return true; }
void CXTPShortcutListBox::DrawItem(LPDRAWITEMSTRUCT lpDIS) { GetTheme()->DrawItem(this, lpDIS); }
void g2Slider::GetCollisionRect(int* Width, int* Height) { // Post back slider length GetTheme()->GetComponentSize(g2Theme_SliderButton, NULL, Height); *Width = GetWidth(); }
void CXTPShortcutListBox::SetColors(COLORREF clrText, COLORREF clrBack, COLORREF clrBackDark/*= COLORREF_NULL*/) { GetTheme()->m_crItemText.SetCustomValue(clrText); // Must be custom value used to prevent reset color in RefreshMetrics. GetTheme()->m_crgBack.SetCustomValue(clrBack, clrBackDark); }
/*! Returns the list of keys this factory can create styles for. \sa create() */ QStringList QStyleFactory::keys() { QStringList list; #ifndef QT_NO_COMPONENT if ( !instance ) instance = new QStyleFactoryPrivate; list = QStyleFactoryPrivate::manager->featureList(); #endif //QT_NO_COMPONENT #ifndef QT_NO_STYLE_WINDOWS if ( !list.contains( "Windows" ) ) list << "Windows"; #endif #ifndef QT_NO_STYLE_WINDOWSXP if ( !list.contains( "WindowsXP" ) && QWindowsXPStyle::resolveSymbols() ) list << "WindowsXP"; #endif #ifndef QT_NO_STYLE_MOTIF if ( !list.contains( "Motif" ) ) list << "Motif"; #endif #ifndef QT_NO_STYLE_CDE if ( !list.contains( "CDE" ) ) list << "CDE"; #endif #ifndef QT_NO_STYLE_MOTIFPLUS if ( !list.contains( "MotifPlus" ) ) list << "MotifPlus"; #endif #ifndef QT_NO_STYLE_PLATINUM if ( !list.contains( "Platinum" ) ) list << "Platinum"; #endif #ifndef QT_NO_STYLE_SGI if ( !list.contains( "SGI" ) ) list << "SGI"; #endif #ifndef QT_NO_STYLE_COMPACT if ( !list.contains( "Compact" ) ) list << "Compact"; #endif #ifndef QT_NO_STYLE_AQUA if ( !list.contains( "Aqua" ) ) list << "Aqua"; #endif #if !defined( QT_NO_STYLE_MAC ) && defined( Q_WS_MAC ) QString mstyle = "Macintosh"; Collection c = NewCollection(); if (c) { GetTheme(c); Str255 str; long int s = 256; if(!GetCollectionItem(c, kThemeNameTag, 0, &s, &str)) mstyle += " (" + p2qstring(str) + ")"; } if (!list.contains(mstyle)) list << mstyle; DisposeCollection(c); #endif return list; }