forked from AuroraMiddleware/gtk
55120a25db
All accessible properties and states may have one of the following types: - true/false - true/false/undefined - true/false/mixed/undefined - reference (to another UI element) - reference list - integer - number (real numerical value) - string - token (one of a limited set of allowed values) - token list See: https://www.w3.org/WAI/PF/aria/states_and_properties#propcharacteristic_value The GtkAccessibleValue is a simple reference counted type that can be "subclassed" to implement each value type. This initial commit adds GtkAccessibleValue and the basic subclasses for plain boolean, tristate (true/false/undefined), and token types, including statically allocated values that can be shared instead of allocated.
136 lines
6.1 KiB
C
136 lines
6.1 KiB
C
/* gtkaccessiblevalueprivate.h: Accessible value
|
|
*
|
|
* 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 <glib-object.h>
|
|
|
|
#include "gtkenums.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define GTK_TYPE_ACCESSIBLE_VALUE (gtk_accessible_value_get_type())
|
|
|
|
#define GTK_ACCESSIBLE_VALUE_ERROR (gtk_accessible_value_error_quark())
|
|
|
|
typedef struct _GtkAccessibleValue GtkAccessibleValue;
|
|
typedef struct _GtkAccessibleValueClass GtkAccessibleValueClass;
|
|
|
|
struct _GtkAccessibleValue
|
|
{
|
|
const GtkAccessibleValueClass *value_class;
|
|
|
|
int ref_count;
|
|
};
|
|
|
|
struct _GtkAccessibleValueClass
|
|
{
|
|
const char *type_name;
|
|
gsize instance_size;
|
|
|
|
void (* init) (GtkAccessibleValue *self);
|
|
void (* finalize) (GtkAccessibleValue *self);
|
|
void (* print) (const GtkAccessibleValue *self,
|
|
GString *string);
|
|
gboolean (* equal) (const GtkAccessibleValue *value_a,
|
|
const GtkAccessibleValue *value_b);
|
|
};
|
|
|
|
typedef enum {
|
|
GTK_ACCESSIBLE_VALUE_ERROR_READ_ONLY,
|
|
GTK_ACCESSIBLE_VALUE_ERROR_INVALID_VALUE,
|
|
GTK_ACCESSIBLE_VALUE_ERROR_INVALID_RANGE,
|
|
GTK_ACCESSIBLE_VALUE_ERROR_INVALID_TOKEN
|
|
} GtkAccessibleValueError;
|
|
|
|
GType gtk_accessible_value_get_type (void) G_GNUC_CONST;
|
|
GQuark gtk_accessible_value_error_quark (void);
|
|
|
|
GtkAccessibleValue * gtk_accessible_value_alloc (const GtkAccessibleValueClass *klass);
|
|
GtkAccessibleValue * gtk_accessible_value_ref (GtkAccessibleValue *self);
|
|
void gtk_accessible_value_unref (GtkAccessibleValue *self);
|
|
void gtk_accessible_value_print (const GtkAccessibleValue *self,
|
|
GString *buffer);
|
|
char * gtk_accessible_value_to_string (const GtkAccessibleValue *self);
|
|
gboolean gtk_accessible_value_equal (const GtkAccessibleValue *value_a,
|
|
const GtkAccessibleValue *value_b);
|
|
|
|
GtkAccessibleValue * gtk_accessible_value_get_default_for_state (GtkAccessibleState state);
|
|
|
|
GtkAccessibleValue * gtk_accessible_value_collect_for_state (GtkAccessibleState state,
|
|
va_list *args);
|
|
GtkAccessibleValue * gtk_accessible_value_collect_for_state_value (GtkAccessibleState state,
|
|
const GValue *value);
|
|
|
|
typedef enum { /*< prefix=GTK_ACCESSIBLE_CHECKED >*/
|
|
GTK_ACCESSIBLE_CHECKED_FALSE = 0,
|
|
GTK_ACCESSIBLE_CHECKED_TRUE = 1,
|
|
GTK_ACCESSIBLE_CHECKED_UNDEFINED = -1,
|
|
GTK_ACCESSIBLE_CHECKED_MIXED = -2
|
|
} GtkAccessibleCheckedState;
|
|
|
|
typedef enum { /*< prefix=GTK_ACCESSIBLE_PRESSED >*/
|
|
GTK_ACCESSIBLE_PRESSED_FALSE = 0,
|
|
GTK_ACCESSIBLE_PRESSED_TRUE = 1,
|
|
GTK_ACCESSIBLE_PRESSED_UNDEFINED = -1,
|
|
GTK_ACCESSIBLE_PRESSED_MIXED = -2
|
|
} GtkAccessiblePressedState;
|
|
|
|
typedef enum { /*< prefix=GTK_ACCESSIBLE_INVALID >*/
|
|
GTK_ACCESSIBLE_INVALID_FALSE,
|
|
GTK_ACCESSIBLE_INVALID_TRUE,
|
|
GTK_ACCESSIBLE_INVALID_GRAMMAR,
|
|
GTK_ACCESSIBLE_INVALID_SPELLING,
|
|
} GtkAccessibleInvalidState;
|
|
|
|
#define GTK_ACCESSIBLE_STATE_UNDEFINED (-1)
|
|
|
|
/* Boolean states */
|
|
GtkAccessibleValue * gtk_busy_accessible_value_new (gboolean state);
|
|
gboolean gtk_busy_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
GtkAccessibleValue * gtk_disabled_accessible_value_new (gboolean state);
|
|
gboolean gtk_disabled_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
GtkAccessibleValue * gtk_hidden_accessible_value_new (gboolean state);
|
|
gboolean gtk_hidden_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
/* Tri-state states */
|
|
GtkAccessibleValue * gtk_expanded_accessible_value_new (int state);
|
|
int gtk_expanded_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
GtkAccessibleValue * gtk_grabbed_accessible_value_new (int state);
|
|
int gtk_grabbed_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
GtkAccessibleValue * gtk_selected_accessible_value_new (int state);
|
|
int gtk_selected_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
/* Token states */
|
|
GtkAccessibleValue * gtk_pressed_accessible_value_new (GtkAccessiblePressedState state);
|
|
GtkAccessiblePressedState gtk_pressed_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
GtkAccessibleValue * gtk_checked_accessible_value_new (GtkAccessibleCheckedState state);
|
|
GtkAccessibleCheckedState gtk_checked_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
GtkAccessibleValue * gtk_invalid_accessible_value_new (GtkAccessibleInvalidState state);
|
|
GtkAccessibleInvalidState gtk_invalid_accessible_value_get (const GtkAccessibleValue *value);
|
|
|
|
G_END_DECLS
|