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.

88 lines
3.6 KiB

  1. //=============================================================================
  2. // CPageBase defines a class which is an interface from which the tab page
  3. // classes will inherit (using multiple inheritance). These methods will be
  4. // called by the main MSConfig control to create and manipulate the pages.
  5. //=============================================================================
  6. #pragma once
  7. extern BOOL FileExists(const CString & strFile);
  8. class CPageBase
  9. {
  10. public:
  11. //-------------------------------------------------------------------------
  12. // This enumeration is used by the tab to communicate its state. NORMAL
  13. // means that the tab has made no changes to the system. DIAGNOSTIC
  14. // means the tab has disabled as much as possible. USER means an in-
  15. // between state (the user has disabled some things).
  16. //-------------------------------------------------------------------------
  17. typedef enum { NORMAL, DIAGNOSTIC, USER } TabState;
  18. public:
  19. CPageBase() : m_fMadeChange(FALSE), m_fInitialized(FALSE) { }
  20. virtual ~CPageBase() { }
  21. //-------------------------------------------------------------------------
  22. // Get the tab state. These two functions will return the current tab
  23. // state, or the state which was last applied to the system.
  24. //
  25. // For the default implementation, the base pages should not override the
  26. // GetAppliedTabState() function, as long as they call
  27. // CPageBase::SetAppliedState() when changes are applied.
  28. //-------------------------------------------------------------------------
  29. virtual TabState GetCurrentTabState() = 0;
  30. virtual TabState GetAppliedTabState();
  31. //-------------------------------------------------------------------------
  32. // CommitChanges() is called when the changes made by this tab are to be
  33. // made permanent. This base class version can be called if the derived
  34. // class is letting the base class maintain the applied state.
  35. //-------------------------------------------------------------------------
  36. virtual void CommitChanges()
  37. {
  38. SetAppliedState(NORMAL);
  39. }
  40. //-------------------------------------------------------------------------
  41. // MadeChanges() should return TRUE if this tab has applied changes to the
  42. // system. This is checked when determining if the computer should be
  43. // restarted when MSConfig exits. If the tab maintains the m_fMadeChange
  44. // variable, this doesn't need to be overridden.
  45. //-------------------------------------------------------------------------
  46. virtual BOOL HasAppliedChanges()
  47. {
  48. return m_fMadeChange;
  49. }
  50. //-------------------------------------------------------------------------
  51. // GetName() should return the name of this tab. This is an internal,
  52. // non-localized name.
  53. //-------------------------------------------------------------------------
  54. virtual LPCTSTR GetName() = 0;
  55. //-------------------------------------------------------------------------
  56. // The following two member functions are called to when the user makes
  57. // a global change to a tab's state (on the general tab).
  58. //-------------------------------------------------------------------------
  59. virtual void SetNormal() = 0;
  60. virtual void SetDiagnostic() = 0;
  61. protected:
  62. //-------------------------------------------------------------------------
  63. // Sets the applied tab state (if the derived class is allowing the base
  64. // class to maintain this).
  65. //-------------------------------------------------------------------------
  66. void SetAppliedState(TabState state);
  67. protected:
  68. BOOL m_fMadeChange; // has the tab applied changes to the system?
  69. BOOL m_fInitialized; // has OnInitDialog() been called?
  70. };