1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/ole/access.cpp
3 // Purpose: implementation of wxIAccessible and wxAccessible
4 // Author: Julian Smart
8 // Copyright: (c) 2003 Julian Smart
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
23 #if defined(__BORLANDC__)
27 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
29 #include "wx/access.h"
32 #include "wx/msw/wrapwin.h"
33 #include "wx/window.h"
37 // for some compilers, the entire ole2.h must be included, not only oleauto.h
38 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
46 #include "wx/msw/ole/oleutils.h"
49 #define CHILDID_SELF 0
53 #define OBJID_CLIENT 0xFFFFFFFC
56 // Convert to Windows role
57 int wxConvertToWindowsRole(wxAccRole wxrole
);
59 // Convert to Windows state
60 long wxConvertToWindowsState(long wxstate
);
62 // Convert to Windows selection flag
63 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel
);
65 // Convert from Windows selection flag
66 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
);
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
);
180 #endif // wxUSE_VARIANT
182 // ----------------------------------------------------------------------------
183 // wxIAccessible implementation of IAccessible interface
184 // ----------------------------------------------------------------------------
186 class wxIAccessible
: public IAccessible
189 wxIAccessible(wxAccessible
*pAccessible
);
191 DECLARE_IUNKNOWN_METHODS
;
195 // Navigation and Hierarchy
197 // Retrieves the child element or child object at a given point on the screen.
198 // All visual objects support this method; sound objects do not support it.
200 STDMETHODIMP
accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
);
202 // Retrieves the specified object's current screen location. All visual objects must
203 // support this method; sound objects do not support it.
205 STDMETHODIMP
accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
);
207 // Traverses to another user interface element within a container and retrieves the object.
208 // All visual objects must support this method.
210 STDMETHODIMP
accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
);
212 // Retrieves the address of an IDispatch interface for the specified child.
213 // All objects must support this property.
215 STDMETHODIMP
get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
);
217 // Retrieves the number of children that belong to this object.
218 // All objects must support this property.
220 STDMETHODIMP
get_accChildCount ( long* pCountChildren
);
222 // Retrieves the IDispatch interface of the object's parent.
223 // All objects support this property.
225 STDMETHODIMP
get_accParent ( IDispatch
** ppDispParent
);
227 // Descriptive Properties and Methods
229 // Performs the object's default action. Not all objects have a default
232 STDMETHODIMP
accDoDefaultAction(VARIANT varID
);
234 // Retrieves a string that describes the object's default action.
235 // Not all objects have a default action.
237 STDMETHODIMP
get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
);
239 // Retrieves a string that describes the visual appearance of the specified object.
240 // Not all objects have a description.
242 STDMETHODIMP
get_accDescription ( VARIANT varID
, BSTR
* pszDescription
);
244 // Retrieves an object's Help property string.
245 // Not all objects support this property.
247 STDMETHODIMP
get_accHelp ( VARIANT varID
, BSTR
* pszHelp
);
249 // Retrieves the full path of the WinHelp file associated with the specified
250 // object and the identifier of the appropriate topic within that file.
251 // Not all objects support this property.
253 STDMETHODIMP
get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
);
255 // Retrieves the specified object's shortcut key or access key, also known as
256 // the mnemonic. All objects that have a shortcut key or access key support
259 STDMETHODIMP
get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
);
261 // Retrieves the name of the specified object.
262 // All objects support this property.
264 STDMETHODIMP
get_accName ( VARIANT varID
, BSTR
* pszName
);
266 // Retrieves information that describes the role of the specified object.
267 // All objects support this property.
269 STDMETHODIMP
get_accRole ( VARIANT varID
, VARIANT
* pVarRole
);
271 // Retrieves the current state of the specified object.
272 // All objects support this property.
274 STDMETHODIMP
get_accState ( VARIANT varID
, VARIANT
* pVarState
);
276 // Retrieves the value of the specified object.
277 // Not all objects have a value.
279 STDMETHODIMP
get_accValue ( VARIANT varID
, BSTR
* pszValue
);
281 // Selection and Focus
283 // Modifies the selection or moves the keyboard focus of the
284 // specified object. All objects that select or receive the
285 // keyboard focus must support this method.
287 STDMETHODIMP
accSelect ( long flagsSelect
, VARIANT varID
);
289 // Retrieves the object that has the keyboard focus. All objects
290 // that receive the keyboard focus must support this property.
292 STDMETHODIMP
get_accFocus ( VARIANT
* pVarID
);
294 // Retrieves the selected children of this object. All objects
295 // selected must support this property.
297 STDMETHODIMP
get_accSelection ( VARIANT
* pVarChildren
);
301 STDMETHODIMP
put_accName(VARIANT
WXUNUSED(varChild
), BSTR
WXUNUSED(szName
)) { return E_FAIL
; }
302 STDMETHODIMP
put_accValue(VARIANT
WXUNUSED(varChild
), BSTR
WXUNUSED(szName
)) { return E_FAIL
; }
308 STDMETHODIMP
GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
);
310 // Get type info count
312 STDMETHODIMP
GetTypeInfoCount(unsigned int* typeInfoCount
);
316 STDMETHODIMP
GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
317 LCID lcid
, DISPID
* dispId
);
321 STDMETHODIMP
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
322 WORD wFlags
, DISPPARAMS
*pDispParams
,
323 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
324 unsigned int *puArgErr
);
328 // Gets the standard IAccessible interface for the given child or object.
329 // Call Release if this is non-NULL.
330 IAccessible
* GetChildStdAccessible(int id
);
332 // Gets the IAccessible interface for the given child or object.
333 // Call Release if this is non-NULL.
334 IAccessible
* GetChildAccessible(int id
);
337 wxAccessible
*m_pAccessible
; // pointer to C++ class we belong to
339 DECLARE_NO_COPY_CLASS(wxIAccessible
)
342 // ============================================================================
344 // ============================================================================
346 // ----------------------------------------------------------------------------
347 // wxIAccessible implementation
348 // ----------------------------------------------------------------------------
349 BEGIN_IID_TABLE(wxIAccessible
)
355 IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible
)
357 wxIAccessible::wxIAccessible(wxAccessible
*pAccessible
)
359 wxASSERT( pAccessible
!= NULL
);
361 m_pAccessible
= pAccessible
;
364 // Retrieves the child element or child object at a given point on the screen.
365 // All visual objects support this method; sound objects do not support it.
367 STDMETHODIMP
wxIAccessible::accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
)
369 wxLogTrace(wxT("access"), wxT("accHitTest"));
370 wxASSERT (m_pAccessible
!= NULL
);
374 wxAccessible
* childObject
= NULL
;
378 wxAccStatus status
= m_pAccessible
->HitTest(wxPoint(xLeft
, yLeft
), & childId
, & childObject
);
380 if (status
== wxACC_FAIL
)
383 if (status
== wxACC_NOT_IMPLEMENTED
)
385 // Use standard interface instead.
386 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
390 return stdInterface
->accHitTest(xLeft
, yLeft
, pVarID
);
395 if (childObject
== m_pAccessible
)
398 pVarID
->lVal
= CHILDID_SELF
;
403 wxIAccessible
* childIA
= childObject
->GetIAccessible();
407 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
410 pVarID
->vt
= VT_DISPATCH
;
414 else if (childId
> 0)
417 pVarID
->lVal
= childId
;
422 pVarID
->vt
= VT_EMPTY
;
427 // all cases above already cause some return action so below line
428 // is unreachable and cause unnecessary warning
433 // Retrieves the specified object's current screen location. All visual objects must
434 // support this method; sound objects do not support it.
436 STDMETHODIMP
wxIAccessible::accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
)
438 wxLogTrace(wxT("access"), wxT("accLocation"));
439 wxASSERT (m_pAccessible
!= NULL
);
445 wxAccStatus status
= m_pAccessible
->GetLocation(rect
, varID
.lVal
);
446 if (status
== wxACC_FAIL
)
449 if (status
== wxACC_NOT_IMPLEMENTED
)
451 // Try to use child object directly.
454 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
458 HRESULT hResult
= childAccessible
->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
459 childAccessible
->Release();
462 else if (m_pAccessible
->GetIAccessibleStd())
463 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
465 else if (m_pAccessible
->GetIAccessibleStd())
466 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
472 *pcxWidth
= rect
.width
;
473 *pcyHeight
= rect
.height
;
480 // Traverses to another user interface element within a container and retrieves the object.
481 // All visual objects must support this method.
483 STDMETHODIMP
wxIAccessible::accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
)
485 wxASSERT (m_pAccessible
!= NULL
);
488 wxLogTrace(wxT("access"), wxString(wxT("accNavigate for ")) + m_pAccessible
->GetWindow()->GetClassInfo()->GetClassName());
490 if ((varStart
.vt
!= VT_I4
&& varStart
.vt
!= VT_EMPTY
)
492 // according to MSDN and sources varStart.vt is unsigned
493 // so below line cause warning "Condition is always false"
498 wxLogTrace(wxT("access"), wxT("Invalid arg for accNavigate"));
502 wxAccessible
* elementObject
= NULL
;
504 VariantInit(pVarEnd
);
505 wxNavDir navDirWX
= wxNAVDIR_FIRSTCHILD
;
512 navDirWX
= wxNAVDIR_DOWN
;
513 navStr
= wxT("wxNAVDIR_DOWN");
516 case NAVDIR_FIRSTCHILD
:
517 navDirWX
= wxNAVDIR_FIRSTCHILD
;
518 navStr
= wxT("wxNAVDIR_FIRSTCHILD");
521 case NAVDIR_LASTCHILD
:
522 navDirWX
= wxNAVDIR_LASTCHILD
;
523 navStr
= wxT("wxNAVDIR_LASTCHILD");
527 navDirWX
= wxNAVDIR_LEFT
;
528 navStr
= wxT("wxNAVDIR_LEFT");
532 navDirWX
= wxNAVDIR_NEXT
;
533 navStr
= wxT("wxNAVDIR_NEXT");
536 case NAVDIR_PREVIOUS
:
537 navDirWX
= wxNAVDIR_PREVIOUS
;
538 navStr
= wxT("wxNAVDIR_PREVIOUS");
542 navDirWX
= wxNAVDIR_RIGHT
;
543 navStr
= wxT("wxNAVDIR_RIGHT");
547 navDirWX
= wxNAVDIR_UP
;
548 navStr
= wxT("wxNAVDIR_UP");
552 wxLogTrace(wxT("access"), wxT("Unknown NAVDIR symbol"));
556 wxLogTrace(wxT("access"), navStr
);
558 wxAccStatus status
= m_pAccessible
->Navigate(navDirWX
, varStart
.lVal
, & elementId
,
561 if (status
== wxACC_FAIL
)
563 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate failed"));
567 if (status
== wxACC_FALSE
)
569 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate found no object in this direction"));
573 if (status
== wxACC_NOT_IMPLEMENTED
)
575 wxLogTrace(wxT("access"), wxT("Navigate not implemented"));
577 // Try to use child object directly.
578 if (varStart
.vt
== VT_I4
&& varStart
.lVal
> 0)
580 IAccessible
* childAccessible
= GetChildAccessible(varStart
.lVal
);
584 HRESULT hResult
= childAccessible
->accNavigate(navDir
, varStart
, pVarEnd
);
585 childAccessible
->Release();
588 else if (m_pAccessible
->GetIAccessibleStd())
589 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
591 else if (m_pAccessible
->GetIAccessibleStd())
592 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
598 wxLogTrace(wxT("access"), wxT("Getting wxIAccessible and calling QueryInterface for Navigate"));
599 wxIAccessible
* objectIA
= elementObject
->GetIAccessible();
602 wxLogTrace(wxT("access"), wxT("No wxIAccessible"));
606 HRESULT hResult
= objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarEnd
->pdispVal
);
609 wxLogTrace(wxT("access"), wxT("QueryInterface failed"));
613 wxLogTrace(wxT("access"), wxT("Called QueryInterface for Navigate"));
614 pVarEnd
->vt
= VT_DISPATCH
;
617 else if (elementId
> 0)
619 wxLogTrace(wxT("access"), wxT("Returning element id from Navigate"));
621 pVarEnd
->lVal
= elementId
;
626 wxLogTrace(wxT("access"), wxT("No object in accNavigate"));
627 pVarEnd
->vt
= VT_EMPTY
;
632 wxLogTrace(wxT("access"), wxT("Failing Navigate"));
636 // Retrieves the address of an IDispatch interface for the specified child.
637 // All objects must support this property.
639 STDMETHODIMP
wxIAccessible::get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
)
641 wxLogTrace(wxT("access"), wxT("get_accChild"));
642 wxASSERT (m_pAccessible
!= NULL
);
646 if (varChildID
.vt
!= VT_I4
)
648 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accChild"));
652 if (varChildID
.lVal
== CHILDID_SELF
)
659 wxAccessible
* child
= NULL
;
661 wxAccStatus status
= m_pAccessible
->GetChild(varChildID
.lVal
, & child
);
662 if (status
== wxACC_FAIL
)
664 wxLogTrace(wxT("access"), wxT("GetChild failed"));
668 if (status
== wxACC_NOT_IMPLEMENTED
)
670 // Use standard interface instead.
671 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
676 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChild"));
677 return stdInterface
->get_accChild (varChildID
, ppDispChild
);
684 wxIAccessible
* objectIA
= child
->GetIAccessible();
688 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispChild
) != S_OK
)
690 wxLogTrace(wxT("access"), wxT("QueryInterface failed in get_accChild"));
698 wxLogTrace(wxT("access"), wxT("Not an accessible object"));
699 return S_FALSE
; // Indicates it's not an accessible object
704 // all cases above already cause some return action so below line
705 // is unreachable and cause unnecessary warning
710 // Retrieves the number of children that belong to this object.
711 // All objects must support this property.
713 STDMETHODIMP
wxIAccessible::get_accChildCount ( long* pCountChildren
)
715 wxLogTrace(wxT("access"), wxT("get_accChildCount"));
716 wxASSERT (m_pAccessible
!= NULL
);
721 wxAccStatus status
= m_pAccessible
->GetChildCount(& childCount
);
722 if (status
== wxACC_FAIL
)
725 if (status
== wxACC_NOT_IMPLEMENTED
)
727 // Use standard interface instead.
728 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
733 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChildCount"));
734 HRESULT res
= stdInterface
->get_accChildCount (pCountChildren
);
736 str
.Printf(wxT("Number of children was %d"), (int) (*pCountChildren
));
737 wxLogTrace(wxT("access"), str
);
743 * pCountChildren
= (long) childCount
;
748 // all cases above already cause some return action so below line
749 // is unreachable and cause unnecessary warning
754 // Retrieves the IDispatch interface of the object's parent.
755 // All objects support this property.
757 STDMETHODIMP
wxIAccessible::get_accParent ( IDispatch
** ppDispParent
)
759 wxLogTrace(wxT("access"), wxT("get_accParent"));
760 wxASSERT (m_pAccessible
!= NULL
);
764 wxAccessible
* parent
= NULL
;
765 wxAccStatus status
= m_pAccessible
->GetParent(& parent
);
767 if (status
== wxACC_FAIL
)
770 // It doesn't seem acceptable to return S_FALSE with a NULL
771 // ppDispParent, so if we have no wxWidgets parent, we leave
772 // it to the standard interface.
773 if (status
== wxACC_NOT_IMPLEMENTED
|| !parent
)
775 wxLogTrace(wxT("access"), wxT("Using standard interface to get the parent."));
776 // Use standard interface instead.
777 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
781 return stdInterface
->get_accParent (ppDispParent
);
787 wxIAccessible
* objectIA
= parent
->GetIAccessible();
791 wxLogTrace(wxT("access"), wxT("About to call QueryInterface"));
792 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispParent
) != S_OK
)
794 wxLogTrace(wxT("access"), wxT("Failed QueryInterface"));
798 wxLogTrace(wxT("access"), wxT("Returning S_OK for get_accParent"));
803 // This doesn't seem to be allowed, despite the documentation,
804 // so we handle it higher up by using the standard interface.
805 wxLogTrace(wxT("access"), wxT("Returning NULL parent because there was none"));
806 *ppDispParent
= NULL
;
812 // all cases above already cause some return action so below line
813 // is unreachable and cause unnecessary warning
818 // Performs the object's default action. Not all objects have a default
821 STDMETHODIMP
wxIAccessible::accDoDefaultAction(VARIANT varID
)
823 wxLogTrace(wxT("access"), wxT("accDoDefaultAction"));
824 wxASSERT (m_pAccessible
!= NULL
);
828 if (varID
.vt
!= VT_I4
)
830 wxLogTrace(wxT("access"), wxT("Invalid arg for accDoDefaultAction"));
834 wxAccStatus status
= m_pAccessible
->DoDefaultAction(varID
.lVal
);
835 if (status
== wxACC_FAIL
)
838 if (status
== wxACC_NOT_SUPPORTED
)
839 return DISP_E_MEMBERNOTFOUND
;
841 if (status
== wxACC_NOT_IMPLEMENTED
)
843 // Try to use child object directly.
846 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
850 HRESULT hResult
= childAccessible
->accDoDefaultAction(varID
);
851 childAccessible
->Release();
854 else if (m_pAccessible
->GetIAccessibleStd())
855 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
857 else if (m_pAccessible
->GetIAccessibleStd())
858 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
863 // Retrieves a string that describes the object's default action.
864 // Not all objects have a default action.
866 STDMETHODIMP
wxIAccessible::get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
)
868 wxLogTrace(wxT("access"), wxT("get_accDefaultAction"));
869 wxASSERT (m_pAccessible
!= NULL
);
873 if (varID
.vt
!= VT_I4
)
875 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDefaultAction"));
879 wxString defaultAction
;
880 wxAccStatus status
= m_pAccessible
->GetDefaultAction(varID
.lVal
, & defaultAction
);
881 if (status
== wxACC_FAIL
)
884 if (status
== wxACC_NOT_SUPPORTED
)
885 return DISP_E_MEMBERNOTFOUND
;
887 if (status
== wxACC_NOT_IMPLEMENTED
)
889 // Try to use child object directly.
892 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
896 HRESULT hResult
= childAccessible
->get_accDefaultAction(varID
, pszDefaultAction
);
897 childAccessible
->Release();
900 else if (m_pAccessible
->GetIAccessibleStd())
901 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
903 else if (m_pAccessible
->GetIAccessibleStd())
904 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
908 if (defaultAction
.IsEmpty())
910 * pszDefaultAction
= NULL
;
915 wxBasicString
basicString(defaultAction
);
916 * pszDefaultAction
= basicString
.Get();
923 // Retrieves a string that describes the visual appearance of the specified object.
924 // Not all objects have a description.
926 STDMETHODIMP
wxIAccessible::get_accDescription ( VARIANT varID
, BSTR
* pszDescription
)
928 wxLogTrace(wxT("access"), wxT("get_accDescription"));
929 wxASSERT (m_pAccessible
!= NULL
);
933 if (varID
.vt
!= VT_I4
)
935 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDescription"));
939 wxString description
;
940 wxAccStatus status
= m_pAccessible
->GetDescription(varID
.lVal
, & description
);
941 if (status
== wxACC_FAIL
)
944 if (status
== wxACC_NOT_IMPLEMENTED
)
946 // Try to use child object directly.
949 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
953 HRESULT hResult
= childAccessible
->get_accDescription(varID
, pszDescription
);
954 childAccessible
->Release();
957 else if (m_pAccessible
->GetIAccessibleStd())
958 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
960 else if (m_pAccessible
->GetIAccessibleStd())
961 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
965 if (description
.empty())
967 * pszDescription
= NULL
;
972 wxBasicString
basicString(description
);
973 * pszDescription
= basicString
.Get();
980 // Retrieves an object's Help property string.
981 // Not all objects support this property.
983 STDMETHODIMP
wxIAccessible::get_accHelp ( VARIANT varID
, BSTR
* pszHelp
)
985 wxLogTrace(wxT("access"), wxT("get_accHelp"));
986 wxASSERT (m_pAccessible
!= NULL
);
990 if (varID
.vt
!= VT_I4
)
992 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelp"));
997 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & helpString
);
998 if (status
== wxACC_FAIL
)
1001 if (status
== wxACC_NOT_IMPLEMENTED
)
1003 // Try to use child object directly.
1006 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1007 if (childAccessible
)
1010 HRESULT hResult
= childAccessible
->get_accHelp(varID
, pszHelp
);
1011 childAccessible
->Release();
1014 else if (m_pAccessible
->GetIAccessibleStd())
1015 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp(varID
, pszHelp
);
1017 else if (m_pAccessible
->GetIAccessibleStd())
1018 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp (varID
, pszHelp
);
1022 if (helpString
.empty())
1029 wxBasicString
basicString(helpString
);
1030 * pszHelp
= basicString
.Get();
1037 // Retrieves the full path of the WinHelp file associated with the specified
1038 // object and the identifier of the appropriate topic within that file.
1039 // Not all objects support this property.
1040 // NOTE: not supported by wxWidgets at this time. Use
1041 // GetHelpText instead.
1043 STDMETHODIMP
wxIAccessible::get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
)
1045 wxLogTrace(wxT("access"), wxT("get_accHelpTopic"));
1046 wxASSERT (m_pAccessible
!= NULL
);
1050 if (varChild
.vt
!= VT_I4
)
1052 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelpTopic"));
1053 return E_INVALIDARG
;
1056 wxAccStatus status
= wxACC_NOT_IMPLEMENTED
;
1057 if (status
== wxACC_FAIL
)
1060 if (status
== wxACC_NOT_IMPLEMENTED
)
1062 // Try to use child object directly.
1063 if (varChild
.lVal
> 0)
1065 IAccessible
* childAccessible
= GetChildAccessible(varChild
.lVal
);
1066 if (childAccessible
)
1069 HRESULT hResult
= childAccessible
->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1070 childAccessible
->Release();
1073 else if (m_pAccessible
->GetIAccessibleStd())
1074 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1076 else if (m_pAccessible
->GetIAccessibleStd())
1077 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic (pszHelpFile
, varChild
, pidTopic
);
1082 // Retrieves the specified object's shortcut key or access key, also known as
1083 // the mnemonic. All objects that have a shortcut key or access key support
1086 STDMETHODIMP
wxIAccessible::get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
)
1088 wxLogTrace(wxT("access"), wxT("get_accKeyboardShortcut"));
1089 *pszKeyboardShortcut
= NULL
;
1091 wxASSERT (m_pAccessible
!= NULL
);
1095 if (varID
.vt
!= VT_I4
)
1097 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accKeyboardShortcut"));
1098 return E_INVALIDARG
;
1101 wxString keyboardShortcut
;
1102 wxAccStatus status
= m_pAccessible
->GetKeyboardShortcut(varID
.lVal
, & keyboardShortcut
);
1103 if (status
== wxACC_FAIL
)
1106 if (status
== wxACC_NOT_IMPLEMENTED
)
1108 // Try to use child object directly.
1111 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1112 if (childAccessible
)
1115 HRESULT hResult
= childAccessible
->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1116 childAccessible
->Release();
1119 else if (m_pAccessible
->GetIAccessibleStd())
1120 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1122 else if (m_pAccessible
->GetIAccessibleStd())
1123 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut (varID
, pszKeyboardShortcut
);
1127 if (keyboardShortcut
.empty())
1129 * pszKeyboardShortcut
= NULL
;
1134 wxBasicString
basicString(keyboardShortcut
);
1135 * pszKeyboardShortcut
= basicString
.Get();
1142 // Retrieves the name of the specified object.
1143 // All objects support this property.
1145 STDMETHODIMP
wxIAccessible::get_accName ( VARIANT varID
, BSTR
* pszName
)
1147 wxLogTrace(wxT("access"), wxT("get_accName"));
1150 wxASSERT (m_pAccessible
!= NULL
);
1154 if (varID
.vt
!= VT_I4
)
1156 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accName"));
1157 return E_INVALIDARG
;
1162 wxAccStatus status
= m_pAccessible
->GetName(varID
.lVal
, & name
);
1164 if (status
== wxACC_FAIL
)
1167 if (status
== wxACC_NOT_IMPLEMENTED
)
1169 // Try to use child object directly.
1172 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1173 if (childAccessible
)
1176 HRESULT hResult
= childAccessible
->get_accName(varID
, pszName
);
1177 childAccessible
->Release();
1180 else if (m_pAccessible
->GetIAccessibleStd())
1181 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName(varID
, pszName
);
1183 else if (m_pAccessible
->GetIAccessibleStd())
1184 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName (varID
, pszName
);
1188 wxBasicString
basicString(name
);
1189 *pszName
= basicString
.Get();
1195 // Retrieves information that describes the role of the specified object.
1196 // All objects support this property.
1198 STDMETHODIMP
wxIAccessible::get_accRole ( VARIANT varID
, VARIANT
* pVarRole
)
1200 wxLogTrace(wxT("access"), wxT("get_accRole"));
1201 wxASSERT (m_pAccessible
!= NULL
);
1205 if (varID
.vt
!= VT_I4
)
1207 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accRole"));
1208 return E_INVALIDARG
;
1211 VariantInit(pVarRole
);
1213 wxAccRole role
= wxROLE_NONE
;
1215 wxAccStatus status
= m_pAccessible
->GetRole(varID
.lVal
, & role
);
1217 if (status
== wxACC_FAIL
)
1220 if (status
== wxACC_NOT_IMPLEMENTED
)
1222 // Try to use child object directly.
1225 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1226 if (childAccessible
)
1229 HRESULT hResult
= childAccessible
->get_accRole(varID
, pVarRole
);
1230 childAccessible
->Release();
1233 else if (m_pAccessible
->GetIAccessibleStd())
1234 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole(varID
, pVarRole
);
1236 else if (m_pAccessible
->GetIAccessibleStd())
1237 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole (varID
, pVarRole
);
1241 if (role
== wxROLE_NONE
)
1243 pVarRole
->vt
= VT_EMPTY
;
1247 pVarRole
->lVal
= wxConvertToWindowsRole(role
);
1248 pVarRole
->vt
= VT_I4
;
1255 // Retrieves the current state of the specified object.
1256 // All objects support this property.
1258 STDMETHODIMP
wxIAccessible::get_accState ( VARIANT varID
, VARIANT
* pVarState
)
1260 wxLogTrace(wxT("access"), wxT("get_accState"));
1261 wxASSERT (m_pAccessible
!= NULL
);
1265 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1267 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accState"));
1268 return E_INVALIDARG
;
1273 wxAccStatus status
= m_pAccessible
->GetState(varID
.lVal
, & wxstate
);
1274 if (status
== wxACC_FAIL
)
1277 if (status
== wxACC_NOT_IMPLEMENTED
)
1279 // Try to use child object directly.
1282 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1283 if (childAccessible
)
1286 HRESULT hResult
= childAccessible
->get_accState(varID
, pVarState
);
1287 childAccessible
->Release();
1290 else if (m_pAccessible
->GetIAccessibleStd())
1291 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState(varID
, pVarState
);
1293 else if (m_pAccessible
->GetIAccessibleStd())
1294 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState (varID
, pVarState
);
1298 long state
= wxConvertToWindowsState(wxstate
);
1299 pVarState
->lVal
= state
;
1300 pVarState
->vt
= VT_I4
;
1306 // Retrieves the value of the specified object.
1307 // Not all objects have a value.
1309 STDMETHODIMP
wxIAccessible::get_accValue ( VARIANT varID
, BSTR
* pszValue
)
1311 wxLogTrace(wxT("access"), wxT("get_accValue"));
1312 wxASSERT (m_pAccessible
!= NULL
);
1316 if (varID
.vt
!= VT_I4
)
1318 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accValue"));
1319 return E_INVALIDARG
;
1324 wxAccStatus status
= m_pAccessible
->GetValue(varID
.lVal
, & strValue
);
1326 if (status
== wxACC_FAIL
)
1329 if (status
== wxACC_NOT_IMPLEMENTED
)
1331 // Try to use child object directly.
1334 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1335 if (childAccessible
)
1338 HRESULT hResult
= childAccessible
->get_accValue(varID
, pszValue
);
1339 childAccessible
->Release();
1342 else if (m_pAccessible
->GetIAccessibleStd())
1343 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue(varID
, pszValue
);
1345 else if (m_pAccessible
->GetIAccessibleStd())
1346 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue (varID
, pszValue
);
1350 wxBasicString
basicString(strValue
);
1351 * pszValue
= basicString
.Get();
1357 // Modifies the selection or moves the keyboard focus of the
1358 // specified object. All objects that select or receive the
1359 // keyboard focus must support this method.
1361 STDMETHODIMP
wxIAccessible::accSelect ( long flagsSelect
, VARIANT varID
)
1363 wxLogTrace(wxT("access"), wxT("get_accSelect"));
1364 wxASSERT (m_pAccessible
!= NULL
);
1368 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1370 wxLogTrace(wxT("access"), wxT("Invalid arg for accSelect"));
1371 return E_INVALIDARG
;
1374 wxAccSelectionFlags wxsel
= wxConvertFromWindowsSelFlag(flagsSelect
);
1376 wxAccStatus status
= m_pAccessible
->Select(varID
.lVal
, wxsel
);
1377 if (status
== wxACC_FAIL
)
1380 if (status
== wxACC_NOT_IMPLEMENTED
)
1382 // Try to use child object directly.
1383 if (varID
.lVal
> 0 && varID
.lVal
> 0)
1385 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1386 if (childAccessible
)
1389 HRESULT hResult
= childAccessible
->accSelect(flagsSelect
, varID
);
1390 childAccessible
->Release();
1393 else if (m_pAccessible
->GetIAccessibleStd())
1394 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1396 else if (m_pAccessible
->GetIAccessibleStd())
1397 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1405 // Retrieves the object that has the keyboard focus. All objects
1406 // that receive the keyboard focus must support this property.
1408 STDMETHODIMP
wxIAccessible::get_accFocus ( VARIANT
* pVarID
)
1410 wxLogTrace(wxT("access"), wxT("get_accFocus"));
1411 wxASSERT (m_pAccessible
!= NULL
);
1415 wxAccessible
* childObject
= NULL
;
1417 VariantInit(pVarID
);
1419 wxAccStatus status
= m_pAccessible
->GetFocus(& childId
, & childObject
);
1420 if (status
== wxACC_FAIL
)
1423 if (status
== wxACC_NOT_IMPLEMENTED
)
1425 // Use standard interface instead.
1426 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1430 return stdInterface
->get_accFocus (pVarID
);
1434 if (childObject
== m_pAccessible
)
1437 pVarID
->lVal
= CHILDID_SELF
;
1441 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1445 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
1448 pVarID
->vt
= VT_DISPATCH
;
1452 else if (childId
> 0)
1455 pVarID
->lVal
= childId
;
1460 pVarID
->vt
= VT_EMPTY
;
1465 // all cases above already cause some return action so below line
1466 // is unreachable and cause unnecessary warning
1471 // Retrieves the selected children of this object. All objects
1472 // selected must support this property.
1474 STDMETHODIMP
wxIAccessible::get_accSelection ( VARIANT
* pVarChildren
)
1477 wxLogTrace(wxT("access"), wxT("get_accSelection"));
1478 wxASSERT (m_pAccessible
!= NULL
);
1482 VariantInit(pVarChildren
);
1484 wxVariant selections
;
1485 wxAccStatus status
= m_pAccessible
->GetSelections(& selections
);
1486 if (status
== wxACC_FAIL
)
1489 if (status
== wxACC_NOT_IMPLEMENTED
)
1491 // Use standard interface instead.
1492 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1496 return stdInterface
->get_accSelection (pVarChildren
);
1500 if (selections
.GetType() == wxT("long"))
1502 pVarChildren
->vt
= VT_I4
;
1503 pVarChildren
->lVal
= selections
.GetLong();
1507 else if (selections
.GetType() == wxT("void*"))
1509 wxAccessible
* childObject
= (wxAccessible
*) selections
.GetVoidPtr();
1510 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1514 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarChildren
->pdispVal
) != S_OK
)
1517 pVarChildren
->vt
= VT_DISPATCH
;
1521 else if (selections
.GetType() == wxT("list"))
1523 // TODO: should we AddRef for every "void*" member??
1525 wxIEnumVARIANT
* enumVariant
= new wxIEnumVARIANT(selections
);
1526 enumVariant
->AddRef();
1528 pVarChildren
->vt
= VT_UNKNOWN
;
1529 pVarChildren
->punkVal
= enumVariant
;
1535 wxUnusedVar(pVarChildren
);
1536 #endif // wxUSE_VARIANT
1543 STDMETHODIMP
wxIAccessible::GetTypeInfo(unsigned int WXUNUSED(typeInfo
), LCID
WXUNUSED(lcid
), ITypeInfo
** ppTypeInfo
)
1549 // Get type info count
1551 STDMETHODIMP
wxIAccessible::GetTypeInfoCount(unsigned int* typeInfoCount
)
1559 STDMETHODIMP
wxIAccessible::GetIDsOfNames(REFIID
WXUNUSED(riid
), OLECHAR
** WXUNUSED(names
), unsigned int WXUNUSED(cNames
),
1560 LCID
WXUNUSED(lcid
), DISPID
* WXUNUSED(dispId
))
1567 STDMETHODIMP
wxIAccessible::Invoke(DISPID
WXUNUSED(dispIdMember
), REFIID
WXUNUSED(riid
), LCID
WXUNUSED(lcid
),
1568 WORD
WXUNUSED(wFlags
), DISPPARAMS
*WXUNUSED(pDispParams
),
1569 VARIANT
*WXUNUSED(pVarResult
), EXCEPINFO
*WXUNUSED(pExcepInfo
),
1570 unsigned int *WXUNUSED(puArgErr
) )
1575 // Gets the standard IAccessible interface for the given child or object.
1576 // Call Release if this is non-NULL.
1577 IAccessible
* wxIAccessible::GetChildStdAccessible(int id
)
1581 IAccessible
* obj
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1592 IDispatch
* pDispatch
= NULL
;
1593 if (S_OK
== get_accChild ( var
, & pDispatch
))
1595 IAccessible
* childAccessible
= NULL
;
1596 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1598 pDispatch
->Release();
1599 wxIAccessible
* c
= (wxIAccessible
*) childAccessible
;
1600 IAccessible
* stdChildAccessible
= (IAccessible
*) c
->m_pAccessible
->GetIAccessibleStd();
1601 stdChildAccessible
->AddRef();
1602 childAccessible
->Release();
1603 return stdChildAccessible
;
1607 pDispatch
->Release();
1614 // Loop until we find the right id
1616 this->get_accChildCount(& nChildren
);
1619 for (i
= 0; i
< nChildren
; i
++)
1625 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1630 var
.vt
= VT_DISPATCH
;
1631 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1633 IAccessible
* childAccessible
= NULL
;
1634 if (var
.pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1636 var
.pdispVal
->Release();
1637 return childAccessible
;
1641 var
.pdispVal
->Release();
1653 // Gets the IAccessible interface for the given child or object.
1654 // Call Release if this is non-NULL.
1655 IAccessible
* wxIAccessible::GetChildAccessible(int id
)
1659 IAccessible
* obj
= this;
1670 IDispatch
* pDispatch
= NULL
;
1671 if (S_OK
== get_accChild ( var
, & pDispatch
))
1673 IAccessible
* childAccessible
= NULL
;
1674 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1676 pDispatch
->Release();
1677 return childAccessible
;
1681 pDispatch
->Release();
1688 // ----------------------------------------------------------------------------
1689 // wxAccessible implementation
1690 // ----------------------------------------------------------------------------
1694 // common part of all ctors
1695 void wxAccessible::Init()
1697 m_pIAccessibleStd
= NULL
;
1698 m_pIAccessible
= new wxIAccessible(this);
1699 m_pIAccessible
->AddRef();
1702 wxAccessible::wxAccessible(wxWindow
* win
)
1703 : wxAccessibleBase(win
)
1708 wxAccessible::~wxAccessible()
1710 m_pIAccessible
->Release();
1711 if (m_pIAccessibleStd
)
1712 ((IAccessible
*)m_pIAccessibleStd
)->Release();
1715 // Gets or creates a standard interface for this object.
1716 void* wxAccessible::GetIAccessibleStd()
1718 if (m_pIAccessibleStd
)
1719 return m_pIAccessibleStd
;
1723 HRESULT retCode
= ::CreateStdAccessibleObject((HWND
) GetWindow()->GetHWND(),
1724 OBJID_CLIENT
, IID_IAccessible
, (void**) & m_pIAccessibleStd
);
1725 if (retCode
== S_OK
)
1726 return m_pIAccessibleStd
;
1729 m_pIAccessibleStd
= NULL
;
1736 // Sends an event when something changes in an accessible object.
1737 void wxAccessible::NotifyEvent(int eventType
, wxWindow
* window
, wxAccObject objectType
,
1740 ::NotifyWinEvent((DWORD
) eventType
, (HWND
) window
->GetHWND(),
1741 (LONG
) objectType
, (LONG
) objectId
);
1746 // Convert to Windows role
1747 int wxConvertToWindowsRole(wxAccRole wxrole
)
1751 case wxROLE_SYSTEM_ALERT
:
1752 return ROLE_SYSTEM_ALERT
;
1753 case wxROLE_SYSTEM_ANIMATION
:
1754 return ROLE_SYSTEM_ANIMATION
;
1755 case wxROLE_SYSTEM_APPLICATION
:
1756 return ROLE_SYSTEM_APPLICATION
;
1757 case wxROLE_SYSTEM_BORDER
:
1758 return ROLE_SYSTEM_BORDER
;
1759 case wxROLE_SYSTEM_BUTTONDROPDOWN
:
1760 return ROLE_SYSTEM_BUTTONDROPDOWN
;
1761 case wxROLE_SYSTEM_BUTTONDROPDOWNGRID
:
1762 return ROLE_SYSTEM_BUTTONDROPDOWNGRID
;
1763 case wxROLE_SYSTEM_BUTTONMENU
:
1764 return ROLE_SYSTEM_BUTTONMENU
;
1765 case wxROLE_SYSTEM_CARET
:
1766 return ROLE_SYSTEM_CARET
;
1767 case wxROLE_SYSTEM_CELL
:
1768 return ROLE_SYSTEM_CELL
;
1769 case wxROLE_SYSTEM_CHARACTER
:
1770 return ROLE_SYSTEM_CHARACTER
;
1771 case wxROLE_SYSTEM_CHART
:
1772 return ROLE_SYSTEM_CHART
;
1773 case wxROLE_SYSTEM_CHECKBUTTON
:
1774 return ROLE_SYSTEM_CHECKBUTTON
;
1775 case wxROLE_SYSTEM_CLIENT
:
1776 return ROLE_SYSTEM_CLIENT
;
1777 case wxROLE_SYSTEM_CLOCK
:
1778 return ROLE_SYSTEM_CLOCK
;
1779 case wxROLE_SYSTEM_COLUMN
:
1780 return ROLE_SYSTEM_COLUMN
;
1781 case wxROLE_SYSTEM_COLUMNHEADER
:
1782 return ROLE_SYSTEM_COLUMNHEADER
;
1783 case wxROLE_SYSTEM_COMBOBOX
:
1784 return ROLE_SYSTEM_COMBOBOX
;
1785 case wxROLE_SYSTEM_CURSOR
:
1786 return ROLE_SYSTEM_CURSOR
;
1787 case wxROLE_SYSTEM_DIAGRAM
:
1788 return ROLE_SYSTEM_DIAGRAM
;
1789 case wxROLE_SYSTEM_DIAL
:
1790 return ROLE_SYSTEM_DIAL
;
1791 case wxROLE_SYSTEM_DIALOG
:
1792 return ROLE_SYSTEM_DIALOG
;
1793 case wxROLE_SYSTEM_DOCUMENT
:
1794 return ROLE_SYSTEM_DOCUMENT
;
1795 case wxROLE_SYSTEM_DROPLIST
:
1796 return ROLE_SYSTEM_DROPLIST
;
1797 case wxROLE_SYSTEM_EQUATION
:
1798 return ROLE_SYSTEM_EQUATION
;
1799 case wxROLE_SYSTEM_GRAPHIC
:
1800 return ROLE_SYSTEM_GRAPHIC
;
1801 case wxROLE_SYSTEM_GRIP
:
1802 return ROLE_SYSTEM_GRIP
;
1803 case wxROLE_SYSTEM_GROUPING
:
1804 return ROLE_SYSTEM_GROUPING
;
1805 case wxROLE_SYSTEM_HELPBALLOON
:
1806 return ROLE_SYSTEM_HELPBALLOON
;
1807 case wxROLE_SYSTEM_HOTKEYFIELD
:
1808 return ROLE_SYSTEM_HOTKEYFIELD
;
1809 case wxROLE_SYSTEM_INDICATOR
:
1810 return ROLE_SYSTEM_INDICATOR
;
1811 case wxROLE_SYSTEM_LINK
:
1812 return ROLE_SYSTEM_LINK
;
1813 case wxROLE_SYSTEM_LIST
:
1814 return ROLE_SYSTEM_LIST
;
1815 case wxROLE_SYSTEM_LISTITEM
:
1816 return ROLE_SYSTEM_LISTITEM
;
1817 case wxROLE_SYSTEM_MENUBAR
:
1818 return ROLE_SYSTEM_MENUBAR
;
1819 case wxROLE_SYSTEM_MENUITEM
:
1820 return ROLE_SYSTEM_MENUITEM
;
1821 case wxROLE_SYSTEM_MENUPOPUP
:
1822 return ROLE_SYSTEM_MENUPOPUP
;
1823 case wxROLE_SYSTEM_OUTLINE
:
1824 return ROLE_SYSTEM_OUTLINE
;
1825 case wxROLE_SYSTEM_OUTLINEITEM
:
1826 return ROLE_SYSTEM_OUTLINEITEM
;
1827 case wxROLE_SYSTEM_PAGETAB
:
1828 return ROLE_SYSTEM_PAGETAB
;
1829 case wxROLE_SYSTEM_PAGETABLIST
:
1830 return ROLE_SYSTEM_PAGETABLIST
;
1831 case wxROLE_SYSTEM_PANE
:
1832 return ROLE_SYSTEM_PANE
;
1833 case wxROLE_SYSTEM_PROGRESSBAR
:
1834 return ROLE_SYSTEM_PROGRESSBAR
;
1835 case wxROLE_SYSTEM_PROPERTYPAGE
:
1836 return ROLE_SYSTEM_PROPERTYPAGE
;
1837 case wxROLE_SYSTEM_PUSHBUTTON
:
1838 return ROLE_SYSTEM_PUSHBUTTON
;
1839 case wxROLE_SYSTEM_RADIOBUTTON
:
1840 return ROLE_SYSTEM_RADIOBUTTON
;
1841 case wxROLE_SYSTEM_ROW
:
1842 return ROLE_SYSTEM_ROW
;
1843 case wxROLE_SYSTEM_ROWHEADER
:
1844 return ROLE_SYSTEM_ROWHEADER
;
1845 case wxROLE_SYSTEM_SCROLLBAR
:
1846 return ROLE_SYSTEM_SCROLLBAR
;
1847 case wxROLE_SYSTEM_SEPARATOR
:
1848 return ROLE_SYSTEM_SEPARATOR
;
1849 case wxROLE_SYSTEM_SLIDER
:
1850 return ROLE_SYSTEM_SLIDER
;
1851 case wxROLE_SYSTEM_SOUND
:
1852 return ROLE_SYSTEM_SOUND
;
1853 case wxROLE_SYSTEM_SPINBUTTON
:
1854 return ROLE_SYSTEM_SPINBUTTON
;
1855 case wxROLE_SYSTEM_STATICTEXT
:
1856 return ROLE_SYSTEM_STATICTEXT
;
1857 case wxROLE_SYSTEM_STATUSBAR
:
1858 return ROLE_SYSTEM_STATUSBAR
;
1859 case wxROLE_SYSTEM_TABLE
:
1860 return ROLE_SYSTEM_TABLE
;
1861 case wxROLE_SYSTEM_TEXT
:
1862 return ROLE_SYSTEM_TEXT
;
1863 case wxROLE_SYSTEM_TITLEBAR
:
1864 return ROLE_SYSTEM_TITLEBAR
;
1865 case wxROLE_SYSTEM_TOOLBAR
:
1866 return ROLE_SYSTEM_TOOLBAR
;
1867 case wxROLE_SYSTEM_TOOLTIP
:
1868 return ROLE_SYSTEM_TOOLTIP
;
1869 case wxROLE_SYSTEM_WHITESPACE
:
1870 return ROLE_SYSTEM_WHITESPACE
;
1871 case wxROLE_SYSTEM_WINDOW
:
1872 return ROLE_SYSTEM_WINDOW
;
1877 // Convert to Windows state
1878 long wxConvertToWindowsState(long wxstate
)
1881 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_HIGH
)
1882 state
|= STATE_SYSTEM_ALERT_HIGH
;
1884 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_MEDIUM
)
1885 state
|= STATE_SYSTEM_ALERT_MEDIUM
;
1887 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_LOW
)
1888 state
|= STATE_SYSTEM_ALERT_LOW
;
1890 if (wxstate
& wxACC_STATE_SYSTEM_ANIMATED
)
1891 state
|= STATE_SYSTEM_ANIMATED
;
1893 if (wxstate
& wxACC_STATE_SYSTEM_BUSY
)
1894 state
|= STATE_SYSTEM_BUSY
;
1896 if (wxstate
& wxACC_STATE_SYSTEM_CHECKED
)
1897 state
|= STATE_SYSTEM_CHECKED
;
1899 if (wxstate
& wxACC_STATE_SYSTEM_COLLAPSED
)
1900 state
|= STATE_SYSTEM_COLLAPSED
;
1902 if (wxstate
& wxACC_STATE_SYSTEM_DEFAULT
)
1903 state
|= STATE_SYSTEM_DEFAULT
;
1905 if (wxstate
& wxACC_STATE_SYSTEM_EXPANDED
)
1906 state
|= STATE_SYSTEM_EXPANDED
;
1908 if (wxstate
& wxACC_STATE_SYSTEM_EXTSELECTABLE
)
1909 state
|= STATE_SYSTEM_EXTSELECTABLE
;
1911 if (wxstate
& wxACC_STATE_SYSTEM_FLOATING
)
1912 state
|= STATE_SYSTEM_FLOATING
;
1914 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSABLE
)
1915 state
|= STATE_SYSTEM_FOCUSABLE
;
1917 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSED
)
1918 state
|= STATE_SYSTEM_FOCUSED
;
1920 if (wxstate
& wxACC_STATE_SYSTEM_HOTTRACKED
)
1921 state
|= STATE_SYSTEM_HOTTRACKED
;
1923 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1924 state
|= STATE_SYSTEM_INVISIBLE
;
1926 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1927 state
|= STATE_SYSTEM_INVISIBLE
;
1929 if (wxstate
& wxACC_STATE_SYSTEM_MIXED
)
1930 state
|= STATE_SYSTEM_MIXED
;
1932 if (wxstate
& wxACC_STATE_SYSTEM_MULTISELECTABLE
)
1933 state
|= STATE_SYSTEM_MULTISELECTABLE
;
1935 if (wxstate
& wxACC_STATE_SYSTEM_OFFSCREEN
)
1936 state
|= STATE_SYSTEM_OFFSCREEN
;
1938 if (wxstate
& wxACC_STATE_SYSTEM_PRESSED
)
1939 state
|= STATE_SYSTEM_PRESSED
;
1941 // if (wxstate & wxACC_STATE_SYSTEM_PROTECTED)
1942 // state |= STATE_SYSTEM_PROTECTED;
1944 if (wxstate
& wxACC_STATE_SYSTEM_READONLY
)
1945 state
|= STATE_SYSTEM_READONLY
;
1947 if (wxstate
& wxACC_STATE_SYSTEM_SELECTABLE
)
1948 state
|= STATE_SYSTEM_SELECTABLE
;
1950 if (wxstate
& wxACC_STATE_SYSTEM_SELECTED
)
1951 state
|= STATE_SYSTEM_SELECTED
;
1953 if (wxstate
& wxACC_STATE_SYSTEM_SELFVOICING
)
1954 state
|= STATE_SYSTEM_SELFVOICING
;
1956 if (wxstate
& wxACC_STATE_SYSTEM_UNAVAILABLE
)
1957 state
|= STATE_SYSTEM_UNAVAILABLE
;
1962 // Convert to Windows selection flag
1963 int wxConvertToWindowsSelFlag(wxAccSelectionFlags wxsel
)
1967 if (wxsel
& wxACC_SEL_TAKEFOCUS
)
1968 sel
|= SELFLAG_TAKEFOCUS
;
1969 if (wxsel
& wxACC_SEL_TAKESELECTION
)
1970 sel
|= SELFLAG_TAKESELECTION
;
1971 if (wxsel
& wxACC_SEL_EXTENDSELECTION
)
1972 sel
|= SELFLAG_EXTENDSELECTION
;
1973 if (wxsel
& wxACC_SEL_ADDSELECTION
)
1974 sel
|= SELFLAG_ADDSELECTION
;
1975 if (wxsel
& wxACC_SEL_REMOVESELECTION
)
1976 sel
|= SELFLAG_REMOVESELECTION
;
1980 // Convert from Windows selection flag
1981 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
)
1985 if (sel
& SELFLAG_TAKEFOCUS
)
1986 wxsel
|= wxACC_SEL_TAKEFOCUS
;
1987 if (sel
& SELFLAG_TAKESELECTION
)
1988 wxsel
|= wxACC_SEL_TAKESELECTION
;
1989 if (sel
& SELFLAG_EXTENDSELECTION
)
1990 wxsel
|= wxACC_SEL_EXTENDSELECTION
;
1991 if (sel
& SELFLAG_ADDSELECTION
)
1992 wxsel
|= wxACC_SEL_ADDSELECTION
;
1993 if (sel
& SELFLAG_REMOVESELECTION
)
1994 wxsel
|= wxACC_SEL_REMOVESELECTION
;
1995 return (wxAccSelectionFlags
) wxsel
;
1999 #endif // wxUSE_OLE && wxUSE_ACCESSIBILITY