Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

198 lines
5.3 KiB

  1. #include "precomp.h"
  2. #include "resource.h"
  3. #include <algorithm>
  4. #include "global.h"
  5. #include "PropPg.h"
  6. #include "DSList.h"
  7. #include "NmAkWiz.h"
  8. ////////////////////////////////////////////////////////////////////////////////////////////////////
  9. // Static member vars
  10. CCallModeSheet* CCallModeSheet::ms_pCallModeSheet = NULL;
  11. ////////////////////////////////////////////////////////////////////////////////////////////////////
  12. // Static member fns
  13. INT_PTR CALLBACK CCallModeSheet::DlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) {
  14. TCHAR sz[ MAX_PATH ];
  15. switch( message )
  16. {
  17. case WM_INITDIALOG:
  18. ms_pCallModeSheet->_InitDialog(hDlg);
  19. ms_pCallModeSheet->_CreatePropWnd(hDlg);
  20. return TRUE;
  21. case WM_COMMAND:
  22. {
  23. if (ms_pCallModeSheet)
  24. {
  25. if (ms_pCallModeSheet->m_fGkActive)
  26. {
  27. if (ms_pCallModeSheet->m_pGkPropWnd)
  28. return(ms_pCallModeSheet->m_pGkPropWnd->DoCommand(wParam, lParam));
  29. }
  30. else
  31. {
  32. if (ms_pCallModeSheet->m_pDsPropWnd)
  33. return(ms_pCallModeSheet->m_pDsPropWnd->DoCommand(wParam, lParam));
  34. }
  35. }
  36. break;
  37. }
  38. case WM_NOTIFY:
  39. switch( reinterpret_cast< NMHDR FAR* >( lParam )->code ) {
  40. case PSN_QUERYCANCEL:
  41. SetWindowLong( hDlg, DWL_MSGRESULT, !VerifyExitMessageBox());
  42. return TRUE;
  43. case PSN_SETACTIVE:
  44. g_hwndActive = hDlg;
  45. ms_pCallModeSheet->m_fGkActive = g_pWiz->m_SettingsSheet.IsGateKeeperModeSelected();
  46. if (ms_pCallModeSheet->m_fGkActive)
  47. {
  48. if (ms_pCallModeSheet->m_pDsPropWnd)
  49. ms_pCallModeSheet->m_pDsPropWnd->ShowWindow( FALSE );
  50. if (ms_pCallModeSheet->m_pGkPropWnd)
  51. ms_pCallModeSheet->m_pGkPropWnd->ShowWindow( TRUE );
  52. }
  53. else
  54. {
  55. if (ms_pCallModeSheet->m_pGkPropWnd)
  56. ms_pCallModeSheet->m_pGkPropWnd->ShowWindow( FALSE );
  57. if (ms_pCallModeSheet->m_pDsPropWnd)
  58. ms_pCallModeSheet->m_pDsPropWnd->ShowWindow( TRUE );
  59. }
  60. PropSheet_SetWizButtons( GetParent( hDlg ), PSWIZB_NEXT | PSWIZB_BACK );
  61. return TRUE;
  62. case PSN_WIZNEXT:
  63. if (ms_pCallModeSheet->m_fGkActive)
  64. {
  65. if (ms_pCallModeSheet->m_pGkPropWnd)
  66. ms_pCallModeSheet->m_pGkPropWnd->QueryWizNext();
  67. }
  68. else
  69. {
  70. if (ms_pCallModeSheet->m_pDsPropWnd)
  71. ms_pCallModeSheet->m_pDsPropWnd->QueryWizNext();
  72. }
  73. return TRUE;
  74. }
  75. default:
  76. break;
  77. }
  78. return FALSE;
  79. }
  80. ////////////////////////////////////////////////////////////////////////////////////////////////////
  81. // Member fns
  82. CCallModeSheet::CCallModeSheet( void )
  83. : m_PropertySheetPage( MAKEINTRESOURCE( IDD_PROPPAGE_DEFAULT ),
  84. CCallModeSheet::DlgProc /*,
  85. PSP_HASHELP */
  86. ),
  87. m_pDsPropWnd( NULL ),
  88. m_pGkPropWnd( NULL ),
  89. m_fGkActive( FALSE )
  90. {
  91. assert(ms_pCallModeSheet == NULL);
  92. ms_pCallModeSheet = this;
  93. }
  94. void CCallModeSheet::_CreatePropWnd(HWND hDlg)
  95. {
  96. RECT rect;
  97. GetClientRect(hDlg, &rect );
  98. int iHeight = rect.bottom;
  99. int iWidth = rect.right - CPropertyDataWindow2::mcs_iLeft;
  100. m_pDsPropWnd = new CDsPropWnd2(hDlg, CPropertyDataWindow2::mcs_iLeft,
  101. CPropertyDataWindow2::mcs_iTop, iWidth, iHeight );
  102. m_pGkPropWnd = new CGkPropWnd2(hDlg, CPropertyDataWindow2::mcs_iLeft,
  103. CPropertyDataWindow2::mcs_iTop, iWidth, iHeight );
  104. }
  105. CCallModeSheet::~CCallModeSheet( void )
  106. {
  107. delete m_pDsPropWnd;
  108. m_pDsPropWnd = NULL;
  109. delete m_pGkPropWnd;
  110. m_pGkPropWnd = NULL;
  111. ms_pCallModeSheet = NULL;
  112. }
  113. void CCallModeSheet::_InitDialog(HWND hDlg)
  114. {
  115. // Set the buttons
  116. PropSheet_SetWizButtons( GetParent(hDlg ), PSWIZB_NEXT | PSWIZB_BACK );
  117. }
  118. int CCallModeSheet::SpewToListBox(HWND hwndList, int iStartLine )
  119. {
  120. if (m_fGkActive)
  121. {
  122. if (m_pGkPropWnd)
  123. iStartLine = m_pGkPropWnd->SpewToListBox(hwndList, iStartLine);
  124. }
  125. else
  126. {
  127. if (m_pDsPropWnd)
  128. iStartLine = m_pDsPropWnd->SpewToListBox(hwndList, iStartLine);
  129. }
  130. return(iStartLine);
  131. }
  132. void CCallModeSheet::PrepSettings(void)
  133. {
  134. if (m_pDsPropWnd)
  135. m_pDsPropWnd->PrepSettings(m_fGkActive);
  136. if (m_pGkPropWnd)
  137. m_pGkPropWnd->PrepSettings(m_fGkActive);
  138. }
  139. void CCallModeSheet::WriteSettings(void)
  140. {
  141. if (m_pDsPropWnd)
  142. m_pDsPropWnd->WriteSettings(m_fGkActive);
  143. if (m_pGkPropWnd)
  144. m_pGkPropWnd->WriteSettings(m_fGkActive);
  145. }
  146. BOOL CCallModeSheet::WriteToINF(HANDLE hFile)
  147. {
  148. if (m_pDsPropWnd)
  149. m_pDsPropWnd->WriteToINF(m_fGkActive, hFile);
  150. if (m_pGkPropWnd)
  151. m_pGkPropWnd->WriteToINF(m_fGkActive, hFile);
  152. return TRUE;
  153. }