1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/ole/access.cpp
3 // Purpose: implementation of wxIAccessible and wxAccessible
4 // Author: Julian Smart
8 // Copyright: (c) 2003 Julian Smart
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "access.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
27 #if defined(__BORLANDC__)
31 #include "wx/window.h"
36 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
39 #include "wx/access.h"
43 // for some compilers, the entire ole2.h must be included, not only oleauto.h
44 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
51 #include "wx/msw/ole/oleutils.h"
54 #define CHILDID_SELF 0
58 #define OBJID_CLIENT 0xFFFFFFFC
61 // Convert to Windows role
62 int wxConvertToWindowsRole(wxAccRole wxrole
);
64 // Convert to Windows state
65 long wxConvertToWindowsState(long wxstate
);
67 // Convert to Windows selection flag
68 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel
);
70 // Convert from Windows selection flag
71 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
);
73 // ----------------------------------------------------------------------------
74 // wxIEnumVARIANT interface implementation
75 // ----------------------------------------------------------------------------
77 class wxIEnumVARIANT
: public IEnumVARIANT
80 wxIEnumVARIANT(const wxVariant
& variant
);
83 DECLARE_IUNKNOWN_METHODS
;
86 STDMETHODIMP
Next(ULONG celt
, VARIANT
*rgelt
, ULONG
*pceltFetched
);
87 STDMETHODIMP
Skip(ULONG celt
);
89 STDMETHODIMP
Clone(IEnumVARIANT
**ppenum
);
92 wxVariant m_variant
; // List of further variants
93 int m_nCurrent
; // Current enum position
95 DECLARE_NO_COPY_CLASS(wxIEnumVARIANT
)
98 // ----------------------------------------------------------------------------
100 // ----------------------------------------------------------------------------
102 BEGIN_IID_TABLE(wxIEnumVARIANT
)
107 IMPLEMENT_IUNKNOWN_METHODS(wxIEnumVARIANT
)
109 // wxVariant contains a list of further variants.
110 wxIEnumVARIANT::wxIEnumVARIANT(const wxVariant
& variant
)
115 STDMETHODIMP
wxIEnumVARIANT::Next(ULONG celt
,
119 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Next"));
122 // we only return 1 element at a time - mainly because I'm too lazy to
123 // implement something which you're never asked for anyhow
127 if (m_variant
.GetType() != wxT("list"))
130 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() ) {
131 if (!wxConvertVariantToOle(m_variant
[m_nCurrent
++], rgelt
[0]))
136 // TODO: should we AddRef if this is an object?
147 STDMETHODIMP
wxIEnumVARIANT::Skip(ULONG celt
)
149 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Skip"));
151 if (m_variant
.GetType() != wxT("list"))
155 if ( m_nCurrent
< (int) m_variant
.GetList().GetCount() )
158 // no, can't skip this many elements
164 STDMETHODIMP
wxIEnumVARIANT::Reset()
166 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Reset"));
173 STDMETHODIMP
wxIEnumVARIANT::Clone(IEnumVARIANT
**ppenum
)
175 wxLogTrace(wxTRACE_OleCalls
, wxT("wxIEnumVARIANT::Clone"));
177 wxIEnumVARIANT
*pNew
= new wxIEnumVARIANT(m_variant
);
185 // ----------------------------------------------------------------------------
186 // wxIAccessible implementation of IAccessible interface
187 // ----------------------------------------------------------------------------
189 class wxIAccessible
: public IAccessible
192 wxIAccessible(wxAccessible
*pAccessible
);
194 DECLARE_IUNKNOWN_METHODS
;
198 // Navigation and Hierarchy
200 // Retrieves the child element or child object at a given point on the screen.
201 // All visual objects support this method; sound objects do not support it.
203 STDMETHODIMP
accHitTest(long xLeft
, long yLeft
, VARIANT
* pVarID
);
205 // Retrieves the specified object's current screen location. All visual objects must
206 // support this method; sound objects do not support it.
208 STDMETHODIMP
accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
);
210 // Traverses to another user interface element within a container and retrieves the object.
211 // All visual objects must support this method.
213 STDMETHODIMP
accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
);
215 // Retrieves the address of an IDispatch interface for the specified child.
216 // All objects must support this property.
218 STDMETHODIMP
get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
);
220 // Retrieves the number of children that belong to this object.
221 // All objects must support this property.
223 STDMETHODIMP
get_accChildCount ( long* pCountChildren
);
225 // Retrieves the IDispatch interface of the object's parent.
226 // All objects support this property.
228 STDMETHODIMP
get_accParent ( IDispatch
** ppDispParent
);
230 // Descriptive Properties and Methods
232 // Performs the object's default action. Not all objects have a default
235 STDMETHODIMP
accDoDefaultAction(VARIANT varID
);
237 // Retrieves a string that describes the object's default action.
238 // Not all objects have a default action.
240 STDMETHODIMP
get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
);
242 // Retrieves a string that describes the visual appearance of the specified object.
243 // Not all objects have a description.
245 STDMETHODIMP
get_accDescription ( VARIANT varID
, BSTR
* pszDescription
);
247 // Retrieves an object's Help property string.
248 // Not all objects support this property.
250 STDMETHODIMP
get_accHelp ( VARIANT varID
, BSTR
* pszHelp
);
252 // Retrieves the full path of the WinHelp file associated with the specified
253 // object and the identifier of the appropriate topic within that file.
254 // Not all objects support this property.
256 STDMETHODIMP
get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
);
258 // Retrieves the specified object's shortcut key or access key, also known as
259 // the mnemonic. All objects that have a shortcut key or access key support
262 STDMETHODIMP
get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
);
264 // Retrieves the name of the specified object.
265 // All objects support this property.
267 STDMETHODIMP
get_accName ( VARIANT varID
, BSTR
* pszName
);
269 // Retrieves information that describes the role of the specified object.
270 // All objects support this property.
272 STDMETHODIMP
get_accRole ( VARIANT varID
, VARIANT
* pVarRole
);
274 // Retrieves the current state of the specified object.
275 // All objects support this property.
277 STDMETHODIMP
get_accState ( VARIANT varID
, VARIANT
* pVarState
);
279 // Retrieves the value of the specified object.
280 // Not all objects have a value.
282 STDMETHODIMP
get_accValue ( VARIANT varID
, BSTR
* pszValue
);
284 // Selection and Focus
286 // Modifies the selection or moves the keyboard focus of the
287 // specified object. All objects that select or receive the
288 // keyboard focus must support this method.
290 STDMETHODIMP
accSelect ( long flagsSelect
, VARIANT varID
);
292 // Retrieves the object that has the keyboard focus. All objects
293 // that receive the keyboard focus must support this property.
295 STDMETHODIMP
get_accFocus ( VARIANT
* pVarID
);
297 // Retrieves the selected children of this object. All objects
298 // selected must support this property.
300 STDMETHODIMP
get_accSelection ( VARIANT
* pVarChildren
);
304 STDMETHODIMP
put_accName(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
305 STDMETHODIMP
put_accValue(VARIANT varChild
, BSTR szName
) { return E_FAIL
; }
311 STDMETHODIMP
GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
);
313 // Get type info count
315 STDMETHODIMP
GetTypeInfoCount(unsigned int* typeInfoCount
);
319 STDMETHODIMP
GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
320 LCID lcid
, DISPID
* dispId
);
324 STDMETHODIMP
Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
325 WORD wFlags
, DISPPARAMS
*pDispParams
,
326 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
327 unsigned int *puArgErr
);
331 // Gets the standard IAccessible interface for the given child or object.
332 // Call Release if this is non-NULL.
333 IAccessible
* GetChildStdAccessible(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 wxLogDebug("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
;
410 // pVarID->pdispVal->AddRef();
414 else if (childId
> 0)
417 pVarID
->lVal
= childId
;
422 pVarID
->vt
= VT_EMPTY
;
429 // Retrieves the specified object's current screen location. All visual objects must
430 // support this method; sound objects do not support it.
432 STDMETHODIMP
wxIAccessible::accLocation ( long* pxLeft
, long* pyTop
, long* pcxWidth
, long* pcyHeight
, VARIANT varID
)
434 wxLogDebug("accLocation");
435 wxASSERT (m_pAccessible
!= NULL
);
441 wxAccStatus status
= m_pAccessible
->GetLocation(rect
, varID
.lVal
);
442 if (status
== wxACC_FAIL
)
445 if (status
== wxACC_NOT_IMPLEMENTED
)
447 // Use standard interface instead.
448 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
452 return stdInterface
->accLocation(pxLeft
, pyTop
, pcxWidth
, pcyHeight
, varID
);
458 *pcxWidth
= rect
.width
;
459 *pcyHeight
= rect
.height
;
466 // Traverses to another user interface element within a container and retrieves the object.
467 // All visual objects must support this method.
469 STDMETHODIMP
wxIAccessible::accNavigate ( long navDir
, VARIANT varStart
, VARIANT
* pVarEnd
)
471 wxASSERT (m_pAccessible
!= NULL
);
474 wxLogDebug(wxString(wxT("accNavigate for ")) + m_pAccessible
->GetWindow()->GetClassInfo()->GetClassName());
476 if ((varStart
.vt
!= VT_I4
&& varStart
.vt
!= VT_EMPTY
) || varStart
.vt
< 0)
478 wxLogDebug("Invalid arg for accNavigate");
482 wxAccessible
* elementObject
= NULL
;
484 VariantInit(pVarEnd
);
485 wxNavDir navDirWX
= wxNAVDIR_FIRSTCHILD
;
492 navDirWX
= wxNAVDIR_DOWN
;
493 navStr
= wxT("wxNAVDIR_DOWN");
496 case NAVDIR_FIRSTCHILD
:
497 navDirWX
= wxNAVDIR_FIRSTCHILD
;
498 navStr
= wxT("wxNAVDIR_FIRSTCHILD");
501 case NAVDIR_LASTCHILD
:
502 navDirWX
= wxNAVDIR_LASTCHILD
;
503 navStr
= wxT("wxNAVDIR_LASTCHILD");
507 navDirWX
= wxNAVDIR_LEFT
;
508 navStr
= wxT("wxNAVDIR_LEFT");
512 navDirWX
= wxNAVDIR_NEXT
;
513 navStr
= wxT("wxNAVDIR_NEXT");
516 case NAVDIR_PREVIOUS
:
517 navDirWX
= wxNAVDIR_PREVIOUS
;
518 navStr
= wxT("wxNAVDIR_PREVIOUS");
522 navDirWX
= wxNAVDIR_RIGHT
;
523 navStr
= wxT("wxNAVDIR_RIGHT");
527 navDirWX
= wxNAVDIR_UP
;
528 navStr
= wxT("wxNAVDIR_UP");
532 wxLogDebug(wxT("Unknown NAVDIR symbol"));
538 wxAccStatus status
= m_pAccessible
->Navigate(navDirWX
, varStart
.lVal
, & elementId
,
541 if (status
== wxACC_FAIL
)
543 wxLogDebug("wxAccessible::Navigate failed");
547 if (status
== wxACC_FALSE
)
549 wxLogDebug("wxAccessible::Navigate found no object in this direction");
553 if (status
== wxACC_NOT_IMPLEMENTED
)
555 wxLogDebug("Navigate not implemented");
557 // Use standard interface instead.
558 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
562 return stdInterface
->accNavigate ( navDir
, varStart
, pVarEnd
);
568 wxLogDebug("Getting wxIAccessible and calling QueryInterface for Navigate");
569 wxIAccessible
* objectIA
= elementObject
->GetIAccessible();
572 wxLogDebug("No wxIAccessible");
576 HRESULT hResult
= objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarEnd
->pdispVal
);
579 wxLogDebug("QueryInterface failed");
583 wxLogDebug("Called QueryInterface for Navigate");
584 pVarEnd
->vt
= VT_DISPATCH
;
585 // pVarEnd->pdispVal->AddRef();
588 else if (elementId
> 0)
590 wxLogDebug("Returning element id from Navigate");
592 pVarEnd
->lVal
= elementId
;
597 wxLogDebug("No object in accNavigate");
598 pVarEnd
->vt
= VT_EMPTY
;
603 wxLogDebug("Failing Navigate");
607 // Retrieves the address of an IDispatch interface for the specified child.
608 // All objects must support this property.
610 STDMETHODIMP
wxIAccessible::get_accChild ( VARIANT varChildID
, IDispatch
** ppDispChild
)
612 wxLogDebug("get_accChild");
613 wxASSERT (m_pAccessible
!= NULL
);
617 if (varChildID
.vt
!= VT_I4
)
619 wxLogDebug("Invalid arg for get_accChild");
623 if (varChildID
.lVal
== CHILDID_SELF
)
630 wxAccessible
* child
= NULL
;
632 wxAccStatus status
= m_pAccessible
->GetChild(varChildID
.lVal
, & child
);
633 if (status
== wxACC_FAIL
)
635 wxLogDebug("GetChild failed");
639 if (status
== wxACC_NOT_IMPLEMENTED
)
641 // Use standard interface instead.
642 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
647 wxLogDebug("Using standard interface for get_accChild");
648 return stdInterface
->get_accChild (varChildID
, ppDispChild
);
655 wxIAccessible
* objectIA
= child
->GetIAccessible();
659 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispChild
) != S_OK
)
661 wxLogDebug("QueryInterface failed in get_accChild");
665 // (*ppDispChild)->AddRef();
670 wxLogDebug("Not an accessible object");
671 return S_FALSE
; // Indicates it's not an accessible object
678 // Retrieves the number of children that belong to this object.
679 // All objects must support this property.
681 STDMETHODIMP
wxIAccessible::get_accChildCount ( long* pCountChildren
)
683 wxLogDebug("get_accChildCount");
684 wxASSERT (m_pAccessible
!= NULL
);
689 wxAccStatus status
= m_pAccessible
->GetChildCount(& childCount
);
690 if (status
== wxACC_FAIL
)
693 if (status
== wxACC_NOT_IMPLEMENTED
)
695 // Use standard interface instead.
696 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
701 wxLogDebug("Using standard interface for get_accChildCount");
702 HRESULT res
= stdInterface
->get_accChildCount (pCountChildren
);
704 str
.Printf(wxT("Number of children was %d"), (int) (*pCountChildren
));
711 * pCountChildren
= (long) childCount
;
718 // Retrieves the IDispatch interface of the object's parent.
719 // All objects support this property.
721 STDMETHODIMP
wxIAccessible::get_accParent ( IDispatch
** ppDispParent
)
723 wxLogDebug("get_accParent");
724 wxASSERT (m_pAccessible
!= NULL
);
728 wxAccessible
* parent
= NULL
;
729 wxAccStatus status
= m_pAccessible
->GetParent(& parent
);
731 if (status
== wxACC_FAIL
)
734 // It doesn't seem acceptable to return S_FALSE with a NULL
735 // ppDispParent, so if we have no wxWindows parent, we leave
736 // it to the standard interface.
737 if (status
== wxACC_NOT_IMPLEMENTED
|| !parent
)
739 wxLogDebug("Using standard interface to get the parent.");
740 // Use standard interface instead.
741 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
745 return stdInterface
->get_accParent (ppDispParent
);
751 wxIAccessible
* objectIA
= parent
->GetIAccessible();
755 wxLogDebug("About to call QueryInterface");
756 if (objectIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) ppDispParent
) != S_OK
)
758 wxLogDebug("Failed QueryInterface");
762 // (*ppDispParent)->AddRef();
763 wxLogDebug("Returning S_OK for get_accParent");
766 wxIAccessible* objectIA = parent->GetIAccessible();
770 *ppDispParent = objectIA;
776 // This doesn't seem to be allowed, despite the documentation,
777 // so we handle it higher up by using the standard interface.
778 wxLogDebug("Returning NULL parent because there was none");
779 *ppDispParent
= NULL
;
787 // Performs the object's default action. Not all objects have a default
790 STDMETHODIMP
wxIAccessible::accDoDefaultAction(VARIANT varID
)
792 wxLogDebug("accDoDefaultAction");
793 wxASSERT (m_pAccessible
!= NULL
);
797 if (varID
.vt
!= VT_I4
)
799 wxLogDebug("Invalid arg for accDoDefaultAction");
803 wxAccStatus status
= m_pAccessible
->DoDefaultAction(varID
.lVal
);
804 if (status
== wxACC_FAIL
)
807 if (status
== wxACC_NOT_SUPPORTED
)
808 return DISP_E_MEMBERNOTFOUND
;
810 if (status
== wxACC_NOT_IMPLEMENTED
)
812 // Use standard interface instead.
813 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
817 return stdInterface
->accDoDefaultAction(varID
);
822 // Retrieves a string that describes the object's default action.
823 // Not all objects have a default action.
825 STDMETHODIMP
wxIAccessible::get_accDefaultAction ( VARIANT varID
, BSTR
* pszDefaultAction
)
827 wxLogDebug("get_accDefaultAction");
828 wxASSERT (m_pAccessible
!= NULL
);
832 if (varID
.vt
!= VT_I4
)
834 wxLogDebug("Invalid arg for get_accDefaultAction");
838 wxString defaultAction
;
839 wxAccStatus status
= m_pAccessible
->GetDefaultAction(varID
.lVal
, & defaultAction
);
840 if (status
== wxACC_FAIL
)
843 if (status
== wxACC_NOT_SUPPORTED
)
844 return DISP_E_MEMBERNOTFOUND
;
846 if (status
== wxACC_NOT_IMPLEMENTED
)
848 // Use standard interface instead.
849 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
853 return stdInterface
->get_accDefaultAction (varID
, pszDefaultAction
);
857 if (defaultAction
.IsEmpty())
859 * pszDefaultAction
= NULL
;
864 wxBasicString
basicString(defaultAction
);
865 * pszDefaultAction
= basicString
.Get();
872 // Retrieves a string that describes the visual appearance of the specified object.
873 // Not all objects have a description.
875 STDMETHODIMP
wxIAccessible::get_accDescription ( VARIANT varID
, BSTR
* pszDescription
)
877 wxLogDebug("get_accDescription");
878 wxASSERT (m_pAccessible
!= NULL
);
882 if (varID
.vt
!= VT_I4
)
884 wxLogDebug("Invalid arg for get_accDescription");
888 wxString description
;
889 wxAccStatus status
= m_pAccessible
->GetDescription(varID
.lVal
, & description
);
890 if (status
== wxACC_FAIL
)
893 if (status
== wxACC_NOT_IMPLEMENTED
)
895 // Use standard interface instead.
896 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
900 return stdInterface
->get_accDescription (varID
, pszDescription
);
904 if (description
.IsEmpty())
906 * pszDescription
= NULL
;
911 wxBasicString
basicString(description
);
912 * pszDescription
= basicString
.Get();
919 // Retrieves an object's Help property string.
920 // Not all objects support this property.
922 STDMETHODIMP
wxIAccessible::get_accHelp ( VARIANT varID
, BSTR
* pszHelp
)
924 wxLogDebug("get_accHelp");
925 wxASSERT (m_pAccessible
!= NULL
);
929 if (varID
.vt
!= VT_I4
)
931 wxLogDebug("Invalid arg for get_accHelp");
936 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & helpString
);
937 if (status
== wxACC_FAIL
)
940 if (status
== wxACC_NOT_IMPLEMENTED
)
942 // Use standard interface instead.
943 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
947 return stdInterface
->get_accHelp (varID
, pszHelp
);
951 if (helpString
.IsEmpty())
958 wxBasicString
basicString(helpString
);
959 * pszHelp
= basicString
.Get();
966 // Retrieves the full path of the WinHelp file associated with the specified
967 // object and the identifier of the appropriate topic within that file.
968 // Not all objects support this property.
969 // NOTE: not supported by wxWindows at this time. Use
970 // GetHelpText instead.
972 STDMETHODIMP
wxIAccessible::get_accHelpTopic ( BSTR
* pszHelpFile
, VARIANT varChild
, long* pidTopic
)
974 wxLogDebug("get_accHelpTopic");
975 wxASSERT (m_pAccessible
!= NULL
);
979 if (varChild
.vt
!= VT_I4
)
981 wxLogDebug("Invalid arg for get_accHelpTopic");
985 wxAccStatus status
= wxACC_NOT_IMPLEMENTED
;
986 if (status
== wxACC_FAIL
)
989 if (status
== wxACC_NOT_IMPLEMENTED
)
991 // Use standard interface instead.
992 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
996 return stdInterface
->get_accHelpTopic (pszHelpFile
, varChild
, pidTopic
);
1001 // Retrieves the specified object's shortcut key or access key, also known as
1002 // the mnemonic. All objects that have a shortcut key or access key support
1005 STDMETHODIMP
wxIAccessible::get_accKeyboardShortcut ( VARIANT varID
, BSTR
* pszKeyboardShortcut
)
1007 wxLogDebug("get_accKeyboardShortcut");
1008 *pszKeyboardShortcut
= NULL
;
1010 wxASSERT (m_pAccessible
!= NULL
);
1014 if (varID
.vt
!= VT_I4
)
1016 wxLogDebug("Invalid arg for get_accKeyboardShortcut");
1017 return E_INVALIDARG
;
1020 wxString keyboardShortcut
;
1021 wxAccStatus status
= m_pAccessible
->GetHelpText(varID
.lVal
, & keyboardShortcut
);
1022 if (status
== wxACC_FAIL
)
1025 if (status
== wxACC_NOT_IMPLEMENTED
)
1027 // Use standard interface instead.
1028 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1032 return stdInterface
->get_accKeyboardShortcut(varID
, pszKeyboardShortcut
);
1036 if (keyboardShortcut
.IsEmpty())
1038 * pszKeyboardShortcut
= NULL
;
1043 wxBasicString
basicString(keyboardShortcut
);
1044 * pszKeyboardShortcut
= basicString
.Get();
1051 // Retrieves the name of the specified object.
1052 // All objects support this property.
1054 STDMETHODIMP
wxIAccessible::get_accName ( VARIANT varID
, BSTR
* pszName
)
1056 wxLogDebug("get_accName");
1059 wxASSERT (m_pAccessible
!= NULL
);
1063 if (varID
.vt
!= VT_I4
)
1065 wxLogDebug("Invalid arg for get_accName");
1066 return E_INVALIDARG
;
1071 wxAccStatus status
= m_pAccessible
->GetName(varID
.lVal
, & name
);
1073 if (status
== wxACC_FAIL
)
1076 if (status
== wxACC_NOT_IMPLEMENTED
)
1079 // Use standard interface instead.
1080 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1084 return stdInterface
->get_accName (varID
, pszName
);
1086 // Turn child reference into object reference.
1087 IAccessible
* stdInterface
= GetChildStdAccessible(varID
.lVal
);
1091 HRESULT hResult
= stdInterface
->get_accName(varID
, pszName
);
1092 stdInterface
->Release();
1100 wxBasicString
basicString(name
);
1101 *pszName
= basicString
.Get();
1107 // Retrieves information that describes the role of the specified object.
1108 // All objects support this property.
1110 STDMETHODIMP
wxIAccessible::get_accRole ( VARIANT varID
, VARIANT
* pVarRole
)
1112 wxLogDebug("get_accRole");
1113 wxASSERT (m_pAccessible
!= NULL
);
1117 if (varID
.vt
!= VT_I4
)
1119 wxLogDebug("Invalid arg for get_accRole");
1120 return E_INVALIDARG
;
1123 VariantInit(pVarRole
);
1125 wxAccRole role
= wxROLE_NONE
;
1127 wxAccStatus status
= m_pAccessible
->GetRole(varID
.lVal
, & role
);
1129 if (status
== wxACC_FAIL
)
1132 if (status
== wxACC_NOT_IMPLEMENTED
)
1134 // Use standard interface instead.
1135 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1139 return stdInterface
->get_accRole (varID
, pVarRole
);
1143 if (role
== wxROLE_NONE
)
1145 pVarRole
->vt
= VT_EMPTY
;
1149 pVarRole
->lVal
= wxConvertToWindowsRole(role
);
1150 pVarRole
->vt
= VT_I4
;
1157 // Retrieves the current state of the specified object.
1158 // All objects support this property.
1160 STDMETHODIMP
wxIAccessible::get_accState ( VARIANT varID
, VARIANT
* pVarState
)
1162 wxLogDebug("get_accState");
1163 wxASSERT (m_pAccessible
!= NULL
);
1167 if (varID
.vt
!= VT_I4
)
1169 wxLogDebug("Invalid arg for get_accState");
1170 return E_INVALIDARG
;
1175 wxAccStatus status
= m_pAccessible
->GetState(varID
.lVal
, & wxstate
);
1176 if (status
== wxACC_FAIL
)
1179 if (status
== wxACC_NOT_IMPLEMENTED
)
1181 // Use standard interface instead.
1182 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1186 return stdInterface
->get_accState (varID
, pVarState
);
1190 long state
= wxConvertToWindowsState(wxstate
);
1191 pVarState
->lVal
= state
;
1192 pVarState
->vt
= VT_I4
;
1198 // Retrieves the value of the specified object.
1199 // Not all objects have a value.
1201 STDMETHODIMP
wxIAccessible::get_accValue ( VARIANT varID
, BSTR
* pszValue
)
1203 wxLogDebug("get_accValue");
1204 wxASSERT (m_pAccessible
!= NULL
);
1208 if (varID
.vt
!= VT_I4
)
1210 wxLogDebug("Invalid arg for get_accValue");
1211 return E_INVALIDARG
;
1216 wxAccStatus status
= m_pAccessible
->GetValue(varID
.lVal
, & strValue
);
1218 if (status
== wxACC_FAIL
)
1221 if (status
== wxACC_NOT_IMPLEMENTED
)
1223 // Use standard interface instead.
1224 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1228 return stdInterface
->get_accValue (varID
, pszValue
);
1232 wxBasicString
basicString(strValue
);
1233 * pszValue
= basicString
.Get();
1239 // Modifies the selection or moves the keyboard focus of the
1240 // specified object. All objects that select or receive the
1241 // keyboard focus must support this method.
1243 STDMETHODIMP
wxIAccessible::accSelect ( long flagsSelect
, VARIANT varID
)
1245 wxLogDebug("get_accSelect");
1246 wxASSERT (m_pAccessible
!= NULL
);
1250 if (varID
.vt
!= VT_I4
&& varID
.vt
!= VT_EMPTY
)
1252 wxLogDebug("Invalid arg for accSelect");
1253 return E_INVALIDARG
;
1256 wxAccSelectionFlags wxsel
= wxConvertFromWindowsSelFlag(flagsSelect
);
1258 wxAccStatus status
= m_pAccessible
->Select(varID
.lVal
, wxsel
);
1259 if (status
== wxACC_FAIL
)
1262 if (status
== wxACC_NOT_IMPLEMENTED
)
1264 // Use standard interface instead.
1265 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1269 return stdInterface
->accSelect ( flagsSelect
, varID
);
1277 // Retrieves the object that has the keyboard focus. All objects
1278 // that receive the keyboard focus must support this property.
1280 STDMETHODIMP
wxIAccessible::get_accFocus ( VARIANT
* pVarID
)
1282 wxLogDebug("get_accFocus");
1283 wxASSERT (m_pAccessible
!= NULL
);
1287 wxAccessible
* childObject
= NULL
;
1289 VariantInit(pVarID
);
1291 wxAccStatus status
= m_pAccessible
->GetFocus(& childId
, & childObject
);
1292 if (status
== wxACC_FAIL
)
1295 if (status
== wxACC_NOT_IMPLEMENTED
)
1297 // Use standard interface instead.
1298 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1302 return stdInterface
->get_accFocus (pVarID
);
1306 if (childObject
== m_pAccessible
)
1309 pVarID
->lVal
= CHILDID_SELF
;
1313 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1317 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarID
->pdispVal
) != S_OK
)
1320 pVarID
->vt
= VT_DISPATCH
;
1321 // pVarID->pdispVal->AddRef();
1325 else if (childId
> 0)
1328 pVarID
->lVal
= childId
;
1333 pVarID
->vt
= VT_EMPTY
;
1340 // Retrieves the selected children of this object. All objects
1341 // selected must support this property.
1343 STDMETHODIMP
wxIAccessible::get_accSelection ( VARIANT
* pVarChildren
)
1345 wxLogDebug("get_accSelection");
1346 wxASSERT (m_pAccessible
!= NULL
);
1350 VariantInit(pVarChildren
);
1352 wxVariant selections
;
1353 wxAccStatus status
= m_pAccessible
->GetSelections(& selections
);
1354 if (status
== wxACC_FAIL
)
1357 if (status
== wxACC_NOT_IMPLEMENTED
)
1359 // Use standard interface instead.
1360 IAccessible
* stdInterface
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1364 return stdInterface
->get_accSelection (pVarChildren
);
1368 if (selections
.GetType() == wxT("long"))
1370 pVarChildren
->vt
= VT_I4
;
1371 pVarChildren
->lVal
= selections
.GetLong();
1375 else if (selections
.GetType() == wxT("void*"))
1377 wxAccessible
* childObject
= (wxAccessible
*) selections
.GetVoidPtr();
1378 wxIAccessible
* childIA
= childObject
->GetIAccessible();
1382 if (childIA
->QueryInterface(IID_IDispatch
, (LPVOID
*) & pVarChildren
->pdispVal
) != S_OK
)
1385 pVarChildren
->vt
= VT_DISPATCH
;
1386 // pVarChildren->pdispVal->AddRef();
1390 else if (selections
.GetType() == wxT("list"))
1392 // TODO: should we AddRef for every "void*" member??
1394 wxIEnumVARIANT
* enumVariant
= new wxIEnumVARIANT(selections
);
1395 enumVariant
->AddRef();
1397 pVarChildren
->vt
= VT_UNKNOWN
;
1398 pVarChildren
->punkVal
= enumVariant
;
1409 STDMETHODIMP
wxIAccessible::GetTypeInfo(unsigned int typeInfo
, LCID lcid
, ITypeInfo
** ppTypeInfo
)
1415 // Get type info count
1417 STDMETHODIMP
wxIAccessible::GetTypeInfoCount(unsigned int* typeInfoCount
)
1425 STDMETHODIMP
wxIAccessible::GetIDsOfNames(REFIID riid
, OLECHAR
** names
, unsigned int cNames
,
1426 LCID lcid
, DISPID
* dispId
)
1433 STDMETHODIMP
wxIAccessible::Invoke(DISPID dispIdMember
, REFIID riid
, LCID lcid
,
1434 WORD wFlags
, DISPPARAMS
*pDispParams
,
1435 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1436 unsigned int *puArgErr
)
1441 // Gets the IAccessible interface for the given child or object.
1442 // Call Release if this is non-NULL.
1443 IAccessible
* wxIAccessible::GetChildStdAccessible(int id
)
1447 IAccessible
* obj
= (IAccessible
*)m_pAccessible
->GetIAccessibleStd();
1458 IDispatch
* pDispatch
= NULL
;
1459 if (S_OK
== get_accChild ( var
, & pDispatch
))
1461 IAccessible
* childAccessible
= NULL
;
1462 if (pDispatch
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1464 pDispatch
->Release();
1465 wxIAccessible
* c
= (wxIAccessible
*) childAccessible
;
1466 IAccessible
* stdChildAccessible
= (IAccessible
*) c
->m_pAccessible
->GetIAccessibleStd();
1467 stdChildAccessible
->AddRef();
1468 childAccessible
->Release();
1469 return stdChildAccessible
;
1473 pDispatch
->Release();
1480 // Loop until we find the right id
1482 this->get_accChildCount(& nChildren
);
1485 for (i
= 0; i
< nChildren
; i
++)
1491 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1496 var
.vt
= VT_DISPATCH
;
1497 if (S_OK
== AccessibleChildren(this, i
, 1, & var
, &obtained
))
1499 IAccessible
* childAccessible
= NULL
;
1500 if (var
.pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
1502 var
.pdispVal
->Release();
1503 return childAccessible
;
1507 var
.pdispVal
->Release();
1520 // ----------------------------------------------------------------------------
1521 // wxAccessible implementation
1522 // ----------------------------------------------------------------------------
1526 // common part of all ctors
1527 void wxAccessible::Init()
1529 m_pIAccessibleStd
= NULL
;
1530 m_pIAccessible
= new wxIAccessible(this);
1531 m_pIAccessible
->AddRef();
1534 wxAccessible::wxAccessible(wxWindow
* win
)
1535 : wxAccessibleBase(win
)
1540 wxAccessible::~wxAccessible()
1542 m_pIAccessible
->Release();
1543 if (m_pIAccessibleStd
)
1544 ((IAccessible
*)m_pIAccessibleStd
)->Release();
1547 // Gets or creates a standard interface for this object.
1548 void* wxAccessible::GetIAccessibleStd()
1550 if (m_pIAccessibleStd
)
1551 return m_pIAccessibleStd
;
1556 HRESULT retCode
= ::CreateStdAccessibleProxy((HWND
) GetWindow()->GetHWND(),
1557 wxT("wxWindowClass"), OBJID_CLIENT
, IID_IAccessible
, (void**) & m_pIAccessibleStd
);
1559 HRESULT retCode
= ::CreateStdAccessibleObject((HWND
) GetWindow()->GetHWND(),
1560 OBJID_CLIENT
, IID_IAccessible
, (void**) & m_pIAccessibleStd
);
1562 if (retCode
== S_OK
)
1563 return m_pIAccessibleStd
;
1566 m_pIAccessibleStd
= NULL
;
1575 // Convert to Windows role
1576 int wxConvertToWindowsRole(wxAccRole wxrole
)
1580 case wxROLE_SYSTEM_ALERT
:
1581 return ROLE_SYSTEM_ALERT
;
1582 case wxROLE_SYSTEM_ANIMATION
:
1583 return ROLE_SYSTEM_ANIMATION
;
1584 case wxROLE_SYSTEM_APPLICATION
:
1585 return ROLE_SYSTEM_APPLICATION
;
1586 case wxROLE_SYSTEM_BORDER
:
1587 return ROLE_SYSTEM_BORDER
;
1588 case wxROLE_SYSTEM_BUTTONDROPDOWN
:
1589 return ROLE_SYSTEM_BUTTONDROPDOWN
;
1590 case wxROLE_SYSTEM_BUTTONDROPDOWNGRID
:
1591 return ROLE_SYSTEM_BUTTONDROPDOWNGRID
;
1592 case wxROLE_SYSTEM_BUTTONMENU
:
1593 return ROLE_SYSTEM_BUTTONMENU
;
1594 case wxROLE_SYSTEM_CARET
:
1595 return ROLE_SYSTEM_CARET
;
1596 case wxROLE_SYSTEM_CELL
:
1597 return ROLE_SYSTEM_CELL
;
1598 case wxROLE_SYSTEM_CHARACTER
:
1599 return ROLE_SYSTEM_CHARACTER
;
1600 case wxROLE_SYSTEM_CHART
:
1601 return ROLE_SYSTEM_CHART
;
1602 case wxROLE_SYSTEM_CHECKBUTTON
:
1603 return ROLE_SYSTEM_CHECKBUTTON
;
1604 case wxROLE_SYSTEM_CLIENT
:
1605 return ROLE_SYSTEM_CLIENT
;
1606 case wxROLE_SYSTEM_CLOCK
:
1607 return ROLE_SYSTEM_CLOCK
;
1608 case wxROLE_SYSTEM_COLUMN
:
1609 return ROLE_SYSTEM_COLUMN
;
1610 case wxROLE_SYSTEM_COLUMNHEADER
:
1611 return ROLE_SYSTEM_COLUMNHEADER
;
1612 case wxROLE_SYSTEM_COMBOBOX
:
1613 return ROLE_SYSTEM_COMBOBOX
;
1614 case wxROLE_SYSTEM_CURSOR
:
1615 return ROLE_SYSTEM_CURSOR
;
1616 case wxROLE_SYSTEM_DIAGRAM
:
1617 return ROLE_SYSTEM_DIAGRAM
;
1618 case wxROLE_SYSTEM_DIAL
:
1619 return ROLE_SYSTEM_DIAL
;
1620 case wxROLE_SYSTEM_DIALOG
:
1621 return ROLE_SYSTEM_DIALOG
;
1622 case wxROLE_SYSTEM_DOCUMENT
:
1623 return ROLE_SYSTEM_DOCUMENT
;
1624 case wxROLE_SYSTEM_DROPLIST
:
1625 return ROLE_SYSTEM_DROPLIST
;
1626 case wxROLE_SYSTEM_EQUATION
:
1627 return ROLE_SYSTEM_EQUATION
;
1628 case wxROLE_SYSTEM_GRAPHIC
:
1629 return ROLE_SYSTEM_GRAPHIC
;
1630 case wxROLE_SYSTEM_GRIP
:
1631 return ROLE_SYSTEM_GRIP
;
1632 case wxROLE_SYSTEM_GROUPING
:
1633 return ROLE_SYSTEM_GROUPING
;
1634 case wxROLE_SYSTEM_HELPBALLOON
:
1635 return ROLE_SYSTEM_HELPBALLOON
;
1636 case wxROLE_SYSTEM_HOTKEYFIELD
:
1637 return ROLE_SYSTEM_HOTKEYFIELD
;
1638 case wxROLE_SYSTEM_INDICATOR
:
1639 return ROLE_SYSTEM_INDICATOR
;
1640 case wxROLE_SYSTEM_LINK
:
1641 return ROLE_SYSTEM_LINK
;
1642 case wxROLE_SYSTEM_LIST
:
1643 return ROLE_SYSTEM_LIST
;
1644 case wxROLE_SYSTEM_LISTITEM
:
1645 return ROLE_SYSTEM_LISTITEM
;
1646 case wxROLE_SYSTEM_MENUBAR
:
1647 return ROLE_SYSTEM_MENUBAR
;
1648 case wxROLE_SYSTEM_MENUITEM
:
1649 return ROLE_SYSTEM_MENUITEM
;
1650 case wxROLE_SYSTEM_MENUPOPUP
:
1651 return ROLE_SYSTEM_MENUPOPUP
;
1652 case wxROLE_SYSTEM_OUTLINE
:
1653 return ROLE_SYSTEM_OUTLINE
;
1654 case wxROLE_SYSTEM_OUTLINEITEM
:
1655 return ROLE_SYSTEM_OUTLINEITEM
;
1656 case wxROLE_SYSTEM_PAGETAB
:
1657 return ROLE_SYSTEM_PAGETAB
;
1658 case wxROLE_SYSTEM_PAGETABLIST
:
1659 return ROLE_SYSTEM_PAGETABLIST
;
1660 case wxROLE_SYSTEM_PANE
:
1661 return ROLE_SYSTEM_PANE
;
1662 case wxROLE_SYSTEM_PROGRESSBAR
:
1663 return ROLE_SYSTEM_PROGRESSBAR
;
1664 case wxROLE_SYSTEM_PROPERTYPAGE
:
1665 return ROLE_SYSTEM_PROPERTYPAGE
;
1666 case wxROLE_SYSTEM_PUSHBUTTON
:
1667 return ROLE_SYSTEM_PUSHBUTTON
;
1668 case wxROLE_SYSTEM_RADIOBUTTON
:
1669 return ROLE_SYSTEM_RADIOBUTTON
;
1670 case wxROLE_SYSTEM_ROW
:
1671 return ROLE_SYSTEM_ROW
;
1672 case wxROLE_SYSTEM_ROWHEADER
:
1673 return ROLE_SYSTEM_ROWHEADER
;
1674 case wxROLE_SYSTEM_SCROLLBAR
:
1675 return ROLE_SYSTEM_SCROLLBAR
;
1676 case wxROLE_SYSTEM_SEPARATOR
:
1677 return ROLE_SYSTEM_SEPARATOR
;
1678 case wxROLE_SYSTEM_SLIDER
:
1679 return ROLE_SYSTEM_SLIDER
;
1680 case wxROLE_SYSTEM_SOUND
:
1681 return ROLE_SYSTEM_SOUND
;
1682 case wxROLE_SYSTEM_SPINBUTTON
:
1683 return ROLE_SYSTEM_SPINBUTTON
;
1684 case wxROLE_SYSTEM_STATICTEXT
:
1685 return ROLE_SYSTEM_STATICTEXT
;
1686 case wxROLE_SYSTEM_STATUSBAR
:
1687 return ROLE_SYSTEM_STATUSBAR
;
1688 case wxROLE_SYSTEM_TABLE
:
1689 return ROLE_SYSTEM_TABLE
;
1690 case wxROLE_SYSTEM_TEXT
:
1691 return ROLE_SYSTEM_TEXT
;
1692 case wxROLE_SYSTEM_TITLEBAR
:
1693 return ROLE_SYSTEM_TITLEBAR
;
1694 case wxROLE_SYSTEM_TOOLBAR
:
1695 return ROLE_SYSTEM_TOOLBAR
;
1696 case wxROLE_SYSTEM_TOOLTIP
:
1697 return ROLE_SYSTEM_TOOLTIP
;
1698 case wxROLE_SYSTEM_WHITESPACE
:
1699 return ROLE_SYSTEM_WHITESPACE
;
1700 case wxROLE_SYSTEM_WINDOW
:
1701 return ROLE_SYSTEM_WINDOW
;
1706 // Convert to Windows state
1707 long wxConvertToWindowsState(long wxstate
)
1710 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_HIGH
)
1711 state
|= STATE_SYSTEM_ALERT_HIGH
;
1713 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_MEDIUM
)
1714 state
|= STATE_SYSTEM_ALERT_MEDIUM
;
1716 if (wxstate
& wxACC_STATE_SYSTEM_ALERT_LOW
)
1717 state
|= STATE_SYSTEM_ALERT_LOW
;
1719 if (wxstate
& wxACC_STATE_SYSTEM_ANIMATED
)
1720 state
|= STATE_SYSTEM_ANIMATED
;
1722 if (wxstate
& wxACC_STATE_SYSTEM_BUSY
)
1723 state
|= STATE_SYSTEM_BUSY
;
1725 if (wxstate
& wxACC_STATE_SYSTEM_CHECKED
)
1726 state
|= STATE_SYSTEM_CHECKED
;
1728 if (wxstate
& wxACC_STATE_SYSTEM_COLLAPSED
)
1729 state
|= STATE_SYSTEM_COLLAPSED
;
1731 if (wxstate
& wxACC_STATE_SYSTEM_DEFAULT
)
1732 state
|= STATE_SYSTEM_DEFAULT
;
1734 if (wxstate
& wxACC_STATE_SYSTEM_EXPANDED
)
1735 state
|= STATE_SYSTEM_EXPANDED
;
1737 if (wxstate
& wxACC_STATE_SYSTEM_EXTSELECTABLE
)
1738 state
|= STATE_SYSTEM_EXTSELECTABLE
;
1740 if (wxstate
& wxACC_STATE_SYSTEM_FLOATING
)
1741 state
|= STATE_SYSTEM_FLOATING
;
1743 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSABLE
)
1744 state
|= STATE_SYSTEM_FOCUSABLE
;
1746 if (wxstate
& wxACC_STATE_SYSTEM_FOCUSED
)
1747 state
|= STATE_SYSTEM_FOCUSED
;
1749 if (wxstate
& wxACC_STATE_SYSTEM_HOTTRACKED
)
1750 state
|= STATE_SYSTEM_HOTTRACKED
;
1752 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1753 state
|= STATE_SYSTEM_INVISIBLE
;
1755 if (wxstate
& wxACC_STATE_SYSTEM_INVISIBLE
)
1756 state
|= STATE_SYSTEM_INVISIBLE
;
1758 if (wxstate
& wxACC_STATE_SYSTEM_MIXED
)
1759 state
|= STATE_SYSTEM_MIXED
;
1761 if (wxstate
& wxACC_STATE_SYSTEM_MULTISELECTABLE
)
1762 state
|= STATE_SYSTEM_MULTISELECTABLE
;
1764 if (wxstate
& wxACC_STATE_SYSTEM_OFFSCREEN
)
1765 state
|= STATE_SYSTEM_OFFSCREEN
;
1767 if (wxstate
& wxACC_STATE_SYSTEM_PRESSED
)
1768 state
|= STATE_SYSTEM_PRESSED
;
1770 // if (wxstate & wxACC_STATE_SYSTEM_PROTECTED)
1771 // state |= STATE_SYSTEM_PROTECTED;
1773 if (wxstate
& wxACC_STATE_SYSTEM_READONLY
)
1774 state
|= STATE_SYSTEM_READONLY
;
1776 if (wxstate
& wxACC_STATE_SYSTEM_SELECTABLE
)
1777 state
|= STATE_SYSTEM_SELECTABLE
;
1779 if (wxstate
& wxACC_STATE_SYSTEM_SELECTED
)
1780 state
|= STATE_SYSTEM_SELECTED
;
1782 if (wxstate
& wxACC_STATE_SYSTEM_SELFVOICING
)
1783 state
|= STATE_SYSTEM_SELFVOICING
;
1785 if (wxstate
& wxACC_STATE_SYSTEM_UNAVAILABLE
)
1786 state
|= STATE_SYSTEM_UNAVAILABLE
;
1791 // Convert to Windows selection flag
1792 int wxConvertToWindowsSelFlag(wxAccSelectionFlags wxsel
)
1796 if (sel
& wxACC_SEL_TAKEFOCUS
)
1797 sel
|= SELFLAG_TAKEFOCUS
;
1798 if (sel
& wxACC_SEL_TAKESELECTION
)
1799 sel
|= SELFLAG_TAKESELECTION
;
1800 if (sel
& wxACC_SEL_EXTENDSELECTION
)
1801 sel
|= SELFLAG_EXTENDSELECTION
;
1802 if (sel
& wxACC_SEL_ADDSELECTION
)
1803 sel
|= SELFLAG_ADDSELECTION
;
1804 if (sel
& wxACC_SEL_REMOVESELECTION
)
1805 sel
|= SELFLAG_REMOVESELECTION
;
1809 // Convert from Windows selection flag
1810 wxAccSelectionFlags
wxConvertFromWindowsSelFlag(int sel
)
1814 if (sel
& SELFLAG_TAKEFOCUS
)
1815 wxsel
|= wxACC_SEL_TAKEFOCUS
;
1816 if (sel
& SELFLAG_TAKESELECTION
)
1817 wxsel
|= wxACC_SEL_TAKESELECTION
;
1818 if (sel
& SELFLAG_EXTENDSELECTION
)
1819 wxsel
|= wxACC_SEL_EXTENDSELECTION
;
1820 if (sel
& SELFLAG_ADDSELECTION
)
1821 wxsel
|= wxACC_SEL_ADDSELECTION
;
1822 if (sel
& SELFLAG_REMOVESELECTION
)
1823 wxsel
|= wxACC_SEL_REMOVESELECTION
;
1824 return (wxAccSelectionFlags
) wxsel
;
1828 #endif //USE_ACCESSIBILITY