Source code of Windows XP (NT5)
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.

259 lines
5.8 KiB

  1. //
  2. // Application Verifier UI
  3. // Copyright (c) Microsoft Corporation, 2001
  4. //
  5. //
  6. //
  7. // module: TaskPage.cpp
  8. // author: DMihai
  9. // created: 02/22/2001
  10. //
  11. // Description:
  12. //
  13. // "Select a task" wizard page class.
  14. //
  15. #include "stdafx.h"
  16. #include "appverif.h"
  17. #include "TaskPage.h"
  18. #include "Setting.h"
  19. #include "AVUtil.h"
  20. #include "AVGlobal.h"
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26. //
  27. // Change this if you add/remove/change order
  28. // of radio buttons on this page
  29. //
  30. #define FIRST_RADIO_BUTTON_ID IDC_TASKP_STANDARD_RADIO
  31. //
  32. // Help IDs
  33. //
  34. static DWORD MyHelpIds[] =
  35. {
  36. 0, 0
  37. };
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CTaskPage property page
  40. IMPLEMENT_DYNCREATE(CTaskPage, CAppverifPage)
  41. CTaskPage::CTaskPage() : CAppverifPage(CTaskPage::IDD)
  42. {
  43. //{{AFX_DATA_INIT(CTaskPage)
  44. m_nCrtRadio = -1;
  45. //}}AFX_DATA_INIT
  46. }
  47. CTaskPage::~CTaskPage()
  48. {
  49. }
  50. void CTaskPage::DoDataExchange(CDataExchange* pDX)
  51. {
  52. CAppverifPage::DoDataExchange(pDX);
  53. //{{AFX_DATA_MAP(CTaskPage)
  54. DDX_Control(pDX, IDC_TASKP_NEXTDESCR_STATIC, m_NextDescription);
  55. DDX_Radio(pDX, IDC_TASKP_STANDARD_RADIO, m_nCrtRadio);
  56. //}}AFX_DATA_MAP
  57. }
  58. BEGIN_MESSAGE_MAP(CTaskPage, CAppverifPage)
  59. //{{AFX_MSG_MAP(CTaskPage)
  60. ON_BN_CLICKED(IDC_TASKP_STANDARD_RADIO, OnStandardRadio)
  61. ON_BN_CLICKED(IDC_TASKP_VIEWSETT_RADIO, OnViewSettRadio)
  62. ON_BN_CLICKED(IDC_TASKP_DELETESETT_RADIO, OnDeletesettRadio)
  63. ON_BN_CLICKED(IDC_TASKP_LOGO_RADIO, OnLogoRadio)
  64. ON_WM_CONTEXTMENU()
  65. ON_MESSAGE( WM_HELP, OnHelp )
  66. //}}AFX_MSG_MAP
  67. END_MESSAGE_MAP()
  68. /////////////////////////////////////////////////////////////////////////////
  69. ULONG CTaskPage::GetDialogId() const
  70. {
  71. return IDD_TASK_PAGE;
  72. }
  73. /////////////////////////////////////////////////////////////////////////////
  74. LRESULT CTaskPage::OnWizardNext()
  75. {
  76. LRESULT lNextPageId;
  77. lNextPageId = -1;
  78. if( UpdateData() == TRUE )
  79. {
  80. switch( m_nCrtRadio )
  81. {
  82. case IDC_TASKP_STANDARD_RADIO - FIRST_RADIO_BUTTON_ID:
  83. g_NewSettings.m_SettingsType = AVSettingsTypeStandard;
  84. lNextPageId = IDD_APPLICATION_PAGE;
  85. break;
  86. case IDC_TASKP_VIEWSETT_RADIO - FIRST_RADIO_BUTTON_ID:
  87. lNextPageId = IDD_VIEWSETT_PAGE;
  88. break;
  89. case IDC_TASKP_LOGO_RADIO - FIRST_RADIO_BUTTON_ID:
  90. lNextPageId = IDD_CHOOSEEXE_PAGE;
  91. break;
  92. case IDC_TASKP_DELETESETT_RADIO - FIRST_RADIO_BUTTON_ID:
  93. default:
  94. //
  95. // Oops. how did we get here?
  96. //
  97. ASSERT( FALSE );
  98. }
  99. }
  100. //
  101. // Go to the next page
  102. //
  103. GoingToNextPageNotify( lNextPageId );
  104. return lNextPageId;
  105. }
  106. /////////////////////////////////////////////////////////////////////////////
  107. BOOL CTaskPage::OnSetActive()
  108. {
  109. ASSERT_VALID( m_pParentSheet );
  110. m_pParentSheet->SetWizardButtons(
  111. PSWIZB_NEXT );
  112. return CAppverifPage::OnSetActive();
  113. }
  114. /////////////////////////////////////////////////////////////////////////////
  115. BOOL CTaskPage::OnWizardFinish()
  116. {
  117. BOOL bFinish;
  118. INT nResponse;
  119. bFinish = FALSE;
  120. if( TRUE == UpdateData( TRUE ) )
  121. {
  122. //
  123. // This must have been the "delete settings" selection
  124. // if we had a "Finish" button.
  125. //
  126. ASSERT( IDC_TASKP_DELETESETT_RADIO - FIRST_RADIO_BUTTON_ID == m_nCrtRadio );
  127. nResponse = AfxMessageBox( IDS_DELETE_ALL_SETTINGS,
  128. MB_YESNO );
  129. if( IDYES == nResponse )
  130. {
  131. g_NewSettings.m_aApplicationData.DeleteAll();
  132. bFinish = AVSaveNewSettings() && CAppverifPage::OnWizardFinish();
  133. }
  134. }
  135. return bFinish;
  136. }
  137. /////////////////////////////////////////////////////////////////////////////
  138. BOOL CTaskPage::OnInitDialog()
  139. {
  140. //
  141. // Always start with standard settings
  142. //
  143. m_nCrtRadio = IDC_TASKP_STANDARD_RADIO - FIRST_RADIO_BUTTON_ID;
  144. CAppverifPage::OnInitDialog();
  145. AVSetWindowText( m_NextDescription, IDS_TASKP_NEXT_DESCR_STANDARD );
  146. return TRUE; // return TRUE unless you set the focus to a control
  147. // EXCEPTION: OCX Property Pages should return FALSE
  148. }
  149. /////////////////////////////////////////////////////////////////////////////
  150. // CTaskPage message handlers
  151. void CTaskPage::OnStandardRadio()
  152. {
  153. ASSERT_VALID( m_pParentSheet );
  154. m_pParentSheet->SetWizardButtons(
  155. PSWIZB_NEXT );
  156. AVSetWindowText( m_NextDescription, IDS_TASKP_NEXT_DESCR_STANDARD );
  157. }
  158. void CTaskPage::OnViewSettRadio()
  159. {
  160. ASSERT_VALID( m_pParentSheet );
  161. m_pParentSheet->SetWizardButtons(
  162. PSWIZB_NEXT );
  163. AVSetWindowText( m_NextDescription, IDS_TASKP_NEXT_DESCR_VIEW );
  164. }
  165. void CTaskPage::OnDeletesettRadio()
  166. {
  167. ASSERT_VALID( m_pParentSheet );
  168. m_pParentSheet->SetWizardButtons(
  169. PSWIZB_FINISH );
  170. AVSetWindowText( m_NextDescription, IDS_TASKP_NEXT_DESCR_DELETE );
  171. }
  172. void CTaskPage::OnLogoRadio()
  173. {
  174. ASSERT_VALID( m_pParentSheet );
  175. m_pParentSheet->SetWizardButtons(
  176. PSWIZB_NEXT );
  177. AVSetWindowText( m_NextDescription, IDS_TASKP_NEXT_DESCR_LOGO );
  178. }
  179. /////////////////////////////////////////////////////////////
  180. LONG CTaskPage::OnHelp( WPARAM wParam, LPARAM lParam )
  181. {
  182. LONG lResult = 0;
  183. LPHELPINFO lpHelpInfo = (LPHELPINFO)lParam;
  184. ::WinHelp(
  185. (HWND) lpHelpInfo->hItemHandle,
  186. g_szAVHelpFile,
  187. HELP_WM_HELP,
  188. (DWORD_PTR) MyHelpIds );
  189. return lResult;
  190. }
  191. /////////////////////////////////////////////////////////////////////////////
  192. void CTaskPage::OnContextMenu(CWnd* pWnd, CPoint point)
  193. {
  194. ::WinHelp(
  195. pWnd->m_hWnd,
  196. g_szAVHelpFile,
  197. HELP_CONTEXTMENU,
  198. (DWORD_PTR) MyHelpIds );
  199. }