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__)
28 #include "wx/window.h"
31 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
34 #include "wx/access.h"
36 #include "wx/msw/wrapwin.h"
38 // for some compilers, the entire ole2.h must be included, not only oleauto.h
39 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
47 #include "wx/msw/ole/oleutils.h"
50 #define CHILDID_SELF 0
54 #define OBJID_CLIENT 0xFFFFFFFC
57 // Convert to Windows role
58 int wxConvertToWindowsRole(wxAccRole wxrole
);
60 // Convert to Windows state
61 long wxConvertToWindowsState(long wxstate
);
63 // Convert to Windows selection flag
64 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel
);
66 // Convert from Windows selection flag
67 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
);
69 // ----------------------------------------------------------------------------
70 // wxIEnumVARIANT interface implementation
71 // ----------------------------------------------------------------------------
73 class wxIEnumVARIANT
: public IEnumVARIANT
76 wxIEnumVARIANT(const wxVariant
& variant
);
77 virtual ~wxIEnumVARIANT() { }
79 DECLARE_IUNKNOWN_METHODS
;
82 STDMETHODIMP
Next(ULONG celt
, VARIANT
*rgelt
, ULONG
*pceltFetched
);
83 STDMETHODIMP
Skip(ULONG celt
);
85 STDMETHODIMP
Clone(IEnumVARIANT
**ppenum
);
88 wxVariant m_variant
; // List of further variants
89 int m_nCurrent
; // Current enum position
91 DECLARE_NO_COPY_CLASS(wxIEnumVARIANT
)
94 // ----------------------------------------------------------------------------
96 // ----------------------------------------------------------------------------
98 BEGIN_IID_TABLE(wxIEnumVARIANT
)
103 IMPLEMENT_IUNKNOWN_METHODS(wxIEnumVARIANT
)
105 // wxVariant contains a list of further variants.
106 wxIEnumVARIANT::wxIEnumVARIANT(const wxVariant
& variant
)
111 STDMETHODIMP
wxIEnumVARIANT::Next(ULONG celt
,
115 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Next"));
118 // we only return 1 element at a time - mainly because I'm too lazy to
119 // implement something which you're never asked for anyhow
123 if (m_variant
.GetType() != wxT("list"))
126 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() ) {
127 if (!wxConvertVariantToOle(m_variant
[m_nCurrent
++], rgelt
[0]))
132 // TODO: should we AddRef if this is an object?
143 STDMETHODIMP
wxIEnumVARIANT::Skip(ULONG celt
)
145 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Skip"));
147 if (m_variant
.GetType() != wxT("list"))
151 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() )
154 // no, can't skip this many elements
160 STDMETHODIMP
wxIEnumVARIANT::Reset()
162 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Reset"));
169 STDMETHODIMP
wxIEnumVARIANT::Clone(IEnumVARIANT
**ppenum
)
171 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Clone"));
173 wxIEnumVARIANT
*pNew
= new wxIEnumVARIANT(m_variant
);
181 // ----------------------------------------------------------------------------
182 // wxIAccessible implementation of IAccessible interface
183 // ----------------------------------------------------------------------------
185 class wxIAccessible
: public IAccessible
188 wxIAccessible(wxAccessible
*pAccessible
);
190 DECLARE_IUNKNOWN_METHODS
;
194 // Navigation and Hierarchy
196 // Retrieves the child element or child object at a given point on the screen.
197 // All visual objects support this method; sound objects do not support it.
199 STDMETHODIMP
accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
);
201 // Retrieves the specified object's current screen location. All visual objects must
202 // support this method; sound objects do not support it.
204 STDMETHODIMP
accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
);
206 // Traverses to another user interface element within a container and retrieves the object.
207 // All visual objects must support this method.
209 STDMETHODIMP
accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
);
211 // Retrieves the address of an IDispatch interface for the specified child.
212 // All objects must support this property.
214 STDMETHODIMP
get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
);
216 // Retrieves the number of children that belong to this object.
217 // All objects must support this property.
219 STDMETHODIMP
get_accChildCount ( long* pCountChildren
);
221 // Retrieves the IDispatch interface of the object's parent.
222 // All objects support this property.
224 STDMETHODIMP
get_accParent ( IDispatch
** ppDispParent
);
226 // Descriptive Properties and Methods
228 // Performs the object's default action. Not all objects have a default
231 STDMETHODIMP
accDoDefaultAction(VARIANT varID
);
233 // Retrieves a string that describes the object's default action.
234 // Not all objects have a default action.
236 STDMETHODIMP
get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
);
238 // Retrieves a string that describes the visual appearance of the specified object.
239 // Not all objects have a description.
241 STDMETHODIMP
get_accDescription ( VARIANT varID
, BSTR
* pszDescription
);
243 // Retrieves an object's Help property string.
244 // Not all objects support this property.
246 STDMETHODIMP
get_accHelp ( VARIANT varID
, BSTR
* pszHelp
);
248 // Retrieves the full path of the WinHelp file associated with the specified
249 // object and the identifier of the appropriate topic within that file.
250 // Not all objects support this property.
252 STDMETHODIMP
get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
);
254 // Retrieves the specified object's shortcut key or access key, also known as
255 // the mnemonic. All objects that have a shortcut key or access key support
258 STDMETHODIMP
get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
);
260 // Retrieves the name of the specified object.
261 // All objects support this property.
263 STDMETHODIMP
get_accName ( VARIANT varID
, BSTR
* pszName
);
265 // Retrieves information that describes the role of the specified object.
266 // All objects support this property.
268 STDMETHODIMP
get_accRole ( VARIANT varID
, VARIANT
* pVarRole
);
270 // Retrieves the current state of the specified object.
271 // All objects support this property.
273 STDMETHODIMP
get_accState ( VARIANT varID
, VARIANT
* pVarState
);
275 // Retrieves the value of the specified object.
276 // Not all objects have a value.
278 STDMETHODIMP
get_accValue ( VARIANT varID
, BSTR
* pszValue
);
280 // Selection and Focus
282 // Modifies the selection or moves the keyboard focus of the
283 // specified object. All objects that select or receive the
284 // keyboard focus must support this method.
286 STDMETHODIMP
accSelect ( long flagsSelect
, VARIANT varID
);
288 // Retrieves the object that has the keyboard focus. All objects
289 // that receive the keyboard focus must support this property.
291 STDMETHODIMP
get_accFocus ( VARIANT
* pVarID
);
293 // Retrieves the selected children of this object. All objects
294 // selected must support this property.
296 STDMETHODIMP
get_accSelection ( VARIANT
* pVarChildren
);
300 STDMETHODIMP
put_accName(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
301 STDMETHODIMP
put_accValue(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
307 STDMETHODIMP
GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
);
309 // Get type info count
311 STDMETHODIMP
GetTypeInfoCount(unsigned int* typeInfoCount
);
315 STDMETHODIMP
GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
316 LCID lcid
, DISPID
* dispId
);
320 STDMETHODIMP
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
321 WORD wFlags
, DISPPARAMS
*pDispParams
,
322 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
323 unsigned int *puArgErr
);
327 // Gets the standard IAccessible interface for the given child or object.
328 // Call Release if this is non-NULL.
329 IAccessible
* GetChildStdAccessible(int id
);
331 // Gets the IAccessible interface for the given child or object.
332 // Call Release if this is non-NULL.
333 IAccessible
* GetChildAccessible(int id
);
336 wxAccessible
*m_pAccessible
; // pointer to C++ class we belong to
338 DECLARE_NO_COPY_CLASS(wxIAccessible
)
341 // ============================================================================
343 // ============================================================================
345 // ----------------------------------------------------------------------------
346 // wxIAccessible implementation
347 // ----------------------------------------------------------------------------
348 BEGIN_IID_TABLE(wxIAccessible
)
354 IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible
)
356 wxIAccessible::wxIAccessible(wxAccessible
*pAccessible
)
358 wxASSERT( pAccessible
!= NULL
);
360 m_pAccessible
= pAccessible
;
363 // Retrieves the child element or child object at a given point on the screen.
364 // All visual objects support this method; sound objects do not support it.
366 STDMETHODIMP
wxIAccessible::accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
)
368 wxLogTrace(wxT("access"), wxT("accHitTest"));
369 wxASSERT (m_pAccessible
!= NULL
);
373 wxAccessible
* childObject
= NULL
;
377 wxAccStatus status
= m_pAccessible
->HitTest(wxPoint(xLeft
, yLeft
), & childId
, & childObject
);
379 if (status
== wxACC_FAIL
)
382 if (status
== wxACC_NOT_IMPLEMENTED
)
384 // Use standard interface instead.
385 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
389 return stdInterface
->accHitTest(xLeft
, yLeft
, pVarID
);
394 if (childObject
== m_pAccessible
)
397 pVarID
->lVal
= CHILDID_SELF
;
402 wxIAccessible
* childIA
= childObject
->GetIAccessible();
406 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
409 pVarID
->vt
= VT_DISPATCH
;
413 else if (childId
> 0)
416 pVarID
->lVal
= childId
;
421 pVarID
->vt
= VT_EMPTY
;
426 // all cases above already cause some return action so below line
427 // is unreachable and cause unnecessary warning
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 wxLogTrace(wxT("access"), wxT("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 wxLogTrace(wxT("access"), wxString(wxT("accNavigate for ")) + m_pAccessible
->GetWindow()->GetClassInfo()->GetClassName());
489 if ((varStart
.vt
!= VT_I4
&& varStart
.vt
!= VT_EMPTY
)
491 // according to MSDN and sources varStart.vt is unsigned
492 // so below line cause warning "Condition is always false"
497 wxLogTrace(wxT("access"), wxT("Invalid arg for accNavigate"));
501 wxAccessible
* elementObject
= NULL
;
503 VariantInit(pVarEnd
);
504 wxNavDir navDirWX
= wxNAVDIR_FIRSTCHILD
;
511 navDirWX
= wxNAVDIR_DOWN
;
512 navStr
= wxT("wxNAVDIR_DOWN");
515 case NAVDIR_FIRSTCHILD
:
516 navDirWX
= wxNAVDIR_FIRSTCHILD
;
517 navStr
= wxT("wxNAVDIR_FIRSTCHILD");
520 case NAVDIR_LASTCHILD
:
521 navDirWX
= wxNAVDIR_LASTCHILD
;
522 navStr
= wxT("wxNAVDIR_LASTCHILD");
526 navDirWX
= wxNAVDIR_LEFT
;
527 navStr
= wxT("wxNAVDIR_LEFT");
531 navDirWX
= wxNAVDIR_NEXT
;
532 navStr
= wxT("wxNAVDIR_NEXT");
535 case NAVDIR_PREVIOUS
:
536 navDirWX
= wxNAVDIR_PREVIOUS
;
537 navStr
= wxT("wxNAVDIR_PREVIOUS");
541 navDirWX
= wxNAVDIR_RIGHT
;
542 navStr
= wxT("wxNAVDIR_RIGHT");
546 navDirWX
= wxNAVDIR_UP
;
547 navStr
= wxT("wxNAVDIR_UP");
551 wxLogTrace(wxT("access"), wxT("Unknown NAVDIR symbol"));
555 wxLogTrace(wxT("access"), navStr
);
557 wxAccStatus status
= m_pAccessible
->Navigate(navDirWX
, varStart
.lVal
, & elementId
,
560 if (status
== wxACC_FAIL
)
562 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate failed"));
566 if (status
== wxACC_FALSE
)
568 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate found no object in this direction"));
572 if (status
== wxACC_NOT_IMPLEMENTED
)
574 wxLogTrace(wxT("access"), wxT("Navigate not implemented"));
576 // Try to use child object directly.
577 if (varStart
.vt
== VT_I4
&& varStart
.lVal
> 0)
579 IAccessible
* childAccessible
= GetChildAccessible(varStart
.lVal
);
583 HRESULT hResult
= childAccessible
->accNavigate(navDir
, varStart
, pVarEnd
);
584 childAccessible
->Release();
587 else if (m_pAccessible
->GetIAccessibleStd())
588 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
590 else if (m_pAccessible
->GetIAccessibleStd())
591 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
597 wxLogTrace(wxT("access"), wxT("Getting wxIAccessible and calling QueryInterface for Navigate"));
598 wxIAccessible
* objectIA
= elementObject
->GetIAccessible();
601 wxLogTrace(wxT("access"), wxT("No wxIAccessible"));
605 HRESULT hResult
= objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarEnd
->pdispVal
);
608 wxLogTrace(wxT("access"), wxT("QueryInterface failed"));
612 wxLogTrace(wxT("access"), wxT("Called QueryInterface for Navigate"));
613 pVarEnd
->vt
= VT_DISPATCH
;
616 else if (elementId
> 0)
618 wxLogTrace(wxT("access"), wxT("Returning element id from Navigate"));
620 pVarEnd
->lVal
= elementId
;
625 wxLogTrace(wxT("access"), wxT("No object in accNavigate"));
626 pVarEnd
->vt
= VT_EMPTY
;
631 wxLogTrace(wxT("access"), wxT("Failing Navigate"));
635 // Retrieves the address of an IDispatch interface for the specified child.
636 // All objects must support this property.
638 STDMETHODIMP
wxIAccessible::get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
)
640 wxLogTrace(wxT("access"), wxT("get_accChild"));
641 wxASSERT (m_pAccessible
!= NULL
);
645 if (varChildID
.vt
!= VT_I4
)
647 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accChild"));
651 if (varChildID
.lVal
== CHILDID_SELF
)
658 wxAccessible
* child
= NULL
;
660 wxAccStatus status
= m_pAccessible
->GetChild(varChildID
.lVal
, & child
);
661 if (status
== wxACC_FAIL
)
663 wxLogTrace(wxT("access"), wxT("GetChild failed"));
667 if (status
== wxACC_NOT_IMPLEMENTED
)
669 // Use standard interface instead.
670 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
675 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChild"));
676 return stdInterface
->get_accChild (varChildID
, ppDispChild
);
683 wxIAccessible
* objectIA
= child
->GetIAccessible();
687 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispChild
) != S_OK
)
689 wxLogTrace(wxT("access"), wxT("QueryInterface failed in get_accChild"));
697 wxLogTrace(wxT("access"), wxT("Not an accessible object"));
698 return S_FALSE
; // Indicates it's not an accessible object
703 // all cases above already cause some return action so below line
704 // is unreachable and cause unnecessary warning
709 // Retrieves the number of children that belong to this object.
710 // All objects must support this property.
712 STDMETHODIMP
wxIAccessible::get_accChildCount ( long* pCountChildren
)
714 wxLogTrace(wxT("access"), wxT("get_accChildCount"));
715 wxASSERT (m_pAccessible
!= NULL
);
720 wxAccStatus status
= m_pAccessible
->GetChildCount(& childCount
);
721 if (status
== wxACC_FAIL
)
724 if (status
== wxACC_NOT_IMPLEMENTED
)
726 // Use standard interface instead.
727 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
732 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChildCount"));
733 HRESULT res
= stdInterface
->get_accChildCount (pCountChildren
);
735 str
.Printf(wxT("Number of children was %d"), (int) (*pCountChildren
));
736 wxLogTrace(wxT("access"), str
);
742 * pCountChildren
= (long) childCount
;
747 // all cases above already cause some return action so below line
748 // is unreachable and cause unnecessary warning
753 // Retrieves the IDispatch interface of the object's parent.
754 // All objects support this property.
756 STDMETHODIMP
wxIAccessible::get_accParent ( IDispatch
** ppDispParent
)
758 wxLogTrace(wxT("access"), wxT("get_accParent"));
759 wxASSERT (m_pAccessible
!= NULL
);
763 wxAccessible
* parent
= NULL
;
764 wxAccStatus status
= m_pAccessible
->GetParent(& parent
);
766 if (status
== wxACC_FAIL
)
769 // It doesn't seem acceptable to return S_FALSE with a NULL
770 // ppDispParent, so if we have no wxWidgets parent, we leave
771 // it to the standard interface.
772 if (status
== wxACC_NOT_IMPLEMENTED
|| !parent
)
774 wxLogTrace(wxT("access"), wxT("Using standard interface to get the parent."));
775 // Use standard interface instead.
776 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
780 return stdInterface
->get_accParent (ppDispParent
);
786 wxIAccessible
* objectIA
= parent
->GetIAccessible();
790 wxLogTrace(wxT("access"), wxT("About to call QueryInterface"));
791 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispParent
) != S_OK
)
793 wxLogTrace(wxT("access"), wxT("Failed QueryInterface"));
797 wxLogTrace(wxT("access"), wxT("Returning S_OK for get_accParent"));
802 // This doesn't seem to be allowed, despite the documentation,
803 // so we handle it higher up by using the standard interface.
804 wxLogTrace(wxT("access"), wxT("Returning NULL parent because there was none"));
805 *ppDispParent
= NULL
;
811 // all cases above already cause some return action so below line
812 // is unreachable and cause unnecessary warning
817 // Performs the object's default action. Not all objects have a default
820 STDMETHODIMP
wxIAccessible::accDoDefaultAction(VARIANT varID
)
822 wxLogTrace(wxT("access"), wxT("accDoDefaultAction"));
823 wxASSERT (m_pAccessible
!= NULL
);
827 if (varID
.vt
!= VT_I4
)
829 wxLogTrace(wxT("access"), wxT("Invalid arg for accDoDefaultAction"));
833 wxAccStatus status
= m_pAccessible
->DoDefaultAction(varID
.lVal
);
834 if (status
== wxACC_FAIL
)
837 if (status
== wxACC_NOT_SUPPORTED
)
838 return DISP_E_MEMBERNOTFOUND
;
840 if (status
== wxACC_NOT_IMPLEMENTED
)
842 // Try to use child object directly.
845 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
849 HRESULT hResult
= childAccessible
->accDoDefaultAction(varID
);
850 childAccessible
->Release();
853 else if (m_pAccessible
->GetIAccessibleStd())
854 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
856 else if (m_pAccessible
->GetIAccessibleStd())
857 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
862 // Retrieves a string that describes the object's default action.
863 // Not all objects have a default action.
865 STDMETHODIMP
wxIAccessible::get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
)
867 wxLogTrace(wxT("access"), wxT("get_accDefaultAction"));
868 wxASSERT (m_pAccessible
!= NULL
);
872 if (varID
.vt
!= VT_I4
)
874 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDefaultAction"));
878 wxString defaultAction
;
879 wxAccStatus status
= m_pAccessible
->GetDefaultAction(varID
.lVal
, & defaultAction
);
880 if (status
== wxACC_FAIL
)
883 if (status
== wxACC_NOT_SUPPORTED
)
884 return DISP_E_MEMBERNOTFOUND
;
886 if (status
== wxACC_NOT_IMPLEMENTED
)
888 // Try to use child object directly.
891 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
895 HRESULT hResult
= childAccessible
->get_accDefaultAction(varID
, pszDefaultAction
);
896 childAccessible
->Release();
899 else if (m_pAccessible
->GetIAccessibleStd())
900 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
902 else if (m_pAccessible
->GetIAccessibleStd())
903 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
907 if (defaultAction
.IsEmpty())
909 * pszDefaultAction
= NULL
;
914 wxBasicString
basicString(defaultAction
);
915 * pszDefaultAction
= basicString
.Get();
922 // Retrieves a string that describes the visual appearance of the specified object.
923 // Not all objects have a description.
925 STDMETHODIMP
wxIAccessible::get_accDescription ( VARIANT varID
, BSTR
* pszDescription
)
927 wxLogTrace(wxT("access"), wxT("get_accDescription"));
928 wxASSERT (m_pAccessible
!= NULL
);
932 if (varID
.vt
!= VT_I4
)
934 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDescription"));
938 wxString description
;
939 wxAccStatus status
= m_pAccessible
->GetDescription(varID
.lVal
, & description
);
940 if (status
== wxACC_FAIL
)
943 if (status
== wxACC_NOT_IMPLEMENTED
)
945 // Try to use child object directly.
948 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
952 HRESULT hResult
= childAccessible
->get_accDescription(varID
, pszDescription
);
953 childAccessible
->Release();
956 else if (m_pAccessible
->GetIAccessibleStd())
957 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
959 else if (m_pAccessible
->GetIAccessibleStd())
960 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
964 if (description
.empty())
966 * pszDescription
= NULL
;
971 wxBasicString
basicString(description
);
972 * pszDescription
= basicString
.Get();
979 // Retrieves an object's Help property string.
980 // Not all objects support this property.
982 STDMETHODIMP
wxIAccessible::get_accHelp ( VARIANT varID
, BSTR
* pszHelp
)
984 wxLogTrace(wxT("access"), wxT("get_accHelp"));
985 wxASSERT (m_pAccessible
!= NULL
);
989 if (varID
.vt
!= VT_I4
)
991 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelp"));
996 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & helpString
);
997 if (status
== wxACC_FAIL
)
1000 if (status
== wxACC_NOT_IMPLEMENTED
)
1002 // Try to use child object directly.
1005 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1006 if (childAccessible
)
1009 HRESULT hResult
= childAccessible
->get_accHelp(varID
, pszHelp
);
1010 childAccessible
->Release();
1013 else if (m_pAccessible
->GetIAccessibleStd())
1014 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp(varID
, pszHelp
);
1016 else if (m_pAccessible
->GetIAccessibleStd())
1017 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp (varID
, pszHelp
);
1021 if (helpString
.empty())
1028 wxBasicString
basicString(helpString
);
1029 * pszHelp
= basicString
.Get();
1036 // Retrieves the full path of the WinHelp file associated with the specified
1037 // object and the identifier of the appropriate topic within that file.
1038 // Not all objects support this property.
1039 // NOTE: not supported by wxWidgets at this time. Use
1040 // GetHelpText instead.
1042 STDMETHODIMP
wxIAccessible::get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
)
1044 wxLogTrace(wxT("access"), wxT("get_accHelpTopic"));
1045 wxASSERT (m_pAccessible
!= NULL
);
1049 if (varChild
.vt
!= VT_I4
)
1051 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelpTopic"));
1052 return E_INVALIDARG
;
1055 wxAccStatus status
= wxACC_NOT_IMPLEMENTED
;
1056 if (status
== wxACC_FAIL
)
1059 if (status
== wxACC_NOT_IMPLEMENTED
)
1061 // Try to use child object directly.
1062 if (varChild
.lVal
> 0)
1064 IAccessible
* childAccessible
= GetChildAccessible(varChild
.lVal
);
1065 if (childAccessible
)
1068 HRESULT hResult
= childAccessible
->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1069 childAccessible
->Release();
1072 else if (m_pAccessible
->GetIAccessibleStd())
1073 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1075 else if (m_pAccessible
->GetIAccessibleStd())
1076 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic (pszHelpFile
, varChild
, pidTopic
);
1081 // Retrieves the specified object's shortcut key or access key, also known as
1082 // the mnemonic. All objects that have a shortcut key or access key support
1085 STDMETHODIMP
wxIAccessible::get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
)
1087 wxLogTrace(wxT("access"), wxT("get_accKeyboardShortcut"));
1088 *pszKeyboardShortcut
= NULL
;
1090 wxASSERT (m_pAccessible
!= NULL
);
1094 if (varID
.vt
!= VT_I4
)
1096 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accKeyboardShortcut"));
1097 return E_INVALIDARG
;
1100 wxString keyboardShortcut
;
1101 wxAccStatus status
= m_pAccessible
->GetKeyboardShortcut(varID
.lVal
, & keyboardShortcut
);
1102 if (status
== wxACC_FAIL
)
1105 if (status
== wxACC_NOT_IMPLEMENTED
)
1107 // Try to use child object directly.
1110 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1111 if (childAccessible
)
1114 HRESULT hResult
= childAccessible
->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1115 childAccessible
->Release();
1118 else if (m_pAccessible
->GetIAccessibleStd())
1119 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1121 else if (m_pAccessible
->GetIAccessibleStd())
1122 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut (varID
, pszKeyboardShortcut
);
1126 if (keyboardShortcut
.empty())
1128 * pszKeyboardShortcut
= NULL
;
1133 wxBasicString
basicString(keyboardShortcut
);
1134 * pszKeyboardShortcut
= basicString
.Get();
1141 // Retrieves the name of the specified object.
1142 // All objects support this property.
1144 STDMETHODIMP
wxIAccessible::get_accName ( VARIANT varID
, BSTR
* pszName
)
1146 wxLogTrace(wxT("access"), wxT("get_accName"));
1149 wxASSERT (m_pAccessible
!= NULL
);
1153 if (varID
.vt
!= VT_I4
)
1155 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accName"));
1156 return E_INVALIDARG
;
1161 wxAccStatus status
= m_pAccessible
->GetName(varID
.lVal
, & name
);
1163 if (status
== wxACC_FAIL
)
1166 if (status
== wxACC_NOT_IMPLEMENTED
)
1168 // Try to use child object directly.
1171 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1172 if (childAccessible
)
1175 HRESULT hResult
= childAccessible
->get_accName(varID
, pszName
);
1176 childAccessible
->Release();
1179 else if (m_pAccessible
->GetIAccessibleStd())
1180 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName(varID
, pszName
);
1182 else if (m_pAccessible
->GetIAccessibleStd())
1183 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName (varID
, pszName
);
1187 wxBasicString
basicString(name
);
1188 *pszName
= basicString
.Get();
1194 // Retrieves information that describes the role of the specified object.
1195 // All objects support this property.
1197 STDMETHODIMP
wxIAccessible::get_accRole ( VARIANT varID
, VARIANT
* pVarRole
)
1199 wxLogTrace(wxT("access"), wxT("get_accRole"));
1200 wxASSERT (m_pAccessible
!= NULL
);
1204 if (varID
.vt
!= VT_I4
)
1206 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accRole"));
1207 return E_INVALIDARG
;
1210 VariantInit(pVarRole
);
1212 wxAccRole role
= wxROLE_NONE
;
1214 wxAccStatus status
= m_pAccessible
->GetRole(varID
.lVal
, & role
);
1216 if (status
== wxACC_FAIL
)
1219 if (status
== wxACC_NOT_IMPLEMENTED
)
1221 // Try to use child object directly.
1224 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1225 if (childAccessible
)
1228 HRESULT hResult
= childAccessible
->get_accRole(varID
, pVarRole
);
1229 childAccessible
->Release();
1232 else if (m_pAccessible
->GetIAccessibleStd())
1233 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole(varID
, pVarRole
);
1235 else if (m_pAccessible
->GetIAccessibleStd())
1236 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole (varID
, pVarRole
);
1240 if (role
== wxROLE_NONE
)
1242 pVarRole
->vt
= VT_EMPTY
;
1246 pVarRole
->lVal
= wxConvertToWindowsRole(role
);
1247 pVarRole
->vt
= VT_I4
;
1254 // Retrieves the current state of the specified object.
1255 // All objects support this property.
1257 STDMETHODIMP
wxIAccessible::get_accState ( VARIANT varID
, VARIANT
* pVarState
)
1259 wxLogTrace(wxT("access"), wxT("get_accState"));
1260 wxASSERT (m_pAccessible
!= NULL
);
1264 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1266 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accState"));
1267 return E_INVALIDARG
;
1272 wxAccStatus status
= m_pAccessible
->GetState(varID
.lVal
, & wxstate
);
1273 if (status
== wxACC_FAIL
)
1276 if (status
== wxACC_NOT_IMPLEMENTED
)
1278 // Try to use child object directly.
1281 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1282 if (childAccessible
)
1285 HRESULT hResult
= childAccessible
->get_accState(varID
, pVarState
);
1286 childAccessible
->Release();
1289 else if (m_pAccessible
->GetIAccessibleStd())
1290 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState(varID
, pVarState
);
1292 else if (m_pAccessible
->GetIAccessibleStd())
1293 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState (varID
, pVarState
);
1297 long state
= wxConvertToWindowsState(wxstate
);
1298 pVarState
->lVal
= state
;
1299 pVarState
->vt
= VT_I4
;
1305 // Retrieves the value of the specified object.
1306 // Not all objects have a value.
1308 STDMETHODIMP
wxIAccessible::get_accValue ( VARIANT varID
, BSTR
* pszValue
)
1310 wxLogTrace(wxT("access"), wxT("get_accValue"));
1311 wxASSERT (m_pAccessible
!= NULL
);
1315 if (varID
.vt
!= VT_I4
)
1317 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accValue"));
1318 return E_INVALIDARG
;
1323 wxAccStatus status
= m_pAccessible
->GetValue(varID
.lVal
, & strValue
);
1325 if (status
== wxACC_FAIL
)
1328 if (status
== wxACC_NOT_IMPLEMENTED
)
1330 // Try to use child object directly.
1333 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1334 if (childAccessible
)
1337 HRESULT hResult
= childAccessible
->get_accValue(varID
, pszValue
);
1338 childAccessible
->Release();
1341 else if (m_pAccessible
->GetIAccessibleStd())
1342 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue(varID
, pszValue
);
1344 else if (m_pAccessible
->GetIAccessibleStd())
1345 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue (varID
, pszValue
);
1349 wxBasicString
basicString(strValue
);
1350 * pszValue
= basicString
.Get();
1356 // Modifies the selection or moves the keyboard focus of the
1357 // specified object. All objects that select or receive the
1358 // keyboard focus must support this method.
1360 STDMETHODIMP
wxIAccessible::accSelect ( long flagsSelect
, VARIANT varID
)
1362 wxLogTrace(wxT("access"), wxT("get_accSelect"));
1363 wxASSERT (m_pAccessible
!= NULL
);
1367 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1369 wxLogTrace(wxT("access"), wxT("Invalid arg for accSelect"));
1370 return E_INVALIDARG
;
1373 wxAccSelectionFlags wxsel
= wxConvertFromWindowsSelFlag(flagsSelect
);
1375 wxAccStatus status
= m_pAccessible
->Select(varID
.lVal
, wxsel
);
1376 if (status
== wxACC_FAIL
)
1379 if (status
== wxACC_NOT_IMPLEMENTED
)
1381 // Try to use child object directly.
1382 if (varID
.lVal
> 0 && varID
.lVal
> 0)
1384 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1385 if (childAccessible
)
1388 HRESULT hResult
= childAccessible
->accSelect(flagsSelect
, varID
);
1389 childAccessible
->Release();
1392 else if (m_pAccessible
->GetIAccessibleStd())
1393 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1395 else if (m_pAccessible
->GetIAccessibleStd())
1396 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1404 // Retrieves the object that has the keyboard focus. All objects
1405 // that receive the keyboard focus must support this property.
1407 STDMETHODIMP
wxIAccessible::get_accFocus ( VARIANT
* pVarID
)
1409 wxLogTrace(wxT("access"), wxT("get_accFocus"));
1410 wxASSERT (m_pAccessible
!= NULL
);
1414 wxAccessible
* childObject
= NULL
;
1416 VariantInit(pVarID
);
1418 wxAccStatus status
= m_pAccessible
->GetFocus(& childId
, & childObject
);
1419 if (status
== wxACC_FAIL
)
1422 if (status
== wxACC_NOT_IMPLEMENTED
)
1424 // Use standard interface instead.
1425 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1429 return stdInterface
->get_accFocus (pVarID
);
1433 if (childObject
== m_pAccessible
)
1436 pVarID
->lVal
= CHILDID_SELF
;
1440 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1444 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
1447 pVarID
->vt
= VT_DISPATCH
;
1451 else if (childId
> 0)
1454 pVarID
->lVal
= childId
;
1459 pVarID
->vt
= VT_EMPTY
;
1464 // all cases above already cause some return action so below line
1465 // is unreachable and cause unnecessary warning
1470 // Retrieves the selected children of this object. All objects
1471 // selected must support this property.
1473 STDMETHODIMP
wxIAccessible::get_accSelection ( VARIANT
* pVarChildren
)
1475 wxLogTrace(wxT("access"), wxT("get_accSelection"));
1476 wxASSERT (m_pAccessible
!= NULL
);
1480 VariantInit(pVarChildren
);
1482 wxVariant selections
;
1483 wxAccStatus status
= m_pAccessible
->GetSelections(& selections
);
1484 if (status
== wxACC_FAIL
)
1487 if (status
== wxACC_NOT_IMPLEMENTED
)
1489 // Use standard interface instead.
1490 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1494 return stdInterface
->get_accSelection (pVarChildren
);
1498 if (selections
.GetType() == wxT("long"))
1500 pVarChildren
->vt
= VT_I4
;
1501 pVarChildren
->lVal
= selections
.GetLong();
1505 else if (selections
.GetType() == wxT("void*"))
1507 wxAccessible
* childObject
= (wxAccessible
*) selections
.GetVoidPtr();
1508 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1512 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarChildren
->pdispVal
) != S_OK
)
1515 pVarChildren
->vt
= VT_DISPATCH
;
1519 else if (selections
.GetType() == wxT("list"))
1521 // TODO: should we AddRef for every "void*" member??
1523 wxIEnumVARIANT
* enumVariant
= new wxIEnumVARIANT(selections
);
1524 enumVariant
->AddRef();
1526 pVarChildren
->vt
= VT_UNKNOWN
;
1527 pVarChildren
->punkVal
= enumVariant
;
1538 STDMETHODIMP
wxIAccessible::GetTypeInfo(unsigned int WXUNUSED(typeInfo
), LCID
WXUNUSED(lcid
), ITypeInfo
** ppTypeInfo
)
1544 // Get type info count
1546 STDMETHODIMP
wxIAccessible::GetTypeInfoCount(unsigned int* typeInfoCount
)
1554 STDMETHODIMP
wxIAccessible::GetIDsOfNames(REFIID
WXUNUSED(riid
), OLECHAR
** WXUNUSED(names
), unsigned int WXUNUSED(cNames
),
1555 LCID
WXUNUSED(lcid
), DISPID
* WXUNUSED(dispId
))
1562 STDMETHODIMP
wxIAccessible::Invoke(DISPID
WXUNUSED(dispIdMember
), REFIID
WXUNUSED(riid
), LCID
WXUNUSED(lcid
),
1563 WORD
WXUNUSED(wFlags
), DISPPARAMS
*WXUNUSED(pDispParams
),
1564 VARIANT
*WXUNUSED(pVarResult
), EXCEPINFO
*WXUNUSED(pExcepInfo
),
1565 unsigned int *WXUNUSED(puArgErr
) )
1570 // Gets the standard IAccessible interface for the given child or object.
1571 // Call Release if this is non-NULL.
1572 IAccessible
* wxIAccessible::GetChildStdAccessible(int id
)
1576 IAccessible
* obj
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1587 IDispatch
* pDispatch
= NULL
;
1588 if (S_OK
== get_accChild ( var
, & pDispatch
))
1590 IAccessible
* childAccessible
= NULL
;
1591 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1593 pDispatch
->Release();
1594 wxIAccessible
* c
= (wxIAccessible
*) childAccessible
;
1595 IAccessible
* stdChildAccessible
= (IAccessible
*) c
->m_pAccessible
->GetIAccessibleStd();
1596 stdChildAccessible
->AddRef();
1597 childAccessible
->Release();
1598 return stdChildAccessible
;
1602 pDispatch
->Release();
1609 // Loop until we find the right id
1611 this->get_accChildCount(& nChildren
);
1614 for (i
= 0; i
< nChildren
; i
++)
1620 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1625 var
.vt
= VT_DISPATCH
;
1626 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1628 IAccessible
* childAccessible
= NULL
;
1629 if (var
.pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1631 var
.pdispVal
->Release();
1632 return childAccessible
;
1636 var
.pdispVal
->Release();
1648 // Gets the IAccessible interface for the given child or object.
1649 // Call Release if this is non-NULL.
1650 IAccessible
* wxIAccessible::GetChildAccessible(int id
)
1654 IAccessible
* obj
= this;
1665 IDispatch
* pDispatch
= NULL
;
1666 if (S_OK
== get_accChild ( var
, & pDispatch
))
1668 IAccessible
* childAccessible
= NULL
;
1669 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1671 pDispatch
->Release();
1672 return childAccessible
;
1676 pDispatch
->Release();
1683 // ----------------------------------------------------------------------------
1684 // wxAccessible implementation
1685 // ----------------------------------------------------------------------------
1689 // common part of all ctors
1690 void wxAccessible::Init()
1692 m_pIAccessibleStd
= NULL
;
1693 m_pIAccessible
= new wxIAccessible(this);
1694 m_pIAccessible
->AddRef();
1697 wxAccessible::wxAccessible(wxWindow
* win
)
1698 : wxAccessibleBase(win
)
1703 wxAccessible::~wxAccessible()
1705 m_pIAccessible
->Release();
1706 if (m_pIAccessibleStd
)
1707 ((IAccessible
*)m_pIAccessibleStd
)->Release();
1710 // Gets or creates a standard interface for this object.
1711 void* wxAccessible::GetIAccessibleStd()
1713 if (m_pIAccessibleStd
)
1714 return m_pIAccessibleStd
;
1718 HRESULT retCode
= ::CreateStdAccessibleObject((HWND
) GetWindow()->GetHWND(),
1719 OBJID_CLIENT
, IID_IAccessible
, (void**) & m_pIAccessibleStd
);
1720 if (retCode
== S_OK
)
1721 return m_pIAccessibleStd
;
1724 m_pIAccessibleStd
= NULL
;
1731 // Sends an event when something changes in an accessible object.
1732 void wxAccessible::NotifyEvent(int eventType
, wxWindow
* window
, wxAccObject objectType
,
1735 ::NotifyWinEvent((DWORD
) eventType
, (HWND
) window
->GetHWND(),
1736 (LONG
) objectType
, (LONG
) objectId
);
1741 // Convert to Windows role
1742 int wxConvertToWindowsRole(wxAccRole wxrole
)
1746 case wxROLE_SYSTEM_ALERT
:
1747 return ROLE_SYSTEM_ALERT
;
1748 case wxROLE_SYSTEM_ANIMATION
:
1749 return ROLE_SYSTEM_ANIMATION
;
1750 case wxROLE_SYSTEM_APPLICATION
:
1751 return ROLE_SYSTEM_APPLICATION
;
1752 case wxROLE_SYSTEM_BORDER
:
1753 return ROLE_SYSTEM_BORDER
;
1754 case wxROLE_SYSTEM_BUTTONDROPDOWN
:
1755 return ROLE_SYSTEM_BUTTONDROPDOWN
;
1756 case wxROLE_SYSTEM_BUTTONDROPDOWNGRID
:
1757 return ROLE_SYSTEM_BUTTONDROPDOWNGRID
;
1758 case wxROLE_SYSTEM_BUTTONMENU
:
1759 return ROLE_SYSTEM_BUTTONMENU
;
1760 case wxROLE_SYSTEM_CARET
:
1761 return ROLE_SYSTEM_CARET
;
1762 case wxROLE_SYSTEM_CELL
:
1763 return ROLE_SYSTEM_CELL
;
1764 case wxROLE_SYSTEM_CHARACTER
:
1765 return ROLE_SYSTEM_CHARACTER
;
1766 case wxROLE_SYSTEM_CHART
:
1767 return ROLE_SYSTEM_CHART
;
1768 case wxROLE_SYSTEM_CHECKBUTTON
:
1769 return ROLE_SYSTEM_CHECKBUTTON
;
1770 case wxROLE_SYSTEM_CLIENT
:
1771 return ROLE_SYSTEM_CLIENT
;
1772 case wxROLE_SYSTEM_CLOCK
:
1773 return ROLE_SYSTEM_CLOCK
;
1774 case wxROLE_SYSTEM_COLUMN
:
1775 return ROLE_SYSTEM_COLUMN
;
1776 case wxROLE_SYSTEM_COLUMNHEADER
:
1777 return ROLE_SYSTEM_COLUMNHEADER
;
1778 case wxROLE_SYSTEM_COMBOBOX
:
1779 return ROLE_SYSTEM_COMBOBOX
;
1780 case wxROLE_SYSTEM_CURSOR
:
1781 return ROLE_SYSTEM_CURSOR
;
1782 case wxROLE_SYSTEM_DIAGRAM
:
1783 return ROLE_SYSTEM_DIAGRAM
;
1784 case wxROLE_SYSTEM_DIAL
:
1785 return ROLE_SYSTEM_DIAL
;
1786 case wxROLE_SYSTEM_DIALOG
:
1787 return ROLE_SYSTEM_DIALOG
;
1788 case wxROLE_SYSTEM_DOCUMENT
:
1789 return ROLE_SYSTEM_DOCUMENT
;
1790 case wxROLE_SYSTEM_DROPLIST
:
1791 return ROLE_SYSTEM_DROPLIST
;
1792 case wxROLE_SYSTEM_EQUATION
:
1793 return ROLE_SYSTEM_EQUATION
;
1794 case wxROLE_SYSTEM_GRAPHIC
:
1795 return ROLE_SYSTEM_GRAPHIC
;
1796 case wxROLE_SYSTEM_GRIP
:
1797 return ROLE_SYSTEM_GRIP
;
1798 case wxROLE_SYSTEM_GROUPING
:
1799 return ROLE_SYSTEM_GROUPING
;
1800 case wxROLE_SYSTEM_HELPBALLOON
:
1801 return ROLE_SYSTEM_HELPBALLOON
;
1802 case wxROLE_SYSTEM_HOTKEYFIELD
:
1803 return ROLE_SYSTEM_HOTKEYFIELD
;
1804 case wxROLE_SYSTEM_INDICATOR
:
1805 return ROLE_SYSTEM_INDICATOR
;
1806 case wxROLE_SYSTEM_LINK
:
1807 return ROLE_SYSTEM_LINK
;
1808 case wxROLE_SYSTEM_LIST
:
1809 return ROLE_SYSTEM_LIST
;
1810 case wxROLE_SYSTEM_LISTITEM
:
1811 return ROLE_SYSTEM_LISTITEM
;
1812 case wxROLE_SYSTEM_MENUBAR
:
1813 return ROLE_SYSTEM_MENUBAR
;
1814 case wxROLE_SYSTEM_MENUITEM
:
1815 return ROLE_SYSTEM_MENUITEM
;
1816 case wxROLE_SYSTEM_MENUPOPUP
:
1817 return ROLE_SYSTEM_MENUPOPUP
;
1818 case wxROLE_SYSTEM_OUTLINE
:
1819 return ROLE_SYSTEM_OUTLINE
;
1820 case wxROLE_SYSTEM_OUTLINEITEM
:
1821 return ROLE_SYSTEM_OUTLINEITEM
;
1822 case wxROLE_SYSTEM_PAGETAB
:
1823 return ROLE_SYSTEM_PAGETAB
;
1824 case wxROLE_SYSTEM_PAGETABLIST
:
1825 return ROLE_SYSTEM_PAGETABLIST
;
1826 case wxROLE_SYSTEM_PANE
:
1827 return ROLE_SYSTEM_PANE
;
1828 case wxROLE_SYSTEM_PROGRESSBAR
:
1829 return ROLE_SYSTEM_PROGRESSBAR
;
1830 case wxROLE_SYSTEM_PROPERTYPAGE
:
1831 return ROLE_SYSTEM_PROPERTYPAGE
;
1832 case wxROLE_SYSTEM_PUSHBUTTON
:
1833 return ROLE_SYSTEM_PUSHBUTTON
;
1834 case wxROLE_SYSTEM_RADIOBUTTON
:
1835 return ROLE_SYSTEM_RADIOBUTTON
;
1836 case wxROLE_SYSTEM_ROW
:
1837 return ROLE_SYSTEM_ROW
;
1838 case wxROLE_SYSTEM_ROWHEADER
:
1839 return ROLE_SYSTEM_ROWHEADER
;
1840 case wxROLE_SYSTEM_SCROLLBAR
:
1841 return ROLE_SYSTEM_SCROLLBAR
;
1842 case wxROLE_SYSTEM_SEPARATOR
:
1843 return ROLE_SYSTEM_SEPARATOR
;
1844 case wxROLE_SYSTEM_SLIDER
:
1845 return ROLE_SYSTEM_SLIDER
;
1846 case wxROLE_SYSTEM_SOUND
:
1847 return ROLE_SYSTEM_SOUND
;
1848 case wxROLE_SYSTEM_SPINBUTTON
:
1849 return ROLE_SYSTEM_SPINBUTTON
;
1850 case wxROLE_SYSTEM_STATICTEXT
:
1851 return ROLE_SYSTEM_STATICTEXT
;
1852 case wxROLE_SYSTEM_STATUSBAR
:
1853 return ROLE_SYSTEM_STATUSBAR
;
1854 case wxROLE_SYSTEM_TABLE
:
1855 return ROLE_SYSTEM_TABLE
;
1856 case wxROLE_SYSTEM_TEXT
:
1857 return ROLE_SYSTEM_TEXT
;
1858 case wxROLE_SYSTEM_TITLEBAR
:
1859 return ROLE_SYSTEM_TITLEBAR
;
1860 case wxROLE_SYSTEM_TOOLBAR
:
1861 return ROLE_SYSTEM_TOOLBAR
;
1862 case wxROLE_SYSTEM_TOOLTIP
:
1863 return ROLE_SYSTEM_TOOLTIP
;
1864 case wxROLE_SYSTEM_WHITESPACE
:
1865 return ROLE_SYSTEM_WHITESPACE
;
1866 case wxROLE_SYSTEM_WINDOW
:
1867 return ROLE_SYSTEM_WINDOW
;
1872 // Convert to Windows state
1873 long wxConvertToWindowsState(long wxstate
)
1876 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_HIGH
)
1877 state
|= STATE_SYSTEM_ALERT_HIGH
;
1879 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_MEDIUM
)
1880 state
|= STATE_SYSTEM_ALERT_MEDIUM
;
1882 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_LOW
)
1883 state
|= STATE_SYSTEM_ALERT_LOW
;
1885 if (wxstate
& wxACC_STATE_SYSTEM_ANIMATED
)
1886 state
|= STATE_SYSTEM_ANIMATED
;
1888 if (wxstate
& wxACC_STATE_SYSTEM_BUSY
)
1889 state
|= STATE_SYSTEM_BUSY
;
1891 if (wxstate
& wxACC_STATE_SYSTEM_CHECKED
)
1892 state
|= STATE_SYSTEM_CHECKED
;
1894 if (wxstate
& wxACC_STATE_SYSTEM_COLLAPSED
)
1895 state
|= STATE_SYSTEM_COLLAPSED
;
1897 if (wxstate
& wxACC_STATE_SYSTEM_DEFAULT
)
1898 state
|= STATE_SYSTEM_DEFAULT
;
1900 if (wxstate
& wxACC_STATE_SYSTEM_EXPANDED
)
1901 state
|= STATE_SYSTEM_EXPANDED
;
1903 if (wxstate
& wxACC_STATE_SYSTEM_EXTSELECTABLE
)
1904 state
|= STATE_SYSTEM_EXTSELECTABLE
;
1906 if (wxstate
& wxACC_STATE_SYSTEM_FLOATING
)
1907 state
|= STATE_SYSTEM_FLOATING
;
1909 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSABLE
)
1910 state
|= STATE_SYSTEM_FOCUSABLE
;
1912 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSED
)
1913 state
|= STATE_SYSTEM_FOCUSED
;
1915 if (wxstate
& wxACC_STATE_SYSTEM_HOTTRACKED
)
1916 state
|= STATE_SYSTEM_HOTTRACKED
;
1918 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1919 state
|= STATE_SYSTEM_INVISIBLE
;
1921 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1922 state
|= STATE_SYSTEM_INVISIBLE
;
1924 if (wxstate
& wxACC_STATE_SYSTEM_MIXED
)
1925 state
|= STATE_SYSTEM_MIXED
;
1927 if (wxstate
& wxACC_STATE_SYSTEM_MULTISELECTABLE
)
1928 state
|= STATE_SYSTEM_MULTISELECTABLE
;
1930 if (wxstate
& wxACC_STATE_SYSTEM_OFFSCREEN
)
1931 state
|= STATE_SYSTEM_OFFSCREEN
;
1933 if (wxstate
& wxACC_STATE_SYSTEM_PRESSED
)
1934 state
|= STATE_SYSTEM_PRESSED
;
1936 // if (wxstate & wxACC_STATE_SYSTEM_PROTECTED)
1937 // state |= STATE_SYSTEM_PROTECTED;
1939 if (wxstate
& wxACC_STATE_SYSTEM_READONLY
)
1940 state
|= STATE_SYSTEM_READONLY
;
1942 if (wxstate
& wxACC_STATE_SYSTEM_SELECTABLE
)
1943 state
|= STATE_SYSTEM_SELECTABLE
;
1945 if (wxstate
& wxACC_STATE_SYSTEM_SELECTED
)
1946 state
|= STATE_SYSTEM_SELECTED
;
1948 if (wxstate
& wxACC_STATE_SYSTEM_SELFVOICING
)
1949 state
|= STATE_SYSTEM_SELFVOICING
;
1951 if (wxstate
& wxACC_STATE_SYSTEM_UNAVAILABLE
)
1952 state
|= STATE_SYSTEM_UNAVAILABLE
;
1957 // Convert to Windows selection flag
1958 int wxConvertToWindowsSelFlag(wxAccSelectionFlags wxsel
)
1962 if (wxsel
& wxACC_SEL_TAKEFOCUS
)
1963 sel
|= SELFLAG_TAKEFOCUS
;
1964 if (wxsel
& wxACC_SEL_TAKESELECTION
)
1965 sel
|= SELFLAG_TAKESELECTION
;
1966 if (wxsel
& wxACC_SEL_EXTENDSELECTION
)
1967 sel
|= SELFLAG_EXTENDSELECTION
;
1968 if (wxsel
& wxACC_SEL_ADDSELECTION
)
1969 sel
|= SELFLAG_ADDSELECTION
;
1970 if (wxsel
& wxACC_SEL_REMOVESELECTION
)
1971 sel
|= SELFLAG_REMOVESELECTION
;
1975 // Convert from Windows selection flag
1976 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
)
1980 if (sel
& SELFLAG_TAKEFOCUS
)
1981 wxsel
|= wxACC_SEL_TAKEFOCUS
;
1982 if (sel
& SELFLAG_TAKESELECTION
)
1983 wxsel
|= wxACC_SEL_TAKESELECTION
;
1984 if (sel
& SELFLAG_EXTENDSELECTION
)
1985 wxsel
|= wxACC_SEL_EXTENDSELECTION
;
1986 if (sel
& SELFLAG_ADDSELECTION
)
1987 wxsel
|= wxACC_SEL_ADDSELECTION
;
1988 if (sel
& SELFLAG_REMOVESELECTION
)
1989 wxsel
|= wxACC_SEL_REMOVESELECTION
;
1990 return (wxAccSelectionFlags
) wxsel
;
1994 #endif //USE_ACCESSIBILITY