XTPTabPaintManagerColors.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:35k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // XTPTabPaintManager.cpp: implementation of the CXTPTabPaintManager class.
  2. //
  3. // This file is a part of the XTREME TOOLKIT PRO MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #include "stdafx.h"
  21. #include "Common/XTPColorManager.h"
  22. #include "Common/XTPDrawHelpers.h"
  23. #include "Common/XTPOffice2007Image.h"
  24. #include "Common/XTPImageManager.h"
  25. #include "XTPTabPaintManager.h"
  26. #include "XTPTabManager.h"
  27. #include "XTPTabPaintManager.inl"
  28. #ifdef _DEBUG
  29. #undef THIS_FILE
  30. static char THIS_FILE[] = __FILE__;
  31. #define new DEBUG_NEW
  32. #endif
  33. //////////////////////////////////////////////////////////////////////////
  34. // CColorSet
  35. CXTPTabPaintManager::CColorSet::CColorSet()
  36. {
  37. m_pPaintManager = NULL;
  38. }
  39. CXTPTabPaintManager::CColorSet::~CColorSet()
  40. {
  41. }
  42. BOOL CXTPTabPaintManager::CColorSet::IsAppThemed() const
  43. {
  44. return FALSE;
  45. }
  46. void CXTPTabPaintManager::CColorSet::RefreshMetrics()
  47. {
  48. RefreshXtremeColors();
  49. m_clrFrameBorder.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW));
  50. m_clrHeaderFace.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  51. m_clrControlFace.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  52. m_clrPaneFace.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  53. m_clrBorderHighlight.SetStandardValue(GetXtremeColor(COLOR_BTNHILIGHT));
  54. m_clrInActiveText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  55. m_clrNormalText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  56. m_clrSelectedText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  57. m_clrHighlightText.SetStandardValue(RGB(0, 0, 128));
  58. m_clrDisabledText.SetStandardValue(GetXtremeColor(COLOR_GRAYTEXT));
  59. m_csStateButton.clrFace.SetStandardValue(GetXtremeColor(COLOR_WINDOW));
  60. m_csStateButton.clrBorder.SetStandardValue(GetXtremeColor(COLOR_HIGHLIGHT));
  61. m_csPropertyPage2003.clrDarkShadow.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW));
  62. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW));
  63. m_csPropertyPage2003.clrBorderLeftHighlight.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  64. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  65. m_csPropertyPage.clrHighlight.SetStandardValue(GetXtremeColor(COLOR_BTNHILIGHT));
  66. m_csPropertyPage.clrShadow.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW));
  67. m_csPropertyPage.clrDarkShadow.SetStandardValue(GetXtremeColor(COLOR_3DDKSHADOW));
  68. m_csExcelSelected.clrRightInnerBorder.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  69. m_csExcelSelected.clrLeftInnerBorder.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  70. m_csExcelSelected.clrTopInnerBorder.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW));
  71. m_csExcelSelected.clrLeftOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  72. m_csExcelSelected.clrRightOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  73. m_csExcelSelected.clrTopOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  74. m_csExcelNormal = m_csExcelSelected;
  75. m_csExcelNormal.clrLeftOuterBorder.SetStandardValue(GetXtremeColor(COLOR_WINDOW));
  76. m_csExcelNormal.clrRightOuterBorder.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW));
  77. m_clrButtonSelected.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  78. m_clrButtonNormal.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  79. m_clrButtonHighlighted.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  80. m_clrButtonPressed.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  81. if (m_pPaintManager->GetAppearance() == xtpTabAppearanceExcel)
  82. {
  83. m_clrButtonSelected.SetStandardValue(GetXtremeColor(COLOR_WINDOW));
  84. }
  85. m_clrAutoHideFace = m_clrHeaderFace;
  86. }
  87. void CXTPTabPaintManager::CColorSet::GradientFill(CDC* pDC, CRect rc, COLORREF clrLight, COLORREF clrDark, XTPTabPosition position)
  88. {
  89. if (clrLight == XTP_TABMANAGER_COLOR_SHADED)
  90. {
  91. WORD bits[] =
  92. {
  93. 0x0055, 0x00AA, 0x0055, 0x00AA,
  94. 0x0055, 0x00AA, 0x0055, 0x00AA
  95. };
  96. CBitmap bitmap;
  97. bitmap.CreateBitmap(8, 8, 1, 1, &bits);
  98. CBrush brush;
  99. brush.CreatePatternBrush(&bitmap);
  100. CBrush* pOldBrush = pDC->SelectObject(&brush);
  101. pDC->SetBkColor(GetXtremeColor(COLOR_3DFACE));
  102. pDC->SetTextColor(GetXtremeColor(COLOR_3DHIGHLIGHT));
  103. pDC->PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATCOPY);
  104. pDC->SelectObject(pOldBrush);
  105. }
  106. else
  107. {
  108. BOOL bHoriz = IsHorizontalTabPosition(position);
  109. if (!IsTopLeftTabPosition(position)) SwapColors(clrLight, clrDark);
  110. if (m_pPaintManager->m_bInvertGradient) SwapColors(clrLight, clrDark);
  111. XTPDrawHelpers()->GradientFill(pDC, rc, clrLight, clrDark, !bHoriz);
  112. }
  113. }
  114. void CXTPTabPaintManager::CColorSet::FillHeader(CDC* pDC, CRect rc, CXTPTabManager* pTabManager)
  115. {
  116. COLORREF clrLight = m_clrHeaderFace.clrLight, clrDark = m_clrHeaderFace.clrDark;
  117. if (clrLight == clrDark && clrLight == GetXtremeColor(COLOR_3DFACE))
  118. {
  119. if (pTabManager->DrawParentBackground(pDC, rc))
  120. return;
  121. }
  122. GradientFill(pDC, rc, clrLight, clrDark, pTabManager->GetPosition());
  123. }
  124. COLORREF CXTPTabPaintManager::CColorSet::FillClient(CDC* pDC, CRect rc, CXTPTabManager* pTabManager)
  125. {
  126. CXTPTabManagerItem* pItem = pTabManager->GetSelectedItem();
  127. COLORREF clrClient = pItem ? GetItemColor(pItem) : m_clrButtonSelected;
  128. pDC->FillSolidRect(rc, clrClient);
  129. return clrClient;
  130. }
  131. void CXTPTabPaintManager::CColorSet::SetTextColor(CDC* pDC, CXTPTabManagerItem* pItem)
  132. {
  133. pDC->SetTextColor(!pItem->IsEnabled() ? m_clrDisabledText: !pItem->GetTabManager()->IsActive() ? m_clrInActiveText :
  134. pItem->IsSelected() ? m_clrSelectedText: pItem->IsHighlighted() ? m_clrHighlightText : m_clrNormalText);
  135. }
  136. COLORREF CXTPTabPaintManager::CColorSet::GetItemColor(CXTPTabManagerItem* pItem)
  137. {
  138. if (m_pPaintManager->m_bOneNoteColors)
  139. {
  140. return pItem->GetColor();
  141. }
  142. return pItem->IsSelected() ? m_clrButtonSelected : m_clrButtonNormal;
  143. }
  144. COLORREF CXTPTabPaintManager::CColorSet::FillPropertyButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem)
  145. {
  146. COLORREF clr = GetItemColor(pItem);
  147. pDC->FillSolidRect(rcItem, clr);
  148. return clr;
  149. }
  150. void CXTPTabPaintManager::CColorSet::FillStateButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem)
  151. {
  152. if (!pItem->IsSelected())
  153. {
  154. if (pItem->GetTabManager()->IsHorizontalPosition())
  155. pDC->Draw3dRect(rcItem.right, rcItem.top + 2, 2, rcItem.Height() - 4, GetXtremeColor(COLOR_3DSHADOW), GetXtremeColor(COLOR_3DHIGHLIGHT));
  156. else
  157. pDC->Draw3dRect(rcItem.left + 2, rcItem.bottom, rcItem.Width() - 4, 2, GetXtremeColor(COLOR_3DSHADOW), GetXtremeColor(COLOR_3DHIGHLIGHT));
  158. }
  159. else
  160. {
  161. if (m_pPaintManager->m_bOneNoteColors)
  162. {
  163. pDC->FillSolidRect(rcItem, GetItemColor(pItem));
  164. }
  165. else
  166. {
  167. GradientFill(pDC, rcItem, m_csStateButton.clrFace.clrLight, m_csStateButton.clrFace.clrDark, pItem->GetTabManager()->GetPosition());
  168. }
  169. pDC->Draw3dRect(rcItem, m_csStateButton.clrBorder.clrLight, m_csStateButton.clrBorder.clrDark);
  170. }
  171. }
  172. //////////////////////////////////////////////////////////////////////////
  173. // CColorSetDefault
  174. void CXTPTabPaintManager::CColorSetDefault::RefreshMetrics()
  175. {
  176. CColorSet::RefreshMetrics();
  177. m_csStateButton.clrFace.SetStandardValue(XTP_TABMANAGER_COLOR_SHADED);
  178. m_csStateButton.clrBorder.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW), GetXtremeColor(COLOR_3DHIGHLIGHT));
  179. m_csExcelSelected.clrRightInnerBorder.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  180. m_csExcelSelected.clrLeftInnerBorder.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  181. m_csExcelSelected.clrTopInnerBorder.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  182. m_csExcelSelected.clrLeftOuterBorder.SetStandardValue(GetXtremeColor(COLOR_WINDOW));
  183. m_csExcelSelected.clrTopOuterBorder.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW));
  184. m_csExcelSelected.clrRightOuterBorder.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW));
  185. m_csExcelNormal = m_csExcelSelected;
  186. m_csExcelNormal.clrLeftOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  187. m_csExcelNormal.clrRightOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  188. m_csExcelNormal.clrTopOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  189. if (m_pPaintManager->GetAppearance() == xtpTabAppearanceExcel)
  190. {
  191. m_clrButtonSelected.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  192. m_clrButtonNormal.SetStandardValue(GetXtremeColor(COLOR_WINDOW));
  193. m_clrFrameBorder.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  194. }
  195. }
  196. void CXTPTabPaintManager::CColorSetDefault::FillNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc)
  197. {
  198. COLORREF clrFrameTopLeft = GetXtremeColor(COLOR_3DSHADOW), clrFrameBottomRight = GetXtremeColor(COLOR_BTNHIGHLIGHT);
  199. if (pButton->IsEnabled())
  200. {
  201. if (pButton->IsPressed())
  202. {
  203. pDC->Draw3dRect(rc, clrFrameTopLeft, clrFrameBottomRight);
  204. rc.OffsetRect(1, 1);
  205. }
  206. else if (pButton->IsHighlighted())
  207. pDC->Draw3dRect(rc, clrFrameBottomRight, clrFrameTopLeft);
  208. }
  209. pDC->SetTextColor(GetXtremeColor(COLOR_BTNTEXT));
  210. }
  211. //////////////////////////////////////////////////////////////////////////
  212. // CColorSetVisualStudio
  213. void CXTPTabPaintManager::CColorSetVisualStudio::RefreshMetrics()
  214. {
  215. CColorSet::RefreshMetrics();
  216. if (m_pPaintManager->GetAppearance() != xtpTabAppearanceExcel && m_pPaintManager->GetAppearance() != xtpTabAppearanceStateButtons)
  217. m_clrHeaderFace.SetStandardValue(GetXtremeColor(XPCOLOR_TAB_INACTIVE_BACK));
  218. if (m_pPaintManager->GetAppearance() == xtpTabAppearanceVisualStudio)
  219. {
  220. m_clrInActiveText.SetStandardValue(GetXtremeColor(XPCOLOR_TAB_INACTIVE_TEXT));
  221. m_clrNormalText.SetStandardValue(GetXtremeColor(XPCOLOR_TAB_INACTIVE_TEXT));
  222. }
  223. m_clrAutoHideFace.SetStandardValue(XTPDrawHelpers()->IsLowResolution() ? GetXtremeColor(COLOR_3DFACE) : m_clrHeaderFace);
  224. }
  225. void CXTPTabPaintManager::CColorSetVisualStudio::FillNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc)
  226. {
  227. if (m_pPaintManager->GetAppearance() == xtpTabAppearanceExcel || m_pPaintManager->GetAppearance() == xtpTabAppearanceStateButtons)
  228. {
  229. CColorSetDefault::FillNavigateButton(pDC, pButton, rc);
  230. return;
  231. }
  232. COLORREF clrFrameTopLeft = GetXtremeColor(COLOR_BTNTEXT), clrFrameBottomRight = GetXtremeColor(COLOR_3DFACE);
  233. if (pButton->IsEnabled())
  234. {
  235. if (pButton->IsPressed())
  236. {
  237. pDC->Draw3dRect(rc, clrFrameTopLeft, clrFrameBottomRight);
  238. rc.OffsetRect(1, 1);
  239. }
  240. else if (pButton->IsHighlighted())
  241. pDC->Draw3dRect(rc, clrFrameBottomRight, clrFrameTopLeft);
  242. }
  243. pDC->SetTextColor(GetXtremeColor(XPCOLOR_TAB_INACTIVE_TEXT));
  244. }
  245. //////////////////////////////////////////////////////////////////////////
  246. // CColorSetOffice2003
  247. void CXTPTabPaintManager::CColorSetOffice2003::RefreshMetrics()
  248. {
  249. CColorSet::RefreshMetrics();
  250. m_clrHeaderFace.SetStandardValue(GetXtremeColor(COLOR_3DFACE), XTPColorManager()->LightColor(GetXtremeColor(COLOR_3DFACE), GetXtremeColor(COLOR_WINDOW), 0xcd));
  251. m_csStateButton.clrFace.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_CHECKED));
  252. m_csStateButton.clrBorder.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_CHECKED_BORDER));
  253. m_clrButtonHighlighted.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_CHECKED));
  254. m_clrButtonPressed.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_PUSHED));
  255. m_clrHighlightText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  256. m_clrAutoHideFace = m_clrHeaderFace;
  257. m_bLunaTheme = FALSE;
  258. if (!m_pPaintManager->IsLunaColorsDisabled())
  259. {
  260. XTPCurrentSystemTheme systemTheme = XTPColorManager()->GetCurrentSystemTheme();
  261. switch (systemTheme)
  262. {
  263. case xtpSystemThemeBlue:
  264. case xtpSystemThemeRoyale:
  265. case xtpSystemThemeAero:
  266. m_clrFrameBorder.SetStandardValue(RGB(59, 97, 156));
  267. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(RGB(59, 97, 156));
  268. m_csPropertyPage.clrDarkShadow.SetStandardValue(RGB(0, 53, 154));
  269. m_csPropertyPage2003.clrDarkShadow.SetStandardValue(RGB(0, 53, 154));
  270. m_csPropertyPage.clrShadow.SetStandardValue(RGB(117, 166, 241));
  271. m_csPropertyPage2003.clrBorderLeftHighlight.SetStandardValue(RGB(117, 166, 241));
  272. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(RGB(255, 255, 255));
  273. m_csStateButton.clrFace.SetStandardValue(RGB(255, 192, 111));
  274. m_csStateButton.clrBorder.SetStandardValue(RGB(0, 0, 128));
  275. m_clrHeaderFace.SetStandardValue(RGB(196, 218, 250), RGB(252, 253, 254));
  276. m_clrButtonNormal.SetStandardValue(RGB(162, 192, 246));
  277. m_clrButtonSelected.SetStandardValue(RGB(255, 194, 115));
  278. m_clrButtonHighlighted.SetStandardValue(RGB(255, 240, 201));
  279. m_clrAutoHideFace.SetStandardValue(RGB(158, 190, 245), RGB(196, 218, 250));
  280. m_clrNavigateButtonBorder.SetStandardValue(RGB(0, 0, 128));
  281. m_bLunaTheme = TRUE;
  282. break;
  283. case xtpSystemThemeOlive:
  284. m_clrFrameBorder.SetStandardValue(RGB(96, 128, 88));
  285. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(RGB(96, 128, 88));
  286. m_csPropertyPage.clrDarkShadow.SetStandardValue(RGB(96, 119, 107));
  287. m_csPropertyPage2003.clrDarkShadow.SetStandardValue(RGB(96, 119, 107));
  288. m_csPropertyPage.clrShadow.SetStandardValue(RGB(176, 194, 140));
  289. m_csPropertyPage2003.clrBorderLeftHighlight.SetStandardValue(RGB(176, 194, 140));
  290. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(RGB(255, 255, 255));
  291. m_csStateButton.clrFace.SetStandardValue(RGB(255, 192, 111));
  292. m_csStateButton.clrBorder.SetStandardValue(RGB(63, 93, 56));
  293. m_clrHeaderFace.SetStandardValue(RGB(242, 241, 228), RGB(252, 254, 254));
  294. m_clrButtonNormal.SetStandardValue(RGB(208, 222, 170));
  295. m_clrButtonSelected.SetStandardValue(RGB(255, 194, 115));
  296. m_clrButtonHighlighted.SetStandardValue(RGB(255, 240, 199));
  297. m_clrAutoHideFace.SetStandardValue(RGB(217, 217, 167), RGB(242, 241, 228));
  298. m_clrNavigateButtonBorder.SetStandardValue(RGB(63, 93, 56));
  299. m_bLunaTheme = TRUE;
  300. break;
  301. case xtpSystemThemeSilver:
  302. m_clrFrameBorder.SetStandardValue(RGB(124, 124, 148));
  303. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(RGB(124, 124, 148));
  304. m_csPropertyPage.clrDarkShadow.SetStandardValue(RGB(118, 116, 146));
  305. m_csPropertyPage2003.clrDarkShadow.SetStandardValue(RGB(118, 116, 146));
  306. m_csPropertyPage.clrShadow.SetStandardValue(RGB(186, 185, 206));
  307. m_csPropertyPage2003.clrBorderLeftHighlight.SetStandardValue(RGB(186, 185, 206));
  308. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(RGB(255, 255, 255));
  309. m_csStateButton.clrFace.SetStandardValue(RGB(255, 192, 111));
  310. m_csStateButton.clrBorder.SetStandardValue(RGB(75, 75, 111));
  311. m_clrHeaderFace.SetStandardValue(RGB(243, 243, 247), RGB(252, 254, 254));
  312. m_clrButtonNormal.SetStandardValue(RGB(217, 217, 230));
  313. m_clrButtonSelected.SetStandardValue(RGB(255, 194, 115));
  314. m_clrButtonHighlighted.SetStandardValue(RGB(255, 238, 194));
  315. m_clrAutoHideFace.SetStandardValue(RGB(215, 215, 229), RGB(243, 243, 247));
  316. m_clrNavigateButtonBorder.SetStandardValue(RGB(75, 75, 111));
  317. m_bLunaTheme = TRUE;
  318. break;
  319. default:
  320. m_clrButtonSelected.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_CHECKED));
  321. }
  322. }
  323. if (m_bLunaTheme)
  324. {
  325. m_clrButtonPressed.SetStandardValue(RGB(254, 142, 75));
  326. }
  327. m_csExcelSelected.clrRightInnerBorder.SetStandardValue(m_clrFrameBorder);
  328. m_csExcelSelected.clrLeftInnerBorder.SetStandardValue(m_clrFrameBorder);
  329. m_csExcelSelected.clrTopInnerBorder.SetStandardValue(m_clrFrameBorder);
  330. m_csExcelSelected.clrTopOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  331. m_csExcelSelected.clrRightOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  332. m_csExcelSelected.clrLeftOuterBorder.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  333. m_csExcelNormal = m_csExcelSelected;
  334. if (m_pPaintManager->GetAppearance() == xtpTabAppearanceStateButtons)
  335. {
  336. m_clrAutoHideFace.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  337. m_clrHeaderFace.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  338. }
  339. }
  340. void CXTPTabPaintManager::CColorSetOffice2003::Rectangle(CDC* pDC, CRect rc, int nPen, int nBrush)
  341. {
  342. pDC->FillSolidRect(rc, GetXtremeColor(nBrush));
  343. pDC->Draw3dRect(rc, GetXtremeColor(nPen), GetXtremeColor(nPen));
  344. }
  345. void CXTPTabPaintManager::CColorSetOffice2003::FillNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc)
  346. {
  347. int nColor = COLOR_BTNTEXT;
  348. if (pButton->IsEnabled())
  349. {
  350. if ((pButton->IsHighlighted() && pButton->IsPressed()))
  351. {
  352. if (!m_bLunaTheme)
  353. {
  354. Rectangle(pDC, rc, XPCOLOR_HIGHLIGHT_PUSHED_BORDER, XPCOLOR_HIGHLIGHT_PUSHED);
  355. nColor = XPCOLOR_PUSHED_TEXT;
  356. }
  357. else
  358. {
  359. XTPDrawHelpers()->GradientFill(pDC, rc, RGB(254, 142, 75), RGB(255, 207, 139), FALSE);
  360. pDC->Draw3dRect(rc, m_clrNavigateButtonBorder, m_clrNavigateButtonBorder);
  361. }
  362. }
  363. else if (pButton->IsPressed() || pButton->IsHighlighted())
  364. {
  365. if (!m_bLunaTheme)
  366. {
  367. Rectangle(pDC, rc, XPCOLOR_HIGHLIGHT_BORDER, XPCOLOR_HIGHLIGHT);
  368. nColor = XPCOLOR_HIGHLIGHT_TEXT;
  369. }
  370. else
  371. {
  372. XTPDrawHelpers()->GradientFill(pDC, rc, RGB(255, 242, 200), RGB(255, 212, 151), FALSE);
  373. pDC->Draw3dRect(rc, m_clrNavigateButtonBorder, m_clrNavigateButtonBorder);
  374. }
  375. }
  376. }
  377. pDC->SetTextColor(GetXtremeColor(nColor));
  378. }
  379. COLORREF CXTPTabPaintManager::CColorSetOffice2003::FillPropertyButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem)
  380. {
  381. COLORREF clrItem = GetItemColor(pItem);
  382. if (pItem->IsPressed())
  383. {
  384. clrItem = m_clrButtonPressed;
  385. }
  386. else if (pItem->IsHighlighted())
  387. {
  388. clrItem = m_clrButtonHighlighted;
  389. }
  390. GradientFill(pDC, rcItem, XTPColorManager()->LightColor(clrItem, RGB(255, 255, 255), 300),
  391. clrItem, pItem->GetTabManager()->GetPosition());
  392. return clrItem;
  393. }
  394. void CXTPTabPaintManager::CColorSetOffice2007::RefreshMetrics()
  395. {
  396. CColorSetOffice2003::RefreshMetrics();
  397. if (XTPOffice2007Images()->IsValid())
  398. {
  399. m_clrHighlightText.SetStandardValue(0);
  400. m_clrFrameBorder.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("TabManager"), _T("FrameBorder")));
  401. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(m_clrFrameBorder);
  402. m_csPropertyPage.clrDarkShadow.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("TabManager"), _T("DarkShadow")));
  403. m_csPropertyPage2003.clrDarkShadow.SetStandardValue(m_csPropertyPage.clrDarkShadow);
  404. m_csPropertyPage.clrShadow.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("TabManager"), _T("LightShadow")));
  405. m_csPropertyPage2003.clrBorderLeftHighlight.SetStandardValue(m_csPropertyPage.clrShadow);
  406. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(RGB(255, 255, 255));
  407. m_clrHeaderFace.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Ribbon"), _T("RibbonFace")));
  408. m_clrAutoHideFace.SetStandardValue(m_clrHeaderFace);
  409. m_clrButtonNormal.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Window"), _T("ButtonFace")));
  410. m_clrButtonSelected.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Window"), _T("HighlightChecked")));
  411. m_clrButtonHighlighted.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Window"), _T("HighlightSelected")));
  412. m_clrNavigateButtonBorder.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Window"), _T("WindowFrame")));
  413. m_clrHighlightText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Ribbon"), _T("TabNormalText")));
  414. m_clrNormalText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Ribbon"), _T("TabNormalText")));
  415. m_clrSelectedText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Ribbon"), _T("TabSelectedText")));
  416. }
  417. else
  418. {
  419. m_clrButtonPressed.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_PUSHED));
  420. m_clrHighlightText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  421. m_clrFrameBorder.SetStandardValue(RGB(59, 97, 156));
  422. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(m_clrFrameBorder);
  423. m_csPropertyPage.clrDarkShadow.SetStandardValue(RGB(0, 53, 154));
  424. m_csPropertyPage2003.clrDarkShadow.SetStandardValue(RGB(0, 53, 154));
  425. m_csPropertyPage.clrShadow.SetStandardValue(RGB(117, 166, 241));
  426. m_csPropertyPage2003.clrBorderLeftHighlight.SetStandardValue(RGB(117, 166, 241));
  427. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(RGB(255, 255, 255));
  428. m_csStateButton.clrFace.SetStandardValue(RGB(255, 192, 111));
  429. m_csStateButton.clrBorder.SetStandardValue(RGB(0, 0, 128));
  430. m_clrHeaderFace.SetStandardValue(RGB(196, 218, 250), RGB(252, 253, 254));
  431. m_clrButtonNormal.SetStandardValue(RGB(162, 192, 246));
  432. m_clrButtonSelected.SetStandardValue(RGB(255, 194, 115));
  433. m_clrButtonHighlighted.SetStandardValue(RGB(255, 240, 201));
  434. m_clrAutoHideFace.SetStandardValue(RGB(158, 190, 245), RGB(196, 218, 250));
  435. m_clrNavigateButtonBorder.SetStandardValue(RGB(0, 0, 128));
  436. }
  437. m_clrButtonText.SetStandardValue(m_clrNormalText);
  438. m_bLunaTheme = TRUE;
  439. }
  440. void CXTPTabPaintManager::CColorSetOffice2007::FillNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc)
  441. {
  442. if (!XTPOffice2007Images()->IsValid())
  443. {
  444. CColorSetDefault::FillNavigateButton(pDC, pButton, rc);
  445. return;
  446. }
  447. if (pButton->GetItem() == NULL) pDC->SetTextColor(m_clrButtonText);
  448. if (pButton->IsEnabled() && (pButton->IsPressed() || pButton->IsHighlighted()))
  449. {
  450. CXTPOffice2007Image* pImage = XTPOffice2007Images()->LoadFile(_T("TOOLBARBUTTONS22"));
  451. ASSERT(pImage);
  452. if (!pImage)
  453. return;
  454. int nState = pButton->IsPressed() ? 1 : 0;
  455. pImage->DrawImage(pDC, rc, pImage->GetSource(nState, 4), CRect(8, 8, 8, 8), COLORREF_NULL);
  456. pDC->SetTextColor(0);
  457. }
  458. }
  459. //////////////////////////////////////////////////////////////////////////
  460. //
  461. void CXTPTabPaintManager::CColorSetAccess2007::RefreshMetrics()
  462. {
  463. CColorSetOffice2007::RefreshMetrics();
  464. if (XTPOffice2007Images()->IsValid())
  465. {
  466. m_clrSelectedText.SetStandardValue(0);
  467. m_clrNormalText.SetStandardValue(0);
  468. m_clrHighlightText.SetStandardValue(0);
  469. m_clrFrameBorder.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("TabManager"), _T("AccessBorder")));
  470. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(m_clrFrameBorder);
  471. m_clrHeaderFace.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("TabManager"), _T("AccessHeader")));
  472. m_clrAutoHideFace.SetStandardValue(m_clrHeaderFace);
  473. m_clrButtonText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("Ribbon"), _T("TabNormalText")));
  474. }
  475. }
  476. //////////////////////////////////////////////////////////////////////////
  477. // CColorSetWinXP
  478. void CXTPTabPaintManager::CColorSetWinXP::RefreshMetrics()
  479. {
  480. CColorSetDefault::RefreshMetrics();
  481. m_themeTabButton.OpenThemeData(0, L"TAB");
  482. if (m_themeTabButton.IsAppThemed())
  483. {
  484. m_csPropertyPage.clrHighlight.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  485. m_csPropertyPage.clrShadow.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  486. m_csPropertyPage.clrDarkShadow.SetStandardValue(XTP_TABMANAGER_COLOR_NONE);
  487. m_clrHighlightText = m_clrNormalText;
  488. COLORREF clrClientFace = m_clrPaneFace;
  489. if (SUCCEEDED(m_themeTabButton.GetThemeColor(TABP_PANE, 0, TMT_FILLCOLORHINT, &clrClientFace)))
  490. {
  491. m_clrPaneFace.SetStandardValue(clrClientFace);
  492. }
  493. }
  494. m_themeToolbar.OpenThemeData(0, L"TOOLBAR");
  495. }
  496. BOOL CXTPTabPaintManager::CColorSetWinXP::IsAppThemed() const
  497. {
  498. return m_themeTabButton.IsAppThemed();
  499. }
  500. void CXTPTabPaintManager::CColorSetWinXP::DrawRotatedBitsBottom(int cx, int cy, UINT* pSrcBits, UINT* pDestBits)
  501. {
  502. UINT* pSrc = &pSrcBits[cx * (cy - 1)];
  503. for (int i = 0; i < cy; i++)
  504. {
  505. pSrcBits = pSrc;
  506. for (int j = 0; j < cx; j++)
  507. {
  508. *pDestBits++ = *pSrcBits++;
  509. }
  510. pSrc -= cx;
  511. }
  512. }
  513. void CXTPTabPaintManager::CColorSetWinXP::DrawRotatedBitsInvertRight(int cx, int cy, UINT* pSrcBits, UINT* pDestBits)
  514. {
  515. UINT* pSrc = pSrcBits;
  516. UINT* pDest = pDestBits + cx - 1;
  517. for (int i = 0; i < cx; i++)
  518. {
  519. pSrcBits = pSrc;
  520. pDestBits = pDest;
  521. for (int j = 0; j < cy; j++)
  522. {
  523. *pDestBits = *pSrcBits;
  524. pSrcBits++;
  525. pDestBits += cx;
  526. }
  527. pSrc += cy;
  528. pDest -= 1;
  529. }
  530. }
  531. void CXTPTabPaintManager::CColorSetWinXP::DrawRotatedBitsRight(int cx, int cy, UINT* pSrcBits, UINT* pDestBits)
  532. {
  533. UINT* pSrc = pSrcBits;
  534. UINT* pDest = pDestBits + cx * cy - cx;
  535. for (int i = 0; i < cy; i++)
  536. {
  537. pSrcBits = pSrc;
  538. pDestBits = pDest;
  539. for (int j = 0; j < cx; j++)
  540. {
  541. *pDestBits++ = *pSrcBits;
  542. pSrcBits += cy;
  543. }
  544. pSrc += 1;
  545. pDest -= cx;
  546. }
  547. }
  548. void CXTPTabPaintManager::CColorSetWinXP::DrawRotatedBitsLeft(int cx, int cy, UINT* pSrcBits, UINT* pDestBits)
  549. {
  550. UINT* pSrc = pSrcBits;
  551. pDestBits += cx * cy - 1;
  552. for (int i = 0; i < cy; i++)
  553. {
  554. pSrcBits = pSrc;
  555. for (int j = 0; j < cx; j++)
  556. {
  557. *pDestBits-- = *pSrcBits;
  558. pSrcBits += cy;
  559. }
  560. pSrc += 1;
  561. }
  562. }
  563. void CXTPTabPaintManager::CColorSetWinXP::DrawRotatedButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem, BOOL bSwap, LPFNDRAWROTATEDBITS pfnRotatedProc)
  564. {
  565. const int cx = rcItem.Width();
  566. const int cy = rcItem.Height();
  567. UINT* pSrcBits = NULL;
  568. HBITMAP hbmSrc = CXTPImageManager::Create32BPPDIBSection(NULL, bSwap ? cy : cx, bSwap ? cx : cy, (LPBYTE*)&pSrcBits);
  569. if (!pSrcBits)
  570. return;
  571. UINT* pDestBits = NULL;
  572. HBITMAP hbmDest = CXTPImageManager::Create32BPPDIBSection(NULL, cx, cy, (LPBYTE*)&pDestBits);
  573. if (!pDestBits)
  574. return;
  575. CDC dc;
  576. dc.CreateCompatibleDC(NULL);
  577. HGDIOBJ hbmpOld = ::SelectObject(dc, hbmSrc);
  578. CRect rcDraw(0, 0, bSwap ? cy: cx, bSwap ? cx : cy);
  579. dc.FillSolidRect(rcDraw, GetXtremeColor(COLOR_3DFACE));
  580. m_themeTabButton.DrawThemeBackground(dc.GetSafeHdc(), pItem->GetIndex() == 0 ? TABP_TOPTABITEMLEFTEDGE :
  581. pItem->GetIndex() == pItem->GetTabManager()->GetItemCount() - 1 && !pItem->IsSelected() ? TABP_TOPTABITEMRIGHTEDGE : TABP_TOPTABITEM,
  582. pItem->IsSelected() ? TIS_SELECTED: pItem->IsHighlighted() ? TIS_HOT : TIS_NORMAL, &rcDraw, 0);
  583. (*pfnRotatedProc)(cx, cy, pSrcBits, pDestBits);
  584. pDC->DrawState(rcItem.TopLeft(), rcItem.Size(), hbmDest, DST_BITMAP);
  585. ::SelectObject(dc, hbmpOld);
  586. DeleteObject(hbmSrc);
  587. DeleteObject(hbmDest);
  588. }
  589. COLORREF CXTPTabPaintManager::CColorSetWinXP::FillPropertyButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem)
  590. {
  591. if (!m_themeTabButton.IsAppThemed())
  592. return CColorSetDefault::FillPropertyButton(pDC, rcItem, pItem);
  593. if (pItem->IsSelected())
  594. {
  595. switch (pItem->GetTabManager()->GetPosition())
  596. {
  597. case xtpTabPositionTop:
  598. rcItem.InflateRect(0, 0, 0, 2);
  599. break;
  600. case xtpTabPositionLeft:
  601. rcItem.InflateRect(0, 0, 1, 0);
  602. break;
  603. }
  604. }
  605. switch (pItem->GetTabManager()->GetPosition())
  606. {
  607. case xtpTabPositionTop:
  608. rcItem.InflateRect(1, 1, 1, 0);
  609. m_themeTabButton.DrawThemeBackground(pDC->GetSafeHdc(),
  610. pItem->GetIndex() == 0 ? TABP_TOPTABITEMLEFTEDGE :
  611. pItem->GetIndex() == pItem->GetTabManager()->GetItemCount() - 1 && !pItem->IsSelected() ? TABP_TOPTABITEMRIGHTEDGE : TABP_TOPTABITEM,
  612. pItem->IsSelected() ? TIS_SELECTED : pItem->IsHighlighted() ? TIS_HOT : TIS_NORMAL, &rcItem, 0);
  613. break;
  614. case xtpTabPositionBottom:
  615. rcItem.InflateRect(1, 0, 1, 2);
  616. DrawRotatedButton(pDC, rcItem, pItem, FALSE, DrawRotatedBitsBottom);
  617. break;
  618. case xtpTabPositionLeft:
  619. rcItem.InflateRect(1, 1, 0, 1);
  620. DrawRotatedButton(pDC, rcItem, pItem, TRUE, DrawRotatedBitsLeft);
  621. break;
  622. case xtpTabPositionRight:
  623. rcItem.InflateRect(0, 1, 2, 1);
  624. DrawRotatedButton(pDC, rcItem, pItem, TRUE, DrawRotatedBitsRight);
  625. break;
  626. }
  627. return XTP_TABMANAGER_COLOR_NONE;
  628. }
  629. COLORREF CXTPTabPaintManager::CColorSetWinXP::FillClient(CDC* pDC, CRect rc, CXTPTabManager* pTabManager)
  630. {
  631. if (!m_themeTabButton.IsAppThemed())
  632. return CColorSetDefault::FillClient(pDC, rc, pTabManager);
  633. switch (pTabManager->GetPosition())
  634. {
  635. case xtpTabPositionBottom:
  636. rc.InflateRect(0, 0, 0, 1);
  637. break;
  638. case xtpTabPositionRight:
  639. rc.InflateRect(0, 0, 1, 0);
  640. break;
  641. }
  642. m_themeTabButton.DrawThemeBackground(pDC->GetSafeHdc(), TABP_PANE, 0, &rc, 0);
  643. return 0;
  644. }
  645. void CXTPTabPaintManager::CColorSetWinXP::SelectClipRgn(CDC* pDC, CRect rcClient, CXTPTabManager* pTabManager)
  646. {
  647. if (!m_themeTabButton.IsAppThemed())
  648. {
  649. CColorSetDefault::SelectClipRgn(pDC, rcClient, pTabManager);
  650. return;
  651. }
  652. CRect rc = m_pPaintManager->GetAppearanceSet()->GetClientRect(rcClient, pTabManager);
  653. switch (pTabManager->GetPosition())
  654. {
  655. case xtpTabPositionBottom:
  656. pDC->ExcludeClipRect(rc.left, rc.bottom - 2, rc.left + 1, rc.bottom - 1);
  657. break;
  658. case xtpTabPositionTop:
  659. case xtpTabPositionLeft:
  660. pDC->ExcludeClipRect(rc.left, rc.top, rc.left + 1, rc.top + 1);
  661. break;
  662. case xtpTabPositionRight:
  663. pDC->ExcludeClipRect(rc.right - 2, rc.top, rc.right - 1, rc.top + 1);
  664. break;
  665. }
  666. }
  667. void CXTPTabPaintManager::CColorSetWinXP::FillNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc)
  668. {
  669. if (!m_themeToolbar.IsAppThemed())
  670. {
  671. CColorSetDefault::FillNavigateButton(pDC, pButton, rc);
  672. return;
  673. }
  674. if (pButton->IsEnabled())
  675. {
  676. m_themeToolbar.DrawThemeBackground(pDC->GetSafeHdc(), TP_BUTTON,
  677. pButton->IsPressed() ? TS_PRESSED :
  678. pButton->IsHighlighted() ? TS_HOT : TS_NORMAL, &rc, 0);
  679. }
  680. pDC->SetTextColor(GetXtremeColor(COLOR_BTNTEXT));
  681. }
  682. void CXTPTabPaintManager::CColorSetWinXP::FillStateButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem)
  683. {
  684. if (!m_themeToolbar.IsAppThemed() || !pItem->IsSelected())
  685. {
  686. CColorSetDefault::FillStateButton(pDC, rcItem, pItem);
  687. return;
  688. }
  689. m_themeToolbar.DrawThemeBackground(pDC->GetSafeHdc(), TP_BUTTON,
  690. pItem->IsHighlighted() ? TS_HOTCHECKED : TS_CHECKED, &rcItem, 0);
  691. }
  692. //////////////////////////////////////////////////////////////////////////
  693. // void CXTPTabPaintManager::CColorSetWhidbey
  694. CXTPTabPaintManager::CColorSetWhidbey::CColorSetWhidbey()
  695. {
  696. m_bGradientButton = FALSE;
  697. }
  698. void CXTPTabPaintManager::CColorSetWhidbey::RefreshMetrics()
  699. {
  700. CColorSet::RefreshMetrics();
  701. m_clrButtonSelected.SetStandardValue(GetXtremeColor(COLOR_WINDOW));
  702. m_clrSelectedText.SetStandardValue(GetXtremeColor(COLOR_WINDOWTEXT));
  703. m_bLunaTheme = FALSE;
  704. m_bGradientButton = FALSE;
  705. m_clrButtonHighlighted.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_CHECKED));
  706. m_clrButtonPressed.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_PUSHED));
  707. m_clrHighlightText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  708. if (!m_pPaintManager->IsLunaColorsDisabled())
  709. {
  710. CColorSetOffice2003::RefreshMetrics();
  711. }
  712. else
  713. {
  714. switch (XTPColorManager()->GetCurrentSystemTheme())
  715. {
  716. case xtpSystemThemeBlue:
  717. case xtpSystemThemeOlive:
  718. m_clrHeaderFace.SetStandardValue(RGB(228, 226, 213));
  719. m_bGradientButton = TRUE;
  720. break;
  721. case xtpSystemThemeSilver:
  722. m_clrButtonNormal.SetStandardValue(RGB(245, 245, 248));
  723. m_clrHeaderFace.SetStandardValue(RGB(238, 238, 238));
  724. m_bGradientButton = TRUE;
  725. break;
  726. }
  727. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(GetXtremeColor(XPCOLOR_STATICFRAME));
  728. m_clrFrameBorder.SetStandardValue(GetXtremeColor(XPCOLOR_STATICFRAME));
  729. }
  730. }
  731. COLORREF CXTPTabPaintManager::CColorSetWhidbey::FillPropertyButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem)
  732. {
  733. COLORREF clrItem = GetItemColor(pItem);
  734. if (pItem->IsHighlighted())
  735. {
  736. clrItem = m_clrButtonHighlighted;
  737. }
  738. if (m_bGradientButton)
  739. {
  740. GradientFill(pDC, rcItem, XTPColorManager()->LightColor(clrItem, RGB(255, 255, 255), 300),
  741. clrItem, pItem->GetTabManager()->GetPosition());
  742. }
  743. else
  744. {
  745. pDC->FillSolidRect(rcItem, clrItem);
  746. }
  747. return clrItem;
  748. }
  749. //////////////////////////////////////////////////////////////////////////
  750. // void CXTPTabPaintManager::CColorSetWhidbey
  751. CXTPTabPaintManager::CColorSetVisualStudio2008::CColorSetVisualStudio2008()
  752. {
  753. m_bGradientButton = FALSE;
  754. }
  755. void CXTPTabPaintManager::CColorSetVisualStudio2008::RefreshMetrics()
  756. {
  757. CColorSet::RefreshMetrics();
  758. m_clrButtonSelected.SetStandardValue(GetXtremeColor(COLOR_WINDOW));
  759. m_clrSelectedText.SetStandardValue(GetXtremeColor(COLOR_WINDOWTEXT));
  760. m_bLunaTheme = FALSE;
  761. m_bGradientButton = FALSE;
  762. m_clrButtonHighlighted.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_CHECKED));
  763. m_clrButtonPressed.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_PUSHED));
  764. m_clrHighlightText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  765. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(GetXtremeColor(XPCOLOR_STATICFRAME));
  766. m_clrFrameBorder.SetStandardValue(GetXtremeColor(XPCOLOR_STATICFRAME));
  767. m_clrButtonSelected.SetStandardValue(GetXtremeColor(COLOR_BTNFACE));
  768. m_clrButtonHighlighted.SetStandardValue(GetXtremeColor(COLOR_WINDOW));
  769. m_clrButtonNormal.SetStandardValue(GetXtremeColor(COLOR_BTNFACE));
  770. m_clrHeaderFace.SetStandardValue(GetXtremeColor(COLOR_BTNFACE));
  771. if (!m_pPaintManager->IsLunaColorsDisabled())
  772. {
  773. CColorSetOffice2003::RefreshMetrics();
  774. }
  775. else
  776. {
  777. switch (XTPColorManager()->GetCurrentSystemTheme())
  778. {
  779. case xtpSystemThemeBlue:
  780. case xtpSystemThemeRoyale:
  781. m_clrButtonSelected.SetStandardValue(RGB(193, 210, 238));
  782. m_clrButtonHighlighted.SetStandardValue(RGB(167, 191, 227));
  783. m_clrFrameBorder.SetStandardValue(RGB(152, 181, 226));
  784. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(m_clrFrameBorder);
  785. m_bGradientButton = TRUE;
  786. break;
  787. case xtpSystemThemeAero:
  788. m_clrButtonSelected.SetStandardValue(RGB(210, 230, 250));
  789. m_clrButtonNormal.SetStandardValue(RGB(152, 180, 210));
  790. m_clrButtonHighlighted.SetStandardValue(RGB(129, 208, 241));
  791. m_clrFrameBorder.SetStandardValue(RGB(105, 161, 191));
  792. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(m_clrFrameBorder);
  793. m_bGradientButton = TRUE;
  794. break;
  795. case xtpSystemThemeOlive:
  796. m_clrButtonSelected.SetStandardValue(RGB(182, 198, 141));
  797. m_clrButtonHighlighted.SetStandardValue(RGB(175, 175, 142));
  798. m_clrFrameBorder.SetStandardValue(RGB(147, 160, 112));
  799. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(m_clrFrameBorder);
  800. m_bGradientButton = TRUE;
  801. break;
  802. case xtpSystemThemeSilver:
  803. m_clrButtonSelected.SetStandardValue(RGB(225, 226, 236));
  804. m_clrButtonHighlighted.SetStandardValue(RGB(255, 201, 128));
  805. m_clrFrameBorder.SetStandardValue(RGB(147, 145, 176));
  806. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(m_clrFrameBorder);
  807. m_bGradientButton = TRUE;
  808. break;
  809. }
  810. }
  811. }
  812. COLORREF CXTPTabPaintManager::CColorSetVisualStudio2008::FillPropertyButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem)
  813. {
  814. COLORREF clrItem = GetItemColor(pItem);
  815. if (pItem->IsHighlighted() && !pItem->IsSelected())
  816. {
  817. clrItem = m_clrButtonHighlighted;
  818. }
  819. if (m_bGradientButton || pItem->IsSelected())
  820. {
  821. GradientFill(pDC, rcItem, RGB(253, 253, 253), clrItem, pItem->GetTabManager()->GetPosition());
  822. }
  823. else
  824. {
  825. pDC->FillSolidRect(rcItem, clrItem);
  826. }
  827. return clrItem;
  828. }