a11y: Document roles of widgets

Add a section to the long description for each
widget that is using a non-default accessible role.
This commit is contained in:
Matthias Clasen 2020-07-27 10:46:52 -04:00
parent 790db8db53
commit d90f79de0e
10 changed files with 87 additions and 47 deletions

View File

@ -49,6 +49,10 @@
* #GtkLockButton, #GtkColorButton or #GtkFontButton use style classes such as * #GtkLockButton, #GtkColorButton or #GtkFontButton use style classes such as
* .toggle, .popup, .scale, .lock, .color on the button node * .toggle, .popup, .scale, .lock, .color on the button node
* to differentiate themselves from a plain GtkButton. * to differentiate themselves from a plain GtkButton.
*
* # Accessibility
*
* GtkButton uses the #GTK_ACCESSIBLE_ROLE_BUTTON role.
*/ */
#include "config.h" #include "config.h"

View File

@ -73,6 +73,10 @@
* A GtkCheckButton without indicator changes the name of its main node * A GtkCheckButton without indicator changes the name of its main node
* to button and adds a .check style class to it. The subnode is invisible * to button and adds a .check style class to it. The subnode is invisible
* in this case. * in this case.
*
* # Accessibility
*
* GtkCheckButton uses the #GTK_ACCESSIBLE_ROLE_CHECKBOX role.
*/ */
typedef struct { typedef struct {

View File

@ -157,6 +157,10 @@
* </action-widgets> * </action-widgets>
* </object> * </object>
* ]| * ]|
*
* # Accessibility
*
* GtkDialog uses the #GTK_ACCESSIBLE_ROLE_DIALOG role.
*/ */
typedef struct _ResponseData ResponseData; typedef struct _ResponseData ResponseData;

View File

@ -85,6 +85,10 @@
* .right, .top or .bottom added when the progress 'touches' the corresponding * .right, .top or .bottom added when the progress 'touches' the corresponding
* end of the GtkProgressBar. The .osd class on the progressbar node is for use * end of the GtkProgressBar. The .osd class on the progressbar node is for use
* in overlays like the one Epiphany has for page loading progress. * in overlays like the one Epiphany has for page loading progress.
*
* # Accessibility
*
* GtkProgressBar uses the #GTK_ACCESSIBLE_ROLE_PROGRESS_BAR role.
*/ */
typedef struct _GtkProgressBarClass GtkProgressBarClass; typedef struct _GtkProgressBarClass GtkProgressBarClass;

View File

@ -69,27 +69,6 @@
* The group list does not need to be freed, as each #GtkRadioButton will remove * The group list does not need to be freed, as each #GtkRadioButton will remove
* itself and its list item when it is destroyed. * itself and its list item when it is destroyed.
* *
* # CSS nodes
*
* |[<!-- language="plain" -->
* radiobutton
* radio
* <child>
* ]|
*
* A GtkRadioButton with indicator (see gtk_check_button_set_draw_indicator())) has a
* main CSS node with name radiobutton and a subnode with name radio.
*
* |[<!-- language="plain" -->
* button.radio
* radio
* <child>
* ]|
*
* A GtkRadioButton without indicator changes the name of its main node
* to button and adds a .radio style class to it. The subnode is invisible
* in this case.
*
* ## How to create a group of two radio buttons. * ## How to create a group of two radio buttons.
* *
* |[<!-- language="C" --> * |[<!-- language="C" -->
@ -124,6 +103,31 @@
* selected button. * selected button.
* Inside the #GtkToggleButton::toggled handler, gtk_toggle_button_get_active() * Inside the #GtkToggleButton::toggled handler, gtk_toggle_button_get_active()
* can be used to determine if the button has been selected or deselected. * can be used to determine if the button has been selected or deselected.
*
* # CSS nodes
*
* |[<!-- language="plain" -->
* radiobutton
* radio
* <child>
* ]|
*
* A GtkRadioButton with indicator (see gtk_check_button_set_draw_indicator())) has a
* main CSS node with name radiobutton and a subnode with name radio.
*
* |[<!-- language="plain" -->
* button.radio
* radio
* <child>
* ]|
*
* A GtkRadioButton without indicator changes the name of its main node
* to button and adds a .radio style class to it. The subnode is invisible
* in this case.
*
* # Accessibility
*
* GtkRadioButton uses the #GTK_ACCESSIBLE_ROLE_RADIO role.
*/ */
typedef struct _GtkRadioButtonClass GtkRadioButtonClass; typedef struct _GtkRadioButtonClass GtkRadioButtonClass;

View File

@ -125,6 +125,10 @@
* If the scale is displaying the value (see #GtkScale:draw-value), there is * If the scale is displaying the value (see #GtkScale:draw-value), there is
* subnode with name value. This node will get the .top or .bottom style classes * subnode with name value. This node will get the .top or .bottom style classes
* similar to the marks node. * similar to the marks node.
*
* # Accessibility
*
* GtkScale uses the #GTK_ACCESSIBLE_ROLE_SLIDER role.
*/ */

View File

@ -78,6 +78,10 @@
* Other style classes that may be added to scrollbars inside #GtkScrolledWindow * Other style classes that may be added to scrollbars inside #GtkScrolledWindow
* include the positional classes (.left, .right, .top, .bottom) and style * include the positional classes (.left, .right, .top, .bottom) and style
* classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering). * classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering).
*
* # Accessibility
*
* GtkScrollbar uses the #GTK_ACCESSIBLE_ROLE_SCROLLBAR role.
*/ */
typedef struct _GtkScrollbarClass GtkScrollbarClass; typedef struct _GtkScrollbarClass GtkScrollbarClass;

View File

@ -46,6 +46,10 @@
* *
* GtkSeparator has a single CSS node with name separator. The node * GtkSeparator has a single CSS node with name separator. The node
* gets one of the .horizontal or .vertical style classes. * gets one of the .horizontal or .vertical style classes.
*
* # Accessibility
*
* GtkSeparator uses the #GTK_ACCESSIBLE_ROLE_SEPARATOR role.
*/ */
typedef struct _GtkSeparatorClass GtkSeparatorClass; typedef struct _GtkSeparatorClass GtkSeparatorClass;

View File

@ -90,32 +90,6 @@
* not desired, the automatic sizing can be turned off by explicitly * not desired, the automatic sizing can be turned off by explicitly
* setting #GtkSpinButton::width-chars to a value != -1. * setting #GtkSpinButton::width-chars to a value != -1.
* *
* # CSS nodes
*
* |[<!-- language="plain" -->
* spinbutton.horizontal
* text
* undershoot.left
* undershoot.right
* button.down
* button.up
* ]|
*
* |[<!-- language="plain" -->
* spinbutton.vertical
* button.up
* text
* undershoot.left
* undershoot.right
* button.down
* ]|
*
* GtkSpinButtons main CSS node has the name spinbutton. It creates subnodes
* for the entry and the two buttons, with these names. The button nodes have
* the style classes .up and .down. The GtkText subnodes (if present) are put
* below the text node. The orientation of the spin button is reflected in
* the .vertical or .horizontal style class on the main node.
*
* ## Using a GtkSpinButton to get an integer * ## Using a GtkSpinButton to get an integer
* *
* |[<!-- language="C" --> * |[<!-- language="C" -->
@ -178,6 +152,36 @@
* gtk_widget_show (window); * gtk_widget_show (window);
* } * }
* ]| * ]|
*
* # CSS nodes
*
* |[<!-- language="plain" -->
* spinbutton.horizontal
* text
* undershoot.left
* undershoot.right
* button.down
* button.up
* ]|
*
* |[<!-- language="plain" -->
* spinbutton.vertical
* button.up
* text
* undershoot.left
* undershoot.right
* button.down
* ]|
*
* GtkSpinButtons main CSS node has the name spinbutton. It creates subnodes
* for the entry and the two buttons, with these names. The button nodes have
* the style classes .up and .down. The GtkText subnodes (if present) are put
* below the text node. The orientation of the spin button is reflected in
* the .vertical or .horizontal style class on the main node.
*
* # Accessiblity
*
* GtkSpinButton uses the #GTK_ACCESSIBLE_ROLE_SPIN_BUTTON role.
*/ */
typedef struct _GtkSpinButton GtkSpinButton; typedef struct _GtkSpinButton GtkSpinButton;

View File

@ -47,6 +47,10 @@
* *
* GtkSwitch has four css nodes, the main node with the name switch and subnodes * GtkSwitch has four css nodes, the main node with the name switch and subnodes
* for the slider and the on and off labels. Neither of them is using any style classes. * for the slider and the on and off labels. Neither of them is using any style classes.
*
* # Accessibility
*
* GtkSwitch uses the #GTK_ACCESSIBLE_ROLE_SWITCH role.
*/ */
#include "config.h" #include "config.h"