$szTitle = "wxaccessible"; include "./_header.inc"; ?>
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.
derived from
include files
<wx/access.h>
data structures
functions return a wxaccstatus error code, which may be one of the following:
typedef enum
{
wxacc_fail, // the function failed
wxacc_false, // the function returned false
wxacc_ok, // the function completed successfully
wxacc_not_implemented, // the function is not implemented
wxacc_not_supported // the function is not supported
} wxaccstatus
directions of navigation are represented by the following:
typedef enum
{
wxnavdir_down,
wxnavdir_firstchild,
wxnavdir_lastchild,
wxnavdir_left,
wxnavdir_next,
wxnavdir_previous,
wxnavdir_right,
wxnavdir_up
} wxnavdir
the role of a user interface element is represented by the following type:
typedef enum {
wxrole_none,
wxrole_system_alert,
wxrole_system_animation,
wxrole_system_application,
wxrole_system_border,
wxrole_system_buttondropdown,
wxrole_system_buttondropdowngrid,
wxrole_system_buttonmenu,
wxrole_system_caret,
wxrole_system_cell,
wxrole_system_character,
wxrole_system_chart,
wxrole_system_checkbutton,
wxrole_system_client,
wxrole_system_clock,
wxrole_system_column,
wxrole_system_columnheader,
wxrole_system_combobox,
wxrole_system_cursor,
wxrole_system_diagram,
wxrole_system_dial,
wxrole_system_dialog,
wxrole_system_document,
wxrole_system_droplist,
wxrole_system_equation,
wxrole_system_graphic,
wxrole_system_grip,
wxrole_system_grouping,
wxrole_system_helpballoon,
wxrole_system_hotkeyfield,
wxrole_system_indicator,
wxrole_system_link,
wxrole_system_list,
wxrole_system_listitem,
wxrole_system_menubar,
wxrole_system_menuitem,
wxrole_system_menupopup,
wxrole_system_outline,
wxrole_system_outlineitem,
wxrole_system_pagetab,
wxrole_system_pagetablist,
wxrole_system_pane,
wxrole_system_progressbar,
wxrole_system_propertypage,
wxrole_system_pushbutton,
wxrole_system_radiobutton,
wxrole_system_row,
wxrole_system_rowheader,
wxrole_system_scrollbar,
wxrole_system_separator,
wxrole_system_slider,
wxrole_system_sound,
wxrole_system_spinbutton,
wxrole_system_statictext,
wxrole_system_statusbar,
wxrole_system_table,
wxrole_system_text,
wxrole_system_titlebar,
wxrole_system_toolbar,
wxrole_system_tooltip,
wxrole_system_whitespace,
wxrole_system_window
} wxaccrole
objects are represented by the following type:
typedef enum {
wxobjid_window = 0x00000000,
wxobjid_sysmenu = 0xffffffff,
wxobjid_titlebar = 0xfffffffe,
wxobjid_menu = 0xfffffffd,
wxobjid_client = 0xfffffffc,
wxobjid_vscroll = 0xfffffffb,
wxobjid_hscroll = 0xfffffffa,
wxobjid_sizegrip = 0xfffffff9,
wxobjid_caret = 0xfffffff8,
wxobjid_cursor = 0xfffffff7,
wxobjid_alert = 0xfffffff6,
wxobjid_sound = 0xfffffff5
} wxaccobject
selection actions are identified by this type:
typedef enum
{
wxacc_sel_none = 0,
wxacc_sel_takefocus = 1,
wxacc_sel_takeselection = 2,
wxacc_sel_extendselection = 4,
wxacc_sel_addselection = 8,
wxacc_sel_removeselection = 16
} wxaccselectionflags
states are represented by the following:
#define wxacc_state_system_alert_high 0x00000001
#define wxacc_state_system_alert_medium 0x00000002
#define wxacc_state_system_alert_low 0x00000004
#define wxacc_state_system_animated 0x00000008
#define wxacc_state_system_busy 0x00000010
#define wxacc_state_system_checked 0x00000020
#define wxacc_state_system_collapsed 0x00000040
#define wxacc_state_system_default 0x00000080
#define wxacc_state_system_expanded 0x00000100
#define wxacc_state_system_extselectable 0x00000200
#define wxacc_state_system_floating 0x00000400
#define wxacc_state_system_focusable 0x00000800
#define wxacc_state_system_focused 0x00001000
#define wxacc_state_system_hottracked 0x00002000
#define wxacc_state_system_invisible 0x00004000
#define wxacc_state_system_marqueed 0x00008000
#define wxacc_state_system_mixed 0x00010000
#define wxacc_state_system_multiselectable 0x00020000
#define wxacc_state_system_offscreen 0x00040000
#define wxacc_state_system_pressed 0x00080000
#define wxacc_state_system_protected 0x00100000
#define wxacc_state_system_readonly 0x00200000
#define wxacc_state_system_selectable 0x00400000
#define wxacc_state_system_selected 0x00800000
#define wxacc_state_system_selfvoicing 0x01000000
#define wxacc_state_system_unavailable 0x02000000
event identifiers that can be sent via wxaccessible::notifyevent are as follows:
#define wxacc_event_system_sound 0x0001
#define wxacc_event_system_alert 0x0002
#define wxacc_event_system_foreground 0x0003
#define wxacc_event_system_menustart 0x0004
#define wxacc_event_system_menuend 0x0005
#define wxacc_event_system_menupopupstart 0x0006
#define wxacc_event_system_menupopupend 0x0007
#define wxacc_event_system_capturestart 0x0008
#define wxacc_event_system_captureend 0x0009
#define wxacc_event_system_movesizestart 0x000a
#define wxacc_event_system_movesizeend 0x000b
#define wxacc_event_system_contexthelpstart 0x000c
#define wxacc_event_system_contexthelpend 0x000d
#define wxacc_event_system_dragdropstart 0x000e
#define wxacc_event_system_dragdropend 0x000f
#define wxacc_event_system_dialogstart 0x0010
#define wxacc_event_system_dialogend 0x0011
#define wxacc_event_system_scrollingstart 0x0012
#define wxacc_event_system_scrollingend 0x0013
#define wxacc_event_system_switchstart 0x0014
#define wxacc_event_system_switchend 0x0015
#define wxacc_event_system_minimizestart 0x0016
#define wxacc_event_system_minimizeend 0x0017
#define wxacc_event_object_create 0x8000
#define wxacc_event_object_destroy 0x8001
#define wxacc_event_object_show 0x8002
#define wxacc_event_object_hide 0x8003
#define wxacc_event_object_reorder 0x8004
#define wxacc_event_object_focus 0x8005
#define wxacc_event_object_selection 0x8006
#define wxacc_event_object_selectionadd 0x8007
#define wxacc_event_object_selectionremove 0x8008
#define wxacc_event_object_selectionwithin 0x8009
#define wxacc_event_object_statechange 0x800a
#define wxacc_event_object_locationchange 0x800b
#define wxacc_event_object_namechange 0x800c
#define wxacc_event_object_descriptionchange 0x800d
#define wxacc_event_object_valuechange 0x800e
#define wxacc_event_object_parentchange 0x800f
#define wxacc_event_object_helpchange 0x8010
#define wxacc_event_object_defactionchange 0x8011
#define wxacc_event_object_acceleratorchange 0x8012
members
wxaccessible::wxaccessible
wxaccessible::~wxaccessible
wxaccessible::dodefaultaction
wxaccessible::getchild
wxaccessible::getchildcount
wxaccessible::getdefaultaction
wxaccessible::getdescription
wxaccessible::getfocus
wxaccessible::gethelptext
wxaccessible::getkeyboardshortcut
wxaccessible::getlocation
wxaccessible::getname
wxaccessible::getparent
wxaccessible::getrole
wxaccessible::getselections
wxaccessible::getstate
wxaccessible::getvalue
wxaccessible::getwindow
wxaccessible::hittest
wxaccessible::navigate
wxaccessible::notifyevent
wxaccessible::select
wxaccessible::setwindow
wxaccessible(wxwindow* win = null)
constructor, taking an optional window. the object can be associated with a window later.
~wxaccessible()
destructor.
virtual wxaccstatus dodefaultaction(int childid)
performs the default action for the object. childid is 0 (the action for this object) or greater than 0 (the action for a child). return wxacc_not_supported if there is no default action for this window (e.g. an edit control).
virtual wxaccstatus getchild(int childid, wxaccessible** child)
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.
virtual wxaccstatus getchildcount(int* childcount)
returns the number of children in childcount.
virtual wxaccstatus getdefaultaction(int childid, wxstring* actionname)
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."
virtual wxaccstatus getdescription(int childid, wxstring* description)
returns the description for this object or a child.
virtual wxaccstatus getfocus(int* childid, wxaccessible** child)
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'.
virtual wxaccstatus gethelptext(int childid, wxstring* helptext)
returns help text for this object or a child, similar to tooltip text.
virtual wxaccstatus getkeyboardshortcut(int childid, wxstring* shortcut)
returns the keyboard shortcut for this object or child. return e.g. alt+k.
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). rect is in screen coordinates.
virtual wxaccstatus getname(int childid, wxstring* name)
gets the name of the specified object.
virtual wxaccstatus getparent(wxaccessible** parent)
returns the parent of this object, or null.
virtual wxaccstatus getrole(int childid, wxaccrole* role)
returns a role constant describing this object. see wxaccessible for a list of these roles.
virtual wxaccstatus getselections(wxvariant* selections)
gets a variant representing the selected children of this object.
acceptable values are:
virtual wxaccstatus getstate(int childid, long* state)
returns a state constant. see wxaccessible for a list of these states.
virtual wxaccstatus getvalue(int childid, wxstring* strvalue)
returns a localized string representing the value for the object or child.
wxwindow* getwindow()
returns the window associated with this object.
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. can return either a child object, or an integer representing the child element, starting from 1.
pt is in screen coordinates.
virtual wxaccstatus navigate(wxnavdir navdir, int fromid, int* toid, wxaccessible** toobject)
navigates from fromid to toid/toobject.
virtual static void notifyevent(int eventtype, wxwindow* window, wxaccobject objecttype, int objecttype)
allows the application to send an event when something changes in an accessible object.
virtual wxaccstatus select(int childid, wxaccselectionflags selectflags)
selects the object or child. see wxaccessible for a list of the selection actions.
void setwindow(wxwindow* window)
sets the window associated with this object.
include "./_footer.inc"; ?>