Version: 3.2.5
wxAccessible Class Reference

#include <wx/access.h>

+ Inheritance diagram for wxAccessible:

Detailed Description

The wxAccessible class allows wxWidgets applications, and wxWidgets itself, to return extended information about user interface elements to client applications such as screen readers.

This is the main way in which wxWidgets implements accessibility features.

At present, only Microsoft Active Accessibility is supported by this class.

To use this class, derive from wxAccessible, implement appropriate functions, and associate an object of the class with a window using wxWindow::SetAccessible.

All functions return an indication of success, failure, or not implemented using values of the wxAccStatus enum type.

If you return wxACC_NOT_IMPLEMENTED from any function, the system will try to implement the appropriate functionality. However this will not work with all functions.

Most functions work with an object id, which can be zero to refer to 'this' UI element, or greater than zero to refer to the nth child element. This allows you to specify elements that don't have a corresponding wxWindow or wxAccessible; for example, the sash of a splitter window.

For details on the semantics of functions and types, please refer to the Microsoft Active Accessibility 1.2 documentation.

This class is compiled into wxWidgets only if the wxUSE_ACCESSIBILITY setup symbol is set to 1.

Availability:  only available for the wxMSW port.

Library:  wxCore
Category:  Miscellaneous
See also
Accessibility Sample

Public Member Functions

 wxAccessible (wxWindow *win=NULL)
 Constructor, taking an optional window. More...
 
 ~wxAccessible ()
 Destructor. More...
 
virtual wxAccStatus DoDefaultAction (int childId)
 Performs the default action for the object. More...
 
virtual wxAccStatus GetChild (int childId, wxAccessible **child)
 Gets the specified child (starting from 1). More...
 
virtual wxAccStatus GetChildCount (int *childCount)
 Returns the number of children in childCount. More...
 
virtual wxAccStatus GetDefaultAction (int childId, wxString *actionName)
 Gets the default action for this object (0) or a child (greater than 0). More...
 
virtual wxAccStatus GetDescription (int childId, wxString *description)
 Returns the description for this object or a child. More...
 
virtual wxAccStatus GetFocus (int *childId, wxAccessible **child)
 Gets the window with the keyboard focus. More...
 
virtual wxAccStatus GetHelpText (int childId, wxString *helpText)
 Returns help text for this object or a child, similar to tooltip text. More...
 
virtual wxAccStatus GetKeyboardShortcut (int childId, wxString *shortcut)
 Returns the keyboard shortcut for this object or child. More...
 
virtual wxAccStatus GetLocation (wxRect &rect, int elementId)
 Returns the rectangle for this object (id is 0) or a child element (id is greater than 0). More...
 
virtual wxAccStatus GetName (int childId, wxString *name)
 Gets the name of the specified object. More...
 
virtual wxAccStatus GetParent (wxAccessible **parent)
 Returns the parent of this object, or NULL. More...
 
virtual wxAccStatus GetRole (int childId, wxAccRole *role)
 Returns a role constant describing this object. More...
 
virtual wxAccStatus GetSelections (wxVariant *selections)
 Gets a variant representing the selected children of this object. More...
 
virtual wxAccStatus GetState (int childId, long *state)
 Returns a state constant. More...
 
virtual wxAccStatus GetValue (int childId, wxString *strValue)
 Returns a localized string representing the value for the object or child. More...
 
wxWindowGetWindow ()
 Returns the window associated with this object. More...
 
virtual wxAccStatus HitTest (const wxPoint &pt, int *childId, wxAccessible **childObject)
 Returns a status value and object id to indicate whether the given point was on this or a child object. More...
 
virtual wxAccStatus Navigate (wxNavDir navDir, int fromId, int *toId, wxAccessible **toObject)
 Navigates from fromId to toId or to toObject. More...
 
virtual wxAccStatus Select (int childId, wxAccSelectionFlags selectFlags)
 Selects the object or child. More...
 
void SetWindow (wxWindow *window)
 Sets the window associated with this object. More...
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data. More...
 
 wxObject (const wxObject &other)
 Copy ctor. More...
 
virtual ~wxObject ()
 Destructor. More...
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class. More...
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj. More...
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone. More...
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer. More...
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public. More...
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 
void * operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 

Static Public Member Functions

static void NotifyEvent (int eventType, wxWindow *window, wxAccObject objectType, int objectId)
 Allows the application to send an event when something changes in an accessible object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object. More...
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Constructor & Destructor Documentation

◆ wxAccessible()

wxAccessible::wxAccessible ( wxWindow win = NULL)

Constructor, taking an optional window.

The object can be associated with a window later.

◆ ~wxAccessible()

wxAccessible::~wxAccessible ( )

Destructor.

Member Function Documentation

◆ DoDefaultAction()

virtual wxAccStatus wxAccessible::DoDefaultAction ( int  childId)
virtual

Performs the default action for the object.

childId is 0 (the action for this object) or greater than 0 (the action for a child).

Returns
wxACC_NOT_SUPPORTED if there is no default action for this window (e.g. an edit control).

◆ GetChild()

virtual wxAccStatus wxAccessible::GetChild ( int  childId,
wxAccessible **  child 
)
virtual

Gets the specified child (starting from 1).

If child is NULL and the return value is wxACC_OK, this means that the child is a simple element and not an accessible object.

◆ GetChildCount()

virtual wxAccStatus wxAccessible::GetChildCount ( int *  childCount)
virtual

Returns the number of children in childCount.

◆ GetDefaultAction()

virtual wxAccStatus wxAccessible::GetDefaultAction ( int  childId,
wxString actionName 
)
virtual

Gets the default action for this object (0) or a child (greater than 0).

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."

◆ GetDescription()

virtual wxAccStatus wxAccessible::GetDescription ( int  childId,
wxString description 
)
virtual

Returns the description for this object or a child.

◆ GetFocus()

virtual wxAccStatus wxAccessible::GetFocus ( int *  childId,
wxAccessible **  child 
)
virtual

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'.

◆ GetHelpText()

virtual wxAccStatus wxAccessible::GetHelpText ( int  childId,
wxString helpText 
)
virtual

Returns help text for this object or a child, similar to tooltip text.

◆ GetKeyboardShortcut()

virtual wxAccStatus wxAccessible::GetKeyboardShortcut ( int  childId,
wxString shortcut 
)
virtual

Returns the keyboard shortcut for this object or child.

Returns e.g. ALT+K.

◆ GetLocation()

virtual wxAccStatus wxAccessible::GetLocation ( wxRect rect,
int  elementId 
)
virtual

Returns the rectangle for this object (id is 0) or a child element (id is greater than 0).

rect is in screen coordinates.

◆ GetName()

virtual wxAccStatus wxAccessible::GetName ( int  childId,
wxString name 
)
virtual

Gets the name of the specified object.

◆ GetParent()

virtual wxAccStatus wxAccessible::GetParent ( wxAccessible **  parent)
virtual

Returns the parent of this object, or NULL.

◆ GetRole()

virtual wxAccStatus wxAccessible::GetRole ( int  childId,
wxAccRole role 
)
virtual

Returns a role constant describing this object.

See wxAccRole for a list of these roles.

◆ GetSelections()

virtual wxAccStatus wxAccessible::GetSelections ( wxVariant selections)
virtual

Gets a variant representing the selected children of this object.

Acceptable values are:

  • a null variant (IsNull() returns true) if no children are selected
  • a void* pointer to a wxAccessible of selected child object
  • an integer representing the selected child element, or 0 if this object is selected (GetType() == "long")
  • a list variant (GetType() == "list") if multiple child objects are selected

◆ GetState()

virtual wxAccStatus wxAccessible::GetState ( int  childId,
long *  state 
)
virtual

Returns a state constant.

See wxAccStatus for a list of these states.

◆ GetValue()

virtual wxAccStatus wxAccessible::GetValue ( int  childId,
wxString strValue 
)
virtual

Returns a localized string representing the value for the object or child.

◆ GetWindow()

wxWindow* wxAccessible::GetWindow ( )

Returns the window associated with this object.

◆ HitTest()

virtual wxAccStatus wxAccessible::HitTest ( const wxPoint pt,
int *  childId,
wxAccessible **  childObject 
)
virtual

Returns a status value and object id to indicate whether the given point was on this or a child object.

Can return either a child object, or an integer representing the child element, starting from 1.

pt is in screen coordinates.

◆ Navigate()

virtual wxAccStatus wxAccessible::Navigate ( wxNavDir  navDir,
int  fromId,
int *  toId,
wxAccessible **  toObject 
)
virtual

Navigates from fromId to toId or to toObject.

◆ NotifyEvent()

static void wxAccessible::NotifyEvent ( int  eventType,
wxWindow window,
wxAccObject  objectType,
int  objectId 
)
static

Allows the application to send an event when something changes in an accessible object.

◆ Select()

virtual wxAccStatus wxAccessible::Select ( int  childId,
wxAccSelectionFlags  selectFlags 
)
virtual

Selects the object or child.

See wxAccSelectionFlags for a list of the selection actions.

◆ SetWindow()

void wxAccessible::SetWindow ( wxWindow window)

Sets the window associated with this object.