1 /////////////////////////////////////////////////////////////////////////////
2 // Name: accesstest.cpp
3 // Purpose: wxWindows 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" wxWindows headers)
33 #include "wx/access.h"
34 #include "wx/splitter.h"
35 #include "wx/cshelp.h"
42 #include "wx/msw/ole/oleutils.h"
43 #include "wx/msw/winundef.h"
46 #define OBJID_CLIENT 0xFFFFFFFC
51 // ----------------------------------------------------------------------------
53 // ----------------------------------------------------------------------------
55 // the application icon (under Windows and OS/2 it is in resources)
56 #if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
57 #include "mondrian.xpm"
60 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
64 // Define a new application type, each program should derive a class from wxApp
65 class MyApp
: public wxApp
68 // override base class virtuals
69 // ----------------------------
71 // this one is called on application startup and is a good place for the app
72 // initialization (doing it here and not in the ctor allows to have an error
73 // return: if OnInit() returns false, the application terminates)
74 virtual bool OnInit();
78 // Define a new frame type: this is going to be our main frame
79 class MyFrame
: public wxFrame
83 MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
,
84 long style
= wxDEFAULT_FRAME_STYLE
);
86 // event handlers (these functions should _not_ be virtual)
87 void OnQuit(wxCommandEvent
& event
);
88 void OnQuery(wxCommandEvent
& event
);
89 void OnAbout(wxCommandEvent
& event
);
91 // Log messages to the text control
92 void Log(const wxString
& text
);
94 // Recursively give information about an object
95 void LogObject(int indent
, IAccessible
* obj
);
97 // Get info for a child (id > 0) or object (id == 0)
98 void GetInfo(IAccessible
* accessible
, int id
, wxString
& name
, wxString
& role
);
100 wxTextCtrl
* m_textCtrl
;
102 // any class wishing to process wxWindows events must use this macro
103 DECLARE_EVENT_TABLE()
106 // ----------------------------------------------------------------------------
108 // ----------------------------------------------------------------------------
110 // IDs for the controls and the menu commands
116 // query the hierarchy
119 // it is important for the id corresponding to the "About" command to have
120 // this standard value as otherwise it won't be handled properly under Mac
121 // (where it is special and put into the "Apple" menu)
122 AccessTest_About
= wxID_ABOUT
125 // ----------------------------------------------------------------------------
126 // event tables and other macros for wxWindows
127 // ----------------------------------------------------------------------------
129 // the event tables connect the wxWindows events with the functions (event
130 // handlers) which process them. It can be also done at run-time, but for the
131 // simple menu events like this the static method is much simpler.
132 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
133 EVT_MENU(AccessTest_Quit
, MyFrame::OnQuit
)
134 EVT_MENU(AccessTest_Query
, MyFrame::OnQuery
)
135 EVT_MENU(AccessTest_About
, MyFrame::OnAbout
)
138 // Create a new application object: this macro will allow wxWindows to create
139 // the application object during program execution (it's better than using a
140 // static object for many reasons) and also declares the accessor function
141 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
145 // ============================================================================
147 // ============================================================================
149 // ----------------------------------------------------------------------------
150 // the application class
151 // ----------------------------------------------------------------------------
153 // 'Main program' equivalent: the program execution "starts" here
156 // Note: JAWS for Windows will only speak the context-sensitive
157 // help if you use this help provider:
158 // wxHelpProvider::Set(new wxHelpControllerHelpProvider(m_helpController)).
159 // JAWS does not seem to be getting the help text from
160 // the wxAccessible object.
161 wxHelpProvider::Set(new wxSimpleHelpProvider());
163 // create the main application window
164 MyFrame
*frame
= new MyFrame(_T("AccessTest wxWindows App"),
165 wxPoint(50, 50), wxSize(450, 340));
167 // and show it (the frames, unlike simple controls, are not shown when
168 // created initially)
171 // success: wxApp::OnRun() will be called which will enter the main message
172 // loop and the application will run. If we returned FALSE here, the
173 // application would exit immediately.
177 class FrameAccessible
: public wxWindowAccessible
180 FrameAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
182 // Gets the name of the specified object.
183 virtual wxAccStatus
GetName(int childId
, wxString
* name
)
185 if (childId
== wxACC_SELF
)
187 * name
= wxT("Julian's Frame");
191 return wxACC_NOT_IMPLEMENTED
;
195 class ScrolledWindowAccessible
: public wxWindowAccessible
198 ScrolledWindowAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
200 // Gets the name of the specified object.
201 virtual wxAccStatus
GetName(int childId
, wxString
* name
)
203 if (childId
== wxACC_SELF
)
205 * name
= wxT("My scrolled window");
209 return wxACC_NOT_IMPLEMENTED
;
213 class SplitterWindowAccessible
: public wxWindowAccessible
216 SplitterWindowAccessible(wxWindow
* win
): wxWindowAccessible(win
) {}
218 // Gets the name of the specified object.
219 virtual wxAccStatus
GetName(int childId
, wxString
* name
);
221 // Can return either a child object, or an integer
222 // representing the child element, starting from 1.
223 virtual wxAccStatus
HitTest(const wxPoint
& pt
, int* childId
, wxAccessible
** childObject
);
225 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
226 virtual wxAccStatus
GetLocation(wxRect
& rect
, int elementId
);
228 // Navigates from fromId to toId/toObject.
229 virtual wxAccStatus
Navigate(wxNavDir navDir
, int fromId
,
230 int* toId
, wxAccessible
** toObject
);
232 // Gets the number of children.
233 virtual wxAccStatus
GetChildCount(int* childCount
);
235 // Gets the specified child (starting from 1).
236 // If *child is NULL and return value is wxACC_OK,
237 // this means that the child is a simple element and
238 // not an accessible object.
239 virtual wxAccStatus
GetChild(int childId
, wxAccessible
** child
);
241 // Gets the parent, or NULL.
242 virtual wxAccStatus
GetParent(wxAccessible
** parent
);
244 // Performs the default action. childId is 0 (the action for this object)
245 // or > 0 (the action for a child).
246 // Return wxACC_NOT_SUPPORTED if there is no default action for this
247 // window (e.g. an edit control).
248 virtual wxAccStatus
DoDefaultAction(int childId
);
250 // Gets the default action for this object (0) or > 0 (the action for a child).
251 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
252 // string if there is no action.
253 // The retrieved string describes the action that is performed on an object,
254 // not what the object does as a result. For example, a toolbar button that prints
255 // a document has a default action of "Press" rather than "Prints the current document."
256 virtual wxAccStatus
GetDefaultAction(int childId
, wxString
* actionName
);
258 // Returns the description for this object or a child.
259 virtual wxAccStatus
GetDescription(int childId
, wxString
* description
);
261 // Returns help text for this object or a child, similar to tooltip text.
262 virtual wxAccStatus
GetHelpText(int childId
, wxString
* helpText
);
264 // Returns the keyboard shortcut for this object or child.
266 virtual wxAccStatus
GetKeyboardShortcut(int childId
, wxString
* shortcut
);
268 // Returns a role constant.
269 virtual wxAccStatus
GetRole(int childId
, wxAccRole
* role
);
271 // Returns a state constant.
272 virtual wxAccStatus
GetState(int childId
, long* state
);
274 // Returns a localized string representing the value for the object
276 virtual wxAccStatus
GetValue(int childId
, wxString
* strValue
);
278 // Selects the object or child.
279 virtual wxAccStatus
Select(int childId
, wxAccSelectionFlags selectFlags
);
281 // Gets the window with the keyboard focus.
282 // If childId is 0 and child is NULL, no object in
283 // this subhierarchy has the focus.
284 // If this object has the focus, child should be 'this'.
285 virtual wxAccStatus
GetFocus(int* childId
, wxAccessible
** child
);
287 // Gets a variant representing the selected children
289 // Acceptable values:
290 // - a null variant (IsNull() returns TRUE)
291 // - a list variant (GetType() == wxT("list"))
292 // - an integer representing the selected child element,
293 // or 0 if this object is selected (GetType() == wxT("long"))
294 // - a "void*" pointer to a wxAccessible child object
295 virtual wxAccStatus
GetSelections(wxVariant
* selections
);
299 // ----------------------------------------------------------------------------
301 // ----------------------------------------------------------------------------
304 MyFrame::MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
)
305 : wxFrame(NULL
, -1, title
, pos
, size
, style
)
309 SetAccessible(new FrameAccessible(this));
311 // set the frame icon
312 SetIcon(wxICON(mondrian
));
316 wxMenu
*menuFile
= new wxMenu
;
318 // the "About" item should be in the help menu
319 wxMenu
*helpMenu
= new wxMenu
;
320 helpMenu
->Append(AccessTest_About
, _T("&About..."), _T("Show about dialog"));
322 menuFile
->Append(AccessTest_Query
, _T("Query"), _T("Query the window hierarchy"));
323 menuFile
->AppendSeparator();
324 menuFile
->Append(AccessTest_Quit
, _T("E&xit\tAlt-X"), _T("Quit this program"));
326 // now append the freshly created menu to the menu bar...
327 wxMenuBar
*menuBar
= new wxMenuBar();
328 menuBar
->Append(menuFile
, _T("&File"));
329 menuBar
->Append(helpMenu
, _T("&Help"));
331 // ... and attach this menu bar to the frame
333 #endif // wxUSE_MENUS
335 #if 0 // wxUSE_STATUSBAR
336 // create a status bar just for fun (by default with 1 pane only)
338 SetStatusText(_T("Welcome to wxWindows!"));
339 #endif // wxUSE_STATUSBAR
342 wxSplitterWindow
* splitter
= new wxSplitterWindow(this, -1);
343 splitter
->SetAccessible(new SplitterWindowAccessible(splitter
));
345 wxListBox
* listBox
= new wxListBox(splitter
, -1);
346 listBox
->Append(wxT("Cabbages"));
347 listBox
->Append(wxT("Kings"));
348 listBox
->Append(wxT("Sealing wax"));
349 listBox
->Append(wxT("Strings"));
350 listBox
->CreateAccessible();
351 listBox
->SetHelpText(wxT("This is a sample wxWindows listbox, with a number of items in it."));
353 m_textCtrl
= new wxTextCtrl(splitter
, -1, wxT(""), wxDefaultPosition
,
354 wxDefaultSize
, wxTE_MULTILINE
);
355 m_textCtrl
->CreateAccessible();
356 m_textCtrl
->SetHelpText(wxT("This is a sample wxWindows multiline text control."));
358 splitter
->SplitHorizontally(listBox
, m_textCtrl
, 150);
361 wxScrolledWindow
* scrolledWindow
= new wxScrolledWindow(this, -1);
362 scrolledWindow
->SetAccessible(new ScrolledWindowAccessible(scrolledWindow
));
369 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
371 // TRUE is to force the frame to close
375 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
378 msg
.Printf( _T("This is the About dialog of the AccessTest sample.\n")
379 _T("Welcome to %s"), wxVERSION_STRING
);
381 wxMessageBox(msg
, _T("About AccessTest"), wxOK
| wxICON_INFORMATION
, this);
384 void MyFrame::OnQuery(wxCommandEvent
& WXUNUSED(event
))
387 IAccessible
* accessibleFrame
= NULL
;
388 if (S_OK
!= AccessibleObjectFromWindow((HWND
) GetHWND(), OBJID_CLIENT
,
389 IID_IAccessible
, (void**) & accessibleFrame
))
391 Log(wxT("Could not get object."));
396 //Log(wxT("Got an IAccessible for the frame."));
397 LogObject(0, accessibleFrame
);
398 Log(wxT("Checking children using AccessibleChildren()..."));
400 // Now check the AccessibleChildren function works OK
402 if (S_OK
!= accessibleFrame
->get_accChildCount(& childCount
))
404 Log(wxT("Could not get number of children."));
405 accessibleFrame
->Release();
408 else if (childCount
== 0)
410 Log(wxT("No children."));
411 accessibleFrame
->Release();
417 VARIANT
*var
= new VARIANT
[childCount
];
419 for (i
= 0; i
< childCount
; i
++)
421 VariantInit(& (var
[i
]));
422 var
[i
].vt
= VT_DISPATCH
;
425 if (S_OK
== AccessibleChildren(accessibleFrame
, 0, childCount
, var
, &obtained
))
427 for (i
= 0; i
< childCount
; i
++)
429 IAccessible
* childAccessible
= NULL
;
432 if (var
[i
].pdispVal
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childAccessible
) == S_OK
)
434 var
[i
].pdispVal
->Release();
437 GetInfo(childAccessible
, 0, name
, role
);
439 str
.Printf(wxT("Found child %s/%s"), name
.c_str(), role
.c_str());
441 childAccessible
->Release();
445 var
[i
].pdispVal
->Release();
452 Log(wxT("AccessibleChildren failed."));
457 accessibleFrame
->Release();
461 // Log messages to the text control
462 void MyFrame::Log(const wxString
& text
)
466 wxString
text2(text
);
467 text2
.Replace(wxT("\n"), wxT(" "));
468 text2
.Replace(wxT("\r"), wxT(" "));
469 m_textCtrl
->SetInsertionPointEnd();
470 m_textCtrl
->WriteText(text2
+ wxT("\n"));
474 // Recursively give information about an object
475 void MyFrame::LogObject(int indent
, IAccessible
* obj
)
480 GetInfo(obj
, 0, name
, role
);
483 str
.Printf(wxT("Name = %s; Role = %s"), name
.c_str(), role
.c_str());
484 str
.Pad(indent
, wxT(' '), FALSE
);
489 if (S_OK
== obj
->get_accChildCount(& childCount
))
492 str
.Printf(wxT("There are %d children."), (int) childCount
);
493 str
.Pad(indent
, wxT(' '), FALSE
);
499 for (i
= 1; i
<= childCount
; i
++)
501 GetInfo(obj
, i
, name
, role
);
504 str
.Printf(wxT("%d) Name = %s; Role = %s"), i
, name
.c_str(), role
.c_str());
505 str
.Pad(indent
, wxT(' '), FALSE
);
512 IDispatch
* pDisp
= NULL
;
513 IAccessible
* childObject
= NULL
;
515 if (S_OK
== obj
->get_accChild(var
, & pDisp
) && pDisp
)
518 str
.Printf(wxT("This is a real object."));
519 str
.Pad(indent
+4, wxT(' '), FALSE
);
522 if (pDisp
->QueryInterface(IID_IAccessible
, (LPVOID
*) & childObject
) == S_OK
)
524 LogObject(indent
+ 4, childObject
);
525 childObject
->Release();
532 str
.Printf(wxT("This is an element."));
533 str
.Pad(indent
+4, wxT(' '), FALSE
);
541 // Get info for a child (id > 0) or object (id == 0)
542 void MyFrame::GetInfo(IAccessible
* accessible
, int id
, wxString
& name
, wxString
& role
)
550 HRESULT hResult
= accessible
->get_accName(var
, & bStrName
);
554 name
= wxConvertStringFromOle(bStrName
);
555 SysFreeString(bStrName
);
559 name
= wxT("NO NAME");
563 VariantInit(& varRole
);
565 hResult
= accessible
->get_accRole(var
, & varRole
);
567 if (hResult
== S_OK
&& varRole
.vt
== VT_I4
)
570 GetRoleText(varRole
.lVal
, buf
, 256);
576 role
= wxT("NO ROLE");
581 * SplitterWindowAccessible implementation
584 // Gets the name of the specified object.
585 wxAccStatus
SplitterWindowAccessible::GetName(int childId
, wxString
* name
)
587 if (childId
== wxACC_SELF
)
589 * name
= wxT("Splitter window");
592 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
595 if (splitter
->IsSplit())
597 // Two windows, and the sash.
598 if (childId
== 1 || childId
== 3)
599 return wxACC_NOT_IMPLEMENTED
;
600 else if (childId
== 2)
607 // Let the framework handle the other cases.
608 return wxACC_NOT_IMPLEMENTED
;
611 // Can return either a child object, or an integer
612 // representing the child element, starting from 1.
613 wxAccStatus
SplitterWindowAccessible::HitTest(const wxPoint
& pt
, int* childId
, wxAccessible
** childObject
)
615 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
618 if (splitter
->IsSplit())
620 wxPoint clientPt
= splitter
->ScreenToClient(pt
);
621 if (splitter
->SashHitTest(clientPt
.x
, clientPt
.y
, 1))
623 // We're over the sash
629 // Let the framework handle the other cases.
630 return wxACC_NOT_IMPLEMENTED
;
633 // Returns the rectangle for this object (id = 0) or a child element (id > 0).
634 wxAccStatus
SplitterWindowAccessible::GetLocation(wxRect
& rect
, int elementId
)
636 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
637 if (splitter
&& elementId
== 2 && splitter
->IsSplit())
639 wxSize clientSize
= splitter
->GetClientSize();
640 if (splitter
->GetSplitMode() == wxSPLIT_VERTICAL
)
642 rect
.x
= splitter
->GetSashPosition();
644 rect
.SetPosition(splitter
->ClientToScreen(rect
.GetPosition()));
645 rect
.width
= splitter
->GetSashSize();
646 rect
.height
= clientSize
.y
;
651 rect
.y
= splitter
->GetSashPosition();
652 rect
.SetPosition(splitter
->ClientToScreen(rect
.GetPosition()));
653 rect
.width
= clientSize
.x
;
654 rect
.height
= splitter
->GetSashSize();
658 // Let the framework handle the other cases.
659 return wxACC_NOT_IMPLEMENTED
;
662 // Navigates from fromId to toId/toObject.
663 wxAccStatus
SplitterWindowAccessible::Navigate(wxNavDir navDir
, int fromId
,
664 int* toId
, wxAccessible
** toObject
)
666 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
667 if (splitter
&& splitter
->IsSplit())
673 if (splitter
->GetSplitMode() == wxSPLIT_VERTICAL
)
675 // Can't go down spatially if split vertically.
686 else if (fromId
== 2)
689 *toObject
= splitter
->GetWindow2()->GetAccessible();
698 case wxNAVDIR_FIRSTCHILD
:
705 case wxNAVDIR_LASTCHILD
:
714 if (splitter
->GetSplitMode() == wxSPLIT_HORIZONTAL
)
716 // Can't go left spatially if split horizontally.
727 else if (fromId
== 2)
730 *toObject
= splitter
->GetWindow1()->GetAccessible();
747 else if (fromId
== 2)
750 *toObject
= splitter
->GetWindow2()->GetAccessible();
758 case wxNAVDIR_PREVIOUS
:
766 else if (fromId
== 2)
769 *toObject
= splitter
->GetWindow1()->GetAccessible();
779 if (splitter
->GetSplitMode() == wxSPLIT_HORIZONTAL
)
781 // Can't go right spatially if split horizontally.
792 else if (fromId
== 2)
795 *toObject
= splitter
->GetWindow2()->GetAccessible();
806 if (splitter
->GetSplitMode() == wxSPLIT_VERTICAL
)
808 // Can't go up spatially if split vertically.
818 else if (fromId
== 2)
821 *toObject
= splitter
->GetWindow1()->GetAccessible();
833 // Let the framework handle the other cases.
834 return wxACC_NOT_IMPLEMENTED
;
837 // Gets the number of children.
838 wxAccStatus
SplitterWindowAccessible::GetChildCount(int* childCount
)
840 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
843 if (splitter
->IsSplit())
845 // Two windows, and the sash.
851 // No sash -- 1 or 0 windows.
852 if (splitter
->GetWindow1() || splitter
->GetWindow2())
864 // Let the framework handle the other cases.
865 return wxACC_NOT_IMPLEMENTED
;
868 // Gets the specified child (starting from 1).
869 // If *child is NULL and return value is wxACC_OK,
870 // this means that the child is a simple element and
871 // not an accessible object.
872 wxAccStatus
SplitterWindowAccessible::GetChild(int childId
, wxAccessible
** child
)
874 if (childId
== wxACC_SELF
)
880 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
883 if (splitter
->IsSplit())
885 // Two windows, and the sash.
888 *child
= splitter
->GetWindow1()->GetAccessible();
890 else if (childId
== 2)
892 *child
= NULL
; // Sash
894 else if (childId
== 3)
896 *child
= splitter
->GetWindow2()->GetAccessible();
906 // No sash -- 1 or 0 windows.
909 if (splitter
->GetWindow1())
911 *child
= splitter
->GetWindow1()->GetAccessible();
914 else if (splitter
->GetWindow2())
916 *child
= splitter
->GetWindow2()->GetAccessible();
928 // Let the framework handle the other cases.
929 return wxACC_NOT_IMPLEMENTED
;
932 // Gets the parent, or NULL.
933 wxAccStatus
SplitterWindowAccessible::GetParent(wxAccessible
** parent
)
935 return wxACC_NOT_IMPLEMENTED
;
938 // Performs the default action. childId is 0 (the action for this object)
939 // or > 0 (the action for a child).
940 // Return wxACC_NOT_SUPPORTED if there is no default action for this
941 // window (e.g. an edit control).
942 wxAccStatus
SplitterWindowAccessible::DoDefaultAction(int childId
)
944 return wxACC_NOT_IMPLEMENTED
;
947 // Gets the default action for this object (0) or > 0 (the action for a child).
948 // Return wxACC_OK even if there is no action. actionName is the action, or the empty
949 // string if there is no action.
950 // The retrieved string describes the action that is performed on an object,
951 // not what the object does as a result. For example, a toolbar button that prints
952 // a document has a default action of "Press" rather than "Prints the current document."
953 wxAccStatus
SplitterWindowAccessible::GetDefaultAction(int childId
, wxString
* actionName
)
955 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
956 if (splitter
&& splitter
->IsSplit() && childId
== 2)
958 // No default action for the splitter.
961 // Let the framework handle the other cases.
962 return wxACC_NOT_IMPLEMENTED
;
965 // Returns the description for this object or a child.
966 wxAccStatus
SplitterWindowAccessible::GetDescription(int childId
, wxString
* description
)
968 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
971 if (splitter
->IsSplit())
975 * description
= _("The splitter window sash.");
980 // Let the framework handle the other cases.
981 return wxACC_NOT_IMPLEMENTED
;
984 // Returns help text for this object or a child, similar to tooltip text.
985 wxAccStatus
SplitterWindowAccessible::GetHelpText(int childId
, wxString
* helpText
)
987 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
990 if (splitter
->IsSplit())
994 * helpText
= _("The splitter window sash.");
999 // Let the framework handle the other cases.
1000 return wxACC_NOT_IMPLEMENTED
;
1003 // Returns the keyboard shortcut for this object or child.
1004 // Return e.g. ALT+K
1005 wxAccStatus
SplitterWindowAccessible::GetKeyboardShortcut(int childId
, wxString
* shortcut
)
1007 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1008 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1010 // No keyboard shortcut for the splitter.
1013 // Let the framework handle the other cases.
1014 return wxACC_NOT_IMPLEMENTED
;
1017 // Returns a role constant.
1018 wxAccStatus
SplitterWindowAccessible::GetRole(int childId
, wxAccRole
* role
)
1020 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1023 if (splitter
->IsSplit())
1027 * role
= wxROLE_SYSTEM_GRIP
;
1032 // Let the framework handle the other cases.
1033 return wxACC_NOT_IMPLEMENTED
;
1036 // Returns a state constant.
1037 wxAccStatus
SplitterWindowAccessible::GetState(int childId
, long* state
)
1039 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1040 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1042 // No particular state. Not sure what would be appropriate here.
1043 *state
= wxACC_STATE_SYSTEM_UNAVAILABLE
;
1046 // Let the framework handle the other cases.
1047 return wxACC_NOT_IMPLEMENTED
;
1050 // Returns a localized string representing the value for the object
1052 wxAccStatus
SplitterWindowAccessible::GetValue(int childId
, wxString
* strValue
)
1054 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1055 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1057 // The sash position is the value.
1059 pos
<< splitter
->GetSashPosition();
1064 // Let the framework handle the other cases.
1065 return wxACC_NOT_IMPLEMENTED
;
1068 // Selects the object or child.
1069 wxAccStatus
SplitterWindowAccessible::Select(int childId
, wxAccSelectionFlags selectFlags
)
1071 wxSplitterWindow
* splitter
= wxDynamicCast(GetWindow(), wxSplitterWindow
);
1072 if (splitter
&& splitter
->IsSplit() && childId
== 2)
1074 // Can't select the sash.
1077 // Let the framework handle the other cases.
1078 return wxACC_NOT_IMPLEMENTED
;
1081 // Gets the window with the keyboard focus.
1082 // If childId is 0 and child is NULL, no object in
1083 // this subhierarchy has the focus.
1084 // If this object has the focus, child should be 'this'.
1085 wxAccStatus
SplitterWindowAccessible::GetFocus(int* childId
, wxAccessible
** child
)
1087 return wxACC_NOT_IMPLEMENTED
;
1090 // Gets a variant representing the selected children
1092 // Acceptable values:
1093 // - a null variant (IsNull() returns TRUE)
1094 // - a list variant (GetType() == wxT("list"))
1095 // - an integer representing the selected child element,
1096 // or 0 if this object is selected (GetType() == wxT("long"))
1097 // - a "void*" pointer to a wxAccessible child object
1098 wxAccStatus
SplitterWindowAccessible::GetSelections(wxVariant
* selections
)
1100 return wxACC_NOT_IMPLEMENTED
;