soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SWndAccessible.h
1#ifndef __SWNDACCESSIBLE__H__
2#define __SWNDACCESSIBLE__H__
3
4#ifdef SOUI_ENABLE_ACC
5#include <oleacc.h>
6#include <helper/SUnknown.h>
7#include "Swnd.h"
8#include "interface/sacchelper-i.h"
9
10SNSBEGIN
11
12/**
13 * @class SAccessible
14 * @brief Accessibility support for DUI windows.
15 *
16 * This class provides accessibility support for DUI windows by implementing the IAccessible and IAccHelper interfaces.
17 * It allows screen readers and other assistive technologies to interact with the windows.
18 */
19class SOUI_EXP SAccessible
20 : public IAccessible
21 , public IAccHelper
22 , public SUnknown {
23 protected:
24 SWindow *m_pWnd; // Pointer to the associated SWindow.
25
26 public:
27 /**
28 * @brief Constructor.
29 * @param pWnd Pointer to the SWindow to provide accessibility support for.
30 */
31 SAccessible(IWindow *pWnd);
32
33 /**
34 * @brief Destructor.
35 */
36 ~SAccessible();
37
38 protected:
39 /**
40 * @brief Validates the navigation start point.
41 * @param pvar Pointer to the VARIANT containing the navigation start point.
42 * @return TRUE if the navigation start point is valid, FALSE otherwise.
43 */
44 BOOL accValidateNavStart(VARIANT *pvar) const;
45
46 public:
47 // Implement IAccHelper
48 /**
49 * @brief Sets the owner window for accessibility.
50 * @param pOwner Pointer to the owner window.
51 */
52 STDMETHOD_(void, SetOwner)(THIS_ IWindow *pOwner) OVERRIDE
53 {
54 m_pWnd = (SWindow *)pOwner;
55 }
56
57 /**
58 * @brief Gets the owner window for accessibility.
59 * @return Pointer to the owner window.
60 */
61 STDMETHOD_(IWindow *, GetOwner)(CTHIS) SCONST OVERRIDE
62 {
63 return m_pWnd;
64 }
65
66 // Implement IAccessible
67 /**
68 * @brief Retrieves the parent of the accessible object.
69 * @param ppdispParent Pointer to receive the parent IDispatch.
70 * @return HRESULT indicating success or failure.
71 */
72 STDMETHODIMP get_accParent(IDispatch **ppdispParent);
73
74 /**
75 * @brief Retrieves the number of child objects.
76 * @param pcountChildren Pointer to receive the count of child objects.
77 * @return HRESULT indicating success or failure.
78 */
79 STDMETHODIMP get_accChildCount(long *pcountChildren);
80
81 /**
82 * @brief Retrieves a child object.
83 * @param varChild Child object identifier.
84 * @param ppdispChild Pointer to receive the child IDispatch.
85 * @return HRESULT indicating success or failure.
86 */
87 STDMETHODIMP get_accChild(VARIANT varChild, IDispatch **ppdispChild);
88
89 /**
90 * @brief Retrieves the name of the specified object.
91 * @param varChild Object identifier.
92 * @param pszName Pointer to receive the name.
93 * @return HRESULT indicating success or failure.
94 */
95 STDMETHODIMP get_accName(VARIANT varChild, BSTR *pszName);
96
97 /**
98 * @brief Retrieves the value of the specified object.
99 * @param varChild Object identifier.
100 * @param pszValue Pointer to receive the value.
101 * @return HRESULT indicating success or failure.
102 */
103 STDMETHODIMP get_accValue(VARIANT varChild, BSTR *pszValue);
104
105 /**
106 * @brief Retrieves the description of the specified object.
107 * @param varChild Object identifier.
108 * @param pszDescription Pointer to receive the description.
109 * @return HRESULT indicating success or failure.
110 */
111 STDMETHODIMP get_accDescription(VARIANT varChild, BSTR *pszDescription);
112
113 /**
114 * @brief Retrieves the role of the specified object.
115 * @param varChild Object identifier.
116 * @param pvarRole Pointer to receive the role.
117 * @return HRESULT indicating success or failure.
118 */
119 STDMETHODIMP get_accRole(VARIANT varChild, VARIANT *pvarRole);
120
121 /**
122 * @brief Retrieves the state of the specified object.
123 * @param varChild Object identifier.
124 * @param pvarState Pointer to receive the state.
125 * @return HRESULT indicating success or failure.
126 */
127 STDMETHODIMP get_accState(VARIANT varChild, VARIANT *pvarState);
128
129 /**
130 * @brief Retrieves the help string for the specified object.
131 * @param varChild Object identifier.
132 * @param pszHelp Pointer to receive the help string.
133 * @return HRESULT indicating success or failure.
134 */
135 STDMETHODIMP get_accHelp(VARIANT varChild, BSTR *pszHelp);
136
137 /**
138 * @brief Retrieves the help topic for the specified object.
139 * @param pszHelpFile Pointer to receive the help file path.
140 * @param varChild Object identifier.
141 * @param pidTopic Pointer to receive the help topic ID.
142 * @return HRESULT indicating success or failure.
143 */
144 STDMETHODIMP get_accHelpTopic(BSTR *pszHelpFile, VARIANT varChild, long *pidTopic);
145
146 /**
147 * @brief Retrieves the keyboard shortcut for the specified object.
148 * @param varChild Object identifier.
149 * @param pszKeyboardShortcut Pointer to receive the keyboard shortcut.
150 * @return HRESULT indicating success or failure.
151 */
152 STDMETHODIMP get_accKeyboardShortcut(VARIANT varChild, BSTR *pszKeyboardShortcut);
153
154 /**
155 * @brief Retrieves the currently focused object.
156 * @param pvarChild Pointer to receive the focused object identifier.
157 * @return HRESULT indicating success or failure.
158 */
159 STDMETHODIMP get_accFocus(VARIANT *pvarChild);
160
161 /**
162 * @brief Retrieves the currently selected objects.
163 * @param pvarChildren Pointer to receive the selected object identifiers.
164 * @return HRESULT indicating success or failure.
165 */
166 STDMETHODIMP get_accSelection(VARIANT *pvarChildren);
167
168 /**
169 * @brief Retrieves the default action for the specified object.
170 * @param varChild Object identifier.
171 * @param pszDefaultAction Pointer to receive the default action.
172 * @return HRESULT indicating success or failure.
173 */
174 STDMETHODIMP get_accDefaultAction(VARIANT varChild, BSTR *pszDefaultAction);
175
176 /**
177 * @brief Selects the specified object.
178 * @param flagsSelect Selection flags.
179 * @param varChild Object identifier.
180 * @return HRESULT indicating success or failure.
181 */
182 STDMETHODIMP accSelect(long flagsSelect, VARIANT varChild);
183
184 /**
185 * @brief Retrieves the location of the specified object.
186 * @param pxLeft Pointer to receive the left coordinate.
187 * @param pyTop Pointer to receive the top coordinate.
188 * @param pcxWidth Pointer to receive the width.
189 * @param pcyHeight Pointer to receive the height.
190 * @param varChild Object identifier.
191 * @return HRESULT indicating success or failure.
192 */
193 STDMETHODIMP accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild);
194
195 /**
196 * @brief Navigates to another object in the specified direction.
197 * @param navDir Navigation direction.
198 * @param varStart Starting object identifier.
199 * @param pvarEndUpAt Pointer to receive the object identifier at the end of navigation.
200 * @return HRESULT indicating success or failure.
201 */
202 STDMETHODIMP accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEndUpAt);
203
204 /**
205 * @brief Retrieves the object at the specified screen coordinates.
206 * @param xLeft X coordinate.
207 * @param yTop Y coordinate.
208 * @param pvarChild Pointer to receive the object identifier.
209 * @return HRESULT indicating success or failure.
210 */
211 STDMETHODIMP accHitTest(long xLeft, long yTop, VARIANT *pvarChild);
212
213 /**
214 * @brief Performs the default action for the specified object.
215 * @param varChild Object identifier.
216 * @return HRESULT indicating success or failure.
217 */
218 STDMETHODIMP accDoDefaultAction(VARIANT varChild);
219
220 /**
221 * @brief Sets the name of the specified object.
222 * @param varChild Object identifier.
223 * @param szName New name for the object.
224 * @return HRESULT indicating success or failure.
225 */
226 STDMETHODIMP put_accName(VARIANT varChild, BSTR szName);
227
228 /**
229 * @brief Sets the value of the specified object.
230 * @param varChild Object identifier.
231 * @param szValue New value for the object.
232 * @return HRESULT indicating success or failure.
233 */
234 STDMETHODIMP put_accValue(VARIANT varChild, BSTR szValue);
235
236 // Implement IDispatch
237 /**
238 * @brief Retrieves the number of type information interfaces that an object provides.
239 * @param pctinfo Pointer to receive the count of type information interfaces.
240 * @return HRESULT indicating success or failure.
241 */
242 STDMETHODIMP GetTypeInfoCount(unsigned int FAR *pctinfo);
243
244 /**
245 * @brief Retrieves the type information for an object.
246 * @param iTInfo Type information index.
247 * @param lcid Locale identifier.
248 * @param ppTInfo Pointer to receive the type information.
249 * @return HRESULT indicating success or failure.
250 */
251 STDMETHODIMP GetTypeInfo(unsigned int iTInfo, LCID lcid, ITypeInfo FAR *FAR *ppTInfo);
252
253 /**
254 * @brief Maps a set of names to a corresponding set of dispatch identifiers.
255 * @param riid Interface identifier.
256 * @param rgszNames Array of names to map.
257 * @param cNames Count of names to map.
258 * @param lcid Locale identifier.
259 * @param rgDispId Array of dispatch identifiers.
260 * @return HRESULT indicating success or failure.
261 */
262 STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR FAR *FAR *rgszNames, unsigned int cNames, LCID lcid, DISPID FAR *rgDispId);
263
264 /**
265 * @brief Provides access to properties and methods exposed by an object.
266 * @param dispIdMember Dispatch identifier.
267 * @param riid Interface identifier.
268 * @param lcid Locale identifier.
269 * @param wFlags Flags specifying the context of the call.
270 * @param pDispParams Pointer to a structure containing an array of arguments.
271 * @param pVarResult Pointer to receive the result.
272 * @param pExcepInfo Pointer to receive exception information.
273 * @param puArgErr Pointer to receive the index of the first argument with an error.
274 * @return HRESULT indicating success or failure.
275 */
276 STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pDispParams, VARIANT FAR *pVarResult, EXCEPINFO FAR *pExcepInfo, unsigned int FAR *puArgErr);
277
278 public:
279 IUNKNOWN_BEGIN(IAccessible)
280 IUNKNOWN_ADD_IID(IAccHelper)
281 IUNKNOWN_ADD_IID(IDispatch)
282 IUNKNOWN_END()
283};
284
285SNSEND
286
287#endif // SOUI_ENABLE_ACC
288
289#endif // __SWNDACCESSIBLE__H__
SOUI基础DUI窗口模块