PropertyPageWithPropertySheet.cpp
上传用户:raowubin
上传日期:2007-01-02
资源大小:19k
文件大小:3k
源码类别:
PropertySheet
开发平台:
Visual C++
- // PropertyPageWithPropertySheet.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ps_in_ps.h"
- #include "PropertyPageWithPropertySheet.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CPropertyPageWithPropertySheet property page
- IMPLEMENT_DYNCREATE(CPropertyPageWithPropertySheet, CPropertyPage)
- CPropertyPageWithPropertySheet::CPropertyPageWithPropertySheet() : CPropertyPage(CPropertyPageWithPropertySheet::IDD)
- {
- //{{AFX_DATA_INIT(CPropertyPageWithPropertySheet)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- CPropertyPageWithPropertySheet::~CPropertyPageWithPropertySheet()
- {
- }
- void CPropertyPageWithPropertySheet::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPropertyPageWithPropertySheet)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- // this need for check data when user change tab in parent property sheet
- if(m_internal_sheet)
- if(!m_internal_sheet.GetActivePage()->UpdateData(pDX->m_bSaveAndValidate))
- pDX->Fail();
- }
- BEGIN_MESSAGE_MAP(CPropertyPageWithPropertySheet, CPropertyPage)
- //{{AFX_MSG_MAP(CPropertyPageWithPropertySheet)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CPropertyPageWithPropertySheet message handlers
- BOOL CPropertyPageWithPropertySheet::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
- // TODO: Add extra initialization here
- m_internal_sheet.EnableStackedTabs( FALSE );
- m_internal_sheet.Create(this, WS_CHILD | WS_VISIBLE , 0);
- m_internal_sheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
- m_internal_sheet.ModifyStyle( 0, WS_TABSTOP );
- // move to left upper corner
- m_internal_sheet.SetWindowPos( NULL, 0, 0, 0, 0,
- SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CPropertyPageWithPropertySheet::AddPage(CPropertyPage *pPage)
- {
- m_internal_sheet.AddPage(pPage);
- }
- BOOL CPropertyPageWithPropertySheet::UpdateData(BOOL bSaveAndValidate)
- {
- if(!CPropertyPage::UpdateData(bSaveAndValidate))
- return FALSE;
- // check property sheet. Need when OK button press
- return m_internal_sheet.GetActivePage()->UpdateData(bSaveAndValidate);
- }