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.

134 lines
4.8 KiB

  1. //=--------------------------------------------------------------------------=
  2. // PropPage.H
  3. //=--------------------------------------------------------------------------=
  4. // Copyright 1995-1996 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 _PROPPAGE_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. #else // INITOBJECTS
  43. #define DEFINE_PROPERTYPAGEOBJECT(name, pclsid, pszon, pfn, wr, wt, wd, pszhf, dwhci) \
  44. PROPERTYPAGEINFO name##Page = { {pclsid, pszon, pfn }, wr, wt, wd, pszhf, dwhci } \
  45. #endif // INITOBJECTS
  46. #define TEMPLATENAMEOFPROPPAGE(index) MAKEINTRESOURCE(((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->wDlgResourceId)
  47. #define TITLEIDOFPROPPAGE(index) (((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->wTitleId)
  48. #define DOCSTRINGIDOFPROPPAGE(index) (((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->wDocStringId)
  49. #define HELPCONTEXTOFPROPPAGE(index) (((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->dwHelpContextId)
  50. #define HELPFILEOFPROPPAGE(index) (((PROPERTYPAGEINFO *)(g_ObjectInfo[index].pInfo))->szHelpFile)
  51. //=--------------------------------------------------------------------------=
  52. //
  53. class CPropertyPage : public CUnknownObject, public IPropertyPage2 {
  54. public:
  55. // IUnknown methods
  56. //
  57. DECLARE_STANDARD_UNKNOWN();
  58. // IPropertyPage methods
  59. //
  60. STDMETHOD(SetPageSite)(LPPROPERTYPAGESITE pPageSite);
  61. STDMETHOD(Activate)(HWND hwndParent, LPCRECT lprc, BOOL bModal);
  62. STDMETHOD(Deactivate)(void);
  63. STDMETHOD(GetPageInfo)(LPPROPPAGEINFO pPageInfo);
  64. STDMETHOD(SetObjects)(ULONG cObjects, LPUNKNOWN FAR* ppunk);
  65. STDMETHOD(Show)(UINT nCmdShow);
  66. STDMETHOD(Move)(LPCRECT prect);
  67. STDMETHOD(IsPageDirty)(void);
  68. STDMETHOD(Apply)(void);
  69. STDMETHOD(Help)(LPCOLESTR lpszHelpDir);
  70. STDMETHOD(TranslateAccelerator)(LPMSG lpMsg);
  71. // IPropertyPage2 methods
  72. //
  73. STDMETHOD(EditProperty)(THIS_ DISPID dispid);
  74. // constructor destructor
  75. //
  76. CPropertyPage(IUnknown *pUnkOuter, int iObjectType);
  77. virtual ~CPropertyPage();
  78. HINSTANCE GetResourceHandle(void); // returns current resource handle.
  79. protected:
  80. IPropertyPageSite *m_pPropertyPageSite; // pointer to our ppage site.
  81. void MakeDirty(); // makes the property page dirty.
  82. HWND m_hwnd; // our hwnd.
  83. // the following two methods allow a property page implementer to get at all the
  84. // objects that we need to set here.
  85. //
  86. IUnknown *FirstControl(DWORD *dwCookie);
  87. IUnknown *NextControl(DWORD *dwCookie);
  88. private:
  89. IUnknown **m_ppUnkObjects; // objects that we're working with.
  90. unsigned m_fActivated:1;
  91. unsigned m_fDirty:1;
  92. int m_ObjectType; // what type of object we are
  93. UINT m_cObjects; // how many objects we're holding on to
  94. void m_ReleaseAllObjects(void); // clears out all objects we've got.
  95. HRESULT m_EnsureLoaded(void); // forces the load of the page.
  96. virtual HRESULT InternalQueryInterface(REFIID, void **);
  97. // default dialog proc for a page.
  98. //
  99. static INT_PTR CALLBACK PropPageDlgProc(HWND, UINT, WPARAM, LPARAM);
  100. // all page implementers MUST implement the following function.
  101. //
  102. virtual INT_PTR DialogProc(HWND, UINT, WPARAM, LPARAM) PURE;
  103. };
  104. #define _PROPPAGE_H_
  105. #endif // _PROPPAGE_H_