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.

195 lines
5.2 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1996.
  5. //
  6. // File: dlg.hxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 04-Apr-96 RaviR Created.
  15. // 12-Jul-96 MarkBl CPropPage now task-specific to incorporate
  16. // scheduling-specific functionality needed
  17. // by all sub-classes.
  18. // 05-05-97 DavidMun prop page copies task path in ctor,
  19. // does not free it.
  20. //
  21. //____________________________________________________________________________
  22. #ifndef _DLG_HXX_
  23. #define _DLG_HXX_
  24. //
  25. // CPropPage task flag values.
  26. //
  27. #define TASK_FLAG_IN_TASKS_FOLDER 0x00000001 // Task resides w/in the
  28. // Tasks folder
  29. #define TASK_FLAG_WIN_TASK 0x00000002 // Task resides on a Win95
  30. // machine.
  31. #define TASK_FLAG_NT_TASK 0x00000004 // Task resides on an NT
  32. // machine.
  33. //____________________________________________________________________________
  34. //
  35. // Class: CPropPage
  36. //____________________________________________________________________________
  37. class CPropPage
  38. {
  39. public:
  40. CPropPage(LPCTSTR szTmplt, LPTSTR ptszJobPath);
  41. virtual ~CPropPage();
  42. HRESULT DoModeless(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam);
  43. //
  44. // I hate to undo the purity of this property-page specific class, but
  45. // these scheduling-agent specific methods need to be available on all
  46. // subclasses.
  47. //
  48. void SetPlatformId(BYTE bPlatform) { m_bPlatformId = bPlatform; }
  49. BYTE GetPlatformId() { return m_bPlatformId; }
  50. LPTSTR GetTaskPath() const { return (LPTSTR) m_ptszTaskPath; }
  51. BOOL IsTaskInTasksFolder() { return m_fTaskInTasksFolder; }
  52. BOOL SupportsSystemRequired() { return m_fSupportsSystemRequired; }
  53. //
  54. // Static WndProc to be passed to PROPSHEETPAGE::pfnDlgProc
  55. //
  56. static INT_PTR CALLBACK StaticDlgProc(HWND hDlg, UINT uMsg,
  57. WPARAM wParam, LPARAM lParam);
  58. //
  59. // Instance specific wind proc
  60. //
  61. virtual LRESULT DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  62. //
  63. // Protected virtual member functions, called by WndProc
  64. //
  65. virtual LRESULT _OnInitDialog(LPARAM lParam) = 0;
  66. virtual LRESULT _OnCommand(int id, HWND hwndCtl, UINT codeNotify);
  67. virtual LRESULT _OnNotify(UINT uMessage, UINT uParam, LPARAM lParam);
  68. virtual LRESULT _OnWinIniChange(WPARAM wParam, LPARAM lParam);
  69. virtual LRESULT _OnApply(void);
  70. virtual LRESULT _OnCancel(void);
  71. virtual LRESULT _OnSetFocus(HWND hwndLoseFocus);
  72. virtual LRESULT _OnTimer(UINT idTimer);
  73. virtual LRESULT _OnDestroy(void);
  74. virtual LRESULT _OnSpinDeltaPos(NM_UPDOWN * pnmud);
  75. virtual LRESULT _OnPSMQuerySibling(WPARAM wParam, LPARAM lParam);
  76. virtual LRESULT _OnPSNSetActive(LPARAM lParam);
  77. virtual LRESULT _OnPSNKillActive(LPARAM lParam);
  78. virtual LRESULT _OnDateTimeChange(LPARAM lParam);
  79. virtual LRESULT _OnHelp(HANDLE hRequesting, UINT uiHelpCommand);
  80. virtual BOOL _ProcessListViewNotifications(UINT uMsg, WPARAM wParam,
  81. LPARAM lParam);
  82. //
  83. // Help full inline functions
  84. //
  85. HWND Hwnd() { return m_hPage; }
  86. HWND _hCtrl(int idCtrl) { return GetDlgItem(m_hPage, idCtrl); }
  87. virtual void _EnableApplyButton(void)
  88. { m_fDirty = TRUE; PropSheet_Changed(GetParent(m_hPage), m_hPage);}
  89. void _EnableDlgItem(int idCtrl, BOOL fEnable)
  90. { EnableWindow(_hCtrl(idCtrl), fEnable); }
  91. //
  92. // Data members
  93. //
  94. PROPSHEETPAGE m_psp;
  95. HWND m_hPage;
  96. BOOL m_fDirty;
  97. protected:
  98. BOOL m_fInInit;
  99. void _BaseInit(void);
  100. private:
  101. static UINT CALLBACK PageRelease(HWND hwnd, UINT uMsg,
  102. LPPROPSHEETPAGE ppsp);
  103. CDllRef m_DllRef;
  104. BOOL m_fTaskInTasksFolder;
  105. BOOL m_fSupportsSystemRequired;
  106. TCHAR m_ptszTaskPath[MAX_PATH + 1];
  107. BYTE m_bPlatformId;
  108. }; // class CPropPage
  109. inline LRESULT
  110. CPropPage::_OnHelp(
  111. HANDLE hRequesting,
  112. UINT uiHelpCommand)
  113. {
  114. return TRUE;
  115. }
  116. //____________________________________________________________________________
  117. //
  118. // Class: CDlg
  119. //____________________________________________________________________________
  120. class CDlg
  121. {
  122. public:
  123. CDlg() {}
  124. virtual ~CDlg() {}
  125. INT_PTR DoModal(UINT idRes, HWND hParent);
  126. HWND DoModeless(UINT idRes, HWND hParent);
  127. HWND Hwnd() { return m_hDlg; }
  128. protected:
  129. static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  130. HWND m_hDlg;
  131. //
  132. // Help full inline functions
  133. //
  134. HWND _hCtrl(int idCtrl) { return GetDlgItem(m_hDlg, idCtrl); }
  135. private:
  136. virtual INT_PTR RealDlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  137. }; // class CDlg
  138. #endif // _DLG_HXX_