1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/ole/access.cpp
3 // Purpose: implementation of wxIAccessible and wxAccessible
4 // Author: Julian Smart
8 // Copyright: (c) 2003 Julian Smart
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "access.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
27 #if defined(__BORLANDC__)
31 #include "wx/window.h"
36 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
39 #include "wx/access.h"
41 #include "wx/msw/wrapwin.h"
43 // for some compilers, the entire ole2.h must be included, not only oleauto.h
44 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
52 #include "wx/msw/ole/oleutils.h"
55 #define CHILDID_SELF 0
59 #define OBJID_CLIENT 0xFFFFFFFC
62 // Convert to Windows role
63 int wxConvertToWindowsRole(wxAccRole wxrole
);
65 // Convert to Windows state
66 long wxConvertToWindowsState(long wxstate
);
68 // Convert to Windows selection flag
69 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel
);
71 // Convert from Windows selection flag
72 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
);
74 // ----------------------------------------------------------------------------
75 // wxIEnumVARIANT interface implementation
76 // ----------------------------------------------------------------------------
78 class wxIEnumVARIANT
: public IEnumVARIANT
81 wxIEnumVARIANT(const wxVariant
& variant
);
82 virtual ~wxIEnumVARIANT() { }
84 DECLARE_IUNKNOWN_METHODS
;
87 STDMETHODIMP
Next(ULONG celt
, VARIANT
*rgelt
, ULONG
*pceltFetched
);
88 STDMETHODIMP
Skip(ULONG celt
);
90 STDMETHODIMP
Clone(IEnumVARIANT
**ppenum
);
93 wxVariant m_variant
; // List of further variants
94 int m_nCurrent
; // Current enum position
96 DECLARE_NO_COPY_CLASS(wxIEnumVARIANT
)
99 // ----------------------------------------------------------------------------
101 // ----------------------------------------------------------------------------
103 BEGIN_IID_TABLE(wxIEnumVARIANT
)
108 IMPLEMENT_IUNKNOWN_METHODS(wxIEnumVARIANT
)
110 // wxVariant contains a list of further variants.
111 wxIEnumVARIANT::wxIEnumVARIANT(const wxVariant
& variant
)
116 STDMETHODIMP
wxIEnumVARIANT::Next(ULONG celt
,
120 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Next"));
123 // we only return 1 element at a time - mainly because I'm too lazy to
124 // implement something which you're never asked for anyhow
128 if (m_variant
.GetType() != wxT("list"))
131 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() ) {
132 if (!wxConvertVariantToOle(m_variant
[m_nCurrent
++], rgelt
[0]))
137 // TODO: should we AddRef if this is an object?
148 STDMETHODIMP
wxIEnumVARIANT::Skip(ULONG celt
)
150 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Skip"));
152 if (m_variant
.GetType() != wxT("list"))
156 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() )
159 // no, can't skip this many elements
165 STDMETHODIMP
wxIEnumVARIANT::Reset()
167 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Reset"));
174 STDMETHODIMP
wxIEnumVARIANT::Clone(IEnumVARIANT
**ppenum
)
176 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Clone"));
178 wxIEnumVARIANT
*pNew
= new wxIEnumVARIANT(m_variant
);
186 // ----------------------------------------------------------------------------
187 // wxIAccessible implementation of IAccessible interface
188 // ----------------------------------------------------------------------------
190 class wxIAccessible
: public IAccessible
193 wxIAccessible(wxAccessible
*pAccessible
);
195 DECLARE_IUNKNOWN_METHODS
;
199 // Navigation and Hierarchy
201 // Retrieves the child element or child object at a given point on the screen.
202 // All visual objects support this method; sound objects do not support it.
204 STDMETHODIMP
accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
);
206 // Retrieves the specified object's current screen location. All visual objects must
207 // support this method; sound objects do not support it.
209 STDMETHODIMP
accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
);
211 // Traverses to another user interface element within a container and retrieves the object.
212 // All visual objects must support this method.
214 STDMETHODIMP
accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
);
216 // Retrieves the address of an IDispatch interface for the specified child.
217 // All objects must support this property.
219 STDMETHODIMP
get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
);
221 // Retrieves the number of children that belong to this object.
222 // All objects must support this property.
224 STDMETHODIMP
get_accChildCount ( long* pCountChildren
);
226 // Retrieves the IDispatch interface of the object's parent.
227 // All objects support this property.
229 STDMETHODIMP
get_accParent ( IDispatch
** ppDispParent
);
231 // Descriptive Properties and Methods
233 // Performs the object's default action. Not all objects have a default
236 STDMETHODIMP
accDoDefaultAction(VARIANT varID
);
238 // Retrieves a string that describes the object's default action.
239 // Not all objects have a default action.
241 STDMETHODIMP
get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
);
243 // Retrieves a string that describes the visual appearance of the specified object.
244 // Not all objects have a description.
246 STDMETHODIMP
get_accDescription ( VARIANT varID
, BSTR
* pszDescription
);
248 // Retrieves an object's Help property string.
249 // Not all objects support this property.
251 STDMETHODIMP
get_accHelp ( VARIANT varID
, BSTR
* pszHelp
);
253 // Retrieves the full path of the WinHelp file associated with the specified
254 // object and the identifier of the appropriate topic within that file.
255 // Not all objects support this property.
257 STDMETHODIMP
get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
);
259 // Retrieves the specified object's shortcut key or access key, also known as
260 // the mnemonic. All objects that have a shortcut key or access key support
263 STDMETHODIMP
get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
);
265 // Retrieves the name of the specified object.
266 // All objects support this property.
268 STDMETHODIMP
get_accName ( VARIANT varID
, BSTR
* pszName
);
270 // Retrieves information that describes the role of the specified object.
271 // All objects support this property.
273 STDMETHODIMP
get_accRole ( VARIANT varID
, VARIANT
* pVarRole
);
275 // Retrieves the current state of the specified object.
276 // All objects support this property.
278 STDMETHODIMP
get_accState ( VARIANT varID
, VARIANT
* pVarState
);
280 // Retrieves the value of the specified object.
281 // Not all objects have a value.
283 STDMETHODIMP
get_accValue ( VARIANT varID
, BSTR
* pszValue
);
285 // Selection and Focus
287 // Modifies the selection or moves the keyboard focus of the
288 // specified object. All objects that select or receive the
289 // keyboard focus must support this method.
291 STDMETHODIMP
accSelect ( long flagsSelect
, VARIANT varID
);
293 // Retrieves the object that has the keyboard focus. All objects
294 // that receive the keyboard focus must support this property.
296 STDMETHODIMP
get_accFocus ( VARIANT
* pVarID
);
298 // Retrieves the selected children of this object. All objects
299 // selected must support this property.
301 STDMETHODIMP
get_accSelection ( VARIANT
* pVarChildren
);
305 STDMETHODIMP
put_accName(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
306 STDMETHODIMP
put_accValue(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
312 STDMETHODIMP
GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
);
314 // Get type info count
316 STDMETHODIMP
GetTypeInfoCount(unsigned int* typeInfoCount
);
320 STDMETHODIMP
GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
321 LCID lcid
, DISPID
* dispId
);
325 STDMETHODIMP
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
326 WORD wFlags
, DISPPARAMS
*pDispParams
,
327 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
328 unsigned int *puArgErr
);
332 // Gets the standard IAccessible interface for the given child or object.
333 // Call Release if this is non-NULL.
334 IAccessible
* GetChildStdAccessible(int id
);
336 // Gets the IAccessible interface for the given child or object.
337 // Call Release if this is non-NULL.
338 IAccessible
* GetChildAccessible(int id
);
341 wxAccessible
*m_pAccessible
; // pointer to C++ class we belong to
343 DECLARE_NO_COPY_CLASS(wxIAccessible
)
346 // ============================================================================
348 // ============================================================================
350 // ----------------------------------------------------------------------------
351 // wxIAccessible implementation
352 // ----------------------------------------------------------------------------
353 BEGIN_IID_TABLE(wxIAccessible
)
359 IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible
)
361 wxIAccessible::wxIAccessible(wxAccessible
*pAccessible
)
363 wxASSERT( pAccessible
!= NULL
);
365 m_pAccessible
= pAccessible
;
368 // Retrieves the child element or child object at a given point on the screen.
369 // All visual objects support this method; sound objects do not support it.
371 STDMETHODIMP
wxIAccessible::accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
)
373 wxLogTrace(wxT("access"), wxT("accHitTest"));
374 wxASSERT (m_pAccessible
!= NULL
);
378 wxAccessible
* childObject
= NULL
;
382 wxAccStatus status
= m_pAccessible
->HitTest(wxPoint(xLeft
, yLeft
), & childId
, & childObject
);
384 if (status
== wxACC_FAIL
)
387 if (status
== wxACC_NOT_IMPLEMENTED
)
389 // Use standard interface instead.
390 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
394 return stdInterface
->accHitTest(xLeft
, yLeft
, pVarID
);
399 if (childObject
== m_pAccessible
)
402 pVarID
->lVal
= CHILDID_SELF
;
407 wxIAccessible
* childIA
= childObject
->GetIAccessible();
411 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
414 pVarID
->vt
= VT_DISPATCH
;
418 else if (childId
> 0)
421 pVarID
->lVal
= childId
;
426 pVarID
->vt
= VT_EMPTY
;
431 // all cases above already cause some return action so below line
432 // is unreachable and cause unnecessary warning
437 // Retrieves the specified object's current screen location. All visual objects must
438 // support this method; sound objects do not support it.
440 STDMETHODIMP
wxIAccessible::accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
)
442 wxLogTrace(wxT("access"), wxT("accLocation"));
443 wxASSERT (m_pAccessible
!= NULL
);
449 wxAccStatus status
= m_pAccessible
->GetLocation(rect
, varID
.lVal
);
450 if (status
== wxACC_FAIL
)
453 if (status
== wxACC_NOT_IMPLEMENTED
)
455 // Try to use child object directly.
458 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
462 HRESULT hResult
= childAccessible
->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
463 childAccessible
->Release();
466 else if (m_pAccessible
->GetIAccessibleStd())
467 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
469 else if (m_pAccessible
->GetIAccessibleStd())
470 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
476 *pcxWidth
= rect
.width
;
477 *pcyHeight
= rect
.height
;
484 // Traverses to another user interface element within a container and retrieves the object.
485 // All visual objects must support this method.
487 STDMETHODIMP
wxIAccessible::accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
)
489 wxASSERT (m_pAccessible
!= NULL
);
492 wxLogTrace(wxT("access"), wxString(wxT("accNavigate for ")) + m_pAccessible
->GetWindow()->GetClassInfo()->GetClassName());
494 if ((varStart
.vt
!= VT_I4
&& varStart
.vt
!= VT_EMPTY
)
496 // according to MSDN and sources varStart.vt is unsigned
497 // so below line cause warning "Condition is always false"
502 wxLogTrace(wxT("access"), wxT("Invalid arg for accNavigate"));
506 wxAccessible
* elementObject
= NULL
;
508 VariantInit(pVarEnd
);
509 wxNavDir navDirWX
= wxNAVDIR_FIRSTCHILD
;
516 navDirWX
= wxNAVDIR_DOWN
;
517 navStr
= wxT("wxNAVDIR_DOWN");
520 case NAVDIR_FIRSTCHILD
:
521 navDirWX
= wxNAVDIR_FIRSTCHILD
;
522 navStr
= wxT("wxNAVDIR_FIRSTCHILD");
525 case NAVDIR_LASTCHILD
:
526 navDirWX
= wxNAVDIR_LASTCHILD
;
527 navStr
= wxT("wxNAVDIR_LASTCHILD");
531 navDirWX
= wxNAVDIR_LEFT
;
532 navStr
= wxT("wxNAVDIR_LEFT");
536 navDirWX
= wxNAVDIR_NEXT
;
537 navStr
= wxT("wxNAVDIR_NEXT");
540 case NAVDIR_PREVIOUS
:
541 navDirWX
= wxNAVDIR_PREVIOUS
;
542 navStr
= wxT("wxNAVDIR_PREVIOUS");
546 navDirWX
= wxNAVDIR_RIGHT
;
547 navStr
= wxT("wxNAVDIR_RIGHT");
551 navDirWX
= wxNAVDIR_UP
;
552 navStr
= wxT("wxNAVDIR_UP");
556 wxLogTrace(wxT("access"), wxT("Unknown NAVDIR symbol"));
560 wxLogTrace(wxT("access"), navStr
);
562 wxAccStatus status
= m_pAccessible
->Navigate(navDirWX
, varStart
.lVal
, & elementId
,
565 if (status
== wxACC_FAIL
)
567 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate failed"));
571 if (status
== wxACC_FALSE
)
573 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate found no object in this direction"));
577 if (status
== wxACC_NOT_IMPLEMENTED
)
579 wxLogTrace(wxT("access"), wxT("Navigate not implemented"));
581 // Try to use child object directly.
582 if (varStart
.vt
== VT_I4
&& varStart
.lVal
> 0)
584 IAccessible
* childAccessible
= GetChildAccessible(varStart
.lVal
);
588 HRESULT hResult
= childAccessible
->accNavigate(navDir
, varStart
, pVarEnd
);
589 childAccessible
->Release();
592 else if (m_pAccessible
->GetIAccessibleStd())
593 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
595 else if (m_pAccessible
->GetIAccessibleStd())
596 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accNavigate(navDir
, varStart
, pVarEnd
);
602 wxLogTrace(wxT("access"), wxT("Getting wxIAccessible and calling QueryInterface for Navigate"));
603 wxIAccessible
* objectIA
= elementObject
->GetIAccessible();
606 wxLogTrace(wxT("access"), wxT("No wxIAccessible"));
610 HRESULT hResult
= objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarEnd
->pdispVal
);
613 wxLogTrace(wxT("access"), wxT("QueryInterface failed"));
617 wxLogTrace(wxT("access"), wxT("Called QueryInterface for Navigate"));
618 pVarEnd
->vt
= VT_DISPATCH
;
621 else if (elementId
> 0)
623 wxLogTrace(wxT("access"), wxT("Returning element id from Navigate"));
625 pVarEnd
->lVal
= elementId
;
630 wxLogTrace(wxT("access"), wxT("No object in accNavigate"));
631 pVarEnd
->vt
= VT_EMPTY
;
636 wxLogTrace(wxT("access"), wxT("Failing Navigate"));
640 // Retrieves the address of an IDispatch interface for the specified child.
641 // All objects must support this property.
643 STDMETHODIMP
wxIAccessible::get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
)
645 wxLogTrace(wxT("access"), wxT("get_accChild"));
646 wxASSERT (m_pAccessible
!= NULL
);
650 if (varChildID
.vt
!= VT_I4
)
652 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accChild"));
656 if (varChildID
.lVal
== CHILDID_SELF
)
663 wxAccessible
* child
= NULL
;
665 wxAccStatus status
= m_pAccessible
->GetChild(varChildID
.lVal
, & child
);
666 if (status
== wxACC_FAIL
)
668 wxLogTrace(wxT("access"), wxT("GetChild failed"));
672 if (status
== wxACC_NOT_IMPLEMENTED
)
674 // Use standard interface instead.
675 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
680 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChild"));
681 return stdInterface
->get_accChild (varChildID
, ppDispChild
);
688 wxIAccessible
* objectIA
= child
->GetIAccessible();
692 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispChild
) != S_OK
)
694 wxLogTrace(wxT("access"), wxT("QueryInterface failed in get_accChild"));
702 wxLogTrace(wxT("access"), wxT("Not an accessible object"));
703 return S_FALSE
; // Indicates it's not an accessible object
708 // all cases above already cause some return action so below line
709 // is unreachable and cause unnecessary warning
714 // Retrieves the number of children that belong to this object.
715 // All objects must support this property.
717 STDMETHODIMP
wxIAccessible::get_accChildCount ( long* pCountChildren
)
719 wxLogTrace(wxT("access"), wxT("get_accChildCount"));
720 wxASSERT (m_pAccessible
!= NULL
);
725 wxAccStatus status
= m_pAccessible
->GetChildCount(& childCount
);
726 if (status
== wxACC_FAIL
)
729 if (status
== wxACC_NOT_IMPLEMENTED
)
731 // Use standard interface instead.
732 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
737 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChildCount"));
738 HRESULT res
= stdInterface
->get_accChildCount (pCountChildren
);
740 str
.Printf(wxT("Number of children was %d"), (int) (*pCountChildren
));
741 wxLogTrace(wxT("access"), str
);
747 * pCountChildren
= (long) childCount
;
752 // all cases above already cause some return action so below line
753 // is unreachable and cause unnecessary warning
758 // Retrieves the IDispatch interface of the object's parent.
759 // All objects support this property.
761 STDMETHODIMP
wxIAccessible::get_accParent ( IDispatch
** ppDispParent
)
763 wxLogTrace(wxT("access"), wxT("get_accParent"));
764 wxASSERT (m_pAccessible
!= NULL
);
768 wxAccessible
* parent
= NULL
;
769 wxAccStatus status
= m_pAccessible
->GetParent(& parent
);
771 if (status
== wxACC_FAIL
)
774 // It doesn't seem acceptable to return S_FALSE with a NULL
775 // ppDispParent, so if we have no wxWindows parent, we leave
776 // it to the standard interface.
777 if (status
== wxACC_NOT_IMPLEMENTED
|| !parent
)
779 wxLogTrace(wxT("access"), wxT("Using standard interface to get the parent."));
780 // Use standard interface instead.
781 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
785 return stdInterface
->get_accParent (ppDispParent
);
791 wxIAccessible
* objectIA
= parent
->GetIAccessible();
795 wxLogTrace(wxT("access"), wxT("About to call QueryInterface"));
796 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispParent
) != S_OK
)
798 wxLogTrace(wxT("access"), wxT("Failed QueryInterface"));
802 wxLogTrace(wxT("access"), wxT("Returning S_OK for get_accParent"));
807 // This doesn't seem to be allowed, despite the documentation,
808 // so we handle it higher up by using the standard interface.
809 wxLogTrace(wxT("access"), wxT("Returning NULL parent because there was none"));
810 *ppDispParent
= NULL
;
816 // all cases above already cause some return action so below line
817 // is unreachable and cause unnecessary warning
822 // Performs the object's default action. Not all objects have a default
825 STDMETHODIMP
wxIAccessible::accDoDefaultAction(VARIANT varID
)
827 wxLogTrace(wxT("access"), wxT("accDoDefaultAction"));
828 wxASSERT (m_pAccessible
!= NULL
);
832 if (varID
.vt
!= VT_I4
)
834 wxLogTrace(wxT("access"), wxT("Invalid arg for accDoDefaultAction"));
838 wxAccStatus status
= m_pAccessible
->DoDefaultAction(varID
.lVal
);
839 if (status
== wxACC_FAIL
)
842 if (status
== wxACC_NOT_SUPPORTED
)
843 return DISP_E_MEMBERNOTFOUND
;
845 if (status
== wxACC_NOT_IMPLEMENTED
)
847 // Try to use child object directly.
850 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
854 HRESULT hResult
= childAccessible
->accDoDefaultAction(varID
);
855 childAccessible
->Release();
858 else if (m_pAccessible
->GetIAccessibleStd())
859 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
861 else if (m_pAccessible
->GetIAccessibleStd())
862 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accDoDefaultAction(varID
);
867 // Retrieves a string that describes the object's default action.
868 // Not all objects have a default action.
870 STDMETHODIMP
wxIAccessible::get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
)
872 wxLogTrace(wxT("access"), wxT("get_accDefaultAction"));
873 wxASSERT (m_pAccessible
!= NULL
);
877 if (varID
.vt
!= VT_I4
)
879 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDefaultAction"));
883 wxString defaultAction
;
884 wxAccStatus status
= m_pAccessible
->GetDefaultAction(varID
.lVal
, & defaultAction
);
885 if (status
== wxACC_FAIL
)
888 if (status
== wxACC_NOT_SUPPORTED
)
889 return DISP_E_MEMBERNOTFOUND
;
891 if (status
== wxACC_NOT_IMPLEMENTED
)
893 // Try to use child object directly.
896 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
900 HRESULT hResult
= childAccessible
->get_accDefaultAction(varID
, pszDefaultAction
);
901 childAccessible
->Release();
904 else if (m_pAccessible
->GetIAccessibleStd())
905 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
907 else if (m_pAccessible
->GetIAccessibleStd())
908 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDefaultAction(varID
, pszDefaultAction
);
912 if (defaultAction
.IsEmpty())
914 * pszDefaultAction
= NULL
;
919 wxBasicString
basicString(defaultAction
);
920 * pszDefaultAction
= basicString
.Get();
927 // Retrieves a string that describes the visual appearance of the specified object.
928 // Not all objects have a description.
930 STDMETHODIMP
wxIAccessible::get_accDescription ( VARIANT varID
, BSTR
* pszDescription
)
932 wxLogTrace(wxT("access"), wxT("get_accDescription"));
933 wxASSERT (m_pAccessible
!= NULL
);
937 if (varID
.vt
!= VT_I4
)
939 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDescription"));
943 wxString description
;
944 wxAccStatus status
= m_pAccessible
->GetDescription(varID
.lVal
, & description
);
945 if (status
== wxACC_FAIL
)
948 if (status
== wxACC_NOT_IMPLEMENTED
)
950 // Try to use child object directly.
953 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
957 HRESULT hResult
= childAccessible
->get_accDescription(varID
, pszDescription
);
958 childAccessible
->Release();
961 else if (m_pAccessible
->GetIAccessibleStd())
962 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
964 else if (m_pAccessible
->GetIAccessibleStd())
965 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accDescription(varID
, pszDescription
);
969 if (description
.IsEmpty())
971 * pszDescription
= NULL
;
976 wxBasicString
basicString(description
);
977 * pszDescription
= basicString
.Get();
984 // Retrieves an object's Help property string.
985 // Not all objects support this property.
987 STDMETHODIMP
wxIAccessible::get_accHelp ( VARIANT varID
, BSTR
* pszHelp
)
989 wxLogTrace(wxT("access"), wxT("get_accHelp"));
990 wxASSERT (m_pAccessible
!= NULL
);
994 if (varID
.vt
!= VT_I4
)
996 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelp"));
1000 wxString helpString
;
1001 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & helpString
);
1002 if (status
== wxACC_FAIL
)
1005 if (status
== wxACC_NOT_IMPLEMENTED
)
1007 // Try to use child object directly.
1010 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1011 if (childAccessible
)
1014 HRESULT hResult
= childAccessible
->get_accHelp(varID
, pszHelp
);
1015 childAccessible
->Release();
1018 else if (m_pAccessible
->GetIAccessibleStd())
1019 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp(varID
, pszHelp
);
1021 else if (m_pAccessible
->GetIAccessibleStd())
1022 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelp (varID
, pszHelp
);
1026 if (helpString
.IsEmpty())
1033 wxBasicString
basicString(helpString
);
1034 * pszHelp
= basicString
.Get();
1041 // Retrieves the full path of the WinHelp file associated with the specified
1042 // object and the identifier of the appropriate topic within that file.
1043 // Not all objects support this property.
1044 // NOTE: not supported by wxWindows at this time. Use
1045 // GetHelpText instead.
1047 STDMETHODIMP
wxIAccessible::get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
)
1049 wxLogTrace(wxT("access"), wxT("get_accHelpTopic"));
1050 wxASSERT (m_pAccessible
!= NULL
);
1054 if (varChild
.vt
!= VT_I4
)
1056 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelpTopic"));
1057 return E_INVALIDARG
;
1060 wxAccStatus status
= wxACC_NOT_IMPLEMENTED
;
1061 if (status
== wxACC_FAIL
)
1064 if (status
== wxACC_NOT_IMPLEMENTED
)
1066 // Try to use child object directly.
1067 if (varChild
.lVal
> 0)
1069 IAccessible
* childAccessible
= GetChildAccessible(varChild
.lVal
);
1070 if (childAccessible
)
1073 HRESULT hResult
= childAccessible
->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1074 childAccessible
->Release();
1077 else if (m_pAccessible
->GetIAccessibleStd())
1078 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic(pszHelpFile
, varChild
, pidTopic
);
1080 else if (m_pAccessible
->GetIAccessibleStd())
1081 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accHelpTopic (pszHelpFile
, varChild
, pidTopic
);
1086 // Retrieves the specified object's shortcut key or access key, also known as
1087 // the mnemonic. All objects that have a shortcut key or access key support
1090 STDMETHODIMP
wxIAccessible::get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
)
1092 wxLogTrace(wxT("access"), wxT("get_accKeyboardShortcut"));
1093 *pszKeyboardShortcut
= NULL
;
1095 wxASSERT (m_pAccessible
!= NULL
);
1099 if (varID
.vt
!= VT_I4
)
1101 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accKeyboardShortcut"));
1102 return E_INVALIDARG
;
1105 wxString keyboardShortcut
;
1106 wxAccStatus status
= m_pAccessible
->GetKeyboardShortcut(varID
.lVal
, & keyboardShortcut
);
1107 if (status
== wxACC_FAIL
)
1110 if (status
== wxACC_NOT_IMPLEMENTED
)
1112 // Try to use child object directly.
1115 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1116 if (childAccessible
)
1119 HRESULT hResult
= childAccessible
->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1120 childAccessible
->Release();
1123 else if (m_pAccessible
->GetIAccessibleStd())
1124 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1126 else if (m_pAccessible
->GetIAccessibleStd())
1127 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accKeyboardShortcut (varID
, pszKeyboardShortcut
);
1131 if (keyboardShortcut
.IsEmpty())
1133 * pszKeyboardShortcut
= NULL
;
1138 wxBasicString
basicString(keyboardShortcut
);
1139 * pszKeyboardShortcut
= basicString
.Get();
1146 // Retrieves the name of the specified object.
1147 // All objects support this property.
1149 STDMETHODIMP
wxIAccessible::get_accName ( VARIANT varID
, BSTR
* pszName
)
1151 wxLogTrace(wxT("access"), wxT("get_accName"));
1154 wxASSERT (m_pAccessible
!= NULL
);
1158 if (varID
.vt
!= VT_I4
)
1160 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accName"));
1161 return E_INVALIDARG
;
1166 wxAccStatus status
= m_pAccessible
->GetName(varID
.lVal
, & name
);
1168 if (status
== wxACC_FAIL
)
1171 if (status
== wxACC_NOT_IMPLEMENTED
)
1173 // Try to use child object directly.
1176 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1177 if (childAccessible
)
1180 HRESULT hResult
= childAccessible
->get_accName(varID
, pszName
);
1181 childAccessible
->Release();
1184 else if (m_pAccessible
->GetIAccessibleStd())
1185 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName(varID
, pszName
);
1187 else if (m_pAccessible
->GetIAccessibleStd())
1188 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accName (varID
, pszName
);
1192 wxBasicString
basicString(name
);
1193 *pszName
= basicString
.Get();
1199 // Retrieves information that describes the role of the specified object.
1200 // All objects support this property.
1202 STDMETHODIMP
wxIAccessible::get_accRole ( VARIANT varID
, VARIANT
* pVarRole
)
1204 wxLogTrace(wxT("access"), wxT("get_accRole"));
1205 wxASSERT (m_pAccessible
!= NULL
);
1209 if (varID
.vt
!= VT_I4
)
1211 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accRole"));
1212 return E_INVALIDARG
;
1215 VariantInit(pVarRole
);
1217 wxAccRole role
= wxROLE_NONE
;
1219 wxAccStatus status
= m_pAccessible
->GetRole(varID
.lVal
, & role
);
1221 if (status
== wxACC_FAIL
)
1224 if (status
== wxACC_NOT_IMPLEMENTED
)
1226 // Try to use child object directly.
1229 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1230 if (childAccessible
)
1233 HRESULT hResult
= childAccessible
->get_accRole(varID
, pVarRole
);
1234 childAccessible
->Release();
1237 else if (m_pAccessible
->GetIAccessibleStd())
1238 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole(varID
, pVarRole
);
1240 else if (m_pAccessible
->GetIAccessibleStd())
1241 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accRole (varID
, pVarRole
);
1245 if (role
== wxROLE_NONE
)
1247 pVarRole
->vt
= VT_EMPTY
;
1251 pVarRole
->lVal
= wxConvertToWindowsRole(role
);
1252 pVarRole
->vt
= VT_I4
;
1259 // Retrieves the current state of the specified object.
1260 // All objects support this property.
1262 STDMETHODIMP
wxIAccessible::get_accState ( VARIANT varID
, VARIANT
* pVarState
)
1264 wxLogTrace(wxT("access"), wxT("get_accState"));
1265 wxASSERT (m_pAccessible
!= NULL
);
1269 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1271 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accState"));
1272 return E_INVALIDARG
;
1277 wxAccStatus status
= m_pAccessible
->GetState(varID
.lVal
, & wxstate
);
1278 if (status
== wxACC_FAIL
)
1281 if (status
== wxACC_NOT_IMPLEMENTED
)
1283 // Try to use child object directly.
1286 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1287 if (childAccessible
)
1290 HRESULT hResult
= childAccessible
->get_accState(varID
, pVarState
);
1291 childAccessible
->Release();
1294 else if (m_pAccessible
->GetIAccessibleStd())
1295 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState(varID
, pVarState
);
1297 else if (m_pAccessible
->GetIAccessibleStd())
1298 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accState (varID
, pVarState
);
1302 long state
= wxConvertToWindowsState(wxstate
);
1303 pVarState
->lVal
= state
;
1304 pVarState
->vt
= VT_I4
;
1310 // Retrieves the value of the specified object.
1311 // Not all objects have a value.
1313 STDMETHODIMP
wxIAccessible::get_accValue ( VARIANT varID
, BSTR
* pszValue
)
1315 wxLogTrace(wxT("access"), wxT("get_accValue"));
1316 wxASSERT (m_pAccessible
!= NULL
);
1320 if (varID
.vt
!= VT_I4
)
1322 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accValue"));
1323 return E_INVALIDARG
;
1328 wxAccStatus status
= m_pAccessible
->GetValue(varID
.lVal
, & strValue
);
1330 if (status
== wxACC_FAIL
)
1333 if (status
== wxACC_NOT_IMPLEMENTED
)
1335 // Try to use child object directly.
1338 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1339 if (childAccessible
)
1342 HRESULT hResult
= childAccessible
->get_accValue(varID
, pszValue
);
1343 childAccessible
->Release();
1346 else if (m_pAccessible
->GetIAccessibleStd())
1347 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue(varID
, pszValue
);
1349 else if (m_pAccessible
->GetIAccessibleStd())
1350 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->get_accValue (varID
, pszValue
);
1354 wxBasicString
basicString(strValue
);
1355 * pszValue
= basicString
.Get();
1361 // Modifies the selection or moves the keyboard focus of the
1362 // specified object. All objects that select or receive the
1363 // keyboard focus must support this method.
1365 STDMETHODIMP
wxIAccessible::accSelect ( long flagsSelect
, VARIANT varID
)
1367 wxLogTrace(wxT("access"), wxT("get_accSelect"));
1368 wxASSERT (m_pAccessible
!= NULL
);
1372 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1374 wxLogTrace(wxT("access"), wxT("Invalid arg for accSelect"));
1375 return E_INVALIDARG
;
1378 wxAccSelectionFlags wxsel
= wxConvertFromWindowsSelFlag(flagsSelect
);
1380 wxAccStatus status
= m_pAccessible
->Select(varID
.lVal
, wxsel
);
1381 if (status
== wxACC_FAIL
)
1384 if (status
== wxACC_NOT_IMPLEMENTED
)
1386 // Try to use child object directly.
1387 if (varID
.lVal
> 0 && varID
.lVal
> 0)
1389 IAccessible
* childAccessible
= GetChildAccessible(varID
.lVal
);
1390 if (childAccessible
)
1393 HRESULT hResult
= childAccessible
->accSelect(flagsSelect
, varID
);
1394 childAccessible
->Release();
1397 else if (m_pAccessible
->GetIAccessibleStd())
1398 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1400 else if (m_pAccessible
->GetIAccessibleStd())
1401 return ((IAccessible
*) m_pAccessible
->GetIAccessibleStd())->accSelect(flagsSelect
, varID
);
1409 // Retrieves the object that has the keyboard focus. All objects
1410 // that receive the keyboard focus must support this property.
1412 STDMETHODIMP
wxIAccessible::get_accFocus ( VARIANT
* pVarID
)
1414 wxLogTrace(wxT("access"), wxT("get_accFocus"));
1415 wxASSERT (m_pAccessible
!= NULL
);
1419 wxAccessible
* childObject
= NULL
;
1421 VariantInit(pVarID
);
1423 wxAccStatus status
= m_pAccessible
->GetFocus(& childId
, & childObject
);
1424 if (status
== wxACC_FAIL
)
1427 if (status
== wxACC_NOT_IMPLEMENTED
)
1429 // Use standard interface instead.
1430 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1434 return stdInterface
->get_accFocus (pVarID
);
1438 if (childObject
== m_pAccessible
)
1441 pVarID
->lVal
= CHILDID_SELF
;
1445 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1449 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
1452 pVarID
->vt
= VT_DISPATCH
;
1456 else if (childId
> 0)
1459 pVarID
->lVal
= childId
;
1464 pVarID
->vt
= VT_EMPTY
;
1469 // all cases above already cause some return action so below line
1470 // is unreachable and cause unnecessary warning
1475 // Retrieves the selected children of this object. All objects
1476 // selected must support this property.
1478 STDMETHODIMP
wxIAccessible::get_accSelection ( VARIANT
* pVarChildren
)
1480 wxLogTrace(wxT("access"), wxT("get_accSelection"));
1481 wxASSERT (m_pAccessible
!= NULL
);
1485 VariantInit(pVarChildren
);
1487 wxVariant selections
;
1488 wxAccStatus status
= m_pAccessible
->GetSelections(& selections
);
1489 if (status
== wxACC_FAIL
)
1492 if (status
== wxACC_NOT_IMPLEMENTED
)
1494 // Use standard interface instead.
1495 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1499 return stdInterface
->get_accSelection (pVarChildren
);
1503 if (selections
.GetType() == wxT("long"))
1505 pVarChildren
->vt
= VT_I4
;
1506 pVarChildren
->lVal
= selections
.GetLong();
1510 else if (selections
.GetType() == wxT("void*"))
1512 wxAccessible
* childObject
= (wxAccessible
*) selections
.GetVoidPtr();
1513 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1517 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarChildren
->pdispVal
) != S_OK
)
1520 pVarChildren
->vt
= VT_DISPATCH
;
1524 else if (selections
.GetType() == wxT("list"))
1526 // TODO: should we AddRef for every "void*" member??
1528 wxIEnumVARIANT
* enumVariant
= new wxIEnumVARIANT(selections
);
1529 enumVariant
->AddRef();
1531 pVarChildren
->vt
= VT_UNKNOWN
;
1532 pVarChildren
->punkVal
= enumVariant
;
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 //USE_ACCESSIBILITY