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