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

对话框与窗口

开发平台:

Visual C++

  1. // PanePropertyGrid.cpp : implementation file
  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 "drawcli.h"
  22. #include "PanePropertyGrid.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CPanePropertyGrid
  30. CPanePropertyGrid::CPanePropertyGrid()
  31. {
  32. }
  33. CPanePropertyGrid::~CPanePropertyGrid()
  34. {
  35. }
  36. BEGIN_MESSAGE_MAP(CPanePropertyGrid, CWnd)
  37. //{{AFX_MSG_MAP(CPanePropertyGrid)
  38. ON_WM_CREATE()
  39. ON_WM_SIZE()
  40. ON_WM_SYSCOLORCHANGE()
  41. //}}AFX_MSG_MAP
  42. ON_COMMAND(ID_PANEPROPERTIES_CATEGORIZED, OnPanePropertiesCategorized)
  43. ON_UPDATE_COMMAND_UI(ID_PANEPROPERTIES_CATEGORIZED, OnUpdatePanePropertiesCategorized)
  44. ON_COMMAND(ID_PANEPROPERTIES_ALPHABETIC, OnPanePropertiesAlphabetic)
  45. ON_UPDATE_COMMAND_UI(ID_PANEPROPERTIES_ALPHABETIC, OnUpdatePanePropertiesAlphabetic)
  46. END_MESSAGE_MAP()
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CPanePropertyGrid message handlers
  49. int CPanePropertyGrid::OnCreate(LPCREATESTRUCT lpCreateStruct)
  50. {
  51. if (CWnd::OnCreate(lpCreateStruct) == -1)
  52. return -1;
  53. m_wndPropertyGrid.Create(CRect(0, 0, 0, 0), this, 1000);
  54. m_wndPropertyGrid.SetOwner(GetTopLevelFrame());
  55. COLORREF clrMask = XTPImageManager()->SetMaskColor(RGB(0, 255, 0));
  56. VERIFY(m_wndToolBar.CreateToolBar(WS_TABSTOP|WS_VISIBLE|WS_CHILD|CBRS_TOOLTIPS, this));
  57. VERIFY(m_wndToolBar.LoadToolBar(IDR_PANE_PROPERTIES));
  58. XTPImageManager()->SetMaskColor(clrMask);
  59. // Enable Office 2003 Theme
  60. m_wndPropertyGrid.SetTheme(xtpGridThemeOffice2003);
  61. return 0;
  62. }
  63. void CPanePropertyGrid::OnSize(UINT nType, int cx, int cy)
  64. {
  65. CWnd::OnSize(nType, cx, cy);
  66. int nTop = 0;
  67. if (m_wndToolBar.GetSafeHwnd())
  68. {
  69. CSize sz = m_wndToolBar.CalcDockingLayout(cx, /*LM_HIDEWRAP|*/ LM_HORZDOCK|LM_HORZ | LM_COMMIT);
  70. m_wndToolBar.MoveWindow(0, nTop, cx, sz.cy);
  71. m_wndToolBar.Invalidate(FALSE);
  72. nTop += sz.cy;
  73. }
  74. if (m_wndPropertyGrid.GetSafeHwnd())
  75. {
  76. m_wndPropertyGrid.MoveWindow(0, nTop, cx, cy - nTop);
  77. m_wndPropertyGrid.Invalidate(FALSE);
  78. }
  79. }
  80. void CPanePropertyGrid::OnPanePropertiesCategorized()
  81. {
  82. m_wndPropertyGrid.SetPropertySort(xtpGridSortCategorized);
  83. }
  84. void CPanePropertyGrid::OnUpdatePanePropertiesCategorized(CCmdUI* pCmdUI)
  85. {
  86. pCmdUI->SetCheck(m_wndPropertyGrid.GetPropertySort() == xtpGridSortCategorized);
  87. }
  88. void CPanePropertyGrid::OnPanePropertiesAlphabetic()
  89. {
  90. m_wndPropertyGrid.SetPropertySort(xtpGridSortAlphabetical);
  91. }
  92. void CPanePropertyGrid::OnUpdatePanePropertiesAlphabetic(CCmdUI* pCmdUI)
  93. {
  94. pCmdUI->SetCheck(m_wndPropertyGrid.GetPropertySort() == xtpGridSortAlphabetical);
  95. }
  96. void CPanePropertyGrid::OnSysColorChange()
  97. {
  98. CWnd::OnSysColorChange();
  99. XTPPaintManager()->RefreshMetrics();
  100. }