]> git.saurik.com Git - wxWidgets.git/blob - src/msw/ole/access.cpp
don't try to paint hidden windows
[wxWidgets.git] / src / msw / ole / access.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/ole/access.cpp
3 // Purpose: implementation of wxIAccessible and wxAccessible
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2003-02-12
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 Julian Smart
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #if defined(__BORLANDC__)
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
28
29 #include "wx/access.h"
30
31 #ifndef WX_PRECOMP
32 #include "wx/msw/wrapwin.h"
33 #include "wx/window.h"
34 #include "wx/log.h"
35 #endif
36
37 // for some compilers, the entire ole2.h must be included, not only oleauto.h
38 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
39 #include <ole2.h>
40 #endif
41
42 #include <oleauto.h>
43 #include <oleacc.h>
44 #include <winable.h>
45
46 #include "wx/msw/ole/oleutils.h"
47
48 #ifndef CHILDID_SELF
49 #define CHILDID_SELF 0
50 #endif
51
52 #ifndef OBJID_CLIENT
53 #define OBJID_CLIENT 0xFFFFFFFC
54 #endif
55
56 // Convert to Windows role
57 int wxConvertToWindowsRole(wxAccRole wxrole);
58
59 // Convert to Windows state
60 long wxConvertToWindowsState(long wxstate);
61
62 // Convert to Windows selection flag
63 int wxConvertToWindowsSelFlag(wxAccSelectionFlags sel);
64
65 // Convert from Windows selection flag
66 wxAccSelectionFlags wxConvertFromWindowsSelFlag(int sel);
67
68 // ----------------------------------------------------------------------------
69 // wxIEnumVARIANT interface implementation
70 // ----------------------------------------------------------------------------
71
72 class wxIEnumVARIANT : public IEnumVARIANT
73 {
74 public:
75 wxIEnumVARIANT(const wxVariant& variant);
76 virtual ~wxIEnumVARIANT() { }
77
78 DECLARE_IUNKNOWN_METHODS;
79
80 // IEnumVARIANT
81 STDMETHODIMP Next(ULONG celt, VARIANT *rgelt, ULONG *pceltFetched);
82 STDMETHODIMP Skip(ULONG celt);
83 STDMETHODIMP Reset();
84 STDMETHODIMP Clone(IEnumVARIANT **ppenum);
85
86 private:
87 wxVariant m_variant; // List of further variants
88 int m_nCurrent; // Current enum position
89
90 DECLARE_NO_COPY_CLASS(wxIEnumVARIANT)
91 };
92
93 // ----------------------------------------------------------------------------
94 // wxIEnumVARIANT
95 // ----------------------------------------------------------------------------
96
97 BEGIN_IID_TABLE(wxIEnumVARIANT)
98 ADD_IID(Unknown)
99 ADD_IID(EnumVARIANT)
100 END_IID_TABLE;
101
102 IMPLEMENT_IUNKNOWN_METHODS(wxIEnumVARIANT)
103
104 // wxVariant contains a list of further variants.
105 wxIEnumVARIANT::wxIEnumVARIANT(const wxVariant& variant)
106 {
107 m_variant = variant;
108 }
109
110 STDMETHODIMP wxIEnumVARIANT::Next(ULONG celt,
111 VARIANT *rgelt,
112 ULONG *pceltFetched)
113 {
114 wxLogTrace(wxTRACE_OleCalls, wxT("wxIEnumVARIANT::Next"));
115
116 if ( celt > 1 ) {
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
119 return S_FALSE;
120 }
121
122 if (m_variant.GetType() != wxT("list"))
123 return S_FALSE;
124
125 if ( m_nCurrent < (int) m_variant.GetList().GetCount() ) {
126 if (!wxConvertVariantToOle(m_variant[m_nCurrent++], rgelt[0]))
127 {
128 return S_FALSE;
129 }
130
131 // TODO: should we AddRef if this is an object?
132
133 * pceltFetched = 1;
134 return S_OK;
135 }
136 else {
137 // bad index
138 return S_FALSE;
139 }
140 }
141
142 STDMETHODIMP wxIEnumVARIANT::Skip(ULONG celt)
143 {
144 wxLogTrace(wxTRACE_OleCalls, wxT("wxIEnumVARIANT::Skip"));
145
146 if (m_variant.GetType() != wxT("list"))
147 return S_FALSE;
148
149 m_nCurrent += celt;
150 if ( m_nCurrent < (int) m_variant.GetList().GetCount() )
151 return S_OK;
152
153 // no, can't skip this many elements
154 m_nCurrent -= celt;
155
156 return S_FALSE;
157 }
158
159 STDMETHODIMP wxIEnumVARIANT::Reset()
160 {
161 wxLogTrace(wxTRACE_OleCalls, wxT("wxIEnumVARIANT::Reset"));
162
163 m_nCurrent = 0;
164
165 return S_OK;
166 }
167
168 STDMETHODIMP wxIEnumVARIANT::Clone(IEnumVARIANT **ppenum)
169 {
170 wxLogTrace(wxTRACE_OleCalls, wxT("wxIEnumVARIANT::Clone"));
171
172 wxIEnumVARIANT *pNew = new wxIEnumVARIANT(m_variant);
173 pNew->AddRef();
174 *ppenum = pNew;
175
176 return S_OK;
177 }
178
179
180 // ----------------------------------------------------------------------------
181 // wxIAccessible implementation of IAccessible interface
182 // ----------------------------------------------------------------------------
183
184 class wxIAccessible : public IAccessible
185 {
186 public:
187 wxIAccessible(wxAccessible *pAccessible);
188
189 DECLARE_IUNKNOWN_METHODS;
190
191 // IAccessible
192
193 // Navigation and Hierarchy
194
195 // Retrieves the child element or child object at a given point on the screen.
196 // All visual objects support this method; sound objects do not support it.
197
198 STDMETHODIMP accHitTest(long xLeft, long yLeft, VARIANT* pVarID);
199
200 // Retrieves the specified object's current screen location. All visual objects must
201 // support this method; sound objects do not support it.
202
203 STDMETHODIMP accLocation ( long* pxLeft, long* pyTop, long* pcxWidth, long* pcyHeight, VARIANT varID);
204
205 // Traverses to another user interface element within a container and retrieves the object.
206 // All visual objects must support this method.
207
208 STDMETHODIMP accNavigate ( long navDir, VARIANT varStart, VARIANT* pVarEnd);
209
210 // Retrieves the address of an IDispatch interface for the specified child.
211 // All objects must support this property.
212
213 STDMETHODIMP get_accChild ( VARIANT varChildID, IDispatch** ppDispChild);
214
215 // Retrieves the number of children that belong to this object.
216 // All objects must support this property.
217
218 STDMETHODIMP get_accChildCount ( long* pCountChildren);
219
220 // Retrieves the IDispatch interface of the object's parent.
221 // All objects support this property.
222
223 STDMETHODIMP get_accParent ( IDispatch** ppDispParent);
224
225 // Descriptive Properties and Methods
226
227 // Performs the object's default action. Not all objects have a default
228 // action.
229
230 STDMETHODIMP accDoDefaultAction(VARIANT varID);
231
232 // Retrieves a string that describes the object's default action.
233 // Not all objects have a default action.
234
235 STDMETHODIMP get_accDefaultAction ( VARIANT varID, BSTR* pszDefaultAction);
236
237 // Retrieves a string that describes the visual appearance of the specified object.
238 // Not all objects have a description.
239
240 STDMETHODIMP get_accDescription ( VARIANT varID, BSTR* pszDescription);
241
242 // Retrieves an object's Help property string.
243 // Not all objects support this property.
244
245 STDMETHODIMP get_accHelp ( VARIANT varID, BSTR* pszHelp);
246
247 // Retrieves the full path of the WinHelp file associated with the specified
248 // object and the identifier of the appropriate topic within that file.
249 // Not all objects support this property.
250
251 STDMETHODIMP get_accHelpTopic ( BSTR* pszHelpFile, VARIANT varChild, long* pidTopic);
252
253 // Retrieves the specified object's shortcut key or access key, also known as
254 // the mnemonic. All objects that have a shortcut key or access key support
255 // this property.
256
257 STDMETHODIMP get_accKeyboardShortcut ( VARIANT varID, BSTR* pszKeyboardShortcut);
258
259 // Retrieves the name of the specified object.
260 // All objects support this property.
261
262 STDMETHODIMP get_accName ( VARIANT varID, BSTR* pszName);
263
264 // Retrieves information that describes the role of the specified object.
265 // All objects support this property.
266
267 STDMETHODIMP get_accRole ( VARIANT varID, VARIANT* pVarRole);
268
269 // Retrieves the current state of the specified object.
270 // All objects support this property.
271
272 STDMETHODIMP get_accState ( VARIANT varID, VARIANT* pVarState);
273
274 // Retrieves the value of the specified object.
275 // Not all objects have a value.
276
277 STDMETHODIMP get_accValue ( VARIANT varID, BSTR* pszValue);
278
279 // Selection and Focus
280
281 // Modifies the selection or moves the keyboard focus of the
282 // specified object. All objects that select or receive the
283 // keyboard focus must support this method.
284
285 STDMETHODIMP accSelect ( long flagsSelect, VARIANT varID );
286
287 // Retrieves the object that has the keyboard focus. All objects
288 // that receive the keyboard focus must support this property.
289
290 STDMETHODIMP get_accFocus ( VARIANT* pVarID);
291
292 // Retrieves the selected children of this object. All objects
293 // selected must support this property.
294
295 STDMETHODIMP get_accSelection ( VARIANT * pVarChildren);
296
297 // Obsolete
298
299 STDMETHODIMP put_accName(VARIANT WXUNUSED(varChild), BSTR WXUNUSED(szName)) { return E_FAIL; }
300 STDMETHODIMP put_accValue(VARIANT WXUNUSED(varChild), BSTR WXUNUSED(szName)) { return E_FAIL; }
301
302 // IDispatch
303
304 // Get type info
305
306 STDMETHODIMP GetTypeInfo(unsigned int typeInfo, LCID lcid, ITypeInfo** ppTypeInfo);
307
308 // Get type info count
309
310 STDMETHODIMP GetTypeInfoCount(unsigned int* typeInfoCount);
311
312 // Get ids of names
313
314 STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** names, unsigned int cNames,
315 LCID lcid, DISPID* dispId);
316
317 // Invoke
318
319 STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
320 WORD wFlags, DISPPARAMS *pDispParams,
321 VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
322 unsigned int *puArgErr );
323
324 // Helpers
325
326 // Gets the standard IAccessible interface for the given child or object.
327 // Call Release if this is non-NULL.
328 IAccessible* GetChildStdAccessible(int id);
329
330 // Gets the IAccessible interface for the given child or object.
331 // Call Release if this is non-NULL.
332 IAccessible* GetChildAccessible(int id);
333
334 private:
335 wxAccessible *m_pAccessible; // pointer to C++ class we belong to
336
337 DECLARE_NO_COPY_CLASS(wxIAccessible)
338 };
339
340 // ============================================================================
341 // Implementation
342 // ============================================================================
343
344 // ----------------------------------------------------------------------------
345 // wxIAccessible implementation
346 // ----------------------------------------------------------------------------
347 BEGIN_IID_TABLE(wxIAccessible)
348 ADD_IID(Unknown)
349 ADD_IID(Accessible)
350 ADD_IID(Dispatch)
351 END_IID_TABLE;
352
353 IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible)
354
355 wxIAccessible::wxIAccessible(wxAccessible *pAccessible)
356 {
357 wxASSERT( pAccessible != NULL );
358
359 m_pAccessible = pAccessible;
360 }
361
362 // Retrieves the child element or child object at a given point on the screen.
363 // All visual objects support this method; sound objects do not support it.
364
365 STDMETHODIMP wxIAccessible::accHitTest(long xLeft, long yLeft, VARIANT* pVarID)
366 {
367 wxLogTrace(wxT("access"), wxT("accHitTest"));
368 wxASSERT (m_pAccessible != NULL);
369 if (!m_pAccessible)
370 return E_FAIL;
371
372 wxAccessible* childObject = NULL;
373 int childId = 0;
374 VariantInit(pVarID);
375
376 wxAccStatus status = m_pAccessible->HitTest(wxPoint(xLeft, yLeft), & childId, & childObject);
377
378 if (status == wxACC_FAIL)
379 return E_FAIL;
380
381 if (status == wxACC_NOT_IMPLEMENTED)
382 {
383 // Use standard interface instead.
384 IAccessible* stdInterface = (IAccessible*)m_pAccessible->GetIAccessibleStd();
385 if (!stdInterface)
386 return E_NOTIMPL;
387 else
388 return stdInterface->accHitTest(xLeft, yLeft, pVarID);
389 }
390
391 if (childObject)
392 {
393 if (childObject == m_pAccessible)
394 {
395 pVarID->vt = VT_I4;
396 pVarID->lVal = CHILDID_SELF;
397 return S_OK;
398 }
399 else
400 {
401 wxIAccessible* childIA = childObject->GetIAccessible();
402 if (!childIA)
403 return E_NOTIMPL;
404
405 if (childIA->QueryInterface(IID_IDispatch, (LPVOID*) & pVarID->pdispVal) != S_OK)
406 return E_FAIL;
407
408 pVarID->vt = VT_DISPATCH;
409 return S_OK;
410 }
411 }
412 else if (childId > 0)
413 {
414 pVarID->vt = VT_I4;
415 pVarID->lVal = childId;
416 return S_OK;
417 }
418 else
419 {
420 pVarID->vt = VT_EMPTY;
421 return S_FALSE;
422 }
423
424 #if 0
425 // all cases above already cause some return action so below line
426 // is unreachable and cause unnecessary warning
427 return E_NOTIMPL;
428 #endif
429 }
430
431 // Retrieves the specified object's current screen location. All visual objects must
432 // support this method; sound objects do not support it.
433
434 STDMETHODIMP wxIAccessible::accLocation ( long* pxLeft, long* pyTop, long* pcxWidth, long* pcyHeight, VARIANT varID)
435 {
436 wxLogTrace(wxT("access"), wxT("accLocation"));
437 wxASSERT (m_pAccessible != NULL);
438 if (!m_pAccessible)
439 return E_FAIL;
440
441 wxRect rect;
442
443 wxAccStatus status = m_pAccessible->GetLocation(rect, varID.lVal);
444 if (status == wxACC_FAIL)
445 return E_FAIL;
446
447 if (status == wxACC_NOT_IMPLEMENTED)
448 {
449 // Try to use child object directly.
450 if (varID.lVal > 0)
451 {
452 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
453 if (childAccessible)
454 {
455 varID.lVal = 0;
456 HRESULT hResult = childAccessible->accLocation(pxLeft, pyTop, pcxWidth, pcyHeight, varID);
457 childAccessible->Release();
458 return hResult;
459 }
460 else if (m_pAccessible->GetIAccessibleStd())
461 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->accLocation(pxLeft, pyTop, pcxWidth, pcyHeight, varID);
462 }
463 else if (m_pAccessible->GetIAccessibleStd())
464 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->accLocation(pxLeft, pyTop, pcxWidth, pcyHeight, varID);
465 }
466 else
467 {
468 *pxLeft = rect.x;
469 *pyTop = rect.y;
470 *pcxWidth = rect.width;
471 *pcyHeight = rect.height;
472 return S_OK;
473 }
474
475 return E_NOTIMPL;
476 }
477
478 // Traverses to another user interface element within a container and retrieves the object.
479 // All visual objects must support this method.
480
481 STDMETHODIMP wxIAccessible::accNavigate ( long navDir, VARIANT varStart, VARIANT* pVarEnd)
482 {
483 wxASSERT (m_pAccessible != NULL);
484 if (!m_pAccessible)
485 return E_FAIL;
486 wxLogTrace(wxT("access"), wxString(wxT("accNavigate for ")) + m_pAccessible->GetWindow()->GetClassInfo()->GetClassName());
487
488 if ((varStart.vt != VT_I4 && varStart.vt != VT_EMPTY)
489 #if 0
490 // according to MSDN and sources varStart.vt is unsigned
491 // so below line cause warning "Condition is always false"
492 || varStart.vt < 0
493 #endif
494 )
495 {
496 wxLogTrace(wxT("access"), wxT("Invalid arg for accNavigate"));
497 return E_INVALIDARG;
498 }
499
500 wxAccessible* elementObject = NULL;
501 int elementId = 0;
502 VariantInit(pVarEnd);
503 wxNavDir navDirWX = wxNAVDIR_FIRSTCHILD;
504
505 wxString navStr;
506
507 switch (navDir)
508 {
509 case NAVDIR_DOWN:
510 navDirWX = wxNAVDIR_DOWN;
511 navStr = wxT("wxNAVDIR_DOWN");
512 break;
513
514 case NAVDIR_FIRSTCHILD:
515 navDirWX = wxNAVDIR_FIRSTCHILD;
516 navStr = wxT("wxNAVDIR_FIRSTCHILD");
517 break;
518
519 case NAVDIR_LASTCHILD:
520 navDirWX = wxNAVDIR_LASTCHILD;
521 navStr = wxT("wxNAVDIR_LASTCHILD");
522 break;
523
524 case NAVDIR_LEFT:
525 navDirWX = wxNAVDIR_LEFT;
526 navStr = wxT("wxNAVDIR_LEFT");
527 break;
528
529 case NAVDIR_NEXT:
530 navDirWX = wxNAVDIR_NEXT;
531 navStr = wxT("wxNAVDIR_NEXT");
532 break;
533
534 case NAVDIR_PREVIOUS:
535 navDirWX = wxNAVDIR_PREVIOUS;
536 navStr = wxT("wxNAVDIR_PREVIOUS");
537 break;
538
539 case NAVDIR_RIGHT:
540 navDirWX = wxNAVDIR_RIGHT;
541 navStr = wxT("wxNAVDIR_RIGHT");
542 break;
543
544 case NAVDIR_UP:
545 navDirWX = wxNAVDIR_UP;
546 navStr = wxT("wxNAVDIR_UP");
547 break;
548 default:
549 {
550 wxLogTrace(wxT("access"), wxT("Unknown NAVDIR symbol"));
551 break;
552 }
553 }
554 wxLogTrace(wxT("access"), navStr);
555
556 wxAccStatus status = m_pAccessible->Navigate(navDirWX, varStart.lVal, & elementId,
557 & elementObject);
558
559 if (status == wxACC_FAIL)
560 {
561 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate failed"));
562 return E_FAIL;
563 }
564
565 if (status == wxACC_FALSE)
566 {
567 wxLogTrace(wxT("access"), wxT("wxAccessible::Navigate found no object in this direction"));
568 return S_FALSE;
569 }
570
571 if (status == wxACC_NOT_IMPLEMENTED)
572 {
573 wxLogTrace(wxT("access"), wxT("Navigate not implemented"));
574
575 // Try to use child object directly.
576 if (varStart.vt == VT_I4 && varStart.lVal > 0)
577 {
578 IAccessible* childAccessible = GetChildAccessible(varStart.lVal);
579 if (childAccessible)
580 {
581 varStart.lVal = 0;
582 HRESULT hResult = childAccessible->accNavigate(navDir, varStart, pVarEnd);
583 childAccessible->Release();
584 return hResult;
585 }
586 else if (m_pAccessible->GetIAccessibleStd())
587 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->accNavigate(navDir, varStart, pVarEnd);
588 }
589 else if (m_pAccessible->GetIAccessibleStd())
590 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->accNavigate(navDir, varStart, pVarEnd);
591 }
592 else
593 {
594 if (elementObject)
595 {
596 wxLogTrace(wxT("access"), wxT("Getting wxIAccessible and calling QueryInterface for Navigate"));
597 wxIAccessible* objectIA = elementObject->GetIAccessible();
598 if (!objectIA)
599 {
600 wxLogTrace(wxT("access"), wxT("No wxIAccessible"));
601 return E_FAIL;
602 }
603
604 HRESULT hResult = objectIA->QueryInterface(IID_IDispatch, (LPVOID*) & pVarEnd->pdispVal);
605 if (hResult != S_OK)
606 {
607 wxLogTrace(wxT("access"), wxT("QueryInterface failed"));
608 return E_FAIL;
609 }
610
611 wxLogTrace(wxT("access"), wxT("Called QueryInterface for Navigate"));
612 pVarEnd->vt = VT_DISPATCH;
613 return S_OK;
614 }
615 else if (elementId > 0)
616 {
617 wxLogTrace(wxT("access"), wxT("Returning element id from Navigate"));
618 pVarEnd->vt = VT_I4;
619 pVarEnd->lVal = elementId;
620 return S_OK;
621 }
622 else
623 {
624 wxLogTrace(wxT("access"), wxT("No object in accNavigate"));
625 pVarEnd->vt = VT_EMPTY;
626 return S_FALSE;
627 }
628 }
629
630 wxLogTrace(wxT("access"), wxT("Failing Navigate"));
631 return E_NOTIMPL;
632 }
633
634 // Retrieves the address of an IDispatch interface for the specified child.
635 // All objects must support this property.
636
637 STDMETHODIMP wxIAccessible::get_accChild ( VARIANT varChildID, IDispatch** ppDispChild)
638 {
639 wxLogTrace(wxT("access"), wxT("get_accChild"));
640 wxASSERT (m_pAccessible != NULL);
641 if (!m_pAccessible)
642 return E_FAIL;
643
644 if (varChildID.vt != VT_I4)
645 {
646 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accChild"));
647 return E_INVALIDARG;
648 }
649
650 if (varChildID.lVal == CHILDID_SELF)
651 {
652 *ppDispChild = this;
653 AddRef();
654 return S_OK;
655 }
656
657 wxAccessible* child = NULL;
658
659 wxAccStatus status = m_pAccessible->GetChild(varChildID.lVal, & child);
660 if (status == wxACC_FAIL)
661 {
662 wxLogTrace(wxT("access"), wxT("GetChild failed"));
663 return E_FAIL;
664 }
665
666 if (status == wxACC_NOT_IMPLEMENTED)
667 {
668 // Use standard interface instead.
669 IAccessible* stdInterface = (IAccessible*)m_pAccessible->GetIAccessibleStd();
670 if (!stdInterface)
671 return E_NOTIMPL;
672 else
673 {
674 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChild"));
675 return stdInterface->get_accChild (varChildID, ppDispChild);
676 }
677 }
678 else
679 {
680 if (child)
681 {
682 wxIAccessible* objectIA = child->GetIAccessible();
683 if (!objectIA)
684 return E_NOTIMPL;
685
686 if (objectIA->QueryInterface(IID_IDispatch, (LPVOID*) ppDispChild) != S_OK)
687 {
688 wxLogTrace(wxT("access"), wxT("QueryInterface failed in get_accChild"));
689 return E_FAIL;
690 }
691
692 return S_OK;
693 }
694 else
695 {
696 wxLogTrace(wxT("access"), wxT("Not an accessible object"));
697 return S_FALSE; // Indicates it's not an accessible object
698 }
699 }
700
701 #if 0
702 // all cases above already cause some return action so below line
703 // is unreachable and cause unnecessary warning
704 return E_NOTIMPL;
705 #endif
706 }
707
708 // Retrieves the number of children that belong to this object.
709 // All objects must support this property.
710
711 STDMETHODIMP wxIAccessible::get_accChildCount ( long* pCountChildren)
712 {
713 wxLogTrace(wxT("access"), wxT("get_accChildCount"));
714 wxASSERT (m_pAccessible != NULL);
715 if (!m_pAccessible)
716 return E_FAIL;
717
718 int childCount = 0;
719 wxAccStatus status = m_pAccessible->GetChildCount(& childCount);
720 if (status == wxACC_FAIL)
721 return E_FAIL;
722
723 if (status == wxACC_NOT_IMPLEMENTED)
724 {
725 // Use standard interface instead.
726 IAccessible* stdInterface = (IAccessible*)m_pAccessible->GetIAccessibleStd();
727 if (!stdInterface)
728 return E_NOTIMPL;
729 else
730 {
731 wxLogTrace(wxT("access"), wxT("Using standard interface for get_accChildCount"));
732 HRESULT res = stdInterface->get_accChildCount (pCountChildren);
733 wxString str;
734 str.Printf(wxT("Number of children was %d"), (int) (*pCountChildren));
735 wxLogTrace(wxT("access"), str);
736 return res;
737 }
738 }
739 else
740 {
741 * pCountChildren = (long) childCount;
742 return S_OK;
743 }
744
745 #if 0
746 // all cases above already cause some return action so below line
747 // is unreachable and cause unnecessary warning
748 return E_NOTIMPL;
749 #endif
750 }
751
752 // Retrieves the IDispatch interface of the object's parent.
753 // All objects support this property.
754
755 STDMETHODIMP wxIAccessible::get_accParent ( IDispatch** ppDispParent)
756 {
757 wxLogTrace(wxT("access"), wxT("get_accParent"));
758 wxASSERT (m_pAccessible != NULL);
759 if (!m_pAccessible)
760 return E_FAIL;
761
762 wxAccessible* parent = NULL;
763 wxAccStatus status = m_pAccessible->GetParent(& parent);
764
765 if (status == wxACC_FAIL)
766 return E_FAIL;
767
768 // It doesn't seem acceptable to return S_FALSE with a NULL
769 // ppDispParent, so if we have no wxWidgets parent, we leave
770 // it to the standard interface.
771 if (status == wxACC_NOT_IMPLEMENTED || !parent)
772 {
773 wxLogTrace(wxT("access"), wxT("Using standard interface to get the parent."));
774 // Use standard interface instead.
775 IAccessible* stdInterface = (IAccessible*)m_pAccessible->GetIAccessibleStd();
776 if (!stdInterface)
777 return E_NOTIMPL;
778 else
779 return stdInterface->get_accParent (ppDispParent);
780 }
781 else
782 {
783 if (parent)
784 {
785 wxIAccessible* objectIA = parent->GetIAccessible();
786 if (!objectIA)
787 return E_FAIL;
788
789 wxLogTrace(wxT("access"), wxT("About to call QueryInterface"));
790 if (objectIA->QueryInterface(IID_IDispatch, (LPVOID*) ppDispParent) != S_OK)
791 {
792 wxLogTrace(wxT("access"), wxT("Failed QueryInterface"));
793 return E_FAIL;
794 }
795
796 wxLogTrace(wxT("access"), wxT("Returning S_OK for get_accParent"));
797 return S_OK;
798 }
799 else
800 {
801 // This doesn't seem to be allowed, despite the documentation,
802 // so we handle it higher up by using the standard interface.
803 wxLogTrace(wxT("access"), wxT("Returning NULL parent because there was none"));
804 *ppDispParent = NULL;
805 return S_FALSE;
806 }
807 }
808
809 #if 0
810 // all cases above already cause some return action so below line
811 // is unreachable and cause unnecessary warning
812 return E_NOTIMPL;
813 #endif
814 }
815
816 // Performs the object's default action. Not all objects have a default
817 // action.
818
819 STDMETHODIMP wxIAccessible::accDoDefaultAction(VARIANT varID)
820 {
821 wxLogTrace(wxT("access"), wxT("accDoDefaultAction"));
822 wxASSERT (m_pAccessible != NULL);
823 if (!m_pAccessible)
824 return E_FAIL;
825
826 if (varID.vt != VT_I4)
827 {
828 wxLogTrace(wxT("access"), wxT("Invalid arg for accDoDefaultAction"));
829 return E_INVALIDARG;
830 }
831
832 wxAccStatus status = m_pAccessible->DoDefaultAction(varID.lVal);
833 if (status == wxACC_FAIL)
834 return E_FAIL;
835
836 if (status == wxACC_NOT_SUPPORTED)
837 return DISP_E_MEMBERNOTFOUND;
838
839 if (status == wxACC_NOT_IMPLEMENTED)
840 {
841 // Try to use child object directly.
842 if (varID.lVal > 0)
843 {
844 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
845 if (childAccessible)
846 {
847 varID.lVal = 0;
848 HRESULT hResult = childAccessible->accDoDefaultAction(varID);
849 childAccessible->Release();
850 return hResult;
851 }
852 else if (m_pAccessible->GetIAccessibleStd())
853 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->accDoDefaultAction(varID);
854 }
855 else if (m_pAccessible->GetIAccessibleStd())
856 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->accDoDefaultAction(varID);
857 }
858 return E_FAIL;
859 }
860
861 // Retrieves a string that describes the object's default action.
862 // Not all objects have a default action.
863
864 STDMETHODIMP wxIAccessible::get_accDefaultAction ( VARIANT varID, BSTR* pszDefaultAction)
865 {
866 wxLogTrace(wxT("access"), wxT("get_accDefaultAction"));
867 wxASSERT (m_pAccessible != NULL);
868 if (!m_pAccessible)
869 return E_FAIL;
870
871 if (varID.vt != VT_I4)
872 {
873 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDefaultAction"));
874 return E_INVALIDARG;
875 }
876
877 wxString defaultAction;
878 wxAccStatus status = m_pAccessible->GetDefaultAction(varID.lVal, & defaultAction);
879 if (status == wxACC_FAIL)
880 return E_FAIL;
881
882 if (status == wxACC_NOT_SUPPORTED)
883 return DISP_E_MEMBERNOTFOUND;
884
885 if (status == wxACC_NOT_IMPLEMENTED)
886 {
887 // Try to use child object directly.
888 if (varID.lVal > 0)
889 {
890 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
891 if (childAccessible)
892 {
893 varID.lVal = 0;
894 HRESULT hResult = childAccessible->get_accDefaultAction(varID, pszDefaultAction);
895 childAccessible->Release();
896 return hResult;
897 }
898 else if (m_pAccessible->GetIAccessibleStd())
899 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accDefaultAction(varID, pszDefaultAction);
900 }
901 else if (m_pAccessible->GetIAccessibleStd())
902 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accDefaultAction(varID, pszDefaultAction);
903 }
904 else
905 {
906 if (defaultAction.IsEmpty())
907 {
908 * pszDefaultAction = NULL;
909 return S_FALSE;
910 }
911 else
912 {
913 wxBasicString basicString(defaultAction);
914 * pszDefaultAction = basicString.Get();
915 return S_OK;
916 }
917 }
918 return E_FAIL;
919 }
920
921 // Retrieves a string that describes the visual appearance of the specified object.
922 // Not all objects have a description.
923
924 STDMETHODIMP wxIAccessible::get_accDescription ( VARIANT varID, BSTR* pszDescription)
925 {
926 wxLogTrace(wxT("access"), wxT("get_accDescription"));
927 wxASSERT (m_pAccessible != NULL);
928 if (!m_pAccessible)
929 return E_FAIL;
930
931 if (varID.vt != VT_I4)
932 {
933 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accDescription"));
934 return E_INVALIDARG;
935 }
936
937 wxString description;
938 wxAccStatus status = m_pAccessible->GetDescription(varID.lVal, & description);
939 if (status == wxACC_FAIL)
940 return E_FAIL;
941
942 if (status == wxACC_NOT_IMPLEMENTED)
943 {
944 // Try to use child object directly.
945 if (varID.lVal > 0)
946 {
947 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
948 if (childAccessible)
949 {
950 varID.lVal = 0;
951 HRESULT hResult = childAccessible->get_accDescription(varID, pszDescription);
952 childAccessible->Release();
953 return hResult;
954 }
955 else if (m_pAccessible->GetIAccessibleStd())
956 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accDescription(varID, pszDescription);
957 }
958 else if (m_pAccessible->GetIAccessibleStd())
959 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accDescription(varID, pszDescription);
960 }
961 else
962 {
963 if (description.empty())
964 {
965 * pszDescription = NULL;
966 return S_FALSE;
967 }
968 else
969 {
970 wxBasicString basicString(description);
971 * pszDescription = basicString.Get();
972 return S_OK;
973 }
974 }
975 return E_NOTIMPL;
976 }
977
978 // Retrieves an object's Help property string.
979 // Not all objects support this property.
980
981 STDMETHODIMP wxIAccessible::get_accHelp ( VARIANT varID, BSTR* pszHelp)
982 {
983 wxLogTrace(wxT("access"), wxT("get_accHelp"));
984 wxASSERT (m_pAccessible != NULL);
985 if (!m_pAccessible)
986 return E_FAIL;
987
988 if (varID.vt != VT_I4)
989 {
990 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelp"));
991 return E_INVALIDARG;
992 }
993
994 wxString helpString;
995 wxAccStatus status = m_pAccessible->GetHelpText(varID.lVal, & helpString);
996 if (status == wxACC_FAIL)
997 return E_FAIL;
998
999 if (status == wxACC_NOT_IMPLEMENTED)
1000 {
1001 // Try to use child object directly.
1002 if (varID.lVal > 0)
1003 {
1004 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
1005 if (childAccessible)
1006 {
1007 varID.lVal = 0;
1008 HRESULT hResult = childAccessible->get_accHelp(varID, pszHelp);
1009 childAccessible->Release();
1010 return hResult;
1011 }
1012 else if (m_pAccessible->GetIAccessibleStd())
1013 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accHelp(varID, pszHelp);
1014 }
1015 else if (m_pAccessible->GetIAccessibleStd())
1016 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accHelp (varID, pszHelp);
1017 }
1018 else
1019 {
1020 if (helpString.empty())
1021 {
1022 * pszHelp = NULL;
1023 return S_FALSE;
1024 }
1025 else
1026 {
1027 wxBasicString basicString(helpString);
1028 * pszHelp = basicString.Get();
1029 return S_OK;
1030 }
1031 }
1032 return E_NOTIMPL;
1033 }
1034
1035 // Retrieves the full path of the WinHelp file associated with the specified
1036 // object and the identifier of the appropriate topic within that file.
1037 // Not all objects support this property.
1038 // NOTE: not supported by wxWidgets at this time. Use
1039 // GetHelpText instead.
1040
1041 STDMETHODIMP wxIAccessible::get_accHelpTopic ( BSTR* pszHelpFile, VARIANT varChild, long* pidTopic)
1042 {
1043 wxLogTrace(wxT("access"), wxT("get_accHelpTopic"));
1044 wxASSERT (m_pAccessible != NULL);
1045 if (!m_pAccessible)
1046 return E_FAIL;
1047
1048 if (varChild.vt != VT_I4)
1049 {
1050 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accHelpTopic"));
1051 return E_INVALIDARG;
1052 }
1053
1054 wxAccStatus status = wxACC_NOT_IMPLEMENTED;
1055 if (status == wxACC_FAIL)
1056 return E_FAIL;
1057
1058 if (status == wxACC_NOT_IMPLEMENTED)
1059 {
1060 // Try to use child object directly.
1061 if (varChild.lVal > 0)
1062 {
1063 IAccessible* childAccessible = GetChildAccessible(varChild.lVal);
1064 if (childAccessible)
1065 {
1066 varChild.lVal = 0;
1067 HRESULT hResult = childAccessible->get_accHelpTopic(pszHelpFile, varChild, pidTopic);
1068 childAccessible->Release();
1069 return hResult;
1070 }
1071 else if (m_pAccessible->GetIAccessibleStd())
1072 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accHelpTopic(pszHelpFile, varChild, pidTopic);
1073 }
1074 else if (m_pAccessible->GetIAccessibleStd())
1075 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accHelpTopic (pszHelpFile, varChild, pidTopic);
1076 }
1077 return E_NOTIMPL;
1078 }
1079
1080 // Retrieves the specified object's shortcut key or access key, also known as
1081 // the mnemonic. All objects that have a shortcut key or access key support
1082 // this property.
1083
1084 STDMETHODIMP wxIAccessible::get_accKeyboardShortcut ( VARIANT varID, BSTR* pszKeyboardShortcut)
1085 {
1086 wxLogTrace(wxT("access"), wxT("get_accKeyboardShortcut"));
1087 *pszKeyboardShortcut = NULL;
1088
1089 wxASSERT (m_pAccessible != NULL);
1090 if (!m_pAccessible)
1091 return E_FAIL;
1092
1093 if (varID.vt != VT_I4)
1094 {
1095 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accKeyboardShortcut"));
1096 return E_INVALIDARG;
1097 }
1098
1099 wxString keyboardShortcut;
1100 wxAccStatus status = m_pAccessible->GetKeyboardShortcut(varID.lVal, & keyboardShortcut);
1101 if (status == wxACC_FAIL)
1102 return E_FAIL;
1103
1104 if (status == wxACC_NOT_IMPLEMENTED)
1105 {
1106 // Try to use child object directly.
1107 if (varID.lVal > 0)
1108 {
1109 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
1110 if (childAccessible)
1111 {
1112 varID.lVal = 0;
1113 HRESULT hResult = childAccessible->get_accKeyboardShortcut(varID, pszKeyboardShortcut);
1114 childAccessible->Release();
1115 return hResult;
1116 }
1117 else if (m_pAccessible->GetIAccessibleStd())
1118 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accKeyboardShortcut(varID, pszKeyboardShortcut);
1119 }
1120 else if (m_pAccessible->GetIAccessibleStd())
1121 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accKeyboardShortcut (varID, pszKeyboardShortcut);
1122 }
1123 else
1124 {
1125 if (keyboardShortcut.empty())
1126 {
1127 * pszKeyboardShortcut = NULL;
1128 return S_FALSE;
1129 }
1130 else
1131 {
1132 wxBasicString basicString(keyboardShortcut);
1133 * pszKeyboardShortcut = basicString.Get();
1134 return S_OK;
1135 }
1136 }
1137 return E_NOTIMPL;
1138 }
1139
1140 // Retrieves the name of the specified object.
1141 // All objects support this property.
1142
1143 STDMETHODIMP wxIAccessible::get_accName ( VARIANT varID, BSTR* pszName)
1144 {
1145 wxLogTrace(wxT("access"), wxT("get_accName"));
1146 *pszName = NULL;
1147
1148 wxASSERT (m_pAccessible != NULL);
1149 if (!m_pAccessible)
1150 return E_FAIL;
1151
1152 if (varID.vt != VT_I4)
1153 {
1154 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accName"));
1155 return E_INVALIDARG;
1156 }
1157
1158 wxString name;
1159
1160 wxAccStatus status = m_pAccessible->GetName(varID.lVal, & name);
1161
1162 if (status == wxACC_FAIL)
1163 return E_FAIL;
1164
1165 if (status == wxACC_NOT_IMPLEMENTED)
1166 {
1167 // Try to use child object directly.
1168 if (varID.lVal > 0)
1169 {
1170 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
1171 if (childAccessible)
1172 {
1173 varID.lVal = 0;
1174 HRESULT hResult = childAccessible->get_accName(varID, pszName);
1175 childAccessible->Release();
1176 return hResult;
1177 }
1178 else if (m_pAccessible->GetIAccessibleStd())
1179 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accName(varID, pszName);
1180 }
1181 else if (m_pAccessible->GetIAccessibleStd())
1182 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accName (varID, pszName);
1183 }
1184 else
1185 {
1186 wxBasicString basicString(name);
1187 *pszName = basicString.Get();
1188 return S_OK;
1189 }
1190 return E_NOTIMPL;
1191 }
1192
1193 // Retrieves information that describes the role of the specified object.
1194 // All objects support this property.
1195
1196 STDMETHODIMP wxIAccessible::get_accRole ( VARIANT varID, VARIANT* pVarRole)
1197 {
1198 wxLogTrace(wxT("access"), wxT("get_accRole"));
1199 wxASSERT (m_pAccessible != NULL);
1200 if (!m_pAccessible)
1201 return E_FAIL;
1202
1203 if (varID.vt != VT_I4)
1204 {
1205 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accRole"));
1206 return E_INVALIDARG;
1207 }
1208
1209 VariantInit(pVarRole);
1210
1211 wxAccRole role = wxROLE_NONE;
1212
1213 wxAccStatus status = m_pAccessible->GetRole(varID.lVal, & role);
1214
1215 if (status == wxACC_FAIL)
1216 return E_FAIL;
1217
1218 if (status == wxACC_NOT_IMPLEMENTED)
1219 {
1220 // Try to use child object directly.
1221 if (varID.lVal > 0)
1222 {
1223 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
1224 if (childAccessible)
1225 {
1226 varID.lVal = 0;
1227 HRESULT hResult = childAccessible->get_accRole(varID, pVarRole);
1228 childAccessible->Release();
1229 return hResult;
1230 }
1231 else if (m_pAccessible->GetIAccessibleStd())
1232 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accRole(varID, pVarRole);
1233 }
1234 else if (m_pAccessible->GetIAccessibleStd())
1235 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accRole (varID, pVarRole);
1236 }
1237 else
1238 {
1239 if (role == wxROLE_NONE)
1240 {
1241 pVarRole->vt = VT_EMPTY;
1242 return S_OK;
1243 }
1244
1245 pVarRole->lVal = wxConvertToWindowsRole(role);
1246 pVarRole->vt = VT_I4;
1247
1248 return S_OK;
1249 }
1250 return E_NOTIMPL;
1251 }
1252
1253 // Retrieves the current state of the specified object.
1254 // All objects support this property.
1255
1256 STDMETHODIMP wxIAccessible::get_accState ( VARIANT varID, VARIANT* pVarState)
1257 {
1258 wxLogTrace(wxT("access"), wxT("get_accState"));
1259 wxASSERT (m_pAccessible != NULL);
1260 if (!m_pAccessible)
1261 return E_FAIL;
1262
1263 if (varID.vt != VT_I4 && varID.vt != VT_EMPTY)
1264 {
1265 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accState"));
1266 return E_INVALIDARG;
1267 }
1268
1269 long wxstate = 0;
1270
1271 wxAccStatus status = m_pAccessible->GetState(varID.lVal, & wxstate);
1272 if (status == wxACC_FAIL)
1273 return E_FAIL;
1274
1275 if (status == wxACC_NOT_IMPLEMENTED)
1276 {
1277 // Try to use child object directly.
1278 if (varID.lVal > 0)
1279 {
1280 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
1281 if (childAccessible)
1282 {
1283 varID.lVal = 0;
1284 HRESULT hResult = childAccessible->get_accState(varID, pVarState);
1285 childAccessible->Release();
1286 return hResult;
1287 }
1288 else if (m_pAccessible->GetIAccessibleStd())
1289 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accState(varID, pVarState);
1290 }
1291 else if (m_pAccessible->GetIAccessibleStd())
1292 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accState (varID, pVarState);
1293 }
1294 else
1295 {
1296 long state = wxConvertToWindowsState(wxstate);
1297 pVarState->lVal = state;
1298 pVarState->vt = VT_I4;
1299 return S_OK;
1300 }
1301 return E_NOTIMPL;
1302 }
1303
1304 // Retrieves the value of the specified object.
1305 // Not all objects have a value.
1306
1307 STDMETHODIMP wxIAccessible::get_accValue ( VARIANT varID, BSTR* pszValue)
1308 {
1309 wxLogTrace(wxT("access"), wxT("get_accValue"));
1310 wxASSERT (m_pAccessible != NULL);
1311 if (!m_pAccessible)
1312 return E_FAIL;
1313
1314 if (varID.vt != VT_I4)
1315 {
1316 wxLogTrace(wxT("access"), wxT("Invalid arg for get_accValue"));
1317 return E_INVALIDARG;
1318 }
1319
1320 wxString strValue;
1321
1322 wxAccStatus status = m_pAccessible->GetValue(varID.lVal, & strValue);
1323
1324 if (status == wxACC_FAIL)
1325 return E_FAIL;
1326
1327 if (status == wxACC_NOT_IMPLEMENTED)
1328 {
1329 // Try to use child object directly.
1330 if (varID.lVal > 0)
1331 {
1332 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
1333 if (childAccessible)
1334 {
1335 varID.lVal = 0;
1336 HRESULT hResult = childAccessible->get_accValue(varID, pszValue);
1337 childAccessible->Release();
1338 return hResult;
1339 }
1340 else if (m_pAccessible->GetIAccessibleStd())
1341 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accValue(varID, pszValue);
1342 }
1343 else if (m_pAccessible->GetIAccessibleStd())
1344 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->get_accValue (varID, pszValue);
1345 }
1346 else
1347 {
1348 wxBasicString basicString(strValue);
1349 * pszValue = basicString.Get();
1350 return S_OK;
1351 }
1352 return E_NOTIMPL;
1353 }
1354
1355 // Modifies the selection or moves the keyboard focus of the
1356 // specified object. All objects that select or receive the
1357 // keyboard focus must support this method.
1358
1359 STDMETHODIMP wxIAccessible::accSelect ( long flagsSelect, VARIANT varID )
1360 {
1361 wxLogTrace(wxT("access"), wxT("get_accSelect"));
1362 wxASSERT (m_pAccessible != NULL);
1363 if (!m_pAccessible)
1364 return E_FAIL;
1365
1366 if (varID.vt != VT_I4 && varID.vt != VT_EMPTY)
1367 {
1368 wxLogTrace(wxT("access"), wxT("Invalid arg for accSelect"));
1369 return E_INVALIDARG;
1370 }
1371
1372 wxAccSelectionFlags wxsel = wxConvertFromWindowsSelFlag(flagsSelect);
1373
1374 wxAccStatus status = m_pAccessible->Select(varID.lVal, wxsel);
1375 if (status == wxACC_FAIL)
1376 return E_FAIL;
1377
1378 if (status == wxACC_NOT_IMPLEMENTED)
1379 {
1380 // Try to use child object directly.
1381 if (varID.lVal > 0 && varID.lVal > 0)
1382 {
1383 IAccessible* childAccessible = GetChildAccessible(varID.lVal);
1384 if (childAccessible)
1385 {
1386 varID.lVal = 0;
1387 HRESULT hResult = childAccessible->accSelect(flagsSelect, varID);
1388 childAccessible->Release();
1389 return hResult;
1390 }
1391 else if (m_pAccessible->GetIAccessibleStd())
1392 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->accSelect(flagsSelect, varID);
1393 }
1394 else if (m_pAccessible->GetIAccessibleStd())
1395 return ((IAccessible*) m_pAccessible->GetIAccessibleStd())->accSelect(flagsSelect, varID);
1396 }
1397 else
1398 return S_OK;
1399
1400 return E_NOTIMPL;
1401 }
1402
1403 // Retrieves the object that has the keyboard focus. All objects
1404 // that receive the keyboard focus must support this property.
1405
1406 STDMETHODIMP wxIAccessible::get_accFocus ( VARIANT* pVarID)
1407 {
1408 wxLogTrace(wxT("access"), wxT("get_accFocus"));
1409 wxASSERT (m_pAccessible != NULL);
1410 if (!m_pAccessible)
1411 return E_FAIL;
1412
1413 wxAccessible* childObject = NULL;
1414 int childId = 0;
1415 VariantInit(pVarID);
1416
1417 wxAccStatus status = m_pAccessible->GetFocus(& childId, & childObject);
1418 if (status == wxACC_FAIL)
1419 return E_FAIL;
1420
1421 if (status == wxACC_NOT_IMPLEMENTED)
1422 {
1423 // Use standard interface instead.
1424 IAccessible* stdInterface = (IAccessible*)m_pAccessible->GetIAccessibleStd();
1425 if (!stdInterface)
1426 return E_NOTIMPL;
1427 else
1428 return stdInterface->get_accFocus (pVarID);
1429 }
1430 if (childObject)
1431 {
1432 if (childObject == m_pAccessible)
1433 {
1434 pVarID->vt = VT_I4;
1435 pVarID->lVal = CHILDID_SELF;
1436 return S_OK; }
1437 else
1438 {
1439 wxIAccessible* childIA = childObject->GetIAccessible();
1440 if (!childIA)
1441 return E_NOTIMPL;
1442
1443 if (childIA->QueryInterface(IID_IDispatch, (LPVOID*) & pVarID->pdispVal) != S_OK)
1444 return E_FAIL;
1445
1446 pVarID->vt = VT_DISPATCH;
1447 return S_OK;
1448 }
1449 }
1450 else if (childId > 0)
1451 {
1452 pVarID->vt = VT_I4;
1453 pVarID->lVal = childId;
1454 return S_OK;
1455 }
1456 else
1457 {
1458 pVarID->vt = VT_EMPTY;
1459 return S_FALSE;
1460 }
1461
1462 #if 0
1463 // all cases above already cause some return action so below line
1464 // is unreachable and cause unnecessary warning
1465 return E_NOTIMPL;
1466 #endif
1467 }
1468
1469 // Retrieves the selected children of this object. All objects
1470 // selected must support this property.
1471
1472 STDMETHODIMP wxIAccessible::get_accSelection ( VARIANT * pVarChildren)
1473 {
1474 wxLogTrace(wxT("access"), wxT("get_accSelection"));
1475 wxASSERT (m_pAccessible != NULL);
1476 if (!m_pAccessible)
1477 return E_FAIL;
1478
1479 VariantInit(pVarChildren);
1480
1481 wxVariant selections;
1482 wxAccStatus status = m_pAccessible->GetSelections(& selections);
1483 if (status == wxACC_FAIL)
1484 return E_FAIL;
1485
1486 if (status == wxACC_NOT_IMPLEMENTED)
1487 {
1488 // Use standard interface instead.
1489 IAccessible* stdInterface = (IAccessible*)m_pAccessible->GetIAccessibleStd();
1490 if (!stdInterface)
1491 return E_NOTIMPL;
1492 else
1493 return stdInterface->get_accSelection (pVarChildren);
1494 }
1495 else
1496 {
1497 if (selections.GetType() == wxT("long"))
1498 {
1499 pVarChildren->vt = VT_I4;
1500 pVarChildren->lVal = selections.GetLong();
1501
1502 return S_OK;
1503 }
1504 else if (selections.GetType() == wxT("void*"))
1505 {
1506 wxAccessible* childObject = (wxAccessible*) selections.GetVoidPtr();
1507 wxIAccessible* childIA = childObject->GetIAccessible();
1508 if (!childIA)
1509 return E_NOTIMPL;
1510
1511 if (childIA->QueryInterface(IID_IDispatch, (LPVOID*) & pVarChildren->pdispVal) != S_OK)
1512 return E_FAIL;
1513
1514 pVarChildren->vt = VT_DISPATCH;
1515
1516 return S_OK;
1517 }
1518 else if (selections.GetType() == wxT("list"))
1519 {
1520 // TODO: should we AddRef for every "void*" member??
1521
1522 wxIEnumVARIANT* enumVariant = new wxIEnumVARIANT(selections);
1523 enumVariant->AddRef();
1524
1525 pVarChildren->vt = VT_UNKNOWN;
1526 pVarChildren->punkVal = enumVariant;
1527
1528 return S_OK;
1529 }
1530 }
1531
1532 return E_NOTIMPL;
1533 }
1534
1535 // Get type info
1536
1537 STDMETHODIMP wxIAccessible::GetTypeInfo(unsigned int WXUNUSED(typeInfo), LCID WXUNUSED(lcid), ITypeInfo** ppTypeInfo)
1538 {
1539 *ppTypeInfo = NULL;
1540 return E_NOTIMPL;
1541 }
1542
1543 // Get type info count
1544
1545 STDMETHODIMP wxIAccessible::GetTypeInfoCount(unsigned int* typeInfoCount)
1546 {
1547 *typeInfoCount = 0;
1548 return E_NOTIMPL;
1549 }
1550
1551 // Get ids of names
1552
1553 STDMETHODIMP wxIAccessible::GetIDsOfNames(REFIID WXUNUSED(riid), OLECHAR** WXUNUSED(names), unsigned int WXUNUSED(cNames),
1554 LCID WXUNUSED(lcid), DISPID* WXUNUSED(dispId))
1555 {
1556 return E_NOTIMPL;
1557 }
1558
1559 // Invoke
1560
1561 STDMETHODIMP wxIAccessible::Invoke(DISPID WXUNUSED(dispIdMember), REFIID WXUNUSED(riid), LCID WXUNUSED(lcid),
1562 WORD WXUNUSED(wFlags), DISPPARAMS *WXUNUSED(pDispParams),
1563 VARIANT *WXUNUSED(pVarResult), EXCEPINFO *WXUNUSED(pExcepInfo),
1564 unsigned int *WXUNUSED(puArgErr) )
1565 {
1566 return E_NOTIMPL;
1567 }
1568
1569 // Gets the standard IAccessible interface for the given child or object.
1570 // Call Release if this is non-NULL.
1571 IAccessible* wxIAccessible::GetChildStdAccessible(int id)
1572 {
1573 if (id == 0)
1574 {
1575 IAccessible* obj = (IAccessible*)m_pAccessible->GetIAccessibleStd();
1576
1577 obj->AddRef();
1578 return obj;
1579 }
1580 else
1581 {
1582 VARIANT var;
1583 VariantInit(& var);
1584 var.vt = VT_I4;
1585 var.lVal = id;
1586 IDispatch* pDispatch = NULL;
1587 if (S_OK == get_accChild ( var, & pDispatch))
1588 {
1589 IAccessible* childAccessible = NULL;
1590 if (pDispatch->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK)
1591 {
1592 pDispatch->Release();
1593 wxIAccessible* c = (wxIAccessible*) childAccessible;
1594 IAccessible* stdChildAccessible = (IAccessible*) c->m_pAccessible->GetIAccessibleStd();
1595 stdChildAccessible->AddRef();
1596 childAccessible->Release();
1597 return stdChildAccessible;
1598 }
1599 else
1600 {
1601 pDispatch->Release();
1602 }
1603 }
1604 }
1605
1606 #if 0
1607 {
1608 // Loop until we find the right id
1609 long nChildren = 0;
1610 this->get_accChildCount(& nChildren);
1611
1612 int i;
1613 for (i = 0; i < nChildren; i++)
1614 {
1615 long obtained = 0;
1616 VARIANT var;
1617 VariantInit(& var);
1618 var.vt = VT_I4;
1619 if (S_OK == AccessibleChildren(this, i, 1, & var, &obtained))
1620 {
1621 if (var.lVal == id)
1622 {
1623 VariantInit(& var);
1624 var.vt = VT_DISPATCH;
1625 if (S_OK == AccessibleChildren(this, i, 1, & var, &obtained))
1626 {
1627 IAccessible* childAccessible = NULL;
1628 if (var.pdispVal->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK)
1629 {
1630 var.pdispVal->Release();
1631 return childAccessible;
1632 }
1633 else
1634 {
1635 var.pdispVal->Release();
1636 }
1637 }
1638 }
1639 break;
1640 }
1641 }
1642 }
1643 #endif
1644 return NULL;
1645 }
1646
1647 // Gets the IAccessible interface for the given child or object.
1648 // Call Release if this is non-NULL.
1649 IAccessible* wxIAccessible::GetChildAccessible(int id)
1650 {
1651 if (id == 0)
1652 {
1653 IAccessible* obj = this;
1654
1655 obj->AddRef();
1656 return obj;
1657 }
1658 else
1659 {
1660 VARIANT var;
1661 VariantInit(& var);
1662 var.vt = VT_I4;
1663 var.lVal = id;
1664 IDispatch* pDispatch = NULL;
1665 if (S_OK == get_accChild ( var, & pDispatch))
1666 {
1667 IAccessible* childAccessible = NULL;
1668 if (pDispatch->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK)
1669 {
1670 pDispatch->Release();
1671 return childAccessible;
1672 }
1673 else
1674 {
1675 pDispatch->Release();
1676 }
1677 }
1678 }
1679 return NULL;
1680 }
1681
1682 // ----------------------------------------------------------------------------
1683 // wxAccessible implementation
1684 // ----------------------------------------------------------------------------
1685
1686 // ctors
1687
1688 // common part of all ctors
1689 void wxAccessible::Init()
1690 {
1691 m_pIAccessibleStd = NULL;
1692 m_pIAccessible = new wxIAccessible(this);
1693 m_pIAccessible->AddRef();
1694 }
1695
1696 wxAccessible::wxAccessible(wxWindow* win)
1697 : wxAccessibleBase(win)
1698 {
1699 Init();
1700 }
1701
1702 wxAccessible::~wxAccessible()
1703 {
1704 m_pIAccessible->Release();
1705 if (m_pIAccessibleStd)
1706 ((IAccessible*)m_pIAccessibleStd)->Release();
1707 }
1708
1709 // Gets or creates a standard interface for this object.
1710 void* wxAccessible::GetIAccessibleStd()
1711 {
1712 if (m_pIAccessibleStd)
1713 return m_pIAccessibleStd;
1714
1715 if (GetWindow())
1716 {
1717 HRESULT retCode = ::CreateStdAccessibleObject((HWND) GetWindow()->GetHWND(),
1718 OBJID_CLIENT, IID_IAccessible, (void**) & m_pIAccessibleStd);
1719 if (retCode == S_OK)
1720 return m_pIAccessibleStd;
1721 else
1722 {
1723 m_pIAccessibleStd = NULL;
1724 return NULL;
1725 }
1726 }
1727 return NULL;
1728 }
1729
1730 // Sends an event when something changes in an accessible object.
1731 void wxAccessible::NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType,
1732 int objectId)
1733 {
1734 ::NotifyWinEvent((DWORD) eventType, (HWND) window->GetHWND(),
1735 (LONG) objectType, (LONG) objectId);
1736 }
1737
1738 // Utilities
1739
1740 // Convert to Windows role
1741 int wxConvertToWindowsRole(wxAccRole wxrole)
1742 {
1743 switch (wxrole)
1744 {
1745 case wxROLE_SYSTEM_ALERT:
1746 return ROLE_SYSTEM_ALERT;
1747 case wxROLE_SYSTEM_ANIMATION:
1748 return ROLE_SYSTEM_ANIMATION;
1749 case wxROLE_SYSTEM_APPLICATION:
1750 return ROLE_SYSTEM_APPLICATION;
1751 case wxROLE_SYSTEM_BORDER:
1752 return ROLE_SYSTEM_BORDER;
1753 case wxROLE_SYSTEM_BUTTONDROPDOWN:
1754 return ROLE_SYSTEM_BUTTONDROPDOWN;
1755 case wxROLE_SYSTEM_BUTTONDROPDOWNGRID:
1756 return ROLE_SYSTEM_BUTTONDROPDOWNGRID;
1757 case wxROLE_SYSTEM_BUTTONMENU:
1758 return ROLE_SYSTEM_BUTTONMENU;
1759 case wxROLE_SYSTEM_CARET:
1760 return ROLE_SYSTEM_CARET;
1761 case wxROLE_SYSTEM_CELL:
1762 return ROLE_SYSTEM_CELL;
1763 case wxROLE_SYSTEM_CHARACTER:
1764 return ROLE_SYSTEM_CHARACTER;
1765 case wxROLE_SYSTEM_CHART:
1766 return ROLE_SYSTEM_CHART;
1767 case wxROLE_SYSTEM_CHECKBUTTON:
1768 return ROLE_SYSTEM_CHECKBUTTON;
1769 case wxROLE_SYSTEM_CLIENT:
1770 return ROLE_SYSTEM_CLIENT;
1771 case wxROLE_SYSTEM_CLOCK:
1772 return ROLE_SYSTEM_CLOCK;
1773 case wxROLE_SYSTEM_COLUMN:
1774 return ROLE_SYSTEM_COLUMN;
1775 case wxROLE_SYSTEM_COLUMNHEADER:
1776 return ROLE_SYSTEM_COLUMNHEADER;
1777 case wxROLE_SYSTEM_COMBOBOX:
1778 return ROLE_SYSTEM_COMBOBOX;
1779 case wxROLE_SYSTEM_CURSOR:
1780 return ROLE_SYSTEM_CURSOR;
1781 case wxROLE_SYSTEM_DIAGRAM:
1782 return ROLE_SYSTEM_DIAGRAM;
1783 case wxROLE_SYSTEM_DIAL:
1784 return ROLE_SYSTEM_DIAL;
1785 case wxROLE_SYSTEM_DIALOG:
1786 return ROLE_SYSTEM_DIALOG;
1787 case wxROLE_SYSTEM_DOCUMENT:
1788 return ROLE_SYSTEM_DOCUMENT;
1789 case wxROLE_SYSTEM_DROPLIST:
1790 return ROLE_SYSTEM_DROPLIST;
1791 case wxROLE_SYSTEM_EQUATION:
1792 return ROLE_SYSTEM_EQUATION;
1793 case wxROLE_SYSTEM_GRAPHIC:
1794 return ROLE_SYSTEM_GRAPHIC;
1795 case wxROLE_SYSTEM_GRIP:
1796 return ROLE_SYSTEM_GRIP;
1797 case wxROLE_SYSTEM_GROUPING:
1798 return ROLE_SYSTEM_GROUPING;
1799 case wxROLE_SYSTEM_HELPBALLOON:
1800 return ROLE_SYSTEM_HELPBALLOON;
1801 case wxROLE_SYSTEM_HOTKEYFIELD:
1802 return ROLE_SYSTEM_HOTKEYFIELD;
1803 case wxROLE_SYSTEM_INDICATOR:
1804 return ROLE_SYSTEM_INDICATOR;
1805 case wxROLE_SYSTEM_LINK:
1806 return ROLE_SYSTEM_LINK;
1807 case wxROLE_SYSTEM_LIST:
1808 return ROLE_SYSTEM_LIST;
1809 case wxROLE_SYSTEM_LISTITEM:
1810 return ROLE_SYSTEM_LISTITEM;
1811 case wxROLE_SYSTEM_MENUBAR:
1812 return ROLE_SYSTEM_MENUBAR;
1813 case wxROLE_SYSTEM_MENUITEM:
1814 return ROLE_SYSTEM_MENUITEM;
1815 case wxROLE_SYSTEM_MENUPOPUP:
1816 return ROLE_SYSTEM_MENUPOPUP;
1817 case wxROLE_SYSTEM_OUTLINE:
1818 return ROLE_SYSTEM_OUTLINE;
1819 case wxROLE_SYSTEM_OUTLINEITEM:
1820 return ROLE_SYSTEM_OUTLINEITEM;
1821 case wxROLE_SYSTEM_PAGETAB:
1822 return ROLE_SYSTEM_PAGETAB;
1823 case wxROLE_SYSTEM_PAGETABLIST:
1824 return ROLE_SYSTEM_PAGETABLIST;
1825 case wxROLE_SYSTEM_PANE:
1826 return ROLE_SYSTEM_PANE;
1827 case wxROLE_SYSTEM_PROGRESSBAR:
1828 return ROLE_SYSTEM_PROGRESSBAR;
1829 case wxROLE_SYSTEM_PROPERTYPAGE:
1830 return ROLE_SYSTEM_PROPERTYPAGE;
1831 case wxROLE_SYSTEM_PUSHBUTTON:
1832 return ROLE_SYSTEM_PUSHBUTTON;
1833 case wxROLE_SYSTEM_RADIOBUTTON:
1834 return ROLE_SYSTEM_RADIOBUTTON;
1835 case wxROLE_SYSTEM_ROW:
1836 return ROLE_SYSTEM_ROW;
1837 case wxROLE_SYSTEM_ROWHEADER:
1838 return ROLE_SYSTEM_ROWHEADER;
1839 case wxROLE_SYSTEM_SCROLLBAR:
1840 return ROLE_SYSTEM_SCROLLBAR;
1841 case wxROLE_SYSTEM_SEPARATOR:
1842 return ROLE_SYSTEM_SEPARATOR;
1843 case wxROLE_SYSTEM_SLIDER:
1844 return ROLE_SYSTEM_SLIDER;
1845 case wxROLE_SYSTEM_SOUND:
1846 return ROLE_SYSTEM_SOUND;
1847 case wxROLE_SYSTEM_SPINBUTTON:
1848 return ROLE_SYSTEM_SPINBUTTON;
1849 case wxROLE_SYSTEM_STATICTEXT:
1850 return ROLE_SYSTEM_STATICTEXT;
1851 case wxROLE_SYSTEM_STATUSBAR:
1852 return ROLE_SYSTEM_STATUSBAR;
1853 case wxROLE_SYSTEM_TABLE:
1854 return ROLE_SYSTEM_TABLE;
1855 case wxROLE_SYSTEM_TEXT:
1856 return ROLE_SYSTEM_TEXT;
1857 case wxROLE_SYSTEM_TITLEBAR:
1858 return ROLE_SYSTEM_TITLEBAR;
1859 case wxROLE_SYSTEM_TOOLBAR:
1860 return ROLE_SYSTEM_TOOLBAR;
1861 case wxROLE_SYSTEM_TOOLTIP:
1862 return ROLE_SYSTEM_TOOLTIP;
1863 case wxROLE_SYSTEM_WHITESPACE:
1864 return ROLE_SYSTEM_WHITESPACE;
1865 case wxROLE_SYSTEM_WINDOW:
1866 return ROLE_SYSTEM_WINDOW;
1867 }
1868 return 0;
1869 }
1870
1871 // Convert to Windows state
1872 long wxConvertToWindowsState(long wxstate)
1873 {
1874 long state = 0;
1875 if (wxstate & wxACC_STATE_SYSTEM_ALERT_HIGH)
1876 state |= STATE_SYSTEM_ALERT_HIGH;
1877
1878 if (wxstate & wxACC_STATE_SYSTEM_ALERT_MEDIUM)
1879 state |= STATE_SYSTEM_ALERT_MEDIUM;
1880
1881 if (wxstate & wxACC_STATE_SYSTEM_ALERT_LOW)
1882 state |= STATE_SYSTEM_ALERT_LOW;
1883
1884 if (wxstate & wxACC_STATE_SYSTEM_ANIMATED)
1885 state |= STATE_SYSTEM_ANIMATED;
1886
1887 if (wxstate & wxACC_STATE_SYSTEM_BUSY)
1888 state |= STATE_SYSTEM_BUSY;
1889
1890 if (wxstate & wxACC_STATE_SYSTEM_CHECKED)
1891 state |= STATE_SYSTEM_CHECKED;
1892
1893 if (wxstate & wxACC_STATE_SYSTEM_COLLAPSED)
1894 state |= STATE_SYSTEM_COLLAPSED;
1895
1896 if (wxstate & wxACC_STATE_SYSTEM_DEFAULT)
1897 state |= STATE_SYSTEM_DEFAULT;
1898
1899 if (wxstate & wxACC_STATE_SYSTEM_EXPANDED)
1900 state |= STATE_SYSTEM_EXPANDED;
1901
1902 if (wxstate & wxACC_STATE_SYSTEM_EXTSELECTABLE)
1903 state |= STATE_SYSTEM_EXTSELECTABLE;
1904
1905 if (wxstate & wxACC_STATE_SYSTEM_FLOATING)
1906 state |= STATE_SYSTEM_FLOATING;
1907
1908 if (wxstate & wxACC_STATE_SYSTEM_FOCUSABLE)
1909 state |= STATE_SYSTEM_FOCUSABLE;
1910
1911 if (wxstate & wxACC_STATE_SYSTEM_FOCUSED)
1912 state |= STATE_SYSTEM_FOCUSED;
1913
1914 if (wxstate & wxACC_STATE_SYSTEM_HOTTRACKED)
1915 state |= STATE_SYSTEM_HOTTRACKED;
1916
1917 if (wxstate & wxACC_STATE_SYSTEM_INVISIBLE)
1918 state |= STATE_SYSTEM_INVISIBLE;
1919
1920 if (wxstate & wxACC_STATE_SYSTEM_INVISIBLE)
1921 state |= STATE_SYSTEM_INVISIBLE;
1922
1923 if (wxstate & wxACC_STATE_SYSTEM_MIXED)
1924 state |= STATE_SYSTEM_MIXED;
1925
1926 if (wxstate & wxACC_STATE_SYSTEM_MULTISELECTABLE)
1927 state |= STATE_SYSTEM_MULTISELECTABLE;
1928
1929 if (wxstate & wxACC_STATE_SYSTEM_OFFSCREEN)
1930 state |= STATE_SYSTEM_OFFSCREEN;
1931
1932 if (wxstate & wxACC_STATE_SYSTEM_PRESSED)
1933 state |= STATE_SYSTEM_PRESSED;
1934
1935 // if (wxstate & wxACC_STATE_SYSTEM_PROTECTED)
1936 // state |= STATE_SYSTEM_PROTECTED;
1937
1938 if (wxstate & wxACC_STATE_SYSTEM_READONLY)
1939 state |= STATE_SYSTEM_READONLY;
1940
1941 if (wxstate & wxACC_STATE_SYSTEM_SELECTABLE)
1942 state |= STATE_SYSTEM_SELECTABLE;
1943
1944 if (wxstate & wxACC_STATE_SYSTEM_SELECTED)
1945 state |= STATE_SYSTEM_SELECTED;
1946
1947 if (wxstate & wxACC_STATE_SYSTEM_SELFVOICING)
1948 state |= STATE_SYSTEM_SELFVOICING;
1949
1950 if (wxstate & wxACC_STATE_SYSTEM_UNAVAILABLE)
1951 state |= STATE_SYSTEM_UNAVAILABLE;
1952
1953 return state;
1954 }
1955
1956 // Convert to Windows selection flag
1957 int wxConvertToWindowsSelFlag(wxAccSelectionFlags wxsel)
1958 {
1959 int sel = 0;
1960
1961 if (wxsel & wxACC_SEL_TAKEFOCUS)
1962 sel |= SELFLAG_TAKEFOCUS;
1963 if (wxsel & wxACC_SEL_TAKESELECTION)
1964 sel |= SELFLAG_TAKESELECTION;
1965 if (wxsel & wxACC_SEL_EXTENDSELECTION)
1966 sel |= SELFLAG_EXTENDSELECTION;
1967 if (wxsel & wxACC_SEL_ADDSELECTION)
1968 sel |= SELFLAG_ADDSELECTION;
1969 if (wxsel & wxACC_SEL_REMOVESELECTION)
1970 sel |= SELFLAG_REMOVESELECTION;
1971 return sel;
1972 }
1973
1974 // Convert from Windows selection flag
1975 wxAccSelectionFlags wxConvertFromWindowsSelFlag(int sel)
1976 {
1977 int wxsel = 0;
1978
1979 if (sel & SELFLAG_TAKEFOCUS)
1980 wxsel |= wxACC_SEL_TAKEFOCUS;
1981 if (sel & SELFLAG_TAKESELECTION)
1982 wxsel |= wxACC_SEL_TAKESELECTION;
1983 if (sel & SELFLAG_EXTENDSELECTION)
1984 wxsel |= wxACC_SEL_EXTENDSELECTION;
1985 if (sel & SELFLAG_ADDSELECTION)
1986 wxsel |= wxACC_SEL_ADDSELECTION;
1987 if (sel & SELFLAG_REMOVESELECTION)
1988 wxsel |= wxACC_SEL_REMOVESELECTION;
1989 return (wxAccSelectionFlags) wxsel;
1990 }
1991
1992
1993 #endif // wxUSE_OLE && wxUSE_ACCESSIBILITY