forked from AuroraMiddleware/gtk
21482e8264
The ARIA spec defines the mechanism for determining the name of an accessible element—see §4.3 of the WAI-ARIA spec. We follow the specification as much as it makes sense for GTK to do so: 1. if the element is hidden, return an empty string 1. if the element has a labelled-by relation set, retrieve the label of the related element 2. if the element has a label property set, use the value of the property 3. if neither labelled-by nor label attributes are set, we use the role to compute the name: - for a `range` role, we return the contents of the value of the `value-text` or `value-now` properties - for any other role, we return a textual representation of the GtkAccessibleRole enumeration value
146 lines
8.5 KiB
C
146 lines
8.5 KiB
C
/* gtkatcontextprivate.h: Private header for GtkATContext
|
|
*
|
|
* Copyright 2020 GNOME Foundation
|
|
*
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "gtkatcontext.h"
|
|
|
|
#include "gtkaccessibleattributesetprivate.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
typedef enum {
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_AUTOCOMPLETE = 1 << GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_DESCRIPTION = 1 << GTK_ACCESSIBLE_PROPERTY_DESCRIPTION,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_HAS_POPUP = 1 << GTK_ACCESSIBLE_PROPERTY_HAS_POPUP,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_KEY_SHORTCUTS = 1 << GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_LABEL = 1 << GTK_ACCESSIBLE_PROPERTY_LABEL,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_LEVEL = 1 << GTK_ACCESSIBLE_PROPERTY_LEVEL,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_MODAL = 1 << GTK_ACCESSIBLE_PROPERTY_MODAL,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_MULTI_LINE = 1 << GTK_ACCESSIBLE_PROPERTY_MULTI_LINE,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_MULTI_SELECTABLE = 1 << GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_ORIENTATION = 1 << GTK_ACCESSIBLE_PROPERTY_ORIENTATION,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_PLACEHOLDER = 1 << GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_READ_ONLY = 1 << GTK_ACCESSIBLE_PROPERTY_READ_ONLY,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_REQUIRED = 1 << GTK_ACCESSIBLE_PROPERTY_REQUIRED,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_ROLE_DESCRIPTION = 1 << GTK_ACCESSIBLE_PROPERTY_ROLE_DESCRIPTION,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_SORT = 1 << GTK_ACCESSIBLE_PROPERTY_SORT,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_VALUE_MAX = 1 << GTK_ACCESSIBLE_PROPERTY_VALUE_MAX,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_VALUE_MIN = 1 << GTK_ACCESSIBLE_PROPERTY_VALUE_MIN,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_VALUE_NOW = 1 << GTK_ACCESSIBLE_PROPERTY_VALUE_NOW,
|
|
GTK_ACCESSIBLE_PROPERTY_CHANGE_VALUE_TEXT = 1 << GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT
|
|
} GtkAccessiblePropertyChange;
|
|
|
|
typedef enum {
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_ACTIVE_DESCENDANT = 1 << GTK_ACCESSIBLE_RELATION_ACTIVE_DESCENDANT,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_COL_COUNT = 1 << GTK_ACCESSIBLE_RELATION_COL_COUNT,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_COL_INDEX = 1 << GTK_ACCESSIBLE_RELATION_COL_INDEX,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_COL_INDEX_TEXT = 1 << GTK_ACCESSIBLE_RELATION_COL_INDEX_TEXT,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_COL_SPAN = 1 << GTK_ACCESSIBLE_RELATION_COL_SPAN,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_CONTROLS = 1 << GTK_ACCESSIBLE_RELATION_CONTROLS,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_DESCRIBED_BY = 1 << GTK_ACCESSIBLE_RELATION_DESCRIBED_BY,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_DETAILS = 1 << GTK_ACCESSIBLE_RELATION_DETAILS,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_ERROR_MESSAGE = 1 << GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_FLOW_TO = 1 << GTK_ACCESSIBLE_RELATION_FLOW_TO,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_LABELLED_BY = 1 << GTK_ACCESSIBLE_RELATION_LABELLED_BY,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_OWNS = 1 << GTK_ACCESSIBLE_RELATION_OWNS,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_POS_IN_SET = 1 << GTK_ACCESSIBLE_RELATION_POS_IN_SET,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_ROW_COUNT = 1 << GTK_ACCESSIBLE_RELATION_ROW_COUNT,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_ROW_INDEX = 1 << GTK_ACCESSIBLE_RELATION_ROW_INDEX,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_ROW_INDEX_TEXT = 1 << GTK_ACCESSIBLE_RELATION_ROW_INDEX_TEXT,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_ROW_SPAN = 1 << GTK_ACCESSIBLE_RELATION_ROW_SPAN,
|
|
GTK_ACCESSIBLE_RELATION_CHANGE_SET_SIZE = 1 << GTK_ACCESSIBLE_RELATION_SET_SIZE
|
|
} GtkAccessibleRelationChange;
|
|
|
|
typedef enum {
|
|
GTK_ACCESSIBLE_STATE_CHANGE_BUSY = 1 << GTK_ACCESSIBLE_STATE_BUSY,
|
|
GTK_ACCESSIBLE_STATE_CHANGE_CHECKED = 1 << GTK_ACCESSIBLE_STATE_CHECKED,
|
|
GTK_ACCESSIBLE_STATE_CHANGE_DISABLED = 1 << GTK_ACCESSIBLE_STATE_DISABLED,
|
|
GTK_ACCESSIBLE_STATE_CHANGE_EXPANDED = 1 << GTK_ACCESSIBLE_STATE_EXPANDED,
|
|
GTK_ACCESSIBLE_STATE_CHANGE_HIDDEN = 1 << GTK_ACCESSIBLE_STATE_HIDDEN,
|
|
GTK_ACCESSIBLE_STATE_CHANGE_INVALID = 1 << GTK_ACCESSIBLE_STATE_INVALID,
|
|
GTK_ACCESSIBLE_STATE_CHANGE_PRESSED = 1 << GTK_ACCESSIBLE_STATE_PRESSED,
|
|
GTK_ACCESSIBLE_STATE_CHANGE_SELECTED = 1 << GTK_ACCESSIBLE_STATE_SELECTED
|
|
} GtkAccessibleStateChange;
|
|
|
|
struct _GtkATContext
|
|
{
|
|
GObject parent_instance;
|
|
|
|
GtkAccessibleRole accessible_role;
|
|
GtkAccessible *accessible;
|
|
GdkDisplay *display;
|
|
|
|
GtkAccessibleAttributeSet *states;
|
|
GtkAccessibleAttributeSet *properties;
|
|
GtkAccessibleAttributeSet *relations;
|
|
|
|
GtkAccessibleStateChange updated_states;
|
|
GtkAccessiblePropertyChange updated_properties;
|
|
GtkAccessibleRelationChange updated_relations;
|
|
};
|
|
|
|
struct _GtkATContextClass
|
|
{
|
|
GObjectClass parent_class;
|
|
|
|
void (* state_change) (GtkATContext *self,
|
|
GtkAccessibleStateChange changed_states,
|
|
GtkAccessiblePropertyChange changed_properties,
|
|
GtkAccessibleRelationChange changed_relations,
|
|
GtkAccessibleAttributeSet *states,
|
|
GtkAccessibleAttributeSet *properties,
|
|
GtkAccessibleAttributeSet *relations);
|
|
};
|
|
|
|
GdkDisplay * gtk_at_context_get_display (GtkATContext *self);
|
|
|
|
void gtk_at_context_update (GtkATContext *self);
|
|
|
|
void gtk_at_context_set_accessible_state (GtkATContext *self,
|
|
GtkAccessibleState state,
|
|
GtkAccessibleValue *value);
|
|
gboolean gtk_at_context_has_accessible_state (GtkATContext *self,
|
|
GtkAccessibleState state);
|
|
GtkAccessibleValue * gtk_at_context_get_accessible_state (GtkATContext *self,
|
|
GtkAccessibleState state);
|
|
void gtk_at_context_set_accessible_property (GtkATContext *self,
|
|
GtkAccessibleProperty property,
|
|
GtkAccessibleValue *value);
|
|
gboolean gtk_at_context_has_accessible_property (GtkATContext *self,
|
|
GtkAccessibleProperty property);
|
|
GtkAccessibleValue * gtk_at_context_get_accessible_property (GtkATContext *self,
|
|
GtkAccessibleProperty property);
|
|
void gtk_at_context_set_accessible_relation (GtkATContext *self,
|
|
GtkAccessibleRelation property,
|
|
GtkAccessibleValue *value);
|
|
gboolean gtk_at_context_has_accessible_relation (GtkATContext *self,
|
|
GtkAccessibleRelation relation);
|
|
GtkAccessibleValue * gtk_at_context_get_accessible_relation (GtkATContext *self,
|
|
GtkAccessibleRelation relation);
|
|
|
|
char * gtk_at_context_get_label (GtkATContext *self);
|
|
|
|
const char * gtk_accessible_property_get_attribute_name (GtkAccessibleProperty property);
|
|
const char * gtk_accessible_relation_get_attribute_name (GtkAccessibleRelation relation);
|
|
const char * gtk_accessible_state_get_attribute_name (GtkAccessibleState state);
|
|
|
|
G_END_DECLS
|