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

对话框与窗口

开发平台:

Visual C++

  1. // ModernTheme.cpp: implementation of the CModernTheme class.
  2. //
  3. // This file is a part of the XTREME TOOLKIT PRO MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #include "stdafx.h"
  21. #include "IntelligentMenus.h"
  22. #include "ModernTheme.h"
  23. #ifdef _DEBUG
  24. #undef THIS_FILE
  25. static char THIS_FILE[]=__FILE__;
  26. #define new DEBUG_NEW
  27. #endif
  28. //////////////////////////////////////////////////////////////////////
  29. // Construction/Destruction
  30. //////////////////////////////////////////////////////////////////////
  31. CModernTheme::CModernTheme()
  32. {
  33. }
  34. CModernTheme::~CModernTheme()
  35. {
  36. }
  37. void CModernTheme::_Fill(CDC* pDC, CWnd* pBar)
  38. {
  39. CXTPDrawHelpers* pDrawHelper = XTPDrawHelpers();
  40. if (!pDrawHelper->IsFastFillAvailable())
  41. {
  42. pDC->FillSolidRect(CXTPClientRect(pBar), GetXtremeColor(COLOR_3DFACE));
  43. return;
  44. }
  45. CWnd* pFrame = pBar->GetParentFrame();
  46. CRect rc, rcParent, rcClient;
  47. pFrame->GetWindowRect(rcParent);
  48. pBar->GetWindowRect(rc);
  49. pBar->GetClientRect(rcClient);
  50. rcClient.TopLeft() += rcParent.TopLeft() -rc.TopLeft();
  51. rcClient.BottomRight() += rcParent.BottomRight() - rc.BottomRight();
  52. COLORREF clr3DFace = GetXtremeColor(COLOR_3DFACE);
  53. TRIVERTEX vert[2];
  54. vert[0].x      = rcClient.left;
  55. vert[0].y      = rcClient.top;
  56. vert[0].Red    = (COLOR16)(255 << 8);
  57. vert[0].Green  = (COLOR16)(255 << 8);
  58. vert[0].Blue   = (COLOR16)(255 << 8);
  59. vert[0].Alpha  = 0x0000;
  60. vert[1].x      = rcClient.right;
  61. vert[1].y      = rcClient.bottom;
  62. vert[1].Red    = (COLOR16)(int(0.67 * GetRValue(clr3DFace) + 0.33 *255) << 8);
  63. vert[1].Green  = (COLOR16)(int(0.67 * GetGValue(clr3DFace) + 0.33 *255) << 8);
  64. vert[1].Blue   = (COLOR16)(int(0.67 * GetBValue(clr3DFace) + 0.33 *255) << 8);
  65. vert[1].Alpha  = 0x0000;
  66. GRADIENT_RECT gRect = { 0, 1 };
  67. pDrawHelper->GradientFill(*pDC, vert, 2, &gRect, 1, GRADIENT_FILL_RECT_H );
  68. }
  69. void CModernTheme::FillDockBar(CDC* pDC, CXTPDockBar* pBar)
  70. {
  71. _Fill(pDC, pBar);
  72. }
  73. void CModernTheme::FillCommandBarEntry(CDC* pDC, CXTPCommandBar* pBar)
  74. {
  75. if (pBar->GetPosition() == xtpBarPopup || pBar->GetPosition() == xtpBarFloating || pBar->GetType() != xtpBarTypeNormal)
  76. {
  77. CXTPNativeXPTheme::FillCommandBarEntry(pDC, pBar);
  78. }
  79. else
  80. {
  81. _Fill(pDC, pBar);
  82. }
  83. }