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

对话框与窗口

开发平台:

Visual C++

  1. // AppearanceSetEclipse.h: interface for the CAppearanceSetEclipse class.
  2. //
  3. // This file is a part of the XTREME TOOLKIT PRO MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #if !defined(AFX_APPEARANCESETECLIPSE_H__598ECCD6_5508_4219_A699_A414FBC210BA__INCLUDED_)
  21. #define AFX_APPEARANCESETECLIPSE_H__598ECCD6_5508_4219_A699_A414FBC210BA__INCLUDED_
  22. #if _MSC_VER > 1000
  23. #pragma once
  24. #endif // _MSC_VER > 1000
  25. class CEclipseTabPaintManager : public CXTPTabPaintManager
  26. {
  27. public:
  28. class CColorSetEclipse : public CXTPTabPaintManager::CColorSetDefault
  29. {
  30. void RefreshMetrics()
  31. {
  32. CColorSetDefault::RefreshMetrics();
  33. m_clrFrameBorder =  RGB(132, 130, 132);
  34. if ((((CEclipseTabPaintManager*)m_pPaintManager)->m_bFillTab))
  35. m_clrSelectedText = GetXtremeColor(COLOR_CAPTIONTEXT);
  36. if ((((CEclipseTabPaintManager*)m_pPaintManager)->m_bFillTab))
  37. m_clrHeaderFace.SetStandardValue(XTPPaintManager()->GetXtremeColor(XPCOLOR_TOOLBAR_FACE));
  38. else
  39. m_clrHeaderFace.SetStandardValue(XTPPaintManager()->GetXtremeColor(XPCOLOR_3DFACE));
  40. }
  41. };
  42. class CAppearanceSetEclipse : public CXTPTabPaintManager::CAppearanceSetFlat
  43. {
  44. public:
  45. CAppearanceSetEclipse()
  46. {
  47. m_rcHeaderMargin.SetRect(-1, -1, 0, 0);
  48. }
  49. CRect FillTabControl(CXTPTabManager* pTabManager, CDC* pDC, CRect rcControl);
  50. void DrawSingleButton(CDC* pDC, CXTPTabManagerItem* pItem);
  51. void RefreshMetrics()
  52. {
  53. CAppearanceSetFlat::RefreshMetrics();
  54. if ((((CEclipseTabPaintManager*)m_pPaintManager)->m_bFillTab))
  55. m_nButtonHeight = max(24, m_nButtonHeight);
  56. else
  57. m_nButtonHeight = max(22, m_nButtonHeight);
  58. }
  59. };
  60. public:
  61. CEclipseTabPaintManager()
  62. {
  63. m_bBoldSelected = FALSE;
  64. m_bFrame = TRUE;
  65. m_bFillTab = TRUE;
  66. m_rcClientMargin.SetRect(0, 1, 0, 0);
  67. m_rcControlMargin.SetRect(4, 4, 4, 4);
  68. m_clientFrame = xtpTabFrameNone;
  69. SetAppearanceSet(new CAppearanceSetEclipse());
  70. SetColorSet(new CColorSetEclipse());
  71. }
  72. void DrawTabControl (CXTPTabManager* pTabManager, CDC* pDC, CRect rcControl);
  73. static void DrawFrame(CDC* pDC, CRect rcControl, BOOL bFillRect = FALSE);
  74. void SetFrame(BOOL bFrame)
  75. {
  76. if (!bFrame)
  77. {
  78. m_rcControlMargin.SetRectEmpty();
  79. m_bFrame = bFrame;
  80. }
  81. }
  82. BOOL m_bFrame;
  83. BOOL m_bFillTab;
  84. };
  85. template <class T>
  86. class CEclipseDockingPanePaintManager: public T
  87. {
  88. public:
  89. CEclipseDockingPanePaintManager()
  90. {
  91. CEclipseTabPaintManager* pTabManager = (CEclipseTabPaintManager*)SetTabPaintManager(new CEclipseTabPaintManager());
  92. pTabManager->SetFrame(FALSE);
  93. pTabManager->m_bFillTab = FALSE;
  94. pTabManager->m_bShowIcons = FALSE;
  95. pTabManager->RefreshMetrics();
  96. }
  97. void AdjustCaptionRect(const CXTPDockingPaneTabbedContainer* /*pPane*/, CRect& rc)
  98. {
  99. rc.DeflateRect(4, 4, 4, 4);
  100. }
  101. void DrawCaption(CDC& dc, CXTPDockingPaneTabbedContainer* /*pPane*/, CRect rc)
  102. {
  103. CEclipseTabPaintManager::DrawFrame(&dc, rc, TRUE);
  104. }
  105. void DrawPane(CDC& dc, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
  106. {
  107. dc.FillSolidRect(rc, XTPPaintManager()->GetXtremeColor(XPCOLOR_3DFACE));
  108. DrawCaption(dc, pPane, rc);
  109. AdjustCaptionRect(pPane, rc);
  110. if (pPane->IsTabsVisible())
  111. {
  112. m_pTabPaintManager->DrawTabControl(pPane, &dc, rc);
  113. }
  114. }
  115. };
  116. template <class T>
  117. class CEclipseCommandBarsPaintManager: public T
  118. {
  119. public:
  120. BOOL IsPaneBar(CXTPCommandBar* pBar)
  121. {
  122. CXTPToolBar* pToolbar = DYNAMIC_DOWNCAST(CXTPToolBar, pBar);
  123. return (pToolbar && pToolbar->GetDockBar() == NULL && pToolbar->GetPosition() == xtpBarTop);
  124. }
  125. void FillCommandBarEntry(CDC* pDC, CXTPCommandBar* pBar)
  126. {
  127. if (IsPaneBar(pBar))
  128. {
  129. pDC->FillSolidRect(CXTPClientRect(pBar), XTPPaintManager()->GetXtremeColor(XPCOLOR_TOOLBAR_FACE));
  130. }
  131. else
  132. {
  133. T::FillCommandBarEntry(pDC, pBar);
  134. }
  135. }
  136. CRect GetCommandBarBorders(CXTPCommandBar* pBar)
  137. {
  138. if (IsPaneBar(pBar))
  139. {
  140. return CRect(1, 1, 1, 1);
  141. }
  142. else
  143. {
  144. return T::GetCommandBarBorders(pBar);
  145. }
  146. }
  147. };
  148. #endif // !defined(AFX_APPEARANCESETECLIPSE_H__598ECCD6_5508_4219_A699_A414FBC210BA__INCLUDED_)