home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / cprop.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-09  |  4.1 KB  |  90 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (c) 1992 - 1996  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11.  
  12. #ifndef __CPROP__
  13. #define __CPROP__
  14.  
  15. // Base property page class. Filters typically expose custom properties by
  16. // implementing special control interfaces, examples are IDirectDrawVideo
  17. // and IQualProp on renderers. This allows property pages to be built that
  18. // use the given interface. Applications such as the ActiveMovie OCX query
  19. // filters for the property pages they support and expose them to the user
  20. //
  21. // This class provides all the framework for a property page. A property
  22. // page is a COM object that supports IPropertyPage. We should be created
  23. // with a resource ID for the dialog which we will load when required. We
  24. // should also be given in the constructor a resource ID for a title string
  25. // we will load from the DLLs STRINGTABLE. The property page titles must be
  26. // stored in resource files so that they can be easily internationalised
  27. //
  28. // We have a number of virtual methods (not PURE) that may be overriden in
  29. // derived classes to query for interfaces and so on. These functions have
  30. // simple implementations here that just return NOERROR. Derived classes
  31. // will almost definately have to override the message handler method called
  32. // OnReceiveMessage. We have a static dialog procedure that calls the method
  33. // so that derived classes don't have to fiddle around with the this pointer
  34.  
  35. class CBasePropertyPage : public IPropertyPage, public CUnknown
  36. {
  37. protected:
  38.  
  39.     LPPROPERTYPAGESITE m_pPageSite;       // Details for our property site
  40.     HWND m_hwnd;                          // Window handle for the page
  41.     HWND m_Dlg;                           // Actual dialog window handle
  42.     BOOL m_bDirty;                        // Has anything been changed
  43.     int m_TitleId;                        // Resource identifier for title
  44.     int m_DialogId;                       // Dialog resource identifier
  45.  
  46.     static BOOL CALLBACK DialogProc(HWND hwnd,
  47.                                     UINT uMsg,
  48.                                     WPARAM wParam,
  49.                                     LPARAM lParam);
  50. public:
  51.  
  52.     CBasePropertyPage(TCHAR *pName,      // Debug only name
  53.                       LPUNKNOWN pUnk,    // COM Delegator
  54.                       HRESULT *phr,      // Return code
  55.                       int DialogId,      // Resource ID
  56.                       int TitleId);      // To get tital
  57.  
  58.     virtual ~CBasePropertyPage() { };
  59.     DECLARE_IUNKNOWN;
  60.  
  61.     // Override these virtual methods
  62.  
  63.     virtual HRESULT OnConnect(IUnknown *pUnknown) { return NOERROR; };
  64.     virtual HRESULT OnDisconnect() { return NOERROR; };
  65.     virtual HRESULT OnActivate() { return NOERROR; };
  66.     virtual HRESULT OnDeactivate() { return NOERROR; };
  67.     virtual HRESULT OnApplyChanges() { return NOERROR; };
  68.     virtual BOOL OnReceiveMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
  69.  
  70.     // These implement an IPropertyPage interface
  71.  
  72.     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,void **ppv);
  73.     STDMETHODIMP_(ULONG) NonDelegatingRelease();
  74.     STDMETHODIMP_(ULONG) NonDelegatingAddRef();
  75.     STDMETHODIMP SetPageSite(LPPROPERTYPAGESITE pPageSite);
  76.     STDMETHODIMP Activate(HWND hwndParent,LPCRECT prect,BOOL fModal);
  77.     STDMETHODIMP Deactivate(void);
  78.     STDMETHODIMP GetPageInfo(LPPROPPAGEINFO pPageInfo);
  79.     STDMETHODIMP SetObjects(ULONG cObjects, LPUNKNOWN *ppUnk);
  80.     STDMETHODIMP Show(UINT nCmdShow);
  81.     STDMETHODIMP Move(LPCRECT prect);
  82.     STDMETHODIMP IsPageDirty(void) { return m_bDirty ? S_OK : S_FALSE; }
  83.     STDMETHODIMP Apply(void);
  84.     STDMETHODIMP Help(LPCWSTR lpszHelpDir) { return E_NOTIMPL; }
  85.     STDMETHODIMP TranslateAccelerator(LPMSG lpMsg) { return E_NOTIMPL; }
  86. };
  87.  
  88. #endif // __CPROP__
  89.  
  90.