1 /////////////////////////////////////////////////////////////////////////////
2 // Name: accesstest.cpp
3 // Purpose: wxWidgets accessibility sample
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx/wx.h".
20 #include "wx/wxprec.h"
26 // for all others, include the necessary headers (this file is usually all you
27 // need because it includes almost all "standard" wxWidgets headers)
32 #if wxUSE_ACCESSIBILITY
33 #include "wx/access.h"
34 #endif // wxUSE_ACCESSIBILITY
36 #include "wx/splitter.h"
37 #include "wx/cshelp.h"
44 #if wxUSE_ACCESSIBILITY
46 #endif // wxUSE_ACCESSIBILITY
48 #include "wx/msw/ole/oleutils.h"
49 #include "wx/msw/winundef.h"
52 #define OBJID_CLIENT 0xFFFFFFFC
56 // ----------------------------------------------------------------------------
58 // ----------------------------------------------------------------------------
60 // the application icon (under Windows and OS/2 it is in resources)
61 #ifndef wxHAS_IMAGES_IN_RESOURCES
62 #include "../sample.xpm"
65 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
69 // Define a new application type, each program should derive a class from wxApp
70 class MyApp
: public wxApp
73 // override base class virtuals
74 // ----------------------------
76 // this one is called on application startup and is a good place for the app
77 // initialization (doing it here and not in the ctor allows to have an error
78 // return: if OnInit() returns false, the application terminates)
79 virtual bool OnInit();
83 #if wxUSE_ACCESSIBILITY
85 // Define a new frame type: this is going to be our main frame
86 class MyFrame
: public wxFrame
90 MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
,
91 long style
= wxDEFAULT_FRAME_STYLE
);
93 // event handlers (these functions should _not_ be virtual)
94 void OnQuit(wxCommandEvent
& event
);
95 void OnQuery(wxCommandEvent
& event
);
96 void OnAbout(wxCommandEvent
& event
);
98 // Log messages to the text control
99 void Log(const wxString
& text
);
101 // Recursively give information about an object
102 void LogObject(int indent
, IAccessible
* obj
);
104 // Get info for a child (id > 0) or object (id == 0)
105 void GetInfo(IAccessible
* accessible
, int id
, wxString
& name
, wxString
& role
);
107 wxTextCtrl
* m_textCtrl
;
109 // any class wishing to process wxWidgets events must use this macro
110 DECLARE_EVENT_TABLE()
113 // ----------------------------------------------------------------------------
115 // ----------------------------------------------------------------------------
117 // IDs for the controls and the menu commands
123 // query the hierarchy
126 // it is important for the id corresponding to the "About" command to have
127 // this standard value as otherwise it won't be handled properly under Mac
128 // (where it is special and put into the "Apple" menu)
129 AccessTest_About
= wxID_ABOUT
132 // ----------------------------------------------------------------------------
133 // event tables and other macros for wxWidgets
134 // ----------------------------------------------------------------------------
136 // the event tables connect the wxWidgets events with the functions (event
137 // handlers) which process them. It can be also done at run-time, but for the
138 // simple menu events like this the static method is much simpler.
139 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
140 EVT_MENU(AccessTest_Quit
, MyFrame::OnQuit
)
141 EVT_MENU(AccessTest_Query
, MyFrame::OnQuery
)
142 EVT_MENU(AccessTest_About
, MyFrame::OnAbout
)
145 #endif // wxUSE_ACCESSIBILITY
147 // Create a new application object: this macro will allow wxWidgets to create
148 // the application object during program execution (it's better than using a
149 // static object for many reasons) and also declares the accessor function
150 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
154 // ============================================================================
156 // ============================================================================
158 // ----------------------------------------------------------------------------
159 // the application class
160 // ----------------------------------------------------------------------------
162 // 'Main program' equivalent: the program execution "starts" here
165 if ( !wxApp::OnInit() )
168 #if wxUSE_ACCESSIBILITY
169 // Note: JAWS for Windows will only speak the context-sensitive
170 // help if you use this help provider:
171 // wxHelpProvider::Set(new wxHelpControllerHelpProvider(m_helpController)).
172 // JAWS does not seem to be getting the help text from
173 // the wxAccessible object.
174 wxHelpProvider::Set(new wxSimpleHelpProvider());
176 // create the main application window
177 MyFrame
*frame
= new MyFrame(wxT("AccessTest wxWidgets App"),
178 wxPoint(50, 50), wxSize(450, 340));
180 // and show it (the frames, unlike simple controls, are not shown when
181 // created initially)
184 // success: wxApp::OnRun() will be called which will enter the main message
185 // loop and the application will run. If we returned false here, the
186 // application would exit immediately.
189 wxMessageBox( wxT("This sample has to be compiled with wxUSE_ACCESSIBILITY"), wxT("Building error"), wxOK
);
191 #endif // wxUSE_ACCESSIBILITY
194 #if wxUSE_ACCESSIBILITY
196 class FrameAccessible
: public wxWindowAccessible
199 FrameAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
201 // Gets the name of the specified object.
202 virtual wxAccStatus
GetName(int childId
, wxString
* name
)
204 if (childId
== wxACC_SELF
)
206 * name
= wxT("Julian's Frame");
210 return wxACC_NOT_IMPLEMENTED
;
214 class ScrolledWindowAccessible
: public wxWindowAccessible
217 ScrolledWindowAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
219 // Gets the name of the specified object.
220 virtual wxAccStatus
GetName(int childId
, wxString
* name
)
222 if (childId
== wxACC_SELF
)
224 * name
= wxT("My scrolled window");
228 return wxACC_NOT_IMPLEMENTED
;
232 class SplitterWindowAccessible
: public wxWindowAccessible
235 SplitterWindowAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
237 // Gets the name of the specified object.
238 virtual wxAccStatus
GetName(int childId
, wxString
* name
);
240 // Can return either a child object, or an integer
241 // representing the child element, starting from 1.
242 virtual wxAccStatus
HitTest(const wxPoint
& pt
, int* childId
, wxAccessible
** childObject
);
244 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
245 virtual wxAccStatus
GetLocation(wxRect
& rect
, int elementId
);
247 // Navigates from fromId to toId/toObject.
248 virtual wxAccStatus
Navigate(wxNavDir navDir
, int fromId
,
249 int* toId
, wxAccessible
** toObject
);
251 // Gets the number of children.
252 virtual wxAccStatus
GetChildCount(int* childCount
);
254 // Gets the specified child (starting from 1).
255 // If *child is NULL and return value is wxACC_OK,
256 // this means that the child is a simple element and
257 // not an accessible object.
258 virtual wxAccStatus
GetChild(int childId
, wxAccessible
** child
);
260 // Gets the parent, or NULL.
261 virtual wxAccStatus
GetParent(wxAccessible
** parent
);
263 // Performs the default action. childId is 0 (the action for this object)
264 // or > 0 (the action for a child).
265 // Return wxACC_NOT_SUPPORTED if there is no default action for this
266 // window (e.g. an edit control).
267 virtual wxAccStatus
DoDefaultAction(int childId
);
269 // Gets the default action for this object (0) or > 0 (the action for a child).
270 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
271 // string if there is no action.
272 // The retrieved string describes the action that is performed on an object,
273 // not what the object does as a result. For example, a toolbar button that prints
274 // a document has a default action of "Press" rather than "Prints the current document."
275 virtual wxAccStatus
GetDefaultAction(int childId
, wxString
* actionName
);
277 // Returns the description for this object or a child.
278 virtual wxAccStatus
GetDescription(int childId
, wxString
* description
);
280 // Returns help text for this object or a child, similar to tooltip text.
281 virtual wxAccStatus
GetHelpText(int childId
, wxString
* helpText
);
283 // Returns the keyboard shortcut for this object or child.
285 virtual wxAccStatus
GetKeyboardShortcut(int childId
, wxString
* shortcut
);
287 // Returns a role constant.
288 virtual wxAccStatus
GetRole(int childId
, wxAccRole
* role
);
290 // Returns a state constant.
291 virtual wxAccStatus
GetState(int childId
, long* state
);
293 // Returns a localized string representing the value for the object
295 virtual wxAccStatus
GetValue(int childId
, wxString
* strValue
);
297 // Selects the object or child.
298 virtual wxAccStatus
Select(int childId
, wxAccSelectionFlags selectFlags
);
300 // Gets the window with the keyboard focus.
301 // If childId is 0 and child is NULL, no object in
302 // this subhierarchy has the focus.
303 // If this object has the focus, child should be 'this'.
304 virtual wxAccStatus
GetFocus(int* childId
, wxAccessible
** child
);
306 // Gets a variant representing the selected children
308 // Acceptable values:
309 // - a null variant (IsNull() returns true)
310 // - a list variant (GetType() == wxT("list"))
311 // - an integer representing the selected child element,
312 // or 0 if this object is selected (GetType() == wxT("long"))
313 // - a "void*" pointer to a wxAccessible child object
314 virtual wxAccStatus
GetSelections(wxVariant
* selections
);
318 // ----------------------------------------------------------------------------
320 // ----------------------------------------------------------------------------
323 MyFrame::MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
)
324 : wxFrame(NULL
, wxID_ANY
, title
, pos
, size
, style
)
328 SetAccessible(new FrameAccessible(this));
330 // set the frame icon
331 SetIcon(wxICON(sample
));
335 wxMenu
*menuFile
= new wxMenu
;
337 // the "About" item should be in the help menu
338 wxMenu
*helpMenu
= new wxMenu
;
339 helpMenu
->Append(AccessTest_About
, wxT("&About"), wxT("Show about dialog"));
341 menuFile
->Append(AccessTest_Query
, wxT("Query"), wxT("Query the window hierarchy"));
342 menuFile
->AppendSeparator();
343 menuFile
->Append(AccessTest_Quit
, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
345 // now append the freshly created menu to the menu bar...
346 wxMenuBar
*menuBar
= new wxMenuBar();
347 menuBar
->Append(menuFile
, wxT("&File"));
348 menuBar
->Append(helpMenu
, wxT("&Help"));
350 // ... and attach this menu bar to the frame
352 #endif // wxUSE_MENUS
354 #if 0 // wxUSE_STATUSBAR
355 // create a status bar just for fun (by default with 1 pane only)
357 SetStatusText(wxT("Welcome to wxWidgets!"));
358 #endif // wxUSE_STATUSBAR
361 wxSplitterWindow
* splitter
= new wxSplitterWindow(this, wxID_ANY
);
362 splitter
->SetAccessible(new SplitterWindowAccessible(splitter
));
364 wxListBox
* listBox
= new wxListBox(splitter
, wxID_ANY
);
365 listBox
->Append(wxT("Cabbages"));
366 listBox
->Append(wxT("Kings"));
367 listBox
->Append(wxT("Sealing wax"));
368 listBox
->Append(wxT("Strings"));
369 listBox
->CreateAccessible();
370 listBox
->SetHelpText(wxT("This is a sample wxWidgets listbox, with a number of items in it."));
372 m_textCtrl
= new wxTextCtrl(splitter
, wxID_ANY
, wxT(""), wxDefaultPosition
,
373 wxDefaultSize
, wxTE_MULTILINE
);
374 m_textCtrl
->CreateAccessible();
375 m_textCtrl
->SetHelpText(wxT("This is a sample wxWidgets multiline text control."));
377 splitter
->SplitHorizontally(listBox
, m_textCtrl
, 150);
380 wxScrolledWindow
* scrolledWindow
= new wxScrolledWindow(this, wxID_ANY
);
381 scrolledWindow
->SetAccessible(new ScrolledWindowAccessible(scrolledWindow
));
388 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
390 // true is to force the frame to close
394 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
397 msg
.Printf( wxT("This is the About dialog of the AccessTest sample.\n")
398 wxT("Welcome to %s"), wxVERSION_STRING
);
400 wxMessageBox(msg
, wxT("About AccessTest"), wxOK
| wxICON_INFORMATION
, this);
403 void MyFrame::OnQuery(wxCommandEvent
& WXUNUSED(event
))
406 IAccessible
* accessibleFrame
= NULL
;
407 if (S_OK
!= AccessibleObjectFromWindow((HWND
) GetHWND(), OBJID_CLIENT
,
408 IID_IAccessible
, (void**) & accessibleFrame
))
410 Log(wxT("Could not get object."));
415 //Log(wxT("Got an IAccessible for the frame."));
416 LogObject(0, accessibleFrame
);
417 Log(wxT("Checking children using AccessibleChildren()..."));
419 // Now check the AccessibleChildren function works OK
421 if (S_OK
!= accessibleFrame
->get_accChildCount(& childCount
))
423 Log(wxT("Could not get number of children."));
424 accessibleFrame
->Release();
427 else if (childCount
== 0)
429 Log(wxT("No children."));
430 accessibleFrame
->Release();
436 VARIANT
*var
= new VARIANT
[childCount
];
438 for (i
= 0; i
< childCount
; i
++)
440 VariantInit(& (var
[i
]));
441 var
[i
].vt
= VT_DISPATCH
;
444 if (S_OK
== AccessibleChildren(accessibleFrame
, 0, childCount
, var
, &obtained
))
446 for (i
= 0; i
< childCount
; i
++)
448 IAccessible
* childAccessible
= NULL
;
451 if (var
[i
].pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
453 var
[i
].pdispVal
->Release();
456 GetInfo(childAccessible
, 0, name
, role
);
458 str
.Printf(wxT("Found child %s/%s"), name
.c_str(), role
.c_str());
460 childAccessible
->Release();
464 var
[i
].pdispVal
->Release();
471 Log(wxT("AccessibleChildren failed."));
476 accessibleFrame
->Release();
480 // Log messages to the text control
481 void MyFrame::Log(const wxString
& text
)
485 wxString
text2(text
);
486 text2
.Replace(wxT("\n"), wxT(" "));
487 text2
.Replace(wxT("\r"), wxT(" "));
488 m_textCtrl
->SetInsertionPointEnd();
489 m_textCtrl
->WriteText(text2
+ wxT("\n"));
493 // Recursively give information about an object
494 void MyFrame::LogObject(int indent
, IAccessible
* obj
)
499 GetInfo(obj
, 0, name
, role
);
502 str
.Printf(wxT("Name = %s; Role = %s"), name
.c_str(), role
.c_str());
503 str
.Pad(indent
, wxT(' '), false);
508 if (S_OK
== obj
->get_accChildCount(& childCount
))
511 str
.Printf(wxT("There are %d children."), (int) childCount
);
512 str
.Pad(indent
, wxT(' '), false);
518 for (i
= 1; i
<= childCount
; i
++)
520 GetInfo(obj
, i
, name
, role
);
523 str
.Printf(wxT("%d) Name = %s; Role = %s"), i
, name
.c_str(), role
.c_str());
524 str
.Pad(indent
, wxT(' '), false);
531 IDispatch
* pDisp
= NULL
;
532 IAccessible
* childObject
= NULL
;
534 if (S_OK
== obj
->get_accChild(var
, & pDisp
) && pDisp
)
537 str
.Printf(wxT("This is a real object."));
538 str
.Pad(indent
+4, wxT(' '), false);
541 if (pDisp
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childObject
) == S_OK
)
543 LogObject(indent
+ 4, childObject
);
544 childObject
->Release();
551 str
.Printf(wxT("This is an element."));
552 str
.Pad(indent
+4, wxT(' '), false);
560 // Get info for a child (id > 0) or object (id == 0)
561 void MyFrame::GetInfo(IAccessible
* accessible
, int id
, wxString
& name
, wxString
& role
)
569 HRESULT hResult
= accessible
->get_accName(var
, & bStrName
);
573 name
= wxConvertStringFromOle(bStrName
);
574 SysFreeString(bStrName
);
578 name
= wxT("NO NAME");
582 VariantInit(& varRole
);
584 hResult
= accessible
->get_accRole(var
, & varRole
);
586 if (hResult
== S_OK
&& varRole
.vt
== VT_I4
)
589 GetRoleText(varRole
.lVal
, buf
, 256);
595 role
= wxT("NO ROLE");
600 * SplitterWindowAccessible implementation
603 // Gets the name of the specified object.
604 wxAccStatus
SplitterWindowAccessible::GetName(int childId
, wxString
* name
)
606 if (childId
== wxACC_SELF
)
608 * name
= wxT("Splitter window");
611 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
614 if (splitter
->IsSplit())
616 // Two windows, and the sash.
617 if (childId
== 1 || childId
== 3)
618 return wxACC_NOT_IMPLEMENTED
;
619 else if (childId
== 2)
626 // Let the framework handle the other cases.
627 return wxACC_NOT_IMPLEMENTED
;
630 // Can return either a child object, or an integer
631 // representing the child element, starting from 1.
632 wxAccStatus
SplitterWindowAccessible::HitTest(const wxPoint
& pt
, int* childId
, wxAccessible
** WXUNUSED(childObject
))
634 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
637 if (splitter
->IsSplit())
639 wxPoint clientPt
= splitter
->ScreenToClient(pt
);
640 if (splitter
->SashHitTest(clientPt
.x
, clientPt
.y
, 1))
642 // We're over the sash
648 // Let the framework handle the other cases.
649 return wxACC_NOT_IMPLEMENTED
;
652 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
653 wxAccStatus
SplitterWindowAccessible::GetLocation(wxRect
& rect
, int elementId
)
655 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
656 if (splitter
&& elementId
== 2 && splitter
->IsSplit())
658 wxSize clientSize
= splitter
->GetClientSize();
659 if (splitter
->GetSplitMode() == wxSPLIT_VERTICAL
)
661 rect
.x
= splitter
->GetSashPosition();
663 rect
.SetPosition(splitter
->ClientToScreen(rect
.GetPosition()));
664 rect
.width
= splitter
->GetSashSize();
665 rect
.height
= clientSize
.y
;
670 rect
.y
= splitter
->GetSashPosition();
671 rect
.SetPosition(splitter
->ClientToScreen(rect
.GetPosition()));
672 rect
.width
= clientSize
.x
;
673 rect
.height
= splitter
->GetSashSize();
677 // Let the framework handle the other cases.
678 return wxACC_NOT_IMPLEMENTED
;
681 // Navigates from fromId to toId/toObject.
682 wxAccStatus
SplitterWindowAccessible::Navigate(wxNavDir navDir
, int fromId
,
683 int* toId
, wxAccessible
** toObject
)
685 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
686 if (splitter
&& splitter
->IsSplit())
692 if (splitter
->GetSplitMode() != wxSPLIT_VERTICAL
)
700 else if (fromId
== 2)
703 *toObject
= splitter
->GetWindow2()->GetAccessible();
709 // below line is not executed due to earlier return
713 case wxNAVDIR_FIRSTCHILD
:
720 case wxNAVDIR_LASTCHILD
:
729 if (splitter
->GetSplitMode() != wxSPLIT_HORIZONTAL
)
737 else if (fromId
== 2)
740 *toObject
= splitter
->GetWindow1()->GetAccessible();
747 // below line is not executed due to earlier return
759 else if (fromId
== 2)
762 *toObject
= splitter
->GetWindow2()->GetAccessible();
768 // below line is not executed due to earlier return
772 case wxNAVDIR_PREVIOUS
:
780 else if (fromId
== 2)
783 *toObject
= splitter
->GetWindow1()->GetAccessible();
789 // below line is not executed due to earlier return
795 if (splitter
->GetSplitMode() != wxSPLIT_HORIZONTAL
)
803 else if (fromId
== 2)
806 *toObject
= splitter
->GetWindow2()->GetAccessible();
810 // Can't go right spatially if split horizontally.
814 // below line is not executed due to earlier return
820 if (splitter
->GetSplitMode() != wxSPLIT_VERTICAL
)
827 else if (fromId
== 2)
830 *toObject
= splitter
->GetWindow1()->GetAccessible();
835 // Can't go up spatially if split vertically.
838 // below line is not executed due to earlier return
845 // Let the framework handle the other cases.
846 return wxACC_NOT_IMPLEMENTED
;
849 // Gets the number of children.
850 wxAccStatus
SplitterWindowAccessible::GetChildCount(int* childCount
)
852 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
855 if (splitter
->IsSplit())
857 // Two windows, and the sash.
863 // No sash -- 1 or 0 windows.
864 if (splitter
->GetWindow1() || splitter
->GetWindow2())
876 // Let the framework handle the other cases.
877 return wxACC_NOT_IMPLEMENTED
;
880 // Gets the specified child (starting from 1).
881 // If *child is NULL and return value is wxACC_OK,
882 // this means that the child is a simple element and
883 // not an accessible object.
884 wxAccStatus
SplitterWindowAccessible::GetChild(int childId
, wxAccessible
** child
)
886 if (childId
== wxACC_SELF
)
892 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
895 if (splitter
->IsSplit())
897 // Two windows, and the sash.
900 *child
= splitter
->GetWindow1()->GetAccessible();
902 else if (childId
== 2)
904 *child
= NULL
; // Sash
906 else if (childId
== 3)
908 *child
= splitter
->GetWindow2()->GetAccessible();
918 // No sash -- 1 or 0 windows.
921 if (splitter
->GetWindow1())
923 *child
= splitter
->GetWindow1()->GetAccessible();
926 else if (splitter
->GetWindow2())
928 *child
= splitter
->GetWindow2()->GetAccessible();
940 // Let the framework handle the other cases.
941 return wxACC_NOT_IMPLEMENTED
;
944 // Gets the parent, or NULL.
945 wxAccStatus
SplitterWindowAccessible::GetParent(wxAccessible
** WXUNUSED(parent
))
947 return wxACC_NOT_IMPLEMENTED
;
950 // Performs the default action. childId is 0 (the action for this object)
951 // or > 0 (the action for a child).
952 // Return wxACC_NOT_SUPPORTED if there is no default action for this
953 // window (e.g. an edit control).
954 wxAccStatus
SplitterWindowAccessible::DoDefaultAction(int WXUNUSED(childId
))
956 return wxACC_NOT_IMPLEMENTED
;
959 // Gets the default action for this object (0) or > 0 (the action for a child).
960 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
961 // string if there is no action.
962 // The retrieved string describes the action that is performed on an object,
963 // not what the object does as a result. For example, a toolbar button that prints
964 // a document has a default action of "Press" rather than "Prints the current document."
965 wxAccStatus
SplitterWindowAccessible::GetDefaultAction(int childId
, wxString
* WXUNUSED(actionName
))
967 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
968 if (splitter
&& splitter
->IsSplit() && childId
== 2)
970 // No default action for the splitter.
973 // Let the framework handle the other cases.
974 return wxACC_NOT_IMPLEMENTED
;
977 // Returns the description for this object or a child.
978 wxAccStatus
SplitterWindowAccessible::GetDescription(int childId
, wxString
* description
)
980 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
983 if (splitter
->IsSplit())
987 * description
= _("The splitter window sash.");
992 // Let the framework handle the other cases.
993 return wxACC_NOT_IMPLEMENTED
;
996 // Returns help text for this object or a child, similar to tooltip text.
997 wxAccStatus
SplitterWindowAccessible::GetHelpText(int childId
, wxString
* helpText
)
999 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1002 if (splitter
->IsSplit())
1006 * helpText
= _("The splitter window sash.");
1011 // Let the framework handle the other cases.
1012 return wxACC_NOT_IMPLEMENTED
;
1015 // Returns the keyboard shortcut for this object or child.
1016 // Return e.g. ALT+K
1017 wxAccStatus
SplitterWindowAccessible::GetKeyboardShortcut(int childId
, wxString
* WXUNUSED(shortcut
))
1019 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1020 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1022 // No keyboard shortcut for the splitter.
1025 // Let the framework handle the other cases.
1026 return wxACC_NOT_IMPLEMENTED
;
1029 // Returns a role constant.
1030 wxAccStatus
SplitterWindowAccessible::GetRole(int childId
, wxAccRole
* role
)
1032 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1035 if (splitter
->IsSplit())
1039 * role
= wxROLE_SYSTEM_GRIP
;
1044 // Let the framework handle the other cases.
1045 return wxACC_NOT_IMPLEMENTED
;
1048 // Returns a state constant.
1049 wxAccStatus
SplitterWindowAccessible::GetState(int childId
, long* state
)
1051 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1052 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1054 // No particular state. Not sure what would be appropriate here.
1055 *state
= wxACC_STATE_SYSTEM_UNAVAILABLE
;
1058 // Let the framework handle the other cases.
1059 return wxACC_NOT_IMPLEMENTED
;
1062 // Returns a localized string representing the value for the object
1064 wxAccStatus
SplitterWindowAccessible::GetValue(int childId
, wxString
* strValue
)
1066 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1067 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1069 // The sash position is the value.
1071 pos
<< splitter
->GetSashPosition();
1076 // Let the framework handle the other cases.
1077 return wxACC_NOT_IMPLEMENTED
;
1080 // Selects the object or child.
1081 wxAccStatus
SplitterWindowAccessible::Select(int childId
, wxAccSelectionFlags
WXUNUSED(selectFlags
))
1083 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1084 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1086 // Can't select the sash.
1089 // Let the framework handle the other cases.
1090 return wxACC_NOT_IMPLEMENTED
;
1093 // Gets the window with the keyboard focus.
1094 // If childId is 0 and child is NULL, no object in
1095 // this subhierarchy has the focus.
1096 // If this object has the focus, child should be 'this'.
1097 wxAccStatus
SplitterWindowAccessible::GetFocus(int* WXUNUSED(childId
), wxAccessible
** WXUNUSED(child
))
1099 return wxACC_NOT_IMPLEMENTED
;
1102 // Gets a variant representing the selected children
1104 // Acceptable values:
1105 // - a null variant (IsNull() returns true)
1106 // - a list variant (GetType() == wxT("list"))
1107 // - an integer representing the selected child element,
1108 // or 0 if this object is selected (GetType() == wxT("long"))
1109 // - a "void*" pointer to a wxAccessible child object
1110 wxAccStatus
SplitterWindowAccessible::GetSelections(wxVariant
* WXUNUSED(selections
))
1112 return wxACC_NOT_IMPLEMENTED
;
1115 #endif // wxUSE_ACCESSIBILITY