1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/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 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
23 #if defined(__BORLANDC__)
27 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
29 #include "wx/access.h"
32 #include "wx/msw/wrapwin.h"
33 #include "wx/window.h"
37 // for some compilers, the entire ole2.h must be included, not only oleauto.h
38 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
46 #include "wx/msw/ole/oleutils.h"
49 #define CHILDID_SELF 0
53 #define OBJID_CLIENT 0xFFFFFFFC
56 // Convert to Windows role
57 int wxConvertToWindowsRole(wxAccRole wxrole
);
59 // Convert to Windows state
60 long wxConvertToWindowsState(long wxstate
);
62 // Convert to Windows selection flag
63 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel
);
65 // Convert from Windows selection flag
66 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
);
68 // ----------------------------------------------------------------------------
69 // wxIEnumVARIANT interface implementation
70 // ----------------------------------------------------------------------------
72 class wxIEnumVARIANT
: public IEnumVARIANT
75 wxIEnumVARIANT(const wxVariant
& variant
);
76 virtual ~wxIEnumVARIANT() { }
78 DECLARE_IUNKNOWN_METHODS
;
81 STDMETHODIMP
Next(ULONG celt
, VARIANT
*rgelt
, ULONG
*pceltFetched
);
82 STDMETHODIMP
Skip(ULONG celt
);
84 STDMETHODIMP
Clone(IEnumVARIANT
**ppenum
);
87 wxVariant m_variant
; // List of further variants
88 int m_nCurrent
; // Current enum position
90 DECLARE_NO_COPY_CLASS(wxIEnumVARIANT
)
93 // ----------------------------------------------------------------------------
95 // ----------------------------------------------------------------------------
97 BEGIN_IID_TABLE(wxIEnumVARIANT
)
102 IMPLEMENT_IUNKNOWN_METHODS(wxIEnumVARIANT
)
104 // wxVariant contains a list of further variants.
105 wxIEnumVARIANT::wxIEnumVARIANT(const wxVariant
& variant
)
110 STDMETHODIMP
wxIEnumVARIANT::Next(ULONG celt
,
114 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Next"));
117 // we only return 1 element at a time - mainly because I'm too lazy to
118 // implement something which you're never asked for anyhow
122 if (m_variant
.GetType() != wxT("list"))
125 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() ) {
126 if (!wxConvertVariantToOle(m_variant
[m_nCurrent
++], rgelt
[0]))
131 // TODO: should we AddRef if this is an object?
142 STDMETHODIMP
wxIEnumVARIANT::Skip(ULONG celt
)
144 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Skip"));
146 if (m_variant
.GetType() != wxT("list"))
150 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() )
153 // no, can't skip this many elements
159 STDMETHODIMP
wxIEnumVARIANT::Reset()
161 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Reset"));
168 STDMETHODIMP
wxIEnumVARIANT::Clone(IEnumVARIANT
**ppenum
)
170 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Clone"));
172 wxIEnumVARIANT
*pNew
= new wxIEnumVARIANT(m_variant
);
180 // ----------------------------------------------------------------------------
181 // wxIAccessible implementation of IAccessible interface
182 // ----------------------------------------------------------------------------
184 class wxIAccessible
: public IAccessible
187 wxIAccessible(wxAccessible
*pAccessible
);
189 DECLARE_IUNKNOWN_METHODS
;
193 // Navigation and Hierarchy
195 // Retrieves the child element or child object at a given point on the screen.
196 // All visual objects support this method; sound objects do not support it.
198 STDMETHODIMP
accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
);
200 // Retrieves the specified object's current screen location. All visual objects must
201 // support this method; sound objects do not support it.
203 STDMETHODIMP
accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
);
205 // Traverses to another user interface element within a container and retrieves the object.
206 // All visual objects must support this method.
208 STDMETHODIMP
accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
);
210 // Retrieves the address of an IDispatch interface for the specified child.
211 // All objects must support this property.
213 STDMETHODIMP
get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
);
215 // Retrieves the number of children that belong to this object.
216 // All objects must support this property.
218 STDMETHODIMP
get_accChildCount ( long* pCountChildren
);
220 // Retrieves the IDispatch interface of the object's parent.
221 // All objects support this property.
223 STDMETHODIMP
get_accParent ( IDispatch
** ppDispParent
);
225 // Descriptive Properties and Methods
227 // Performs the object's default action. Not all objects have a default
230 STDMETHODIMP
accDoDefaultAction(VARIANT varID
);
232 // Retrieves a string that describes the object's default action.
233 // Not all objects have a default action.
235 STDMETHODIMP
get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
);
237 // Retrieves a string that describes the visual appearance of the specified object.
238 // Not all objects have a description.
240 STDMETHODIMP
get_accDescription ( VARIANT varID
, BSTR
* pszDescription
);
242 // Retrieves an object's Help property string.
243 // Not all objects support this property.
245 STDMETHODIMP
get_accHelp ( VARIANT varID
, BSTR
* pszHelp
);
247 // Retrieves the full path of the WinHelp file associated with the specified
248 // object and the identifier of the appropriate topic within that file.
249 // Not all objects support this property.
251 STDMETHODIMP
get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
);
253 // Retrieves the specified object's shortcut key or access key, also known as
254 // the mnemonic. All objects that have a shortcut key or access key support
257 STDMETHODIMP
get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
);
259 // Retrieves the name of the specified object.
260 // All objects support this property.
262 STDMETHODIMP
get_accName ( VARIANT varID
, BSTR
* pszName
);
264 // Retrieves information that describes the role of the specified object.
265 // All objects support this property.
267 STDMETHODIMP
get_accRole ( VARIANT varID
, VARIANT
* pVarRole
);
269 // Retrieves the current state of the specified object.
270 // All objects support this property.
272 STDMETHODIMP
get_accState ( VARIANT varID
, VARIANT
* pVarState
);
274 // Retrieves the value of the specified object.
275 // Not all objects have a value.
277 STDMETHODIMP
get_accValue ( VARIANT varID
, BSTR
* pszValue
);
279 // Selection and Focus
281 // Modifies the selection or moves the keyboard focus of the
282 // specified object. All objects that select or receive the
283 // keyboard focus must support this method.
285 STDMETHODIMP
accSelect ( long flagsSelect
, VARIANT varID
);
287 // Retrieves the object that has the keyboard focus. All objects
288 // that receive the keyboard focus must support this property.
290 STDMETHODIMP
get_accFocus ( VARIANT
* pVarID
);
292 // Retrieves the selected children of this object. All objects
293 // selected must support this property.
295 STDMETHODIMP
get_accSelection ( VARIANT
* pVarChildren
);
299 STDMETHODIMP
put_accName(VARIANT
WXUNUSED(varChild
), BSTR
WXUNUSED(szName
)) { return E_FAIL
; }
300 STDMETHODIMP
put_accValue(VARIANT
WXUNUSED(varChild
), BSTR
WXUNUSED(szName
)) { return E_FAIL
; }
306 STDMETHODIMP
GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
);
308 // Get type info count
310 STDMETHODIMP
GetTypeInfoCount(unsigned int* typeInfoCount
);
314 STDMETHODIMP
GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
315 LCID lcid
, DISPID
* dispId
);
319 STDMETHODIMP
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
320 WORD wFlags
, DISPPARAMS
*pDispParams
,
321 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
322 unsigned int *puArgErr
);
326 // Gets the standard IAccessible interface for the given child or object.
327 // Call Release if this is non-NULL.
328 IAccessible
* GetChildStdAccessible(int id
);
330 // Gets the IAccessible interface for the given child or object.
331 // Call Release if this is non-NULL.
332 IAccessible
* GetChildAccessible(int id
);
335 wxAccessible
*m_pAccessible
; // pointer to C++ class we belong to
337 DECLARE_NO_COPY_CLASS(wxIAccessible
)
340 // ============================================================================
342 // ============================================================================
344 // ----------------------------------------------------------------------------
345 // wxIAccessible implementation
346 // ----------------------------------------------------------------------------
347 BEGIN_IID_TABLE(wxIAccessible
)
353 IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible
)
355 wxIAccessible::wxIAccessible(wxAccessible
*pAccessible
)
357 wxASSERT( pAccessible
!= NULL
);
359 m_pAccessible
= pAccessible
;
362 // Retrieves the child element or child object at a given point on the screen.
363 // All visual objects support this method; sound objects do not support it.
365 STDMETHODIMP
wxIAccessible::accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
)
367 wxLogTrace(wxT("access"), wxT("accHitTest"));
368 wxASSERT (m_pAccessible
!= NULL
);
372 wxAccessible
* childObject
= NULL
;
376 wxAccStatus status
= m_pAccessible
->HitTest(wxPoint(xLeft
, yLeft
), & childId
, & childObject
);
378 if (status
== wxACC_FAIL
)
381 if (status
== wxACC_NOT_IMPLEMENTED
)
383 // Use standard interface instead.
384 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
388 return stdInterface
->accHitTest(xLeft
, yLeft
, pVarID
);
393 if (childObject
== m_pAccessible
)
396 pVarID
->lVal
= CHILDID_SELF
;
401 wxIAccessible
* childIA
= childObject
->GetIAccessible();
405 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
408 pVarID
->vt
= VT_DISPATCH
;
412 else if (childId
> 0)
415 pVarID
->lVal
= childId
;
420 pVarID
->vt
= VT_EMPTY
;
425 // all cases above already cause some return action so below line
426 // is unreachable and cause unnecessary warning
431 // Retrieves the specified object's current screen location. All visual objects must
432 // support this method; sound objects do not support it.
434 STDMETHODIMP
wxIAccessible::accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
)
436 wxLogTrace(wxT("access"), wxT("accLocation"));
437 wxASSERT (m_pAccessible
!= NULL
);
443 wxAccStatus status
= m_pAccessible
->GetLocation(rect
, varID
.lVal
);
444 if (status
== wxACC_FAIL
)
447 if (status
== wxACC_NOT_IMPLEMENTED
)
449 // Try to use child object directly.
452 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
456 HRESULT hResult
= childAccessible
->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
457 childAccessible
->Release();
460 else if (m_pAccessible
->GetIAccessibleStd())
461 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
463 else if (m_pAccessible
->GetIAccessibleStd())
464 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
470 *pcxWidth
= rect
.width
;
471 *pcyHeight
= rect
.height
;
478 // Traverses to another user interface element within a container and retrieves the object.
479 // All visual objects must support this method.
481 STDMETHODIMP
wxIAccessible::accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
)
483 wxASSERT (m_pAccessible
!= NULL
);
486 wxLogTrace(wxT("access"), wxString(wxT("accNavigate for ")) + m_pAccessible
->GetWindow()->GetClassInfo()->GetClassName());
488 if ((varStart
.vt
!= VT_I4
&& varStart
.vt
!= VT_EMPTY
)
490 // according to MSDN and sources varStart.vt is unsigned
491 // so below line cause warning "Condition is always false"
496 wxLogTrace(wxT("access"), wxT("Invalid arg for accNavigate"));
500 wxAccessible
* elementObject
= NULL
;
502 VariantInit(pVarEnd
);
503 wxNavDir navDirWX
= wxNAVDIR_FIRSTCHILD
;
510 navDirWX
= wxNAVDIR_DOWN
;
511 navStr
= wxT("wxNAVDIR_DOWN");
514 case NAVDIR_FIRSTCHILD
:
515 navDirWX
= wxNAVDIR_FIRSTCHILD
;
516 navStr
= wxT("wxNAVDIR_FIRSTCHILD");
519 case NAVDIR_LASTCHILD
:
520 navDirWX
= wxNAVDIR_LASTCHILD
;
521 navStr
= wxT("wxNAVDIR_LASTCHILD");
525 navDirWX
= wxNAVDIR_LEFT
;
526 navStr
= wxT("wxNAVDIR_LEFT");
530 navDirWX
= wxNAVDIR_NEXT
;
531 navStr
= wxT("wxNAVDIR_NEXT");
534 case NAVDIR_PREVIOUS
:
535 navDirWX
= wxNAVDIR_PREVIOUS
;
536 navStr
= wxT("wxNAVDIR_PREVIOUS");
540 navDirWX
= wxNAVDIR_RIGHT
;
541 navStr
= wxT("wxNAVDIR_RIGHT");
545 navDirWX
= wxNAVDIR_UP
;
546 navStr
= wxT("wxNAVDIR_UP");
550 wxLogTrace(wxT("access"), wxT("Unknown NAVDIR symbol"));
554 wxLogTrace(wxT("access"), navStr
);
556 wxAccStatus status
= m_pAccessible
->Navigate(navDirWX
, varStart
.lVal
, & elementId
,
559 if (status
== wxACC_FAIL
)
561 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate failed"));
565 if (status
== wxACC_FALSE
)
567 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate found no object in this direction"));
571 if (status
== wxACC_NOT_IMPLEMENTED
)
573 wxLogTrace(wxT("access"), wxT("Navigate not implemented"));
575 // Try to use child object directly.
576 if (varStart
.vt
== VT_I4
&& varStart
.lVal
> 0)
578 IAccessible
* childAccessible
= GetChildAccessible(varStart
.lVal
);
582 HRESULT hResult
= childAccessible
->accNavigate(navDir
, varStart
, pVarEnd
);
583 childAccessible
->Release();
586 else if (m_pAccessible
->GetIAccessibleStd())
587 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
589 else if (m_pAccessible
->GetIAccessibleStd())
590 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
596 wxLogTrace(wxT("access"), wxT("Getting wxIAccessible and calling QueryInterface for Navigate"));
597 wxIAccessible
* objectIA
= elementObject
->GetIAccessible();
600 wxLogTrace(wxT("access"), wxT("No wxIAccessible"));
604 HRESULT hResult
= objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarEnd
->pdispVal
);
607 wxLogTrace(wxT("access"), wxT("QueryInterface failed"));
611 wxLogTrace(wxT("access"), wxT("Called QueryInterface for Navigate"));
612 pVarEnd
->vt
= VT_DISPATCH
;
615 else if (elementId
> 0)
617 wxLogTrace(wxT("access"), wxT("Returning element id from Navigate"));
619 pVarEnd
->lVal
= elementId
;
624 wxLogTrace(wxT("access"), wxT("No object in accNavigate"));
625 pVarEnd
->vt
= VT_EMPTY
;
630 wxLogTrace(wxT("access"), wxT("Failing Navigate"));
634 // Retrieves the address of an IDispatch interface for the specified child.
635 // All objects must support this property.
637 STDMETHODIMP
wxIAccessible::get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
)
639 wxLogTrace(wxT("access"), wxT("get_accChild"));
640 wxASSERT (m_pAccessible
!= NULL
);
644 if (varChildID
.vt
!= VT_I4
)
646 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accChild"));
650 if (varChildID
.lVal
== CHILDID_SELF
)
657 wxAccessible
* child
= NULL
;
659 wxAccStatus status
= m_pAccessible
->GetChild(varChildID
.lVal
, & child
);
660 if (status
== wxACC_FAIL
)
662 wxLogTrace(wxT("access"), wxT("GetChild failed"));
666 if (status
== wxACC_NOT_IMPLEMENTED
)
668 // Use standard interface instead.
669 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
674 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChild"));
675 return stdInterface
->get_accChild (varChildID
, ppDispChild
);
682 wxIAccessible
* objectIA
= child
->GetIAccessible();
686 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispChild
) != S_OK
)
688 wxLogTrace(wxT("access"), wxT("QueryInterface failed in get_accChild"));
696 wxLogTrace(wxT("access"), wxT("Not an accessible object"));
697 return S_FALSE
; // Indicates it's not an accessible object
702 // all cases above already cause some return action so below line
703 // is unreachable and cause unnecessary warning
708 // Retrieves the number of children that belong to this object.
709 // All objects must support this property.
711 STDMETHODIMP
wxIAccessible::get_accChildCount ( long* pCountChildren
)
713 wxLogTrace(wxT("access"), wxT("get_accChildCount"));
714 wxASSERT (m_pAccessible
!= NULL
);
719 wxAccStatus status
= m_pAccessible
->GetChildCount(& childCount
);
720 if (status
== wxACC_FAIL
)
723 if (status
== wxACC_NOT_IMPLEMENTED
)
725 // Use standard interface instead.
726 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
731 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChildCount"));
732 HRESULT res
= stdInterface
->get_accChildCount (pCountChildren
);
734 str
.Printf(wxT("Number of children was %d"), (int) (*pCountChildren
));
735 wxLogTrace(wxT("access"), str
);
741 * pCountChildren
= (long) childCount
;
746 // all cases above already cause some return action so below line
747 // is unreachable and cause unnecessary warning
752 // Retrieves the IDispatch interface of the object's parent.
753 // All objects support this property.
755 STDMETHODIMP
wxIAccessible::get_accParent ( IDispatch
** ppDispParent
)
757 wxLogTrace(wxT("access"), wxT("get_accParent"));
758 wxASSERT (m_pAccessible
!= NULL
);
762 wxAccessible
* parent
= NULL
;
763 wxAccStatus status
= m_pAccessible
->GetParent(& parent
);
765 if (status
== wxACC_FAIL
)
768 // It doesn't seem acceptable to return S_FALSE with a NULL
769 // ppDispParent, so if we have no wxWidgets parent, we leave
770 // it to the standard interface.
771 if (status
== wxACC_NOT_IMPLEMENTED
|| !parent
)
773 wxLogTrace(wxT("access"), wxT("Using standard interface to get the parent."));
774 // Use standard interface instead.
775 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
779 return stdInterface
->get_accParent (ppDispParent
);
785 wxIAccessible
* objectIA
= parent
->GetIAccessible();
789 wxLogTrace(wxT("access"), wxT("About to call QueryInterface"));
790 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispParent
) != S_OK
)
792 wxLogTrace(wxT("access"), wxT("Failed QueryInterface"));
796 wxLogTrace(wxT("access"), wxT("Returning S_OK for get_accParent"));
801 // This doesn't seem to be allowed, despite the documentation,
802 // so we handle it higher up by using the standard interface.
803 wxLogTrace(wxT("access"), wxT("Returning NULL parent because there was none"));
804 *ppDispParent
= NULL
;
810 // all cases above already cause some return action so below line
811 // is unreachable and cause unnecessary warning
816 // Performs the object's default action. Not all objects have a default
819 STDMETHODIMP
wxIAccessible::accDoDefaultAction(VARIANT varID
)
821 wxLogTrace(wxT("access"), wxT("accDoDefaultAction"));
822 wxASSERT (m_pAccessible
!= NULL
);
826 if (varID
.vt
!= VT_I4
)
828 wxLogTrace(wxT("access"), wxT("Invalid arg for accDoDefaultAction"));
832 wxAccStatus status
= m_pAccessible
->DoDefaultAction(varID
.lVal
);
833 if (status
== wxACC_FAIL
)
836 if (status
== wxACC_NOT_SUPPORTED
)
837 return DISP_E_MEMBERNOTFOUND
;
839 if (status
== wxACC_NOT_IMPLEMENTED
)
841 // Try to use child object directly.
844 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
848 HRESULT hResult
= childAccessible
->accDoDefaultAction(varID
);
849 childAccessible
->Release();
852 else if (m_pAccessible
->GetIAccessibleStd())
853 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
855 else if (m_pAccessible
->GetIAccessibleStd())
856 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
861 // Retrieves a string that describes the object's default action.
862 // Not all objects have a default action.
864 STDMETHODIMP
wxIAccessible::get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
)
866 wxLogTrace(wxT("access"), wxT("get_accDefaultAction"));
867 wxASSERT (m_pAccessible
!= NULL
);
871 if (varID
.vt
!= VT_I4
)
873 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDefaultAction"));
877 wxString defaultAction
;
878 wxAccStatus status
= m_pAccessible
->GetDefaultAction(varID
.lVal
, & defaultAction
);
879 if (status
== wxACC_FAIL
)
882 if (status
== wxACC_NOT_SUPPORTED
)
883 return DISP_E_MEMBERNOTFOUND
;
885 if (status
== wxACC_NOT_IMPLEMENTED
)
887 // Try to use child object directly.
890 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
894 HRESULT hResult
= childAccessible
->get_accDefaultAction(varID
, pszDefaultAction
);
895 childAccessible
->Release();
898 else if (m_pAccessible
->GetIAccessibleStd())
899 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
901 else if (m_pAccessible
->GetIAccessibleStd())
902 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
906 if (defaultAction
.IsEmpty())
908 * pszDefaultAction
= NULL
;
913 wxBasicString
basicString(defaultAction
);
914 * pszDefaultAction
= basicString
.Get();
921 // Retrieves a string that describes the visual appearance of the specified object.
922 // Not all objects have a description.
924 STDMETHODIMP
wxIAccessible::get_accDescription ( VARIANT varID
, BSTR
* pszDescription
)
926 wxLogTrace(wxT("access"), wxT("get_accDescription"));
927 wxASSERT (m_pAccessible
!= NULL
);
931 if (varID
.vt
!= VT_I4
)
933 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDescription"));
937 wxString description
;
938 wxAccStatus status
= m_pAccessible
->GetDescription(varID
.lVal
, & description
);
939 if (status
== wxACC_FAIL
)
942 if (status
== wxACC_NOT_IMPLEMENTED
)
944 // Try to use child object directly.
947 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
951 HRESULT hResult
= childAccessible
->get_accDescription(varID
, pszDescription
);
952 childAccessible
->Release();
955 else if (m_pAccessible
->GetIAccessibleStd())
956 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
958 else if (m_pAccessible
->GetIAccessibleStd())
959 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
963 if (description
.empty())
965 * pszDescription
= NULL
;
970 wxBasicString
basicString(description
);
971 * pszDescription
= basicString
.Get();
978 // Retrieves an object's Help property string.
979 // Not all objects support this property.
981 STDMETHODIMP
wxIAccessible::get_accHelp ( VARIANT varID
, BSTR
* pszHelp
)
983 wxLogTrace(wxT("access"), wxT("get_accHelp"));
984 wxASSERT (m_pAccessible
!= NULL
);
988 if (varID
.vt
!= VT_I4
)
990 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelp"));
995 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & helpString
);
996 if (status
== wxACC_FAIL
)
999 if (status
== wxACC_NOT_IMPLEMENTED
)
1001 // Try to use child object directly.
1004 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1005 if (childAccessible
)
1008 HRESULT hResult
= childAccessible
->get_accHelp(varID
, pszHelp
);
1009 childAccessible
->Release();
1012 else if (m_pAccessible
->GetIAccessibleStd())
1013 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp(varID
, pszHelp
);
1015 else if (m_pAccessible
->GetIAccessibleStd())
1016 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp (varID
, pszHelp
);
1020 if (helpString
.empty())
1027 wxBasicString
basicString(helpString
);
1028 * pszHelp
= basicString
.Get();
1035 // Retrieves the full path of the WinHelp file associated with the specified
1036 // object and the identifier of the appropriate topic within that file.
1037 // Not all objects support this property.
1038 // NOTE: not supported by wxWidgets at this time. Use
1039 // GetHelpText instead.
1041 STDMETHODIMP
wxIAccessible::get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
)
1043 wxLogTrace(wxT("access"), wxT("get_accHelpTopic"));
1044 wxASSERT (m_pAccessible
!= NULL
);
1048 if (varChild
.vt
!= VT_I4
)
1050 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelpTopic"));
1051 return E_INVALIDARG
;
1054 wxAccStatus status
= wxACC_NOT_IMPLEMENTED
;
1055 if (status
== wxACC_FAIL
)
1058 if (status
== wxACC_NOT_IMPLEMENTED
)
1060 // Try to use child object directly.
1061 if (varChild
.lVal
> 0)
1063 IAccessible
* childAccessible
= GetChildAccessible(varChild
.lVal
);
1064 if (childAccessible
)
1067 HRESULT hResult
= childAccessible
->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1068 childAccessible
->Release();
1071 else if (m_pAccessible
->GetIAccessibleStd())
1072 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1074 else if (m_pAccessible
->GetIAccessibleStd())
1075 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic (pszHelpFile
, varChild
, pidTopic
);
1080 // Retrieves the specified object's shortcut key or access key, also known as
1081 // the mnemonic. All objects that have a shortcut key or access key support
1084 STDMETHODIMP
wxIAccessible::get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
)
1086 wxLogTrace(wxT("access"), wxT("get_accKeyboardShortcut"));
1087 *pszKeyboardShortcut
= NULL
;
1089 wxASSERT (m_pAccessible
!= NULL
);
1093 if (varID
.vt
!= VT_I4
)
1095 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accKeyboardShortcut"));
1096 return E_INVALIDARG
;
1099 wxString keyboardShortcut
;
1100 wxAccStatus status
= m_pAccessible
->GetKeyboardShortcut(varID
.lVal
, & keyboardShortcut
);
1101 if (status
== wxACC_FAIL
)
1104 if (status
== wxACC_NOT_IMPLEMENTED
)
1106 // Try to use child object directly.
1109 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1110 if (childAccessible
)
1113 HRESULT hResult
= childAccessible
->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1114 childAccessible
->Release();
1117 else if (m_pAccessible
->GetIAccessibleStd())
1118 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1120 else if (m_pAccessible
->GetIAccessibleStd())
1121 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut (varID
, pszKeyboardShortcut
);
1125 if (keyboardShortcut
.empty())
1127 * pszKeyboardShortcut
= NULL
;
1132 wxBasicString
basicString(keyboardShortcut
);
1133 * pszKeyboardShortcut
= basicString
.Get();
1140 // Retrieves the name of the specified object.
1141 // All objects support this property.
1143 STDMETHODIMP
wxIAccessible::get_accName ( VARIANT varID
, BSTR
* pszName
)
1145 wxLogTrace(wxT("access"), wxT("get_accName"));
1148 wxASSERT (m_pAccessible
!= NULL
);
1152 if (varID
.vt
!= VT_I4
)
1154 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accName"));
1155 return E_INVALIDARG
;
1160 wxAccStatus status
= m_pAccessible
->GetName(varID
.lVal
, & name
);
1162 if (status
== wxACC_FAIL
)
1165 if (status
== wxACC_NOT_IMPLEMENTED
)
1167 // Try to use child object directly.
1170 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1171 if (childAccessible
)
1174 HRESULT hResult
= childAccessible
->get_accName(varID
, pszName
);
1175 childAccessible
->Release();
1178 else if (m_pAccessible
->GetIAccessibleStd())
1179 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName(varID
, pszName
);
1181 else if (m_pAccessible
->GetIAccessibleStd())
1182 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName (varID
, pszName
);
1186 wxBasicString
basicString(name
);
1187 *pszName
= basicString
.Get();
1193 // Retrieves information that describes the role of the specified object.
1194 // All objects support this property.
1196 STDMETHODIMP
wxIAccessible::get_accRole ( VARIANT varID
, VARIANT
* pVarRole
)
1198 wxLogTrace(wxT("access"), wxT("get_accRole"));
1199 wxASSERT (m_pAccessible
!= NULL
);
1203 if (varID
.vt
!= VT_I4
)
1205 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accRole"));
1206 return E_INVALIDARG
;
1209 VariantInit(pVarRole
);
1211 wxAccRole role
= wxROLE_NONE
;
1213 wxAccStatus status
= m_pAccessible
->GetRole(varID
.lVal
, & role
);
1215 if (status
== wxACC_FAIL
)
1218 if (status
== wxACC_NOT_IMPLEMENTED
)
1220 // Try to use child object directly.
1223 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1224 if (childAccessible
)
1227 HRESULT hResult
= childAccessible
->get_accRole(varID
, pVarRole
);
1228 childAccessible
->Release();
1231 else if (m_pAccessible
->GetIAccessibleStd())
1232 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole(varID
, pVarRole
);
1234 else if (m_pAccessible
->GetIAccessibleStd())
1235 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole (varID
, pVarRole
);
1239 if (role
== wxROLE_NONE
)
1241 pVarRole
->vt
= VT_EMPTY
;
1245 pVarRole
->lVal
= wxConvertToWindowsRole(role
);
1246 pVarRole
->vt
= VT_I4
;
1253 // Retrieves the current state of the specified object.
1254 // All objects support this property.
1256 STDMETHODIMP
wxIAccessible::get_accState ( VARIANT varID
, VARIANT
* pVarState
)
1258 wxLogTrace(wxT("access"), wxT("get_accState"));
1259 wxASSERT (m_pAccessible
!= NULL
);
1263 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1265 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accState"));
1266 return E_INVALIDARG
;
1271 wxAccStatus status
= m_pAccessible
->GetState(varID
.lVal
, & wxstate
);
1272 if (status
== wxACC_FAIL
)
1275 if (status
== wxACC_NOT_IMPLEMENTED
)
1277 // Try to use child object directly.
1280 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1281 if (childAccessible
)
1284 HRESULT hResult
= childAccessible
->get_accState(varID
, pVarState
);
1285 childAccessible
->Release();
1288 else if (m_pAccessible
->GetIAccessibleStd())
1289 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState(varID
, pVarState
);
1291 else if (m_pAccessible
->GetIAccessibleStd())
1292 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState (varID
, pVarState
);
1296 long state
= wxConvertToWindowsState(wxstate
);
1297 pVarState
->lVal
= state
;
1298 pVarState
->vt
= VT_I4
;
1304 // Retrieves the value of the specified object.
1305 // Not all objects have a value.
1307 STDMETHODIMP
wxIAccessible::get_accValue ( VARIANT varID
, BSTR
* pszValue
)
1309 wxLogTrace(wxT("access"), wxT("get_accValue"));
1310 wxASSERT (m_pAccessible
!= NULL
);
1314 if (varID
.vt
!= VT_I4
)
1316 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accValue"));
1317 return E_INVALIDARG
;
1322 wxAccStatus status
= m_pAccessible
->GetValue(varID
.lVal
, & strValue
);
1324 if (status
== wxACC_FAIL
)
1327 if (status
== wxACC_NOT_IMPLEMENTED
)
1329 // Try to use child object directly.
1332 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1333 if (childAccessible
)
1336 HRESULT hResult
= childAccessible
->get_accValue(varID
, pszValue
);
1337 childAccessible
->Release();
1340 else if (m_pAccessible
->GetIAccessibleStd())
1341 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue(varID
, pszValue
);
1343 else if (m_pAccessible
->GetIAccessibleStd())
1344 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue (varID
, pszValue
);
1348 wxBasicString
basicString(strValue
);
1349 * pszValue
= basicString
.Get();
1355 // Modifies the selection or moves the keyboard focus of the
1356 // specified object. All objects that select or receive the
1357 // keyboard focus must support this method.
1359 STDMETHODIMP
wxIAccessible::accSelect ( long flagsSelect
, VARIANT varID
)
1361 wxLogTrace(wxT("access"), wxT("get_accSelect"));
1362 wxASSERT (m_pAccessible
!= NULL
);
1366 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1368 wxLogTrace(wxT("access"), wxT("Invalid arg for accSelect"));
1369 return E_INVALIDARG
;
1372 wxAccSelectionFlags wxsel
= wxConvertFromWindowsSelFlag(flagsSelect
);
1374 wxAccStatus status
= m_pAccessible
->Select(varID
.lVal
, wxsel
);
1375 if (status
== wxACC_FAIL
)
1378 if (status
== wxACC_NOT_IMPLEMENTED
)
1380 // Try to use child object directly.
1381 if (varID
.lVal
> 0 && varID
.lVal
> 0)
1383 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1384 if (childAccessible
)
1387 HRESULT hResult
= childAccessible
->accSelect(flagsSelect
, varID
);
1388 childAccessible
->Release();
1391 else if (m_pAccessible
->GetIAccessibleStd())
1392 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1394 else if (m_pAccessible
->GetIAccessibleStd())
1395 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1403 // Retrieves the object that has the keyboard focus. All objects
1404 // that receive the keyboard focus must support this property.
1406 STDMETHODIMP
wxIAccessible::get_accFocus ( VARIANT
* pVarID
)
1408 wxLogTrace(wxT("access"), wxT("get_accFocus"));
1409 wxASSERT (m_pAccessible
!= NULL
);
1413 wxAccessible
* childObject
= NULL
;
1415 VariantInit(pVarID
);
1417 wxAccStatus status
= m_pAccessible
->GetFocus(& childId
, & childObject
);
1418 if (status
== wxACC_FAIL
)
1421 if (status
== wxACC_NOT_IMPLEMENTED
)
1423 // Use standard interface instead.
1424 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1428 return stdInterface
->get_accFocus (pVarID
);
1432 if (childObject
== m_pAccessible
)
1435 pVarID
->lVal
= CHILDID_SELF
;
1439 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1443 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
1446 pVarID
->vt
= VT_DISPATCH
;
1450 else if (childId
> 0)
1453 pVarID
->lVal
= childId
;
1458 pVarID
->vt
= VT_EMPTY
;
1463 // all cases above already cause some return action so below line
1464 // is unreachable and cause unnecessary warning
1469 // Retrieves the selected children of this object. All objects
1470 // selected must support this property.
1472 STDMETHODIMP
wxIAccessible::get_accSelection ( VARIANT
* pVarChildren
)
1474 wxLogTrace(wxT("access"), wxT("get_accSelection"));
1475 wxASSERT (m_pAccessible
!= NULL
);
1479 VariantInit(pVarChildren
);
1481 wxVariant selections
;
1482 wxAccStatus status
= m_pAccessible
->GetSelections(& selections
);
1483 if (status
== wxACC_FAIL
)
1486 if (status
== wxACC_NOT_IMPLEMENTED
)
1488 // Use standard interface instead.
1489 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1493 return stdInterface
->get_accSelection (pVarChildren
);
1497 if (selections
.GetType() == wxT("long"))
1499 pVarChildren
->vt
= VT_I4
;
1500 pVarChildren
->lVal
= selections
.GetLong();
1504 else if (selections
.GetType() == wxT("void*"))
1506 wxAccessible
* childObject
= (wxAccessible
*) selections
.GetVoidPtr();
1507 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1511 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarChildren
->pdispVal
) != S_OK
)
1514 pVarChildren
->vt
= VT_DISPATCH
;
1518 else if (selections
.GetType() == wxT("list"))
1520 // TODO: should we AddRef for every "void*" member??
1522 wxIEnumVARIANT
* enumVariant
= new wxIEnumVARIANT(selections
);
1523 enumVariant
->AddRef();
1525 pVarChildren
->vt
= VT_UNKNOWN
;
1526 pVarChildren
->punkVal
= enumVariant
;
1537 STDMETHODIMP
wxIAccessible::GetTypeInfo(unsigned int WXUNUSED(typeInfo
), LCID
WXUNUSED(lcid
), ITypeInfo
** ppTypeInfo
)
1543 // Get type info count
1545 STDMETHODIMP
wxIAccessible::GetTypeInfoCount(unsigned int* typeInfoCount
)
1553 STDMETHODIMP
wxIAccessible::GetIDsOfNames(REFIID
WXUNUSED(riid
), OLECHAR
** WXUNUSED(names
), unsigned int WXUNUSED(cNames
),
1554 LCID
WXUNUSED(lcid
), DISPID
* WXUNUSED(dispId
))
1561 STDMETHODIMP
wxIAccessible::Invoke(DISPID
WXUNUSED(dispIdMember
), REFIID
WXUNUSED(riid
), LCID
WXUNUSED(lcid
),
1562 WORD
WXUNUSED(wFlags
), DISPPARAMS
*WXUNUSED(pDispParams
),
1563 VARIANT
*WXUNUSED(pVarResult
), EXCEPINFO
*WXUNUSED(pExcepInfo
),
1564 unsigned int *WXUNUSED(puArgErr
) )
1569 // Gets the standard IAccessible interface for the given child or object.
1570 // Call Release if this is non-NULL.
1571 IAccessible
* wxIAccessible::GetChildStdAccessible(int id
)
1575 IAccessible
* obj
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1586 IDispatch
* pDispatch
= NULL
;
1587 if (S_OK
== get_accChild ( var
, & pDispatch
))
1589 IAccessible
* childAccessible
= NULL
;
1590 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1592 pDispatch
->Release();
1593 wxIAccessible
* c
= (wxIAccessible
*) childAccessible
;
1594 IAccessible
* stdChildAccessible
= (IAccessible
*) c
->m_pAccessible
->GetIAccessibleStd();
1595 stdChildAccessible
->AddRef();
1596 childAccessible
->Release();
1597 return stdChildAccessible
;
1601 pDispatch
->Release();
1608 // Loop until we find the right id
1610 this->get_accChildCount(& nChildren
);
1613 for (i
= 0; i
< nChildren
; i
++)
1619 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1624 var
.vt
= VT_DISPATCH
;
1625 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1627 IAccessible
* childAccessible
= NULL
;
1628 if (var
.pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1630 var
.pdispVal
->Release();
1631 return childAccessible
;
1635 var
.pdispVal
->Release();
1647 // Gets the IAccessible interface for the given child or object.
1648 // Call Release if this is non-NULL.
1649 IAccessible
* wxIAccessible::GetChildAccessible(int id
)
1653 IAccessible
* obj
= this;
1664 IDispatch
* pDispatch
= NULL
;
1665 if (S_OK
== get_accChild ( var
, & pDispatch
))
1667 IAccessible
* childAccessible
= NULL
;
1668 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1670 pDispatch
->Release();
1671 return childAccessible
;
1675 pDispatch
->Release();
1682 // ----------------------------------------------------------------------------
1683 // wxAccessible implementation
1684 // ----------------------------------------------------------------------------
1688 // common part of all ctors
1689 void wxAccessible::Init()
1691 m_pIAccessibleStd
= NULL
;
1692 m_pIAccessible
= new wxIAccessible(this);
1693 m_pIAccessible
->AddRef();
1696 wxAccessible::wxAccessible(wxWindow
* win
)
1697 : wxAccessibleBase(win
)
1702 wxAccessible::~wxAccessible()
1704 m_pIAccessible
->Release();
1705 if (m_pIAccessibleStd
)
1706 ((IAccessible
*)m_pIAccessibleStd
)->Release();
1709 // Gets or creates a standard interface for this object.
1710 void* wxAccessible::GetIAccessibleStd()
1712 if (m_pIAccessibleStd
)
1713 return m_pIAccessibleStd
;
1717 HRESULT retCode
= ::CreateStdAccessibleObject((HWND
) GetWindow()->GetHWND(),
1718 OBJID_CLIENT
, IID_IAccessible
, (void**) & m_pIAccessibleStd
);
1719 if (retCode
== S_OK
)
1720 return m_pIAccessibleStd
;
1723 m_pIAccessibleStd
= NULL
;
1730 // Sends an event when something changes in an accessible object.
1731 void wxAccessible::NotifyEvent(int eventType
, wxWindow
* window
, wxAccObject objectType
,
1734 ::NotifyWinEvent((DWORD
) eventType
, (HWND
) window
->GetHWND(),
1735 (LONG
) objectType
, (LONG
) objectId
);
1740 // Convert to Windows role
1741 int wxConvertToWindowsRole(wxAccRole wxrole
)
1745 case wxROLE_SYSTEM_ALERT
:
1746 return ROLE_SYSTEM_ALERT
;
1747 case wxROLE_SYSTEM_ANIMATION
:
1748 return ROLE_SYSTEM_ANIMATION
;
1749 case wxROLE_SYSTEM_APPLICATION
:
1750 return ROLE_SYSTEM_APPLICATION
;
1751 case wxROLE_SYSTEM_BORDER
:
1752 return ROLE_SYSTEM_BORDER
;
1753 case wxROLE_SYSTEM_BUTTONDROPDOWN
:
1754 return ROLE_SYSTEM_BUTTONDROPDOWN
;
1755 case wxROLE_SYSTEM_BUTTONDROPDOWNGRID
:
1756 return ROLE_SYSTEM_BUTTONDROPDOWNGRID
;
1757 case wxROLE_SYSTEM_BUTTONMENU
:
1758 return ROLE_SYSTEM_BUTTONMENU
;
1759 case wxROLE_SYSTEM_CARET
:
1760 return ROLE_SYSTEM_CARET
;
1761 case wxROLE_SYSTEM_CELL
:
1762 return ROLE_SYSTEM_CELL
;
1763 case wxROLE_SYSTEM_CHARACTER
:
1764 return ROLE_SYSTEM_CHARACTER
;
1765 case wxROLE_SYSTEM_CHART
:
1766 return ROLE_SYSTEM_CHART
;
1767 case wxROLE_SYSTEM_CHECKBUTTON
:
1768 return ROLE_SYSTEM_CHECKBUTTON
;
1769 case wxROLE_SYSTEM_CLIENT
:
1770 return ROLE_SYSTEM_CLIENT
;
1771 case wxROLE_SYSTEM_CLOCK
:
1772 return ROLE_SYSTEM_CLOCK
;
1773 case wxROLE_SYSTEM_COLUMN
:
1774 return ROLE_SYSTEM_COLUMN
;
1775 case wxROLE_SYSTEM_COLUMNHEADER
:
1776 return ROLE_SYSTEM_COLUMNHEADER
;
1777 case wxROLE_SYSTEM_COMBOBOX
:
1778 return ROLE_SYSTEM_COMBOBOX
;
1779 case wxROLE_SYSTEM_CURSOR
:
1780 return ROLE_SYSTEM_CURSOR
;
1781 case wxROLE_SYSTEM_DIAGRAM
:
1782 return ROLE_SYSTEM_DIAGRAM
;
1783 case wxROLE_SYSTEM_DIAL
:
1784 return ROLE_SYSTEM_DIAL
;
1785 case wxROLE_SYSTEM_DIALOG
:
1786 return ROLE_SYSTEM_DIALOG
;
1787 case wxROLE_SYSTEM_DOCUMENT
:
1788 return ROLE_SYSTEM_DOCUMENT
;
1789 case wxROLE_SYSTEM_DROPLIST
:
1790 return ROLE_SYSTEM_DROPLIST
;
1791 case wxROLE_SYSTEM_EQUATION
:
1792 return ROLE_SYSTEM_EQUATION
;
1793 case wxROLE_SYSTEM_GRAPHIC
:
1794 return ROLE_SYSTEM_GRAPHIC
;
1795 case wxROLE_SYSTEM_GRIP
:
1796 return ROLE_SYSTEM_GRIP
;
1797 case wxROLE_SYSTEM_GROUPING
:
1798 return ROLE_SYSTEM_GROUPING
;
1799 case wxROLE_SYSTEM_HELPBALLOON
:
1800 return ROLE_SYSTEM_HELPBALLOON
;
1801 case wxROLE_SYSTEM_HOTKEYFIELD
:
1802 return ROLE_SYSTEM_HOTKEYFIELD
;
1803 case wxROLE_SYSTEM_INDICATOR
:
1804 return ROLE_SYSTEM_INDICATOR
;
1805 case wxROLE_SYSTEM_LINK
:
1806 return ROLE_SYSTEM_LINK
;
1807 case wxROLE_SYSTEM_LIST
:
1808 return ROLE_SYSTEM_LIST
;
1809 case wxROLE_SYSTEM_LISTITEM
:
1810 return ROLE_SYSTEM_LISTITEM
;
1811 case wxROLE_SYSTEM_MENUBAR
:
1812 return ROLE_SYSTEM_MENUBAR
;
1813 case wxROLE_SYSTEM_MENUITEM
:
1814 return ROLE_SYSTEM_MENUITEM
;
1815 case wxROLE_SYSTEM_MENUPOPUP
:
1816 return ROLE_SYSTEM_MENUPOPUP
;
1817 case wxROLE_SYSTEM_OUTLINE
:
1818 return ROLE_SYSTEM_OUTLINE
;
1819 case wxROLE_SYSTEM_OUTLINEITEM
:
1820 return ROLE_SYSTEM_OUTLINEITEM
;
1821 case wxROLE_SYSTEM_PAGETAB
:
1822 return ROLE_SYSTEM_PAGETAB
;
1823 case wxROLE_SYSTEM_PAGETABLIST
:
1824 return ROLE_SYSTEM_PAGETABLIST
;
1825 case wxROLE_SYSTEM_PANE
:
1826 return ROLE_SYSTEM_PANE
;
1827 case wxROLE_SYSTEM_PROGRESSBAR
:
1828 return ROLE_SYSTEM_PROGRESSBAR
;
1829 case wxROLE_SYSTEM_PROPERTYPAGE
:
1830 return ROLE_SYSTEM_PROPERTYPAGE
;
1831 case wxROLE_SYSTEM_PUSHBUTTON
:
1832 return ROLE_SYSTEM_PUSHBUTTON
;
1833 case wxROLE_SYSTEM_RADIOBUTTON
:
1834 return ROLE_SYSTEM_RADIOBUTTON
;
1835 case wxROLE_SYSTEM_ROW
:
1836 return ROLE_SYSTEM_ROW
;
1837 case wxROLE_SYSTEM_ROWHEADER
:
1838 return ROLE_SYSTEM_ROWHEADER
;
1839 case wxROLE_SYSTEM_SCROLLBAR
:
1840 return ROLE_SYSTEM_SCROLLBAR
;
1841 case wxROLE_SYSTEM_SEPARATOR
:
1842 return ROLE_SYSTEM_SEPARATOR
;
1843 case wxROLE_SYSTEM_SLIDER
:
1844 return ROLE_SYSTEM_SLIDER
;
1845 case wxROLE_SYSTEM_SOUND
:
1846 return ROLE_SYSTEM_SOUND
;
1847 case wxROLE_SYSTEM_SPINBUTTON
:
1848 return ROLE_SYSTEM_SPINBUTTON
;
1849 case wxROLE_SYSTEM_STATICTEXT
:
1850 return ROLE_SYSTEM_STATICTEXT
;
1851 case wxROLE_SYSTEM_STATUSBAR
:
1852 return ROLE_SYSTEM_STATUSBAR
;
1853 case wxROLE_SYSTEM_TABLE
:
1854 return ROLE_SYSTEM_TABLE
;
1855 case wxROLE_SYSTEM_TEXT
:
1856 return ROLE_SYSTEM_TEXT
;
1857 case wxROLE_SYSTEM_TITLEBAR
:
1858 return ROLE_SYSTEM_TITLEBAR
;
1859 case wxROLE_SYSTEM_TOOLBAR
:
1860 return ROLE_SYSTEM_TOOLBAR
;
1861 case wxROLE_SYSTEM_TOOLTIP
:
1862 return ROLE_SYSTEM_TOOLTIP
;
1863 case wxROLE_SYSTEM_WHITESPACE
:
1864 return ROLE_SYSTEM_WHITESPACE
;
1865 case wxROLE_SYSTEM_WINDOW
:
1866 return ROLE_SYSTEM_WINDOW
;
1871 // Convert to Windows state
1872 long wxConvertToWindowsState(long wxstate
)
1875 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_HIGH
)
1876 state
|= STATE_SYSTEM_ALERT_HIGH
;
1878 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_MEDIUM
)
1879 state
|= STATE_SYSTEM_ALERT_MEDIUM
;
1881 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_LOW
)
1882 state
|= STATE_SYSTEM_ALERT_LOW
;
1884 if (wxstate
& wxACC_STATE_SYSTEM_ANIMATED
)
1885 state
|= STATE_SYSTEM_ANIMATED
;
1887 if (wxstate
& wxACC_STATE_SYSTEM_BUSY
)
1888 state
|= STATE_SYSTEM_BUSY
;
1890 if (wxstate
& wxACC_STATE_SYSTEM_CHECKED
)
1891 state
|= STATE_SYSTEM_CHECKED
;
1893 if (wxstate
& wxACC_STATE_SYSTEM_COLLAPSED
)
1894 state
|= STATE_SYSTEM_COLLAPSED
;
1896 if (wxstate
& wxACC_STATE_SYSTEM_DEFAULT
)
1897 state
|= STATE_SYSTEM_DEFAULT
;
1899 if (wxstate
& wxACC_STATE_SYSTEM_EXPANDED
)
1900 state
|= STATE_SYSTEM_EXPANDED
;
1902 if (wxstate
& wxACC_STATE_SYSTEM_EXTSELECTABLE
)
1903 state
|= STATE_SYSTEM_EXTSELECTABLE
;
1905 if (wxstate
& wxACC_STATE_SYSTEM_FLOATING
)
1906 state
|= STATE_SYSTEM_FLOATING
;
1908 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSABLE
)
1909 state
|= STATE_SYSTEM_FOCUSABLE
;
1911 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSED
)
1912 state
|= STATE_SYSTEM_FOCUSED
;
1914 if (wxstate
& wxACC_STATE_SYSTEM_HOTTRACKED
)
1915 state
|= STATE_SYSTEM_HOTTRACKED
;
1917 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1918 state
|= STATE_SYSTEM_INVISIBLE
;
1920 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1921 state
|= STATE_SYSTEM_INVISIBLE
;
1923 if (wxstate
& wxACC_STATE_SYSTEM_MIXED
)
1924 state
|= STATE_SYSTEM_MIXED
;
1926 if (wxstate
& wxACC_STATE_SYSTEM_MULTISELECTABLE
)
1927 state
|= STATE_SYSTEM_MULTISELECTABLE
;
1929 if (wxstate
& wxACC_STATE_SYSTEM_OFFSCREEN
)
1930 state
|= STATE_SYSTEM_OFFSCREEN
;
1932 if (wxstate
& wxACC_STATE_SYSTEM_PRESSED
)
1933 state
|= STATE_SYSTEM_PRESSED
;
1935 // if (wxstate & wxACC_STATE_SYSTEM_PROTECTED)
1936 // state |= STATE_SYSTEM_PROTECTED;
1938 if (wxstate
& wxACC_STATE_SYSTEM_READONLY
)
1939 state
|= STATE_SYSTEM_READONLY
;
1941 if (wxstate
& wxACC_STATE_SYSTEM_SELECTABLE
)
1942 state
|= STATE_SYSTEM_SELECTABLE
;
1944 if (wxstate
& wxACC_STATE_SYSTEM_SELECTED
)
1945 state
|= STATE_SYSTEM_SELECTED
;
1947 if (wxstate
& wxACC_STATE_SYSTEM_SELFVOICING
)
1948 state
|= STATE_SYSTEM_SELFVOICING
;
1950 if (wxstate
& wxACC_STATE_SYSTEM_UNAVAILABLE
)
1951 state
|= STATE_SYSTEM_UNAVAILABLE
;
1956 // Convert to Windows selection flag
1957 int wxConvertToWindowsSelFlag(wxAccSelectionFlags wxsel
)
1961 if (wxsel
& wxACC_SEL_TAKEFOCUS
)
1962 sel
|= SELFLAG_TAKEFOCUS
;
1963 if (wxsel
& wxACC_SEL_TAKESELECTION
)
1964 sel
|= SELFLAG_TAKESELECTION
;
1965 if (wxsel
& wxACC_SEL_EXTENDSELECTION
)
1966 sel
|= SELFLAG_EXTENDSELECTION
;
1967 if (wxsel
& wxACC_SEL_ADDSELECTION
)
1968 sel
|= SELFLAG_ADDSELECTION
;
1969 if (wxsel
& wxACC_SEL_REMOVESELECTION
)
1970 sel
|= SELFLAG_REMOVESELECTION
;
1974 // Convert from Windows selection flag
1975 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
)
1979 if (sel
& SELFLAG_TAKEFOCUS
)
1980 wxsel
|= wxACC_SEL_TAKEFOCUS
;
1981 if (sel
& SELFLAG_TAKESELECTION
)
1982 wxsel
|= wxACC_SEL_TAKESELECTION
;
1983 if (sel
& SELFLAG_EXTENDSELECTION
)
1984 wxsel
|= wxACC_SEL_EXTENDSELECTION
;
1985 if (sel
& SELFLAG_ADDSELECTION
)
1986 wxsel
|= wxACC_SEL_ADDSELECTION
;
1987 if (sel
& SELFLAG_REMOVESELECTION
)
1988 wxsel
|= wxACC_SEL_REMOVESELECTION
;
1989 return (wxAccSelectionFlags
) wxsel
;
1993 #endif // wxUSE_OLE && wxUSE_ACCESSIBILITY