XFloorPropertiesWndDesign.cpp
上传用户:yangzi5763
上传日期:2007-01-02
资源大小:239k
文件大小:4k
源码类别:

ActiveX/DCOM/ATL

开发平台:

Visual C++

  1. /************************************
  2.   REVISION LOG ENTRY
  3.   Revision By: Mihai Filimon
  4.   Revised on 10/14/98 12:03:03 PM
  5.   Comments: XFloorPropertiesWndDesign.cpp: implementation of the CXFloorPropertiesWndDesign class.
  6.  ************************************/
  7. #include "stdafx.h"
  8. #include "xpropertieswnd.h"
  9. #include "XFloorPropertiesWndDesign.h"
  10. #include "PageListCtrlDesign.h"
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char THIS_FILE[]=__FILE__;
  14. #define new DEBUG_NEW
  15. #endif
  16. //////////////////////////////////////////////////////////////////////
  17. // Construction/Destruction
  18. //////////////////////////////////////////////////////////////////////
  19. // Function name : CXFloorPropertiesWndDesign::CXFloorPropertiesWndDesign
  20. // Description     : default contructor
  21. // Return type : 
  22. CXFloorPropertiesWndDesign::CXFloorPropertiesWndDesign()
  23. {
  24. m_pOleDialog = NULL;
  25. }
  26. // Function name : CXFloorPropertiesWndDesign::~CXFloorPropertiesWndDesign
  27. // Description     : virtual destructor
  28. // Return type : 
  29. CXFloorPropertiesWndDesign::~CXFloorPropertiesWndDesign()
  30. {
  31. }
  32. // Function name : CXFloorPropertiesWndDesign::NewPageListCtrl
  33. // Description     : Virtual function.This will return CPageListCtrlDesign* page
  34. // Return type : CPageListCtrl* 
  35. // Argument         : int nIndex
  36. CPageListCtrl* CXFloorPropertiesWndDesign::NewPageListCtrl(int nIndex, CXPropertiesWndCtrl* pControl, BOOL bGroup )
  37. {
  38. ASSERT (pControl == NULL);
  39. CPageListCtrlDesign* pPageListCtlrDesign = new CPageListCtrlDesign(m_pOleDialog);
  40. pPageListCtlrDesign->OnNew(this, nIndex + _nIDFirstListView);
  41. return pPageListCtlrDesign;
  42. }
  43. // Function name : CXFloorPropertiesWndDesign::DataExchange
  44. // Description     : Called by CXPropertiesWndPropPage.DoDataExchange
  45. // Return type : void 
  46. // Argument         : CDataExchange * pDX
  47. void CXFloorPropertiesWndDesign::DataExchange(CDataExchange * pDX)
  48. {
  49. CString sPagesAndItems;
  50. if (pDX->m_bSaveAndValidate) Fill(sPagesAndItems);
  51. CXPropertiesWndPropPage* pParent = (CXPropertiesWndPropPage*)GetParent();
  52. DDP_DEFINE<CString>(pParent, pDX->m_bSaveAndValidate, &sPagesAndItems, _T("PagesAndItems"), VT_BSTR);
  53. if (!pDX->m_bSaveAndValidate) Load(sPagesAndItems);
  54. }
  55. // Function name : CXFloorPropertiesWndDesign::Fill
  56. // Description     : Called by DataExhange to construct the sPagesItems string
  57. // stream will be the following form.
  58. // Page 1
  59. // {
  60. // NameEdit
  61. // NotesEdit
  62. // VisibleBoolComboBox
  63. // }
  64. // Page 2
  65. // {
  66. // ...
  67. // }
  68. //
  69. //
  70. //
  71. // Return type : void 
  72. void CXFloorPropertiesWndDesign::Fill(CString& stream)
  73. {
  74. CString s(_cPagesSeparator);
  75. for (int i = 0; IsPage(i); i++)
  76. {
  77. CString sGroup(IsGroup(i) ? (LPCTSTR)CString(_T("[Group]") + s) : NULL);
  78. stream += GetPageName(i) + s + sGroup + _T("{") + s;
  79. GetListCtrl(i)->Save(stream);
  80. stream += _T("}") + s;
  81. }
  82. }
  83. // Function name : CXFloorPropertiesWndDesign::OnCommand
  84. // Description     : 
  85. // Return type : BOOL 
  86. // Argument         :  WPARAM wParam
  87. // Argument         : LPARAM lParam
  88. BOOL CXFloorPropertiesWndDesign::OnCommand( WPARAM wParam, LPARAM lParam )
  89. {
  90. CXPropertiesWndPropPage* pParent = (CXPropertiesWndPropPage*)GetParent();
  91. if (LOWORD(wParam) == (pParent)->m_edtRename.GetDlgCtrlID())
  92. if (HIWORD(wParam) == EN_KILLFOCUS)
  93. pParent->RenamePage(pParent->m_nRenamePage);
  94. return CXFloorPropertiesWnd::OnCommand(wParam, lParam);
  95. }
  96. // Function name : CXFloorPropertiesWndDesign::OnReset
  97. // Description     : Called by load function
  98. // Return type : void 
  99. void CXFloorPropertiesWndDesign::OnReset()
  100. {
  101. // just delete the old page
  102. while (DeletePage(0));
  103. }
  104. // Function name : CXFloorPropertiesWnd::OnDestructor
  105. // Description     : This is called by ~CXFloorPropertiesWnd
  106. // Return type : void 
  107. void CXFloorPropertiesWndDesign::OnDestructor()
  108. {
  109. for (int i = 0; i < m_arPagesListCtrl.GetSize(); i++)
  110. delete m_arPagesListCtrl[i];
  111. m_arPagesListCtrl.RemoveAll();
  112. }
  113. // Function name : CXFloorPropertiesWndDesign::SetOleDialog
  114. // Description     : Set the parent of this class
  115. // Return type : void 
  116. // Argument         : COlePropertyPage *pOleDialog
  117. void CXFloorPropertiesWndDesign::SetOleDialog(COlePropertyPage *pOleDialog)
  118. {
  119. m_pOleDialog = pOleDialog;
  120. }