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(__WXMSW__) && !defined(__WXPM__)
63 #include "../sample.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 ( !wxApp::OnInit() )
169 #if wxUSE_ACCESSIBILITY
170 // Note: JAWS for Windows will only speak the context-sensitive
171 // help if you use this help provider:
172 // wxHelpProvider::Set(new wxHelpControllerHelpProvider(m_helpController)).
173 // JAWS does not seem to be getting the help text from
174 // the wxAccessible object.
175 wxHelpProvider::Set(new wxSimpleHelpProvider());
177 // create the main application window
178 MyFrame
*frame
= new MyFrame(wxT("AccessTest wxWidgets App"),
179 wxPoint(50, 50), wxSize(450, 340));
181 // and show it (the frames, unlike simple controls, are not shown when
182 // created initially)
185 // success: wxApp::OnRun() will be called which will enter the main message
186 // loop and the application will run. If we returned false here, the
187 // application would exit immediately.
190 wxMessageBox( wxT("This sample has to be compiled with wxUSE_ACCESSIBILITY"), wxT("Building error"), wxOK
);
192 #endif // wxUSE_ACCESSIBILITY
195 #if wxUSE_ACCESSIBILITY
197 class FrameAccessible
: public wxWindowAccessible
200 FrameAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
202 // Gets the name of the specified object.
203 virtual wxAccStatus
GetName(int childId
, wxString
* name
)
205 if (childId
== wxACC_SELF
)
207 * name
= wxT("Julian's Frame");
211 return wxACC_NOT_IMPLEMENTED
;
215 class ScrolledWindowAccessible
: public wxWindowAccessible
218 ScrolledWindowAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
220 // Gets the name of the specified object.
221 virtual wxAccStatus
GetName(int childId
, wxString
* name
)
223 if (childId
== wxACC_SELF
)
225 * name
= wxT("My scrolled window");
229 return wxACC_NOT_IMPLEMENTED
;
233 class SplitterWindowAccessible
: public wxWindowAccessible
236 SplitterWindowAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
238 // Gets the name of the specified object.
239 virtual wxAccStatus
GetName(int childId
, wxString
* name
);
241 // Can return either a child object, or an integer
242 // representing the child element, starting from 1.
243 virtual wxAccStatus
HitTest(const wxPoint
& pt
, int* childId
, wxAccessible
** childObject
);
245 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
246 virtual wxAccStatus
GetLocation(wxRect
& rect
, int elementId
);
248 // Navigates from fromId to toId/toObject.
249 virtual wxAccStatus
Navigate(wxNavDir navDir
, int fromId
,
250 int* toId
, wxAccessible
** toObject
);
252 // Gets the number of children.
253 virtual wxAccStatus
GetChildCount(int* childCount
);
255 // Gets the specified child (starting from 1).
256 // If *child is NULL and return value is wxACC_OK,
257 // this means that the child is a simple element and
258 // not an accessible object.
259 virtual wxAccStatus
GetChild(int childId
, wxAccessible
** child
);
261 // Gets the parent, or NULL.
262 virtual wxAccStatus
GetParent(wxAccessible
** parent
);
264 // Performs the default action. childId is 0 (the action for this object)
265 // or > 0 (the action for a child).
266 // Return wxACC_NOT_SUPPORTED if there is no default action for this
267 // window (e.g. an edit control).
268 virtual wxAccStatus
DoDefaultAction(int childId
);
270 // Gets the default action for this object (0) or > 0 (the action for a child).
271 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
272 // string if there is no action.
273 // The retrieved string describes the action that is performed on an object,
274 // not what the object does as a result. For example, a toolbar button that prints
275 // a document has a default action of "Press" rather than "Prints the current document."
276 virtual wxAccStatus
GetDefaultAction(int childId
, wxString
* actionName
);
278 // Returns the description for this object or a child.
279 virtual wxAccStatus
GetDescription(int childId
, wxString
* description
);
281 // Returns help text for this object or a child, similar to tooltip text.
282 virtual wxAccStatus
GetHelpText(int childId
, wxString
* helpText
);
284 // Returns the keyboard shortcut for this object or child.
286 virtual wxAccStatus
GetKeyboardShortcut(int childId
, wxString
* shortcut
);
288 // Returns a role constant.
289 virtual wxAccStatus
GetRole(int childId
, wxAccRole
* role
);
291 // Returns a state constant.
292 virtual wxAccStatus
GetState(int childId
, long* state
);
294 // Returns a localized string representing the value for the object
296 virtual wxAccStatus
GetValue(int childId
, wxString
* strValue
);
298 // Selects the object or child.
299 virtual wxAccStatus
Select(int childId
, wxAccSelectionFlags selectFlags
);
301 // Gets the window with the keyboard focus.
302 // If childId is 0 and child is NULL, no object in
303 // this subhierarchy has the focus.
304 // If this object has the focus, child should be 'this'.
305 virtual wxAccStatus
GetFocus(int* childId
, wxAccessible
** child
);
307 // Gets a variant representing the selected children
309 // Acceptable values:
310 // - a null variant (IsNull() returns true)
311 // - a list variant (GetType() == wxT("list"))
312 // - an integer representing the selected child element,
313 // or 0 if this object is selected (GetType() == wxT("long"))
314 // - a "void*" pointer to a wxAccessible child object
315 virtual wxAccStatus
GetSelections(wxVariant
* selections
);
319 // ----------------------------------------------------------------------------
321 // ----------------------------------------------------------------------------
324 MyFrame::MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
)
325 : wxFrame(NULL
, wxID_ANY
, title
, pos
, size
, style
)
329 SetAccessible(new FrameAccessible(this));
331 // set the frame icon
332 SetIcon(wxICON(sample
));
336 wxMenu
*menuFile
= new wxMenu
;
338 // the "About" item should be in the help menu
339 wxMenu
*helpMenu
= new wxMenu
;
340 helpMenu
->Append(AccessTest_About
, wxT("&About..."), wxT("Show about dialog"));
342 menuFile
->Append(AccessTest_Query
, wxT("Query"), wxT("Query the window hierarchy"));
343 menuFile
->AppendSeparator();
344 menuFile
->Append(AccessTest_Quit
, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
346 // now append the freshly created menu to the menu bar...
347 wxMenuBar
*menuBar
= new wxMenuBar();
348 menuBar
->Append(menuFile
, wxT("&File"));
349 menuBar
->Append(helpMenu
, wxT("&Help"));
351 // ... and attach this menu bar to the frame
353 #endif // wxUSE_MENUS
355 #if 0 // wxUSE_STATUSBAR
356 // create a status bar just for fun (by default with 1 pane only)
358 SetStatusText(wxT("Welcome to wxWidgets!"));
359 #endif // wxUSE_STATUSBAR
362 wxSplitterWindow
* splitter
= new wxSplitterWindow(this, wxID_ANY
);
363 splitter
->SetAccessible(new SplitterWindowAccessible(splitter
));
365 wxListBox
* listBox
= new wxListBox(splitter
, wxID_ANY
);
366 listBox
->Append(wxT("Cabbages"));
367 listBox
->Append(wxT("Kings"));
368 listBox
->Append(wxT("Sealing wax"));
369 listBox
->Append(wxT("Strings"));
370 listBox
->CreateAccessible();
371 listBox
->SetHelpText(wxT("This is a sample wxWidgets listbox, with a number of items in it."));
373 m_textCtrl
= new wxTextCtrl(splitter
, wxID_ANY
, wxT(""), wxDefaultPosition
,
374 wxDefaultSize
, wxTE_MULTILINE
);
375 m_textCtrl
->CreateAccessible();
376 m_textCtrl
->SetHelpText(wxT("This is a sample wxWidgets multiline text control."));
378 splitter
->SplitHorizontally(listBox
, m_textCtrl
, 150);
381 wxScrolledWindow
* scrolledWindow
= new wxScrolledWindow(this, wxID_ANY
);
382 scrolledWindow
->SetAccessible(new ScrolledWindowAccessible(scrolledWindow
));
389 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
391 // true is to force the frame to close
395 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
398 msg
.Printf( wxT("This is the About dialog of the AccessTest sample.\n")
399 wxT("Welcome to %s"), wxVERSION_STRING
);
401 wxMessageBox(msg
, wxT("About AccessTest"), wxOK
| wxICON_INFORMATION
, this);
404 void MyFrame::OnQuery(wxCommandEvent
& WXUNUSED(event
))
407 IAccessible
* accessibleFrame
= NULL
;
408 if (S_OK
!= AccessibleObjectFromWindow((HWND
) GetHWND(), OBJID_CLIENT
,
409 IID_IAccessible
, (void**) & accessibleFrame
))
411 Log(wxT("Could not get object."));
416 //Log(wxT("Got an IAccessible for the frame."));
417 LogObject(0, accessibleFrame
);
418 Log(wxT("Checking children using AccessibleChildren()..."));
420 // Now check the AccessibleChildren function works OK
422 if (S_OK
!= accessibleFrame
->get_accChildCount(& childCount
))
424 Log(wxT("Could not get number of children."));
425 accessibleFrame
->Release();
428 else if (childCount
== 0)
430 Log(wxT("No children."));
431 accessibleFrame
->Release();
437 VARIANT
*var
= new VARIANT
[childCount
];
439 for (i
= 0; i
< childCount
; i
++)
441 VariantInit(& (var
[i
]));
442 var
[i
].vt
= VT_DISPATCH
;
445 if (S_OK
== AccessibleChildren(accessibleFrame
, 0, childCount
, var
, &obtained
))
447 for (i
= 0; i
< childCount
; i
++)
449 IAccessible
* childAccessible
= NULL
;
452 if (var
[i
].pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
454 var
[i
].pdispVal
->Release();
457 GetInfo(childAccessible
, 0, name
, role
);
459 str
.Printf(wxT("Found child %s/%s"), name
.c_str(), role
.c_str());
461 childAccessible
->Release();
465 var
[i
].pdispVal
->Release();
472 Log(wxT("AccessibleChildren failed."));
477 accessibleFrame
->Release();
481 // Log messages to the text control
482 void MyFrame::Log(const wxString
& text
)
486 wxString
text2(text
);
487 text2
.Replace(wxT("\n"), wxT(" "));
488 text2
.Replace(wxT("\r"), wxT(" "));
489 m_textCtrl
->SetInsertionPointEnd();
490 m_textCtrl
->WriteText(text2
+ wxT("\n"));
494 // Recursively give information about an object
495 void MyFrame::LogObject(int indent
, IAccessible
* obj
)
500 GetInfo(obj
, 0, name
, role
);
503 str
.Printf(wxT("Name = %s; Role = %s"), name
.c_str(), role
.c_str());
504 str
.Pad(indent
, wxT(' '), false);
509 if (S_OK
== obj
->get_accChildCount(& childCount
))
512 str
.Printf(wxT("There are %d children."), (int) childCount
);
513 str
.Pad(indent
, wxT(' '), false);
519 for (i
= 1; i
<= childCount
; i
++)
521 GetInfo(obj
, i
, name
, role
);
524 str
.Printf(wxT("%d) Name = %s; Role = %s"), i
, name
.c_str(), role
.c_str());
525 str
.Pad(indent
, wxT(' '), false);
532 IDispatch
* pDisp
= NULL
;
533 IAccessible
* childObject
= NULL
;
535 if (S_OK
== obj
->get_accChild(var
, & pDisp
) && pDisp
)
538 str
.Printf(wxT("This is a real object."));
539 str
.Pad(indent
+4, wxT(' '), false);
542 if (pDisp
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childObject
) == S_OK
)
544 LogObject(indent
+ 4, childObject
);
545 childObject
->Release();
552 str
.Printf(wxT("This is an element."));
553 str
.Pad(indent
+4, wxT(' '), false);
561 // Get info for a child (id > 0) or object (id == 0)
562 void MyFrame::GetInfo(IAccessible
* accessible
, int id
, wxString
& name
, wxString
& role
)
570 HRESULT hResult
= accessible
->get_accName(var
, & bStrName
);
574 name
= wxConvertStringFromOle(bStrName
);
575 SysFreeString(bStrName
);
579 name
= wxT("NO NAME");
583 VariantInit(& varRole
);
585 hResult
= accessible
->get_accRole(var
, & varRole
);
587 if (hResult
== S_OK
&& varRole
.vt
== VT_I4
)
590 GetRoleText(varRole
.lVal
, buf
, 256);
596 role
= wxT("NO ROLE");
601 * SplitterWindowAccessible implementation
604 // Gets the name of the specified object.
605 wxAccStatus
SplitterWindowAccessible::GetName(int childId
, wxString
* name
)
607 if (childId
== wxACC_SELF
)
609 * name
= wxT("Splitter window");
612 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
615 if (splitter
->IsSplit())
617 // Two windows, and the sash.
618 if (childId
== 1 || childId
== 3)
619 return wxACC_NOT_IMPLEMENTED
;
620 else if (childId
== 2)
627 // Let the framework handle the other cases.
628 return wxACC_NOT_IMPLEMENTED
;
631 // Can return either a child object, or an integer
632 // representing the child element, starting from 1.
633 wxAccStatus
SplitterWindowAccessible::HitTest(const wxPoint
& pt
, int* childId
, wxAccessible
** WXUNUSED(childObject
))
635 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
638 if (splitter
->IsSplit())
640 wxPoint clientPt
= splitter
->ScreenToClient(pt
);
641 if (splitter
->SashHitTest(clientPt
.x
, clientPt
.y
, 1))
643 // We're over the sash
649 // Let the framework handle the other cases.
650 return wxACC_NOT_IMPLEMENTED
;
653 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
654 wxAccStatus
SplitterWindowAccessible::GetLocation(wxRect
& rect
, int elementId
)
656 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
657 if (splitter
&& elementId
== 2 && splitter
->IsSplit())
659 wxSize clientSize
= splitter
->GetClientSize();
660 if (splitter
->GetSplitMode() == wxSPLIT_VERTICAL
)
662 rect
.x
= splitter
->GetSashPosition();
664 rect
.SetPosition(splitter
->ClientToScreen(rect
.GetPosition()));
665 rect
.width
= splitter
->GetSashSize();
666 rect
.height
= clientSize
.y
;
671 rect
.y
= splitter
->GetSashPosition();
672 rect
.SetPosition(splitter
->ClientToScreen(rect
.GetPosition()));
673 rect
.width
= clientSize
.x
;
674 rect
.height
= splitter
->GetSashSize();
678 // Let the framework handle the other cases.
679 return wxACC_NOT_IMPLEMENTED
;
682 // Navigates from fromId to toId/toObject.
683 wxAccStatus
SplitterWindowAccessible::Navigate(wxNavDir navDir
, int fromId
,
684 int* toId
, wxAccessible
** toObject
)
686 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
687 if (splitter
&& splitter
->IsSplit())
693 if (splitter
->GetSplitMode() != wxSPLIT_VERTICAL
)
701 else if (fromId
== 2)
704 *toObject
= splitter
->GetWindow2()->GetAccessible();
710 // below line is not executed due to earlier return
714 case wxNAVDIR_FIRSTCHILD
:
721 case wxNAVDIR_LASTCHILD
:
730 if (splitter
->GetSplitMode() != wxSPLIT_HORIZONTAL
)
738 else if (fromId
== 2)
741 *toObject
= splitter
->GetWindow1()->GetAccessible();
748 // below line is not executed due to earlier return
760 else if (fromId
== 2)
763 *toObject
= splitter
->GetWindow2()->GetAccessible();
769 // below line is not executed due to earlier return
773 case wxNAVDIR_PREVIOUS
:
781 else if (fromId
== 2)
784 *toObject
= splitter
->GetWindow1()->GetAccessible();
790 // below line is not executed due to earlier return
796 if (splitter
->GetSplitMode() != wxSPLIT_HORIZONTAL
)
804 else if (fromId
== 2)
807 *toObject
= splitter
->GetWindow2()->GetAccessible();
811 // Can't go right spatially if split horizontally.
815 // below line is not executed due to earlier return
821 if (splitter
->GetSplitMode() != wxSPLIT_VERTICAL
)
828 else if (fromId
== 2)
831 *toObject
= splitter
->GetWindow1()->GetAccessible();
836 // Can't go up spatially if split vertically.
839 // below line is not executed due to earlier return
846 // Let the framework handle the other cases.
847 return wxACC_NOT_IMPLEMENTED
;
850 // Gets the number of children.
851 wxAccStatus
SplitterWindowAccessible::GetChildCount(int* childCount
)
853 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
856 if (splitter
->IsSplit())
858 // Two windows, and the sash.
864 // No sash -- 1 or 0 windows.
865 if (splitter
->GetWindow1() || splitter
->GetWindow2())
877 // Let the framework handle the other cases.
878 return wxACC_NOT_IMPLEMENTED
;
881 // Gets the specified child (starting from 1).
882 // If *child is NULL and return value is wxACC_OK,
883 // this means that the child is a simple element and
884 // not an accessible object.
885 wxAccStatus
SplitterWindowAccessible::GetChild(int childId
, wxAccessible
** child
)
887 if (childId
== wxACC_SELF
)
893 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
896 if (splitter
->IsSplit())
898 // Two windows, and the sash.
901 *child
= splitter
->GetWindow1()->GetAccessible();
903 else if (childId
== 2)
905 *child
= NULL
; // Sash
907 else if (childId
== 3)
909 *child
= splitter
->GetWindow2()->GetAccessible();
919 // No sash -- 1 or 0 windows.
922 if (splitter
->GetWindow1())
924 *child
= splitter
->GetWindow1()->GetAccessible();
927 else if (splitter
->GetWindow2())
929 *child
= splitter
->GetWindow2()->GetAccessible();
941 // Let the framework handle the other cases.
942 return wxACC_NOT_IMPLEMENTED
;
945 // Gets the parent, or NULL.
946 wxAccStatus
SplitterWindowAccessible::GetParent(wxAccessible
** WXUNUSED(parent
))
948 return wxACC_NOT_IMPLEMENTED
;
951 // Performs the default action. childId is 0 (the action for this object)
952 // or > 0 (the action for a child).
953 // Return wxACC_NOT_SUPPORTED if there is no default action for this
954 // window (e.g. an edit control).
955 wxAccStatus
SplitterWindowAccessible::DoDefaultAction(int WXUNUSED(childId
))
957 return wxACC_NOT_IMPLEMENTED
;
960 // Gets the default action for this object (0) or > 0 (the action for a child).
961 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
962 // string if there is no action.
963 // The retrieved string describes the action that is performed on an object,
964 // not what the object does as a result. For example, a toolbar button that prints
965 // a document has a default action of "Press" rather than "Prints the current document."
966 wxAccStatus
SplitterWindowAccessible::GetDefaultAction(int childId
, wxString
* WXUNUSED(actionName
))
968 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
969 if (splitter
&& splitter
->IsSplit() && childId
== 2)
971 // No default action for the splitter.
974 // Let the framework handle the other cases.
975 return wxACC_NOT_IMPLEMENTED
;
978 // Returns the description for this object or a child.
979 wxAccStatus
SplitterWindowAccessible::GetDescription(int childId
, wxString
* description
)
981 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
984 if (splitter
->IsSplit())
988 * description
= _("The splitter window sash.");
993 // Let the framework handle the other cases.
994 return wxACC_NOT_IMPLEMENTED
;
997 // Returns help text for this object or a child, similar to tooltip text.
998 wxAccStatus
SplitterWindowAccessible::GetHelpText(int childId
, wxString
* helpText
)
1000 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1003 if (splitter
->IsSplit())
1007 * helpText
= _("The splitter window sash.");
1012 // Let the framework handle the other cases.
1013 return wxACC_NOT_IMPLEMENTED
;
1016 // Returns the keyboard shortcut for this object or child.
1017 // Return e.g. ALT+K
1018 wxAccStatus
SplitterWindowAccessible::GetKeyboardShortcut(int childId
, wxString
* WXUNUSED(shortcut
))
1020 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1021 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1023 // No keyboard shortcut for the splitter.
1026 // Let the framework handle the other cases.
1027 return wxACC_NOT_IMPLEMENTED
;
1030 // Returns a role constant.
1031 wxAccStatus
SplitterWindowAccessible::GetRole(int childId
, wxAccRole
* role
)
1033 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1036 if (splitter
->IsSplit())
1040 * role
= wxROLE_SYSTEM_GRIP
;
1045 // Let the framework handle the other cases.
1046 return wxACC_NOT_IMPLEMENTED
;
1049 // Returns a state constant.
1050 wxAccStatus
SplitterWindowAccessible::GetState(int childId
, long* state
)
1052 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1053 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1055 // No particular state. Not sure what would be appropriate here.
1056 *state
= wxACC_STATE_SYSTEM_UNAVAILABLE
;
1059 // Let the framework handle the other cases.
1060 return wxACC_NOT_IMPLEMENTED
;
1063 // Returns a localized string representing the value for the object
1065 wxAccStatus
SplitterWindowAccessible::GetValue(int childId
, wxString
* strValue
)
1067 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1068 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1070 // The sash position is the value.
1072 pos
<< splitter
->GetSashPosition();
1077 // Let the framework handle the other cases.
1078 return wxACC_NOT_IMPLEMENTED
;
1081 // Selects the object or child.
1082 wxAccStatus
SplitterWindowAccessible::Select(int childId
, wxAccSelectionFlags
WXUNUSED(selectFlags
))
1084 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1085 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1087 // Can't select the sash.
1090 // Let the framework handle the other cases.
1091 return wxACC_NOT_IMPLEMENTED
;
1094 // Gets the window with the keyboard focus.
1095 // If childId is 0 and child is NULL, no object in
1096 // this subhierarchy has the focus.
1097 // If this object has the focus, child should be 'this'.
1098 wxAccStatus
SplitterWindowAccessible::GetFocus(int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
1100 return wxACC_NOT_IMPLEMENTED
;
1103 // Gets a variant representing the selected children
1105 // Acceptable values:
1106 // - a null variant (IsNull() returns true)
1107 // - a list variant (GetType() == wxT("list"))
1108 // - an integer representing the selected child element,
1109 // or 0 if this object is selected (GetType() == wxT("long"))
1110 // - a "void*" pointer to a wxAccessible child object
1111 wxAccStatus
SplitterWindowAccessible::GetSelections(wxVariant
* WXUNUSED(selections
))
1113 return wxACC_NOT_IMPLEMENTED
;
1116 #endif // wxUSE_ACCESSIBILITY