Print Page | Close Window

CXTCaptionThemeOffice2007

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=9682
Printed Date: 27 September 2024 at 9:32pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTCaptionThemeOffice2007
Posted By: adrien
Subject: CXTCaptionThemeOffice2007
Date Posted: 24 February 2008 at 7:41pm
 
Office2007 theme for CXTCaption in case anyone wants it.
 
To use, in your caption, use
 
pCaption->SetTheme(new CXTCaptionThemeOffice2007);
 
enjoy.
 
 
class CXTCaptionThemeOffice2007 : public CXTCaptionThemeOffice2003
{
public:
 virtual void DrawCaptionBack(CDC* pDC, CXTCaption* pCaption, CRect& rcItem);
 virtual void RefreshMetrics();

 CXTPPaintManagerColorGradient m_clrNormalCaption;   // Color of pane caption when inactive.
 CXTPPaintManagerColor m_clrNormalCaptionText;       // Color of pane caption text when the caption is inactive
 COLORREF m_arrColor[XPCOLOR_LAST + 1];    // Self colors array.
};

void CXTCaptionThemeOffice2007::RefreshMetrics()
{
 CXTCaptionThemeOffice2003::RefreshMetrics();

 if (XTPOffice2007Images()->IsValid())
 {
  m_arrColor[XPCOLOR_FRAME] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("WindowFrame"));
  m_arrColor[XPCOLOR_3DFACE] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("ButtonFace"));
  m_arrColor[COLOR_3DHIGHLIGHT] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("EdgeHighLightColor"));
  m_arrColor[XPCOLOR_TOOLBAR_GRIPPER] = XTPOffice2007Images()->GetImageColor(_T("Toolbar"), _T("ToolbarGripper"));
  m_arrColor[XPCOLOR_MENUBAR_BORDER] = XTPOffice2007Images()->GetImageColor(_T("Toolbar"), _T("MenuPopupBorder"));

  m_clrNormalCaption.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("NormalCaptionLight")),
   XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("NormalCaptionDark")), 0.25f);
  m_clrNormalCaptionText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("NormalCaptionText")));
 }
 else
 {
  // defaults for if there's no Office2007 images.
  m_arrColor[XPCOLOR_FRAME] = RGB(101, 147, 207);
  m_arrColor[XPCOLOR_3DFACE] = RGB(191, 219, 255);
  m_arrColor[COLOR_3DHIGHLIGHT] = RGB(255, 255, 255);
  m_clrNormalCaption.SetStandardValue(RGB(227, 239, 255), RGB(175, 210, 255), 0.25f);
  m_clrNormalCaptionText.SetStandardValue(RGB(8, 55, 114));
 }
}


void CXTCaptionThemeOffice2007::DrawCaptionBack(CDC* pDC, CXTCaption* pCaption, CRect& rcItem)
{
 XTPDrawHelpers()->GradientFill(pDC, rcItem, m_clrNormalCaption, FALSE);
 pDC->FillSolidRect(rcItem.left, rcItem.top, rcItem.Width(), 1, m_arrColor[XPCOLOR_FRAME]);
 pDC->FillSolidRect(rcItem.left, rcItem.top + 1, rcItem.Width(), 1, m_arrColor[COLOR_3DHIGHLIGHT]);
 pDC->FillSolidRect(rcItem.left, rcItem.top, 1, rcItem.Height(), m_arrColor[XPCOLOR_FRAME]);
 pDC->FillSolidRect(rcItem.left + 1, rcItem.top + 1, 1, rcItem.Height() - 1, m_arrColor[COLOR_3DHIGHLIGHT]);
 pDC->FillSolidRect(rcItem.right - 1, rcItem.top, 1, rcItem.Height(), m_arrColor[XPCOLOR_FRAME]);
}

 




Replies:
Posted By: adrien
Date Posted: 24 February 2008 at 7:44pm
actually the DrawCaptionBack func was ripped out of the docking pane tab drawing code, so will actually look better if you just have
 
 
void CXTCaptionThemeOffice2007::DrawCaptionBack(CDC* pDC, CXTCaption* pCaption, CRect& rcItem)
{
 XTPDrawHelpers()->GradientFill(pDC, rcItem, m_clrNormalCaption, FALSE);
 pDC->FillSolidRect(rcItem.left, rcItem.bottom - 1, rcItem.Width(), 1, m_arrColor[XPCOLOR_FRAME]);
}


Posted By: Oleg
Date Posted: 25 February 2008 at 2:06pm
Thanks for sharing.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 26 February 2008 at 4:10pm
Why not provide a screenshot?
 
Thanks!


Posted By: markr
Date Posted: 27 February 2008 at 3:05pm
Hi Adrien,

Thanks for sharing this code; I've been looking to do something similar, and you've saved me the trouble of figuring it out.

- Mark R.


Posted By: znakeeye
Date Posted: 01 March 2008 at 6:29am
Possible improvement.
 
void CXTCaptionThemeOffice2007::DrawCaptionText(CDC* pDC, CXTCaption* pCaption)
{
    int oldBkMode = pDC->SetBkMode(TRANSPARENT);
    CXTCaptionThemeOffice2003::DrawCaptionText(pDC, pCaption);
    pDC->SetBkMode(oldBkMode);
}


Posted By: Kenneth
Date Posted: 01 March 2008 at 11:38am
Many thanks.  That resolved a problem I was having.
 
Ken
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net