File: gtkaccessiblerange.c

package info (click to toggle)
gtk4 4.20.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 187,060 kB
  • sloc: ansic: 779,084; xml: 3,093; javascript: 3,054; python: 1,911; java: 752; sh: 682; makefile: 315; perl: 162; cpp: 21
file content (82 lines) | stat: -rw-r--r-- 2,437 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* gtkaccessiblerange.c: Accessible range interface
 *
 * SPDX-FileCopyrightText: 2022 Red Hat Inc.
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

/**
 * GtkAccessibleRange:
 *
 * An interface for accessible objects containing a numeric value.
 *
 * `GtkAccessibleRange` describes ranged controls for Assistive Technologies.
 *
 * Ranged controls have a single value within an allowed range that can
 * optionally be changed by the user.
 *
 * This interface is expected to be implemented by controls using the
 * following roles:
 *
 * - `GTK_ACCESSIBLE_ROLE_METER`
 * - `GTK_ACCESSIBLE_ROLE_PROGRESS_BAR`
 * - `GTK_ACCESSIBLE_ROLE_SCROLLBAR`
 * - `GTK_ACCESSIBLE_ROLE_SLIDER`
 * - `GTK_ACCESSIBLE_ROLE_SPIN_BUTTON`
 *
 * If that is not the case, a warning will be issued at run time.
 *
 * In addition to this interface, its implementers are expected to provide the
 * correct values for the following properties:
 *
 * - `GTK_ACCESSIBLE_PROPERTY_VALUE_MAX`
 * - `GTK_ACCESSIBLE_PROPERTY_VALUE_MIN`
 * - `GTK_ACCESSIBLE_PROPERTY_VALUE_NOW`
 * - `GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT`
 *
 * Since: 4.10
 */

#include "config.h"

#include "gtkaccessiblerangeprivate.h"

#include "gtkaccessibleprivate.h"
#include "gtkatcontextprivate.h"
#include "gtkaccessiblevalueprivate.h"

G_DEFINE_INTERFACE (GtkAccessibleRange, gtk_accessible_range, GTK_TYPE_ACCESSIBLE)

static gboolean
gtk_accessible_range_default_set_current_value (GtkAccessibleRange *accessible_range,
                                                double              value)
{
  return TRUE;
}

static void
gtk_accessible_range_default_init (GtkAccessibleRangeInterface *iface)
{
  iface->set_current_value = gtk_accessible_range_default_set_current_value;
}

/*< private >
 * gtk_accessible_range_set_current_value:
 * @self: a `GtkAccessibleRange`
 *
 * Sets the current value of this `GtkAccessibleRange` to the given value
 *
 * Note that for some widgets implementing this interface, setting a value
 * through the accessibility API makes no sense, so calling this function
 * may in some cases do nothing
 *
 * Returns: true if the call changed the value, and false otherwise
 */
gboolean
gtk_accessible_range_set_current_value (GtkAccessibleRange *self, double value)
{
  g_return_val_if_fail (GTK_IS_ACCESSIBLE_RANGE (self), FALSE);

  GtkAccessibleRangeInterface *iface = GTK_ACCESSIBLE_RANGE_GET_IFACE (self);

  return iface->set_current_value (self, value);
}