00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "stdafx.h"
00026 #include "mplayerc.h"
00027 #include "ComPropertyPage.h"
00028 #include "ComPropertySheet.h"
00029
00030
00031
00032
00033 IMPLEMENT_DYNAMIC(CComPropertyPage, CPropertyPage)
00034 CComPropertyPage::CComPropertyPage(IPropertyPage* pPage)
00035 : CPropertyPage(CComPropertyPage::IDD), m_pPage(pPage)
00036 {
00037 PROPPAGEINFO ppi;
00038 m_pPage->GetPageInfo(&ppi);
00039 m_pPSP->pszTitle = (m_strCaption = ppi.pszTitle);
00040 m_psp.dwFlags |= PSP_USETITLE;
00041 }
00042
00043 CComPropertyPage::~CComPropertyPage()
00044 {
00045 }
00046
00047 void CComPropertyPage::DoDataExchange(CDataExchange* pDX)
00048 {
00049 CPropertyPage::DoDataExchange(pDX);
00050 }
00051
00052 BOOL CComPropertyPage::OnInitDialog()
00053 {
00054 CPropertyPage::OnInitDialog();
00055
00056 CRect r;
00057 PROPPAGEINFO ppi;
00058 m_pPage->GetPageInfo(&ppi);
00059 r = CRect(CPoint(0,0), ppi.size);
00060 m_pPage->Activate(m_hWnd, r, FALSE);
00061 m_pPage->Show(SW_SHOW);
00062
00063 return TRUE;
00064
00065 }
00066
00067 void CComPropertyPage::OnDestroy()
00068 {
00069 CPropertyPage::OnDestroy();
00070
00071 m_pPage->Deactivate();
00072 }
00073
00074 BOOL CComPropertyPage::OnSetActive()
00075 {
00076 SetModified(S_OK == m_pPage->IsPageDirty());
00077
00078 CWnd* pParent = GetParent();
00079 if(pParent->IsKindOf(RUNTIME_CLASS(CComPropertySheet)))
00080 {
00081 CComPropertySheet* pSheet = (CComPropertySheet*)pParent;
00082 pSheet->OnActivated(this);
00083 }
00084
00085 return CPropertyPage::OnSetActive();
00086 }
00087
00088 BOOL CComPropertyPage::OnKillActive()
00089 {
00090 SetModified(FALSE);
00091
00092 return CPropertyPage::OnKillActive();
00093 }
00094
00095
00096 BEGIN_MESSAGE_MAP(CComPropertyPage, CPropertyPage)
00097 ON_WM_DESTROY()
00098 END_MESSAGE_MAP()
00099
00100
00101
00102
00103 void CComPropertyPage::OnOK()
00104 {
00105 if(S_OK == m_pPage->IsPageDirty()) m_pPage->Apply();
00106 SetModified(FALSE);
00107
00108 CPropertyPage::OnOK();
00109 }