CXTPControl* CXTPRibbonGroup::SetControlType(CXTPControl* pControl, XTPControlType type) { ASSERT(pControl); if (!pControl) return NULL; if (IsPopupControlType(pControl->GetType()) && IsPopupControlType(type)) { pControl->m_controlType = type; return pControl; } CXTPControl* pNew = Add(type, 0, _T(""), IndexOf(pControl) + 1, FALSE); pNew->CXTPControl::Copy(pControl, FALSE); pNew->m_controlType = type; Remove(pControl); return pNew; }
CSize CSkinTheme::DrawControlToolBarParent(CDC* pDC, CXTPControl* pButton, BOOL bDraw) { if(!CImgSkin::IsLoaded()) { return CXTPDefaultTheme::DrawControlToolBarParent(pDC, pButton, bDraw); } CRect rcButton = bDraw? pButton->GetRect(): CXTPEmptyRect(); XTPControlType controlType = pButton->GetType(); CSize szIcon = pButton->GetParent()->GetIconSize(); CSize szButton = CSize(szIcon.cx + 7, szIcon.cy + 7); BOOL bVert = pButton->GetParent()->GetPosition() == xtpBarRight || pButton->GetParent()->GetPosition() == xtpBarLeft; BOOL bPressed = pButton->GetPressed(), bSelected = pButton->GetSelected(), bEnabled = pButton->GetEnabled(), bChecked = pButton->GetChecked(), bPopuped = IsPopupControlType(controlType) ;//&& ((CXTPControlPopup*)pButton)->GetPopup(); COLORREF col; if (bDraw) { CRect rc = pButton->GetRect(); rc.bottom = m_mapRect["Background"].Height; pButton->SetRect(rc); col = bPressed?(m_mapColor["Pressed"]):(bSelected? m_mapColor["Selected"]: m_mapColor["Enable"]); col = !bEnabled?m_mapColor["Disabled"]: bPressed||bPopuped? m_mapColor["Pressed"]: m_mapColor["Enable"]; pDC->SetTextColor(col); pDC->SetBkMode (TRANSPARENT); return CXTPDefaultTheme::DrawControlToolBarParent(pDC, pButton, bDraw); } return CXTPDefaultTheme::DrawControlToolBarParent(pDC, pButton, bDraw); }