1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/ole/access.cpp
3 // Purpose: implementation of wxIAccessible and wxAccessible
4 // Author: Julian Smart
8 // Copyright: (c) 2003 Julian Smart
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "access.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
27 #if defined(__BORLANDC__)
31 #include "wx/window.h"
36 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
39 #include "wx/access.h"
43 // for some compilers, the entire ole2.h must be included, not only oleauto.h
44 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
52 #include "wx/msw/ole/oleutils.h"
55 #define CHILDID_SELF 0
59 #define OBJID_CLIENT 0xFFFFFFFC
62 // Convert to Windows role
63 int wxConvertToWindowsRole(wxAccRole wxrole
);
65 // Convert to Windows state
66 long wxConvertToWindowsState(long wxstate
);
68 // Convert to Windows selection flag
69 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel
);
71 // Convert from Windows selection flag
72 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
);
74 // ----------------------------------------------------------------------------
75 // wxIEnumVARIANT interface implementation
76 // ----------------------------------------------------------------------------
78 class wxIEnumVARIANT
: public IEnumVARIANT
81 wxIEnumVARIANT(const wxVariant
& variant
);
84 DECLARE_IUNKNOWN_METHODS
;
87 STDMETHODIMP
Next(ULONG celt
, VARIANT
*rgelt
, ULONG
*pceltFetched
);
88 STDMETHODIMP
Skip(ULONG celt
);
90 STDMETHODIMP
Clone(IEnumVARIANT
**ppenum
);
93 wxVariant m_variant
; // List of further variants
94 int m_nCurrent
; // Current enum position
96 DECLARE_NO_COPY_CLASS(wxIEnumVARIANT
)
99 // ----------------------------------------------------------------------------
101 // ----------------------------------------------------------------------------
103 BEGIN_IID_TABLE(wxIEnumVARIANT
)
108 IMPLEMENT_IUNKNOWN_METHODS(wxIEnumVARIANT
)
110 // wxVariant contains a list of further variants.
111 wxIEnumVARIANT::wxIEnumVARIANT(const wxVariant
& variant
)
116 STDMETHODIMP
wxIEnumVARIANT::Next(ULONG celt
,
120 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Next"));
123 // we only return 1 element at a time - mainly because I'm too lazy to
124 // implement something which you're never asked for anyhow
128 if (m_variant
.GetType() != wxT("list"))
131 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() ) {
132 if (!wxConvertVariantToOle(m_variant
[m_nCurrent
++], rgelt
[0]))
137 // TODO: should we AddRef if this is an object?
148 STDMETHODIMP
wxIEnumVARIANT::Skip(ULONG celt
)
150 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Skip"));
152 if (m_variant
.GetType() != wxT("list"))
156 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() )
159 // no, can't skip this many elements
165 STDMETHODIMP
wxIEnumVARIANT::Reset()
167 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Reset"));
174 STDMETHODIMP
wxIEnumVARIANT::Clone(IEnumVARIANT
**ppenum
)
176 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Clone"));
178 wxIEnumVARIANT
*pNew
= new wxIEnumVARIANT(m_variant
);
186 // ----------------------------------------------------------------------------
187 // wxIAccessible implementation of IAccessible interface
188 // ----------------------------------------------------------------------------
190 class wxIAccessible
: public IAccessible
193 wxIAccessible(wxAccessible
*pAccessible
);
195 DECLARE_IUNKNOWN_METHODS
;
199 // Navigation and Hierarchy
201 // Retrieves the child element or child object at a given point on the screen.
202 // All visual objects support this method; sound objects do not support it.
204 STDMETHODIMP
accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
);
206 // Retrieves the specified object's current screen location. All visual objects must
207 // support this method; sound objects do not support it.
209 STDMETHODIMP
accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
);
211 // Traverses to another user interface element within a container and retrieves the object.
212 // All visual objects must support this method.
214 STDMETHODIMP
accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
);
216 // Retrieves the address of an IDispatch interface for the specified child.
217 // All objects must support this property.
219 STDMETHODIMP
get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
);
221 // Retrieves the number of children that belong to this object.
222 // All objects must support this property.
224 STDMETHODIMP
get_accChildCount ( long* pCountChildren
);
226 // Retrieves the IDispatch interface of the object's parent.
227 // All objects support this property.
229 STDMETHODIMP
get_accParent ( IDispatch
** ppDispParent
);
231 // Descriptive Properties and Methods
233 // Performs the object's default action. Not all objects have a default
236 STDMETHODIMP
accDoDefaultAction(VARIANT varID
);
238 // Retrieves a string that describes the object's default action.
239 // Not all objects have a default action.
241 STDMETHODIMP
get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
);
243 // Retrieves a string that describes the visual appearance of the specified object.
244 // Not all objects have a description.
246 STDMETHODIMP
get_accDescription ( VARIANT varID
, BSTR
* pszDescription
);
248 // Retrieves an object's Help property string.
249 // Not all objects support this property.
251 STDMETHODIMP
get_accHelp ( VARIANT varID
, BSTR
* pszHelp
);
253 // Retrieves the full path of the WinHelp file associated with the specified
254 // object and the identifier of the appropriate topic within that file.
255 // Not all objects support this property.
257 STDMETHODIMP
get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
);
259 // Retrieves the specified object's shortcut key or access key, also known as
260 // the mnemonic. All objects that have a shortcut key or access key support
263 STDMETHODIMP
get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
);
265 // Retrieves the name of the specified object.
266 // All objects support this property.
268 STDMETHODIMP
get_accName ( VARIANT varID
, BSTR
* pszName
);
270 // Retrieves information that describes the role of the specified object.
271 // All objects support this property.
273 STDMETHODIMP
get_accRole ( VARIANT varID
, VARIANT
* pVarRole
);
275 // Retrieves the current state of the specified object.
276 // All objects support this property.
278 STDMETHODIMP
get_accState ( VARIANT varID
, VARIANT
* pVarState
);
280 // Retrieves the value of the specified object.
281 // Not all objects have a value.
283 STDMETHODIMP
get_accValue ( VARIANT varID
, BSTR
* pszValue
);
285 // Selection and Focus
287 // Modifies the selection or moves the keyboard focus of the
288 // specified object. All objects that select or receive the
289 // keyboard focus must support this method.
291 STDMETHODIMP
accSelect ( long flagsSelect
, VARIANT varID
);
293 // Retrieves the object that has the keyboard focus. All objects
294 // that receive the keyboard focus must support this property.
296 STDMETHODIMP
get_accFocus ( VARIANT
* pVarID
);
298 // Retrieves the selected children of this object. All objects
299 // selected must support this property.
301 STDMETHODIMP
get_accSelection ( VARIANT
* pVarChildren
);
305 STDMETHODIMP
put_accName(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
306 STDMETHODIMP
put_accValue(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
312 STDMETHODIMP
GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
);
314 // Get type info count
316 STDMETHODIMP
GetTypeInfoCount(unsigned int* typeInfoCount
);
320 STDMETHODIMP
GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
321 LCID lcid
, DISPID
* dispId
);
325 STDMETHODIMP
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
326 WORD wFlags
, DISPPARAMS
*pDispParams
,
327 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
328 unsigned int *puArgErr
);
332 // Gets the standard IAccessible interface for the given child or object.
333 // Call Release if this is non-NULL.
334 IAccessible
* GetChildStdAccessible(int id
);
336 // Gets the IAccessible interface for the given child or object.
337 // Call Release if this is non-NULL.
338 IAccessible
* GetChildAccessible(int id
);
341 wxAccessible
*m_pAccessible
; // pointer to C++ class we belong to
343 DECLARE_NO_COPY_CLASS(wxIAccessible
)
346 // ============================================================================
348 // ============================================================================
350 // ----------------------------------------------------------------------------
351 // wxIAccessible implementation
352 // ----------------------------------------------------------------------------
353 BEGIN_IID_TABLE(wxIAccessible
)
359 IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible
)
361 wxIAccessible::wxIAccessible(wxAccessible
*pAccessible
)
363 wxASSERT( pAccessible
!= NULL
);
365 m_pAccessible
= pAccessible
;
368 // Retrieves the child element or child object at a given point on the screen.
369 // All visual objects support this method; sound objects do not support it.
371 STDMETHODIMP
wxIAccessible::accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
)
373 wxLogDebug("accHitTest");
374 wxASSERT (m_pAccessible
!= NULL
);
378 wxAccessible
* childObject
= NULL
;
382 wxAccStatus status
= m_pAccessible
->HitTest(wxPoint(xLeft
, yLeft
), & childId
, & childObject
);
384 if (status
== wxACC_FAIL
)
387 if (status
== wxACC_NOT_IMPLEMENTED
)
389 // Use standard interface instead.
390 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
394 return stdInterface
->accHitTest(xLeft
, yLeft
, pVarID
);
399 if (childObject
== m_pAccessible
)
402 pVarID
->lVal
= CHILDID_SELF
;
407 wxIAccessible
* childIA
= childObject
->GetIAccessible();
411 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
414 pVarID
->vt
= VT_DISPATCH
;
418 else if (childId
> 0)
421 pVarID
->lVal
= childId
;
426 pVarID
->vt
= VT_EMPTY
;
433 // Retrieves the specified object's current screen location. All visual objects must
434 // support this method; sound objects do not support it.
436 STDMETHODIMP
wxIAccessible::accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
)
438 wxLogDebug("accLocation");
439 wxASSERT (m_pAccessible
!= NULL
);
445 wxAccStatus status
= m_pAccessible
->GetLocation(rect
, varID
.lVal
);
446 if (status
== wxACC_FAIL
)
449 if (status
== wxACC_NOT_IMPLEMENTED
)
451 // Try to use child object directly.
454 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
458 HRESULT hResult
= childAccessible
->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
459 childAccessible
->Release();
462 else if (m_pAccessible
->GetIAccessibleStd())
463 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
465 else if (m_pAccessible
->GetIAccessibleStd())
466 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
472 *pcxWidth
= rect
.width
;
473 *pcyHeight
= rect
.height
;
480 // Traverses to another user interface element within a container and retrieves the object.
481 // All visual objects must support this method.
483 STDMETHODIMP
wxIAccessible::accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
)
485 wxASSERT (m_pAccessible
!= NULL
);
488 wxLogDebug(wxString(wxT("accNavigate for ")) + m_pAccessible
->GetWindow()->GetClassInfo()->GetClassName());
490 if ((varStart
.vt
!= VT_I4
&& varStart
.vt
!= VT_EMPTY
) || varStart
.vt
< 0)
492 wxLogDebug("Invalid arg for accNavigate");
496 wxAccessible
* elementObject
= NULL
;
498 VariantInit(pVarEnd
);
499 wxNavDir navDirWX
= wxNAVDIR_FIRSTCHILD
;
506 navDirWX
= wxNAVDIR_DOWN
;
507 navStr
= wxT("wxNAVDIR_DOWN");
510 case NAVDIR_FIRSTCHILD
:
511 navDirWX
= wxNAVDIR_FIRSTCHILD
;
512 navStr
= wxT("wxNAVDIR_FIRSTCHILD");
515 case NAVDIR_LASTCHILD
:
516 navDirWX
= wxNAVDIR_LASTCHILD
;
517 navStr
= wxT("wxNAVDIR_LASTCHILD");
521 navDirWX
= wxNAVDIR_LEFT
;
522 navStr
= wxT("wxNAVDIR_LEFT");
526 navDirWX
= wxNAVDIR_NEXT
;
527 navStr
= wxT("wxNAVDIR_NEXT");
530 case NAVDIR_PREVIOUS
:
531 navDirWX
= wxNAVDIR_PREVIOUS
;
532 navStr
= wxT("wxNAVDIR_PREVIOUS");
536 navDirWX
= wxNAVDIR_RIGHT
;
537 navStr
= wxT("wxNAVDIR_RIGHT");
541 navDirWX
= wxNAVDIR_UP
;
542 navStr
= wxT("wxNAVDIR_UP");
546 wxLogDebug(wxT("Unknown NAVDIR symbol"));
552 wxAccStatus status
= m_pAccessible
->Navigate(navDirWX
, varStart
.lVal
, & elementId
,
555 if (status
== wxACC_FAIL
)
557 wxLogDebug("wxAccessible::Navigate failed");
561 if (status
== wxACC_FALSE
)
563 wxLogDebug("wxAccessible::Navigate found no object in this direction");
567 if (status
== wxACC_NOT_IMPLEMENTED
)
569 wxLogDebug("Navigate not implemented");
571 // Try to use child object directly.
572 if (varStart
.vt
== VT_I4
&& varStart
.lVal
> 0)
574 IAccessible
* childAccessible
= GetChildAccessible(varStart
.lVal
);
578 HRESULT hResult
= childAccessible
->accNavigate(navDir
, varStart
, pVarEnd
);
579 childAccessible
->Release();
582 else if (m_pAccessible
->GetIAccessibleStd())
583 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
585 else if (m_pAccessible
->GetIAccessibleStd())
586 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
592 wxLogDebug("Getting wxIAccessible and calling QueryInterface for Navigate");
593 wxIAccessible
* objectIA
= elementObject
->GetIAccessible();
596 wxLogDebug("No wxIAccessible");
600 HRESULT hResult
= objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarEnd
->pdispVal
);
603 wxLogDebug("QueryInterface failed");
607 wxLogDebug("Called QueryInterface for Navigate");
608 pVarEnd
->vt
= VT_DISPATCH
;
611 else if (elementId
> 0)
613 wxLogDebug("Returning element id from Navigate");
615 pVarEnd
->lVal
= elementId
;
620 wxLogDebug("No object in accNavigate");
621 pVarEnd
->vt
= VT_EMPTY
;
626 wxLogDebug("Failing Navigate");
630 // Retrieves the address of an IDispatch interface for the specified child.
631 // All objects must support this property.
633 STDMETHODIMP
wxIAccessible::get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
)
635 wxLogDebug("get_accChild");
636 wxASSERT (m_pAccessible
!= NULL
);
640 if (varChildID
.vt
!= VT_I4
)
642 wxLogDebug("Invalid arg for get_accChild");
646 if (varChildID
.lVal
== CHILDID_SELF
)
653 wxAccessible
* child
= NULL
;
655 wxAccStatus status
= m_pAccessible
->GetChild(varChildID
.lVal
, & child
);
656 if (status
== wxACC_FAIL
)
658 wxLogDebug("GetChild failed");
662 if (status
== wxACC_NOT_IMPLEMENTED
)
664 // Use standard interface instead.
665 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
670 wxLogDebug("Using standard interface for get_accChild");
671 return stdInterface
->get_accChild (varChildID
, ppDispChild
);
678 wxIAccessible
* objectIA
= child
->GetIAccessible();
682 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispChild
) != S_OK
)
684 wxLogDebug("QueryInterface failed in get_accChild");
692 wxLogDebug("Not an accessible object");
693 return S_FALSE
; // Indicates it's not an accessible object
700 // Retrieves the number of children that belong to this object.
701 // All objects must support this property.
703 STDMETHODIMP
wxIAccessible::get_accChildCount ( long* pCountChildren
)
705 wxLogDebug("get_accChildCount");
706 wxASSERT (m_pAccessible
!= NULL
);
711 wxAccStatus status
= m_pAccessible
->GetChildCount(& childCount
);
712 if (status
== wxACC_FAIL
)
715 if (status
== wxACC_NOT_IMPLEMENTED
)
717 // Use standard interface instead.
718 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
723 wxLogDebug("Using standard interface for get_accChildCount");
724 HRESULT res
= stdInterface
->get_accChildCount (pCountChildren
);
726 str
.Printf(wxT("Number of children was %d"), (int) (*pCountChildren
));
733 * pCountChildren
= (long) childCount
;
740 // Retrieves the IDispatch interface of the object's parent.
741 // All objects support this property.
743 STDMETHODIMP
wxIAccessible::get_accParent ( IDispatch
** ppDispParent
)
745 wxLogDebug("get_accParent");
746 wxASSERT (m_pAccessible
!= NULL
);
750 wxAccessible
* parent
= NULL
;
751 wxAccStatus status
= m_pAccessible
->GetParent(& parent
);
753 if (status
== wxACC_FAIL
)
756 // It doesn't seem acceptable to return S_FALSE with a NULL
757 // ppDispParent, so if we have no wxWindows parent, we leave
758 // it to the standard interface.
759 if (status
== wxACC_NOT_IMPLEMENTED
|| !parent
)
761 wxLogDebug("Using standard interface to get the parent.");
762 // Use standard interface instead.
763 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
767 return stdInterface
->get_accParent (ppDispParent
);
773 wxIAccessible
* objectIA
= parent
->GetIAccessible();
777 wxLogDebug("About to call QueryInterface");
778 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispParent
) != S_OK
)
780 wxLogDebug("Failed QueryInterface");
784 wxLogDebug("Returning S_OK for get_accParent");
789 // This doesn't seem to be allowed, despite the documentation,
790 // so we handle it higher up by using the standard interface.
791 wxLogDebug("Returning NULL parent because there was none");
792 *ppDispParent
= NULL
;
800 // Performs the object's default action. Not all objects have a default
803 STDMETHODIMP
wxIAccessible::accDoDefaultAction(VARIANT varID
)
805 wxLogDebug("accDoDefaultAction");
806 wxASSERT (m_pAccessible
!= NULL
);
810 if (varID
.vt
!= VT_I4
)
812 wxLogDebug("Invalid arg for accDoDefaultAction");
816 wxAccStatus status
= m_pAccessible
->DoDefaultAction(varID
.lVal
);
817 if (status
== wxACC_FAIL
)
820 if (status
== wxACC_NOT_SUPPORTED
)
821 return DISP_E_MEMBERNOTFOUND
;
823 if (status
== wxACC_NOT_IMPLEMENTED
)
825 // Try to use child object directly.
828 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
832 HRESULT hResult
= childAccessible
->accDoDefaultAction(varID
);
833 childAccessible
->Release();
836 else if (m_pAccessible
->GetIAccessibleStd())
837 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
839 else if (m_pAccessible
->GetIAccessibleStd())
840 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
845 // Retrieves a string that describes the object's default action.
846 // Not all objects have a default action.
848 STDMETHODIMP
wxIAccessible::get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
)
850 wxLogDebug("get_accDefaultAction");
851 wxASSERT (m_pAccessible
!= NULL
);
855 if (varID
.vt
!= VT_I4
)
857 wxLogDebug("Invalid arg for get_accDefaultAction");
861 wxString defaultAction
;
862 wxAccStatus status
= m_pAccessible
->GetDefaultAction(varID
.lVal
, & defaultAction
);
863 if (status
== wxACC_FAIL
)
866 if (status
== wxACC_NOT_SUPPORTED
)
867 return DISP_E_MEMBERNOTFOUND
;
869 if (status
== wxACC_NOT_IMPLEMENTED
)
871 // Try to use child object directly.
874 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
878 HRESULT hResult
= childAccessible
->get_accDefaultAction(varID
, pszDefaultAction
);
879 childAccessible
->Release();
882 else if (m_pAccessible
->GetIAccessibleStd())
883 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
885 else if (m_pAccessible
->GetIAccessibleStd())
886 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
890 if (defaultAction
.IsEmpty())
892 * pszDefaultAction
= NULL
;
897 wxBasicString
basicString(defaultAction
);
898 * pszDefaultAction
= basicString
.Get();
905 // Retrieves a string that describes the visual appearance of the specified object.
906 // Not all objects have a description.
908 STDMETHODIMP
wxIAccessible::get_accDescription ( VARIANT varID
, BSTR
* pszDescription
)
910 wxLogDebug("get_accDescription");
911 wxASSERT (m_pAccessible
!= NULL
);
915 if (varID
.vt
!= VT_I4
)
917 wxLogDebug("Invalid arg for get_accDescription");
921 wxString description
;
922 wxAccStatus status
= m_pAccessible
->GetDescription(varID
.lVal
, & description
);
923 if (status
== wxACC_FAIL
)
926 if (status
== wxACC_NOT_IMPLEMENTED
)
928 // Try to use child object directly.
931 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
935 HRESULT hResult
= childAccessible
->get_accDescription(varID
, pszDescription
);
936 childAccessible
->Release();
939 else if (m_pAccessible
->GetIAccessibleStd())
940 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
942 else if (m_pAccessible
->GetIAccessibleStd())
943 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
947 if (description
.IsEmpty())
949 * pszDescription
= NULL
;
954 wxBasicString
basicString(description
);
955 * pszDescription
= basicString
.Get();
962 // Retrieves an object's Help property string.
963 // Not all objects support this property.
965 STDMETHODIMP
wxIAccessible::get_accHelp ( VARIANT varID
, BSTR
* pszHelp
)
967 wxLogDebug("get_accHelp");
968 wxASSERT (m_pAccessible
!= NULL
);
972 if (varID
.vt
!= VT_I4
)
974 wxLogDebug("Invalid arg for get_accHelp");
979 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & helpString
);
980 if (status
== wxACC_FAIL
)
983 if (status
== wxACC_NOT_IMPLEMENTED
)
985 // Try to use child object directly.
988 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
992 HRESULT hResult
= childAccessible
->get_accHelp(varID
, pszHelp
);
993 childAccessible
->Release();
996 else if (m_pAccessible
->GetIAccessibleStd())
997 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp(varID
, pszHelp
);
999 else if (m_pAccessible
->GetIAccessibleStd())
1000 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp (varID
, pszHelp
);
1004 if (helpString
.IsEmpty())
1011 wxBasicString
basicString(helpString
);
1012 * pszHelp
= basicString
.Get();
1019 // Retrieves the full path of the WinHelp file associated with the specified
1020 // object and the identifier of the appropriate topic within that file.
1021 // Not all objects support this property.
1022 // NOTE: not supported by wxWindows at this time. Use
1023 // GetHelpText instead.
1025 STDMETHODIMP
wxIAccessible::get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
)
1027 wxLogDebug("get_accHelpTopic");
1028 wxASSERT (m_pAccessible
!= NULL
);
1032 if (varChild
.vt
!= VT_I4
)
1034 wxLogDebug("Invalid arg for get_accHelpTopic");
1035 return E_INVALIDARG
;
1038 wxAccStatus status
= wxACC_NOT_IMPLEMENTED
;
1039 if (status
== wxACC_FAIL
)
1042 if (status
== wxACC_NOT_IMPLEMENTED
)
1044 // Try to use child object directly.
1045 if (varChild
.lVal
> 0)
1047 IAccessible
* childAccessible
= GetChildAccessible(varChild
.lVal
);
1048 if (childAccessible
)
1051 HRESULT hResult
= childAccessible
->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1052 childAccessible
->Release();
1055 else if (m_pAccessible
->GetIAccessibleStd())
1056 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1058 else if (m_pAccessible
->GetIAccessibleStd())
1059 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic (pszHelpFile
, varChild
, pidTopic
);
1064 // Retrieves the specified object's shortcut key or access key, also known as
1065 // the mnemonic. All objects that have a shortcut key or access key support
1068 STDMETHODIMP
wxIAccessible::get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
)
1070 wxLogDebug("get_accKeyboardShortcut");
1071 *pszKeyboardShortcut
= NULL
;
1073 wxASSERT (m_pAccessible
!= NULL
);
1077 if (varID
.vt
!= VT_I4
)
1079 wxLogDebug("Invalid arg for get_accKeyboardShortcut");
1080 return E_INVALIDARG
;
1083 wxString keyboardShortcut
;
1084 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & keyboardShortcut
);
1085 if (status
== wxACC_FAIL
)
1088 if (status
== wxACC_NOT_IMPLEMENTED
)
1090 // Try to use child object directly.
1093 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1094 if (childAccessible
)
1097 HRESULT hResult
= childAccessible
->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1098 childAccessible
->Release();
1101 else if (m_pAccessible
->GetIAccessibleStd())
1102 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1104 else if (m_pAccessible
->GetIAccessibleStd())
1105 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut (varID
, pszKeyboardShortcut
);
1109 if (keyboardShortcut
.IsEmpty())
1111 * pszKeyboardShortcut
= NULL
;
1116 wxBasicString
basicString(keyboardShortcut
);
1117 * pszKeyboardShortcut
= basicString
.Get();
1124 // Retrieves the name of the specified object.
1125 // All objects support this property.
1127 STDMETHODIMP
wxIAccessible::get_accName ( VARIANT varID
, BSTR
* pszName
)
1129 wxLogDebug("get_accName");
1132 wxASSERT (m_pAccessible
!= NULL
);
1136 if (varID
.vt
!= VT_I4
)
1138 wxLogDebug("Invalid arg for get_accName");
1139 return E_INVALIDARG
;
1144 wxAccStatus status
= m_pAccessible
->GetName(varID
.lVal
, & name
);
1146 if (status
== wxACC_FAIL
)
1149 if (status
== wxACC_NOT_IMPLEMENTED
)
1151 // Try to use child object directly.
1154 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1155 if (childAccessible
)
1158 HRESULT hResult
= childAccessible
->get_accName(varID
, pszName
);
1159 childAccessible
->Release();
1162 else if (m_pAccessible
->GetIAccessibleStd())
1163 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName(varID
, pszName
);
1165 else if (m_pAccessible
->GetIAccessibleStd())
1166 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName (varID
, pszName
);
1170 wxBasicString
basicString(name
);
1171 *pszName
= basicString
.Get();
1177 // Retrieves information that describes the role of the specified object.
1178 // All objects support this property.
1180 STDMETHODIMP
wxIAccessible::get_accRole ( VARIANT varID
, VARIANT
* pVarRole
)
1182 wxLogDebug("get_accRole");
1183 wxASSERT (m_pAccessible
!= NULL
);
1187 if (varID
.vt
!= VT_I4
)
1189 wxLogDebug("Invalid arg for get_accRole");
1190 return E_INVALIDARG
;
1193 VariantInit(pVarRole
);
1195 wxAccRole role
= wxROLE_NONE
;
1197 wxAccStatus status
= m_pAccessible
->GetRole(varID
.lVal
, & role
);
1199 if (status
== wxACC_FAIL
)
1202 if (status
== wxACC_NOT_IMPLEMENTED
)
1204 // Try to use child object directly.
1207 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1208 if (childAccessible
)
1211 HRESULT hResult
= childAccessible
->get_accRole(varID
, pVarRole
);
1212 childAccessible
->Release();
1215 else if (m_pAccessible
->GetIAccessibleStd())
1216 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole(varID
, pVarRole
);
1218 else if (m_pAccessible
->GetIAccessibleStd())
1219 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole (varID
, pVarRole
);
1223 if (role
== wxROLE_NONE
)
1225 pVarRole
->vt
= VT_EMPTY
;
1229 pVarRole
->lVal
= wxConvertToWindowsRole(role
);
1230 pVarRole
->vt
= VT_I4
;
1237 // Retrieves the current state of the specified object.
1238 // All objects support this property.
1240 STDMETHODIMP
wxIAccessible::get_accState ( VARIANT varID
, VARIANT
* pVarState
)
1242 wxLogDebug("get_accState");
1243 wxASSERT (m_pAccessible
!= NULL
);
1247 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1249 wxLogDebug("Invalid arg for get_accState");
1250 return E_INVALIDARG
;
1255 wxAccStatus status
= m_pAccessible
->GetState(varID
.lVal
, & wxstate
);
1256 if (status
== wxACC_FAIL
)
1259 if (status
== wxACC_NOT_IMPLEMENTED
)
1261 // Try to use child object directly.
1264 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1265 if (childAccessible
)
1268 HRESULT hResult
= childAccessible
->get_accState(varID
, pVarState
);
1269 childAccessible
->Release();
1272 else if (m_pAccessible
->GetIAccessibleStd())
1273 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState(varID
, pVarState
);
1275 else if (m_pAccessible
->GetIAccessibleStd())
1276 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState (varID
, pVarState
);
1280 long state
= wxConvertToWindowsState(wxstate
);
1281 pVarState
->lVal
= state
;
1282 pVarState
->vt
= VT_I4
;
1288 // Retrieves the value of the specified object.
1289 // Not all objects have a value.
1291 STDMETHODIMP
wxIAccessible::get_accValue ( VARIANT varID
, BSTR
* pszValue
)
1293 wxLogDebug("get_accValue");
1294 wxASSERT (m_pAccessible
!= NULL
);
1298 if (varID
.vt
!= VT_I4
)
1300 wxLogDebug("Invalid arg for get_accValue");
1301 return E_INVALIDARG
;
1306 wxAccStatus status
= m_pAccessible
->GetValue(varID
.lVal
, & strValue
);
1308 if (status
== wxACC_FAIL
)
1311 if (status
== wxACC_NOT_IMPLEMENTED
)
1313 // Try to use child object directly.
1316 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1317 if (childAccessible
)
1320 HRESULT hResult
= childAccessible
->get_accValue(varID
, pszValue
);
1321 childAccessible
->Release();
1324 else if (m_pAccessible
->GetIAccessibleStd())
1325 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue(varID
, pszValue
);
1327 else if (m_pAccessible
->GetIAccessibleStd())
1328 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue (varID
, pszValue
);
1332 wxBasicString
basicString(strValue
);
1333 * pszValue
= basicString
.Get();
1339 // Modifies the selection or moves the keyboard focus of the
1340 // specified object. All objects that select or receive the
1341 // keyboard focus must support this method.
1343 STDMETHODIMP
wxIAccessible::accSelect ( long flagsSelect
, VARIANT varID
)
1345 wxLogDebug("get_accSelect");
1346 wxASSERT (m_pAccessible
!= NULL
);
1350 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1352 wxLogDebug("Invalid arg for accSelect");
1353 return E_INVALIDARG
;
1356 wxAccSelectionFlags wxsel
= wxConvertFromWindowsSelFlag(flagsSelect
);
1358 wxAccStatus status
= m_pAccessible
->Select(varID
.lVal
, wxsel
);
1359 if (status
== wxACC_FAIL
)
1362 if (status
== wxACC_NOT_IMPLEMENTED
)
1364 // Try to use child object directly.
1365 if (varID
.lVal
> 0 && varID
.lVal
> 0)
1367 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1368 if (childAccessible
)
1371 HRESULT hResult
= childAccessible
->accSelect(flagsSelect
, varID
);
1372 childAccessible
->Release();
1375 else if (m_pAccessible
->GetIAccessibleStd())
1376 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1378 else if (m_pAccessible
->GetIAccessibleStd())
1379 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1387 // Retrieves the object that has the keyboard focus. All objects
1388 // that receive the keyboard focus must support this property.
1390 STDMETHODIMP
wxIAccessible::get_accFocus ( VARIANT
* pVarID
)
1392 wxLogDebug("get_accFocus");
1393 wxASSERT (m_pAccessible
!= NULL
);
1397 wxAccessible
* childObject
= NULL
;
1399 VariantInit(pVarID
);
1401 wxAccStatus status
= m_pAccessible
->GetFocus(& childId
, & childObject
);
1402 if (status
== wxACC_FAIL
)
1405 if (status
== wxACC_NOT_IMPLEMENTED
)
1407 // Use standard interface instead.
1408 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1412 return stdInterface
->get_accFocus (pVarID
);
1416 if (childObject
== m_pAccessible
)
1419 pVarID
->lVal
= CHILDID_SELF
;
1423 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1427 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
1430 pVarID
->vt
= VT_DISPATCH
;
1434 else if (childId
> 0)
1437 pVarID
->lVal
= childId
;
1442 pVarID
->vt
= VT_EMPTY
;
1449 // Retrieves the selected children of this object. All objects
1450 // selected must support this property.
1452 STDMETHODIMP
wxIAccessible::get_accSelection ( VARIANT
* pVarChildren
)
1454 wxLogDebug("get_accSelection");
1455 wxASSERT (m_pAccessible
!= NULL
);
1459 VariantInit(pVarChildren
);
1461 wxVariant selections
;
1462 wxAccStatus status
= m_pAccessible
->GetSelections(& selections
);
1463 if (status
== wxACC_FAIL
)
1466 if (status
== wxACC_NOT_IMPLEMENTED
)
1468 // Use standard interface instead.
1469 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1473 return stdInterface
->get_accSelection (pVarChildren
);
1477 if (selections
.GetType() == wxT("long"))
1479 pVarChildren
->vt
= VT_I4
;
1480 pVarChildren
->lVal
= selections
.GetLong();
1484 else if (selections
.GetType() == wxT("void*"))
1486 wxAccessible
* childObject
= (wxAccessible
*) selections
.GetVoidPtr();
1487 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1491 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarChildren
->pdispVal
) != S_OK
)
1494 pVarChildren
->vt
= VT_DISPATCH
;
1498 else if (selections
.GetType() == wxT("list"))
1500 // TODO: should we AddRef for every "void*" member??
1502 wxIEnumVARIANT
* enumVariant
= new wxIEnumVARIANT(selections
);
1503 enumVariant
->AddRef();
1505 pVarChildren
->vt
= VT_UNKNOWN
;
1506 pVarChildren
->punkVal
= enumVariant
;
1517 STDMETHODIMP
wxIAccessible::GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
)
1523 // Get type info count
1525 STDMETHODIMP
wxIAccessible::GetTypeInfoCount(unsigned int* typeInfoCount
)
1533 STDMETHODIMP
wxIAccessible::GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
1534 LCID lcid
, DISPID
* dispId
)
1541 STDMETHODIMP
wxIAccessible::Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
1542 WORD wFlags
, DISPPARAMS
*pDispParams
,
1543 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1544 unsigned int *puArgErr
)
1549 // Gets the standard IAccessible interface for the given child or object.
1550 // Call Release if this is non-NULL.
1551 IAccessible
* wxIAccessible::GetChildStdAccessible(int id
)
1555 IAccessible
* obj
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1566 IDispatch
* pDispatch
= NULL
;
1567 if (S_OK
== get_accChild ( var
, & pDispatch
))
1569 IAccessible
* childAccessible
= NULL
;
1570 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1572 pDispatch
->Release();
1573 wxIAccessible
* c
= (wxIAccessible
*) childAccessible
;
1574 IAccessible
* stdChildAccessible
= (IAccessible
*) c
->m_pAccessible
->GetIAccessibleStd();
1575 stdChildAccessible
->AddRef();
1576 childAccessible
->Release();
1577 return stdChildAccessible
;
1581 pDispatch
->Release();
1588 // Loop until we find the right id
1590 this->get_accChildCount(& nChildren
);
1593 for (i
= 0; i
< nChildren
; i
++)
1599 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1604 var
.vt
= VT_DISPATCH
;
1605 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1607 IAccessible
* childAccessible
= NULL
;
1608 if (var
.pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1610 var
.pdispVal
->Release();
1611 return childAccessible
;
1615 var
.pdispVal
->Release();
1627 // Gets the IAccessible interface for the given child or object.
1628 // Call Release if this is non-NULL.
1629 IAccessible
* wxIAccessible::GetChildAccessible(int id
)
1633 IAccessible
* obj
= this;
1644 IDispatch
* pDispatch
= NULL
;
1645 if (S_OK
== get_accChild ( var
, & pDispatch
))
1647 IAccessible
* childAccessible
= NULL
;
1648 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1650 pDispatch
->Release();
1651 return childAccessible
;
1655 pDispatch
->Release();
1662 // ----------------------------------------------------------------------------
1663 // wxAccessible implementation
1664 // ----------------------------------------------------------------------------
1668 // common part of all ctors
1669 void wxAccessible::Init()
1671 m_pIAccessibleStd
= NULL
;
1672 m_pIAccessible
= new wxIAccessible(this);
1673 m_pIAccessible
->AddRef();
1676 wxAccessible::wxAccessible(wxWindow
* win
)
1677 : wxAccessibleBase(win
)
1682 wxAccessible::~wxAccessible()
1684 m_pIAccessible
->Release();
1685 if (m_pIAccessibleStd
)
1686 ((IAccessible
*)m_pIAccessibleStd
)->Release();
1689 // Gets or creates a standard interface for this object.
1690 void* wxAccessible::GetIAccessibleStd()
1692 if (m_pIAccessibleStd
)
1693 return m_pIAccessibleStd
;
1697 HRESULT retCode
= ::CreateStdAccessibleObject((HWND
) GetWindow()->GetHWND(),
1698 OBJID_CLIENT
, IID_IAccessible
, (void**) & m_pIAccessibleStd
);
1699 if (retCode
== S_OK
)
1700 return m_pIAccessibleStd
;
1703 m_pIAccessibleStd
= NULL
;
1710 // Sends an event when something changes in an accessible object.
1711 void wxAccessible::NotifyEvent(int eventType
, wxWindow
* window
, wxAccObject objectType
,
1714 ::NotifyWinEvent((DWORD
) eventType
, (HWND
) window
->GetHWND(),
1715 (LONG
) objectType
, (LONG
) objectId
);
1720 // Convert to Windows role
1721 int wxConvertToWindowsRole(wxAccRole wxrole
)
1725 case wxROLE_SYSTEM_ALERT
:
1726 return ROLE_SYSTEM_ALERT
;
1727 case wxROLE_SYSTEM_ANIMATION
:
1728 return ROLE_SYSTEM_ANIMATION
;
1729 case wxROLE_SYSTEM_APPLICATION
:
1730 return ROLE_SYSTEM_APPLICATION
;
1731 case wxROLE_SYSTEM_BORDER
:
1732 return ROLE_SYSTEM_BORDER
;
1733 case wxROLE_SYSTEM_BUTTONDROPDOWN
:
1734 return ROLE_SYSTEM_BUTTONDROPDOWN
;
1735 case wxROLE_SYSTEM_BUTTONDROPDOWNGRID
:
1736 return ROLE_SYSTEM_BUTTONDROPDOWNGRID
;
1737 case wxROLE_SYSTEM_BUTTONMENU
:
1738 return ROLE_SYSTEM_BUTTONMENU
;
1739 case wxROLE_SYSTEM_CARET
:
1740 return ROLE_SYSTEM_CARET
;
1741 case wxROLE_SYSTEM_CELL
:
1742 return ROLE_SYSTEM_CELL
;
1743 case wxROLE_SYSTEM_CHARACTER
:
1744 return ROLE_SYSTEM_CHARACTER
;
1745 case wxROLE_SYSTEM_CHART
:
1746 return ROLE_SYSTEM_CHART
;
1747 case wxROLE_SYSTEM_CHECKBUTTON
:
1748 return ROLE_SYSTEM_CHECKBUTTON
;
1749 case wxROLE_SYSTEM_CLIENT
:
1750 return ROLE_SYSTEM_CLIENT
;
1751 case wxROLE_SYSTEM_CLOCK
:
1752 return ROLE_SYSTEM_CLOCK
;
1753 case wxROLE_SYSTEM_COLUMN
:
1754 return ROLE_SYSTEM_COLUMN
;
1755 case wxROLE_SYSTEM_COLUMNHEADER
:
1756 return ROLE_SYSTEM_COLUMNHEADER
;
1757 case wxROLE_SYSTEM_COMBOBOX
:
1758 return ROLE_SYSTEM_COMBOBOX
;
1759 case wxROLE_SYSTEM_CURSOR
:
1760 return ROLE_SYSTEM_CURSOR
;
1761 case wxROLE_SYSTEM_DIAGRAM
:
1762 return ROLE_SYSTEM_DIAGRAM
;
1763 case wxROLE_SYSTEM_DIAL
:
1764 return ROLE_SYSTEM_DIAL
;
1765 case wxROLE_SYSTEM_DIALOG
:
1766 return ROLE_SYSTEM_DIALOG
;
1767 case wxROLE_SYSTEM_DOCUMENT
:
1768 return ROLE_SYSTEM_DOCUMENT
;
1769 case wxROLE_SYSTEM_DROPLIST
:
1770 return ROLE_SYSTEM_DROPLIST
;
1771 case wxROLE_SYSTEM_EQUATION
:
1772 return ROLE_SYSTEM_EQUATION
;
1773 case wxROLE_SYSTEM_GRAPHIC
:
1774 return ROLE_SYSTEM_GRAPHIC
;
1775 case wxROLE_SYSTEM_GRIP
:
1776 return ROLE_SYSTEM_GRIP
;
1777 case wxROLE_SYSTEM_GROUPING
:
1778 return ROLE_SYSTEM_GROUPING
;
1779 case wxROLE_SYSTEM_HELPBALLOON
:
1780 return ROLE_SYSTEM_HELPBALLOON
;
1781 case wxROLE_SYSTEM_HOTKEYFIELD
:
1782 return ROLE_SYSTEM_HOTKEYFIELD
;
1783 case wxROLE_SYSTEM_INDICATOR
:
1784 return ROLE_SYSTEM_INDICATOR
;
1785 case wxROLE_SYSTEM_LINK
:
1786 return ROLE_SYSTEM_LINK
;
1787 case wxROLE_SYSTEM_LIST
:
1788 return ROLE_SYSTEM_LIST
;
1789 case wxROLE_SYSTEM_LISTITEM
:
1790 return ROLE_SYSTEM_LISTITEM
;
1791 case wxROLE_SYSTEM_MENUBAR
:
1792 return ROLE_SYSTEM_MENUBAR
;
1793 case wxROLE_SYSTEM_MENUITEM
:
1794 return ROLE_SYSTEM_MENUITEM
;
1795 case wxROLE_SYSTEM_MENUPOPUP
:
1796 return ROLE_SYSTEM_MENUPOPUP
;
1797 case wxROLE_SYSTEM_OUTLINE
:
1798 return ROLE_SYSTEM_OUTLINE
;
1799 case wxROLE_SYSTEM_OUTLINEITEM
:
1800 return ROLE_SYSTEM_OUTLINEITEM
;
1801 case wxROLE_SYSTEM_PAGETAB
:
1802 return ROLE_SYSTEM_PAGETAB
;
1803 case wxROLE_SYSTEM_PAGETABLIST
:
1804 return ROLE_SYSTEM_PAGETABLIST
;
1805 case wxROLE_SYSTEM_PANE
:
1806 return ROLE_SYSTEM_PANE
;
1807 case wxROLE_SYSTEM_PROGRESSBAR
:
1808 return ROLE_SYSTEM_PROGRESSBAR
;
1809 case wxROLE_SYSTEM_PROPERTYPAGE
:
1810 return ROLE_SYSTEM_PROPERTYPAGE
;
1811 case wxROLE_SYSTEM_PUSHBUTTON
:
1812 return ROLE_SYSTEM_PUSHBUTTON
;
1813 case wxROLE_SYSTEM_RADIOBUTTON
:
1814 return ROLE_SYSTEM_RADIOBUTTON
;
1815 case wxROLE_SYSTEM_ROW
:
1816 return ROLE_SYSTEM_ROW
;
1817 case wxROLE_SYSTEM_ROWHEADER
:
1818 return ROLE_SYSTEM_ROWHEADER
;
1819 case wxROLE_SYSTEM_SCROLLBAR
:
1820 return ROLE_SYSTEM_SCROLLBAR
;
1821 case wxROLE_SYSTEM_SEPARATOR
:
1822 return ROLE_SYSTEM_SEPARATOR
;
1823 case wxROLE_SYSTEM_SLIDER
:
1824 return ROLE_SYSTEM_SLIDER
;
1825 case wxROLE_SYSTEM_SOUND
:
1826 return ROLE_SYSTEM_SOUND
;
1827 case wxROLE_SYSTEM_SPINBUTTON
:
1828 return ROLE_SYSTEM_SPINBUTTON
;
1829 case wxROLE_SYSTEM_STATICTEXT
:
1830 return ROLE_SYSTEM_STATICTEXT
;
1831 case wxROLE_SYSTEM_STATUSBAR
:
1832 return ROLE_SYSTEM_STATUSBAR
;
1833 case wxROLE_SYSTEM_TABLE
:
1834 return ROLE_SYSTEM_TABLE
;
1835 case wxROLE_SYSTEM_TEXT
:
1836 return ROLE_SYSTEM_TEXT
;
1837 case wxROLE_SYSTEM_TITLEBAR
:
1838 return ROLE_SYSTEM_TITLEBAR
;
1839 case wxROLE_SYSTEM_TOOLBAR
:
1840 return ROLE_SYSTEM_TOOLBAR
;
1841 case wxROLE_SYSTEM_TOOLTIP
:
1842 return ROLE_SYSTEM_TOOLTIP
;
1843 case wxROLE_SYSTEM_WHITESPACE
:
1844 return ROLE_SYSTEM_WHITESPACE
;
1845 case wxROLE_SYSTEM_WINDOW
:
1846 return ROLE_SYSTEM_WINDOW
;
1851 // Convert to Windows state
1852 long wxConvertToWindowsState(long wxstate
)
1855 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_HIGH
)
1856 state
|= STATE_SYSTEM_ALERT_HIGH
;
1858 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_MEDIUM
)
1859 state
|= STATE_SYSTEM_ALERT_MEDIUM
;
1861 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_LOW
)
1862 state
|= STATE_SYSTEM_ALERT_LOW
;
1864 if (wxstate
& wxACC_STATE_SYSTEM_ANIMATED
)
1865 state
|= STATE_SYSTEM_ANIMATED
;
1867 if (wxstate
& wxACC_STATE_SYSTEM_BUSY
)
1868 state
|= STATE_SYSTEM_BUSY
;
1870 if (wxstate
& wxACC_STATE_SYSTEM_CHECKED
)
1871 state
|= STATE_SYSTEM_CHECKED
;
1873 if (wxstate
& wxACC_STATE_SYSTEM_COLLAPSED
)
1874 state
|= STATE_SYSTEM_COLLAPSED
;
1876 if (wxstate
& wxACC_STATE_SYSTEM_DEFAULT
)
1877 state
|= STATE_SYSTEM_DEFAULT
;
1879 if (wxstate
& wxACC_STATE_SYSTEM_EXPANDED
)
1880 state
|= STATE_SYSTEM_EXPANDED
;
1882 if (wxstate
& wxACC_STATE_SYSTEM_EXTSELECTABLE
)
1883 state
|= STATE_SYSTEM_EXTSELECTABLE
;
1885 if (wxstate
& wxACC_STATE_SYSTEM_FLOATING
)
1886 state
|= STATE_SYSTEM_FLOATING
;
1888 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSABLE
)
1889 state
|= STATE_SYSTEM_FOCUSABLE
;
1891 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSED
)
1892 state
|= STATE_SYSTEM_FOCUSED
;
1894 if (wxstate
& wxACC_STATE_SYSTEM_HOTTRACKED
)
1895 state
|= STATE_SYSTEM_HOTTRACKED
;
1897 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1898 state
|= STATE_SYSTEM_INVISIBLE
;
1900 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1901 state
|= STATE_SYSTEM_INVISIBLE
;
1903 if (wxstate
& wxACC_STATE_SYSTEM_MIXED
)
1904 state
|= STATE_SYSTEM_MIXED
;
1906 if (wxstate
& wxACC_STATE_SYSTEM_MULTISELECTABLE
)
1907 state
|= STATE_SYSTEM_MULTISELECTABLE
;
1909 if (wxstate
& wxACC_STATE_SYSTEM_OFFSCREEN
)
1910 state
|= STATE_SYSTEM_OFFSCREEN
;
1912 if (wxstate
& wxACC_STATE_SYSTEM_PRESSED
)
1913 state
|= STATE_SYSTEM_PRESSED
;
1915 // if (wxstate & wxACC_STATE_SYSTEM_PROTECTED)
1916 // state |= STATE_SYSTEM_PROTECTED;
1918 if (wxstate
& wxACC_STATE_SYSTEM_READONLY
)
1919 state
|= STATE_SYSTEM_READONLY
;
1921 if (wxstate
& wxACC_STATE_SYSTEM_SELECTABLE
)
1922 state
|= STATE_SYSTEM_SELECTABLE
;
1924 if (wxstate
& wxACC_STATE_SYSTEM_SELECTED
)
1925 state
|= STATE_SYSTEM_SELECTED
;
1927 if (wxstate
& wxACC_STATE_SYSTEM_SELFVOICING
)
1928 state
|= STATE_SYSTEM_SELFVOICING
;
1930 if (wxstate
& wxACC_STATE_SYSTEM_UNAVAILABLE
)
1931 state
|= STATE_SYSTEM_UNAVAILABLE
;
1936 // Convert to Windows selection flag
1937 int wxConvertToWindowsSelFlag(wxAccSelectionFlags wxsel
)
1941 if (sel
& wxACC_SEL_TAKEFOCUS
)
1942 sel
|= SELFLAG_TAKEFOCUS
;
1943 if (sel
& wxACC_SEL_TAKESELECTION
)
1944 sel
|= SELFLAG_TAKESELECTION
;
1945 if (sel
& wxACC_SEL_EXTENDSELECTION
)
1946 sel
|= SELFLAG_EXTENDSELECTION
;
1947 if (sel
& wxACC_SEL_ADDSELECTION
)
1948 sel
|= SELFLAG_ADDSELECTION
;
1949 if (sel
& wxACC_SEL_REMOVESELECTION
)
1950 sel
|= SELFLAG_REMOVESELECTION
;
1954 // Convert from Windows selection flag
1955 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
)
1959 if (sel
& SELFLAG_TAKEFOCUS
)
1960 wxsel
|= wxACC_SEL_TAKEFOCUS
;
1961 if (sel
& SELFLAG_TAKESELECTION
)
1962 wxsel
|= wxACC_SEL_TAKESELECTION
;
1963 if (sel
& SELFLAG_EXTENDSELECTION
)
1964 wxsel
|= wxACC_SEL_EXTENDSELECTION
;
1965 if (sel
& SELFLAG_ADDSELECTION
)
1966 wxsel
|= wxACC_SEL_ADDSELECTION
;
1967 if (sel
& SELFLAG_REMOVESELECTION
)
1968 wxsel
|= wxACC_SEL_REMOVESELECTION
;
1969 return (wxAccSelectionFlags
) wxsel
;
1973 #endif //USE_ACCESSIBILITY