1
0

cprop.h 4.2 KB

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