Fix comment
[xy_vsfilter.git] / src / filters / InternalPropertyPage.h
blobc49f05aa76f2d34e23a6583a4275f74707ca60c0
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #pragma once
24 #include <atlcoll.h>
26 [uuid("03481710-D73E-4674-839F-03EDE2D60ED8")]
27 interface ISpecifyPropertyPages2 : public ISpecifyPropertyPages
29 STDMETHOD (CreatePage) (const GUID& guid, IPropertyPage** ppPage) = 0;
32 class CInternalPropertyPageWnd : public CWnd
34 bool m_fDirty;
35 CComPtr<IPropertyPageSite> m_pPageSite;
37 protected:
38 CFont m_font, m_monospacefont;
39 int m_fontheight;
41 virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
43 public:
44 CInternalPropertyPageWnd();
46 void SetDirty(bool fDirty = true) {m_fDirty = fDirty; if(fDirty && m_pPageSite) m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);}
47 bool GetDirty() {return m_fDirty;}
49 virtual BOOL Create(IPropertyPageSite* pPageSite, LPCRECT pRect, CWnd* pParentWnd);
51 virtual bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks) {return true;}
52 virtual void OnDisconnect() {}
53 virtual bool OnActivate() {return true;}
54 virtual void OnDeactivate() {}
55 virtual bool OnApply() {return true;}
57 DECLARE_MESSAGE_MAP()
60 class CInternalPropertyPage
61 : public CUnknown
62 , public IPropertyPage
63 , public CCritSec
65 CComPtr<IPropertyPageSite> m_pPageSite;
66 CInterfaceList<IUnknown, &IID_IUnknown> m_pUnks;
67 CInternalPropertyPageWnd* m_pWnd;
69 protected:
70 virtual CInternalPropertyPageWnd* GetWindow() = 0;
71 virtual LPCTSTR GetWindowTitle() = 0;
72 virtual CSize GetWindowSize() = 0;
74 public:
75 CInternalPropertyPage(LPUNKNOWN lpunk, HRESULT* phr);
76 virtual ~CInternalPropertyPage();
78 DECLARE_IUNKNOWN;
79 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
81 // IPropertyPage
83 STDMETHODIMP SetPageSite(IPropertyPageSite* pPageSite);
84 STDMETHODIMP Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal);
85 STDMETHODIMP Deactivate();
86 STDMETHODIMP GetPageInfo(PROPPAGEINFO* pPageInfo);
87 STDMETHODIMP SetObjects(ULONG cObjects, LPUNKNOWN* ppUnk);
88 STDMETHODIMP Show(UINT nCmdShow);
89 STDMETHODIMP Move(LPCRECT prect);
90 STDMETHODIMP IsPageDirty();
91 STDMETHODIMP Apply();
92 STDMETHODIMP Help(LPCWSTR lpszHelpDir);
93 STDMETHODIMP TranslateAccelerator(LPMSG lpMsg);
96 template<class WndClass>
97 class CInternalPropertyPageTempl : public CInternalPropertyPage
99 virtual CInternalPropertyPageWnd* GetWindow()
101 return new WndClass();
104 virtual LPCTSTR GetWindowTitle()
106 return WndClass::GetWindowTitle();
109 virtual CSize GetWindowSize()
111 return WndClass::GetWindowSize();
114 public:
115 CInternalPropertyPageTempl(LPUNKNOWN lpunk, HRESULT* phr)
116 : CInternalPropertyPage(lpunk, phr)