This one adds the gradient shading to the toolbars when floating
instead of just when docked. (Plus it uses the blue color style instead
of grey on windows 2000 and below as before)
Here is the blue style with the original codejock code that leaves the
toolbar flat looking when floated, and with a funnier darker outline.
Here is what it will look like with this theme, still shaded when floating:
It even works when you wrap the toolbars too:
Unfortunately the separator bars still show up and take up a little
space as you can see just below the save icon in that last screenshot.
Its close enough to how Office 2003 actually displays toolbars though.
.h file
class CXTPOffice2003ThemeEx : public CXTPOffice2003Theme
{
public:
CXTPOffice2003ThemeEx(BOOL bGreyToBlue = TRUE, BOOL bYellowHighlight = FALSE);
BOOL m_bGreyToBlue, m_bYellowHighlight;
protected:
virtual void RefreshMetrics();
virtual void FillCommandBarEntry(CDC* pDC, CXTPCommandBar* pBar);
};
.cpp file
CXTPOffice2003ThemeEx::CXTPOffice2003ThemeEx(BOOL bGreyToBlue, BOOL bYellowHighlight)
{
m_bGreyToBlue = bGreyToBlue;
m_bYellowHighlight = bYellowHighlight;
RefreshMetrics();
}
void CXTPOffice2003ThemeEx::RefreshMetrics()
{
CXTPOffice2003Theme::RefreshMetrics();
if( !m_bLunaTheme ) {
CXTPColorManager *pClrMgr = XTPColorManager();
COLORREF btn = pClrMgr->GetColor(COLOR_BTNFACE);
if( m_bGreyToBlue && (btn == RGB(192, 192, 192) || btn == RGB(212, 208, 200)) ) {
m_clrDockBarDark = RGB(158, 190, 245);
m_clrDockBarLight = RGB(196, 218, 250);
m_clrCommandBarDark = RGB(129, 169, 226);
m_clrCommandBarLight = RGB(221, 236, 254);
m_clrPopupDark = RGB(227, 239, 255);
m_clrPopupLight = RGB(147, 181, 231);
m_crlToolbarShadow = RGB(59, 97, 156);
m_crlFloatingGripper = RGB(42, 102, 201);
m_crlExpandNormalDark = RGB(0, 53, 145);
m_crlExpandNormalLight = RGB(117, 166, 241);
m_clrMenuExpandedDark = RGB(121, 161, 220);
m_clrMenuExpandedLight = RGB(203, 221, 246);
m_clrCircleDark = RGB(129, 169, 226);
m_clrCircleLight = RGB(227, 239, 254);
m_clrStatusPane = RGB(221, 221, 221);
m_bLunaTheme = TRUE;
CreateGradientCircle();
m_arrColor[0] = RGB(0, 0, 0);
m_arrColor[1] = RGB(0, 78, 152);
m_arrColor[2] = RGB(0, 84, 227);
m_arrColor[3] = RGB(122, 150, 223);
m_arrColor[4] = RGB(255, 255, 255);
m_arrColor[5] = RGB(255, 255, 255);
m_arrColor[6] = RGB(0, 0, 0);
m_arrColor[7] = RGB(0, 0, 0);
m_arrColor[8] = RGB(0, 0, 0);
m_arrColor[9] = RGB(255, 255, 255);
m_arrColor[10] = RGB(212, 208, 200);
m_arrColor[11] = RGB(212, 208, 200);
m_arrColor[12] = RGB(144, 153, 174);
m_arrColor[13] = RGB(49, 106, 197);
m_arrColor[14] = RGB(255, 255, 255);
// m_arrColor[15] = RGB(236, 233, 216);
m_arrColor[15] = btn;
m_arrColor[16] = RGB(172, 168, 153);
m_arrColor[17] = RGB(172, 168, 153);
m_arrColor[18] = RGB(0, 0, 0);
m_arrColor[19] = RGB(216, 228, 248);
m_arrColor[20] = RGB(255, 255, 255);
m_arrColor[21] = RGB(113, 111, 100);
m_arrColor[22] = RGB(251, 248, 231);
m_arrColor[23] = RGB(0, 0, 0);
m_arrColor[24] = RGB(255, 255, 225);
m_arrColor[25] = RGB(181, 181, 181);
m_arrColor[26] = RGB(0, 0, 128);
m_arrColor[27] = RGB(61, 149, 255);
m_arrColor[28] = RGB(0, 0, 0);
m_arrColor[29] = RGB(0, 0, 0);
m_arrColor[30] = RGB(158, 190, 245);
m_arrColor[31] = RGB(255, 238, 194);
m_arrColor[32] = RGB(0, 0, 128);
m_arrColor[33] = RGB(254, 128, 62);
m_arrColor[34] = RGB(144, 157, 178);
m_arrColor[35] = RGB(197, 194, 184);
m_arrColor[36] = RGB(255, 192, 111);
m_arrColor[37] = RGB(0, 0, 128);
m_arrColor[38] = RGB(39, 65, 118);
m_arrColor[39] = RGB(106, 140, 203);
m_arrColor[40] = RGB(109, 150, 208);
m_arrColor[41] = RGB(246, 246, 246);
m_arrColor[42] = RGB(230, 227, 210);
m_arrColor[43] = RGB(0, 45, 150);
m_arrColor[44] = RGB(0, 0, 0);
m_arrColor[45] = RGB(0, 0, 0);
m_arrColor[46] = RGB(0, 0, 0);
m_arrColor[47] = RGB(0, 0, 0);
m_arrColor[48] = RGB(255, 251, 233);
m_arrColor[49] = RGB(129, 126, 114);
m_arrColor[50] = RGB(0, 0, 128);
m_arrColor[51] = RGB(216, 231, 252);
m_arrColor[52] = RGB(158, 190, 245);
m_arrColor[53] = RGB(203, 225, 252);
m_arrColor[54] = RGB(0, 45, 150);
m_arrColor[55] = RGB(196, 218, 250);
} else if(m_bYellowHighlight) {
m_arrColor[31] = RGB(255, 238, 194);
m_arrColor[33] = RGB(254, 128, 62);
m_arrColor[36] = RGB(255, 192, 111);
m_bLunaTheme = TRUE;
}
}
}
void CXTPOffice2003ThemeEx::FillCommandBarEntry(CDC* pDC, CXTPCommandBar* pBar)
{
XTPBarPosition pos = pBar->GetPosition();
if( pos == xtpBarFloating ) {
CXTPClientRect rc((CWnd *)pBar);
CXTPPenDC pen(*pDC, m_crlFloatingGripper);
CXTPBrushDC brush(*pDC, GetXtremeColor(XPCOLOR_TOOLBAR_FACE));
pDC->Rectangle(rc);
rc.DeflateRect(1, 1);
pDC->Rectangle(rc);
pDC->SetPixel(2, 2, pen.Color());
pDC->SetPixel(rc.right - 2, 2, pen.Color());
pDC->SetPixel(2, rc.bottom - 2, pen.Color());
pDC->SetPixel(rc.right - 2, rc.bottom - 2, pen.Color());
CXTPControls *pControls = pBar->GetControls();
CRect rcPrev(-1, -1, -1, -1), rcRaw(0, 0, 0, 0);
for( int nIndex = 0; nIndex < pControls->GetCount(); nIndex++ ) {
CXTPControl *pControl = pControls->GetAt(nIndex);
if( pControl->IsTemporary() ) continue;
rcRaw = pControl->GetRawRect();
if( rcRaw != rcPrev ) {
rcPrev = rcRaw;
GradientFill(pDC, rcRaw, m_clrCommandBarLight,
m_clrCommandBarDark, FALSE);
if( pControl->GetBeginGroup() && nIndex
> 0 ) {
/* CXTPControls::_WrapToolBar
adds space for a horizontal line.
* We could disable drawing
the line in CXTPOffice2003ThemeEx::DrawCommandBarSeparator,
* but the extra 6 pixels
would still be there either way.
*/
rcRaw.bottom = rcRaw.top;
rcRaw.top -= 6;
pDC->FillSolidRect(rcRaw,
m_clrCommandBarDark);
}
}
}
} else {
CXTPOffice2003Theme::FillCommandBarEntry(pDC, pBar);
}
}
|