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.

144 lines
5.5 KiB

  1. //=--------------------------------------------------------------------------=
  2. // PropertyPages.H
  3. //=--------------------------------------------------------------------------=
  4. // Copyright 1995 Microsoft Corporation. All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // class declaration for CPropertyPage.
  13. //
  14. #ifndef _PROPERTYPAGES_H_
  15. // things we really need
  16. //
  17. #include "Unknown.H"
  18. #include <olectl.h>
  19. #include "LocalSrv.H"
  20. //=--------------------------------------------------------------------------=
  21. // messages that we'll send to property pages to instruct them to accomplish
  22. // tasks.
  23. //
  24. #define PPM_NEWOBJECTS (WM_USER + 100)
  25. #define PPM_APPLY (WM_USER + 101)
  26. #define PPM_EDITPROPERTY (WM_USER + 102)
  27. #define PPM_FREEOBJECTS (WM_USER + 103)
  28. //=--------------------------------------------------------------------------=
  29. // structure that control writers will use to define property pages.
  30. //
  31. typedef struct tagPROPERTYPAGEINFO {
  32. UNKNOWNOBJECTINFO unknowninfo;
  33. WORD wDlgResourceId;
  34. WORD wTitleId;
  35. WORD wDocStringId;
  36. LPCSTR szHelpFile;
  37. DWORD dwHelpContextId;
  38. } PROPERTYPAGEINFO;
  39. #ifndef INITOBJECTS
  40. #define DEFINE_PROPERTYPAGEOBJECT(name, pclsid, pszon, pfn, wr, wt, wd, pszhf, dwhci) \
  41. extern PROPERTYPAGEINFO name##Page \
  42. #define DEFINE_PROPERTYPAGEOBJECT2(name, pclsid, pszon, pfn, wr, wt, wd, pszhf, dwhci, fthreadsafe) \
  43. extern PROPERTYPAGEINFO name##Page \
  44. #else // INITOBJECTS
  45. #define DEFINE_PROPERTYPAGEOBJECT(name, pclsid, pszon, pfn, wr, wt, wd, pszhf, dwhci) \
  46. PROPERTYPAGEINFO name##Page = { {pclsid, pszon, NULL, TRUE, pfn }, wr, wt, wd, pszhf, dwhci } \
  47. #define DEFINE_PROPERTYPAGEOBJECT2(name, pclsid, pszon, pfn, wr, wt, wd, pszhf, dwhci, fthreadsafe) \
  48. PROPERTYPAGEINFO name##Page = { {pclsid, pszon, NULL, fthreadsafe, pfn }, wr, wt, wd, pszhf, dwhci } \
  49. #endif // INITOBJECTS
  50. #define TEMPLATENAMEOFPROPPAGE(index) MAKEINTRESOURCE(((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->wDlgResourceId)
  51. #define TITLEIDOFPROPPAGE(index) (((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->wTitleId)
  52. #define DOCSTRINGIDOFPROPPAGE(index) (((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->wDocStringId)
  53. #define HELPCONTEXTOFPROPPAGE(index) (((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->dwHelpContextId)
  54. #define HELPFILEOFPROPPAGE(index) (((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->szHelpFile)
  55. //=--------------------------------------------------------------------------=
  56. //
  57. class CPropertyPage : public CUnknownObject,
  58. public IPropertyPage2 {
  59. public:
  60. // IUnknown methods
  61. //
  62. DECLARE_STANDARD_UNKNOWN();
  63. // IPropertyPage methods
  64. //
  65. STDMETHOD(SetPageSite)(LPPROPERTYPAGESITE pPageSite);
  66. STDMETHOD(Activate)(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  67. STDMETHOD(Deactivate)(void);
  68. STDMETHOD(GetPageInfo)(LPPROPPAGEINFO pPageInfo);
  69. STDMETHOD(SetObjects)(ULONG cObjects, LPUNKNOWN FAR* ppunk);
  70. STDMETHOD(Show)(UINT nCmdShow);
  71. STDMETHOD(Move)(LPCRECT prect);
  72. STDMETHOD(IsPageDirty)(void);
  73. STDMETHOD(Apply)(void);
  74. STDMETHOD(Help)(LPCOLESTR lpszHelpDir);
  75. STDMETHOD(TranslateAccelerator)(LPMSG lpMsg);
  76. // IPropertyPage2 methods
  77. //
  78. STDMETHOD(EditProperty)(THIS_ DISPID dispid);
  79. // constructor destructor
  80. //
  81. CPropertyPage(IUnknown *pUnkOuter, int iObjectType);
  82. virtual ~CPropertyPage();
  83. HINSTANCE GetResourceHandle(void); // returns current resource handle.
  84. protected:
  85. IPropertyPageSite *m_pPropertyPageSite; // pointer to our ppage site.
  86. void MakeDirty(); // makes the property page dirty.
  87. HWND m_hwnd; // our hwnd.
  88. // the following two methods allow a property page implementer to get at all the
  89. // objects that we need to set here.
  90. //
  91. IUnknown *FirstControl(DWORD *dwCookie);
  92. IUnknown *NextControl(DWORD *dwCookie);
  93. virtual HRESULT InternalQueryInterface(REFIID, void **);
  94. int m_ObjectType; // what type of object we are
  95. private:
  96. IUnknown **m_ppUnkObjects; // objects that we're working with.
  97. unsigned m_fActivated:1;
  98. unsigned m_fDirty:1;
  99. unsigned m_fDeactivating:1; // Set when the page is deactivating. This helps prevent
  100. // unnecessary calls to IPropertyPageSite::OnStatusChange
  101. UINT m_cObjects; // how many objects we're holding on to
  102. void ReleaseAllObjects(void); // clears out all objects we've got.
  103. HRESULT EnsureLoaded(void); // forces the load of the page.
  104. HRESULT NewObjects(void); // Notifies page to initialize its fields with prop vals
  105. // default dialog proc for a page.
  106. //
  107. static BOOL CALLBACK PropPageDlgProc(HWND, UINT, WPARAM, LPARAM);
  108. // all page implementers MUST implement the following function.
  109. //
  110. virtual BOOL DialogProc(HWND, UINT, WPARAM, LPARAM) PURE;
  111. };
  112. #define _PROPERTYPAGES_H_
  113. #endif // _PROPERTYPAGES_H_