2020-07-08 15:34:32 +00:00
|
|
|
/* gtkaccessiblevaluestatic.c: GtkAccessibleValue static implementations
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gtkaccessiblevalueprivate.h"
|
|
|
|
|
2020-07-15 18:08:37 +00:00
|
|
|
/* {{{ Undefined value */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_undefined_accessible_value_print (const GtkAccessibleValue *value,
|
|
|
|
GString *buffer)
|
|
|
|
{
|
|
|
|
g_string_append (buffer, "undefined");
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GtkAccessibleValueClass GTK_UNDEFINED_ACCESSIBLE_VALUE = {
|
2020-07-16 17:08:22 +00:00
|
|
|
.type = GTK_ACCESSIBLE_VALUE_TYPE_UNDEFINED,
|
2020-07-15 18:08:37 +00:00
|
|
|
.type_name = "GtkUndefinedAccessibleValue",
|
|
|
|
.instance_size = sizeof (GtkAccessibleValue),
|
|
|
|
.print = gtk_undefined_accessible_value_print,
|
|
|
|
};
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
static GtkAccessibleValue undefined_value =
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_UNDEFINED_ACCESSIBLE_VALUE);
|
2020-07-15 18:08:37 +00:00
|
|
|
|
|
|
|
GtkAccessibleValue *
|
|
|
|
gtk_undefined_accessible_value_new (void)
|
|
|
|
{
|
|
|
|
return gtk_accessible_value_ref (&undefined_value);
|
|
|
|
}
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
int
|
|
|
|
gtk_undefined_accessible_value_get (const GtkAccessibleValue *value)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_VALUE_UNDEFINED);
|
|
|
|
g_return_val_if_fail (value->value_class == >K_UNDEFINED_ACCESSIBLE_VALUE,
|
|
|
|
GTK_ACCESSIBLE_VALUE_UNDEFINED);
|
|
|
|
|
|
|
|
return GTK_ACCESSIBLE_VALUE_UNDEFINED;
|
|
|
|
}
|
|
|
|
|
2020-07-15 18:08:37 +00:00
|
|
|
/* }}} */
|
|
|
|
|
2020-07-08 15:34:32 +00:00
|
|
|
/* {{{ Boolean values */
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GtkAccessibleValue parent;
|
|
|
|
|
|
|
|
gboolean value;
|
|
|
|
} GtkBooleanAccessibleValue;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_boolean_accessible_value_equal (const GtkAccessibleValue *value_a,
|
|
|
|
const GtkAccessibleValue *value_b)
|
|
|
|
{
|
|
|
|
const GtkBooleanAccessibleValue *bool_a = (GtkBooleanAccessibleValue *) value_a;
|
|
|
|
const GtkBooleanAccessibleValue *bool_b = (GtkBooleanAccessibleValue *) value_b;
|
|
|
|
|
|
|
|
return bool_a->value == bool_b->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_boolean_accessible_value_print (const GtkAccessibleValue *value,
|
|
|
|
GString *buffer)
|
|
|
|
{
|
|
|
|
const GtkBooleanAccessibleValue *self = (GtkBooleanAccessibleValue *) value;
|
|
|
|
|
|
|
|
g_string_append_printf (buffer, "%s", self->value ? "true" : "false");
|
|
|
|
}
|
|
|
|
|
2020-07-13 14:22:24 +00:00
|
|
|
static const GtkAccessibleValueClass GTK_BOOLEAN_ACCESSIBLE_VALUE = {
|
2020-07-16 17:08:22 +00:00
|
|
|
.type = GTK_ACCESSIBLE_VALUE_TYPE_BOOLEAN,
|
2020-07-13 14:22:24 +00:00
|
|
|
.type_name = "GtkBooleanAccessibleValue",
|
2020-07-08 15:34:32 +00:00
|
|
|
.instance_size = sizeof (GtkBooleanAccessibleValue),
|
|
|
|
.equal = gtk_boolean_accessible_value_equal,
|
|
|
|
.print = gtk_boolean_accessible_value_print,
|
|
|
|
};
|
|
|
|
|
2020-07-13 14:22:24 +00:00
|
|
|
static GtkBooleanAccessibleValue boolean_values[] = {
|
2020-07-16 17:08:22 +00:00
|
|
|
{ GTK_ACCESSIBLE_VALUE_INIT (>K_BOOLEAN_ACCESSIBLE_VALUE), FALSE },
|
|
|
|
{ GTK_ACCESSIBLE_VALUE_INIT (>K_BOOLEAN_ACCESSIBLE_VALUE), TRUE },
|
2020-07-08 15:34:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GtkAccessibleValue *
|
2020-07-13 14:22:24 +00:00
|
|
|
gtk_boolean_accessible_value_new (gboolean state)
|
2020-07-08 15:34:32 +00:00
|
|
|
{
|
|
|
|
if (state)
|
2020-07-13 14:22:24 +00:00
|
|
|
return gtk_accessible_value_ref ((GtkAccessibleValue *) &boolean_values[1]);
|
2020-07-08 15:34:32 +00:00
|
|
|
|
2020-07-13 14:22:24 +00:00
|
|
|
return gtk_accessible_value_ref ((GtkAccessibleValue *) &boolean_values[0]);
|
2020-07-08 15:34:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2020-07-13 14:22:24 +00:00
|
|
|
gtk_boolean_accessible_value_get (const GtkAccessibleValue *value)
|
2020-07-08 15:34:32 +00:00
|
|
|
{
|
|
|
|
GtkBooleanAccessibleValue *self = (GtkBooleanAccessibleValue *) value;
|
|
|
|
|
|
|
|
g_return_val_if_fail (value != NULL, FALSE);
|
2020-07-13 14:22:24 +00:00
|
|
|
g_return_val_if_fail (value->value_class == >K_BOOLEAN_ACCESSIBLE_VALUE, FALSE);
|
2020-07-08 15:34:32 +00:00
|
|
|
|
|
|
|
return self->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
/* {{{ Tri-state values */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
GtkAccessibleValue parent;
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
GtkAccessibleTristate value;
|
2020-07-08 15:34:32 +00:00
|
|
|
} GtkTristateAccessibleValue;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_tristate_accessible_value_equal (const GtkAccessibleValue *value_a,
|
|
|
|
const GtkAccessibleValue *value_b)
|
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
const GtkTristateAccessibleValue *self_a = (GtkTristateAccessibleValue *) value_a;
|
|
|
|
const GtkTristateAccessibleValue *self_b = (GtkTristateAccessibleValue *) value_b;
|
2020-07-08 15:34:32 +00:00
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
return self_a->value == self_b->value;
|
2020-07-08 15:34:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tristate_accessible_value_print (const GtkAccessibleValue *value,
|
|
|
|
GString *buffer)
|
|
|
|
{
|
|
|
|
const GtkTristateAccessibleValue *self = (GtkTristateAccessibleValue *) value;
|
|
|
|
|
|
|
|
switch (self->value)
|
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
case GTK_ACCESSIBLE_TRISTATE_FALSE:
|
2020-07-08 15:34:32 +00:00
|
|
|
g_string_append (buffer, "false");
|
|
|
|
break;
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
case GTK_ACCESSIBLE_TRISTATE_TRUE:
|
2020-07-08 15:34:32 +00:00
|
|
|
g_string_append (buffer, "true");
|
|
|
|
break;
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
case GTK_ACCESSIBLE_TRISTATE_MIXED:
|
|
|
|
g_string_append (buffer, "mixed");
|
2020-07-08 15:34:32 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
static const GtkAccessibleValueClass GTK_TRISTATE_ACCESSIBLE_VALUE = {
|
|
|
|
.type = GTK_ACCESSIBLE_VALUE_TYPE_TRISTATE,
|
|
|
|
.type_name = "GtkTristateAccessibleValue",
|
2020-07-08 15:34:32 +00:00
|
|
|
.instance_size = sizeof (GtkTristateAccessibleValue),
|
|
|
|
.equal = gtk_tristate_accessible_value_equal,
|
|
|
|
.print = gtk_tristate_accessible_value_print,
|
|
|
|
};
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
static GtkTristateAccessibleValue tristate_values[] = {
|
|
|
|
[GTK_ACCESSIBLE_TRISTATE_FALSE] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_TRISTATE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_TRISTATE_FALSE
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_TRISTATE_TRUE] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_TRISTATE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_TRISTATE_TRUE
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_TRISTATE_MIXED] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_TRISTATE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_TRISTATE_MIXED
|
|
|
|
},
|
2020-07-08 15:34:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GtkAccessibleValue *
|
2020-07-16 17:08:22 +00:00
|
|
|
gtk_tristate_accessible_value_new (GtkAccessibleTristate value)
|
2020-07-08 15:34:32 +00:00
|
|
|
{
|
2020-07-27 04:21:01 +00:00
|
|
|
g_return_val_if_fail (value >= GTK_ACCESSIBLE_TRISTATE_FALSE &&
|
|
|
|
value <= GTK_ACCESSIBLE_TRISTATE_MIXED, NULL);
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
return gtk_accessible_value_ref ((GtkAccessibleValue *) &tristate_values[value]);
|
2020-07-08 15:34:32 +00:00
|
|
|
}
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
GtkAccessibleTristate
|
|
|
|
gtk_tristate_accessible_value_get (const GtkAccessibleValue *value)
|
2020-07-08 15:34:32 +00:00
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_TRISTATE_FALSE);
|
|
|
|
g_return_val_if_fail (value->value_class == >K_TRISTATE_ACCESSIBLE_VALUE,
|
|
|
|
GTK_ACCESSIBLE_TRISTATE_FALSE);
|
2020-07-08 15:34:32 +00:00
|
|
|
|
|
|
|
GtkTristateAccessibleValue *self = (GtkTristateAccessibleValue *) value;
|
|
|
|
|
|
|
|
return self->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
/* {{{ Enumeration values */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
GtkAccessibleValue parent;
|
|
|
|
|
|
|
|
int value;
|
|
|
|
const char *token;
|
2020-07-16 17:08:22 +00:00
|
|
|
} GtkTokenAccessibleValue;
|
2020-07-08 15:34:32 +00:00
|
|
|
|
|
|
|
static gboolean
|
2020-07-16 17:08:22 +00:00
|
|
|
gtk_token_accessible_value_equal (const GtkAccessibleValue *value_a,
|
|
|
|
const GtkAccessibleValue *value_b)
|
2020-07-08 15:34:32 +00:00
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
const GtkTokenAccessibleValue *self_a = (GtkTokenAccessibleValue *) value_a;
|
|
|
|
const GtkTokenAccessibleValue *self_b = (GtkTokenAccessibleValue *) value_b;
|
2020-07-08 15:34:32 +00:00
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
return self_a->value == self_b->value;
|
2020-07-08 15:34:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-07-16 17:08:22 +00:00
|
|
|
gtk_token_accessible_value_print (const GtkAccessibleValue *value,
|
|
|
|
GString *buffer)
|
2020-07-08 15:34:32 +00:00
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
const GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
|
2020-07-08 15:34:32 +00:00
|
|
|
|
|
|
|
g_string_append (buffer, self->token);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GtkAccessibleValueClass GTK_INVALID_ACCESSIBLE_VALUE = {
|
2020-07-16 17:08:22 +00:00
|
|
|
.type = GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
|
2020-07-08 15:34:32 +00:00
|
|
|
.type_name = "GtkInvalidAccessibleValue",
|
2020-07-16 17:08:22 +00:00
|
|
|
.instance_size = sizeof (GtkTokenAccessibleValue),
|
|
|
|
.equal = gtk_token_accessible_value_equal,
|
|
|
|
.print = gtk_token_accessible_value_print,
|
2020-07-08 15:34:32 +00:00
|
|
|
};
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
static GtkTokenAccessibleValue invalid_values[] = {
|
|
|
|
[GTK_ACCESSIBLE_INVALID_FALSE] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_INVALID_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_INVALID_FALSE, "false"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_INVALID_TRUE] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_INVALID_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_INVALID_TRUE, "true"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_INVALID_GRAMMAR] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_INVALID_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_INVALID_GRAMMAR, "grammar"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_INVALID_SPELLING] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_INVALID_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_INVALID_SPELLING, "spelling"
|
|
|
|
},
|
2020-07-08 15:34:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GtkAccessibleValue *
|
|
|
|
gtk_invalid_accessible_value_new (GtkAccessibleInvalidState state)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (state >= GTK_ACCESSIBLE_INVALID_FALSE &&
|
|
|
|
state <= GTK_ACCESSIBLE_INVALID_SPELLING,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return gtk_accessible_value_ref ((GtkAccessibleValue *) &invalid_values[state]);
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkAccessibleInvalidState
|
|
|
|
gtk_invalid_accessible_value_get (const GtkAccessibleValue *value)
|
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
|
2020-07-08 15:34:32 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_INVALID_FALSE);
|
|
|
|
g_return_val_if_fail (value->value_class == >K_INVALID_ACCESSIBLE_VALUE,
|
|
|
|
GTK_ACCESSIBLE_INVALID_FALSE);
|
|
|
|
|
|
|
|
return self->value;
|
|
|
|
}
|
|
|
|
|
2020-07-13 14:22:24 +00:00
|
|
|
static const GtkAccessibleValueClass GTK_AUTOCOMPLETE_ACCESSIBLE_VALUE = {
|
2020-07-16 17:08:22 +00:00
|
|
|
.type = GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
|
2020-07-13 14:22:24 +00:00
|
|
|
.type_name = "GtkAutocompleteAccessibleValue",
|
2020-07-16 17:08:22 +00:00
|
|
|
.instance_size = sizeof (GtkTokenAccessibleValue),
|
|
|
|
.equal = gtk_token_accessible_value_equal,
|
|
|
|
.print = gtk_token_accessible_value_print,
|
2020-07-13 14:22:24 +00:00
|
|
|
};
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
static GtkTokenAccessibleValue autocomplete_values[] = {
|
|
|
|
[GTK_ACCESSIBLE_AUTOCOMPLETE_NONE] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_AUTOCOMPLETE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_AUTOCOMPLETE_NONE, "none"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_AUTOCOMPLETE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_AUTOCOMPLETE_INLINE, "inline"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_AUTOCOMPLETE_LIST] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_AUTOCOMPLETE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_AUTOCOMPLETE_LIST, "list"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_AUTOCOMPLETE_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH, "both"
|
|
|
|
},
|
2020-07-13 14:22:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GtkAccessibleValue *
|
|
|
|
gtk_autocomplete_accessible_value_new (GtkAccessibleAutocomplete value)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (value >= GTK_ACCESSIBLE_AUTOCOMPLETE_NONE &&
|
|
|
|
value <= GTK_ACCESSIBLE_AUTOCOMPLETE_BOTH,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return gtk_accessible_value_ref ((GtkAccessibleValue *) &autocomplete_values[value]);
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkAccessibleAutocomplete
|
|
|
|
gtk_autocomplete_accessible_value_get (const GtkAccessibleValue *value)
|
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
|
2020-07-13 14:22:24 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_AUTOCOMPLETE_NONE);
|
|
|
|
g_return_val_if_fail (value->value_class == >K_AUTOCOMPLETE_ACCESSIBLE_VALUE,
|
|
|
|
GTK_ACCESSIBLE_AUTOCOMPLETE_NONE);
|
|
|
|
|
|
|
|
return self->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GtkAccessibleValueClass GTK_ORIENTATION_ACCESSIBLE_VALUE = {
|
2020-07-16 17:08:22 +00:00
|
|
|
.type = GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
|
2020-07-13 14:22:24 +00:00
|
|
|
.type_name = "GtkOrientationAccessibleValue",
|
2020-07-16 17:08:22 +00:00
|
|
|
.instance_size = sizeof (GtkTokenAccessibleValue),
|
|
|
|
.equal = gtk_token_accessible_value_equal,
|
|
|
|
.print = gtk_token_accessible_value_print,
|
2020-07-13 14:22:24 +00:00
|
|
|
};
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
static GtkTokenAccessibleValue orientation_values[] = {
|
|
|
|
[GTK_ORIENTATION_HORIZONTAL] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_ORIENTATION_ACCESSIBLE_VALUE), GTK_ORIENTATION_HORIZONTAL, "horizontal"
|
|
|
|
},
|
|
|
|
[GTK_ORIENTATION_VERTICAL] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_ORIENTATION_ACCESSIBLE_VALUE), GTK_ORIENTATION_VERTICAL, "vertical"
|
|
|
|
},
|
2020-07-13 14:22:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GtkAccessibleValue *
|
|
|
|
gtk_orientation_accessible_value_new (GtkOrientation value)
|
|
|
|
{
|
2020-07-27 04:21:01 +00:00
|
|
|
g_return_val_if_fail (value >= GTK_ORIENTATION_HORIZONTAL &&
|
|
|
|
value <= GTK_ORIENTATION_VERTICAL,
|
|
|
|
NULL);
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
return gtk_accessible_value_ref ((GtkAccessibleValue *) &orientation_values[value]);
|
2020-07-13 14:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkOrientation
|
|
|
|
gtk_orientation_accessible_value_get (const GtkAccessibleValue *value)
|
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
|
2020-07-13 14:22:24 +00:00
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_VALUE_UNDEFINED);
|
2020-07-13 14:22:24 +00:00
|
|
|
g_return_val_if_fail (value->value_class == >K_ORIENTATION_ACCESSIBLE_VALUE,
|
2020-07-16 17:08:22 +00:00
|
|
|
GTK_ACCESSIBLE_VALUE_UNDEFINED);
|
2020-07-13 14:22:24 +00:00
|
|
|
|
|
|
|
return self->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GtkAccessibleValueClass GTK_SORT_ACCESSIBLE_VALUE = {
|
2020-07-16 17:08:22 +00:00
|
|
|
.type = GTK_ACCESSIBLE_VALUE_TYPE_TOKEN,
|
2020-07-13 14:22:24 +00:00
|
|
|
.type_name = "GtkSortAccessibleValue",
|
2020-07-16 17:08:22 +00:00
|
|
|
.instance_size = sizeof (GtkTokenAccessibleValue),
|
|
|
|
.equal = gtk_token_accessible_value_equal,
|
|
|
|
.print = gtk_token_accessible_value_print,
|
2020-07-13 14:22:24 +00:00
|
|
|
};
|
|
|
|
|
2020-07-16 17:08:22 +00:00
|
|
|
static GtkTokenAccessibleValue sort_values[] = {
|
|
|
|
[GTK_ACCESSIBLE_SORT_NONE] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_SORT_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_SORT_NONE, "none"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_SORT_ASCENDING] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_SORT_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_SORT_ASCENDING, "ascending"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_SORT_DESCENDING] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_SORT_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_SORT_DESCENDING, "descending"
|
|
|
|
},
|
|
|
|
[GTK_ACCESSIBLE_SORT_OTHER] = {
|
|
|
|
GTK_ACCESSIBLE_VALUE_INIT (>K_SORT_ACCESSIBLE_VALUE), GTK_ACCESSIBLE_SORT_OTHER, "other"
|
|
|
|
},
|
2020-07-13 14:22:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GtkAccessibleValue *
|
|
|
|
gtk_sort_accessible_value_new (GtkAccessibleSort value)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (value >= GTK_ACCESSIBLE_SORT_NONE &&
|
|
|
|
value <= GTK_ACCESSIBLE_SORT_OTHER,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return gtk_accessible_value_ref ((GtkAccessibleValue *) &sort_values[value]);
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkAccessibleSort
|
|
|
|
gtk_sort_accessible_value_get (const GtkAccessibleValue *value)
|
|
|
|
{
|
2020-07-16 17:08:22 +00:00
|
|
|
GtkTokenAccessibleValue *self = (GtkTokenAccessibleValue *) value;
|
2020-07-13 14:22:24 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (value != NULL, GTK_ACCESSIBLE_SORT_NONE);
|
|
|
|
g_return_val_if_fail (value->value_class == >K_SORT_ACCESSIBLE_VALUE,
|
|
|
|
GTK_ACCESSIBLE_SORT_NONE);
|
|
|
|
|
|
|
|
return self->value;
|
|
|
|
}
|
|
|
|
|
2020-07-08 15:34:32 +00:00
|
|
|
/* }}} */
|