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

对话框与窗口

开发平台:

Visual C++

  1. // CoolGridPage.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 "OwnerDraw.h"
  22. #include "CoolGridPage.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CCoolGridPage property page
  30. IMPLEMENT_DYNCREATE(CCoolGridPage, CPropertyPage)
  31. CCoolGridPage::CCoolGridPage() : CPropertyPage(CCoolGridPage::IDD)
  32. {
  33. //{{AFX_DATA_INIT(CCoolGridPage)
  34. // NOTE: the ClassWizard will add member initialization here
  35. //}}AFX_DATA_INIT
  36. }
  37. CCoolGridPage::~CCoolGridPage()
  38. {
  39. }
  40. void CCoolGridPage::DoDataExchange(CDataExchange* pDX)
  41. {
  42. CPropertyPage::DoDataExchange(pDX);
  43. //{{AFX_DATA_MAP(CCoolGridPage)
  44. // NOTE: the ClassWizard will add DDX and DDV calls here
  45. //}}AFX_DATA_MAP
  46. }
  47. BEGIN_MESSAGE_MAP(CCoolGridPage, CPropertyPage)
  48. //{{AFX_MSG_MAP(CCoolGridPage)
  49. //}}AFX_MSG_MAP
  50. END_MESSAGE_MAP()
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CCoolGridPage message handlers
  53. BOOL CCoolGridPage::OnInitDialog()
  54. {
  55. CPropertyPage::OnInitDialog();
  56. // get the size of the place holder, this will be used when creating the grid.
  57. CWnd* pPlaceHolder = GetDlgItem(IDC_PLACEHOLDER);
  58. CRect rc;
  59. pPlaceHolder->GetWindowRect( &rc );
  60. ScreenToClient( &rc );
  61. // create the property grid.
  62. if ( m_wndPropertyGrid.Create( rc, this, 100))
  63. {
  64. m_wndPropertyGrid.SetTheme(xtpGridThemeCool);
  65. LOGFONT lf;
  66. GetFont()->GetLogFont( &lf );
  67. // create document settings category.
  68. CXTPPropertyGridItem* pSettings        = m_wndPropertyGrid.AddCategory(_T("Document Settings"));
  69. CXTPPropertyGridItem* pSettingsGlobal = pSettings->AddChildItem(new CXTPPropertyGridItemCategory(_T("Global")));
  70. // add child items to category.
  71. CXTPPropertyGridItem* pItemSaveOnClose = pSettingsGlobal->AddChildItem(new CXTPPropertyGridItemBool(_T("SaveOnClose"), TRUE));
  72. CXTPPropertyGridItem* pSettingsAppearance = pSettings->AddChildItem(new CXTPPropertyGridItemCategory(_T("Appearance")));
  73. pSettingsAppearance->AddChildItem(new CXTPPropertyGridItemFont(_T("WindowFont"), lf));
  74. pSettingsAppearance->AddChildItem(new CXTPPropertyGridItemSize(_T("WindowSize"), CSize(100, 100)));
  75. pSettings->Expand();
  76. pItemSaveOnClose->Select();
  77. // create global settings category.
  78. CXTPPropertyGridItem* pGlobals      = m_wndPropertyGrid.AddCategory(_T("Global Settings"));
  79. // add child items to category.
  80. CXTPPropertyGridItem* pItemGreeting = pGlobals->AddChildItem(new CXTPPropertyGridItem(_T("Greeting Text"), _T("Welcome to your application!")));
  81. pGlobals->AddChildItem(new CXTPPropertyGridItemNumber(_T("ItemsInMRUList"), 4));
  82. CXTPPropertyGridItem* pItemRate     = pGlobals->AddChildItem(new CXTPPropertyGridItemNumber(_T("MaxRepeatRate"), 10));
  83. pGlobals->AddChildItem(new CXTPPropertyGridItemColor(_T("ToolbarColor"), RGB(255, 192,128)));
  84. pItemGreeting->SetReadOnly(TRUE);
  85. pItemRate->SetDescription(_T("The rate in milliseconds that the text will repeat."));
  86. // create version category.
  87. CXTPPropertyGridItem* pVersion      = m_wndPropertyGrid.AddCategory(_T("Version"));
  88. // add child items to category.
  89. CXTPPropertyGridItem* pItemVersion  = pVersion->AddChildItem(new CXTPPropertyGridItem(_T("AppVersion"), _T("1.0")));
  90. pItemVersion->SetReadOnly(TRUE);
  91. pVersion->Expand();
  92. }
  93. return TRUE;  // return TRUE unless you set the focus to a control
  94.               // EXCEPTION: OCX Property Pages should return FALSE
  95. }