XFloorPropertiesWndDesign.cpp
资源名称:propgrid.zip [点击查看]
上传用户:yangzi5763
上传日期:2007-01-02
资源大小:239k
文件大小:4k
源码类别:
ActiveX/DCOM/ATL
开发平台:
Visual C++
- /************************************
- REVISION LOG ENTRY
- Revision By: Mihai Filimon
- Revised on 10/14/98 12:03:03 PM
- Comments: XFloorPropertiesWndDesign.cpp: implementation of the CXFloorPropertiesWndDesign class.
- ************************************/
- #include "stdafx.h"
- #include "xpropertieswnd.h"
- #include "XFloorPropertiesWndDesign.h"
- #include "PageListCtrlDesign.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- // Function name : CXFloorPropertiesWndDesign::CXFloorPropertiesWndDesign
- // Description : default contructor
- // Return type :
- CXFloorPropertiesWndDesign::CXFloorPropertiesWndDesign()
- {
- m_pOleDialog = NULL;
- }
- // Function name : CXFloorPropertiesWndDesign::~CXFloorPropertiesWndDesign
- // Description : virtual destructor
- // Return type :
- CXFloorPropertiesWndDesign::~CXFloorPropertiesWndDesign()
- {
- }
- // Function name : CXFloorPropertiesWndDesign::NewPageListCtrl
- // Description : Virtual function.This will return CPageListCtrlDesign* page
- // Return type : CPageListCtrl*
- // Argument : int nIndex
- CPageListCtrl* CXFloorPropertiesWndDesign::NewPageListCtrl(int nIndex, CXPropertiesWndCtrl* pControl, BOOL bGroup )
- {
- ASSERT (pControl == NULL);
- CPageListCtrlDesign* pPageListCtlrDesign = new CPageListCtrlDesign(m_pOleDialog);
- pPageListCtlrDesign->OnNew(this, nIndex + _nIDFirstListView);
- return pPageListCtlrDesign;
- }
- // Function name : CXFloorPropertiesWndDesign::DataExchange
- // Description : Called by CXPropertiesWndPropPage.DoDataExchange
- // Return type : void
- // Argument : CDataExchange * pDX
- void CXFloorPropertiesWndDesign::DataExchange(CDataExchange * pDX)
- {
- CString sPagesAndItems;
- if (pDX->m_bSaveAndValidate) Fill(sPagesAndItems);
- CXPropertiesWndPropPage* pParent = (CXPropertiesWndPropPage*)GetParent();
- DDP_DEFINE<CString>(pParent, pDX->m_bSaveAndValidate, &sPagesAndItems, _T("PagesAndItems"), VT_BSTR);
- if (!pDX->m_bSaveAndValidate) Load(sPagesAndItems);
- }
- // Function name : CXFloorPropertiesWndDesign::Fill
- // Description : Called by DataExhange to construct the sPagesItems string
- // stream will be the following form.
- // Page 1
- // {
- // NameEdit
- // NotesEdit
- // VisibleBoolComboBox
- // }
- // Page 2
- // {
- // ...
- // }
- //
- //
- //
- // Return type : void
- void CXFloorPropertiesWndDesign::Fill(CString& stream)
- {
- CString s(_cPagesSeparator);
- for (int i = 0; IsPage(i); i++)
- {
- CString sGroup(IsGroup(i) ? (LPCTSTR)CString(_T("[Group]") + s) : NULL);
- stream += GetPageName(i) + s + sGroup + _T("{") + s;
- GetListCtrl(i)->Save(stream);
- stream += _T("}") + s;
- }
- }
- // Function name : CXFloorPropertiesWndDesign::OnCommand
- // Description :
- // Return type : BOOL
- // Argument : WPARAM wParam
- // Argument : LPARAM lParam
- BOOL CXFloorPropertiesWndDesign::OnCommand( WPARAM wParam, LPARAM lParam )
- {
- CXPropertiesWndPropPage* pParent = (CXPropertiesWndPropPage*)GetParent();
- if (LOWORD(wParam) == (pParent)->m_edtRename.GetDlgCtrlID())
- if (HIWORD(wParam) == EN_KILLFOCUS)
- pParent->RenamePage(pParent->m_nRenamePage);
- return CXFloorPropertiesWnd::OnCommand(wParam, lParam);
- }
- // Function name : CXFloorPropertiesWndDesign::OnReset
- // Description : Called by load function
- // Return type : void
- void CXFloorPropertiesWndDesign::OnReset()
- {
- // just delete the old page
- while (DeletePage(0));
- }
- // Function name : CXFloorPropertiesWnd::OnDestructor
- // Description : This is called by ~CXFloorPropertiesWnd
- // Return type : void
- void CXFloorPropertiesWndDesign::OnDestructor()
- {
- for (int i = 0; i < m_arPagesListCtrl.GetSize(); i++)
- delete m_arPagesListCtrl[i];
- m_arPagesListCtrl.RemoveAll();
- }
- // Function name : CXFloorPropertiesWndDesign::SetOleDialog
- // Description : Set the parent of this class
- // Return type : void
- // Argument : COlePropertyPage *pOleDialog
- void CXFloorPropertiesWndDesign::SetOleDialog(COlePropertyPage *pOleDialog)
- {
- m_pOleDialog = pOleDialog;
- }