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__)
51 #include "wx/msw/ole/oleutils.h"
54 #define CHILDID_SELF 0
58 #define OBJID_CLIENT 0xFFFFFFFC
61 // Convert to Windows role
62 int wxConvertToWindowsRole(wxAccRole wxrole
);
64 // Convert to Windows state
65 long wxConvertToWindowsState(long wxstate
);
67 // Convert to Windows selection flag
68 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel
);
70 // Convert from Windows selection flag
71 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
);
73 // ----------------------------------------------------------------------------
74 // wxIEnumVARIANT interface implementation
75 // ----------------------------------------------------------------------------
77 class wxIEnumVARIANT
: public IEnumVARIANT
80 wxIEnumVARIANT(const wxVariant
& variant
);
83 DECLARE_IUNKNOWN_METHODS
;
86 STDMETHODIMP
Next(ULONG celt
, VARIANT
*rgelt
, ULONG
*pceltFetched
);
87 STDMETHODIMP
Skip(ULONG celt
);
89 STDMETHODIMP
Clone(IEnumVARIANT
**ppenum
);
92 wxVariant m_variant
; // List of further variants
93 int m_nCurrent
; // Current enum position
95 DECLARE_NO_COPY_CLASS(wxIEnumVARIANT
)
98 // ----------------------------------------------------------------------------
100 // ----------------------------------------------------------------------------
102 BEGIN_IID_TABLE(wxIEnumVARIANT
)
107 IMPLEMENT_IUNKNOWN_METHODS(wxIEnumVARIANT
)
109 // wxVariant contains a list of further variants.
110 wxIEnumVARIANT::wxIEnumVARIANT(const wxVariant
& variant
)
115 STDMETHODIMP
wxIEnumVARIANT::Next(ULONG celt
,
119 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Next"));
122 // we only return 1 element at a time - mainly because I'm too lazy to
123 // implement something which you're never asked for anyhow
127 if (m_variant
.GetType() != wxT("list"))
130 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() ) {
131 if (!wxConvertVariantToOle(m_variant
[m_nCurrent
++], rgelt
[0]))
136 // TODO: should we AddRef if this is an object?
147 STDMETHODIMP
wxIEnumVARIANT::Skip(ULONG celt
)
149 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Skip"));
151 if (m_variant
.GetType() != wxT("list"))
155 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() )
158 // no, can't skip this many elements
164 STDMETHODIMP
wxIEnumVARIANT::Reset()
166 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Reset"));
173 STDMETHODIMP
wxIEnumVARIANT::Clone(IEnumVARIANT
**ppenum
)
175 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Clone"));
177 wxIEnumVARIANT
*pNew
= new wxIEnumVARIANT(m_variant
);
185 // ----------------------------------------------------------------------------
186 // wxIAccessible implementation of IAccessible interface
187 // ----------------------------------------------------------------------------
189 class wxIAccessible
: public IAccessible
192 wxIAccessible(wxAccessible
*pAccessible
);
194 DECLARE_IUNKNOWN_METHODS
;
198 // Navigation and Hierarchy
200 // Retrieves the child element or child object at a given point on the screen.
201 // All visual objects support this method; sound objects do not support it.
203 STDMETHODIMP
accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
);
205 // Retrieves the specified object's current screen location. All visual objects must
206 // support this method; sound objects do not support it.
208 STDMETHODIMP
accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
);
210 // Traverses to another user interface element within a container and retrieves the object.
211 // All visual objects must support this method.
213 STDMETHODIMP
accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
);
215 // Retrieves the address of an IDispatch interface for the specified child.
216 // All objects must support this property.
218 STDMETHODIMP
get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
);
220 // Retrieves the number of children that belong to this object.
221 // All objects must support this property.
223 STDMETHODIMP
get_accChildCount ( long* pCountChildren
);
225 // Retrieves the IDispatch interface of the object's parent.
226 // All objects support this property.
228 STDMETHODIMP
get_accParent ( IDispatch
** ppDispParent
);
230 // Descriptive Properties and Methods
232 // Performs the object's default action. Not all objects have a default
235 STDMETHODIMP
accDoDefaultAction(VARIANT varID
);
237 // Retrieves a string that describes the object's default action.
238 // Not all objects have a default action.
240 STDMETHODIMP
get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
);
242 // Retrieves a string that describes the visual appearance of the specified object.
243 // Not all objects have a description.
245 STDMETHODIMP
get_accDescription ( VARIANT varID
, BSTR
* pszDescription
);
247 // Retrieves an object's Help property string.
248 // Not all objects support this property.
250 STDMETHODIMP
get_accHelp ( VARIANT varID
, BSTR
* pszHelp
);
252 // Retrieves the full path of the WinHelp file associated with the specified
253 // object and the identifier of the appropriate topic within that file.
254 // Not all objects support this property.
256 STDMETHODIMP
get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
);
258 // Retrieves the specified object's shortcut key or access key, also known as
259 // the mnemonic. All objects that have a shortcut key or access key support
262 STDMETHODIMP
get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
);
264 // Retrieves the name of the specified object.
265 // All objects support this property.
267 STDMETHODIMP
get_accName ( VARIANT varID
, BSTR
* pszName
);
269 // Retrieves information that describes the role of the specified object.
270 // All objects support this property.
272 STDMETHODIMP
get_accRole ( VARIANT varID
, VARIANT
* pVarRole
);
274 // Retrieves the current state of the specified object.
275 // All objects support this property.
277 STDMETHODIMP
get_accState ( VARIANT varID
, VARIANT
* pVarState
);
279 // Retrieves the value of the specified object.
280 // Not all objects have a value.
282 STDMETHODIMP
get_accValue ( VARIANT varID
, BSTR
* pszValue
);
284 // Selection and Focus
286 // Modifies the selection or moves the keyboard focus of the
287 // specified object. All objects that select or receive the
288 // keyboard focus must support this method.
290 STDMETHODIMP
accSelect ( long flagsSelect
, VARIANT varID
);
292 // Retrieves the object that has the keyboard focus. All objects
293 // that receive the keyboard focus must support this property.
295 STDMETHODIMP
get_accFocus ( VARIANT
* pVarID
);
297 // Retrieves the selected children of this object. All objects
298 // selected must support this property.
300 STDMETHODIMP
get_accSelection ( VARIANT
* pVarChildren
);
304 STDMETHODIMP
put_accName(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
305 STDMETHODIMP
put_accValue(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
311 STDMETHODIMP
GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
);
313 // Get type info count
315 STDMETHODIMP
GetTypeInfoCount(unsigned int* typeInfoCount
);
319 STDMETHODIMP
GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
320 LCID lcid
, DISPID
* dispId
);
324 STDMETHODIMP
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
325 WORD wFlags
, DISPPARAMS
*pDispParams
,
326 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
327 unsigned int *puArgErr
);
331 // Gets the standard IAccessible interface for the given child or object.
332 // Call Release if this is non-NULL.
333 IAccessible
* GetChildStdAccessible(int id
);
335 // Gets the IAccessible interface for the given child or object.
336 // Call Release if this is non-NULL.
337 IAccessible
* GetChildAccessible(int id
);
340 wxAccessible
*m_pAccessible
; // pointer to C++ class we belong to
342 DECLARE_NO_COPY_CLASS(wxIAccessible
)
345 // ============================================================================
347 // ============================================================================
349 // ----------------------------------------------------------------------------
350 // wxIAccessible implementation
351 // ----------------------------------------------------------------------------
352 BEGIN_IID_TABLE(wxIAccessible
)
358 IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible
)
360 wxIAccessible::wxIAccessible(wxAccessible
*pAccessible
)
362 wxASSERT( pAccessible
!= NULL
);
364 m_pAccessible
= pAccessible
;
367 // Retrieves the child element or child object at a given point on the screen.
368 // All visual objects support this method; sound objects do not support it.
370 STDMETHODIMP
wxIAccessible::accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
)
372 wxLogDebug("accHitTest");
373 wxASSERT (m_pAccessible
!= NULL
);
377 wxAccessible
* childObject
= NULL
;
381 wxAccStatus status
= m_pAccessible
->HitTest(wxPoint(xLeft
, yLeft
), & childId
, & childObject
);
383 if (status
== wxACC_FAIL
)
386 if (status
== wxACC_NOT_IMPLEMENTED
)
388 // Use standard interface instead.
389 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
393 return stdInterface
->accHitTest(xLeft
, yLeft
, pVarID
);
398 if (childObject
== m_pAccessible
)
401 pVarID
->lVal
= CHILDID_SELF
;
406 wxIAccessible
* childIA
= childObject
->GetIAccessible();
410 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
413 pVarID
->vt
= VT_DISPATCH
;
417 else if (childId
> 0)
420 pVarID
->lVal
= childId
;
425 pVarID
->vt
= VT_EMPTY
;
432 // Retrieves the specified object's current screen location. All visual objects must
433 // support this method; sound objects do not support it.
435 STDMETHODIMP
wxIAccessible::accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
)
437 wxLogDebug("accLocation");
438 wxASSERT (m_pAccessible
!= NULL
);
444 wxAccStatus status
= m_pAccessible
->GetLocation(rect
, varID
.lVal
);
445 if (status
== wxACC_FAIL
)
448 if (status
== wxACC_NOT_IMPLEMENTED
)
450 // Try to use child object directly.
453 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
457 HRESULT hResult
= childAccessible
->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
458 childAccessible
->Release();
461 else if (m_pAccessible
->GetIAccessibleStd())
462 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
464 else if (m_pAccessible
->GetIAccessibleStd())
465 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
471 *pcxWidth
= rect
.width
;
472 *pcyHeight
= rect
.height
;
479 // Traverses to another user interface element within a container and retrieves the object.
480 // All visual objects must support this method.
482 STDMETHODIMP
wxIAccessible::accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
)
484 wxASSERT (m_pAccessible
!= NULL
);
487 wxLogDebug(wxString(wxT("accNavigate for ")) + m_pAccessible
->GetWindow()->GetClassInfo()->GetClassName());
489 if ((varStart
.vt
!= VT_I4
&& varStart
.vt
!= VT_EMPTY
) || varStart
.vt
< 0)
491 wxLogDebug("Invalid arg for accNavigate");
495 wxAccessible
* elementObject
= NULL
;
497 VariantInit(pVarEnd
);
498 wxNavDir navDirWX
= wxNAVDIR_FIRSTCHILD
;
505 navDirWX
= wxNAVDIR_DOWN
;
506 navStr
= wxT("wxNAVDIR_DOWN");
509 case NAVDIR_FIRSTCHILD
:
510 navDirWX
= wxNAVDIR_FIRSTCHILD
;
511 navStr
= wxT("wxNAVDIR_FIRSTCHILD");
514 case NAVDIR_LASTCHILD
:
515 navDirWX
= wxNAVDIR_LASTCHILD
;
516 navStr
= wxT("wxNAVDIR_LASTCHILD");
520 navDirWX
= wxNAVDIR_LEFT
;
521 navStr
= wxT("wxNAVDIR_LEFT");
525 navDirWX
= wxNAVDIR_NEXT
;
526 navStr
= wxT("wxNAVDIR_NEXT");
529 case NAVDIR_PREVIOUS
:
530 navDirWX
= wxNAVDIR_PREVIOUS
;
531 navStr
= wxT("wxNAVDIR_PREVIOUS");
535 navDirWX
= wxNAVDIR_RIGHT
;
536 navStr
= wxT("wxNAVDIR_RIGHT");
540 navDirWX
= wxNAVDIR_UP
;
541 navStr
= wxT("wxNAVDIR_UP");
545 wxLogDebug(wxT("Unknown NAVDIR symbol"));
551 wxAccStatus status
= m_pAccessible
->Navigate(navDirWX
, varStart
.lVal
, & elementId
,
554 if (status
== wxACC_FAIL
)
556 wxLogDebug("wxAccessible::Navigate failed");
560 if (status
== wxACC_FALSE
)
562 wxLogDebug("wxAccessible::Navigate found no object in this direction");
566 if (status
== wxACC_NOT_IMPLEMENTED
)
568 wxLogDebug("Navigate not implemented");
570 // Try to use child object directly.
571 if (varStart
.vt
== VT_I4
&& varStart
.lVal
> 0)
573 IAccessible
* childAccessible
= GetChildAccessible(varStart
.lVal
);
577 HRESULT hResult
= childAccessible
->accNavigate(navDir
, varStart
, pVarEnd
);
578 childAccessible
->Release();
581 else if (m_pAccessible
->GetIAccessibleStd())
582 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
584 else if (m_pAccessible
->GetIAccessibleStd())
585 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
591 wxLogDebug("Getting wxIAccessible and calling QueryInterface for Navigate");
592 wxIAccessible
* objectIA
= elementObject
->GetIAccessible();
595 wxLogDebug("No wxIAccessible");
599 HRESULT hResult
= objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarEnd
->pdispVal
);
602 wxLogDebug("QueryInterface failed");
606 wxLogDebug("Called QueryInterface for Navigate");
607 pVarEnd
->vt
= VT_DISPATCH
;
610 else if (elementId
> 0)
612 wxLogDebug("Returning element id from Navigate");
614 pVarEnd
->lVal
= elementId
;
619 wxLogDebug("No object in accNavigate");
620 pVarEnd
->vt
= VT_EMPTY
;
625 wxLogDebug("Failing Navigate");
629 // Retrieves the address of an IDispatch interface for the specified child.
630 // All objects must support this property.
632 STDMETHODIMP
wxIAccessible::get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
)
634 wxLogDebug("get_accChild");
635 wxASSERT (m_pAccessible
!= NULL
);
639 if (varChildID
.vt
!= VT_I4
)
641 wxLogDebug("Invalid arg for get_accChild");
645 if (varChildID
.lVal
== CHILDID_SELF
)
652 wxAccessible
* child
= NULL
;
654 wxAccStatus status
= m_pAccessible
->GetChild(varChildID
.lVal
, & child
);
655 if (status
== wxACC_FAIL
)
657 wxLogDebug("GetChild failed");
661 if (status
== wxACC_NOT_IMPLEMENTED
)
663 // Use standard interface instead.
664 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
669 wxLogDebug("Using standard interface for get_accChild");
670 return stdInterface
->get_accChild (varChildID
, ppDispChild
);
677 wxIAccessible
* objectIA
= child
->GetIAccessible();
681 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispChild
) != S_OK
)
683 wxLogDebug("QueryInterface failed in get_accChild");
691 wxLogDebug("Not an accessible object");
692 return S_FALSE
; // Indicates it's not an accessible object
699 // Retrieves the number of children that belong to this object.
700 // All objects must support this property.
702 STDMETHODIMP
wxIAccessible::get_accChildCount ( long* pCountChildren
)
704 wxLogDebug("get_accChildCount");
705 wxASSERT (m_pAccessible
!= NULL
);
710 wxAccStatus status
= m_pAccessible
->GetChildCount(& childCount
);
711 if (status
== wxACC_FAIL
)
714 if (status
== wxACC_NOT_IMPLEMENTED
)
716 // Use standard interface instead.
717 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
722 wxLogDebug("Using standard interface for get_accChildCount");
723 HRESULT res
= stdInterface
->get_accChildCount (pCountChildren
);
725 str
.Printf(wxT("Number of children was %d"), (int) (*pCountChildren
));
732 * pCountChildren
= (long) childCount
;
739 // Retrieves the IDispatch interface of the object's parent.
740 // All objects support this property.
742 STDMETHODIMP
wxIAccessible::get_accParent ( IDispatch
** ppDispParent
)
744 wxLogDebug("get_accParent");
745 wxASSERT (m_pAccessible
!= NULL
);
749 wxAccessible
* parent
= NULL
;
750 wxAccStatus status
= m_pAccessible
->GetParent(& parent
);
752 if (status
== wxACC_FAIL
)
755 // It doesn't seem acceptable to return S_FALSE with a NULL
756 // ppDispParent, so if we have no wxWindows parent, we leave
757 // it to the standard interface.
758 if (status
== wxACC_NOT_IMPLEMENTED
|| !parent
)
760 wxLogDebug("Using standard interface to get the parent.");
761 // Use standard interface instead.
762 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
766 return stdInterface
->get_accParent (ppDispParent
);
772 wxIAccessible
* objectIA
= parent
->GetIAccessible();
776 wxLogDebug("About to call QueryInterface");
777 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispParent
) != S_OK
)
779 wxLogDebug("Failed QueryInterface");
783 wxLogDebug("Returning S_OK for get_accParent");
788 // This doesn't seem to be allowed, despite the documentation,
789 // so we handle it higher up by using the standard interface.
790 wxLogDebug("Returning NULL parent because there was none");
791 *ppDispParent
= NULL
;
799 // Performs the object's default action. Not all objects have a default
802 STDMETHODIMP
wxIAccessible::accDoDefaultAction(VARIANT varID
)
804 wxLogDebug("accDoDefaultAction");
805 wxASSERT (m_pAccessible
!= NULL
);
809 if (varID
.vt
!= VT_I4
)
811 wxLogDebug("Invalid arg for accDoDefaultAction");
815 wxAccStatus status
= m_pAccessible
->DoDefaultAction(varID
.lVal
);
816 if (status
== wxACC_FAIL
)
819 if (status
== wxACC_NOT_SUPPORTED
)
820 return DISP_E_MEMBERNOTFOUND
;
822 if (status
== wxACC_NOT_IMPLEMENTED
)
824 // Try to use child object directly.
827 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
831 HRESULT hResult
= childAccessible
->accDoDefaultAction(varID
);
832 childAccessible
->Release();
835 else if (m_pAccessible
->GetIAccessibleStd())
836 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
838 else if (m_pAccessible
->GetIAccessibleStd())
839 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
844 // Retrieves a string that describes the object's default action.
845 // Not all objects have a default action.
847 STDMETHODIMP
wxIAccessible::get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
)
849 wxLogDebug("get_accDefaultAction");
850 wxASSERT (m_pAccessible
!= NULL
);
854 if (varID
.vt
!= VT_I4
)
856 wxLogDebug("Invalid arg for get_accDefaultAction");
860 wxString defaultAction
;
861 wxAccStatus status
= m_pAccessible
->GetDefaultAction(varID
.lVal
, & defaultAction
);
862 if (status
== wxACC_FAIL
)
865 if (status
== wxACC_NOT_SUPPORTED
)
866 return DISP_E_MEMBERNOTFOUND
;
868 if (status
== wxACC_NOT_IMPLEMENTED
)
870 // Try to use child object directly.
873 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
877 HRESULT hResult
= childAccessible
->get_accDefaultAction(varID
, pszDefaultAction
);
878 childAccessible
->Release();
881 else if (m_pAccessible
->GetIAccessibleStd())
882 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
884 else if (m_pAccessible
->GetIAccessibleStd())
885 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
889 if (defaultAction
.IsEmpty())
891 * pszDefaultAction
= NULL
;
896 wxBasicString
basicString(defaultAction
);
897 * pszDefaultAction
= basicString
.Get();
904 // Retrieves a string that describes the visual appearance of the specified object.
905 // Not all objects have a description.
907 STDMETHODIMP
wxIAccessible::get_accDescription ( VARIANT varID
, BSTR
* pszDescription
)
909 wxLogDebug("get_accDescription");
910 wxASSERT (m_pAccessible
!= NULL
);
914 if (varID
.vt
!= VT_I4
)
916 wxLogDebug("Invalid arg for get_accDescription");
920 wxString description
;
921 wxAccStatus status
= m_pAccessible
->GetDescription(varID
.lVal
, & description
);
922 if (status
== wxACC_FAIL
)
925 if (status
== wxACC_NOT_IMPLEMENTED
)
927 // Try to use child object directly.
930 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
934 HRESULT hResult
= childAccessible
->get_accDescription(varID
, pszDescription
);
935 childAccessible
->Release();
938 else if (m_pAccessible
->GetIAccessibleStd())
939 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
941 else if (m_pAccessible
->GetIAccessibleStd())
942 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
946 if (description
.IsEmpty())
948 * pszDescription
= NULL
;
953 wxBasicString
basicString(description
);
954 * pszDescription
= basicString
.Get();
961 // Retrieves an object's Help property string.
962 // Not all objects support this property.
964 STDMETHODIMP
wxIAccessible::get_accHelp ( VARIANT varID
, BSTR
* pszHelp
)
966 wxLogDebug("get_accHelp");
967 wxASSERT (m_pAccessible
!= NULL
);
971 if (varID
.vt
!= VT_I4
)
973 wxLogDebug("Invalid arg for get_accHelp");
978 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & helpString
);
979 if (status
== wxACC_FAIL
)
982 if (status
== wxACC_NOT_IMPLEMENTED
)
984 // Try to use child object directly.
987 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
991 HRESULT hResult
= childAccessible
->get_accHelp(varID
, pszHelp
);
992 childAccessible
->Release();
995 else if (m_pAccessible
->GetIAccessibleStd())
996 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp(varID
, pszHelp
);
998 else if (m_pAccessible
->GetIAccessibleStd())
999 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp (varID
, pszHelp
);
1003 if (helpString
.IsEmpty())
1010 wxBasicString
basicString(helpString
);
1011 * pszHelp
= basicString
.Get();
1018 // Retrieves the full path of the WinHelp file associated with the specified
1019 // object and the identifier of the appropriate topic within that file.
1020 // Not all objects support this property.
1021 // NOTE: not supported by wxWindows at this time. Use
1022 // GetHelpText instead.
1024 STDMETHODIMP
wxIAccessible::get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
)
1026 wxLogDebug("get_accHelpTopic");
1027 wxASSERT (m_pAccessible
!= NULL
);
1031 if (varChild
.vt
!= VT_I4
)
1033 wxLogDebug("Invalid arg for get_accHelpTopic");
1034 return E_INVALIDARG
;
1037 wxAccStatus status
= wxACC_NOT_IMPLEMENTED
;
1038 if (status
== wxACC_FAIL
)
1041 if (status
== wxACC_NOT_IMPLEMENTED
)
1043 // Try to use child object directly.
1044 if (varChild
.lVal
> 0)
1046 IAccessible
* childAccessible
= GetChildAccessible(varChild
.lVal
);
1047 if (childAccessible
)
1050 HRESULT hResult
= childAccessible
->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1051 childAccessible
->Release();
1054 else if (m_pAccessible
->GetIAccessibleStd())
1055 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1057 else if (m_pAccessible
->GetIAccessibleStd())
1058 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic (pszHelpFile
, varChild
, pidTopic
);
1063 // Retrieves the specified object's shortcut key or access key, also known as
1064 // the mnemonic. All objects that have a shortcut key or access key support
1067 STDMETHODIMP
wxIAccessible::get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
)
1069 wxLogDebug("get_accKeyboardShortcut");
1070 *pszKeyboardShortcut
= NULL
;
1072 wxASSERT (m_pAccessible
!= NULL
);
1076 if (varID
.vt
!= VT_I4
)
1078 wxLogDebug("Invalid arg for get_accKeyboardShortcut");
1079 return E_INVALIDARG
;
1082 wxString keyboardShortcut
;
1083 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & keyboardShortcut
);
1084 if (status
== wxACC_FAIL
)
1087 if (status
== wxACC_NOT_IMPLEMENTED
)
1089 // Try to use child object directly.
1092 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1093 if (childAccessible
)
1096 HRESULT hResult
= childAccessible
->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1097 childAccessible
->Release();
1100 else if (m_pAccessible
->GetIAccessibleStd())
1101 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1103 else if (m_pAccessible
->GetIAccessibleStd())
1104 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut (varID
, pszKeyboardShortcut
);
1108 if (keyboardShortcut
.IsEmpty())
1110 * pszKeyboardShortcut
= NULL
;
1115 wxBasicString
basicString(keyboardShortcut
);
1116 * pszKeyboardShortcut
= basicString
.Get();
1123 // Retrieves the name of the specified object.
1124 // All objects support this property.
1126 STDMETHODIMP
wxIAccessible::get_accName ( VARIANT varID
, BSTR
* pszName
)
1128 wxLogDebug("get_accName");
1131 wxASSERT (m_pAccessible
!= NULL
);
1135 if (varID
.vt
!= VT_I4
)
1137 wxLogDebug("Invalid arg for get_accName");
1138 return E_INVALIDARG
;
1143 wxAccStatus status
= m_pAccessible
->GetName(varID
.lVal
, & name
);
1145 if (status
== wxACC_FAIL
)
1148 if (status
== wxACC_NOT_IMPLEMENTED
)
1150 // Try to use child object directly.
1153 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1154 if (childAccessible
)
1157 HRESULT hResult
= childAccessible
->get_accName(varID
, pszName
);
1158 childAccessible
->Release();
1161 else if (m_pAccessible
->GetIAccessibleStd())
1162 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName(varID
, pszName
);
1164 else if (m_pAccessible
->GetIAccessibleStd())
1165 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName (varID
, pszName
);
1169 wxBasicString
basicString(name
);
1170 *pszName
= basicString
.Get();
1176 // Retrieves information that describes the role of the specified object.
1177 // All objects support this property.
1179 STDMETHODIMP
wxIAccessible::get_accRole ( VARIANT varID
, VARIANT
* pVarRole
)
1181 wxLogDebug("get_accRole");
1182 wxASSERT (m_pAccessible
!= NULL
);
1186 if (varID
.vt
!= VT_I4
)
1188 wxLogDebug("Invalid arg for get_accRole");
1189 return E_INVALIDARG
;
1192 VariantInit(pVarRole
);
1194 wxAccRole role
= wxROLE_NONE
;
1196 wxAccStatus status
= m_pAccessible
->GetRole(varID
.lVal
, & role
);
1198 if (status
== wxACC_FAIL
)
1201 if (status
== wxACC_NOT_IMPLEMENTED
)
1203 // Try to use child object directly.
1206 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1207 if (childAccessible
)
1210 HRESULT hResult
= childAccessible
->get_accRole(varID
, pVarRole
);
1211 childAccessible
->Release();
1214 else if (m_pAccessible
->GetIAccessibleStd())
1215 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole(varID
, pVarRole
);
1217 else if (m_pAccessible
->GetIAccessibleStd())
1218 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole (varID
, pVarRole
);
1222 if (role
== wxROLE_NONE
)
1224 pVarRole
->vt
= VT_EMPTY
;
1228 pVarRole
->lVal
= wxConvertToWindowsRole(role
);
1229 pVarRole
->vt
= VT_I4
;
1236 // Retrieves the current state of the specified object.
1237 // All objects support this property.
1239 STDMETHODIMP
wxIAccessible::get_accState ( VARIANT varID
, VARIANT
* pVarState
)
1241 wxLogDebug("get_accState");
1242 wxASSERT (m_pAccessible
!= NULL
);
1246 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1248 wxLogDebug("Invalid arg for get_accState");
1249 return E_INVALIDARG
;
1254 wxAccStatus status
= m_pAccessible
->GetState(varID
.lVal
, & wxstate
);
1255 if (status
== wxACC_FAIL
)
1258 if (status
== wxACC_NOT_IMPLEMENTED
)
1260 // Try to use child object directly.
1263 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1264 if (childAccessible
)
1267 HRESULT hResult
= childAccessible
->get_accState(varID
, pVarState
);
1268 childAccessible
->Release();
1271 else if (m_pAccessible
->GetIAccessibleStd())
1272 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState(varID
, pVarState
);
1274 else if (m_pAccessible
->GetIAccessibleStd())
1275 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState (varID
, pVarState
);
1279 long state
= wxConvertToWindowsState(wxstate
);
1280 pVarState
->lVal
= state
;
1281 pVarState
->vt
= VT_I4
;
1287 // Retrieves the value of the specified object.
1288 // Not all objects have a value.
1290 STDMETHODIMP
wxIAccessible::get_accValue ( VARIANT varID
, BSTR
* pszValue
)
1292 wxLogDebug("get_accValue");
1293 wxASSERT (m_pAccessible
!= NULL
);
1297 if (varID
.vt
!= VT_I4
)
1299 wxLogDebug("Invalid arg for get_accValue");
1300 return E_INVALIDARG
;
1305 wxAccStatus status
= m_pAccessible
->GetValue(varID
.lVal
, & strValue
);
1307 if (status
== wxACC_FAIL
)
1310 if (status
== wxACC_NOT_IMPLEMENTED
)
1312 // Try to use child object directly.
1315 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1316 if (childAccessible
)
1319 HRESULT hResult
= childAccessible
->get_accValue(varID
, pszValue
);
1320 childAccessible
->Release();
1323 else if (m_pAccessible
->GetIAccessibleStd())
1324 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue(varID
, pszValue
);
1326 else if (m_pAccessible
->GetIAccessibleStd())
1327 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue (varID
, pszValue
);
1331 wxBasicString
basicString(strValue
);
1332 * pszValue
= basicString
.Get();
1338 // Modifies the selection or moves the keyboard focus of the
1339 // specified object. All objects that select or receive the
1340 // keyboard focus must support this method.
1342 STDMETHODIMP
wxIAccessible::accSelect ( long flagsSelect
, VARIANT varID
)
1344 wxLogDebug("get_accSelect");
1345 wxASSERT (m_pAccessible
!= NULL
);
1349 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1351 wxLogDebug("Invalid arg for accSelect");
1352 return E_INVALIDARG
;
1355 wxAccSelectionFlags wxsel
= wxConvertFromWindowsSelFlag(flagsSelect
);
1357 wxAccStatus status
= m_pAccessible
->Select(varID
.lVal
, wxsel
);
1358 if (status
== wxACC_FAIL
)
1361 if (status
== wxACC_NOT_IMPLEMENTED
)
1363 // Try to use child object directly.
1364 if (varID
.lVal
> 0 && varID
.lVal
> 0)
1366 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1367 if (childAccessible
)
1370 HRESULT hResult
= childAccessible
->accSelect(flagsSelect
, varID
);
1371 childAccessible
->Release();
1374 else if (m_pAccessible
->GetIAccessibleStd())
1375 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1377 else if (m_pAccessible
->GetIAccessibleStd())
1378 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1386 // Retrieves the object that has the keyboard focus. All objects
1387 // that receive the keyboard focus must support this property.
1389 STDMETHODIMP
wxIAccessible::get_accFocus ( VARIANT
* pVarID
)
1391 wxLogDebug("get_accFocus");
1392 wxASSERT (m_pAccessible
!= NULL
);
1396 wxAccessible
* childObject
= NULL
;
1398 VariantInit(pVarID
);
1400 wxAccStatus status
= m_pAccessible
->GetFocus(& childId
, & childObject
);
1401 if (status
== wxACC_FAIL
)
1404 if (status
== wxACC_NOT_IMPLEMENTED
)
1406 // Use standard interface instead.
1407 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1411 return stdInterface
->get_accFocus (pVarID
);
1415 if (childObject
== m_pAccessible
)
1418 pVarID
->lVal
= CHILDID_SELF
;
1422 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1426 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
1429 pVarID
->vt
= VT_DISPATCH
;
1433 else if (childId
> 0)
1436 pVarID
->lVal
= childId
;
1441 pVarID
->vt
= VT_EMPTY
;
1448 // Retrieves the selected children of this object. All objects
1449 // selected must support this property.
1451 STDMETHODIMP
wxIAccessible::get_accSelection ( VARIANT
* pVarChildren
)
1453 wxLogDebug("get_accSelection");
1454 wxASSERT (m_pAccessible
!= NULL
);
1458 VariantInit(pVarChildren
);
1460 wxVariant selections
;
1461 wxAccStatus status
= m_pAccessible
->GetSelections(& selections
);
1462 if (status
== wxACC_FAIL
)
1465 if (status
== wxACC_NOT_IMPLEMENTED
)
1467 // Use standard interface instead.
1468 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1472 return stdInterface
->get_accSelection (pVarChildren
);
1476 if (selections
.GetType() == wxT("long"))
1478 pVarChildren
->vt
= VT_I4
;
1479 pVarChildren
->lVal
= selections
.GetLong();
1483 else if (selections
.GetType() == wxT("void*"))
1485 wxAccessible
* childObject
= (wxAccessible
*) selections
.GetVoidPtr();
1486 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1490 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarChildren
->pdispVal
) != S_OK
)
1493 pVarChildren
->vt
= VT_DISPATCH
;
1497 else if (selections
.GetType() == wxT("list"))
1499 // TODO: should we AddRef for every "void*" member??
1501 wxIEnumVARIANT
* enumVariant
= new wxIEnumVARIANT(selections
);
1502 enumVariant
->AddRef();
1504 pVarChildren
->vt
= VT_UNKNOWN
;
1505 pVarChildren
->punkVal
= enumVariant
;
1516 STDMETHODIMP
wxIAccessible::GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
)
1522 // Get type info count
1524 STDMETHODIMP
wxIAccessible::GetTypeInfoCount(unsigned int* typeInfoCount
)
1532 STDMETHODIMP
wxIAccessible::GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
1533 LCID lcid
, DISPID
* dispId
)
1540 STDMETHODIMP
wxIAccessible::Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
1541 WORD wFlags
, DISPPARAMS
*pDispParams
,
1542 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1543 unsigned int *puArgErr
)
1548 // Gets the standard IAccessible interface for the given child or object.
1549 // Call Release if this is non-NULL.
1550 IAccessible
* wxIAccessible::GetChildStdAccessible(int id
)
1554 IAccessible
* obj
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1565 IDispatch
* pDispatch
= NULL
;
1566 if (S_OK
== get_accChild ( var
, & pDispatch
))
1568 IAccessible
* childAccessible
= NULL
;
1569 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1571 pDispatch
->Release();
1572 wxIAccessible
* c
= (wxIAccessible
*) childAccessible
;
1573 IAccessible
* stdChildAccessible
= (IAccessible
*) c
->m_pAccessible
->GetIAccessibleStd();
1574 stdChildAccessible
->AddRef();
1575 childAccessible
->Release();
1576 return stdChildAccessible
;
1580 pDispatch
->Release();
1587 // Loop until we find the right id
1589 this->get_accChildCount(& nChildren
);
1592 for (i
= 0; i
< nChildren
; i
++)
1598 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1603 var
.vt
= VT_DISPATCH
;
1604 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1606 IAccessible
* childAccessible
= NULL
;
1607 if (var
.pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1609 var
.pdispVal
->Release();
1610 return childAccessible
;
1614 var
.pdispVal
->Release();
1626 // Gets the IAccessible interface for the given child or object.
1627 // Call Release if this is non-NULL.
1628 IAccessible
* wxIAccessible::GetChildAccessible(int id
)
1632 IAccessible
* obj
= this;
1643 IDispatch
* pDispatch
= NULL
;
1644 if (S_OK
== get_accChild ( var
, & pDispatch
))
1646 IAccessible
* childAccessible
= NULL
;
1647 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1649 pDispatch
->Release();
1650 return childAccessible
;
1654 pDispatch
->Release();
1661 // ----------------------------------------------------------------------------
1662 // wxAccessible implementation
1663 // ----------------------------------------------------------------------------
1667 // common part of all ctors
1668 void wxAccessible::Init()
1670 m_pIAccessibleStd
= NULL
;
1671 m_pIAccessible
= new wxIAccessible(this);
1672 m_pIAccessible
->AddRef();
1675 wxAccessible::wxAccessible(wxWindow
* win
)
1676 : wxAccessibleBase(win
)
1681 wxAccessible::~wxAccessible()
1683 m_pIAccessible
->Release();
1684 if (m_pIAccessibleStd
)
1685 ((IAccessible
*)m_pIAccessibleStd
)->Release();
1688 // Gets or creates a standard interface for this object.
1689 void* wxAccessible::GetIAccessibleStd()
1691 if (m_pIAccessibleStd
)
1692 return m_pIAccessibleStd
;
1696 HRESULT retCode
= ::CreateStdAccessibleObject((HWND
) GetWindow()->GetHWND(),
1697 OBJID_CLIENT
, IID_IAccessible
, (void**) & m_pIAccessibleStd
);
1698 if (retCode
== S_OK
)
1699 return m_pIAccessibleStd
;
1702 m_pIAccessibleStd
= NULL
;
1711 // Convert to Windows role
1712 int wxConvertToWindowsRole(wxAccRole wxrole
)
1716 case wxROLE_SYSTEM_ALERT
:
1717 return ROLE_SYSTEM_ALERT
;
1718 case wxROLE_SYSTEM_ANIMATION
:
1719 return ROLE_SYSTEM_ANIMATION
;
1720 case wxROLE_SYSTEM_APPLICATION
:
1721 return ROLE_SYSTEM_APPLICATION
;
1722 case wxROLE_SYSTEM_BORDER
:
1723 return ROLE_SYSTEM_BORDER
;
1724 case wxROLE_SYSTEM_BUTTONDROPDOWN
:
1725 return ROLE_SYSTEM_BUTTONDROPDOWN
;
1726 case wxROLE_SYSTEM_BUTTONDROPDOWNGRID
:
1727 return ROLE_SYSTEM_BUTTONDROPDOWNGRID
;
1728 case wxROLE_SYSTEM_BUTTONMENU
:
1729 return ROLE_SYSTEM_BUTTONMENU
;
1730 case wxROLE_SYSTEM_CARET
:
1731 return ROLE_SYSTEM_CARET
;
1732 case wxROLE_SYSTEM_CELL
:
1733 return ROLE_SYSTEM_CELL
;
1734 case wxROLE_SYSTEM_CHARACTER
:
1735 return ROLE_SYSTEM_CHARACTER
;
1736 case wxROLE_SYSTEM_CHART
:
1737 return ROLE_SYSTEM_CHART
;
1738 case wxROLE_SYSTEM_CHECKBUTTON
:
1739 return ROLE_SYSTEM_CHECKBUTTON
;
1740 case wxROLE_SYSTEM_CLIENT
:
1741 return ROLE_SYSTEM_CLIENT
;
1742 case wxROLE_SYSTEM_CLOCK
:
1743 return ROLE_SYSTEM_CLOCK
;
1744 case wxROLE_SYSTEM_COLUMN
:
1745 return ROLE_SYSTEM_COLUMN
;
1746 case wxROLE_SYSTEM_COLUMNHEADER
:
1747 return ROLE_SYSTEM_COLUMNHEADER
;
1748 case wxROLE_SYSTEM_COMBOBOX
:
1749 return ROLE_SYSTEM_COMBOBOX
;
1750 case wxROLE_SYSTEM_CURSOR
:
1751 return ROLE_SYSTEM_CURSOR
;
1752 case wxROLE_SYSTEM_DIAGRAM
:
1753 return ROLE_SYSTEM_DIAGRAM
;
1754 case wxROLE_SYSTEM_DIAL
:
1755 return ROLE_SYSTEM_DIAL
;
1756 case wxROLE_SYSTEM_DIALOG
:
1757 return ROLE_SYSTEM_DIALOG
;
1758 case wxROLE_SYSTEM_DOCUMENT
:
1759 return ROLE_SYSTEM_DOCUMENT
;
1760 case wxROLE_SYSTEM_DROPLIST
:
1761 return ROLE_SYSTEM_DROPLIST
;
1762 case wxROLE_SYSTEM_EQUATION
:
1763 return ROLE_SYSTEM_EQUATION
;
1764 case wxROLE_SYSTEM_GRAPHIC
:
1765 return ROLE_SYSTEM_GRAPHIC
;
1766 case wxROLE_SYSTEM_GRIP
:
1767 return ROLE_SYSTEM_GRIP
;
1768 case wxROLE_SYSTEM_GROUPING
:
1769 return ROLE_SYSTEM_GROUPING
;
1770 case wxROLE_SYSTEM_HELPBALLOON
:
1771 return ROLE_SYSTEM_HELPBALLOON
;
1772 case wxROLE_SYSTEM_HOTKEYFIELD
:
1773 return ROLE_SYSTEM_HOTKEYFIELD
;
1774 case wxROLE_SYSTEM_INDICATOR
:
1775 return ROLE_SYSTEM_INDICATOR
;
1776 case wxROLE_SYSTEM_LINK
:
1777 return ROLE_SYSTEM_LINK
;
1778 case wxROLE_SYSTEM_LIST
:
1779 return ROLE_SYSTEM_LIST
;
1780 case wxROLE_SYSTEM_LISTITEM
:
1781 return ROLE_SYSTEM_LISTITEM
;
1782 case wxROLE_SYSTEM_MENUBAR
:
1783 return ROLE_SYSTEM_MENUBAR
;
1784 case wxROLE_SYSTEM_MENUITEM
:
1785 return ROLE_SYSTEM_MENUITEM
;
1786 case wxROLE_SYSTEM_MENUPOPUP
:
1787 return ROLE_SYSTEM_MENUPOPUP
;
1788 case wxROLE_SYSTEM_OUTLINE
:
1789 return ROLE_SYSTEM_OUTLINE
;
1790 case wxROLE_SYSTEM_OUTLINEITEM
:
1791 return ROLE_SYSTEM_OUTLINEITEM
;
1792 case wxROLE_SYSTEM_PAGETAB
:
1793 return ROLE_SYSTEM_PAGETAB
;
1794 case wxROLE_SYSTEM_PAGETABLIST
:
1795 return ROLE_SYSTEM_PAGETABLIST
;
1796 case wxROLE_SYSTEM_PANE
:
1797 return ROLE_SYSTEM_PANE
;
1798 case wxROLE_SYSTEM_PROGRESSBAR
:
1799 return ROLE_SYSTEM_PROGRESSBAR
;
1800 case wxROLE_SYSTEM_PROPERTYPAGE
:
1801 return ROLE_SYSTEM_PROPERTYPAGE
;
1802 case wxROLE_SYSTEM_PUSHBUTTON
:
1803 return ROLE_SYSTEM_PUSHBUTTON
;
1804 case wxROLE_SYSTEM_RADIOBUTTON
:
1805 return ROLE_SYSTEM_RADIOBUTTON
;
1806 case wxROLE_SYSTEM_ROW
:
1807 return ROLE_SYSTEM_ROW
;
1808 case wxROLE_SYSTEM_ROWHEADER
:
1809 return ROLE_SYSTEM_ROWHEADER
;
1810 case wxROLE_SYSTEM_SCROLLBAR
:
1811 return ROLE_SYSTEM_SCROLLBAR
;
1812 case wxROLE_SYSTEM_SEPARATOR
:
1813 return ROLE_SYSTEM_SEPARATOR
;
1814 case wxROLE_SYSTEM_SLIDER
:
1815 return ROLE_SYSTEM_SLIDER
;
1816 case wxROLE_SYSTEM_SOUND
:
1817 return ROLE_SYSTEM_SOUND
;
1818 case wxROLE_SYSTEM_SPINBUTTON
:
1819 return ROLE_SYSTEM_SPINBUTTON
;
1820 case wxROLE_SYSTEM_STATICTEXT
:
1821 return ROLE_SYSTEM_STATICTEXT
;
1822 case wxROLE_SYSTEM_STATUSBAR
:
1823 return ROLE_SYSTEM_STATUSBAR
;
1824 case wxROLE_SYSTEM_TABLE
:
1825 return ROLE_SYSTEM_TABLE
;
1826 case wxROLE_SYSTEM_TEXT
:
1827 return ROLE_SYSTEM_TEXT
;
1828 case wxROLE_SYSTEM_TITLEBAR
:
1829 return ROLE_SYSTEM_TITLEBAR
;
1830 case wxROLE_SYSTEM_TOOLBAR
:
1831 return ROLE_SYSTEM_TOOLBAR
;
1832 case wxROLE_SYSTEM_TOOLTIP
:
1833 return ROLE_SYSTEM_TOOLTIP
;
1834 case wxROLE_SYSTEM_WHITESPACE
:
1835 return ROLE_SYSTEM_WHITESPACE
;
1836 case wxROLE_SYSTEM_WINDOW
:
1837 return ROLE_SYSTEM_WINDOW
;
1842 // Convert to Windows state
1843 long wxConvertToWindowsState(long wxstate
)
1846 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_HIGH
)
1847 state
|= STATE_SYSTEM_ALERT_HIGH
;
1849 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_MEDIUM
)
1850 state
|= STATE_SYSTEM_ALERT_MEDIUM
;
1852 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_LOW
)
1853 state
|= STATE_SYSTEM_ALERT_LOW
;
1855 if (wxstate
& wxACC_STATE_SYSTEM_ANIMATED
)
1856 state
|= STATE_SYSTEM_ANIMATED
;
1858 if (wxstate
& wxACC_STATE_SYSTEM_BUSY
)
1859 state
|= STATE_SYSTEM_BUSY
;
1861 if (wxstate
& wxACC_STATE_SYSTEM_CHECKED
)
1862 state
|= STATE_SYSTEM_CHECKED
;
1864 if (wxstate
& wxACC_STATE_SYSTEM_COLLAPSED
)
1865 state
|= STATE_SYSTEM_COLLAPSED
;
1867 if (wxstate
& wxACC_STATE_SYSTEM_DEFAULT
)
1868 state
|= STATE_SYSTEM_DEFAULT
;
1870 if (wxstate
& wxACC_STATE_SYSTEM_EXPANDED
)
1871 state
|= STATE_SYSTEM_EXPANDED
;
1873 if (wxstate
& wxACC_STATE_SYSTEM_EXTSELECTABLE
)
1874 state
|= STATE_SYSTEM_EXTSELECTABLE
;
1876 if (wxstate
& wxACC_STATE_SYSTEM_FLOATING
)
1877 state
|= STATE_SYSTEM_FLOATING
;
1879 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSABLE
)
1880 state
|= STATE_SYSTEM_FOCUSABLE
;
1882 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSED
)
1883 state
|= STATE_SYSTEM_FOCUSED
;
1885 if (wxstate
& wxACC_STATE_SYSTEM_HOTTRACKED
)
1886 state
|= STATE_SYSTEM_HOTTRACKED
;
1888 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1889 state
|= STATE_SYSTEM_INVISIBLE
;
1891 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1892 state
|= STATE_SYSTEM_INVISIBLE
;
1894 if (wxstate
& wxACC_STATE_SYSTEM_MIXED
)
1895 state
|= STATE_SYSTEM_MIXED
;
1897 if (wxstate
& wxACC_STATE_SYSTEM_MULTISELECTABLE
)
1898 state
|= STATE_SYSTEM_MULTISELECTABLE
;
1900 if (wxstate
& wxACC_STATE_SYSTEM_OFFSCREEN
)
1901 state
|= STATE_SYSTEM_OFFSCREEN
;
1903 if (wxstate
& wxACC_STATE_SYSTEM_PRESSED
)
1904 state
|= STATE_SYSTEM_PRESSED
;
1906 // if (wxstate & wxACC_STATE_SYSTEM_PROTECTED)
1907 // state |= STATE_SYSTEM_PROTECTED;
1909 if (wxstate
& wxACC_STATE_SYSTEM_READONLY
)
1910 state
|= STATE_SYSTEM_READONLY
;
1912 if (wxstate
& wxACC_STATE_SYSTEM_SELECTABLE
)
1913 state
|= STATE_SYSTEM_SELECTABLE
;
1915 if (wxstate
& wxACC_STATE_SYSTEM_SELECTED
)
1916 state
|= STATE_SYSTEM_SELECTED
;
1918 if (wxstate
& wxACC_STATE_SYSTEM_SELFVOICING
)
1919 state
|= STATE_SYSTEM_SELFVOICING
;
1921 if (wxstate
& wxACC_STATE_SYSTEM_UNAVAILABLE
)
1922 state
|= STATE_SYSTEM_UNAVAILABLE
;
1927 // Convert to Windows selection flag
1928 int wxConvertToWindowsSelFlag(wxAccSelectionFlags wxsel
)
1932 if (sel
& wxACC_SEL_TAKEFOCUS
)
1933 sel
|= SELFLAG_TAKEFOCUS
;
1934 if (sel
& wxACC_SEL_TAKESELECTION
)
1935 sel
|= SELFLAG_TAKESELECTION
;
1936 if (sel
& wxACC_SEL_EXTENDSELECTION
)
1937 sel
|= SELFLAG_EXTENDSELECTION
;
1938 if (sel
& wxACC_SEL_ADDSELECTION
)
1939 sel
|= SELFLAG_ADDSELECTION
;
1940 if (sel
& wxACC_SEL_REMOVESELECTION
)
1941 sel
|= SELFLAG_REMOVESELECTION
;
1945 // Convert from Windows selection flag
1946 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
)
1950 if (sel
& SELFLAG_TAKEFOCUS
)
1951 wxsel
|= wxACC_SEL_TAKEFOCUS
;
1952 if (sel
& SELFLAG_TAKESELECTION
)
1953 wxsel
|= wxACC_SEL_TAKESELECTION
;
1954 if (sel
& SELFLAG_EXTENDSELECTION
)
1955 wxsel
|= wxACC_SEL_EXTENDSELECTION
;
1956 if (sel
& SELFLAG_ADDSELECTION
)
1957 wxsel
|= wxACC_SEL_ADDSELECTION
;
1958 if (sel
& SELFLAG_REMOVESELECTION
)
1959 wxsel
|= wxACC_SEL_REMOVESELECTION
;
1960 return (wxAccSelectionFlags
) wxsel
;
1964 #endif //USE_ACCESSIBILITY