summaryrefslogtreecommitdiff
path: root/Common/PropPageHolder.h
blob: 4fec7eea31fcea027b3857a6a348913c70356063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//////////////////////////////////////////////////////////////////
//  
// PropPageHolder.h : header file
//
// CPropPageHolder manages the components IPropertyPage Interface
//
// It also exposes a IPropertyPageSite Interface for the 
// Component (not used for much though)
//
//////////////////////////////////////////////////////////////////

#if !defined(AFX_PROPPAGEHOLDER_H__F0EC0A29_18D4_11D2_B2D4_0020182B97FC__INCLUDED_)
#define AFX_PROPPAGEHOLDER_H__F0EC0A29_18D4_11D2_B2D4_0020182B97FC__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

/////////////////////////////////////////////////////////////////////////////
// CPropPageHolder command target

class ATL_NO_VTABLE CPropPageHolder : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public IPropertyPageSite
{

// Attributes
public:
	CPropPageHolder();
//	CPropPageHolder(IPropertyPage* pPage, IUnknown* pSite);
	virtual ~CPropPageHolder();

// Operations
public:
	HRESULT Close();

	bool IsActivated();			// Is Proppage Created?
	HRESULT Apply();			// Save Changes to Data Object
	bool IsInitialized();		// Is Initialized?

	// Checks to see if it has a IPropPage
	HRESULT Initialize(IPropertyPage* pUnk, IUnknown* pSite);

	// Activates and Shows the Page
	// For best results start with WS_VISIBLE = false in 
	// dialog template (no flicker)
	HRESULT Create(HWND hwndParent, const RECT& rect, bool bModalParent = true);

	// DeActivates Page and Releases IPropPage
	HRESULT Destroy();

	// Window Functions
	HRESULT Show(UINT nCmdShow);
	HRESULT Move(const RECT& rect);

// Implementation
protected:
	HRESULT LoadInfo();

	// Is Created or not?
	bool m_bActivated;

	IPropertyPage* m_pPropPage;
	PROPPAGEINFO m_PageInfo;
	IUnknown* m_pSite;			// This is a pointer to the Page Container Site
								// Returned from IPropertyPageSite::GetPageContainer

public:
	DWORD GetHelpContext();
	string GetHelpFile();
	string GetTitle();

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CPropPageHolder)
	COM_INTERFACE_ENTRY(IPropertyPageSite)
END_COM_MAP()

	// IPropertyBag
    STDMETHOD(OnStatusChange)(DWORD dwFlags);
    STDMETHOD(GetLocaleID)(LCID* pLocaleID);
    STDMETHOD(GetPageContainer)(IUnknown** ppUnk);
    STDMETHOD(TranslateAccelerator)(LPMSG pMsg);
    
};

/////////////////////////////////////////////////////////////////////////////

#endif // !defined(AFX_PROPPAGEHOLDER_H__F0EC0A29_18D4_11D2_B2D4_0020182B97FC__INCLUDED_)