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