Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTCaptionThemeOffice2007
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTCaptionThemeOffice2007

 Post Reply Post Reply
Author
Message
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Topic: CXTCaptionThemeOffice2007
    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]);
}

 

Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post 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]);
}
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2008 at 2:06pm
Thanks for sharing.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 26 February 2008 at 4:10pm
Why not provide a screenshot?
 
Thanks!
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 443
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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);
}
Back to Top
Kenneth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 May 2004
Location: United States
Status: Offline
Points: 256
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kenneth Quote  Post ReplyReply Direct Link To This Post Posted: 01 March 2008 at 11:38am
Many thanks.  That resolved a problem I was having.
 
Ken
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.