soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SActiveX.h
1#ifndef __SACTIVEX__H__
2#define __SACTIVEX__H__
3
4#include "core/SWnd.h"
5#include <mshtmhst.h>
6
7SNSBEGIN
8
9class SAxContainerImpl;
10
11/**
12 * @class SActiveX
13 * @brief Class for embedding ActiveX controls in SUI windows.
14 * @details This class provides the functionality to embed and manage ActiveX controls within SUI windows.
15 * It handles the creation, activation, and rendering of ActiveX controls.
16 */
17class SOUI_EXP SActiveX : public SWindow {
18 friend class SAxContainerImpl;
19 DEF_SOBJECT(SWindow, L"activex")
20 public:
21 /**
22 * @brief Default constructor.
23 */
24 explicit SActiveX();
25
26 /**
27 * @brief Destructor.
28 */
29 virtual ~SActiveX();
30
31 /**
32 * @brief Retrieves the IUnknown interface of the ActiveX control.
33 * @return Pointer to the IUnknown interface.
34 */
35 IUnknown *GetIUnknown();
36
37 protected:
38 /**
39 * @brief Called when the ActiveX control is activated.
40 * @param pUnknwn Pointer to the IUnknown interface of the ActiveX control.
41 */
42 virtual void OnAxActivate(IUnknown *pUnknwn)
43 {
44 }
45
46 /**
47 * @brief Called when the window is created.
48 * @param lp Creation parameters.
49 * @return Result of the creation process.
50 */
51 int OnCreate(LPVOID lp);
52
53 /**
54 * @brief Called when the window size changes.
55 * @param nType Type of size change.
56 * @param size New size of the window.
57 */
58 void OnSize(UINT nType, CSize size);
59
60 /**
61 * @brief Called when the window needs to be painted.
62 * @param pRT Pointer to the rendering target.
63 */
65
66 /**
67 * @brief Called when a mouse event occurs.
68 * @param uMsg Message identifier.
69 * @param wp WPARAM value.
70 * @param lp LPARAM value.
71 * @return Result of the message processing.
72 */
73 LRESULT OnMouseEvent(UINT uMsg, WPARAM wp, LPARAM lp);
74
75 /**
76 * @brief Called when a keyboard event occurs.
77 * @param uMsg Message identifier.
78 * @param wp WPARAM value.
79 * @param lp LPARAM value.
80 * @return Result of the message processing.
81 */
82 LRESULT OnKeyEvent(UINT uMsg, WPARAM wp, LPARAM lp);
83
84 /**
85 * @brief Called when the window is shown or hidden.
86 * @param bShow TRUE if the window is being shown, FALSE if hidden.
87 * @param nStatus Status of the show operation.
88 */
89 void OnShowWindow(BOOL bShow, UINT nStatus);
90
91 /**
92 * @brief Retrieves the dialog code for the window.
93 * @return Dialog code indicating the type of input the window wants.
94 */
95 virtual UINT WINAPI OnGetDlgCode() const OVERRIDE
96 {
97 return SC_WANTALLKEYS;
98 }
99
100 /**
101 * @brief Checks if the window can receive focus.
102 * @return TRUE if the window can receive focus, FALSE otherwise.
103 */
104 virtual BOOL WINAPI IsFocusable() const OVERRIDE
105 {
106 return TRUE;
107 }
108
109 /**
110 * @brief Handles the "clsID" attribute.
111 * @param strValue The CLSID value as a string.
112 * @param bLoading TRUE if the attribute is being loaded, FALSE otherwise.
113 * @return HRESULT indicating success or failure.
114 */
115 HRESULT OnAttrClsid(const SStringW &strValue, BOOL bLoading);
116
117 SOUI_MSG_MAP_BEGIN()
118 MSG_WM_PAINT_EX(OnPaint)
119 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseEvent)
120 MESSAGE_RANGE_HANDLER_EX(WM_KEYFIRST, WM_KEYLAST, OnKeyEvent)
121 MSG_WM_CREATE(OnCreate)
122 MSG_WM_SIZE(OnSize)
123 MSG_WM_SHOWWINDOW(OnShowWindow)
124 SOUI_MSG_MAP_END()
125
126 SOUI_ATTRS_BEGIN()
127 ATTR_CUSTOM(L"clsID", OnAttrClsid)
128 ATTR_DWORD(L"clsCtx", m_clsCtx, FALSE)
129 ATTR_UINT(L"delay", m_bDelayInit, FALSE)
130 SOUI_ATTRS_END()
131
132 /**
133 * @brief Called when the initialization of the ActiveX control is finished.
134 */
136 {
137 }
138
139 /**
140 * @brief Initializes the ActiveX control.
141 * @return TRUE if initialization is successful, FALSE otherwise.
142 */
144
145 /**
146 * @brief Sets the visibility of the ActiveX control.
147 * @param bVisible TRUE to make the control visible, FALSE to hide it.
148 */
149 void SetActiveXVisible(BOOL bVisible);
150
151 /**
152 * @brief Sets the external UI handler for the ActiveX control.
153 * @param pUiHandler Pointer to the IDocHostUIHandler interface.
154 */
155 void SetExternalUIHandler(IDocHostUIHandler *pUiHandler);
156
157 protected:
158 /**
159 * @brief Pointer to the internal ActiveX container implementation.
160 */
161 SAxContainerImpl *m_axContainer;
162
163 /**
164 * @brief CLSID of the ActiveX control.
165 */
166 CLSID m_clsid;
167
168 /**
169 * @brief Context in which the ActiveX control should be created.
170 */
171 DWORD m_clsCtx;
172
173 /**
174 * @brief Flag indicating whether the initialization of the ActiveX control should be delayed.
175 */
177};
178
179SNSEND
180
181#endif // __SACTIVEX__H__
SOUI基础DUI窗口模块
SActiveX()
Default constructor.
int OnCreate(LPVOID lp)
Called when the window is created.
LRESULT OnMouseEvent(UINT uMsg, WPARAM wp, LPARAM lp)
Called when a mouse event occurs.
BOOL m_bDelayInit
Flag indicating whether the initialization of the ActiveX control should be delayed.
Definition SActiveX.h:176
LRESULT OnKeyEvent(UINT uMsg, WPARAM wp, LPARAM lp)
Called when a keyboard event occurs.
CLSID m_clsid
CLSID of the ActiveX control.
Definition SActiveX.h:166
virtual UINT WINAPI OnGetDlgCode() const OVERRIDE
Retrieves the dialog code for the window.
Definition SActiveX.h:95
void OnShowWindow(BOOL bShow, UINT nStatus)
Called when the window is shown or hidden.
HRESULT OnAttrClsid(const SStringW &strValue, BOOL bLoading)
Handles the "clsID" attribute.
virtual ~SActiveX()
Destructor.
virtual BOOL WINAPI IsFocusable() const OVERRIDE
Checks if the window can receive focus.
Definition SActiveX.h:104
void OnPaint(IRenderTarget *pRT)
Called when the window needs to be painted.
virtual void OnAxActivate(IUnknown *pUnknwn)
Called when the ActiveX control is activated.
Definition SActiveX.h:42
virtual void OnInitActiveXFinished()
Called when the initialization of the ActiveX control is finished.
Definition SActiveX.h:135
void OnSize(UINT nType, CSize size)
Called when the window size changes.
void SetExternalUIHandler(IDocHostUIHandler *pUiHandler)
Sets the external UI handler for the ActiveX control.
IUnknown * GetIUnknown()
Retrieves the IUnknown interface of the ActiveX control.
void SetActiveXVisible(BOOL bVisible)
Sets the visibility of the ActiveX control.
DWORD m_clsCtx
Context in which the ActiveX control should be created.
Definition SActiveX.h:171
BOOL InitActiveX()
Initializes the ActiveX control.
SAxContainerImpl * m_axContainer
Pointer to the internal ActiveX container implementation.
Definition SActiveX.h:161
A class representing an ASCII string.
Definition sstringw.h:96
SWindow()
Constructor.
Definition Swnd.cpp:104
Interface for rendering target objects.
Definition SRender-i.h:1440