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

对话框与窗口

开发平台:

Visual C++

  1. // XTPDockingPanePaintManager.cpp : implementation of the CXTPDockingPanePaintManager class.
  2. //
  3. // This file is a part of the XTREME DOCKINGPANE 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 "Resource.h"
  22. #include "Common/XTPVC80Helpers.h"
  23. #include "Common/XTPColorManager.h"
  24. #include "Common/XTPDrawHelpers.h"
  25. #include "Common/XTPOffice2007Image.h"
  26. #include "TabManager/XTPTabManager.h"
  27. #include "TabManager/XTPTabPaintManager.h"
  28. #include "XTPDockingPanePaintManager.h"
  29. #include "XTPDockingPaneManager.h"
  30. #include "XTPDockingPaneTabbedContainer.h"
  31. #include "XTPDockingPaneAutoHidePanel.h"
  32. #include "XTPDockingPane.h"
  33. #include "XTPDockingPaneMiniWnd.h"
  34. #include "XTPDockingPaneSplitterContainer.h"
  35. #include "XTPDockingPaneSidePanel.h"
  36. #ifdef _DEBUG
  37. #define new DEBUG_NEW
  38. #undef THIS_FILE
  39. static char THIS_FILE[] = __FILE__;
  40. #endif
  41. BOOL CXTPDockingPaneCaptionButton::IsVisible()
  42. {
  43. return m_pPane->IsCaptionButtonVisible(this);
  44. }
  45. AFX_INLINE void XTPDeflateRectDirection(CRect& rc, int left, int top, int right, int bottom, BOOL bVertical)
  46. {
  47. if (bVertical)
  48. {
  49. rc.DeflateRect(top, left, bottom, right);
  50. }
  51. else
  52. {
  53. rc.DeflateRect(left, top, right, bottom);
  54. }
  55. }
  56. AFX_INLINE int XTPGetRectDirectionHeight(const CRect& rc, BOOL bVertical)
  57. {
  58. return bVertical ? rc.Width() : rc.Height();
  59. }
  60. void XTPFillFramePartRect(CDC* pDC, CRect rc, CWnd* pWnd, CWnd* pParentFrame, const CXTPPaintManagerColorGradient& clrHeaderFace, BOOL bHoriz)
  61. {
  62. COLORREF clrLight = clrHeaderFace.clrDark, clrDark = clrHeaderFace.clrLight;
  63. CWnd* pFrame = pParentFrame;
  64. if (XTPColorManager()->IsLowResolution())
  65. {
  66. pDC->FillSolidRect(rc, clrDark);
  67. return;
  68. }
  69. if (pFrame)
  70. {
  71. CRect rcFrame;
  72. pFrame->GetWindowRect(&rcFrame);
  73. pWnd->ScreenToClient(&rcFrame);
  74. if (bHoriz)
  75. {
  76. float fWidth = (float)max(rcFrame.Width(), GetSystemMetrics(SM_CXFULLSCREEN)/ 2);
  77. COLORREF clr1 = XTPDrawHelpers()->BlendColors(clrLight, clrDark, float(rc.left - rcFrame.left) / fWidth);
  78. COLORREF clr2 = XTPDrawHelpers()->BlendColors(clrLight, clrDark, float(rc.right - rcFrame.left) / fWidth);
  79. XTPDrawHelpers()->GradientFill(pDC, rc, clr1, clr2, TRUE);
  80. }
  81. else
  82. {
  83. float fHeight = (float)rcFrame.Height();
  84. COLORREF clr1 = XTPDrawHelpers()->BlendColors(clrLight, clrDark, float(rc.top - rcFrame.top) / fHeight);
  85. COLORREF clr2 = XTPDrawHelpers()->BlendColors(clrLight, clrDark, float(rc.bottom - rcFrame.top) / fHeight);
  86. XTPDrawHelpers()->GradientFill(pDC, rc, clr1, clr2, FALSE);
  87. }
  88. }
  89. }
  90. void AFX_CDECL CXTPDockingPaneCaptionButton::DrawPinnButton(CDC* pDC, CPoint pt, BOOL bPinned)
  91. {
  92. pt.y--;
  93. if (bPinned)
  94. {
  95. pDC->MoveTo(pt.x - 4, pt.y); pDC->LineTo(pt.x - 1, pt.y);
  96. pDC->MoveTo(pt.x - 1, pt.y - 3); pDC->LineTo(pt.x - 1, pt.y + 4);
  97. pDC->MoveTo(pt.x - 1, pt.y + 2); pDC->LineTo(pt.x + 3, pt.y + 2);
  98. pDC->LineTo(pt.x + 3, pt.y - 2); pDC->LineTo(pt.x - 1, pt.y - 2);
  99. pDC->MoveTo(pt.x - 1, pt.y + 1); pDC->LineTo(pt.x + 3, pt.y + 1);
  100. }
  101. else
  102. {
  103. pt.y += 2;
  104. pDC->MoveTo(pt.x - 3, pt.y - 1); pDC->LineTo(pt.x + 4, pt.y - 1);
  105. pDC->MoveTo(pt.x, pt.y - 1); pDC->LineTo(pt.x, pt.y + 3);
  106. pDC->MoveTo(pt.x - 2, pt.y - 1); pDC->LineTo(pt.x - 2, pt.y - 6);
  107. pDC->LineTo(pt.x + 2, pt.y - 6); pDC->LineTo(pt.x + 2, pt.y - 1);
  108. pDC->MoveTo(pt.x + 1, pt.y - 1); pDC->LineTo(pt.x + 1, pt.y - 6);
  109. }
  110. }
  111. void AFX_CDECL CXTPDockingPaneCaptionButton::DrawMaximizeRestoreButton(CDC* pDC, CPoint pt, BOOL bMaximize, COLORREF clr)
  112. {
  113. if (bMaximize)
  114. {
  115. pDC->Draw3dRect(pt.x - 5, pt.y - 5, 9, 9, clr, clr);
  116. pDC->FillSolidRect(pt.x - 5, pt.y - 5, 9, 2, clr);
  117. }
  118. else
  119. {
  120. pDC->Draw3dRect(pt.x - 4, pt.y - 2, 6, 6, clr, clr);
  121. pDC->FillSolidRect(pt.x - 4, pt.y - 2, 6, 2, clr);
  122. pDC->FillSolidRect(pt.x - 2, pt.y - 5, 6, 2, clr);
  123. pDC->SetPixel(pt.x - 2, pt.y - 3, clr);
  124. pDC->FillSolidRect(pt.x + 3, pt.y - 3, 1, 4, clr);
  125. pDC->SetPixel(pt.x + 2, pt.y, clr);
  126. }
  127. }
  128. void CXTPDockingPaneCaptionButton::InvalidateRect()
  129. {
  130. m_pPane->RedrawPane();
  131. }
  132. BOOL CXTPDockingPaneCaptionButton::IsEnabled() const
  133. {
  134. CXTPDockingPane* pPane = CXTPDockingPanePaintManager::GetSelectedPane(GetPane());
  135. if (pPane && ((pPane->GetEnabled() & xtpPaneEnableActions) == 0))
  136. return FALSE;
  137. return TRUE;
  138. }
  139. DWORD CXTPDockingPaneCaptionButton::Click (CWnd* pWnd, CPoint pt, BOOL bClient)
  140. {
  141. if ((::GetCapture() != NULL))
  142. return FALSE;
  143. pWnd->SetCapture();
  144. ASSERT(pWnd == CWnd::GetCapture());
  145. BOOL  bClick = FALSE;
  146. CRect rcBtn(m_rcButton);
  147. while (CWnd::GetCapture() == pWnd)
  148. {
  149. BOOL bNewDown = ::PtInRect (rcBtn, pt) != 0;
  150. if (bNewDown != m_bPressed)
  151. {
  152. m_bPressed = bNewDown;
  153. InvalidateRect();
  154. }
  155. MSG msg;
  156. VERIFY(::GetMessage(&msg, NULL, 0, 0));
  157. switch (msg.message)
  158. {
  159. case WM_NCMOUSEMOVE:
  160. break;
  161. case WM_MOUSEMOVE:
  162. pt = CPoint((short signed)LOWORD(msg.lParam), (short signed)HIWORD(msg.lParam));
  163. if (!bClient)
  164. {
  165. pWnd->ClientToScreen (&pt);
  166. CXTPDrawHelpers::ScreenToWindow(pWnd, &pt);
  167. }
  168. break;
  169. case WM_LBUTTONUP:
  170. bClick = m_bPressed;
  171. goto ExitLoop;
  172. case WM_KEYDOWN:
  173. if (msg.wParam != VK_ESCAPE)
  174. break;
  175. case WM_CANCELMODE:
  176. case WM_RBUTTONDOWN:
  177. goto ExitLoop;
  178. default:
  179. DispatchMessage (&msg);
  180. break;
  181. }
  182. }
  183. ExitLoop:
  184. ReleaseCapture();
  185. m_bPressed = FALSE;
  186. CheckForMouseOver (pt);
  187. InvalidateRect();
  188. return bClick;
  189. }
  190. void CXTPDockingPaneCaptionButton::SetRect (CRect rc)
  191. {
  192. ASSERT(m_pPane);
  193. if (!m_pPane)
  194. return;
  195. if (rc != m_rcButton)
  196. {
  197. m_rcButton = rc;
  198. m_pPane->OnCaptionButtonRectChanged(this);
  199. }
  200. }
  201. BOOL CXTPDockingPaneCaptionButton::CheckForMouseOver (CPoint pt)
  202. {
  203. if (!PtInRect (pt) && m_bSelected)
  204. {
  205. m_bSelected = FALSE;
  206. InvalidateRect();
  207. }
  208. if (!m_bSelected && PtInRect (pt) && IsEnabled())
  209. {
  210. TRACKMOUSEEVENT tme =
  211. {
  212. sizeof(TRACKMOUSEEVENT), TME_LEAVE, m_pPane->GetPaneHwnd()
  213. };
  214. _TrackMouseEvent(&tme);
  215. m_bSelected = TRUE;
  216. InvalidateRect();
  217. return TRUE;
  218. }
  219. return FALSE;
  220. }
  221. ///////////////////////////////////////////////////////////////////////////////
  222. // CXTPDockingPanePaintManager
  223. CXTPDockingPanePaintManager::CXTPDockingPanePaintManager()
  224. : m_bUseOfficeFont(FALSE)
  225. , m_strOfficeFont(_T("Tahoma"))
  226. {
  227. m_pTabPaintManager = new CXTPTabPaintManager();
  228. m_pTabPaintManager->SetLayout(xtpTabLayoutSizeToFit);
  229. m_pTabPaintManager->SetPosition(xtpTabPositionBottom);
  230. m_pTabPaintManager->m_clientFrame = xtpTabFrameSingleLine;
  231. m_pTabPaintManager->m_bBoldSelected = FALSE;
  232. m_pTabPaintManager->EnableToolTips();
  233. m_pPanelPaintManager = new CXTPTabPaintManager();
  234. m_pPanelPaintManager->SetLayout(xtpTabLayoutCompressed);
  235. m_pPanelPaintManager->m_clientFrame = xtpTabFrameNone;
  236. m_pPanelPaintManager->m_bBoldSelected = FALSE;
  237. m_pPanelPaintManager->m_bInvertGradient = TRUE;
  238. m_pPanelPaintManager->m_bFillBackground = FALSE;
  239. m_bDrawSingleTab = FALSE;
  240. m_nSplitterSize = 4;
  241. m_nSplitterIndent = 0;
  242. m_bDrawCaptionIcon = FALSE;
  243. m_rcCaptionMargin.SetRect(0, 2, 0, 1);
  244. m_nCaptionFontGap = 5;
  245. m_bShowCaption = TRUE;
  246. m_bUseStandardFont = TRUE;
  247. m_bHighlightActiveCaption = TRUE;
  248. m_systemTheme = xtpSystemThemeDefault;
  249. m_bUseBoldCaptionFont = TRUE;
  250. m_dwSplitterStyle = xtpPaneSplitterFlat;
  251. m_nCaptionButtonStyle = xtpPaneCaptionButtonDefault;
  252. m_nTitleHeight = 0;
  253. m_nTabsHeight = 0;
  254. m_bLunaTheme = FALSE;
  255. }
  256. DWORD CXTPDockingPanePaintManager::GetSplitterStyle() const
  257. {
  258. return m_dwSplitterStyle;
  259. }
  260. void CXTPDockingPanePaintManager::SetSplitterStyle(DWORD dwStyle)
  261. {
  262. m_dwSplitterStyle = dwStyle;
  263. m_nSplitterSize = dwStyle == xtpPaneSplitterFlat ? 4 : 7;
  264. }
  265. XTPCurrentSystemTheme CXTPDockingPanePaintManager::GetCurrentSystemTheme() const
  266. {
  267. if (m_systemTheme == xtpSystemThemeDefault)
  268. return XTPColorManager()->IsLunaColorsDisabled() ? xtpSystemThemeUnknown :
  269. XTPColorManager()->GetCurrentSystemTheme();
  270. if (m_systemTheme == xtpSystemThemeAuto)
  271. return XTPColorManager()->GetWinThemeWrapperTheme();
  272. return m_systemTheme;
  273. }
  274. void CXTPDockingPanePaintManager::SetLunaTheme(XTPCurrentSystemTheme systemTheme)
  275. {
  276. m_systemTheme = systemTheme;
  277. RefreshMetrics();
  278. }
  279. COLORREF CXTPDockingPanePaintManager::GetXtremeColor(UINT nIndex)
  280. {
  281. if (nIndex > XPCOLOR_LAST) return nIndex;
  282. return m_arrColor[nIndex];
  283. }
  284. void CXTPDockingPanePaintManager::SetColors(int cElements, CONST INT* lpaElements, CONST COLORREF* lpaRgbValues)
  285. {
  286. for (int i = 0; i < cElements; i++)
  287. m_arrColor[lpaElements[i]] = lpaRgbValues[i];
  288. }
  289. CXTPDockingPanePaintManager::~CXTPDockingPanePaintManager()
  290. {
  291. m_pTabPaintManager->InternalRelease();
  292. m_pPanelPaintManager->InternalRelease();
  293. }
  294. CXTPTabPaintManager* CXTPDockingPanePaintManager::SetTabPaintManager(CXTPTabPaintManager* pManager)
  295. {
  296. m_pTabPaintManager->InternalRelease();
  297. m_pTabPaintManager = pManager;
  298. m_pTabPaintManager->SetLayout(xtpTabLayoutSizeToFit);
  299. m_pTabPaintManager->SetPosition(xtpTabPositionBottom);
  300. m_pTabPaintManager->m_bBoldSelected = FALSE;
  301. m_pTabPaintManager->EnableToolTips();
  302. pManager->RefreshMetrics();
  303. return pManager;
  304. }
  305. CXTPTabPaintManager* CXTPDockingPanePaintManager::SetPanelPaintManager(CXTPTabPaintManager* pManager)
  306. {
  307. delete m_pPanelPaintManager;
  308. m_pPanelPaintManager = pManager;
  309. m_pPanelPaintManager->SetLayout(xtpTabLayoutCompressed);
  310. m_pPanelPaintManager->m_clientFrame = xtpTabFrameNone;
  311. m_pPanelPaintManager->m_bBoldSelected = FALSE;
  312. m_pPanelPaintManager->m_bInvertGradient = TRUE;
  313. m_pPanelPaintManager->m_bFillBackground = FALSE;
  314. pManager->RefreshMetrics();
  315. return pManager;
  316. }
  317. void CXTPDockingPanePaintManager::UseOfficeFont(BOOL bUseOfficeFont)
  318. {
  319. m_bUseOfficeFont = bUseOfficeFont;
  320. RefreshMetrics();
  321. }
  322. void CXTPDockingPanePaintManager::SetCaptionFontIndirect(LOGFONT* pLogFont, BOOL bUseStandardFont /*= FALSE*/)
  323. {
  324. m_bUseStandardFont = bUseStandardFont;
  325. if (!pLogFont)
  326. return;
  327. BOOL bUseSystemFont = (pLogFont->lfCharSet > SYMBOL_CHARSET);
  328. if (m_bUseOfficeFont && !bUseSystemFont && bUseStandardFont && XTPDrawHelpers()->FontExists(_T("Tahoma")))
  329. {
  330. STRCPY_S(pLogFont->lfFaceName, LF_FACESIZE, _T("Tahoma"));
  331. }
  332. m_fntTitle.DeleteObject();
  333. VERIFY(m_fntTitle.CreateFontIndirect(pLogFont));
  334. pLogFont->lfOrientation = 900;
  335. pLogFont->lfEscapement = 2700;
  336. pLogFont->lfHeight = pLogFont->lfHeight < 0 ? __min(-11, pLogFont->lfHeight) : pLogFont->lfHeight;
  337. STRCPY_S(pLogFont->lfFaceName, LF_FACESIZE, CXTPDrawHelpers::GetVerticalFontName(m_bUseOfficeFont));
  338. m_fntTitleVertical.DeleteObject();
  339. m_fntTitleVertical.CreateFontIndirect(pLogFont);
  340. CWindowDC dc(CWnd::GetDesktopWindow());
  341. CXTPFontDC font(&dc, &m_fntTitle);
  342. m_nTitleHeight = max(13, dc.GetTextExtent(_T(" "), 1).cy) + m_nCaptionFontGap;
  343. }
  344. void CXTPDockingPanePaintManager::RefreshMetrics()
  345. {
  346. RefreshXtremeColors();
  347. CXTPColorManager* pColorManager = XTPColorManager();
  348. for (int i = 0; i <= XPCOLOR_LAST; i++)
  349. m_arrColor[i] = pColorManager->GetColor(i);
  350. m_clrSplitterGripper.SetStandardValue(m_arrColor[COLOR_3DSHADOW]);
  351. m_clrSplitter.SetStandardValue(m_arrColor[COLOR_3DFACE]);
  352. m_clrSplitterGradient.SetStandardValue(GetSysColor(COLOR_3DFACE), XTPColorManager()->LightColor(GetSysColor(COLOR_3DFACE), GetSysColor(COLOR_WINDOW), 0xcd));
  353. m_clrDisabledCaptionText.SetStandardValue(m_arrColor[COLOR_GRAYTEXT]);
  354. if (m_bUseStandardFont)
  355. {
  356. NONCLIENTMETRICS ncm =
  357. {
  358. sizeof(NONCLIENTMETRICS)
  359. };
  360. VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
  361. if (!m_bUseBoldCaptionFont)
  362. ncm.lfSmCaptionFont.lfWeight = FW_NORMAL;
  363. SetCaptionFontIndirect(&ncm.lfSmCaptionFont, TRUE);
  364. }
  365. m_pTabPaintManager->RefreshMetrics();
  366. m_pPanelPaintManager->RefreshMetrics();
  367. CWindowDC dc(CWnd::GetDesktopWindow());
  368. CXTPFontDC font(&dc, m_pTabPaintManager->GetFont(FALSE));
  369. m_nTabsHeight = max(24, dc.GetTextExtent(_T(" "), 1).cy + 10);
  370. m_themeExplorer.OpenTheme(0, L"EXPLORERBAR");
  371. m_themeButton.OpenTheme(0, L"BUTTON");
  372. m_themeToolbar.OpenThemeData(0, L"TOOLBAR");
  373. m_themeWindow.OpenThemeData(0, L"WINDOW");
  374. m_bLunaTheme = FALSE;
  375. }
  376. void CXTPDockingPanePaintManager::Line(CDC* pDC, int x0, int y0, int x1, int y1, int nPen)
  377. {
  378. CXTPPenDC pen(*pDC, GetXtremeColor(nPen));
  379. pDC->MoveTo(x0, y0);
  380. pDC->LineTo(x1, y1);
  381. }
  382. void CXTPDockingPanePaintManager::Line(CDC* pDC, int x0, int y0, int x1, int y1)
  383. {
  384. pDC->MoveTo(x0, y0);
  385. pDC->LineTo(x1, y1);
  386. }
  387. void CXTPDockingPanePaintManager::Rectangle(CDC* pDC, CRect rc, int nBrush, int nPen)
  388. {
  389. pDC->FillSolidRect(rc, GetXtremeColor(nBrush));
  390. pDC->Draw3dRect(rc, GetXtremeColor(nPen), GetXtremeColor(nPen));
  391. }
  392. void CXTPDockingPanePaintManager::Pixel(CDC* pDC, int x, int y, int nPen)
  393. {
  394. pDC->SetPixel(x, y, GetXtremeColor(nPen));
  395. }
  396. CRect CXTPDockingPanePaintManager::GetCaptionGripperRect(const CXTPDockingPaneTabbedContainer* /*pPane*/)
  397. {
  398. return CRect(0, 0, 0, 0);
  399. }
  400. void CXTPDockingPanePaintManager::DrawCaptionButtons(CDC* pDC, CXTPDockingPaneCaptionButtons* pButtons, CRect& rcCaption, COLORREF clr, int nButtonSize, int nButtonGap, BOOL bVertical)
  401. {
  402. if (!pButtons)
  403. return;
  404. CRect rcButton(
  405. bVertical ? CPoint(rcCaption.CenterPoint().x - nButtonSize / 2, rcCaption.bottom - nButtonSize) :
  406. CPoint(rcCaption.right - nButtonSize , rcCaption.CenterPoint().y - nButtonSize / 2),
  407. CSize(nButtonSize, nButtonSize));
  408. for (int i = 0; i < pButtons->GetSize(); i++)
  409. {
  410. CXTPDockingPaneCaptionButton* pButton = pButtons->GetAt(i);
  411. if (i == 0)
  412. {
  413. CXTPDockingPane* pPane = GetSelectedPane(pButton->GetPane());
  414. if (pPane && ((pPane->GetEnabled() & xtpPaneEnableActions) == 0))
  415. clr = m_clrDisabledCaptionText;
  416. }
  417. if (pButton->IsVisible())
  418. {
  419. pButton->SetRect(rcButton);
  420. DrawCaptionButton(pDC, pButton, clr);
  421. if (bVertical)
  422. {
  423. rcButton.OffsetRect(0, - nButtonSize - nButtonGap);
  424. }
  425. else
  426. {
  427. rcButton.OffsetRect(- nButtonSize - nButtonGap, 0);
  428. }
  429. }
  430. else
  431. {
  432. pButton->SetRect(CXTPEmptyRect());
  433. }
  434. }
  435. if (bVertical)
  436. {
  437. rcCaption.bottom = rcButton.bottom;
  438. }
  439. else
  440. {
  441. rcCaption.right = rcButton.right;
  442. }
  443. }
  444. void CXTPDockingPanePaintManager::DrawCaptionButton(CDC* pDC, CXTPDockingPaneCaptionButton* pButton, COLORREF clrButton)
  445. {
  446. CRect rc = pButton->GetRect();
  447. CPoint pt = rc.CenterPoint();
  448. XTPDockingPaneCaptionButtonStyle nCaptionButtonStyle = m_nCaptionButtonStyle;
  449. if (nCaptionButtonStyle == xtpPaneCaptionButtonThemedToolBar)
  450. {
  451. if (!m_themeToolbar.IsAppThemed())
  452. {
  453. nCaptionButtonStyle = xtpPaneCaptionButtonOffice;
  454. }
  455. else
  456. {
  457. if (pButton->IsPressed())
  458. {
  459. m_themeToolbar.DrawThemeBackground(pDC->GetSafeHdc(), TP_BUTTON, TS_PRESSED, &rc, 0);
  460. }
  461. else if (pButton->IsSelected())
  462. {
  463. m_themeToolbar.DrawThemeBackground(pDC->GetSafeHdc(), TP_BUTTON, TS_HOT, &rc, 0);
  464. }
  465. }
  466. }
  467. if (nCaptionButtonStyle == xtpPaneCaptionButtonThemedToolWindow)
  468. {
  469. if (!m_themeWindow.IsAppThemed() || pButton->GetID() != XTP_IDS_DOCKINGPANE_CLOSE )
  470. {
  471. nCaptionButtonStyle = xtpPaneCaptionButtonOffice;
  472. }
  473. else
  474. {
  475. BOOL bActive = TRUE;
  476. if (pButton->GetPane()->GetType() == xtpPaneTypeTabbedContainer)
  477. bActive = ((CXTPDockingPaneTabbedContainer*)pButton->GetPane())->IsActive();
  478. if (pButton->GetPane()->GetType() == xtpPaneTypeMiniWnd)
  479. bActive = ((CXTPDockingPaneMiniWnd*)pButton->GetPane())->IsActive();
  480. int nState = pButton->IsPressed() ? CBS_PUSHED: pButton->IsSelected() ? CBS_HOT : !bActive ? 5 : CBS_NORMAL;
  481. m_themeWindow.DrawThemeBackground(pDC->GetSafeHdc(), WP_SMALLCLOSEBUTTON, nState, &rc, 0);
  482. return;
  483. }
  484. }
  485. if (nCaptionButtonStyle == xtpPaneCaptionButtonThemedExplorerBar)
  486. {
  487. if (!m_themeExplorer.IsAppThemed())
  488. {
  489. nCaptionButtonStyle = xtpPaneCaptionButtonOffice;
  490. }
  491. else
  492. {
  493. if (pButton->GetID() == XTP_IDS_DOCKINGPANE_CLOSE || pButton->GetID() == XTP_IDS_DOCKINGPANE_AUTOHIDE)
  494. {
  495. BOOL bActive = TRUE;
  496. if (pButton->GetPane()->GetType() == xtpPaneTypeTabbedContainer)
  497. bActive = ((CXTPDockingPaneTabbedContainer*)pButton->GetPane())->IsActive();
  498. if (pButton->GetPane()->GetType() == xtpPaneTypeMiniWnd)
  499. bActive = ((CXTPDockingPaneMiniWnd*)pButton->GetPane())->IsActive();
  500. bActive = m_bHighlightActiveCaption && bActive;
  501. if (pButton->GetID() == XTP_IDS_DOCKINGPANE_CLOSE)
  502. {
  503. int nState = pButton->IsPressed() ? EBHC_PRESSED: bActive || pButton->IsSelected() ? EBHC_HOT : EBHC_NORMAL;
  504. if (SUCCEEDED(m_themeExplorer.DrawThemeBackground(*pDC, EBP_HEADERCLOSE, nState, pButton->GetRect(), 0)))
  505. return;
  506. }
  507. else
  508. {
  509. int nState = pButton->IsPressed() ? EBHP_PRESSED: pButton->IsSelected() ? EBHP_HOT : EBHP_NORMAL;
  510. if (SUCCEEDED(m_themeExplorer.DrawThemeBackground(*pDC, EBP_HEADERPIN, (pButton->GetState() & xtpPanePinPushed ? 0 : 3) + nState, pButton->GetRect(), 0)))
  511. return;
  512. }
  513. }
  514. nCaptionButtonStyle = xtpPaneCaptionButtonThemedButton;
  515. }
  516. }
  517. if (nCaptionButtonStyle == xtpPaneCaptionButtonThemedButton)
  518. {
  519. if (!m_themeButton.IsAppThemed())
  520. {
  521. nCaptionButtonStyle = xtpPaneCaptionButtonOffice;
  522. }
  523. else
  524. {
  525. int nState = pButton->IsPressed() ? PBS_PRESSED: pButton->IsSelected() ? PBS_HOT: PBS_NORMAL;
  526. if (nState != PBS_NORMAL)
  527. {
  528. m_themeButton.DrawThemeBackground(*pDC, BP_PUSHBUTTON, nState, pButton->GetRect(), 0);
  529. m_themeButton.GetThemeColor(BP_PUSHBUTTON, nState, TMT_TEXTCOLOR, &clrButton);
  530. }
  531. }
  532. }
  533. if (nCaptionButtonStyle == xtpPaneCaptionButtonDefault)
  534. {
  535. pDC->DrawFrameControl(&rc, DFC_BUTTON, DFCS_ADJUSTRECT | DFCS_BUTTONPUSH | (pButton->IsPressed() ? DFCS_PUSHED : 0));
  536. if (pButton->IsPressed()) pt.Offset(1, 1);
  537. }
  538. if (nCaptionButtonStyle == xtpPaneCaptionButtonOffice)
  539. {
  540. if (pButton->IsPressed())
  541. {
  542. pDC->Draw3dRect(rc, GetXtremeColor(COLOR_BTNTEXT), GetXtremeColor(COLOR_BTNHILIGHT));
  543. pt.Offset(1, 1);
  544. }
  545. else if (pButton->IsSelected())
  546. pDC->Draw3dRect(rc, GetXtremeColor(COLOR_BTNHILIGHT), GetXtremeColor(COLOR_BTNTEXT));
  547. }
  548. if (nCaptionButtonStyle == xtpPaneCaptionButtonOffice2003)
  549. {
  550. if (pButton->IsSelected())
  551. {
  552. if (!m_bLunaTheme)
  553. {
  554. Rectangle(pDC, rc, XPCOLOR_HIGHLIGHT, XPCOLOR_HIGHLIGHT_BORDER);
  555. clrButton = GetXtremeColor(XPCOLOR_HIGHLIGHT_TEXT);
  556. }
  557. else
  558. {
  559. XTPDrawHelpers()->GradientFill(pDC, rc, RGB(255, 242, 200), RGB(255, 212, 151), FALSE);
  560. pDC->Draw3dRect(rc, GetXtremeColor(XPCOLOR_HIGHLIGHT_BORDER), GetXtremeColor(XPCOLOR_HIGHLIGHT_BORDER));
  561. clrButton = 0;
  562. }
  563. }
  564. if (pButton->IsPressed())
  565. {
  566. if (!m_bLunaTheme)
  567. {
  568. Rectangle(pDC, rc, XPCOLOR_HIGHLIGHT_PUSHED, XPCOLOR_HIGHLIGHT_BORDER);
  569. clrButton = GetXtremeColor(XPCOLOR_PUSHED_TEXT);
  570. }
  571. else
  572. {
  573. XTPDrawHelpers()->GradientFill(pDC, rc, RGB(254, 142, 75), RGB(255, 207, 139), FALSE);
  574. pDC->Draw3dRect(rc, GetXtremeColor(XPCOLOR_HIGHLIGHT_BORDER), GetXtremeColor(XPCOLOR_HIGHLIGHT_BORDER));
  575. clrButton = 0;
  576. }
  577. }
  578. }
  579. DrawCaptionButtonEntry(pDC, pButton, pt, clrButton);
  580. }
  581. void CXTPDockingPanePaintManager::DrawPane(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  582. {
  583. pDC->FillSolidRect(rc, GetXtremeColor(COLOR_3DFACE));
  584. pDC->SetBkMode(TRANSPARENT);
  585. CRect rcCaption(rc);
  586. if (pPane->IsTabsVisible())
  587. {
  588. AdjustCaptionRect(pPane, rc);
  589. m_pTabPaintManager->DrawTabControl(pPane, pDC, rc);
  590. }
  591. if (pPane->IsTitleVisible())
  592. {
  593. DrawCaption(pDC, pPane, rcCaption);
  594. }
  595. }
  596. void CXTPDockingPanePaintManager::AdjustCaptionRect(const CXTPDockingPaneTabbedContainer* pPane, CRect& rc)
  597. {
  598. if (pPane->IsTitleVisible())
  599. {
  600. if (pPane->IsCaptionVertical())
  601. {
  602. rc.left += m_nTitleHeight + m_rcCaptionMargin.top + m_rcCaptionMargin.bottom;
  603. }
  604. else
  605. {
  606. rc.top += m_nTitleHeight + m_rcCaptionMargin.top + m_rcCaptionMargin.bottom;
  607. }
  608. }
  609. }
  610. void CXTPDockingPanePaintManager::AdjustClientRect(CXTPDockingPaneTabbedContainer* pPane, CRect& rect, BOOL bApply)
  611. {
  612. CPoint pt = rect.TopLeft();
  613. AdjustCaptionRect(pPane, rect);
  614. if (pPane->IsTabsVisible())
  615. {
  616. if (bApply)
  617. {
  618. CClientDC dc(pPane);
  619. CRect rcTabs(rect);
  620. rcTabs.OffsetRect(-pt);
  621. m_pTabPaintManager->RepositionTabControl(pPane, &dc, rcTabs);
  622. }
  623. m_pTabPaintManager->AdjustClientRect(pPane, rect);
  624. }
  625. }
  626. void CXTPDockingPanePaintManager::AdjustClientRect(CXTPDockingPaneSidePanel* pPane, CRect& rect)
  627. {
  628. rect.DeflateRect(3, 3);
  629. AdjustCaptionRect(pPane, rect);
  630. }
  631. void CXTPDockingPanePaintManager::AdjustCaptionRect(const CXTPDockingPaneSidePanel* pPane, CRect& rect)
  632. {
  633. int nTitleFont = GetCaptionHeight();
  634. XTPDockingPaneDirection direction = pPane->GetDirection();
  635. if (direction == xtpPaneDockLeft) rect.left += nTitleFont;
  636. else if (direction == xtpPaneDockRight) rect.right -= nTitleFont;
  637. else if (direction == xtpPaneDockTop) rect.top += nTitleFont;
  638. else if (direction == xtpPaneDockBottom) rect.bottom -= nTitleFont;
  639. }
  640. CRect CXTPDockingPanePaintManager::GetPaneCaptionRect(const CXTPDockingPaneSidePanel* pPane)
  641. {
  642. CXTPClientRect rect(pPane);
  643. rect.DeflateRect(1, 1);
  644. int nTitleFont = GetCaptionHeight();
  645. XTPDockingPaneDirection direction = pPane->GetDirection();
  646. if (direction == xtpPaneDockLeft) rect.right = rect.left + nTitleFont;
  647. else if (direction == xtpPaneDockRight) rect.left = rect.right - nTitleFont;
  648. else if (direction == xtpPaneDockTop) rect.bottom = rect.top + nTitleFont;
  649. else if (direction == xtpPaneDockBottom) rect.top = rect.bottom - nTitleFont;
  650. return rect;
  651. }
  652. void CXTPDockingPanePaintManager::DrawSplitter(CDC* pDC, CXTPDockingPaneSplitterWnd* pSplitter)
  653. {
  654. CXTPClientRect rc((CWnd*)pSplitter);
  655. if (m_dwSplitterStyle & xtpPaneSplitter3D)
  656. {
  657. pDC->FillSolidRect(rc, m_clrSplitter);
  658. if (pSplitter->IsHorizontal())
  659. {
  660. pDC->FillSolidRect(0, 0, rc.Width(), 1, GetXtremeColor(COLOR_3DHIGHLIGHT));
  661. pDC->FillSolidRect(0, rc.bottom - 2, rc.Width(), 1, GetXtremeColor(XPCOLOR_3DSHADOW));
  662. pDC->FillSolidRect(0, rc.bottom - 1, rc.Width(), 1, GetXtremeColor(COLOR_BTNTEXT));
  663. }
  664. else
  665. {
  666. pDC->FillSolidRect(0, 0, 1, rc.Height(), GetXtremeColor(COLOR_3DHIGHLIGHT));
  667. pDC->FillSolidRect(rc.right - 2, 0, 1, rc.Height(), GetXtremeColor(XPCOLOR_3DSHADOW));
  668. pDC->FillSolidRect(rc.right - 1, 0, 1, rc.Height(), GetXtremeColor(COLOR_BTNTEXT));
  669. }
  670. }
  671. else if (m_dwSplitterStyle & xtpPaneSplitterSoft3D)
  672. {
  673. int nCenter = m_nSplitterSize / 2;
  674. if (pSplitter->IsHorizontal())
  675. {
  676. pDC->FillSolidRect(0, 0, rc.Width(), 1, GetXtremeColor(COLOR_3DDKSHADOW));
  677. pDC->FillSolidRect(0, rc.bottom - 1, rc.Width(), 1, GetXtremeColor(COLOR_3DDKSHADOW));
  678. pDC->FillSolidRect(0, 1, rc.Width(), nCenter - 1, GetXtremeColor(COLOR_WINDOW));
  679. pDC->FillSolidRect(0, nCenter, rc.Width(), rc.Height() - nCenter - 1, m_clrSplitter);
  680. }
  681. else
  682. {
  683. pDC->FillSolidRect(0, 0, 1, rc.Height(), GetXtremeColor(COLOR_3DDKSHADOW));
  684. pDC->FillSolidRect(rc.right - 1, 0, 1, rc.Height(), GetXtremeColor(COLOR_3DDKSHADOW));
  685. pDC->FillSolidRect(1, 0, nCenter - 1, rc.Height(), GetXtremeColor(COLOR_WINDOW));
  686. pDC->FillSolidRect(nCenter, 0, rc.Width() - nCenter - 1, rc.Height(), m_clrSplitter);
  687. }
  688. }
  689. else if (m_dwSplitterStyle & xtpPaneSplitterGradient)
  690. {
  691. XTPFillFramePartRect(pDC, rc, (CWnd*)pSplitter, pSplitter->GetParent(), m_clrSplitterGradient, TRUE);
  692. }
  693. else if (m_dwSplitterStyle & xtpPaneSplitterGradientVert)
  694. {
  695. XTPFillFramePartRect(pDC, rc, (CWnd*)pSplitter, pSplitter->GetParent(), m_clrSplitterGradient, FALSE);
  696. }
  697. else
  698. {
  699. pDC->FillSolidRect(rc, m_clrSplitter);
  700. }
  701. if (m_dwSplitterStyle & xtpPaneSplitterGripperOfficeXP)
  702. {
  703. if (pSplitter->IsHorizontal())
  704. {
  705. pDC->FillSolidRect(rc.CenterPoint().x, 0 + 2, 11, 1, m_clrSplitterGripper);
  706. pDC->FillSolidRect(rc.CenterPoint().x, 0 + 4, 11, 1, m_clrSplitterGripper);
  707. }
  708. else
  709. {
  710. pDC->FillSolidRect(2, rc.CenterPoint().y, 1, 11, m_clrSplitterGripper);
  711. pDC->FillSolidRect(4, rc.CenterPoint().y, 1, 11, m_clrSplitterGripper);
  712. }
  713. }
  714. if (m_dwSplitterStyle & xtpPaneSplitterGripperOffice2003)
  715. {
  716. if (pSplitter->IsHorizontal())
  717. {
  718. int nLeft = rc.CenterPoint().x - min(32, rc.Width() /2 - 10);
  719. int nRight = rc.CenterPoint().x + min(32, rc.Width() /2 - 10);
  720. int y = rc.CenterPoint().y - 1;
  721. for (int x = nLeft; x < nRight; x += 4)
  722. {
  723. pDC->FillSolidRect(CRect(x + 1, y + 1, x + 3, y + 3), GetXtremeColor(COLOR_BTNHIGHLIGHT));
  724. pDC->FillSolidRect(CRect(x, y, x + 2, y + 2), m_clrSplitterGripper);
  725. }
  726. }
  727. else
  728. {
  729. int nTop = rc.CenterPoint().y - min(32, rc.Height() /2 - 10);
  730. int nBottom = rc.CenterPoint().y + min(32, rc.Height() /2 - 10);
  731. int x = rc.CenterPoint().x - 1;
  732. for (int y = nTop; y < nBottom; y += 4)
  733. {
  734. pDC->FillSolidRect(CRect(x + 1, y + 1, x + 3, y + 3), GetXtremeColor(COLOR_BTNHIGHLIGHT));
  735. pDC->FillSolidRect(CRect(x, y, x + 2, y + 2), m_clrSplitterGripper);
  736. }
  737. }
  738. }
  739. }
  740. ///////////////////////////////////////////////////////////////////////////////
  741. // CXTPDockingPaneOfficeTheme
  742. class CXTPDockingPaneOfficeTheme::COfficePanelColorSet :
  743. public CXTPTabPaintManager::CColorSetVisualStudio
  744. {
  745. public:
  746. virtual void RefreshMetrics();
  747. };
  748. void CXTPDockingPaneOfficeTheme::COfficePanelColorSet::RefreshMetrics()
  749. {
  750. CColorSetVisualStudio::RefreshMetrics();
  751. if (m_pPaintManager->GetAppearance() == xtpTabAppearanceFlat)
  752. {
  753. m_clrSelectedText.SetStandardValue(GetSysColor(COLOR_3DDKSHADOW));
  754. m_clrNormalText.SetStandardValue(GetSysColor(COLOR_3DDKSHADOW));
  755. }
  756. }
  757. CXTPDockingPaneOfficeTheme::CXTPDockingPaneOfficeTheme()
  758. {
  759. m_pPanelPaintManager->SetAppearance(xtpTabAppearanceFlat);
  760. m_pPanelPaintManager->SetColorSet(new COfficePanelColorSet);
  761. m_pTabPaintManager->SetAppearance(xtpTabAppearanceVisualStudio);
  762. m_bGradientCaption = FALSE;
  763. m_bUseBoldCaptionFont = FALSE;
  764. }
  765. void CXTPDockingPaneOfficeTheme::RefreshMetrics()
  766. {
  767. CXTPDockingPaneGripperedTheme::RefreshMetrics();
  768. m_clrActiveCaption.SetStandardValue(GetXtremeColor(COLOR_ACTIVECAPTION), GetXtremeColor(27));
  769. m_clrNormalCaption.SetStandardValue(GetXtremeColor(COLOR_INACTIVECAPTION), GetSysColor(28));
  770. m_clrNormalCaptionText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  771. m_clrActiveCaptionText.SetStandardValue(GetXtremeColor(COLOR_CAPTIONTEXT));
  772. if (XTPSystemVersion()->IsWin95())
  773. {
  774. // Windows 95
  775. m_clrNormalCaption.SetStandardValue(GetXtremeColor(COLOR_INACTIVECAPTION));
  776. m_clrActiveCaption.SetStandardValue(GetXtremeColor(COLOR_ACTIVECAPTION));
  777. }
  778. }
  779. COLORREF CXTPDockingPaneOfficeTheme::FillCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, BOOL bActive, BOOL bVertical)
  780. {
  781. if (m_bGradientCaption)
  782. {
  783. XTPDrawHelpers()->GradientFill(pDC, rcCaption, bActive ? m_clrActiveCaption : m_clrNormalCaption, !bVertical);
  784. }
  785. else
  786. {
  787. if (bActive)
  788. {
  789. pDC->FillSolidRect(rcCaption, m_clrActiveCaption.clrLight);
  790. }
  791. else if (pPane->GetType() != xtpPaneTypeSidePanel)
  792. {
  793. CXTPPenDC pen(*pDC, GetXtremeColor(XPCOLOR_3DSHADOW));
  794. pDC->MoveTo(rcCaption.left + 1, rcCaption.top); pDC->LineTo(rcCaption.right - 1 , rcCaption.top);
  795. pDC->MoveTo(rcCaption.left, rcCaption.top + 1); pDC->LineTo(rcCaption.left, rcCaption.bottom - 1);
  796. pDC->MoveTo(rcCaption.left + 1, rcCaption.bottom - 1); pDC->LineTo(rcCaption.right - 1 , rcCaption.bottom - 1);
  797. pDC->MoveTo(rcCaption.right -1 , rcCaption.top + 1); pDC->LineTo(rcCaption.right - 1, rcCaption.bottom - 1);
  798. }
  799. }
  800. return  bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText;
  801. }
  802. void CXTPDockingPaneOfficeTheme::DrawCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, const CString& strTitle, BOOL bActive, BOOL bVertical)
  803. {
  804. COLORREF clrButton = FillCaptionPart(pDC, pPane, rcCaption, bActive, bVertical);
  805. COLORREF clrText = bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText;
  806. XTPDeflateRectDirection(rcCaption, 0, 0, 2, 0, bVertical);
  807. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, clrButton, 14, 2, bVertical);
  808. // Title text
  809. pDC->SetTextColor(IsCaptionEnabled(pPane) ? clrText : m_clrDisabledCaptionText);
  810. XTPDeflateRectDirection(rcCaption, 4, 1, 0, 0, bVertical);
  811. DrawCaptionIcon(pDC, pPane, rcCaption, bVertical);
  812. DrawCaptionText(pDC, strTitle, rcCaption, bVertical);
  813. }
  814. ///////////////////////////////////////////////////////////////////////////////
  815. // CXTPDockingPaneDefaultTheme
  816. CXTPDockingPaneDefaultTheme::CXTPDockingPaneDefaultTheme()
  817. {
  818. m_pPanelPaintManager->SetAppearance(xtpTabAppearancePropertyPage);
  819. m_pTabPaintManager->SetAppearance(xtpTabAppearancePropertyPage);
  820. m_nCaptionButtonStyle = xtpPaneCaptionButtonDefault;
  821. }
  822. void CXTPDockingPaneDefaultTheme::RefreshMetrics()
  823. {
  824. CXTPDockingPanePaintManager::RefreshMetrics();
  825. m_clrActiveCaption.SetStandardValue(GetXtremeColor(COLOR_ACTIVECAPTION));
  826. m_clrNormalCaption.SetStandardValue(GetXtremeColor(COLOR_INACTIVECAPTION));
  827. m_clrActiveCaptionText.SetStandardValue(GetXtremeColor(COLOR_CAPTIONTEXT));
  828. m_clrNormalCaptionText.SetStandardValue(GetXtremeColor(COLOR_INACTIVECAPTIONTEXT));
  829. }
  830. void CXTPDockingPaneDefaultTheme::DrawFloatingFrame(CDC* pDC, CXTPDockingPaneMiniWnd* pPane, CRect rc)
  831. {
  832. pDC->Draw3dRect(rc, GetXtremeColor(COLOR_3DFACE), 0);
  833. rc.DeflateRect(1, 1);
  834. pDC->Draw3dRect(rc, GetXtremeColor(COLOR_3DHIGHLIGHT), GetXtremeColor(COLOR_3DSHADOW));
  835. rc.DeflateRect(1, 1);
  836. pDC->Draw3dRect(rc, GetXtremeColor(COLOR_3DFACE), GetXtremeColor(COLOR_3DFACE));
  837. int nTitleHeight = m_nTitleHeight;
  838. CRect rcCaption(rc);
  839. rcCaption.DeflateRect(0, 0, 0, rc.Height() - nTitleHeight - 3);
  840. CXTPBufferDC dcCache(*pDC, rcCaption);
  841. dcCache.SetBkMode(TRANSPARENT);
  842. dcCache.FillSolidRect(rcCaption, GetXtremeColor(COLOR_3DFACE));
  843. CString strTitle;
  844. pPane->GetWindowText(strTitle);
  845. rcCaption.DeflateRect(1, 2, 1, 2);
  846. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  847. DrawCaptionPart(&dcCache, pPane, rcCaption, strTitle, bActive, FALSE);
  848. }
  849. void CXTPDockingPaneDefaultTheme::DrawSidePanel(CDC* pDC, CXTPDockingPaneSidePanel* pPane, CRect rc)
  850. {
  851. pDC->FillSolidRect(rc, GetXtremeColor(COLOR_3DFACE));
  852. pDC->SetBkMode(TRANSPARENT);
  853. pDC->Draw3dRect(rc, GetXtremeColor(COLOR_WINDOWFRAME), GetXtremeColor(COLOR_WINDOWFRAME));
  854. CRect rcCaption = GetPaneCaptionRect(pPane);
  855. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  856. CString strTitle = pPane->GetTitle();
  857. DrawCaptionPart(pDC, pPane, rcCaption, strTitle, bActive, pPane->GetDirection() == xtpPaneDockLeft || pPane->GetDirection() == xtpPaneDockRight);
  858. }
  859. void CXTPDockingPaneDefaultTheme::DrawCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, const CString& strTitle, BOOL bActive, BOOL bVertical)
  860. {
  861. pDC->FillSolidRect(rcCaption, bActive ? m_clrActiveCaption : m_clrNormalCaption);
  862. XTPDeflateRectDirection(rcCaption, 0, 0, 2, 0, bVertical);
  863. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, GetXtremeColor(COLOR_BTNTEXT), 14, 0, bVertical);
  864. pDC->SetTextColor(IsCaptionEnabled(pPane) ? (bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText) : m_clrDisabledCaptionText);
  865. XTPDeflateRectDirection(rcCaption, 4, 1, 0, 0, bVertical);
  866. DrawCaptionIcon(pDC, pPane, rcCaption, bVertical);
  867. DrawCaptionText(pDC, strTitle, rcCaption, bVertical);
  868. }
  869. void CXTPDockingPaneDefaultTheme::DrawCaption(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  870. {
  871. BOOL bVertical = pPane->IsCaptionVertical();
  872. CRect rcCaption(rc);
  873. XTPDeflateRectDirection(rcCaption, 0, 2, 0, XTPGetRectDirectionHeight(rc, bVertical)  - m_nTitleHeight - 1, bVertical);
  874. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  875. if (bVertical)
  876. {
  877. pDC->FillSolidRect(rc.left, rc.top, rcCaption.right + 2, rcCaption.Height(), GetXtremeColor(COLOR_3DFACE));
  878. }
  879. else
  880. {
  881. pDC->FillSolidRect(rc.left, rc.top, rc.Width(), rcCaption.bottom + 2, GetXtremeColor(COLOR_3DFACE));
  882. }
  883. DrawCaptionPart(pDC, pPane, rcCaption, pPane->GetTitle(), bActive, bVertical);
  884. }
  885. ///////////////////////////////////////////////////////////////////////////////
  886. // CXTPDockingPaneGripperedTheme
  887. void CXTPDockingPanePaintManager::DrawCaptionButtonEntry(CDC* pDC, CXTPDockingPaneCaptionButton* pButton, CPoint pt, COLORREF clrButton)
  888. {
  889. CXTPPenDC pen(*pDC, clrButton);
  890. if (pButton->GetID() == XTP_IDS_DOCKINGPANE_CLOSE)
  891. {
  892. pDC->MoveTo(pt.x - 4, pt.y - 3 - 1); pDC->LineTo(pt.x + 3 , pt.y + 4 - 1);
  893. pDC->MoveTo(pt.x - 4, pt.y + 3 - 1); pDC->LineTo(pt.x + 3 , pt.y - 4 - 1);
  894. pDC->MoveTo(pt.x - 3, pt.y - 3 - 1); pDC->LineTo(pt.x + 4 , pt.y + 4 - 1);
  895. pDC->MoveTo(pt.x - 3, pt.y + 3 - 1); pDC->LineTo(pt.x + 4 , pt.y - 4 - 1);
  896. }
  897. else if (pButton->GetID() == XTP_IDS_DOCKINGPANE_AUTOHIDE)
  898. {
  899. CXTPDockingPaneCaptionButton::DrawPinnButton(pDC, pt, pButton->GetState() & xtpPanePinPushed);
  900. }
  901. else if (pButton->GetID() == XTP_IDS_DOCKINGPANE_MAXIMIZE || pButton->GetID() == XTP_IDS_DOCKINGPANE_RESTORE)
  902. {
  903. CXTPDockingPaneCaptionButton::DrawMaximizeRestoreButton(pDC, pt, pButton->GetID() == XTP_IDS_DOCKINGPANE_MAXIMIZE, clrButton);
  904. }
  905. else if (pButton->GetID() == XTP_IDS_DOCKINGPANE_MENU)
  906. {
  907. CXTPBrushDC brush (*pDC, clrButton);
  908. CPoint pts[] =
  909. {
  910. CPoint(pt.x - 4, pt.y - 1), CPoint(pt.x - 1, pt.y + 2) , CPoint(pt.x, pt.y + 2), CPoint(pt.x + 3, pt.y - 1)
  911. };
  912. pDC->Polygon(pts, 4);
  913. }
  914. }
  915. CXTPDockingPaneGripperedTheme::CXTPDockingPaneGripperedTheme()
  916. {
  917. m_nCaptionButtonStyle = xtpPaneCaptionButtonOffice;
  918. }
  919. void CXTPDockingPaneGripperedTheme::RefreshMetrics()
  920. {
  921. CXTPDockingPaneDefaultTheme::RefreshMetrics();
  922. m_clrActiveCaption.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  923. m_clrNormalCaption.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  924. m_clrActiveCaptionText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  925. m_clrNormalCaptionText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  926. }
  927. void CXTPDockingPaneGripperedTheme::DrawCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, const CString& strTitle, BOOL bActive, BOOL bVertical)
  928. {
  929. COLORREF clrText = bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText;
  930. XTPDeflateRectDirection(rcCaption, 0, 0, 2, 0, bVertical);
  931. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, clrText, 14, 2, bVertical);
  932. int nOffset = 4;
  933. XTPDeflateRectDirection(rcCaption, 4, 1, 2, 0, bVertical);
  934. if (!strTitle.IsEmpty())
  935. {
  936. pDC->SetTextColor(IsCaptionEnabled(pPane) ? clrText : m_clrDisabledCaptionText);
  937. DrawCaptionIcon(pDC, pPane, rcCaption, bVertical);
  938. int nWidth = DrawCaptionText(pDC, strTitle, rcCaption, bVertical, TRUE);
  939. nOffset = nWidth + 4 + (bVertical ? rcCaption.top : rcCaption.left);
  940. }
  941. if (bVertical)
  942. {
  943. if (rcCaption.bottom > nOffset)
  944. {
  945. int nCenter = rcCaption.CenterPoint().x;
  946. pDC->Draw3dRect(nCenter - 3, nOffset, 3, rcCaption.bottom - nOffset, GetXtremeColor(COLOR_BTNHILIGHT), GetXtremeColor(COLOR_3DSHADOW));
  947. pDC->Draw3dRect(nCenter + 1, nOffset, 3, rcCaption.bottom - nOffset, GetXtremeColor(COLOR_BTNHILIGHT), GetXtremeColor(COLOR_3DSHADOW));
  948. }
  949. }
  950. else
  951. {
  952. if (rcCaption.right > nOffset)
  953. {
  954. int nCenter = rcCaption.CenterPoint().y;
  955. pDC->Draw3dRect(nOffset, nCenter - 3, rcCaption.right - nOffset, 3, GetXtremeColor(COLOR_BTNHILIGHT), GetXtremeColor(COLOR_3DSHADOW));
  956. pDC->Draw3dRect(nOffset, nCenter + 1, rcCaption.right - nOffset, 3, GetXtremeColor(COLOR_BTNHILIGHT), GetXtremeColor(COLOR_3DSHADOW));
  957. }
  958. }
  959. }
  960. void CXTPDockingPaneGripperedTheme::DrawFloatingFrame(CDC* pDC, CXTPDockingPaneMiniWnd* pPane, CRect rc)
  961. {
  962. CXTPDockingPaneDefaultTheme::DrawFloatingFrame(pDC, pPane, rc);
  963. }
  964. void CXTPDockingPaneGripperedTheme::DrawCaption(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  965. {
  966. BOOL bVertical = pPane->IsCaptionVertical();
  967. int nTitleHeight = m_nTitleHeight;
  968. CRect rcCaption(rc);
  969. XTPDeflateRectDirection(rcCaption, 0, m_rcCaptionMargin.top, 0, XTPGetRectDirectionHeight(rc, bVertical) - nTitleHeight - 1, bVertical);
  970. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  971. if (bVertical)
  972. {
  973. pDC->FillSolidRect(rc.left, rc.top, rcCaption.right + 2, rc.Height(), GetXtremeColor(COLOR_3DFACE));
  974. }
  975. else
  976. {
  977. pDC->FillSolidRect(rc.left, rc.top, rc.Width(), rcCaption.bottom + 2, GetXtremeColor(COLOR_3DFACE));
  978. }
  979. DrawCaptionPart(pDC, pPane, rcCaption, pPane->GetTitle(), bActive, bVertical);
  980. }
  981. //////////////////////////////////////////////////////////////////////////
  982. // CXTPDockingPaneExplorerTheme
  983. CXTPDockingPaneExplorerTheme::CXTPDockingPaneExplorerTheme()
  984. {
  985. m_bUseBoldCaptionFont = FALSE;
  986. m_rcCaptionMargin.SetRect(0, 0, 0, 0);
  987. m_nCaptionFontGap = 9;
  988. m_nCaptionButtonStyle = xtpPaneCaptionButtonThemedToolBar;
  989. }
  990. void CXTPDockingPaneExplorerTheme::DrawCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, const CString& strTitle, BOOL bActive, BOOL bVertical)
  991. {
  992. if (m_themeRebar.IsAppThemed())
  993. {
  994. CWnd* pWnd = CWnd::FromHandle(pPane->GetPaneHwnd());
  995. ASSERT(pWnd);
  996. if (!pWnd)
  997. return;
  998. if (pPane->GetType() == xtpPaneTypeMiniWnd)
  999. {
  1000. CRect rcClient;
  1001. pWnd->GetWindowRect(rcClient);
  1002. rcClient.OffsetRect(-rcClient.TopLeft());
  1003. m_themeRebar.DrawThemeBackground(pDC->GetSafeHdc(), 0, 0, &rcClient, &rcCaption);
  1004. }
  1005. else
  1006. {
  1007. CWnd* pParent = pPane->GetDockingSite();
  1008. CRect rc, rcParent, rcClient, rcClipRect;
  1009. pWnd->GetClientRect(&rcClient);
  1010. rcClipRect = rcClient;
  1011. if (pParent)
  1012. {
  1013. pParent->GetWindowRect(rcParent);
  1014. pWnd->GetWindowRect(rc);
  1015. rcClient.TopLeft() += rcParent.TopLeft() - rc.TopLeft();
  1016. rcClient.BottomRight() += rcParent.BottomRight() - rc.BottomRight();
  1017. }
  1018. m_themeRebar.DrawThemeBackground(pDC->GetSafeHdc(), 0, 0, &rcClient, &rcCaption);
  1019. }
  1020. }
  1021. COLORREF clrText = bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText;
  1022. XTPDeflateRectDirection(rcCaption, 0, 0, 2, 0, bVertical);
  1023. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, clrText, 16, 2, bVertical);
  1024. pDC->SetTextColor(IsCaptionEnabled(pPane) ? clrText : m_clrDisabledCaptionText);
  1025. XTPDeflateRectDirection(rcCaption, 4, 1, 0, 0, bVertical);
  1026. DrawCaptionIcon(pDC, pPane, rcCaption, bVertical);
  1027. DrawCaptionText(pDC, strTitle, rcCaption, bVertical);
  1028. }
  1029. void CXTPDockingPaneExplorerTheme::RefreshMetrics()
  1030. {
  1031. CXTPDockingPaneGripperedTheme::RefreshMetrics();
  1032. m_themeRebar.OpenThemeData(0, L"REBAR");
  1033. if (m_themeRebar.IsAppThemed())
  1034. {
  1035. m_pPanelPaintManager->SetAppearance(xtpTabAppearancePropertyPage);
  1036. m_pPanelPaintManager->SetColor(xtpTabColorWinXP);
  1037. m_pPanelPaintManager->m_bHotTracking = TRUE;
  1038. m_pTabPaintManager->SetAppearance(xtpTabAppearancePropertyPage);
  1039. m_pTabPaintManager->SetColor(xtpTabColorWinXP);
  1040. m_pTabPaintManager->m_bHotTracking = TRUE;
  1041. }
  1042. else
  1043. {
  1044. m_pPanelPaintManager->SetAppearance(xtpTabAppearanceFlat);
  1045. m_pPanelPaintManager->m_bHotTracking = FALSE;
  1046. m_pTabPaintManager->SetAppearance(xtpTabAppearanceVisualStudio);
  1047. m_pTabPaintManager->m_bHotTracking = FALSE;
  1048. }
  1049. }
  1050. ///////////////////////////////////////////////////////////////////////////////
  1051. // CXTPDockingPaneVisioTheme
  1052. CXTPDockingPaneVisioTheme::CXTPDockingPaneVisioTheme()
  1053. {
  1054. m_pPanelPaintManager->SetAppearance(xtpTabAppearanceFlat);
  1055. m_pTabPaintManager->SetAppearance(xtpTabAppearanceVisio);
  1056. m_pTabPaintManager->SetPosition(xtpTabPositionTop);
  1057. m_nCaptionFontGap = 2;
  1058. m_nCaptionButtonStyle = xtpPaneCaptionButtonOffice2003;
  1059. }
  1060. void CXTPDockingPaneVisioTheme::RefreshMetrics()
  1061. {
  1062. CXTPDockingPanePaintManager::RefreshMetrics();
  1063. }
  1064. void CXTPDockingPaneVisioTheme::AdjustCaptionRect(const CXTPDockingPaneTabbedContainer* pPane, CRect& rc)
  1065. {
  1066. CXTPDockingPaneOfficeTheme::AdjustCaptionRect(pPane, rc);
  1067. BOOL bVertical = pPane->IsCaptionVertical();
  1068. XTPDeflateRectDirection(rc, 3, 0, 3, 3, bVertical);
  1069. if (!pPane->IsTitleVisible())
  1070. {
  1071. rc.DeflateRect(0, 3, 0, 0);
  1072. }
  1073. if (!pPane->IsTabsVisible() && m_pTabPaintManager->m_clientFrame != xtpTabFrameNone)
  1074. {
  1075. rc.DeflateRect(1, 1);
  1076. }
  1077. }
  1078. void CXTPDockingPaneVisioTheme::DrawPane(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  1079. {
  1080. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1081. pDC->FillSolidRect(rc, GetXtremeColor(bActive ? XPCOLOR_HIGHLIGHT : XPCOLOR_TOOLBAR_FACE));
  1082. pDC->SetBkMode(TRANSPARENT);
  1083. CRect rcClient(rc);
  1084. if (pPane->IsTitleVisible())
  1085. {
  1086. pDC->FillSolidRect(rc.left, rc.top, rc.Width(), 1, m_clrSplitter);
  1087. DrawCaption(pDC, pPane, rc);
  1088. rcClient.top++;
  1089. }
  1090. AdjustCaptionRect(pPane, rc);
  1091. if (pPane->IsTabsVisible())
  1092. {
  1093. m_pTabPaintManager->DrawTabControl(pPane, pDC, rc);
  1094. }
  1095. else if (m_pTabPaintManager->m_clientFrame != xtpTabFrameNone)
  1096. {
  1097. pDC->Draw3dRect(rc.left - 1, rc.top - 1, rc.Width() + 2, rc.Height() + 2, m_pTabPaintManager->GetColorSet()->m_clrFrameBorder, m_pTabPaintManager->GetColorSet()->m_clrFrameBorder);
  1098. }
  1099. Pixel(pDC, rcClient.left, rcClient.top, XPCOLOR_3DFACE);
  1100. Pixel(pDC, rcClient.right - 1, rcClient.top, XPCOLOR_3DFACE);
  1101. Pixel(pDC, rcClient.left, rcClient.bottom -1, XPCOLOR_3DFACE);
  1102. Pixel(pDC, rcClient.right - 1, rcClient.bottom -1, XPCOLOR_3DFACE);
  1103. }
  1104. void CXTPDockingPaneVisioTheme::DrawFloatingFrame(CDC* pDC, CXTPDockingPaneMiniWnd* pPane, CRect rc)
  1105. {
  1106. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1107. COLORREF clrFrame = GetXtremeColor(bActive ? XPCOLOR_HIGHLIGHT : XPCOLOR_TOOLBAR_FACE);
  1108. pDC->Draw3dRect(rc, clrFrame, 0);
  1109. rc.DeflateRect(1, 1);
  1110. pDC->Draw3dRect(rc, GetXtremeColor(COLOR_3DHIGHLIGHT), GetXtremeColor(COLOR_3DSHADOW));
  1111. rc.DeflateRect(1, 1);
  1112. pDC->Draw3dRect(rc, clrFrame, clrFrame);
  1113. int nTitleHeight = m_nTitleHeight;
  1114. CRect rcCaption(rc);
  1115. rcCaption.DeflateRect(0, 0, 0, rc.Height() - nTitleHeight - 3);
  1116. pDC->FillSolidRect(rcCaption, clrFrame);
  1117. rcCaption.right -= 2;
  1118. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, GetXtremeColor(COLOR_BTNTEXT), 16, 0, FALSE);
  1119. CString strTitle;
  1120. pPane->GetWindowText(strTitle);
  1121. int nRight = rcCaption.right;
  1122. COLORREF clrText = GetXtremeColor(COLOR_BTNTEXT);
  1123. int nLeft = 4;
  1124. if (!strTitle.IsEmpty())
  1125. {
  1126. pDC->SetBkMode(TRANSPARENT);
  1127. CRect rcText(rcCaption.left + 4, rcCaption.top + 1, nRight - 2, rcCaption.bottom);
  1128. pDC->SetTextColor(clrText);
  1129. CXTPFontDC font(pDC, &m_fntTitle);
  1130. pDC->DrawText(strTitle, rcText, DT_SINGLELINE | DT_END_ELLIPSIS | DT_VCENTER | DT_NOPREFIX);
  1131. CRect rcCalc(0, 0, 0, 0);
  1132. pDC->DrawText(strTitle, rcCalc, DT_CALCRECT | DT_SINGLELINE | DT_NOPREFIX);
  1133. nLeft = rcCalc.Width() + rcCaption.left + 14;
  1134. }
  1135. nRight -= 4;
  1136. if (nRight - nLeft > 0)
  1137. {
  1138. int nCenter = rcCaption.CenterPoint().y;
  1139. Line(pDC, nLeft, nCenter - 3, nRight, nCenter - 3, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1140. Line(pDC, nLeft, nCenter - 1, nRight, nCenter - 1, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1141. Line(pDC, nLeft, nCenter + 1, nRight, nCenter + 1, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1142. Line(pDC, nLeft, nCenter + 3, nRight, nCenter + 3, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1143. }
  1144. }
  1145. void CXTPDockingPaneVisioTheme::DrawCaption(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  1146. {
  1147. BOOL bVertical = pPane->IsCaptionVertical();
  1148. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1149. int nTitleHeight = m_nTitleHeight;
  1150. CString strTitle = pPane->GetTitle();
  1151. CRect rcCaption(rc);
  1152. XTPDeflateRectDirection(rcCaption, 0, 2, 1, XTPGetRectDirectionHeight(rc, bVertical) - nTitleHeight - 3, bVertical);
  1153. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, 0, 16, 0, bVertical);
  1154. COLORREF clrText = GetXtremeColor(COLOR_BTNTEXT);
  1155. int nOffset = 4;
  1156. XTPDeflateRectDirection(rcCaption, 4, 1, 2, 0, bVertical);
  1157. if (!strTitle.IsEmpty())
  1158. {
  1159. pDC->SetTextColor(IsCaptionEnabled(pPane) ? clrText : m_clrDisabledCaptionText);
  1160. int nWidth = DrawCaptionText(pDC, strTitle, rcCaption, bVertical, TRUE);
  1161. nOffset = nWidth + 10 + (bVertical ? rcCaption.top : rcCaption.left);
  1162. }
  1163. if (bVertical)
  1164. {
  1165. if (rcCaption.bottom - nOffset > 0)
  1166. {
  1167. int nCenter = rcCaption.CenterPoint().x;
  1168. Line(pDC, nCenter - 3, nOffset, nCenter - 3, rcCaption.bottom, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1169. Line(pDC, nCenter - 1, nOffset, nCenter - 1, rcCaption.bottom, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1170. Line(pDC, nCenter + 1, nOffset, nCenter + 1, rcCaption.bottom, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1171. Line(pDC, nCenter + 3, nOffset, nCenter + 3, rcCaption.bottom, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1172. }
  1173. }
  1174. else
  1175. {
  1176. if (rcCaption.right - nOffset > 0)
  1177. {
  1178. int nCenter = rcCaption.CenterPoint().y;
  1179. Line(pDC, nOffset, nCenter - 3, rcCaption.right, nCenter - 3, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1180. Line(pDC, nOffset, nCenter - 1, rcCaption.right, nCenter - 1, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1181. Line(pDC, nOffset, nCenter + 1, rcCaption.right, nCenter + 1, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1182. Line(pDC, nOffset, nCenter + 3, rcCaption.right, nCenter + 3, !bActive ? XPCOLOR_TOOLBAR_GRIPPER : COLOR_BTNTEXT);
  1183. }
  1184. }
  1185. }
  1186. ///////////////////////////////////////////////////////////////////////////////
  1187. // CXTPDockingPaneOffice2003Theme
  1188. CXTPDockingPaneOffice2003Theme::CXTPDockingPaneOffice2003Theme()
  1189. {
  1190. m_bDrawGripper = TRUE;
  1191. m_bRoundedCaption = TRUE;
  1192. m_nCaptionFontGap = 7;
  1193. m_bUseBoldCaptionFont = TRUE;
  1194. m_pPanelPaintManager->SetAppearance(xtpTabAppearancePropertyPageFlat);
  1195. m_pPanelPaintManager->SetColor(xtpTabColorOffice2003);
  1196. m_pPanelPaintManager->m_bHotTracking = TRUE;
  1197. m_pTabPaintManager->SetAppearance(xtpTabAppearancePropertyPageFlat);
  1198. m_pTabPaintManager->SetColor(xtpTabColorOffice2003);
  1199. m_pTabPaintManager->m_bHotTracking = TRUE;
  1200. m_nCaptionButtonStyle = xtpPaneCaptionButtonOffice2003;
  1201. }
  1202. CXTPDockingPaneOffice2003Theme::~CXTPDockingPaneOffice2003Theme()
  1203. {
  1204. }
  1205. void CXTPDockingPaneOffice2003Theme::RefreshMetrics()
  1206. {
  1207. CXTPDockingPaneOfficeTheme::RefreshMetrics();
  1208. m_clrNormalCaption.SetStandardValue(XTPColorManager()->LightColor(GetXtremeColor(COLOR_3DFACE), GetXtremeColor(COLOR_WINDOW), 0xcd), GetXtremeColor(COLOR_3DFACE));
  1209. m_clrNormalCaptionText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  1210. m_clrActiveCaption.SetStandardValue(GetXtremeColor(XPCOLOR_HIGHLIGHT_CHECKED));
  1211. m_clrActiveCaptionText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT));
  1212. m_bLunaTheme = FALSE;
  1213. if (XTPColorManager()->IsLowResolution())
  1214. {
  1215. m_clrNormalCaption.SetStandardValue(GetXtremeColor(COLOR_3DFACE));
  1216. m_clrActiveCaption.SetStandardValue(GetXtremeColor(COLOR_HIGHLIGHT));
  1217. m_clrActiveCaptionText.SetStandardValue(GetXtremeColor(COLOR_HIGHLIGHTTEXT));
  1218. }
  1219. XTPCurrentSystemTheme systemTheme = GetCurrentSystemTheme();
  1220. switch (systemTheme)
  1221. {
  1222. case xtpSystemThemeBlue:
  1223. case xtpSystemThemeRoyale:
  1224. case xtpSystemThemeAero:
  1225. {
  1226. m_clrNormalCaption.SetStandardValue(RGB(221, 236, 254), RGB(129, 169, 226), 0.75f);
  1227. m_clrSplitter.SetStandardValue(RGB(216, 231, 252));
  1228. m_clrSplitterGripper.SetStandardValue(GetXtremeColor(XPCOLOR_TOOLBAR_GRIPPER));
  1229. INT nElements[] =
  1230. {
  1231. XPCOLOR_TOOLBAR_GRIPPER, XPCOLOR_SEPARATOR, XPCOLOR_DISABLED, XPCOLOR_MENUBAR_FACE, XPCOLOR_MENUBAR_BORDER, XPCOLOR_HIGHLIGHT, XPCOLOR_HIGHLIGHT_BORDER, XPCOLOR_HIGHLIGHT_PUSHED_BORDER, XPCOLOR_HIGHLIGHT_CHECKED_BORDER, XPCOLOR_HIGHLIGHT_PUSHED, XPCOLOR_HIGHLIGHT_CHECKED, XPCOLOR_TOOLBAR_FACE, XPCOLOR_PUSHED_TEXT
  1232. };
  1233. COLORREF clrValues[] =
  1234. {
  1235. RGB(39, 65, 118), RGB(106, 140, 203), RGB(109, 150, 208), RGB(246, 246, 246), RGB(0, 45, 150), RGB(255, 238, 194), RGB(0, 0, 128), RGB(0, 0, 128), RGB(0, 0, 128), RGB(254, 128, 62), RGB(255, 192, 111), RGB(158, 190, 245), 0
  1236. };
  1237. SetColors(sizeof(nElements)/sizeof(INT), nElements, clrValues);
  1238. m_bLunaTheme = TRUE;
  1239. }
  1240. break;
  1241. case xtpSystemThemeOlive:
  1242. {
  1243. m_clrNormalCaption.SetStandardValue(RGB(244, 247, 222), RGB(183, 198, 145), 0.3f);
  1244. m_clrSplitter.SetStandardValue(RGB(226, 231, 191));
  1245. m_clrSplitterGripper.SetStandardValue(GetXtremeColor(XPCOLOR_TOOLBAR_GRIPPER));
  1246. INT nElements[] =
  1247. {
  1248. XPCOLOR_TOOLBAR_GRIPPER, XPCOLOR_SEPARATOR, XPCOLOR_DISABLED, XPCOLOR_MENUBAR_FACE, XPCOLOR_MENUBAR_BORDER, XPCOLOR_HIGHLIGHT, XPCOLOR_HIGHLIGHT_BORDER, XPCOLOR_HIGHLIGHT_CHECKED_BORDER, XPCOLOR_HIGHLIGHT_PUSHED_BORDER, XPCOLOR_HIGHLIGHT_PUSHED, XPCOLOR_HIGHLIGHT_CHECKED, XPCOLOR_TOOLBAR_FACE, XPCOLOR_PUSHED_TEXT
  1249. };
  1250. COLORREF clrValues[] =
  1251. {
  1252. RGB(81, 94, 51), RGB(96, 128, 88), RGB(159, 174, 122), RGB(244, 244, 238), RGB(117, 141, 94), RGB(255, 238, 194), RGB(63, 93, 56), RGB(63, 93, 56), RGB(63, 93, 56), RGB(254, 128, 62), RGB(255, 192, 111), RGB(217, 217, 167), 0
  1253. };
  1254. SetColors(sizeof(nElements)/sizeof(INT), nElements, clrValues);
  1255. m_bLunaTheme = TRUE;
  1256. }
  1257. break;
  1258. case xtpSystemThemeSilver:
  1259. {
  1260. m_clrNormalCaption.SetStandardValue(RGB(249, 249, 255), RGB(156, 155, 183), 0.75f);
  1261. m_clrSplitter.SetStandardValue(RGB(223, 223, 234));
  1262. m_clrSplitterGripper.SetStandardValue(GetXtremeColor(XPCOLOR_TOOLBAR_GRIPPER));
  1263. INT nElements[] =
  1264. {
  1265. XPCOLOR_TOOLBAR_GRIPPER, XPCOLOR_SEPARATOR, XPCOLOR_DISABLED, XPCOLOR_MENUBAR_FACE, XPCOLOR_MENUBAR_BORDER, XPCOLOR_HIGHLIGHT, XPCOLOR_HIGHLIGHT_BORDER, XPCOLOR_HIGHLIGHT_CHECKED_BORDER, XPCOLOR_HIGHLIGHT_PUSHED_BORDER, XPCOLOR_HIGHLIGHT_PUSHED, XPCOLOR_HIGHLIGHT_CHECKED, XPCOLOR_TOOLBAR_FACE, XPCOLOR_PUSHED_TEXT
  1266. };
  1267. COLORREF clrValues[] =
  1268. {
  1269. RGB(84, 84, 117), RGB(110, 109, 143), RGB(168, 167, 190), RGB(253, 250, 255), RGB(124, 124, 148), RGB(255, 238, 194), RGB(75, 75, 111), RGB(75, 75, 111), RGB(75, 75, 111), RGB(254, 128, 62), RGB(255, 192, 111), RGB(215, 215, 229), 0
  1270. };
  1271. SetColors(sizeof(nElements)/sizeof(INT), nElements, clrValues);
  1272. m_bLunaTheme = TRUE;
  1273. }
  1274. break;
  1275. }
  1276. if (m_bLunaTheme)
  1277. {
  1278. m_clrActiveCaption.SetStandardValue(RGB(255, 213, 140), RGB(255, 166, 76));
  1279. m_clrSplitterGradient.SetStandardValue(XTPColorManager()->grcDockBar);
  1280. }
  1281. }
  1282. CRect CXTPDockingPaneOffice2003Theme::GetCaptionGripperRect(const CXTPDockingPaneTabbedContainer* /*pPane*/)
  1283. {
  1284. return CRect(0, 0, 10, m_nTitleHeight);
  1285. }
  1286. CRect CXTPDockingPaneOffice2003Theme::GetPaneCaptionRect(const CXTPDockingPaneSidePanel* pPane)
  1287. {
  1288. CXTPClientRect rect(pPane);
  1289. rect.DeflateRect(1, 1);
  1290. int nTitleFont = GetCaptionHeight() + 2;
  1291. XTPDockingPaneDirection direction = pPane->GetDirection();
  1292. if (direction == xtpPaneDockLeft) rect.right = rect.left + nTitleFont;
  1293. else if (direction == xtpPaneDockRight) rect.left = rect.right - nTitleFont;
  1294. else if (direction == xtpPaneDockTop) rect.bottom = rect.top + nTitleFont;
  1295. else if (direction == xtpPaneDockBottom) rect.top = rect.bottom - nTitleFont;
  1296. return rect;
  1297. }
  1298. int CXTPDockingPanePaintManager::DrawCaptionText(CDC* pDC, const CString& strTitle, CRect rcText, BOOL bVertical, BOOL bCalcWidth)
  1299. {
  1300. int nWidth = 0;
  1301. if (strTitle.IsEmpty())
  1302. return 0;
  1303. if (bVertical)
  1304. {
  1305. CXTPFontDC font(pDC, &m_fntTitleVertical);
  1306. CSize sz = pDC->GetTextExtent(strTitle);
  1307. if (rcText.bottom > rcText.top)
  1308. {
  1309. rcText.left = (rcText.right - (rcText.Width() - sz.cy) / 2);
  1310. rcText.right = rcText.left + rcText.Height();
  1311. pDC->DrawText(strTitle, rcText, DT_NOPREFIX | DT_SINGLELINE | DT_NOCLIP | DT_END_ELLIPSIS);
  1312. }
  1313. nWidth = sz.cx;
  1314. }
  1315. else
  1316. {
  1317. CXTPFontDC font(pDC, &m_fntTitle);
  1318. pDC->DrawText(strTitle, rcText, DT_SINGLELINE | DT_END_ELLIPSIS | DT_VCENTER | DT_NOPREFIX);
  1319. if (bCalcWidth)
  1320. {
  1321. CXTPEmptyRect rcCalc;
  1322. pDC->DrawText(strTitle, rcCalc, DT_CALCRECT | DT_SINGLELINE | DT_NOPREFIX);
  1323. nWidth = rcCalc.Width();
  1324. }
  1325. }
  1326. return nWidth;
  1327. }
  1328. CXTPDockingPane* CXTPDockingPanePaintManager::GetSelectedPane(CXTPDockingPaneBase* pPane)
  1329. {
  1330. if (pPane->GetType() == xtpPaneTypeTabbedContainer)
  1331. {
  1332. return ((CXTPDockingPaneTabbedContainer*)pPane)->GetSelected();
  1333. }
  1334. if (pPane->GetType() == xtpPaneTypeSidePanel)
  1335. {
  1336. return ((CXTPDockingPaneSidePanel*)pPane)->GetSelectedPane();
  1337. }
  1338. else if (pPane->GetType() == xtpPaneTypeMiniWnd)
  1339. {
  1340. CXTPDockingPaneBaseList lst;
  1341. pPane->FindPane(xtpPaneTypeTabbedContainer, &lst);
  1342. if (lst.GetCount() == 1)
  1343. {
  1344. return ((CXTPDockingPaneTabbedContainer*)lst.GetHead())->GetSelected();
  1345. }
  1346. }
  1347. return NULL;
  1348. }
  1349. BOOL CXTPDockingPanePaintManager::IsCaptionEnabled(CXTPDockingPaneBase* pPane)
  1350. {
  1351. CXTPDockingPane* pSelectedPane = GetSelectedPane(pPane);
  1352. if (!pSelectedPane)
  1353. return TRUE;
  1354. return pSelectedPane->GetEnabled() & xtpPaneEnableClient;
  1355. }
  1356. void CXTPDockingPanePaintManager::DrawCaptionIcon(CDC* pDC, CXTPDockingPaneBase* pPane, CRect& rcCaption, BOOL bVertical)
  1357. {
  1358. if (!m_bDrawCaptionIcon)
  1359. return;
  1360. CSize szIcon = GetTabPaintManager()->m_szIcon;
  1361. CXTPDockingPane* pSelectedPane = GetSelectedPane(pPane);
  1362. CXTPImageManagerIcon* pImage = pSelectedPane ? pSelectedPane->GetIcon(szIcon.cx) : NULL;
  1363. if (!pImage)
  1364. return;
  1365. BOOL bEnabled = IsCaptionEnabled(pPane);
  1366. CXTPImageManagerIconHandle& imageHandle = !bEnabled ? pImage->GetDisabledIcon(): pImage->GetIcon();
  1367. if (!bVertical && rcCaption.Width() >= szIcon.cx)
  1368. {
  1369. pImage->Draw(pDC, CPoint(rcCaption.left, rcCaption.CenterPoint().y - szIcon.cy / 2),
  1370. imageHandle, szIcon);
  1371. rcCaption.left += szIcon.cx + 3;
  1372. }
  1373. else if (bVertical && rcCaption.Height() >= szIcon.cy)
  1374. {
  1375. pImage->Draw(pDC, CPoint(rcCaption.CenterPoint().x - szIcon.cy / 2, rcCaption.top),
  1376. imageHandle, szIcon);
  1377. rcCaption.top += szIcon.cy + 3;
  1378. }
  1379. }
  1380. void CXTPDockingPaneOffice2003Theme::DrawCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, const CString& strTitle, BOOL bActive, BOOL bVertical)
  1381. {
  1382. COLORREF clrText = bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText ;
  1383. XTPDeflateRectDirection(rcCaption, 0, 0, 4, 0, bVertical);
  1384. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, clrText, 16, 0, bVertical);
  1385. if (!bVertical && m_bDrawGripper && (rcCaption.right > rcCaption.left + 7))
  1386. {
  1387. for (int y = rcCaption.top + 5; y < rcCaption.bottom - 3; y += 4)
  1388. {
  1389. pDC->FillSolidRect(rcCaption.left + 4 + 2, y + 1, 2, 2, GetXtremeColor(COLOR_WINDOW));
  1390. pDC->FillSolidRect(rcCaption.left + 3 + 2, y, 2, 2, GetXtremeColor(XPCOLOR_TOOLBAR_GRIPPER));
  1391. }
  1392. rcCaption.left += 8;
  1393. }
  1394. if (bVertical && m_bDrawGripper && (rcCaption.bottom > rcCaption.top + 7))
  1395. {
  1396. for (int x = rcCaption.left + 3; x < rcCaption.right - 5; x += 4)
  1397. {
  1398. pDC->FillSolidRect(x + 2, rcCaption.top + 4 + 2, 2, 2, GetXtremeColor(COLOR_WINDOW));
  1399. pDC->FillSolidRect(x + 1, rcCaption.top + 3 + 2, 2, 2, GetXtremeColor(XPCOLOR_TOOLBAR_GRIPPER));
  1400. }
  1401. rcCaption.top += 8;
  1402. }
  1403. pDC->SetTextColor(IsCaptionEnabled(pPane) ? clrText : m_clrDisabledCaptionText);
  1404. XTPDeflateRectDirection(rcCaption, 6, 1, 2, 0, bVertical);
  1405. DrawCaptionIcon(pDC, pPane, rcCaption, bVertical);
  1406. DrawCaptionText(pDC, strTitle, rcCaption, bVertical);
  1407. }
  1408. void CXTPDockingPaneOffice2003Theme::DrawFloatingFrame(CDC* pDC, CXTPDockingPaneMiniWnd* pPane, CRect rc)
  1409. {
  1410. COLORREF clrFrame = GetXtremeColor(XPCOLOR_MENUBAR_BORDER);
  1411. pDC->Draw3dRect(rc, clrFrame, clrFrame);
  1412. rc.DeflateRect(1, 1);
  1413. pDC->Draw3dRect(rc, clrFrame, clrFrame);
  1414. rc.DeflateRect(1, 1);
  1415. pDC->Draw3dRect(rc, clrFrame, clrFrame);
  1416. XTPDrawHelpers()->ExcludeCorners(pDC, rc);
  1417. pDC->Draw3dRect(rc, m_clrNormalCaption.clrDark, m_clrNormalCaption.clrDark);
  1418. int nTitleHeight = m_nTitleHeight;
  1419. CRect rcCaption(rc);
  1420. rcCaption.DeflateRect(0, 0, 0, rc.Height() - nTitleHeight - 3);
  1421. CXTPBufferDC dcCache(*pDC, rcCaption);
  1422. dcCache.SetBkMode(TRANSPARENT);
  1423. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1424. XTPDrawHelpers()->GradientFill(&dcCache, rcCaption,
  1425. bActive ? m_clrActiveCaption : m_clrNormalCaption, FALSE);
  1426. dcCache.SetPixel(rcCaption.left, rcCaption.bottom, m_clrNormalCaption.clrDark);
  1427. dcCache.SetPixel(rcCaption.right - 1, rcCaption.bottom, m_clrNormalCaption.clrDark);
  1428. rcCaption.DeflateRect(1, 0);
  1429. CString strTitle;
  1430. pPane->GetWindowText(strTitle);
  1431. DrawCaptionPart(&dcCache, pPane, rcCaption, strTitle, bActive, FALSE);
  1432. }
  1433. void CXTPDockingPaneOffice2003Theme::DrawSidePanel(CDC* pDC, CXTPDockingPaneSidePanel* pPane, CRect rc)
  1434. {
  1435. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1436. pDC->FillSolidRect(rc, bActive ? m_clrActiveCaption : m_clrNormalCaption);
  1437. pDC->SetBkMode(TRANSPARENT);
  1438. pDC->Draw3dRect(rc, GetXtremeColor(COLOR_WINDOWFRAME), GetXtremeColor(COLOR_WINDOWFRAME));
  1439. rc.DeflateRect(1, 1);
  1440. CRect rcCaption = rc;
  1441. int nTitleFont = GetCaptionHeight() + 2;
  1442. XTPDockingPaneDirection direction = pPane->GetDirection();
  1443. if (direction == xtpPaneDockLeft) rcCaption.right = rcCaption.left + nTitleFont;
  1444. else if (direction == xtpPaneDockRight) rcCaption.left = rcCaption.right - nTitleFont;
  1445. else if (direction == xtpPaneDockTop) rcCaption.bottom = rcCaption.top + nTitleFont;
  1446. else if (direction == xtpPaneDockBottom) rcCaption.top = rcCaption.bottom - nTitleFont;
  1447. BOOL bVertical = direction == xtpPaneDockLeft || direction == xtpPaneDockRight;
  1448. XTPDrawHelpers()->GradientFill(pDC, rcCaption, bActive ? m_clrActiveCaption : m_clrNormalCaption, bVertical);
  1449. DrawCaptionPart(pDC, pPane, rcCaption, pPane->GetTitle(), bActive, bVertical);
  1450. }
  1451. void CXTPDockingPaneOffice2003Theme::DrawCaption(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  1452. {
  1453. BOOL bVertical = pPane->IsCaptionVertical();
  1454. int nTitleHeight = m_nTitleHeight;
  1455. CRect rcCaption(rc);
  1456. if (bVertical)
  1457. {
  1458. rcCaption.DeflateRect(0, 0, rc.Width() - nTitleHeight - 3, 0);
  1459. }
  1460. else
  1461. {
  1462. rcCaption.DeflateRect(0, 0, 0, rc.Height() - nTitleHeight - 3);
  1463. }
  1464. CRect rcFill(rcCaption);
  1465. if (m_bRoundedCaption)
  1466. {
  1467. XTPDeflateRectDirection(rcFill, 1, 0, 0, 0, bVertical);
  1468. pDC->FillSolidRect(rcCaption, m_clrSplitter);
  1469. XTPDrawHelpers()->ExcludeCorners(pDC, rcFill);
  1470. }
  1471. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1472. XTPDrawHelpers()->GradientFill(pDC, rcFill,
  1473. bActive ? m_clrActiveCaption : m_clrNormalCaption, bVertical);
  1474. if (!m_bRoundedCaption)
  1475. {
  1476. pDC->FillSolidRect(rcCaption.left, rcCaption.top, 1, rcCaption.Height(), GetXtremeColor(XPCOLOR_FRAME));
  1477. pDC->FillSolidRect(rcCaption.left, rcCaption.top, rcCaption.Width(), 1, GetXtremeColor(XPCOLOR_FRAME));
  1478. pDC->FillSolidRect(rcCaption.right - 1, rcCaption.top, 1, rcCaption.Height(), GetXtremeColor(XPCOLOR_FRAME));
  1479. }
  1480. CString strTitle = pPane->GetTitle();
  1481. DrawCaptionPart(pDC, pPane, rcCaption, strTitle, bActive, bVertical);
  1482. }
  1483. //////////////////////////////////////////////////////////////////////////
  1484. // CXTPDockingPaneOffice2007Theme
  1485. CXTPDockingPaneOffice2007Theme::CXTPDockingPaneOffice2007Theme()
  1486. {
  1487. m_bRoundedCaption = FALSE;
  1488. m_dwSplitterStyle = xtpPaneSplitterGradientVert;
  1489. m_bDrawGripper = FALSE;
  1490. m_pPanelPaintManager->SetAppearance(xtpTabAppearancePropertyPage2007);
  1491. m_pPanelPaintManager->m_bHotTracking = TRUE;
  1492. m_pTabPaintManager->SetAppearance(xtpTabAppearancePropertyPage2007);
  1493. m_pTabPaintManager->m_bHotTracking = TRUE;
  1494. m_pPanelPaintManager->m_rcButtonMargin.SetRect(2, 1, 2, 1);
  1495. m_pTabPaintManager->m_rcButtonMargin.SetRect(2, 1, 2, 1);
  1496. m_nCaptionFontGap = 5;
  1497. }
  1498. void CXTPDockingPaneOffice2007Theme::DrawCaption(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  1499. {
  1500. BOOL bVertical = pPane->IsCaptionVertical();
  1501. int nTitleHeight = m_nTitleHeight;
  1502. CRect rcCaption(rc);
  1503. if (bVertical)
  1504. {
  1505. rcCaption.DeflateRect(0, 0, rc.Width() - nTitleHeight - 3, 0);
  1506. }
  1507. else
  1508. {
  1509. rcCaption.DeflateRect(0, 0, 0, rc.Height() - nTitleHeight - 3);
  1510. }
  1511. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1512. XTPDrawHelpers()->GradientFill(pDC, rcCaption,  bActive ? m_clrActiveCaption : m_clrNormalCaption, bVertical);
  1513. DrawCaptionPart(pDC, pPane, rcCaption, pPane->GetTitle(), bActive, bVertical);
  1514. }
  1515. void CXTPDockingPaneOffice2007Theme::RefreshMetrics()
  1516. {
  1517. CXTPDockingPaneOffice2003Theme::RefreshMetrics();
  1518. if (XTPOffice2007Images()->IsValid())
  1519. {
  1520. m_arrColor[XPCOLOR_FRAME] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("WindowFrame"));
  1521. m_arrColor[XPCOLOR_3DFACE] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("ButtonFace"));
  1522. m_arrColor[COLOR_3DHIGHLIGHT] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("EdgeHighLightColor"));
  1523. m_clrSplitter.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("Splitter")));
  1524. m_clrSplitterGripper.SetStandardValue(m_arrColor[XPCOLOR_FRAME]);
  1525. m_arrColor[XPCOLOR_TOOLBAR_GRIPPER] = XTPOffice2007Images()->GetImageColor(_T("Toolbar"), _T("ToolbarGripper"));
  1526. m_arrColor[XPCOLOR_MENUBAR_BORDER] = XTPOffice2007Images()->GetImageColor(_T("Toolbar"), _T("MenuPopupBorder"));
  1527. m_bLunaTheme = TRUE;
  1528. m_clrSplitterGradient.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("SplitterLight")),
  1529. XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("SplitterDark")));
  1530. m_clrNormalCaption.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("NormalCaptionLight")),
  1531. XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("NormalCaptionDark")), 0.25f);
  1532. m_clrNormalCaptionText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("NormalCaptionText")));
  1533. m_clrActiveCaption.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("ActiveCaptionLight")),
  1534. XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("ActiveCaptionDark")), 0.25f);
  1535. m_clrActiveCaptionText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("ActiveCaptionText")));
  1536. }
  1537. else
  1538. {
  1539. m_arrColor[XPCOLOR_FRAME] = RGB(101, 147, 207);
  1540. m_arrColor[XPCOLOR_3DFACE] = RGB(191, 219, 255);
  1541. m_arrColor[COLOR_3DHIGHLIGHT] = RGB(255, 255, 255);
  1542. m_clrNormalCaption.SetStandardValue(RGB(227, 239, 255), RGB(175, 210, 255), 0.25f);
  1543. m_clrSplitter.SetStandardValue(RGB(216, 231, 252));
  1544. m_clrSplitterGripper.SetStandardValue(GetXtremeColor(XPCOLOR_TOOLBAR_GRIPPER));
  1545. m_clrSplitterGradient.SetStandardValue(RGB(190, 218, 254), RGB(100, 143, 203));
  1546. INT nElements[] =
  1547. {
  1548. XPCOLOR_TOOLBAR_GRIPPER, XPCOLOR_SEPARATOR, XPCOLOR_DISABLED, XPCOLOR_MENUBAR_FACE, XPCOLOR_MENUBAR_BORDER, XPCOLOR_HIGHLIGHT, XPCOLOR_HIGHLIGHT_BORDER, XPCOLOR_HIGHLIGHT_PUSHED_BORDER, XPCOLOR_HIGHLIGHT_CHECKED_BORDER, XPCOLOR_HIGHLIGHT_PUSHED, XPCOLOR_HIGHLIGHT_CHECKED, XPCOLOR_TOOLBAR_FACE, XPCOLOR_PUSHED_TEXT
  1549. };
  1550. COLORREF clrValues[] =
  1551. {
  1552. RGB(39, 65, 118), RGB(106, 140, 203), RGB(109, 150, 208), RGB(246, 246, 246), RGB(0, 45, 150), RGB(255, 238, 194), RGB(0, 0, 128), RGB(0, 0, 128), RGB(0, 0, 128), RGB(254, 128, 62), RGB(255, 192, 111), RGB(158, 190, 245), 0
  1553. };
  1554. SetColors(sizeof(nElements)/sizeof(INT), nElements, clrValues);
  1555. m_bLunaTheme = TRUE;
  1556. m_clrActiveCaption.SetStandardValue(RGB(255, 231, 162), RGB(255, 166, 76));
  1557. m_clrNormalCaptionText.SetStandardValue(RGB(8, 55, 114));
  1558. m_clrActiveCaptionText.SetStandardValue(RGB(8, 55, 114));
  1559. }
  1560. }
  1561. //////////////////////////////////////////////////////////////////////////
  1562. // CXTPDockingPaneWord2007Theme
  1563. CXTPDockingPaneWord2007Theme::CXTPDockingPaneWord2007Theme()
  1564. {
  1565. m_bRoundedCaption = FALSE;
  1566. m_dwSplitterStyle = xtpPaneSplitterFlat;
  1567. m_bDrawGripper = FALSE;
  1568. m_pPanelPaintManager->SetAppearance(xtpTabAppearancePropertyPageAccess2007);
  1569. m_pPanelPaintManager->m_bHotTracking = TRUE;
  1570. m_pTabPaintManager->SetAppearance(xtpTabAppearancePropertyPageAccess2007);
  1571. m_pTabPaintManager->m_bHotTracking = TRUE;
  1572. m_nCaptionFontGap = 2;
  1573. m_nSplitterSize = 0;
  1574. m_nSplitterIndent = 2;
  1575. }
  1576. void CXTPDockingPaneWord2007Theme::DrawCaption(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  1577. {
  1578. BOOL bVertical = pPane->IsCaptionVertical();
  1579. int nTitleHeight = m_nTitleHeight;
  1580. CRect rcCaption(rc);
  1581. if (bVertical)
  1582. {
  1583. rcCaption.DeflateRect(0, 0, rc.Width() - nTitleHeight - 3, 0);
  1584. }
  1585. else
  1586. {
  1587. rcCaption.DeflateRect(0, 0, 0, rc.Height() - nTitleHeight - 3);
  1588. }
  1589. CRect rcFill(rcCaption);
  1590. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1591. XTPDrawHelpers()->GradientFill(pDC, rcFill, bActive ? m_clrActiveCaption : m_clrNormalCaption, bVertical);
  1592. CString strTitle = pPane->GetTitle();
  1593. DrawCaptionPart(pDC, pPane, rcCaption, strTitle, bActive, bVertical);
  1594. }
  1595. void CXTPDockingPaneWord2007Theme::DrawCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, const CString& strTitle, BOOL bActive, BOOL bVertical)
  1596. {
  1597. COLORREF clrText = bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText;
  1598. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, clrText, 16, 0, bVertical);
  1599. pDC->SetTextColor(IsCaptionEnabled(pPane) ? clrText : m_clrDisabledCaptionText);
  1600. XTPDeflateRectDirection(rcCaption, 2, 1, 2, 0, bVertical);
  1601. DrawCaptionIcon(pDC, pPane, rcCaption, bVertical);
  1602. DrawCaptionText(pDC, strTitle, rcCaption, bVertical);
  1603. }
  1604. BOOL CXTPDockingPaneWord2007Theme::PaneHasBorders(CXTPDockingPaneTabbedContainer* pPane) const
  1605. {
  1606. return pPane->IsTitleVisible();
  1607. }
  1608. void CXTPDockingPaneWord2007Theme::AdjustClientRect(CXTPDockingPaneTabbedContainer* pPane, CRect& rect, BOOL bApply)
  1609. {
  1610. if (PaneHasBorders(pPane))
  1611. {
  1612. rect.DeflateRect(3, 3);
  1613. }
  1614. CXTPDockingPaneOffice2003Theme::AdjustClientRect(pPane, rect, bApply);
  1615. }
  1616. void CXTPDockingPaneWord2007Theme::DrawPane(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  1617. {
  1618. if (PaneHasBorders(pPane))
  1619. {
  1620. pDC->FillSolidRect(rc, m_arrColor[XPCOLOR_FRAME]);
  1621. pDC->FillSolidRect(rc.left + 3, rc.top + 2, rc.Width() - 6, 1, m_arrColor[XPCOLOR_TOOLBAR_GRIPPER]);
  1622. pDC->FillSolidRect(rc.left + 2, rc.top + 3, 1, rc.Height() - 5, m_arrColor[XPCOLOR_TOOLBAR_GRIPPER]);
  1623. pDC->FillSolidRect(rc.right - 3, rc.top + 3, 1, rc.Height() - 5, m_arrColor[XPCOLOR_TOOLBAR_GRIPPER]);
  1624. pDC->FillSolidRect(rc.left + 2, rc.bottom - 3, rc.Width() - 4, 1, m_arrColor[XPCOLOR_TOOLBAR_GRIPPER]);
  1625. rc.DeflateRect(3, 3);
  1626. }
  1627. CXTPDockingPaneOffice2003Theme::DrawPane(pDC, pPane, rc);
  1628. }
  1629. void CXTPDockingPaneWord2007Theme::RefreshMetrics()
  1630. {
  1631. CXTPDockingPaneOffice2003Theme::RefreshMetrics();
  1632. m_arrColor[XPCOLOR_FRAME] = XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordSplitter"));
  1633. m_arrColor[XPCOLOR_3DFACE] = XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordPaneBackground"));
  1634. m_arrColor[COLOR_3DHIGHLIGHT] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("EdgeHighLightColor"));
  1635. m_arrColor[XPCOLOR_TOOLBAR_GRIPPER] = XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordPaneBorder"));
  1636. m_arrColor[XPCOLOR_MENUBAR_BORDER] = XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordSplitter"));
  1637. m_arrColor[XPCOLOR_HIGHLIGHT_BORDER] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("HighlightSelectedBorder"));
  1638. m_arrColor[XPCOLOR_HIGHLIGHT] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("HighlightSelected"));
  1639. m_arrColor[XPCOLOR_HIGHLIGHT_PUSHED_BORDER] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("HighlightPressedBorder"));
  1640. m_arrColor[XPCOLOR_HIGHLIGHT_PUSHED] = XTPOffice2007Images()->GetImageColor(_T("Window"), _T("HighlightPressed"));
  1641. m_arrColor[XPCOLOR_HIGHLIGHT_TEXT] = 0;
  1642. m_arrColor[XPCOLOR_PUSHED_TEXT] = 0;
  1643. m_bLunaTheme = FALSE;
  1644. m_clrSplitterGradient.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordSplitter")));
  1645. m_clrSplitter.SetStandardValue(m_clrSplitterGradient);
  1646. m_clrNormalCaption.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordNormalCaption")));
  1647. m_clrNormalCaptionText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordCaptionText")));
  1648. m_clrActiveCaption.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordActiveCaption")));
  1649. m_clrActiveCaptionText.SetStandardValue(XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordCaptionText")));
  1650. m_clrSplitterGripper.SetStandardValue(m_clrNormalCaptionText);
  1651. }
  1652. ///////////////////////////////////////////////////////////////////////////////
  1653. // CXTPDockingPaneShortcutBar2003Theme
  1654. CXTPDockingPaneShortcutBar2003Theme::CXTPDockingPaneShortcutBar2003Theme()
  1655. {
  1656. m_bDrawGripper = FALSE;
  1657. m_bRoundedCaption = FALSE;
  1658. m_nCaptionFontGap = 3;
  1659. }
  1660. CXTPDockingPaneShortcutBar2003Theme::~CXTPDockingPaneShortcutBar2003Theme()
  1661. {
  1662. }
  1663. void CXTPDockingPaneShortcutBar2003Theme::RefreshMetrics()
  1664. {
  1665. CXTPDockingPaneOffice2003Theme::RefreshMetrics();
  1666. CWindowDC dc(CWnd::GetDesktopWindow());
  1667. if (m_bUseStandardFont)
  1668. {
  1669. LOGFONT lf = { sizeof(LOGFONT)};
  1670. VERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT,
  1671. sizeof(LOGFONT), &lf, 0));
  1672. STRCPY_S(lf.lfFaceName, LF_FACESIZE, _T("Arial"));
  1673. lf.lfWeight = FW_BOLD;
  1674. lf.lfHeight = 20;
  1675. SetCaptionFontIndirect(&lf);
  1676. }
  1677. if (m_bLunaTheme)
  1678. {
  1679. m_clrNormalCaption.SetStandardValue(XTPColorManager()->grcCaption);
  1680. m_clrNormalCaptionText.SetStandardValue(RGB(255, 255, 255));
  1681. }
  1682. else
  1683. {
  1684. m_clrNormalCaption.SetStandardValue(XTPColorManager()->LightColor(
  1685. GetXtremeColor(COLOR_3DSHADOW), GetXtremeColor(COLOR_WINDOW), 0xcd),
  1686. GetXtremeColor(COLOR_3DSHADOW));
  1687. }
  1688. }
  1689. CRect CXTPDockingPaneShortcutBar2003Theme::GetCaptionGripperRect(const CXTPDockingPaneTabbedContainer* /*pPane*/)
  1690. {
  1691. return CRect(0, 0, 0, 0);
  1692. }
  1693. //////////////////////////////////////////////////////////////////////////
  1694. ///
  1695. CXTPDockingPaneNativeXPTheme::CXTPDockingPaneNativeXPTheme()
  1696. {
  1697. m_pPanelPaintManager->SetAppearance(xtpTabAppearancePropertyPage);
  1698. m_pPanelPaintManager->SetColor(xtpTabColorWinXP);
  1699. m_pPanelPaintManager->m_bHotTracking = TRUE;
  1700. m_pTabPaintManager->SetAppearance(xtpTabAppearancePropertyPage);
  1701. m_pTabPaintManager->SetColor(xtpTabColorWinXP);
  1702. m_pTabPaintManager->m_bHotTracking = TRUE;
  1703. m_bGradientCaption = TRUE;
  1704. m_nCaptionFontGap = 7;
  1705. m_nCaptionButtonStyle = xtpPaneCaptionButtonThemedExplorerBar;
  1706. }
  1707. void CXTPDockingPaneNativeXPTheme::RefreshMetrics()
  1708. {
  1709. CXTPDockingPaneOfficeTheme::RefreshMetrics();
  1710. if (m_themeWindow.IsAppThemed())
  1711. {
  1712. m_clrActiveCaptionText.SetStandardValue(GetXtremeColor(COLOR_CAPTIONTEXT));
  1713. m_clrNormalCaptionText.SetStandardValue(GetXtremeColor(COLOR_INACTIVECAPTIONTEXT));
  1714. }
  1715. }
  1716. void CXTPDockingPaneNativeXPTheme::DrawFloatingFrame(CDC* pDC, CXTPDockingPaneMiniWnd* pPane, CRect rc)
  1717. {
  1718. if (!m_themeWindow.IsAppThemed())
  1719. {
  1720. CXTPDockingPaneOfficeTheme::DrawFloatingFrame(pDC, pPane, rc);
  1721. return;
  1722. }
  1723. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1724. int nState = bActive ? CS_ACTIVE : CS_INACTIVE;
  1725. m_themeWindow.DrawThemeBackground(pDC->GetSafeHdc(), WP_SMALLFRAMELEFT, nState, CRect(rc.left, rc.top, rc.left + 3, rc.bottom), 0);
  1726. m_themeWindow.DrawThemeBackground(pDC->GetSafeHdc(), WP_SMALLFRAMERIGHT, nState, CRect(rc.right - 3, rc.top, rc.right, rc.bottom), 0);
  1727. m_themeWindow.DrawThemeBackground(pDC->GetSafeHdc(), WP_SMALLFRAMEBOTTOM, nState, CRect(rc.left, rc.bottom - 3, rc.right, rc.bottom), 0);
  1728. int nTitleHeight = m_nTitleHeight;
  1729. CRect rcCaption(rc);
  1730. rcCaption.DeflateRect(0, 0, 0, rc.Height() - nTitleHeight - 3 - 2);
  1731. CXTPBufferDC dcCache(*pDC, rcCaption);
  1732. dcCache.SetBkMode(TRANSPARENT);
  1733. m_themeWindow.DrawThemeBackground(dcCache, WP_SMALLCAPTION, nState, rcCaption, 0);
  1734. rcCaption.DeflateRect(3, 0);
  1735. CString strTitle;
  1736. pPane->GetWindowText(strTitle);
  1737. DrawCaptionPart(&dcCache, pPane, rcCaption, strTitle, bActive, FALSE);
  1738. }
  1739. void CXTPDockingPaneNativeXPTheme::DrawSidePanel(CDC* pDC, CXTPDockingPaneSidePanel* pPane, CRect rc)
  1740. {
  1741. CXTPDockingPaneOfficeTheme::DrawSidePanel(pDC, pPane, rc);
  1742. }
  1743. void CXTPDockingPaneNativeXPTheme::DrawCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, const CString& strTitle, BOOL bActive, BOOL bVertical)
  1744. {
  1745. if (!m_themeWindow.IsAppThemed())
  1746. {
  1747. CXTPDockingPaneOfficeTheme::DrawCaptionPart(pDC, pPane, rcCaption, strTitle, bActive, bVertical);
  1748. return;
  1749. }
  1750. COLORREF clrText = bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText;
  1751. COLORREF clrButton = clrText;
  1752. if (pPane->GetType() == xtpPaneTypeSidePanel)
  1753. {
  1754. clrButton = FillCaptionPart(pDC, pPane, rcCaption, bActive, bVertical);
  1755. }
  1756. XTPDeflateRectDirection(rcCaption, 0, 0, 2, 0, bVertical);
  1757. DrawCaptionButtons(pDC, pPane->GetCaptionButtons(), rcCaption, clrButton, 16, 3, bVertical);
  1758. pDC->SetTextColor(IsCaptionEnabled(pPane) ? clrText : m_clrDisabledCaptionText);
  1759. XTPDeflateRectDirection(rcCaption, 4, 1, 0, 0, bVertical);
  1760. DrawCaptionIcon(pDC, pPane, rcCaption, bVertical);
  1761. DrawCaptionText(pDC, strTitle, rcCaption, bVertical);
  1762. }
  1763. void CXTPDockingPaneNativeXPTheme::DrawCaption(CDC* pDC, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  1764. {
  1765. if (!m_themeWindow.IsAppThemed())
  1766. {
  1767. CXTPDockingPaneOfficeTheme::DrawCaption(pDC, pPane, rc);
  1768. return;
  1769. }
  1770. BOOL bVertical = pPane->IsCaptionVertical();
  1771. BOOL bActive = m_bHighlightActiveCaption && pPane->IsActive();
  1772. CRect rcCaption(0, 0, rc.right, m_nTitleHeight + 1);
  1773. if (bVertical)
  1774. {
  1775. rcCaption = CRect(0, 0, m_nTitleHeight + 1, rc.bottom);
  1776. }
  1777. m_themeWindow.DrawThemeBackground(pDC->GetSafeHdc(), WP_SMALLCAPTION, bActive ? CS_ACTIVE : CS_INACTIVE, rcCaption, 0);
  1778. CString strTitle = pPane->GetTitle();
  1779. DrawCaptionPart(pDC, pPane, rcCaption, strTitle, bActive, bVertical);
  1780. }
  1781. //////////////////////////////////////////////////////////////////////////
  1782. // CXTPDockingPaneWhidbeyTheme
  1783. class CXTPDockingPaneWhidbeyTheme::CColorSetWhidbey : public CXTPTabPaintManager::CColorSetOffice2003
  1784. {
  1785. public:
  1786. CColorSetWhidbey(BOOL bHighlightSelected)
  1787. {
  1788. m_bHighlightSelected = bHighlightSelected;
  1789. m_bTransparentButton = FALSE;
  1790. m_bGradientButton = FALSE;
  1791. }
  1792. void RefreshMetrics();
  1793. void XTPFillFramePartRect(CDC* pDC, CRect rc, CWnd* pWnd, CWnd* pSite)
  1794. {
  1795. ::XTPFillFramePartRect(pDC, rc, pWnd, pSite, m_clrHeaderFace, TRUE);
  1796. }
  1797. void FillHeader(CDC* pDC, CRect rc, CXTPTabManager* pTabManager)
  1798. {
  1799. XTPFillFramePartRect(pDC, rc, (CXTPDockingPaneTabbedContainer*)pTabManager, ((CXTPDockingPaneTabbedContainer*)pTabManager)->GetDockingSite());
  1800. }
  1801. COLORREF FillPropertyButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem)
  1802. {
  1803. if (m_bTransparentButton && (!m_bHighlightSelected || !pItem->IsSelected()))
  1804. return COLORREF_NULL;
  1805. if (m_bGradientButton)
  1806. return CColorSetOffice2003::FillPropertyButton(pDC, rcItem, pItem);
  1807. return CColorSet::FillPropertyButton(pDC, rcItem, pItem);
  1808. }
  1809. protected:
  1810. BOOL m_bGradientButton;
  1811. BOOL m_bTransparentButton;
  1812. BOOL m_bHighlightSelected;
  1813. };
  1814. void CXTPDockingPaneWhidbeyTheme::CColorSetWhidbey::RefreshMetrics()
  1815. {
  1816. CColorSet::RefreshMetrics();
  1817. if (m_bHighlightSelected)
  1818. {
  1819. m_clrButtonSelected.SetStandardValue(GetSysColor(COLOR_WINDOW));
  1820. m_clrSelectedText.SetStandardValue(GetSysColor(COLOR_WINDOWTEXT));
  1821. }
  1822. else
  1823. {
  1824. m_clrSelectedText.SetStandardValue(GetSysColor(COLOR_3DDKSHADOW));
  1825. }
  1826. m_clrHeaderFace.SetStandardValue(GetSysColor(COLOR_3DFACE), XTPColorManager()->LightColor(GetSysColor(COLOR_3DFACE), GetSysColor(COLOR_WINDOW), 0xcd));
  1827. m_clrNormalText.SetStandardValue(GetSysColor(COLOR_3DDKSHADOW));
  1828. m_bGradientButton = FALSE;
  1829. m_bLunaTheme = FALSE;
  1830. switch (XTPColorManager()->GetCurrentSystemTheme())
  1831. {
  1832. case xtpSystemThemeSilver:
  1833. m_bGradientButton = TRUE;
  1834. m_clrButtonNormal.SetStandardValue(RGB(242, 242, 247));
  1835. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(RGB(255, 255, 255));
  1836. m_csPropertyPage2003.clrDarkShadow.SetStandardValue(RGB(145, 155, 156));
  1837. m_csPropertyPage2003.clrFrameBorder.SetStandardValue(RGB(145, 155, 156));
  1838. m_csPropertyPage2003.clrBorderLeftHighlight.SetStandardValue(RGB(190, 190, 216));
  1839. m_clrHeaderFace.SetStandardValue(RGB(215, 215, 229), RGB(243, 243, 247));
  1840. break;
  1841. case xtpSystemThemeBlue:
  1842. m_bGradientButton = TRUE;
  1843. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(RGB(255, 255, 255));
  1844. m_clrHeaderFace.SetStandardValue(RGB(229, 229, 215), RGB(244, 241, 231));
  1845. break;
  1846. case xtpSystemThemeOlive:
  1847. m_bGradientButton = TRUE;
  1848. m_csPropertyPage2003.clrBorderTopHighlight.SetStandardValue(RGB(255, 255, 255));
  1849. m_clrHeaderFace.SetStandardValue(RGB(229, 229, 215), RGB(244, 241, 231));
  1850. break;
  1851. }
  1852. m_clrAutoHideFace.SetStandardValue(m_clrHeaderFace);
  1853. }
  1854. class CXTPDockingPaneWhidbeyTheme::CColorSetVisualStudio2005 : public CColorSetWhidbey
  1855. {
  1856. public:
  1857. CColorSetVisualStudio2005(BOOL bHighlightSelected)
  1858. : CColorSetWhidbey(bHighlightSelected)
  1859. {
  1860. m_bTransparentButton = TRUE;
  1861. }
  1862. void RefreshMetrics();
  1863. };
  1864. void CXTPDockingPaneWhidbeyTheme::CColorSetVisualStudio2005::RefreshMetrics()
  1865. {
  1866. CColorSetWhidbey::RefreshMetrics();
  1867. m_bGradientButton = FALSE;
  1868. m_bLunaTheme = FALSE;
  1869. switch (XTPColorManager()->GetCurrentSystemTheme())
  1870. {
  1871. case xtpSystemThemeSilver:
  1872. case xtpSystemThemeBlue:
  1873. case xtpSystemThemeOlive:
  1874. m_clrNormalText.SetStandardValue(RGB(113, 111, 100));
  1875. if (!m_bHighlightSelected) m_clrSelectedText.SetStandardValue(RGB(113, 111, 100));
  1876. break;
  1877. }
  1878. }
  1879. CXTPDockingPaneWhidbeyTheme::CXTPDockingPaneWhidbeyTheme()
  1880. {
  1881. CXTPTabPaintManager::CAppearanceSetPropertyPageFlat* pAppearanceFlat = (CXTPTabPaintManager::CAppearanceSetPropertyPageFlat*)
  1882. m_pTabPaintManager->SetAppearance(xtpTabAppearancePropertyPageFlat);
  1883. m_pTabPaintManager->m_bDisableLunaColors = TRUE;
  1884. pAppearanceFlat->m_bBlurPoints = FALSE;
  1885. m_pTabPaintManager->SetColorSet(new CColorSetWhidbey(TRUE));
  1886. m_pTabPaintManager->m_bHotTracking = FALSE;
  1887. m_pTabPaintManager->m_clientFrame = xtpTabFrameNone;
  1888. m_pPanelPaintManager->m_bDisableLunaColors = TRUE;
  1889. pAppearanceFlat = (CXTPTabPaintManager::CAppearanceSetPropertyPageFlat*)m_pPanelPaintManager->SetAppearance(xtpTabAppearancePropertyPageFlat);
  1890. pAppearanceFlat->m_bBlurPoints = FALSE;
  1891. m_pPanelPaintManager->SetColorSet(new CColorSetWhidbey(FALSE));
  1892. m_pPanelPaintManager->m_bHotTracking = FALSE;
  1893. m_pPanelPaintManager->SetLayout(xtpTabLayoutAutoSize);
  1894. m_rcCaptionMargin.SetRect(0, 0, 0, 0);
  1895. m_bGradientCaption = TRUE;
  1896. m_bUseBoldCaptionFont = FALSE;
  1897. m_dwSplitterStyle = xtpPaneSplitterGradient;
  1898. m_systemTheme = xtpSystemThemeUnknown;
  1899. }
  1900. void CXTPDockingPaneWhidbeyTheme::RefreshMetrics()
  1901. {
  1902. CXTPDockingPaneOfficeTheme::RefreshMetrics();
  1903. m_clrNormalCaptionText.SetStandardValue(GetXtremeColor(COLOR_INACTIVECAPTIONTEXT));
  1904. switch (XTPColorManager()->GetCurrentSystemTheme())
  1905. {
  1906. case xtpSystemThemeBlue:
  1907. m_clrSplitterGradient.SetStandardValue(RGB(229, 229, 215), RGB(244, 241, 231));
  1908. m_clrNormalCaption.SetStandardValue(RGB(216, 215, 198), RGB(238, 239, 229));
  1909. m_clrNormalCaptionText.SetStandardValue(0);
  1910. break;
  1911. case xtpSystemThemeOlive:
  1912. m_clrSplitterGradient.SetStandardValue(RGB(229, 229, 215), RGB(244, 241, 231));
  1913. m_clrNormalCaption.SetStandardValue(RGB(216, 215, 198), RGB(238, 239, 229));
  1914. m_clrNormalCaptionText.SetStandardValue(0);
  1915. break;
  1916. case xtpSystemThemeSilver:
  1917. m_clrSplitterGradient.SetStandardValue(RGB(215, 215, 229), RGB(243, 243, 247));
  1918. m_clrNormalCaption.SetStandardValue(RGB(224, 224, 235), RGB(242, 242, 246));
  1919. m_clrActiveCaption.SetStandardValue(RGB(160, 158, 186), RGB(224, 225, 235));
  1920. m_clrNormalCaptionText.SetStandardValue(0);
  1921. break;
  1922. }
  1923. }
  1924. CXTPDockingPaneVisualStudio2005SecondTheme::CXTPDockingPaneVisualStudio2005SecondTheme()
  1925. {
  1926. m_pTabPaintManager->SetAppearance(xtpTabAppearanceVisualStudio2005);
  1927. m_pTabPaintManager->SetColorSet(new CColorSetWhidbey(TRUE));
  1928. m_pPanelPaintManager->SetAppearance(xtpTabAppearanceVisualStudio2005);
  1929. m_pPanelPaintManager->SetColorSet(new CColorSetWhidbey(TRUE));
  1930. }
  1931. CXTPDockingPaneVisualStudio2005Theme::CXTPDockingPaneVisualStudio2005Theme()
  1932. {
  1933. CXTPTabPaintManager::CAppearanceSetPropertyPageFlat* pAppearance =
  1934. new CXTPTabPaintManager::CAppearanceSetPropertyPageFlat;
  1935. pAppearance->m_bBlurPoints = FALSE;
  1936. m_pPanelPaintManager->SetAppearanceSet(pAppearance);
  1937. m_pPanelPaintManager->SetColorSet(new CColorSetVisualStudio2005(FALSE));
  1938. m_pPanelPaintManager->m_bRotateImageOnVerticalDraw = TRUE;
  1939. pAppearance = new CXTPTabPaintManager::CAppearanceSetPropertyPageFlat;
  1940. pAppearance->m_bBlurPoints = FALSE;
  1941. pAppearance->m_bVisualStudio2005Style = TRUE;
  1942. m_pTabPaintManager->SetAppearanceSet(pAppearance);
  1943. m_pTabPaintManager->SetColorSet(new CColorSetVisualStudio2005(TRUE));
  1944. m_pTabPaintManager->m_clientFrame = xtpTabFrameSingleLine;
  1945. m_pTabPaintManager->m_rcClientMargin.top = 1;
  1946. }
  1947. void CXTPDockingPaneVisualStudio2005SecondTheme::RefreshMetrics()
  1948. {
  1949. CXTPDockingPaneWhidbeyTheme::RefreshMetrics();
  1950. m_clrNormalCaption.SetStandardValue(GetXtremeColor(COLOR_INACTIVECAPTION));
  1951. m_clrActiveCaption.SetStandardValue(GetXtremeColor(COLOR_ACTIVECAPTION));
  1952. m_clrCaptionBorder = GetXtremeColor(COLOR_3DSHADOW);
  1953. switch (XTPColorManager()->GetCurrentSystemTheme())
  1954. {
  1955. case xtpSystemThemeBlue:
  1956. m_clrNormalCaption.SetStandardValue(RGB(204, 199, 186));
  1957. m_clrActiveCaption.SetStandardValue(RGB(59, 128, 237), RGB(49, 106, 197));
  1958. m_clrNormalCaptionText.SetStandardValue(0);
  1959. break;
  1960. case xtpSystemThemeOlive:
  1961. m_clrNormalCaption.SetStandardValue(RGB(204, 199, 186));
  1962. m_clrActiveCaption.SetStandardValue(RGB(182, 195, 146), RGB(145, 160, 117));
  1963. m_clrNormalCaptionText.SetStandardValue(0);
  1964. break;
  1965. case xtpSystemThemeSilver:
  1966. m_clrNormalCaption.SetStandardValue(RGB(240, 240, 245));
  1967. m_clrActiveCaption.SetStandardValue(RGB(211, 212, 221), RGB(166, 165, 191));
  1968. m_clrNormalCaptionText.SetStandardValue(0);
  1969. m_clrCaptionBorder = RGB(145, 155, 156);
  1970. break;
  1971. }
  1972. }
  1973. COLORREF CXTPDockingPaneVisualStudio2005SecondTheme::FillCaptionPart(CDC* pDC, CXTPDockingPaneBase* pPane, CRect rcCaption, BOOL bActive, BOOL bVertical)
  1974. {
  1975. XTPDrawHelpers()->GradientFill(pDC, rcCaption, bActive ? m_clrActiveCaption : m_clrNormalCaption, bVertical);
  1976. if (pPane->GetType() == xtpPaneTypeSidePanel)
  1977. return bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText;
  1978. CXTPPenDC pen(*pDC, m_clrCaptionBorder);
  1979. if (bVertical)
  1980. {
  1981. pDC->MoveTo(rcCaption.right, rcCaption.bottom - 1);
  1982. pDC->LineTo(rcCaption.left , rcCaption.bottom - 1);
  1983. pDC->LineTo(rcCaption.left, rcCaption.top);
  1984. pDC->LineTo(rcCaption.right, rcCaption.top);
  1985. }
  1986. else
  1987. {
  1988. pDC->MoveTo(rcCaption.left, rcCaption.bottom);
  1989. pDC->LineTo(rcCaption.left , rcCaption.top);
  1990. pDC->LineTo(rcCaption.right - 1, rcCaption.top);
  1991. pDC->LineTo(rcCaption.right - 1, rcCaption.bottom - 1);
  1992. }
  1993. return bActive ? m_clrActiveCaptionText : m_clrNormalCaptionText;
  1994. }