ComPropertyPage.cpp

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 // ComPropertyPage.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "mplayerc.h"
00027 #include "ComPropertyPage.h"
00028 #include "ComPropertySheet.h"
00029 
00030 
00031 // CComPropertyPage dialog
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;  // return TRUE unless you set the focus to a control
00064         // EXCEPTION: OCX Property Pages should return FALSE
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 // CComPropertyPage message handlers
00102 
00103 void CComPropertyPage::OnOK()
00104 {
00105         if(S_OK == m_pPage->IsPageDirty()) m_pPage->Apply();
00106         SetModified(FALSE);
00107 
00108         CPropertyPage::OnOK();
00109 }

Generated on Tue Dec 13 14:46:47 2005 for guliverkli by  doxygen 1.4.5