home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / WIZPROP.ZIP / WizPropertyPage.cpp next >
Encoding:
C/C++ Source or Header  |  1998-02-03  |  1.8 KB  |  96 lines

  1. #include "stdafx.h"
  2. #include "WizPropertyPage.h"
  3. #include "WizPropertySheet.h"
  4.  
  5. IMPLEMENT_DYNAMIC(CWizPropertyPage, CPropertyPage)
  6.  
  7. CWizPropertyPage::CWizPropertyPage() : CPropertyPage()
  8. {
  9.     m_pPropSheet = NULL;
  10.     m_bEnabled = TRUE;
  11. }
  12.  
  13. CWizPropertyPage::CWizPropertyPage(UINT nIDTemplate, UINT nIDCaption /*= 0*/) 
  14.     : CPropertyPage(nIDTemplate, nIDCaption)
  15. {
  16.     m_pPropSheet = NULL;
  17.     m_bEnabled = TRUE;
  18. }
  19.  
  20. CWizPropertyPage::CWizPropertyPage(LPCTSTR lpszTemplateName, UINT nIDCaption /*= 0 */)
  21. : CPropertyPage(lpszTemplateName, nIDCaption)
  22. {
  23.     m_pPropSheet = NULL;
  24.     m_bEnabled = TRUE;
  25. }
  26.  
  27. LRESULT CWizPropertyPage::GetNextPage(BOOL forward)
  28. {
  29.     ASSERT(m_pPropSheet);
  30.     
  31.     int act  = m_pPropSheet->GetActiveIndex();
  32.     int count= m_pPropSheet->GetPageCount();
  33.  
  34.     act += (forward ? 1: -1);
  35.  
  36.     BOOL found = FALSE;
  37.     CWizPropertyPage *pPage;
  38.  
  39.     CString tmp;
  40.  
  41.     while (!found && act < count && act >=0)
  42.     {
  43.         pPage = (CWizPropertyPage*) m_pPropSheet->GetPage(act);
  44.         if (pPage->IsEnabled())
  45.         {
  46.             found = TRUE;
  47.         }
  48.         else 
  49.         {
  50.             act += (forward ? 1: -1);
  51.         }
  52.         
  53.     }
  54.     
  55.     if (found)
  56.     {
  57.         return (LRESULT) pPage->m_lpszTemplateName; 
  58.     }
  59.     return -1; // Nowhere to go :)
  60. }
  61.  
  62. BOOL CWizPropertyPage::IsEnabled(void)
  63. {
  64.     return m_bEnabled;
  65. }
  66.  
  67. BOOL CWizPropertyPage::Enable(BOOL bEnable)
  68. {
  69.     BOOL old = m_bEnabled;
  70.     m_bEnabled = bEnable;
  71.     return old;
  72. }
  73.  
  74. LRESULT CWizPropertyPage::OnWizardNext() 
  75. {
  76.     // TODO: Add your specialized code here and/or call the base class
  77.     return GetNextPage();
  78. }
  79.  
  80. LRESULT CWizPropertyPage::OnWizardBack()
  81. {
  82.     return GetNextPage(FALSE);
  83. }
  84.  
  85.  
  86. BOOL CWizPropertyPage::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
  87. {
  88.     return CPropertyPage::OnNotify(wParam,lParam,pResult);
  89. }
  90.  
  91.  
  92. BOOL CWizPropertyPage::OnSetActive()
  93. {
  94.     return CPropertyPage::OnSetActive();
  95. }
  96.