Corrected some wxAccessible mistakes

Implemented some SplitterWindowAccessible functions
in sample


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-05-19 14:00:18 +00:00
parent 067ad8205c
commit a37e4a071c
5 changed files with 571 additions and 62 deletions

View File

@@ -291,9 +291,9 @@ this means that the child is a simple element and not an accessible object.
\membersection{wxAccessible::GetChildCount}\label{wxaccessiblegetchildcount} \membersection{wxAccessible::GetChildCount}\label{wxaccessiblegetchildcount}
\func{virtual wxAccStatus}{GetChildCount}{\param{int* }{childId}} \func{virtual wxAccStatus}{GetChildCount}{\param{int* }{childCount}}
Returns the number of children in {\it childId}. Returns the number of children in {\it childCount}.
\membersection{wxAccessible::GetDefaultAction}\label{wxaccessiblegetdefaultaction} \membersection{wxAccessible::GetDefaultAction}\label{wxaccessiblegetdefaultaction}
@@ -336,6 +336,7 @@ Return e.g. ALT+K.
\func{virtual wxAccStatus}{GetLocation}{\param{wxRect\& }{rect}, \param{int }{elementId}} \func{virtual wxAccStatus}{GetLocation}{\param{wxRect\& }{rect}, \param{int }{elementId}}
Returns the rectangle for this object (id is 0) or a child element (id is greater than 0). Returns the rectangle for this object (id is 0) or a child element (id is greater than 0).
{\it rect} is in screen coordinates.
\membersection{wxAccessible::GetName}\label{wxaccessiblegetname} \membersection{wxAccessible::GetName}\label{wxaccessiblegetname}
@@ -401,6 +402,8 @@ Returns a status value and object id to indicate whether the given point was on
a child object. Can return either a child object, or an integer a child object. Can return either a child object, or an integer
representing the child element, starting from 1. representing the child element, starting from 1.
{\it pt} is in screen coordinates.
\membersection{wxAccessible::Navigate}\label{wxaccessiblenavigate} \membersection{wxAccessible::Navigate}\label{wxaccessiblenavigate}
\func{virtual wxAccStatus}{Navigate}{\param{wxNavDir }{navDir}, \param{int }{fromId}, \param{int* }{toId}, \param{wxAccessible** }{toObject}} \func{virtual wxAccStatus}{Navigate}{\param{wxNavDir }{navDir}, \param{int }{fromId}, \param{int* }{toId}, \param{wxAccessible** }{toObject}}

View File

@@ -237,10 +237,12 @@ public:
// Can return either a child object, or an integer // Can return either a child object, or an integer
// representing the child element, starting from 1. // representing the child element, starting from 1.
// pt is in screen coordinates.
virtual wxAccStatus HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject)) virtual wxAccStatus HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject))
{ return wxACC_NOT_IMPLEMENTED; } { return wxACC_NOT_IMPLEMENTED; }
// Returns the rectangle for this object (id = 0) or a child element (id > 0). // Returns the rectangle for this object (id = 0) or a child element (id > 0).
// rect is in screen coordinates.
virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId)) virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId))
{ return wxACC_NOT_IMPLEMENTED; } { return wxACC_NOT_IMPLEMENTED; }
@@ -254,7 +256,7 @@ public:
{ return wxACC_NOT_IMPLEMENTED; } { return wxACC_NOT_IMPLEMENTED; }
// Gets the number of children. // Gets the number of children.
virtual wxAccStatus GetChildCount(int* WXUNUSED(childId)) virtual wxAccStatus GetChildCount(int* WXUNUSED(childCount))
{ return wxACC_NOT_IMPLEMENTED; } { return wxACC_NOT_IMPLEMENTED; }
// Gets the specified child (starting from 1). // Gets the specified child (starting from 1).

View File

@@ -1231,7 +1231,7 @@ public:
virtual wxAccStatus GetName(int childId, wxString* name); virtual wxAccStatus GetName(int childId, wxString* name);
// Gets the number of children. // Gets the number of children.
virtual wxAccStatus GetChildCount(int* childId); virtual wxAccStatus GetChildCount(int* childCount);
// Gets the specified child (starting from 1). // Gets the specified child (starting from 1).
// If *child is NULL and return value is wxACC_OK, // If *child is NULL and return value is wxACC_OK,

View File

@@ -32,6 +32,7 @@
#include "wx/access.h" #include "wx/access.h"
#include "wx/splitter.h" #include "wx/splitter.h"
#include "wx/cshelp.h"
#ifdef __WXMSW__ #ifdef __WXMSW__
#include "windows.h" #include "windows.h"
@@ -152,6 +153,13 @@ IMPLEMENT_APP(MyApp)
// 'Main program' equivalent: the program execution "starts" here // 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit() bool MyApp::OnInit()
{ {
// Note: JAWS for Windows will only speak the context-sensitive
// help if you use this help provider:
// wxHelpProvider::Set(new wxHelpControllerHelpProvider(m_helpController)).
// JAWS does not seem to be getting the help text from
// the wxAccessible object.
wxHelpProvider::Set(new wxSimpleHelpProvider());
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(_T("AccessTest wxWindows App"), MyFrame *frame = new MyFrame(_T("AccessTest wxWindows App"),
wxPoint(50, 50), wxSize(450, 340)); wxPoint(50, 50), wxSize(450, 340));
@@ -174,14 +182,12 @@ public:
// Gets the name of the specified object. // Gets the name of the specified object.
virtual wxAccStatus GetName(int childId, wxString* name) virtual wxAccStatus GetName(int childId, wxString* name)
{ {
#if 1
if (childId == wxACC_SELF) if (childId == wxACC_SELF)
{ {
* name = wxT("Julian's Frame"); * name = wxT("Julian's Frame");
return wxACC_OK; return wxACC_OK;
} }
else else
#endif
return wxACC_NOT_IMPLEMENTED; return wxACC_NOT_IMPLEMENTED;
} }
}; };
@@ -210,52 +216,36 @@ public:
SplitterWindowAccessible(wxWindow* win): wxWindowAccessible(win) {} SplitterWindowAccessible(wxWindow* win): wxWindowAccessible(win) {}
// Gets the name of the specified object. // Gets the name of the specified object.
virtual wxAccStatus GetName(int childId, wxString* name) virtual wxAccStatus GetName(int childId, wxString* name);
{
if (childId == wxACC_SELF)
{
* name = wxT("Splitter window");
return wxACC_OK;
}
else
return wxACC_NOT_IMPLEMENTED;
}
// Can return either a child object, or an integer // Can return either a child object, or an integer
// representing the child element, starting from 1. // representing the child element, starting from 1.
virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject) virtual wxAccStatus HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject);
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the rectangle for this object (id = 0) or a child element (id > 0). // Returns the rectangle for this object (id = 0) or a child element (id > 0).
virtual wxAccStatus GetLocation(wxRect& WXUNUSED(rect), int WXUNUSED(elementId)) virtual wxAccStatus GetLocation(wxRect& rect, int elementId);
{ return wxACC_NOT_IMPLEMENTED; }
// Navigates from fromId to toId/toObject. // Navigates from fromId to toId/toObject.
virtual wxAccStatus Navigate(wxNavDir WXUNUSED(navDir), int WXUNUSED(fromId), virtual wxAccStatus Navigate(wxNavDir navDir, int fromId,
int* WXUNUSED(toId), wxAccessible** WXUNUSED(toObject)) int* toId, wxAccessible** toObject);
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the number of children. // Gets the number of children.
virtual wxAccStatus GetChildCount(int* WXUNUSED(childId)) virtual wxAccStatus GetChildCount(int* childCount);
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the specified child (starting from 1). // Gets the specified child (starting from 1).
// If *child is NULL and return value is wxACC_OK, // If *child is NULL and return value is wxACC_OK,
// this means that the child is a simple element and // this means that the child is a simple element and
// not an accessible object. // not an accessible object.
virtual wxAccStatus GetChild(int WXUNUSED(childId), wxAccessible** WXUNUSED(child)) virtual wxAccStatus GetChild(int childId, wxAccessible** child);
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the parent, or NULL. // Gets the parent, or NULL.
virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent)) virtual wxAccStatus GetParent(wxAccessible** parent);
{ return wxACC_NOT_IMPLEMENTED; }
// Performs the default action. childId is 0 (the action for this object) // Performs the default action. childId is 0 (the action for this object)
// or > 0 (the action for a child). // or > 0 (the action for a child).
// Return wxACC_NOT_SUPPORTED if there is no default action for this // Return wxACC_NOT_SUPPORTED if there is no default action for this
// window (e.g. an edit control). // window (e.g. an edit control).
virtual wxAccStatus DoDefaultAction(int WXUNUSED(childId)) virtual wxAccStatus DoDefaultAction(int childId);
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the default action for this object (0) or > 0 (the action for a child). // Gets the default action for this object (0) or > 0 (the action for a child).
// Return wxACC_OK even if there is no action. actionName is the action, or the empty // Return wxACC_OK even if there is no action. actionName is the action, or the empty
@@ -263,45 +253,36 @@ public:
// The retrieved string describes the action that is performed on an object, // The retrieved string describes the action that is performed on an object,
// not what the object does as a result. For example, a toolbar button that prints // not what the object does as a result. For example, a toolbar button that prints
// a document has a default action of "Press" rather than "Prints the current document." // a document has a default action of "Press" rather than "Prints the current document."
virtual wxAccStatus GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName)) virtual wxAccStatus GetDefaultAction(int childId, wxString* actionName);
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the description for this object or a child. // Returns the description for this object or a child.
virtual wxAccStatus GetDescription(int WXUNUSED(childId), wxString* WXUNUSED(description)) virtual wxAccStatus GetDescription(int childId, wxString* description);
{ return wxACC_NOT_IMPLEMENTED; }
// Returns help text for this object or a child, similar to tooltip text. // Returns help text for this object or a child, similar to tooltip text.
virtual wxAccStatus GetHelpText(int WXUNUSED(childId), wxString* WXUNUSED(helpText)) virtual wxAccStatus GetHelpText(int childId, wxString* helpText);
{ return wxACC_NOT_IMPLEMENTED; }
// Returns the keyboard shortcut for this object or child. // Returns the keyboard shortcut for this object or child.
// Return e.g. ALT+K // Return e.g. ALT+K
virtual wxAccStatus GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut)) virtual wxAccStatus GetKeyboardShortcut(int childId, wxString* shortcut);
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a role constant. // Returns a role constant.
virtual wxAccStatus GetRole(int WXUNUSED(childId), wxAccRole* WXUNUSED(role)) virtual wxAccStatus GetRole(int childId, wxAccRole* role);
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a state constant. // Returns a state constant.
virtual wxAccStatus GetState(int WXUNUSED(childId), long* WXUNUSED(state)) virtual wxAccStatus GetState(int childId, long* state);
{ return wxACC_NOT_IMPLEMENTED; }
// Returns a localized string representing the value for the object // Returns a localized string representing the value for the object
// or child. // or child.
virtual wxAccStatus GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue)) virtual wxAccStatus GetValue(int childId, wxString* strValue);
{ return wxACC_NOT_IMPLEMENTED; }
// Selects the object or child. // Selects the object or child.
virtual wxAccStatus Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags)) virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags);
{ return wxACC_NOT_IMPLEMENTED; }
// Gets the window with the keyboard focus. // Gets the window with the keyboard focus.
// If childId is 0 and child is NULL, no object in // If childId is 0 and child is NULL, no object in
// this subhierarchy has the focus. // this subhierarchy has the focus.
// If this object has the focus, child should be 'this'. // If this object has the focus, child should be 'this'.
virtual wxAccStatus GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child)) virtual wxAccStatus GetFocus(int* childId, wxAccessible** child);
{ return wxACC_NOT_IMPLEMENTED; }
// Gets a variant representing the selected children // Gets a variant representing the selected children
// of this object. // of this object.
@@ -311,8 +292,7 @@ public:
// - an integer representing the selected child element, // - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long")) // or 0 if this object is selected (GetType() == wxT("long"))
// - a "void*" pointer to a wxAccessible child object // - a "void*" pointer to a wxAccessible child object
virtual wxAccStatus GetSelections(wxVariant* WXUNUSED(selections)) virtual wxAccStatus GetSelections(wxVariant* selections);
{ return wxACC_NOT_IMPLEMENTED; }
}; };
@@ -326,7 +306,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
{ {
m_textCtrl = NULL; m_textCtrl = NULL;
// SetAccessible(new FrameAccessible(this)); SetAccessible(new FrameAccessible(this));
// set the frame icon // set the frame icon
SetIcon(wxICON(mondrian)); SetIcon(wxICON(mondrian));
@@ -337,7 +317,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(AccessTest_About, _T("&About...\tF1"), _T("Show about dialog")); helpMenu->Append(AccessTest_About, _T("&About..."), _T("Show about dialog"));
menuFile->Append(AccessTest_Query, _T("Query"), _T("Query the window hierarchy")); menuFile->Append(AccessTest_Query, _T("Query"), _T("Query the window hierarchy"));
menuFile->AppendSeparator(); menuFile->AppendSeparator();
@@ -358,29 +338,29 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
SetStatusText(_T("Welcome to wxWindows!")); SetStatusText(_T("Welcome to wxWindows!"));
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
#if 1
wxSplitterWindow* splitter = new wxSplitterWindow(this, -1); wxSplitterWindow* splitter = new wxSplitterWindow(this, -1);
splitter->CreateAccessible(); splitter->SetAccessible(new SplitterWindowAccessible(splitter));
wxListBox* listBox = new wxListBox(splitter, -1); wxListBox* listBox = new wxListBox(splitter, -1);
listBox->Append(wxT("Cabbages"));
listBox->Append(wxT("Kings"));
listBox->Append(wxT("Sealing wax"));
listBox->Append(wxT("Strings"));
listBox->CreateAccessible(); listBox->CreateAccessible();
listBox->SetHelpText(wxT("This is a sample wxWindows listbox, with a number of items in it."));
m_textCtrl = new wxTextCtrl(splitter, -1, wxT(""), wxDefaultPosition, m_textCtrl = new wxTextCtrl(splitter, -1, wxT(""), wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE); wxDefaultSize, wxTE_MULTILINE);
m_textCtrl->CreateAccessible(); m_textCtrl->CreateAccessible();
m_textCtrl->SetHelpText(wxT("This is a sample wxWindows multiline text control."));
splitter->SplitHorizontally(listBox, m_textCtrl, 150); splitter->SplitHorizontally(listBox, m_textCtrl, 150);
#endif
#if 0 #if 0
#if 1
wxListBox* listBox = new wxListBox(this, -1);
//listBox->SetAccessible(new wxAccessible(listBox));
#else
wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this, -1); wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this, -1);
scrolledWindow->SetAccessible(new ScrolledWindowAccessible(scrolledWindow)); scrolledWindow->SetAccessible(new ScrolledWindowAccessible(scrolledWindow));
#endif #endif
#endif
} }
@@ -596,3 +576,527 @@ void MyFrame::GetInfo(IAccessible* accessible, int id, wxString& name, wxString&
role = wxT("NO ROLE"); role = wxT("NO ROLE");
} }
} }
/*
* SplitterWindowAccessible implementation
*/
// Gets the name of the specified object.
wxAccStatus SplitterWindowAccessible::GetName(int childId, wxString* name)
{
if (childId == wxACC_SELF)
{
* name = wxT("Splitter window");
return wxACC_OK;
}
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter)
{
if (splitter->IsSplit())
{
// Two windows, and the sash.
if (childId == 1 || childId == 3)
return wxACC_NOT_IMPLEMENTED;
else if (childId == 2)
{
*name = wxT("Sash");
return wxACC_OK;
}
}
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Can return either a child object, or an integer
// representing the child element, starting from 1.
wxAccStatus SplitterWindowAccessible::HitTest(const wxPoint& pt, int* childId, wxAccessible** childObject)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter)
{
if (splitter->IsSplit())
{
wxPoint clientPt = splitter->ScreenToClient(pt);
if (splitter->SashHitTest(clientPt.x, clientPt.y, 1))
{
// We're over the sash
*childId = 2;
return wxACC_OK;
}
}
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Returns the rectangle for this object (id = 0) or a child element (id > 0).
wxAccStatus SplitterWindowAccessible::GetLocation(wxRect& rect, int elementId)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter && elementId == 2 && splitter->IsSplit())
{
wxSize clientSize = splitter->GetClientSize();
if (splitter->GetSplitMode() == wxSPLIT_VERTICAL)
{
rect.x = splitter->GetSashPosition();
rect.y = 0;
rect.SetPosition(splitter->ClientToScreen(rect.GetPosition()));
rect.width = splitter->GetSashSize();
rect.height = clientSize.y;
}
else
{
rect.x = 0;
rect.y = splitter->GetSashPosition();
rect.SetPosition(splitter->ClientToScreen(rect.GetPosition()));
rect.width = clientSize.x;
rect.height = splitter->GetSashSize();
}
return wxACC_OK;
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Navigates from fromId to toId/toObject.
wxAccStatus SplitterWindowAccessible::Navigate(wxNavDir navDir, int fromId,
int* toId, wxAccessible** toObject)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter && splitter->IsSplit())
{
switch (navDir)
{
case wxNAVDIR_DOWN:
{
if (splitter->GetSplitMode() == wxSPLIT_VERTICAL)
{
// Can't go down spatially if split vertically.
return wxACC_FALSE;
}
else
{
if (fromId == 1)
{
*toId = 2;
*toObject = NULL;
return wxACC_OK;
}
else if (fromId == 2)
{
*toId = 3;
*toObject = splitter->GetWindow2()->GetAccessible();
return wxACC_OK;
}
else
return wxACC_FALSE;
}
break;
}
case wxNAVDIR_FIRSTCHILD:
{
if (fromId == 2)
return wxACC_FALSE;
}
break;
case wxNAVDIR_LASTCHILD:
{
if (fromId == 2)
return wxACC_FALSE;
}
break;
case wxNAVDIR_LEFT:
{
if (splitter->GetSplitMode() == wxSPLIT_HORIZONTAL)
{
// Can't go left spatially if split horizontally.
return wxACC_FALSE;
}
else
{
if (fromId == 3)
{
*toId = 2;
*toObject = NULL;
return wxACC_OK;
}
else if (fromId == 2)
{
*toId = 1;
*toObject = splitter->GetWindow1()->GetAccessible();
return wxACC_OK;
}
else
return wxACC_FALSE;
}
}
break;
case wxNAVDIR_NEXT:
{
if (fromId == 1)
{
*toId = 2;
*toObject = NULL;
return wxACC_OK;
}
else if (fromId == 2)
{
*toId = 3;
*toObject = splitter->GetWindow2()->GetAccessible();
return wxACC_OK;
}
else
return wxACC_FALSE;
}
break;
case wxNAVDIR_PREVIOUS:
{
if (fromId == 3)
{
*toId = 2;
*toObject = NULL;
return wxACC_OK;
}
else if (fromId == 2)
{
*toId = 1;
*toObject = splitter->GetWindow1()->GetAccessible();
return wxACC_OK;
}
else
return wxACC_FALSE;
}
break;
case wxNAVDIR_RIGHT:
{
if (splitter->GetSplitMode() == wxSPLIT_HORIZONTAL)
{
// Can't go right spatially if split horizontally.
return wxACC_FALSE;
}
else
{
if (fromId == 1)
{
*toId = 2;
*toObject = NULL;
return wxACC_OK;
}
else if (fromId == 2)
{
*toId = 3;
*toObject = splitter->GetWindow2()->GetAccessible();
return wxACC_OK;
}
else
return wxACC_FALSE;
}
}
break;
case wxNAVDIR_UP:
{
if (splitter->GetSplitMode() == wxSPLIT_VERTICAL)
{
// Can't go up spatially if split vertically.
return wxACC_FALSE;
}
else
{
if (fromId == 3)
{
*toId = 2;
return wxACC_OK;
}
else if (fromId == 2)
{
*toId = 1;
*toObject = splitter->GetWindow1()->GetAccessible();
return wxACC_OK;
}
else
return wxACC_FALSE;
}
break;
}
}
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Gets the number of children.
wxAccStatus SplitterWindowAccessible::GetChildCount(int* childCount)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter)
{
if (splitter->IsSplit())
{
// Two windows, and the sash.
*childCount = 3;
return wxACC_OK;
}
else
{
// No sash -- 1 or 0 windows.
if (splitter->GetWindow1() || splitter->GetWindow2())
{
*childCount = 1;
return wxACC_OK;
}
else
{
*childCount = 0;
return wxACC_OK;
}
}
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Gets the specified child (starting from 1).
// If *child is NULL and return value is wxACC_OK,
// this means that the child is a simple element and
// not an accessible object.
wxAccStatus SplitterWindowAccessible::GetChild(int childId, wxAccessible** child)
{
if (childId == wxACC_SELF)
{
*child = this;
return wxACC_OK;
}
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter)
{
if (splitter->IsSplit())
{
// Two windows, and the sash.
if (childId == 1)
{
*child = splitter->GetWindow1()->GetAccessible();
}
else if (childId == 2)
{
*child = NULL; // Sash
}
else if (childId == 3)
{
*child = splitter->GetWindow2()->GetAccessible();
}
else
{
return wxACC_FAIL;
}
return wxACC_OK;
}
else
{
// No sash -- 1 or 0 windows.
if (childId == 1)
{
if (splitter->GetWindow1())
{
*child = splitter->GetWindow1()->GetAccessible();
return wxACC_OK;
}
else if (splitter->GetWindow2())
{
*child = splitter->GetWindow2()->GetAccessible();
return wxACC_OK;
}
else
{
return wxACC_FAIL;
}
}
else
return wxACC_FAIL;
}
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Gets the parent, or NULL.
wxAccStatus SplitterWindowAccessible::GetParent(wxAccessible** parent)
{
return wxACC_NOT_IMPLEMENTED;
}
// Performs the default action. childId is 0 (the action for this object)
// or > 0 (the action for a child).
// Return wxACC_NOT_SUPPORTED if there is no default action for this
// window (e.g. an edit control).
wxAccStatus SplitterWindowAccessible::DoDefaultAction(int childId)
{
return wxACC_NOT_IMPLEMENTED;
}
// Gets the default action for this object (0) or > 0 (the action for a child).
// Return wxACC_OK even if there is no action. actionName is the action, or the empty
// string if there is no action.
// The retrieved string describes the action that is performed on an object,
// not what the object does as a result. For example, a toolbar button that prints
// a document has a default action of "Press" rather than "Prints the current document."
wxAccStatus SplitterWindowAccessible::GetDefaultAction(int childId, wxString* actionName)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter && splitter->IsSplit() && childId == 2)
{
// No default action for the splitter.
return wxACC_FALSE;
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Returns the description for this object or a child.
wxAccStatus SplitterWindowAccessible::GetDescription(int childId, wxString* description)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter)
{
if (splitter->IsSplit())
{
if (childId == 2)
{
* description = _("The splitter window sash.");
return wxACC_OK;
}
}
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Returns help text for this object or a child, similar to tooltip text.
wxAccStatus SplitterWindowAccessible::GetHelpText(int childId, wxString* helpText)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter)
{
if (splitter->IsSplit())
{
if (childId == 2)
{
* helpText = _("The splitter window sash.");
return wxACC_OK;
}
}
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Returns the keyboard shortcut for this object or child.
// Return e.g. ALT+K
wxAccStatus SplitterWindowAccessible::GetKeyboardShortcut(int childId, wxString* shortcut)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter && splitter->IsSplit() && childId == 2)
{
// No keyboard shortcut for the splitter.
return wxACC_FALSE;
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Returns a role constant.
wxAccStatus SplitterWindowAccessible::GetRole(int childId, wxAccRole* role)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter)
{
if (splitter->IsSplit())
{
if (childId == 2)
{
* role = wxROLE_SYSTEM_GRIP;
return wxACC_OK;
}
}
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Returns a state constant.
wxAccStatus SplitterWindowAccessible::GetState(int childId, long* state)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter && splitter->IsSplit() && childId == 2)
{
// No particular state. Not sure what would be appropriate here.
*state = wxACC_STATE_SYSTEM_UNAVAILABLE;
return wxACC_OK;
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Returns a localized string representing the value for the object
// or child.
wxAccStatus SplitterWindowAccessible::GetValue(int childId, wxString* strValue)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter && splitter->IsSplit() && childId == 2)
{
// The sash position is the value.
wxString pos;
pos << splitter->GetSashPosition();
*strValue = pos;
return wxACC_OK;
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Selects the object or child.
wxAccStatus SplitterWindowAccessible::Select(int childId, wxAccSelectionFlags selectFlags)
{
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
if (splitter && splitter->IsSplit() && childId == 2)
{
// Can't select the sash.
return wxACC_FALSE;
}
// Let the framework handle the other cases.
return wxACC_NOT_IMPLEMENTED;
}
// Gets the window with the keyboard focus.
// If childId is 0 and child is NULL, no object in
// this subhierarchy has the focus.
// If this object has the focus, child should be 'this'.
wxAccStatus SplitterWindowAccessible::GetFocus(int* childId, wxAccessible** child)
{
return wxACC_NOT_IMPLEMENTED;
}
// Gets a variant representing the selected children
// of this object.
// Acceptable values:
// - a null variant (IsNull() returns TRUE)
// - a list variant (GetType() == wxT("list"))
// - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long"))
// - a "void*" pointer to a wxAccessible child object
wxAccStatus SplitterWindowAccessible::GetSelections(wxVariant* selections)
{
return wxACC_NOT_IMPLEMENTED;
}

View File

@@ -1081,7 +1081,7 @@ STDMETHODIMP wxIAccessible::get_accKeyboardShortcut ( VARIANT varID, BSTR* pszKe
} }
wxString keyboardShortcut; wxString keyboardShortcut;
wxAccStatus status = m_pAccessible->GetHelpText(varID.lVal, & keyboardShortcut); wxAccStatus status = m_pAccessible->GetKeyboardShortcut(varID.lVal, & keyboardShortcut);
if (status == wxACC_FAIL) if (status == wxACC_FAIL)
return E_FAIL; return E_FAIL;