1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/ole/access.cpp
3 // Purpose: implementation of wxIAccessible and wxAccessible
4 // Author: Julian Smart
8 // Copyright: (c) 2003 Julian Smart
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "access.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
27 #if defined(__BORLANDC__)
31 #include "wx/window.h"
36 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
39 #include "wx/access.h"
43 // for some compilers, the entire ole2.h must be included, not only oleauto.h
44 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
52 #include "wx/msw/winundef.h"
53 #include "wx/msw/ole/oleutils.h"
56 #define CHILDID_SELF 0
60 #define OBJID_CLIENT 0xFFFFFFFC
63 // Convert to Windows role
64 int wxConvertToWindowsRole(wxAccRole wxrole
);
66 // Convert to Windows state
67 long wxConvertToWindowsState(long wxstate
);
69 // Convert to Windows selection flag
70 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel
);
72 // Convert from Windows selection flag
73 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
);
75 // ----------------------------------------------------------------------------
76 // wxIEnumVARIANT interface implementation
77 // ----------------------------------------------------------------------------
79 class wxIEnumVARIANT
: public IEnumVARIANT
82 wxIEnumVARIANT(const wxVariant
& variant
);
83 virtual ~wxIEnumVARIANT() { }
85 DECLARE_IUNKNOWN_METHODS
;
88 STDMETHODIMP
Next(ULONG celt
, VARIANT
*rgelt
, ULONG
*pceltFetched
);
89 STDMETHODIMP
Skip(ULONG celt
);
91 STDMETHODIMP
Clone(IEnumVARIANT
**ppenum
);
94 wxVariant m_variant
; // List of further variants
95 int m_nCurrent
; // Current enum position
97 DECLARE_NO_COPY_CLASS(wxIEnumVARIANT
)
100 // ----------------------------------------------------------------------------
102 // ----------------------------------------------------------------------------
104 BEGIN_IID_TABLE(wxIEnumVARIANT
)
109 IMPLEMENT_IUNKNOWN_METHODS(wxIEnumVARIANT
)
111 // wxVariant contains a list of further variants.
112 wxIEnumVARIANT::wxIEnumVARIANT(const wxVariant
& variant
)
117 STDMETHODIMP
wxIEnumVARIANT::Next(ULONG celt
,
121 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Next"));
124 // we only return 1 element at a time - mainly because I'm too lazy to
125 // implement something which you're never asked for anyhow
129 if (m_variant
.GetType() != wxT("list"))
132 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() ) {
133 if (!wxConvertVariantToOle(m_variant
[m_nCurrent
++], rgelt
[0]))
138 // TODO: should we AddRef if this is an object?
149 STDMETHODIMP
wxIEnumVARIANT::Skip(ULONG celt
)
151 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Skip"));
153 if (m_variant
.GetType() != wxT("list"))
157 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() )
160 // no, can't skip this many elements
166 STDMETHODIMP
wxIEnumVARIANT::Reset()
168 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Reset"));
175 STDMETHODIMP
wxIEnumVARIANT::Clone(IEnumVARIANT
**ppenum
)
177 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Clone"));
179 wxIEnumVARIANT
*pNew
= new wxIEnumVARIANT(m_variant
);
187 // ----------------------------------------------------------------------------
188 // wxIAccessible implementation of IAccessible interface
189 // ----------------------------------------------------------------------------
191 class wxIAccessible
: public IAccessible
194 wxIAccessible(wxAccessible
*pAccessible
);
196 DECLARE_IUNKNOWN_METHODS
;
200 // Navigation and Hierarchy
202 // Retrieves the child element or child object at a given point on the screen.
203 // All visual objects support this method; sound objects do not support it.
205 STDMETHODIMP
accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
);
207 // Retrieves the specified object's current screen location. All visual objects must
208 // support this method; sound objects do not support it.
210 STDMETHODIMP
accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
);
212 // Traverses to another user interface element within a container and retrieves the object.
213 // All visual objects must support this method.
215 STDMETHODIMP
accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
);
217 // Retrieves the address of an IDispatch interface for the specified child.
218 // All objects must support this property.
220 STDMETHODIMP
get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
);
222 // Retrieves the number of children that belong to this object.
223 // All objects must support this property.
225 STDMETHODIMP
get_accChildCount ( long* pCountChildren
);
227 // Retrieves the IDispatch interface of the object's parent.
228 // All objects support this property.
230 STDMETHODIMP
get_accParent ( IDispatch
** ppDispParent
);
232 // Descriptive Properties and Methods
234 // Performs the object's default action. Not all objects have a default
237 STDMETHODIMP
accDoDefaultAction(VARIANT varID
);
239 // Retrieves a string that describes the object's default action.
240 // Not all objects have a default action.
242 STDMETHODIMP
get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
);
244 // Retrieves a string that describes the visual appearance of the specified object.
245 // Not all objects have a description.
247 STDMETHODIMP
get_accDescription ( VARIANT varID
, BSTR
* pszDescription
);
249 // Retrieves an object's Help property string.
250 // Not all objects support this property.
252 STDMETHODIMP
get_accHelp ( VARIANT varID
, BSTR
* pszHelp
);
254 // Retrieves the full path of the WinHelp file associated with the specified
255 // object and the identifier of the appropriate topic within that file.
256 // Not all objects support this property.
258 STDMETHODIMP
get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
);
260 // Retrieves the specified object's shortcut key or access key, also known as
261 // the mnemonic. All objects that have a shortcut key or access key support
264 STDMETHODIMP
get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
);
266 // Retrieves the name of the specified object.
267 // All objects support this property.
269 STDMETHODIMP
get_accName ( VARIANT varID
, BSTR
* pszName
);
271 // Retrieves information that describes the role of the specified object.
272 // All objects support this property.
274 STDMETHODIMP
get_accRole ( VARIANT varID
, VARIANT
* pVarRole
);
276 // Retrieves the current state of the specified object.
277 // All objects support this property.
279 STDMETHODIMP
get_accState ( VARIANT varID
, VARIANT
* pVarState
);
281 // Retrieves the value of the specified object.
282 // Not all objects have a value.
284 STDMETHODIMP
get_accValue ( VARIANT varID
, BSTR
* pszValue
);
286 // Selection and Focus
288 // Modifies the selection or moves the keyboard focus of the
289 // specified object. All objects that select or receive the
290 // keyboard focus must support this method.
292 STDMETHODIMP
accSelect ( long flagsSelect
, VARIANT varID
);
294 // Retrieves the object that has the keyboard focus. All objects
295 // that receive the keyboard focus must support this property.
297 STDMETHODIMP
get_accFocus ( VARIANT
* pVarID
);
299 // Retrieves the selected children of this object. All objects
300 // selected must support this property.
302 STDMETHODIMP
get_accSelection ( VARIANT
* pVarChildren
);
306 STDMETHODIMP
put_accName(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
307 STDMETHODIMP
put_accValue(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
313 STDMETHODIMP
GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
);
315 // Get type info count
317 STDMETHODIMP
GetTypeInfoCount(unsigned int* typeInfoCount
);
321 STDMETHODIMP
GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
322 LCID lcid
, DISPID
* dispId
);
326 STDMETHODIMP
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
327 WORD wFlags
, DISPPARAMS
*pDispParams
,
328 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
329 unsigned int *puArgErr
);
333 // Gets the standard IAccessible interface for the given child or object.
334 // Call Release if this is non-NULL.
335 IAccessible
* GetChildStdAccessible(int id
);
337 // Gets the IAccessible interface for the given child or object.
338 // Call Release if this is non-NULL.
339 IAccessible
* GetChildAccessible(int id
);
342 wxAccessible
*m_pAccessible
; // pointer to C++ class we belong to
344 DECLARE_NO_COPY_CLASS(wxIAccessible
)
347 // ============================================================================
349 // ============================================================================
351 // ----------------------------------------------------------------------------
352 // wxIAccessible implementation
353 // ----------------------------------------------------------------------------
354 BEGIN_IID_TABLE(wxIAccessible
)
360 IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible
)
362 wxIAccessible::wxIAccessible(wxAccessible
*pAccessible
)
364 wxASSERT( pAccessible
!= NULL
);
366 m_pAccessible
= pAccessible
;
369 // Retrieves the child element or child object at a given point on the screen.
370 // All visual objects support this method; sound objects do not support it.
372 STDMETHODIMP
wxIAccessible::accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
)
374 wxLogTrace(wxT("access"), "accHitTest");
375 wxASSERT (m_pAccessible
!= NULL
);
379 wxAccessible
* childObject
= NULL
;
383 wxAccStatus status
= m_pAccessible
->HitTest(wxPoint(xLeft
, yLeft
), & childId
, & childObject
);
385 if (status
== wxACC_FAIL
)
388 if (status
== wxACC_NOT_IMPLEMENTED
)
390 // Use standard interface instead.
391 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
395 return stdInterface
->accHitTest(xLeft
, yLeft
, pVarID
);
400 if (childObject
== m_pAccessible
)
403 pVarID
->lVal
= CHILDID_SELF
;
408 wxIAccessible
* childIA
= childObject
->GetIAccessible();
412 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
415 pVarID
->vt
= VT_DISPATCH
;
419 else if (childId
> 0)
422 pVarID
->lVal
= childId
;
427 pVarID
->vt
= VT_EMPTY
;
434 // Retrieves the specified object's current screen location. All visual objects must
435 // support this method; sound objects do not support it.
437 STDMETHODIMP
wxIAccessible::accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
)
439 wxLogTrace(wxT("access"), "accLocation");
440 wxASSERT (m_pAccessible
!= NULL
);
446 wxAccStatus status
= m_pAccessible
->GetLocation(rect
, varID
.lVal
);
447 if (status
== wxACC_FAIL
)
450 if (status
== wxACC_NOT_IMPLEMENTED
)
452 // Try to use child object directly.
455 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
459 HRESULT hResult
= childAccessible
->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
460 childAccessible
->Release();
463 else if (m_pAccessible
->GetIAccessibleStd())
464 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
466 else if (m_pAccessible
->GetIAccessibleStd())
467 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
473 *pcxWidth
= rect
.width
;
474 *pcyHeight
= rect
.height
;
481 // Traverses to another user interface element within a container and retrieves the object.
482 // All visual objects must support this method.
484 STDMETHODIMP
wxIAccessible::accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
)
486 wxASSERT (m_pAccessible
!= NULL
);
489 wxLogTrace(wxT("access"), wxString(wxT("accNavigate for ")) + m_pAccessible
->GetWindow()->GetClassInfo()->GetClassName());
491 if ((varStart
.vt
!= VT_I4
&& varStart
.vt
!= VT_EMPTY
) || varStart
.vt
< 0)
493 wxLogTrace(wxT("access"), "Invalid arg for accNavigate");
497 wxAccessible
* elementObject
= NULL
;
499 VariantInit(pVarEnd
);
500 wxNavDir navDirWX
= wxNAVDIR_FIRSTCHILD
;
507 navDirWX
= wxNAVDIR_DOWN
;
508 navStr
= wxT("wxNAVDIR_DOWN");
511 case NAVDIR_FIRSTCHILD
:
512 navDirWX
= wxNAVDIR_FIRSTCHILD
;
513 navStr
= wxT("wxNAVDIR_FIRSTCHILD");
516 case NAVDIR_LASTCHILD
:
517 navDirWX
= wxNAVDIR_LASTCHILD
;
518 navStr
= wxT("wxNAVDIR_LASTCHILD");
522 navDirWX
= wxNAVDIR_LEFT
;
523 navStr
= wxT("wxNAVDIR_LEFT");
527 navDirWX
= wxNAVDIR_NEXT
;
528 navStr
= wxT("wxNAVDIR_NEXT");
531 case NAVDIR_PREVIOUS
:
532 navDirWX
= wxNAVDIR_PREVIOUS
;
533 navStr
= wxT("wxNAVDIR_PREVIOUS");
537 navDirWX
= wxNAVDIR_RIGHT
;
538 navStr
= wxT("wxNAVDIR_RIGHT");
542 navDirWX
= wxNAVDIR_UP
;
543 navStr
= wxT("wxNAVDIR_UP");
547 wxLogTrace(wxT("access"), wxT("Unknown NAVDIR symbol"));
551 wxLogTrace(wxT("access"), navStr
);
553 wxAccStatus status
= m_pAccessible
->Navigate(navDirWX
, varStart
.lVal
, & elementId
,
556 if (status
== wxACC_FAIL
)
558 wxLogTrace(wxT("access"), "wxAccessible::Navigate failed");
562 if (status
== wxACC_FALSE
)
564 wxLogTrace(wxT("access"), "wxAccessible::Navigate found no object in this direction");
568 if (status
== wxACC_NOT_IMPLEMENTED
)
570 wxLogTrace(wxT("access"), "Navigate not implemented");
572 // Try to use child object directly.
573 if (varStart
.vt
== VT_I4
&& varStart
.lVal
> 0)
575 IAccessible
* childAccessible
= GetChildAccessible(varStart
.lVal
);
579 HRESULT hResult
= childAccessible
->accNavigate(navDir
, varStart
, pVarEnd
);
580 childAccessible
->Release();
583 else if (m_pAccessible
->GetIAccessibleStd())
584 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
586 else if (m_pAccessible
->GetIAccessibleStd())
587 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
593 wxLogTrace(wxT("access"), "Getting wxIAccessible and calling QueryInterface for Navigate");
594 wxIAccessible
* objectIA
= elementObject
->GetIAccessible();
597 wxLogTrace(wxT("access"), "No wxIAccessible");
601 HRESULT hResult
= objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarEnd
->pdispVal
);
604 wxLogTrace(wxT("access"), "QueryInterface failed");
608 wxLogTrace(wxT("access"), "Called QueryInterface for Navigate");
609 pVarEnd
->vt
= VT_DISPATCH
;
612 else if (elementId
> 0)
614 wxLogTrace(wxT("access"), "Returning element id from Navigate");
616 pVarEnd
->lVal
= elementId
;
621 wxLogTrace(wxT("access"), "No object in accNavigate");
622 pVarEnd
->vt
= VT_EMPTY
;
627 wxLogTrace(wxT("access"), "Failing Navigate");
631 // Retrieves the address of an IDispatch interface for the specified child.
632 // All objects must support this property.
634 STDMETHODIMP
wxIAccessible::get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
)
636 wxLogTrace(wxT("access"), "get_accChild");
637 wxASSERT (m_pAccessible
!= NULL
);
641 if (varChildID
.vt
!= VT_I4
)
643 wxLogTrace(wxT("access"), "Invalid arg for get_accChild");
647 if (varChildID
.lVal
== CHILDID_SELF
)
654 wxAccessible
* child
= NULL
;
656 wxAccStatus status
= m_pAccessible
->GetChild(varChildID
.lVal
, & child
);
657 if (status
== wxACC_FAIL
)
659 wxLogTrace(wxT("access"), "GetChild failed");
663 if (status
== wxACC_NOT_IMPLEMENTED
)
665 // Use standard interface instead.
666 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
671 wxLogTrace(wxT("access"), "Using standard interface for get_accChild");
672 return stdInterface
->get_accChild (varChildID
, ppDispChild
);
679 wxIAccessible
* objectIA
= child
->GetIAccessible();
683 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispChild
) != S_OK
)
685 wxLogTrace(wxT("access"), "QueryInterface failed in get_accChild");
693 wxLogTrace(wxT("access"), "Not an accessible object");
694 return S_FALSE
; // Indicates it's not an accessible object
701 // Retrieves the number of children that belong to this object.
702 // All objects must support this property.
704 STDMETHODIMP
wxIAccessible::get_accChildCount ( long* pCountChildren
)
706 wxLogTrace(wxT("access"), "get_accChildCount");
707 wxASSERT (m_pAccessible
!= NULL
);
712 wxAccStatus status
= m_pAccessible
->GetChildCount(& childCount
);
713 if (status
== wxACC_FAIL
)
716 if (status
== wxACC_NOT_IMPLEMENTED
)
718 // Use standard interface instead.
719 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
724 wxLogTrace(wxT("access"), "Using standard interface for get_accChildCount");
725 HRESULT res
= stdInterface
->get_accChildCount (pCountChildren
);
727 str
.Printf(wxT("Number of children was %d"), (int) (*pCountChildren
));
728 wxLogTrace(wxT("access"), str
);
734 * pCountChildren
= (long) childCount
;
741 // Retrieves the IDispatch interface of the object's parent.
742 // All objects support this property.
744 STDMETHODIMP
wxIAccessible::get_accParent ( IDispatch
** ppDispParent
)
746 wxLogTrace(wxT("access"), "get_accParent");
747 wxASSERT (m_pAccessible
!= NULL
);
751 wxAccessible
* parent
= NULL
;
752 wxAccStatus status
= m_pAccessible
->GetParent(& parent
);
754 if (status
== wxACC_FAIL
)
757 // It doesn't seem acceptable to return S_FALSE with a NULL
758 // ppDispParent, so if we have no wxWindows parent, we leave
759 // it to the standard interface.
760 if (status
== wxACC_NOT_IMPLEMENTED
|| !parent
)
762 wxLogTrace(wxT("access"), "Using standard interface to get the parent.");
763 // Use standard interface instead.
764 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
768 return stdInterface
->get_accParent (ppDispParent
);
774 wxIAccessible
* objectIA
= parent
->GetIAccessible();
778 wxLogTrace(wxT("access"), "About to call QueryInterface");
779 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispParent
) != S_OK
)
781 wxLogTrace(wxT("access"), "Failed QueryInterface");
785 wxLogTrace(wxT("access"), "Returning S_OK for get_accParent");
790 // This doesn't seem to be allowed, despite the documentation,
791 // so we handle it higher up by using the standard interface.
792 wxLogTrace(wxT("access"), "Returning NULL parent because there was none");
793 *ppDispParent
= NULL
;
801 // Performs the object's default action. Not all objects have a default
804 STDMETHODIMP
wxIAccessible::accDoDefaultAction(VARIANT varID
)
806 wxLogTrace(wxT("access"), "accDoDefaultAction");
807 wxASSERT (m_pAccessible
!= NULL
);
811 if (varID
.vt
!= VT_I4
)
813 wxLogTrace(wxT("access"), "Invalid arg for accDoDefaultAction");
817 wxAccStatus status
= m_pAccessible
->DoDefaultAction(varID
.lVal
);
818 if (status
== wxACC_FAIL
)
821 if (status
== wxACC_NOT_SUPPORTED
)
822 return DISP_E_MEMBERNOTFOUND
;
824 if (status
== wxACC_NOT_IMPLEMENTED
)
826 // Try to use child object directly.
829 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
833 HRESULT hResult
= childAccessible
->accDoDefaultAction(varID
);
834 childAccessible
->Release();
837 else if (m_pAccessible
->GetIAccessibleStd())
838 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
840 else if (m_pAccessible
->GetIAccessibleStd())
841 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
846 // Retrieves a string that describes the object's default action.
847 // Not all objects have a default action.
849 STDMETHODIMP
wxIAccessible::get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
)
851 wxLogTrace(wxT("access"), "get_accDefaultAction");
852 wxASSERT (m_pAccessible
!= NULL
);
856 if (varID
.vt
!= VT_I4
)
858 wxLogTrace(wxT("access"), "Invalid arg for get_accDefaultAction");
862 wxString defaultAction
;
863 wxAccStatus status
= m_pAccessible
->GetDefaultAction(varID
.lVal
, & defaultAction
);
864 if (status
== wxACC_FAIL
)
867 if (status
== wxACC_NOT_SUPPORTED
)
868 return DISP_E_MEMBERNOTFOUND
;
870 if (status
== wxACC_NOT_IMPLEMENTED
)
872 // Try to use child object directly.
875 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
879 HRESULT hResult
= childAccessible
->get_accDefaultAction(varID
, pszDefaultAction
);
880 childAccessible
->Release();
883 else if (m_pAccessible
->GetIAccessibleStd())
884 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
886 else if (m_pAccessible
->GetIAccessibleStd())
887 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
891 if (defaultAction
.IsEmpty())
893 * pszDefaultAction
= NULL
;
898 wxBasicString
basicString(defaultAction
);
899 * pszDefaultAction
= basicString
.Get();
906 // Retrieves a string that describes the visual appearance of the specified object.
907 // Not all objects have a description.
909 STDMETHODIMP
wxIAccessible::get_accDescription ( VARIANT varID
, BSTR
* pszDescription
)
911 wxLogTrace(wxT("access"), "get_accDescription");
912 wxASSERT (m_pAccessible
!= NULL
);
916 if (varID
.vt
!= VT_I4
)
918 wxLogTrace(wxT("access"), "Invalid arg for get_accDescription");
922 wxString description
;
923 wxAccStatus status
= m_pAccessible
->GetDescription(varID
.lVal
, & description
);
924 if (status
== wxACC_FAIL
)
927 if (status
== wxACC_NOT_IMPLEMENTED
)
929 // Try to use child object directly.
932 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
936 HRESULT hResult
= childAccessible
->get_accDescription(varID
, pszDescription
);
937 childAccessible
->Release();
940 else if (m_pAccessible
->GetIAccessibleStd())
941 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
943 else if (m_pAccessible
->GetIAccessibleStd())
944 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
948 if (description
.IsEmpty())
950 * pszDescription
= NULL
;
955 wxBasicString
basicString(description
);
956 * pszDescription
= basicString
.Get();
963 // Retrieves an object's Help property string.
964 // Not all objects support this property.
966 STDMETHODIMP
wxIAccessible::get_accHelp ( VARIANT varID
, BSTR
* pszHelp
)
968 wxLogTrace(wxT("access"), "get_accHelp");
969 wxASSERT (m_pAccessible
!= NULL
);
973 if (varID
.vt
!= VT_I4
)
975 wxLogTrace(wxT("access"), "Invalid arg for get_accHelp");
980 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & helpString
);
981 if (status
== wxACC_FAIL
)
984 if (status
== wxACC_NOT_IMPLEMENTED
)
986 // Try to use child object directly.
989 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
993 HRESULT hResult
= childAccessible
->get_accHelp(varID
, pszHelp
);
994 childAccessible
->Release();
997 else if (m_pAccessible
->GetIAccessibleStd())
998 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp(varID
, pszHelp
);
1000 else if (m_pAccessible
->GetIAccessibleStd())
1001 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp (varID
, pszHelp
);
1005 if (helpString
.IsEmpty())
1012 wxBasicString
basicString(helpString
);
1013 * pszHelp
= basicString
.Get();
1020 // Retrieves the full path of the WinHelp file associated with the specified
1021 // object and the identifier of the appropriate topic within that file.
1022 // Not all objects support this property.
1023 // NOTE: not supported by wxWindows at this time. Use
1024 // GetHelpText instead.
1026 STDMETHODIMP
wxIAccessible::get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
)
1028 wxLogTrace(wxT("access"), "get_accHelpTopic");
1029 wxASSERT (m_pAccessible
!= NULL
);
1033 if (varChild
.vt
!= VT_I4
)
1035 wxLogTrace(wxT("access"), "Invalid arg for get_accHelpTopic");
1036 return E_INVALIDARG
;
1039 wxAccStatus status
= wxACC_NOT_IMPLEMENTED
;
1040 if (status
== wxACC_FAIL
)
1043 if (status
== wxACC_NOT_IMPLEMENTED
)
1045 // Try to use child object directly.
1046 if (varChild
.lVal
> 0)
1048 IAccessible
* childAccessible
= GetChildAccessible(varChild
.lVal
);
1049 if (childAccessible
)
1052 HRESULT hResult
= childAccessible
->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1053 childAccessible
->Release();
1056 else if (m_pAccessible
->GetIAccessibleStd())
1057 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1059 else if (m_pAccessible
->GetIAccessibleStd())
1060 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic (pszHelpFile
, varChild
, pidTopic
);
1065 // Retrieves the specified object's shortcut key or access key, also known as
1066 // the mnemonic. All objects that have a shortcut key or access key support
1069 STDMETHODIMP
wxIAccessible::get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
)
1071 wxLogTrace(wxT("access"), "get_accKeyboardShortcut");
1072 *pszKeyboardShortcut
= NULL
;
1074 wxASSERT (m_pAccessible
!= NULL
);
1078 if (varID
.vt
!= VT_I4
)
1080 wxLogTrace(wxT("access"), "Invalid arg for get_accKeyboardShortcut");
1081 return E_INVALIDARG
;
1084 wxString keyboardShortcut
;
1085 wxAccStatus status
= m_pAccessible
->GetKeyboardShortcut(varID
.lVal
, & keyboardShortcut
);
1086 if (status
== wxACC_FAIL
)
1089 if (status
== wxACC_NOT_IMPLEMENTED
)
1091 // Try to use child object directly.
1094 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1095 if (childAccessible
)
1098 HRESULT hResult
= childAccessible
->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1099 childAccessible
->Release();
1102 else if (m_pAccessible
->GetIAccessibleStd())
1103 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1105 else if (m_pAccessible
->GetIAccessibleStd())
1106 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut (varID
, pszKeyboardShortcut
);
1110 if (keyboardShortcut
.IsEmpty())
1112 * pszKeyboardShortcut
= NULL
;
1117 wxBasicString
basicString(keyboardShortcut
);
1118 * pszKeyboardShortcut
= basicString
.Get();
1125 // Retrieves the name of the specified object.
1126 // All objects support this property.
1128 STDMETHODIMP
wxIAccessible::get_accName ( VARIANT varID
, BSTR
* pszName
)
1130 wxLogTrace(wxT("access"), "get_accName");
1133 wxASSERT (m_pAccessible
!= NULL
);
1137 if (varID
.vt
!= VT_I4
)
1139 wxLogTrace(wxT("access"), "Invalid arg for get_accName");
1140 return E_INVALIDARG
;
1145 wxAccStatus status
= m_pAccessible
->GetName(varID
.lVal
, & name
);
1147 if (status
== wxACC_FAIL
)
1150 if (status
== wxACC_NOT_IMPLEMENTED
)
1152 // Try to use child object directly.
1155 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1156 if (childAccessible
)
1159 HRESULT hResult
= childAccessible
->get_accName(varID
, pszName
);
1160 childAccessible
->Release();
1163 else if (m_pAccessible
->GetIAccessibleStd())
1164 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName(varID
, pszName
);
1166 else if (m_pAccessible
->GetIAccessibleStd())
1167 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName (varID
, pszName
);
1171 wxBasicString
basicString(name
);
1172 *pszName
= basicString
.Get();
1178 // Retrieves information that describes the role of the specified object.
1179 // All objects support this property.
1181 STDMETHODIMP
wxIAccessible::get_accRole ( VARIANT varID
, VARIANT
* pVarRole
)
1183 wxLogTrace(wxT("access"), "get_accRole");
1184 wxASSERT (m_pAccessible
!= NULL
);
1188 if (varID
.vt
!= VT_I4
)
1190 wxLogTrace(wxT("access"), "Invalid arg for get_accRole");
1191 return E_INVALIDARG
;
1194 VariantInit(pVarRole
);
1196 wxAccRole role
= wxROLE_NONE
;
1198 wxAccStatus status
= m_pAccessible
->GetRole(varID
.lVal
, & role
);
1200 if (status
== wxACC_FAIL
)
1203 if (status
== wxACC_NOT_IMPLEMENTED
)
1205 // Try to use child object directly.
1208 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1209 if (childAccessible
)
1212 HRESULT hResult
= childAccessible
->get_accRole(varID
, pVarRole
);
1213 childAccessible
->Release();
1216 else if (m_pAccessible
->GetIAccessibleStd())
1217 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole(varID
, pVarRole
);
1219 else if (m_pAccessible
->GetIAccessibleStd())
1220 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole (varID
, pVarRole
);
1224 if (role
== wxROLE_NONE
)
1226 pVarRole
->vt
= VT_EMPTY
;
1230 pVarRole
->lVal
= wxConvertToWindowsRole(role
);
1231 pVarRole
->vt
= VT_I4
;
1238 // Retrieves the current state of the specified object.
1239 // All objects support this property.
1241 STDMETHODIMP
wxIAccessible::get_accState ( VARIANT varID
, VARIANT
* pVarState
)
1243 wxLogTrace(wxT("access"), "get_accState");
1244 wxASSERT (m_pAccessible
!= NULL
);
1248 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1250 wxLogTrace(wxT("access"), "Invalid arg for get_accState");
1251 return E_INVALIDARG
;
1256 wxAccStatus status
= m_pAccessible
->GetState(varID
.lVal
, & wxstate
);
1257 if (status
== wxACC_FAIL
)
1260 if (status
== wxACC_NOT_IMPLEMENTED
)
1262 // Try to use child object directly.
1265 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1266 if (childAccessible
)
1269 HRESULT hResult
= childAccessible
->get_accState(varID
, pVarState
);
1270 childAccessible
->Release();
1273 else if (m_pAccessible
->GetIAccessibleStd())
1274 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState(varID
, pVarState
);
1276 else if (m_pAccessible
->GetIAccessibleStd())
1277 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState (varID
, pVarState
);
1281 long state
= wxConvertToWindowsState(wxstate
);
1282 pVarState
->lVal
= state
;
1283 pVarState
->vt
= VT_I4
;
1289 // Retrieves the value of the specified object.
1290 // Not all objects have a value.
1292 STDMETHODIMP
wxIAccessible::get_accValue ( VARIANT varID
, BSTR
* pszValue
)
1294 wxLogTrace(wxT("access"), "get_accValue");
1295 wxASSERT (m_pAccessible
!= NULL
);
1299 if (varID
.vt
!= VT_I4
)
1301 wxLogTrace(wxT("access"), "Invalid arg for get_accValue");
1302 return E_INVALIDARG
;
1307 wxAccStatus status
= m_pAccessible
->GetValue(varID
.lVal
, & strValue
);
1309 if (status
== wxACC_FAIL
)
1312 if (status
== wxACC_NOT_IMPLEMENTED
)
1314 // Try to use child object directly.
1317 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1318 if (childAccessible
)
1321 HRESULT hResult
= childAccessible
->get_accValue(varID
, pszValue
);
1322 childAccessible
->Release();
1325 else if (m_pAccessible
->GetIAccessibleStd())
1326 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue(varID
, pszValue
);
1328 else if (m_pAccessible
->GetIAccessibleStd())
1329 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue (varID
, pszValue
);
1333 wxBasicString
basicString(strValue
);
1334 * pszValue
= basicString
.Get();
1340 // Modifies the selection or moves the keyboard focus of the
1341 // specified object. All objects that select or receive the
1342 // keyboard focus must support this method.
1344 STDMETHODIMP
wxIAccessible::accSelect ( long flagsSelect
, VARIANT varID
)
1346 wxLogTrace(wxT("access"), "get_accSelect");
1347 wxASSERT (m_pAccessible
!= NULL
);
1351 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1353 wxLogTrace(wxT("access"), "Invalid arg for accSelect");
1354 return E_INVALIDARG
;
1357 wxAccSelectionFlags wxsel
= wxConvertFromWindowsSelFlag(flagsSelect
);
1359 wxAccStatus status
= m_pAccessible
->Select(varID
.lVal
, wxsel
);
1360 if (status
== wxACC_FAIL
)
1363 if (status
== wxACC_NOT_IMPLEMENTED
)
1365 // Try to use child object directly.
1366 if (varID
.lVal
> 0 && varID
.lVal
> 0)
1368 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1369 if (childAccessible
)
1372 HRESULT hResult
= childAccessible
->accSelect(flagsSelect
, varID
);
1373 childAccessible
->Release();
1376 else if (m_pAccessible
->GetIAccessibleStd())
1377 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1379 else if (m_pAccessible
->GetIAccessibleStd())
1380 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1388 // Retrieves the object that has the keyboard focus. All objects
1389 // that receive the keyboard focus must support this property.
1391 STDMETHODIMP
wxIAccessible::get_accFocus ( VARIANT
* pVarID
)
1393 wxLogTrace(wxT("access"), "get_accFocus");
1394 wxASSERT (m_pAccessible
!= NULL
);
1398 wxAccessible
* childObject
= NULL
;
1400 VariantInit(pVarID
);
1402 wxAccStatus status
= m_pAccessible
->GetFocus(& childId
, & childObject
);
1403 if (status
== wxACC_FAIL
)
1406 if (status
== wxACC_NOT_IMPLEMENTED
)
1408 // Use standard interface instead.
1409 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1413 return stdInterface
->get_accFocus (pVarID
);
1417 if (childObject
== m_pAccessible
)
1420 pVarID
->lVal
= CHILDID_SELF
;
1424 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1428 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
1431 pVarID
->vt
= VT_DISPATCH
;
1435 else if (childId
> 0)
1438 pVarID
->lVal
= childId
;
1443 pVarID
->vt
= VT_EMPTY
;
1450 // Retrieves the selected children of this object. All objects
1451 // selected must support this property.
1453 STDMETHODIMP
wxIAccessible::get_accSelection ( VARIANT
* pVarChildren
)
1455 wxLogTrace(wxT("access"), "get_accSelection");
1456 wxASSERT (m_pAccessible
!= NULL
);
1460 VariantInit(pVarChildren
);
1462 wxVariant selections
;
1463 wxAccStatus status
= m_pAccessible
->GetSelections(& selections
);
1464 if (status
== wxACC_FAIL
)
1467 if (status
== wxACC_NOT_IMPLEMENTED
)
1469 // Use standard interface instead.
1470 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1474 return stdInterface
->get_accSelection (pVarChildren
);
1478 if (selections
.GetType() == wxT("long"))
1480 pVarChildren
->vt
= VT_I4
;
1481 pVarChildren
->lVal
= selections
.GetLong();
1485 else if (selections
.GetType() == wxT("void*"))
1487 wxAccessible
* childObject
= (wxAccessible
*) selections
.GetVoidPtr();
1488 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1492 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarChildren
->pdispVal
) != S_OK
)
1495 pVarChildren
->vt
= VT_DISPATCH
;
1499 else if (selections
.GetType() == wxT("list"))
1501 // TODO: should we AddRef for every "void*" member??
1503 wxIEnumVARIANT
* enumVariant
= new wxIEnumVARIANT(selections
);
1504 enumVariant
->AddRef();
1506 pVarChildren
->vt
= VT_UNKNOWN
;
1507 pVarChildren
->punkVal
= enumVariant
;
1518 STDMETHODIMP
wxIAccessible::GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
)
1524 // Get type info count
1526 STDMETHODIMP
wxIAccessible::GetTypeInfoCount(unsigned int* typeInfoCount
)
1534 STDMETHODIMP
wxIAccessible::GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
1535 LCID lcid
, DISPID
* dispId
)
1542 STDMETHODIMP
wxIAccessible::Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
1543 WORD wFlags
, DISPPARAMS
*pDispParams
,
1544 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1545 unsigned int *puArgErr
)
1550 // Gets the standard IAccessible interface for the given child or object.
1551 // Call Release if this is non-NULL.
1552 IAccessible
* wxIAccessible::GetChildStdAccessible(int id
)
1556 IAccessible
* obj
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1567 IDispatch
* pDispatch
= NULL
;
1568 if (S_OK
== get_accChild ( var
, & pDispatch
))
1570 IAccessible
* childAccessible
= NULL
;
1571 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1573 pDispatch
->Release();
1574 wxIAccessible
* c
= (wxIAccessible
*) childAccessible
;
1575 IAccessible
* stdChildAccessible
= (IAccessible
*) c
->m_pAccessible
->GetIAccessibleStd();
1576 stdChildAccessible
->AddRef();
1577 childAccessible
->Release();
1578 return stdChildAccessible
;
1582 pDispatch
->Release();
1589 // Loop until we find the right id
1591 this->get_accChildCount(& nChildren
);
1594 for (i
= 0; i
< nChildren
; i
++)
1600 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1605 var
.vt
= VT_DISPATCH
;
1606 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1608 IAccessible
* childAccessible
= NULL
;
1609 if (var
.pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1611 var
.pdispVal
->Release();
1612 return childAccessible
;
1616 var
.pdispVal
->Release();
1628 // Gets the IAccessible interface for the given child or object.
1629 // Call Release if this is non-NULL.
1630 IAccessible
* wxIAccessible::GetChildAccessible(int id
)
1634 IAccessible
* obj
= this;
1645 IDispatch
* pDispatch
= NULL
;
1646 if (S_OK
== get_accChild ( var
, & pDispatch
))
1648 IAccessible
* childAccessible
= NULL
;
1649 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1651 pDispatch
->Release();
1652 return childAccessible
;
1656 pDispatch
->Release();
1663 // ----------------------------------------------------------------------------
1664 // wxAccessible implementation
1665 // ----------------------------------------------------------------------------
1669 // common part of all ctors
1670 void wxAccessible::Init()
1672 m_pIAccessibleStd
= NULL
;
1673 m_pIAccessible
= new wxIAccessible(this);
1674 m_pIAccessible
->AddRef();
1677 wxAccessible::wxAccessible(wxWindow
* win
)
1678 : wxAccessibleBase(win
)
1683 wxAccessible::~wxAccessible()
1685 m_pIAccessible
->Release();
1686 if (m_pIAccessibleStd
)
1687 ((IAccessible
*)m_pIAccessibleStd
)->Release();
1690 // Gets or creates a standard interface for this object.
1691 void* wxAccessible::GetIAccessibleStd()
1693 if (m_pIAccessibleStd
)
1694 return m_pIAccessibleStd
;
1698 HRESULT retCode
= ::CreateStdAccessibleObject((HWND
) GetWindow()->GetHWND(),
1699 OBJID_CLIENT
, IID_IAccessible
, (void**) & m_pIAccessibleStd
);
1700 if (retCode
== S_OK
)
1701 return m_pIAccessibleStd
;
1704 m_pIAccessibleStd
= NULL
;
1711 // Sends an event when something changes in an accessible object.
1712 void wxAccessible::NotifyEvent(int eventType
, wxWindow
* window
, wxAccObject objectType
,
1715 ::NotifyWinEvent((DWORD
) eventType
, (HWND
) window
->GetHWND(),
1716 (LONG
) objectType
, (LONG
) objectId
);
1721 // Convert to Windows role
1722 int wxConvertToWindowsRole(wxAccRole wxrole
)
1726 case wxROLE_SYSTEM_ALERT
:
1727 return ROLE_SYSTEM_ALERT
;
1728 case wxROLE_SYSTEM_ANIMATION
:
1729 return ROLE_SYSTEM_ANIMATION
;
1730 case wxROLE_SYSTEM_APPLICATION
:
1731 return ROLE_SYSTEM_APPLICATION
;
1732 case wxROLE_SYSTEM_BORDER
:
1733 return ROLE_SYSTEM_BORDER
;
1734 case wxROLE_SYSTEM_BUTTONDROPDOWN
:
1735 return ROLE_SYSTEM_BUTTONDROPDOWN
;
1736 case wxROLE_SYSTEM_BUTTONDROPDOWNGRID
:
1737 return ROLE_SYSTEM_BUTTONDROPDOWNGRID
;
1738 case wxROLE_SYSTEM_BUTTONMENU
:
1739 return ROLE_SYSTEM_BUTTONMENU
;
1740 case wxROLE_SYSTEM_CARET
:
1741 return ROLE_SYSTEM_CARET
;
1742 case wxROLE_SYSTEM_CELL
:
1743 return ROLE_SYSTEM_CELL
;
1744 case wxROLE_SYSTEM_CHARACTER
:
1745 return ROLE_SYSTEM_CHARACTER
;
1746 case wxROLE_SYSTEM_CHART
:
1747 return ROLE_SYSTEM_CHART
;
1748 case wxROLE_SYSTEM_CHECKBUTTON
:
1749 return ROLE_SYSTEM_CHECKBUTTON
;
1750 case wxROLE_SYSTEM_CLIENT
:
1751 return ROLE_SYSTEM_CLIENT
;
1752 case wxROLE_SYSTEM_CLOCK
:
1753 return ROLE_SYSTEM_CLOCK
;
1754 case wxROLE_SYSTEM_COLUMN
:
1755 return ROLE_SYSTEM_COLUMN
;
1756 case wxROLE_SYSTEM_COLUMNHEADER
:
1757 return ROLE_SYSTEM_COLUMNHEADER
;
1758 case wxROLE_SYSTEM_COMBOBOX
:
1759 return ROLE_SYSTEM_COMBOBOX
;
1760 case wxROLE_SYSTEM_CURSOR
:
1761 return ROLE_SYSTEM_CURSOR
;
1762 case wxROLE_SYSTEM_DIAGRAM
:
1763 return ROLE_SYSTEM_DIAGRAM
;
1764 case wxROLE_SYSTEM_DIAL
:
1765 return ROLE_SYSTEM_DIAL
;
1766 case wxROLE_SYSTEM_DIALOG
:
1767 return ROLE_SYSTEM_DIALOG
;
1768 case wxROLE_SYSTEM_DOCUMENT
:
1769 return ROLE_SYSTEM_DOCUMENT
;
1770 case wxROLE_SYSTEM_DROPLIST
:
1771 return ROLE_SYSTEM_DROPLIST
;
1772 case wxROLE_SYSTEM_EQUATION
:
1773 return ROLE_SYSTEM_EQUATION
;
1774 case wxROLE_SYSTEM_GRAPHIC
:
1775 return ROLE_SYSTEM_GRAPHIC
;
1776 case wxROLE_SYSTEM_GRIP
:
1777 return ROLE_SYSTEM_GRIP
;
1778 case wxROLE_SYSTEM_GROUPING
:
1779 return ROLE_SYSTEM_GROUPING
;
1780 case wxROLE_SYSTEM_HELPBALLOON
:
1781 return ROLE_SYSTEM_HELPBALLOON
;
1782 case wxROLE_SYSTEM_HOTKEYFIELD
:
1783 return ROLE_SYSTEM_HOTKEYFIELD
;
1784 case wxROLE_SYSTEM_INDICATOR
:
1785 return ROLE_SYSTEM_INDICATOR
;
1786 case wxROLE_SYSTEM_LINK
:
1787 return ROLE_SYSTEM_LINK
;
1788 case wxROLE_SYSTEM_LIST
:
1789 return ROLE_SYSTEM_LIST
;
1790 case wxROLE_SYSTEM_LISTITEM
:
1791 return ROLE_SYSTEM_LISTITEM
;
1792 case wxROLE_SYSTEM_MENUBAR
:
1793 return ROLE_SYSTEM_MENUBAR
;
1794 case wxROLE_SYSTEM_MENUITEM
:
1795 return ROLE_SYSTEM_MENUITEM
;
1796 case wxROLE_SYSTEM_MENUPOPUP
:
1797 return ROLE_SYSTEM_MENUPOPUP
;
1798 case wxROLE_SYSTEM_OUTLINE
:
1799 return ROLE_SYSTEM_OUTLINE
;
1800 case wxROLE_SYSTEM_OUTLINEITEM
:
1801 return ROLE_SYSTEM_OUTLINEITEM
;
1802 case wxROLE_SYSTEM_PAGETAB
:
1803 return ROLE_SYSTEM_PAGETAB
;
1804 case wxROLE_SYSTEM_PAGETABLIST
:
1805 return ROLE_SYSTEM_PAGETABLIST
;
1806 case wxROLE_SYSTEM_PANE
:
1807 return ROLE_SYSTEM_PANE
;
1808 case wxROLE_SYSTEM_PROGRESSBAR
:
1809 return ROLE_SYSTEM_PROGRESSBAR
;
1810 case wxROLE_SYSTEM_PROPERTYPAGE
:
1811 return ROLE_SYSTEM_PROPERTYPAGE
;
1812 case wxROLE_SYSTEM_PUSHBUTTON
:
1813 return ROLE_SYSTEM_PUSHBUTTON
;
1814 case wxROLE_SYSTEM_RADIOBUTTON
:
1815 return ROLE_SYSTEM_RADIOBUTTON
;
1816 case wxROLE_SYSTEM_ROW
:
1817 return ROLE_SYSTEM_ROW
;
1818 case wxROLE_SYSTEM_ROWHEADER
:
1819 return ROLE_SYSTEM_ROWHEADER
;
1820 case wxROLE_SYSTEM_SCROLLBAR
:
1821 return ROLE_SYSTEM_SCROLLBAR
;
1822 case wxROLE_SYSTEM_SEPARATOR
:
1823 return ROLE_SYSTEM_SEPARATOR
;
1824 case wxROLE_SYSTEM_SLIDER
:
1825 return ROLE_SYSTEM_SLIDER
;
1826 case wxROLE_SYSTEM_SOUND
:
1827 return ROLE_SYSTEM_SOUND
;
1828 case wxROLE_SYSTEM_SPINBUTTON
:
1829 return ROLE_SYSTEM_SPINBUTTON
;
1830 case wxROLE_SYSTEM_STATICTEXT
:
1831 return ROLE_SYSTEM_STATICTEXT
;
1832 case wxROLE_SYSTEM_STATUSBAR
:
1833 return ROLE_SYSTEM_STATUSBAR
;
1834 case wxROLE_SYSTEM_TABLE
:
1835 return ROLE_SYSTEM_TABLE
;
1836 case wxROLE_SYSTEM_TEXT
:
1837 return ROLE_SYSTEM_TEXT
;
1838 case wxROLE_SYSTEM_TITLEBAR
:
1839 return ROLE_SYSTEM_TITLEBAR
;
1840 case wxROLE_SYSTEM_TOOLBAR
:
1841 return ROLE_SYSTEM_TOOLBAR
;
1842 case wxROLE_SYSTEM_TOOLTIP
:
1843 return ROLE_SYSTEM_TOOLTIP
;
1844 case wxROLE_SYSTEM_WHITESPACE
:
1845 return ROLE_SYSTEM_WHITESPACE
;
1846 case wxROLE_SYSTEM_WINDOW
:
1847 return ROLE_SYSTEM_WINDOW
;
1852 // Convert to Windows state
1853 long wxConvertToWindowsState(long wxstate
)
1856 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_HIGH
)
1857 state
|= STATE_SYSTEM_ALERT_HIGH
;
1859 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_MEDIUM
)
1860 state
|= STATE_SYSTEM_ALERT_MEDIUM
;
1862 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_LOW
)
1863 state
|= STATE_SYSTEM_ALERT_LOW
;
1865 if (wxstate
& wxACC_STATE_SYSTEM_ANIMATED
)
1866 state
|= STATE_SYSTEM_ANIMATED
;
1868 if (wxstate
& wxACC_STATE_SYSTEM_BUSY
)
1869 state
|= STATE_SYSTEM_BUSY
;
1871 if (wxstate
& wxACC_STATE_SYSTEM_CHECKED
)
1872 state
|= STATE_SYSTEM_CHECKED
;
1874 if (wxstate
& wxACC_STATE_SYSTEM_COLLAPSED
)
1875 state
|= STATE_SYSTEM_COLLAPSED
;
1877 if (wxstate
& wxACC_STATE_SYSTEM_DEFAULT
)
1878 state
|= STATE_SYSTEM_DEFAULT
;
1880 if (wxstate
& wxACC_STATE_SYSTEM_EXPANDED
)
1881 state
|= STATE_SYSTEM_EXPANDED
;
1883 if (wxstate
& wxACC_STATE_SYSTEM_EXTSELECTABLE
)
1884 state
|= STATE_SYSTEM_EXTSELECTABLE
;
1886 if (wxstate
& wxACC_STATE_SYSTEM_FLOATING
)
1887 state
|= STATE_SYSTEM_FLOATING
;
1889 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSABLE
)
1890 state
|= STATE_SYSTEM_FOCUSABLE
;
1892 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSED
)
1893 state
|= STATE_SYSTEM_FOCUSED
;
1895 if (wxstate
& wxACC_STATE_SYSTEM_HOTTRACKED
)
1896 state
|= STATE_SYSTEM_HOTTRACKED
;
1898 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1899 state
|= STATE_SYSTEM_INVISIBLE
;
1901 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1902 state
|= STATE_SYSTEM_INVISIBLE
;
1904 if (wxstate
& wxACC_STATE_SYSTEM_MIXED
)
1905 state
|= STATE_SYSTEM_MIXED
;
1907 if (wxstate
& wxACC_STATE_SYSTEM_MULTISELECTABLE
)
1908 state
|= STATE_SYSTEM_MULTISELECTABLE
;
1910 if (wxstate
& wxACC_STATE_SYSTEM_OFFSCREEN
)
1911 state
|= STATE_SYSTEM_OFFSCREEN
;
1913 if (wxstate
& wxACC_STATE_SYSTEM_PRESSED
)
1914 state
|= STATE_SYSTEM_PRESSED
;
1916 // if (wxstate & wxACC_STATE_SYSTEM_PROTECTED)
1917 // state |= STATE_SYSTEM_PROTECTED;
1919 if (wxstate
& wxACC_STATE_SYSTEM_READONLY
)
1920 state
|= STATE_SYSTEM_READONLY
;
1922 if (wxstate
& wxACC_STATE_SYSTEM_SELECTABLE
)
1923 state
|= STATE_SYSTEM_SELECTABLE
;
1925 if (wxstate
& wxACC_STATE_SYSTEM_SELECTED
)
1926 state
|= STATE_SYSTEM_SELECTED
;
1928 if (wxstate
& wxACC_STATE_SYSTEM_SELFVOICING
)
1929 state
|= STATE_SYSTEM_SELFVOICING
;
1931 if (wxstate
& wxACC_STATE_SYSTEM_UNAVAILABLE
)
1932 state
|= STATE_SYSTEM_UNAVAILABLE
;
1937 // Convert to Windows selection flag
1938 int wxConvertToWindowsSelFlag(wxAccSelectionFlags wxsel
)
1942 if (sel
& wxACC_SEL_TAKEFOCUS
)
1943 sel
|= SELFLAG_TAKEFOCUS
;
1944 if (sel
& wxACC_SEL_TAKESELECTION
)
1945 sel
|= SELFLAG_TAKESELECTION
;
1946 if (sel
& wxACC_SEL_EXTENDSELECTION
)
1947 sel
|= SELFLAG_EXTENDSELECTION
;
1948 if (sel
& wxACC_SEL_ADDSELECTION
)
1949 sel
|= SELFLAG_ADDSELECTION
;
1950 if (sel
& wxACC_SEL_REMOVESELECTION
)
1951 sel
|= SELFLAG_REMOVESELECTION
;
1955 // Convert from Windows selection flag
1956 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
)
1960 if (sel
& SELFLAG_TAKEFOCUS
)
1961 wxsel
|= wxACC_SEL_TAKEFOCUS
;
1962 if (sel
& SELFLAG_TAKESELECTION
)
1963 wxsel
|= wxACC_SEL_TAKESELECTION
;
1964 if (sel
& SELFLAG_EXTENDSELECTION
)
1965 wxsel
|= wxACC_SEL_EXTENDSELECTION
;
1966 if (sel
& SELFLAG_ADDSELECTION
)
1967 wxsel
|= wxACC_SEL_ADDSELECTION
;
1968 if (sel
& SELFLAG_REMOVESELECTION
)
1969 wxsel
|= wxACC_SEL_REMOVESELECTION
;
1970 return (wxAccSelectionFlags
) wxsel
;
1974 #endif //USE_ACCESSIBILITY