-
Notifications
You must be signed in to change notification settings - Fork 0
/
ValidationResultControl.h
141 lines (118 loc) · 4.31 KB
/
ValidationResultControl.h
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// ValidationResultControl.h : Declaration of the CValidationResultControl
#pragma once
#include "resource.h" // main symbols
#include <atlctl.h>
#include "ontoumleaplugin_i.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
using namespace ATL;
// CValidationResultControl
class ATL_NO_VTABLE CValidationResultControl :
public CComObjectRootEx<CComSingleThreadModel>,
public CStockPropImpl<CValidationResultControl, IValidationResultControl>,
public IOleControlImpl<CValidationResultControl>,
public IOleObjectImpl<CValidationResultControl>,
public IOleInPlaceActiveObjectImpl<CValidationResultControl>,
public IViewObjectExImpl<CValidationResultControl>,
public IOleInPlaceObjectWindowlessImpl<CValidationResultControl>,
public CComCoClass<CValidationResultControl, &CLSID_ValidationResultControl>,
public CComCompositeControl<CValidationResultControl>
{
public:
CValidationResultControl()
{
m_bWindowOnly = TRUE;
CalcExtent(m_sizeExtent);
}
DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE |
OLEMISC_CANTLINKINSIDE |
OLEMISC_INSIDEOUT |
OLEMISC_ACTIVATEWHENVISIBLE |
OLEMISC_SETCLIENTSITEFIRST
)
DECLARE_REGISTRY_RESOURCEID(IDR_VALIDATIONRESULTCONTROL)
BEGIN_COM_MAP(CValidationResultControl)
COM_INTERFACE_ENTRY(IValidationResultControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IViewObjectEx)
COM_INTERFACE_ENTRY(IViewObject2)
COM_INTERFACE_ENTRY(IViewObject)
COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceObject)
COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY(IOleControl)
COM_INTERFACE_ENTRY(IOleObject)
END_COM_MAP()
BEGIN_PROP_MAP(CValidationResultControl)
PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
#ifndef _WIN32_WCE
PROP_ENTRY_TYPE("BackColor", DISPID_BACKCOLOR, CLSID_StockColorPage, VT_UI4)
#endif
#ifndef _WIN32_WCE
PROP_ENTRY_TYPE("FillColor", DISPID_FILLCOLOR, CLSID_StockColorPage, VT_UI4)
#endif
#ifndef _WIN32_WCE
PROP_ENTRY_TYPE("ForeColor", DISPID_FORECOLOR, CLSID_StockColorPage, VT_UI4)
#endif
PROP_ENTRY_TYPE("Text", DISPID_TEXT, CLSID_NULL, VT_BSTR)
// Example entries
// PROP_ENTRY_TYPE("Property Name", dispid, clsid, vtType)
// PROP_PAGE(CLSID_StockColorPage)
END_PROP_MAP()
BEGIN_MSG_MAP(CValidationResultControl)
CHAIN_MSG_MAP(CComCompositeControl<CValidationResultControl>)
END_MSG_MAP()
// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
BEGIN_SINK_MAP(CValidationResultControl)
//Make sure the Event Handlers have __stdcall calling convention
END_SINK_MAP()
STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
{
if (dispid == DISPID_AMBIENT_BACKCOLOR)
{
SetBackgroundColorFromAmbient();
FireViewChange();
}
return IOleControlImpl<CValidationResultControl>::OnAmbientPropertyChange(dispid);
}
// IViewObjectEx
DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
// IValidationResultControl
OLE_COLOR m_clrBackColor;
void OnBackColorChanged()
{
ATLTRACE(_T("OnBackColorChanged\n"));
}
OLE_COLOR m_clrFillColor;
void OnFillColorChanged()
{
ATLTRACE(_T("OnFillColorChanged\n"));
}
OLE_COLOR m_clrForeColor;
void OnForeColorChanged()
{
ATLTRACE(_T("OnForeColorChanged\n"));
}
CComBSTR m_bstrText;
void OnTextChanged()
{
ATLTRACE(_T("OnTextChanged\n"));
}
enum { IDD = IDD_VALIDATIONRESULTCONTROL };
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
STDMETHOD(GetControlInfo)(CONTROLINFO* pCI);
};
OBJECT_ENTRY_AUTO(__uuidof(ValidationResultControl), CValidationResultControl)