1 /////////////////////////////////////////////////////////////////////////////
2 // Name: accesstest.cpp
3 // Purpose: wxWidgets accessibility sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx/wx.h".
21 #include "wx/wxprec.h"
27 // for all others, include the necessary headers (this file is usually all you
28 // need because it includes almost all "standard" wxWidgets headers)
33 #if wxUSE_ACCESSIBILITY
34 #include "wx/access.h"
35 #endif // wxUSE_ACCESSIBILITY
37 #include "wx/splitter.h"
38 #include "wx/cshelp.h"
45 #if wxUSE_ACCESSIBILITY
47 #endif // wxUSE_ACCESSIBILITY
49 #include "wx/msw/ole/oleutils.h"
50 #include "wx/msw/winundef.h"
53 #define OBJID_CLIENT 0xFFFFFFFC
57 // ----------------------------------------------------------------------------
59 // ----------------------------------------------------------------------------
61 // the application icon (under Windows and OS/2 it is in resources)
62 #if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
63 #include "mondrian.xpm"
66 // ----------------------------------------------------------------------------
68 // ----------------------------------------------------------------------------
70 // Define a new application type, each program should derive a class from wxApp
71 class MyApp
: public wxApp
74 // override base class virtuals
75 // ----------------------------
77 // this one is called on application startup and is a good place for the app
78 // initialization (doing it here and not in the ctor allows to have an error
79 // return: if OnInit() returns false, the application terminates)
80 virtual bool OnInit();
84 #if wxUSE_ACCESSIBILITY
86 // Define a new frame type: this is going to be our main frame
87 class MyFrame
: public wxFrame
91 MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
,
92 long style
= wxDEFAULT_FRAME_STYLE
);
94 // event handlers (these functions should _not_ be virtual)
95 void OnQuit(wxCommandEvent
& event
);
96 void OnQuery(wxCommandEvent
& event
);
97 void OnAbout(wxCommandEvent
& event
);
99 // Log messages to the text control
100 void Log(const wxString
& text
);
102 // Recursively give information about an object
103 void LogObject(int indent
, IAccessible
* obj
);
105 // Get info for a child (id > 0) or object (id == 0)
106 void GetInfo(IAccessible
* accessible
, int id
, wxString
& name
, wxString
& role
);
108 wxTextCtrl
* m_textCtrl
;
110 // any class wishing to process wxWidgets events must use this macro
111 DECLARE_EVENT_TABLE()
114 // ----------------------------------------------------------------------------
116 // ----------------------------------------------------------------------------
118 // IDs for the controls and the menu commands
124 // query the hierarchy
127 // it is important for the id corresponding to the "About" command to have
128 // this standard value as otherwise it won't be handled properly under Mac
129 // (where it is special and put into the "Apple" menu)
130 AccessTest_About
= wxID_ABOUT
133 // ----------------------------------------------------------------------------
134 // event tables and other macros for wxWidgets
135 // ----------------------------------------------------------------------------
137 // the event tables connect the wxWidgets events with the functions (event
138 // handlers) which process them. It can be also done at run-time, but for the
139 // simple menu events like this the static method is much simpler.
140 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
141 EVT_MENU(AccessTest_Quit
, MyFrame::OnQuit
)
142 EVT_MENU(AccessTest_Query
, MyFrame::OnQuery
)
143 EVT_MENU(AccessTest_About
, MyFrame::OnAbout
)
146 #endif // wxUSE_ACCESSIBILITY
148 // Create a new application object: this macro will allow wxWidgets to create
149 // the application object during program execution (it's better than using a
150 // static object for many reasons) and also declares the accessor function
151 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
155 // ============================================================================
157 // ============================================================================
159 // ----------------------------------------------------------------------------
160 // the application class
161 // ----------------------------------------------------------------------------
163 // 'Main program' equivalent: the program execution "starts" here
166 #if wxUSE_ACCESSIBILITY
167 // Note: JAWS for Windows will only speak the context-sensitive
168 // help if you use this help provider:
169 // wxHelpProvider::Set(new wxHelpControllerHelpProvider(m_helpController)).
170 // JAWS does not seem to be getting the help text from
171 // the wxAccessible object.
172 wxHelpProvider::Set(new wxSimpleHelpProvider());
174 // create the main application window
175 MyFrame
*frame
= new MyFrame(_T("AccessTest wxWidgets App"),
176 wxPoint(50, 50), wxSize(450, 340));
178 // and show it (the frames, unlike simple controls, are not shown when
179 // created initially)
182 // success: wxApp::OnRun() will be called which will enter the main message
183 // loop and the application will run. If we returned false here, the
184 // application would exit immediately.
187 wxMessageBox( _T("This sample has to be compiled with wxUSE_ACCESSIBILITY"), _T("Building error"), wxOK
);
189 #endif // wxUSE_ACCESSIBILITY
192 #if wxUSE_ACCESSIBILITY
194 class FrameAccessible
: public wxWindowAccessible
197 FrameAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
199 // Gets the name of the specified object.
200 virtual wxAccStatus
GetName(int childId
, wxString
* name
)
202 if (childId
== wxACC_SELF
)
204 * name
= wxT("Julian's Frame");
208 return wxACC_NOT_IMPLEMENTED
;
212 class ScrolledWindowAccessible
: public wxWindowAccessible
215 ScrolledWindowAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
217 // Gets the name of the specified object.
218 virtual wxAccStatus
GetName(int childId
, wxString
* name
)
220 if (childId
== wxACC_SELF
)
222 * name
= wxT("My scrolled window");
226 return wxACC_NOT_IMPLEMENTED
;
230 class SplitterWindowAccessible
: public wxWindowAccessible
233 SplitterWindowAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
235 // Gets the name of the specified object.
236 virtual wxAccStatus
GetName(int childId
, wxString
* name
);
238 // Can return either a child object, or an integer
239 // representing the child element, starting from 1.
240 virtual wxAccStatus
HitTest(const wxPoint
& pt
, int* childId
, wxAccessible
** childObject
);
242 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
243 virtual wxAccStatus
GetLocation(wxRect
& rect
, int elementId
);
245 // Navigates from fromId to toId/toObject.
246 virtual wxAccStatus
Navigate(wxNavDir navDir
, int fromId
,
247 int* toId
, wxAccessible
** toObject
);
249 // Gets the number of children.
250 virtual wxAccStatus
GetChildCount(int* childCount
);
252 // Gets the specified child (starting from 1).
253 // If *child is NULL and return value is wxACC_OK,
254 // this means that the child is a simple element and
255 // not an accessible object.
256 virtual wxAccStatus
GetChild(int childId
, wxAccessible
** child
);
258 // Gets the parent, or NULL.
259 virtual wxAccStatus
GetParent(wxAccessible
** parent
);
261 // Performs the default action. childId is 0 (the action for this object)
262 // or > 0 (the action for a child).
263 // Return wxACC_NOT_SUPPORTED if there is no default action for this
264 // window (e.g. an edit control).
265 virtual wxAccStatus
DoDefaultAction(int childId
);
267 // Gets the default action for this object (0) or > 0 (the action for a child).
268 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
269 // string if there is no action.
270 // The retrieved string describes the action that is performed on an object,
271 // not what the object does as a result. For example, a toolbar button that prints
272 // a document has a default action of "Press" rather than "Prints the current document."
273 virtual wxAccStatus
GetDefaultAction(int childId
, wxString
* actionName
);
275 // Returns the description for this object or a child.
276 virtual wxAccStatus
GetDescription(int childId
, wxString
* description
);
278 // Returns help text for this object or a child, similar to tooltip text.
279 virtual wxAccStatus
GetHelpText(int childId
, wxString
* helpText
);
281 // Returns the keyboard shortcut for this object or child.
283 virtual wxAccStatus
GetKeyboardShortcut(int childId
, wxString
* shortcut
);
285 // Returns a role constant.
286 virtual wxAccStatus
GetRole(int childId
, wxAccRole
* role
);
288 // Returns a state constant.
289 virtual wxAccStatus
GetState(int childId
, long* state
);
291 // Returns a localized string representing the value for the object
293 virtual wxAccStatus
GetValue(int childId
, wxString
* strValue
);
295 // Selects the object or child.
296 virtual wxAccStatus
Select(int childId
, wxAccSelectionFlags selectFlags
);
298 // Gets the window with the keyboard focus.
299 // If childId is 0 and child is NULL, no object in
300 // this subhierarchy has the focus.
301 // If this object has the focus, child should be 'this'.
302 virtual wxAccStatus
GetFocus(int* childId
, wxAccessible
** child
);
304 // Gets a variant representing the selected children
306 // Acceptable values:
307 // - a null variant (IsNull() returns true)
308 // - a list variant (GetType() == wxT("list"))
309 // - an integer representing the selected child element,
310 // or 0 if this object is selected (GetType() == wxT("long"))
311 // - a "void*" pointer to a wxAccessible child object
312 virtual wxAccStatus
GetSelections(wxVariant
* selections
);
316 // ----------------------------------------------------------------------------
318 // ----------------------------------------------------------------------------
321 MyFrame::MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
)
322 : wxFrame(NULL
, wxID_ANY
, title
, pos
, size
, style
)
326 SetAccessible(new FrameAccessible(this));
328 // set the frame icon
329 SetIcon(wxICON(mondrian
));
333 wxMenu
*menuFile
= new wxMenu
;
335 // the "About" item should be in the help menu
336 wxMenu
*helpMenu
= new wxMenu
;
337 helpMenu
->Append(AccessTest_About
, _T("&About..."), _T("Show about dialog"));
339 menuFile
->Append(AccessTest_Query
, _T("Query"), _T("Query the window hierarchy"));
340 menuFile
->AppendSeparator();
341 menuFile
->Append(AccessTest_Quit
, _T("E&xit\tAlt-X"), _T("Quit this program"));
343 // now append the freshly created menu to the menu bar...
344 wxMenuBar
*menuBar
= new wxMenuBar();
345 menuBar
->Append(menuFile
, _T("&File"));
346 menuBar
->Append(helpMenu
, _T("&Help"));
348 // ... and attach this menu bar to the frame
350 #endif // wxUSE_MENUS
352 #if 0 // wxUSE_STATUSBAR
353 // create a status bar just for fun (by default with 1 pane only)
355 SetStatusText(_T("Welcome to wxWidgets!"));
356 #endif // wxUSE_STATUSBAR
359 wxSplitterWindow
* splitter
= new wxSplitterWindow(this, wxID_ANY
);
360 splitter
->SetAccessible(new SplitterWindowAccessible(splitter
));
362 wxListBox
* listBox
= new wxListBox(splitter
, wxID_ANY
);
363 listBox
->Append(wxT("Cabbages"));
364 listBox
->Append(wxT("Kings"));
365 listBox
->Append(wxT("Sealing wax"));
366 listBox
->Append(wxT("Strings"));
367 listBox
->CreateAccessible();
368 listBox
->SetHelpText(wxT("This is a sample wxWidgets listbox, with a number of items in it."));
370 m_textCtrl
= new wxTextCtrl(splitter
, wxID_ANY
, wxT(""), wxDefaultPosition
,
371 wxDefaultSize
, wxTE_MULTILINE
);
372 m_textCtrl
->CreateAccessible();
373 m_textCtrl
->SetHelpText(wxT("This is a sample wxWidgets multiline text control."));
375 splitter
->SplitHorizontally(listBox
, m_textCtrl
, 150);
378 wxScrolledWindow
* scrolledWindow
= new wxScrolledWindow(this, wxID_ANY
);
379 scrolledWindow
->SetAccessible(new ScrolledWindowAccessible(scrolledWindow
));
386 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
388 // true is to force the frame to close
392 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
395 msg
.Printf( _T("This is the About dialog of the AccessTest sample.\n")
396 _T("Welcome to %s"), wxVERSION_STRING
);
398 wxMessageBox(msg
, _T("About AccessTest"), wxOK
| wxICON_INFORMATION
, this);
401 void MyFrame::OnQuery(wxCommandEvent
& WXUNUSED(event
))
404 IAccessible
* accessibleFrame
= NULL
;
405 if (S_OK
!= AccessibleObjectFromWindow((HWND
) GetHWND(), OBJID_CLIENT
,
406 IID_IAccessible
, (void**) & accessibleFrame
))
408 Log(wxT("Could not get object."));
413 //Log(wxT("Got an IAccessible for the frame."));
414 LogObject(0, accessibleFrame
);
415 Log(wxT("Checking children using AccessibleChildren()..."));
417 // Now check the AccessibleChildren function works OK
419 if (S_OK
!= accessibleFrame
->get_accChildCount(& childCount
))
421 Log(wxT("Could not get number of children."));
422 accessibleFrame
->Release();
425 else if (childCount
== 0)
427 Log(wxT("No children."));
428 accessibleFrame
->Release();
434 VARIANT
*var
= new VARIANT
[childCount
];
436 for (i
= 0; i
< childCount
; i
++)
438 VariantInit(& (var
[i
]));
439 var
[i
].vt
= VT_DISPATCH
;
442 if (S_OK
== AccessibleChildren(accessibleFrame
, 0, childCount
, var
, &obtained
))
444 for (i
= 0; i
< childCount
; i
++)
446 IAccessible
* childAccessible
= NULL
;
449 if (var
[i
].pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
451 var
[i
].pdispVal
->Release();
454 GetInfo(childAccessible
, 0, name
, role
);
456 str
.Printf(wxT("Found child %s/%s"), name
.c_str(), role
.c_str());
458 childAccessible
->Release();
462 var
[i
].pdispVal
->Release();
469 Log(wxT("AccessibleChildren failed."));
474 accessibleFrame
->Release();
478 // Log messages to the text control
479 void MyFrame::Log(const wxString
& text
)
483 wxString
text2(text
);
484 text2
.Replace(wxT("\n"), wxT(" "));
485 text2
.Replace(wxT("\r"), wxT(" "));
486 m_textCtrl
->SetInsertionPointEnd();
487 m_textCtrl
->WriteText(text2
+ wxT("\n"));
491 // Recursively give information about an object
492 void MyFrame::LogObject(int indent
, IAccessible
* obj
)
497 GetInfo(obj
, 0, name
, role
);
500 str
.Printf(wxT("Name = %s; Role = %s"), name
.c_str(), role
.c_str());
501 str
.Pad(indent
, wxT(' '), false);
506 if (S_OK
== obj
->get_accChildCount(& childCount
))
509 str
.Printf(wxT("There are %d children."), (int) childCount
);
510 str
.Pad(indent
, wxT(' '), false);
516 for (i
= 1; i
<= childCount
; i
++)
518 GetInfo(obj
, i
, name
, role
);
521 str
.Printf(wxT("%d) Name = %s; Role = %s"), i
, name
.c_str(), role
.c_str());
522 str
.Pad(indent
, wxT(' '), false);
529 IDispatch
* pDisp
= NULL
;
530 IAccessible
* childObject
= NULL
;
532 if (S_OK
== obj
->get_accChild(var
, & pDisp
) && pDisp
)
535 str
.Printf(wxT("This is a real object."));
536 str
.Pad(indent
+4, wxT(' '), false);
539 if (pDisp
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childObject
) == S_OK
)
541 LogObject(indent
+ 4, childObject
);
542 childObject
->Release();
549 str
.Printf(wxT("This is an element."));
550 str
.Pad(indent
+4, wxT(' '), false);
558 // Get info for a child (id > 0) or object (id == 0)
559 void MyFrame::GetInfo(IAccessible
* accessible
, int id
, wxString
& name
, wxString
& role
)
567 HRESULT hResult
= accessible
->get_accName(var
, & bStrName
);
571 name
= wxConvertStringFromOle(bStrName
);
572 SysFreeString(bStrName
);
576 name
= wxT("NO NAME");
580 VariantInit(& varRole
);
582 hResult
= accessible
->get_accRole(var
, & varRole
);
584 if (hResult
== S_OK
&& varRole
.vt
== VT_I4
)
587 GetRoleText(varRole
.lVal
, buf
, 256);
593 role
= wxT("NO ROLE");
598 * SplitterWindowAccessible implementation
601 // Gets the name of the specified object.
602 wxAccStatus
SplitterWindowAccessible::GetName(int childId
, wxString
* name
)
604 if (childId
== wxACC_SELF
)
606 * name
= wxT("Splitter window");
609 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
612 if (splitter
->IsSplit())
614 // Two windows, and the sash.
615 if (childId
== 1 || childId
== 3)
616 return wxACC_NOT_IMPLEMENTED
;
617 else if (childId
== 2)
624 // Let the framework handle the other cases.
625 return wxACC_NOT_IMPLEMENTED
;
628 // Can return either a child object, or an integer
629 // representing the child element, starting from 1.
630 wxAccStatus
SplitterWindowAccessible::HitTest(const wxPoint
& pt
, int* childId
, wxAccessible
** WXUNUSED(childObject
))
632 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
635 if (splitter
->IsSplit())
637 wxPoint clientPt
= splitter
->ScreenToClient(pt
);
638 if (splitter
->SashHitTest(clientPt
.x
, clientPt
.y
, 1))
640 // We're over the sash
646 // Let the framework handle the other cases.
647 return wxACC_NOT_IMPLEMENTED
;
650 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
651 wxAccStatus
SplitterWindowAccessible::GetLocation(wxRect
& rect
, int elementId
)
653 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
654 if (splitter
&& elementId
== 2 && splitter
->IsSplit())
656 wxSize clientSize
= splitter
->GetClientSize();
657 if (splitter
->GetSplitMode() == wxSPLIT_VERTICAL
)
659 rect
.x
= splitter
->GetSashPosition();
661 rect
.SetPosition(splitter
->ClientToScreen(rect
.GetPosition()));
662 rect
.width
= splitter
->GetSashSize();
663 rect
.height
= clientSize
.y
;
668 rect
.y
= splitter
->GetSashPosition();
669 rect
.SetPosition(splitter
->ClientToScreen(rect
.GetPosition()));
670 rect
.width
= clientSize
.x
;
671 rect
.height
= splitter
->GetSashSize();
675 // Let the framework handle the other cases.
676 return wxACC_NOT_IMPLEMENTED
;
679 // Navigates from fromId to toId/toObject.
680 wxAccStatus
SplitterWindowAccessible::Navigate(wxNavDir navDir
, int fromId
,
681 int* toId
, wxAccessible
** toObject
)
683 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
684 if (splitter
&& splitter
->IsSplit())
690 if (splitter
->GetSplitMode() != wxSPLIT_VERTICAL
)
698 else if (fromId
== 2)
701 *toObject
= splitter
->GetWindow2()->GetAccessible();
707 // below line is not executed due to earlier return
711 case wxNAVDIR_FIRSTCHILD
:
718 case wxNAVDIR_LASTCHILD
:
727 if (splitter
->GetSplitMode() != wxSPLIT_HORIZONTAL
)
735 else if (fromId
== 2)
738 *toObject
= splitter
->GetWindow1()->GetAccessible();
745 // below line is not executed due to earlier return
757 else if (fromId
== 2)
760 *toObject
= splitter
->GetWindow2()->GetAccessible();
766 // below line is not executed due to earlier return
770 case wxNAVDIR_PREVIOUS
:
778 else if (fromId
== 2)
781 *toObject
= splitter
->GetWindow1()->GetAccessible();
787 // below line is not executed due to earlier return
793 if (splitter
->GetSplitMode() != wxSPLIT_HORIZONTAL
)
801 else if (fromId
== 2)
804 *toObject
= splitter
->GetWindow2()->GetAccessible();
808 // Can't go right spatially if split horizontally.
812 // below line is not executed due to earlier return
818 if (splitter
->GetSplitMode() != wxSPLIT_VERTICAL
)
825 else if (fromId
== 2)
828 *toObject
= splitter
->GetWindow1()->GetAccessible();
833 // Can't go up spatially if split vertically.
836 // below line is not executed due to earlier return
843 // Let the framework handle the other cases.
844 return wxACC_NOT_IMPLEMENTED
;
847 // Gets the number of children.
848 wxAccStatus
SplitterWindowAccessible::GetChildCount(int* childCount
)
850 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
853 if (splitter
->IsSplit())
855 // Two windows, and the sash.
861 // No sash -- 1 or 0 windows.
862 if (splitter
->GetWindow1() || splitter
->GetWindow2())
874 // Let the framework handle the other cases.
875 return wxACC_NOT_IMPLEMENTED
;
878 // Gets the specified child (starting from 1).
879 // If *child is NULL and return value is wxACC_OK,
880 // this means that the child is a simple element and
881 // not an accessible object.
882 wxAccStatus
SplitterWindowAccessible::GetChild(int childId
, wxAccessible
** child
)
884 if (childId
== wxACC_SELF
)
890 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
893 if (splitter
->IsSplit())
895 // Two windows, and the sash.
898 *child
= splitter
->GetWindow1()->GetAccessible();
900 else if (childId
== 2)
902 *child
= NULL
; // Sash
904 else if (childId
== 3)
906 *child
= splitter
->GetWindow2()->GetAccessible();
916 // No sash -- 1 or 0 windows.
919 if (splitter
->GetWindow1())
921 *child
= splitter
->GetWindow1()->GetAccessible();
924 else if (splitter
->GetWindow2())
926 *child
= splitter
->GetWindow2()->GetAccessible();
938 // Let the framework handle the other cases.
939 return wxACC_NOT_IMPLEMENTED
;
942 // Gets the parent, or NULL.
943 wxAccStatus
SplitterWindowAccessible::GetParent(wxAccessible
** WXUNUSED(parent
))
945 return wxACC_NOT_IMPLEMENTED
;
948 // Performs the default action. childId is 0 (the action for this object)
949 // or > 0 (the action for a child).
950 // Return wxACC_NOT_SUPPORTED if there is no default action for this
951 // window (e.g. an edit control).
952 wxAccStatus
SplitterWindowAccessible::DoDefaultAction(int WXUNUSED(childId
))
954 return wxACC_NOT_IMPLEMENTED
;
957 // Gets the default action for this object (0) or > 0 (the action for a child).
958 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
959 // string if there is no action.
960 // The retrieved string describes the action that is performed on an object,
961 // not what the object does as a result. For example, a toolbar button that prints
962 // a document has a default action of "Press" rather than "Prints the current document."
963 wxAccStatus
SplitterWindowAccessible::GetDefaultAction(int childId
, wxString
* WXUNUSED(actionName
))
965 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
966 if (splitter
&& splitter
->IsSplit() && childId
== 2)
968 // No default action for the splitter.
971 // Let the framework handle the other cases.
972 return wxACC_NOT_IMPLEMENTED
;
975 // Returns the description for this object or a child.
976 wxAccStatus
SplitterWindowAccessible::GetDescription(int childId
, wxString
* description
)
978 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
981 if (splitter
->IsSplit())
985 * description
= _("The splitter window sash.");
990 // Let the framework handle the other cases.
991 return wxACC_NOT_IMPLEMENTED
;
994 // Returns help text for this object or a child, similar to tooltip text.
995 wxAccStatus
SplitterWindowAccessible::GetHelpText(int childId
, wxString
* helpText
)
997 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1000 if (splitter
->IsSplit())
1004 * helpText
= _("The splitter window sash.");
1009 // Let the framework handle the other cases.
1010 return wxACC_NOT_IMPLEMENTED
;
1013 // Returns the keyboard shortcut for this object or child.
1014 // Return e.g. ALT+K
1015 wxAccStatus
SplitterWindowAccessible::GetKeyboardShortcut(int childId
, wxString
* WXUNUSED(shortcut
))
1017 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1018 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1020 // No keyboard shortcut for the splitter.
1023 // Let the framework handle the other cases.
1024 return wxACC_NOT_IMPLEMENTED
;
1027 // Returns a role constant.
1028 wxAccStatus
SplitterWindowAccessible::GetRole(int childId
, wxAccRole
* role
)
1030 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1033 if (splitter
->IsSplit())
1037 * role
= wxROLE_SYSTEM_GRIP
;
1042 // Let the framework handle the other cases.
1043 return wxACC_NOT_IMPLEMENTED
;
1046 // Returns a state constant.
1047 wxAccStatus
SplitterWindowAccessible::GetState(int childId
, long* state
)
1049 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1050 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1052 // No particular state. Not sure what would be appropriate here.
1053 *state
= wxACC_STATE_SYSTEM_UNAVAILABLE
;
1056 // Let the framework handle the other cases.
1057 return wxACC_NOT_IMPLEMENTED
;
1060 // Returns a localized string representing the value for the object
1062 wxAccStatus
SplitterWindowAccessible::GetValue(int childId
, wxString
* strValue
)
1064 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1065 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1067 // The sash position is the value.
1069 pos
<< splitter
->GetSashPosition();
1074 // Let the framework handle the other cases.
1075 return wxACC_NOT_IMPLEMENTED
;
1078 // Selects the object or child.
1079 wxAccStatus
SplitterWindowAccessible::Select(int childId
, wxAccSelectionFlags
WXUNUSED(selectFlags
))
1081 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1082 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1084 // Can't select the sash.
1087 // Let the framework handle the other cases.
1088 return wxACC_NOT_IMPLEMENTED
;
1091 // Gets the window with the keyboard focus.
1092 // If childId is 0 and child is NULL, no object in
1093 // this subhierarchy has the focus.
1094 // If this object has the focus, child should be 'this'.
1095 wxAccStatus
SplitterWindowAccessible::GetFocus(int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
1097 return wxACC_NOT_IMPLEMENTED
;
1100 // Gets a variant representing the selected children
1102 // Acceptable values:
1103 // - a null variant (IsNull() returns true)
1104 // - a list variant (GetType() == wxT("list"))
1105 // - an integer representing the selected child element,
1106 // or 0 if this object is selected (GetType() == wxT("long"))
1107 // - a "void*" pointer to a wxAccessible child object
1108 wxAccStatus
SplitterWindowAccessible::GetSelections(wxVariant
* WXUNUSED(selections
))
1110 return wxACC_NOT_IMPLEMENTED
;
1113 #endif // wxUSE_ACCESSIBILITY