1 /* ATK - Accessibility Toolkit
2 * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
24 atk_value_get_type (void)
26 static GType type = 0;
31 sizeof (AtkValueIface),
33 (GBaseFinalizeFunc) NULL,
37 type = g_type_register_static (G_TYPE_INTERFACE, "AtkValue", &tinfo, 0);
44 * atk_value_get_current_value:
45 * @obj: a GObject instance that implements AtkValueIface
46 * @value: a #GValue representing the current accessible value
48 * Gets the value of this object.
51 atk_value_get_current_value (AtkValue *obj,
56 g_return_if_fail (value != NULL);
57 g_return_if_fail (ATK_IS_VALUE (obj));
59 iface = ATK_VALUE_GET_IFACE (obj);
61 if (iface->get_current_value)
63 if (G_IS_VALUE (value))
64 g_value_unset (value);
66 memset (value, 0, sizeof (*value));
68 (iface->get_current_value) (obj, value);
73 * atk_value_get_maximum_value:
74 * @obj: a GObject instance that implements AtkValueIface
75 * @value: a #GValue representing the maximum accessible value
77 * Gets the maximum value of this object.
80 atk_value_get_maximum_value (AtkValue *obj,
85 g_return_if_fail (value != NULL);
86 g_return_if_fail (ATK_IS_VALUE (obj));
88 iface = ATK_VALUE_GET_IFACE (obj);
90 if (iface->get_maximum_value)
92 if (G_IS_VALUE (value))
93 g_value_unset (value);
95 memset (value, 0, sizeof (*value));
97 (iface->get_maximum_value) (obj, value);
102 * atk_value_get_minimum_value:
103 * @obj: a GObject instance that implements AtkValueIface
104 * @value: a #GValue representing the minimum accessible value
106 * Gets the minimum value of this object.
109 atk_value_get_minimum_value (AtkValue *obj,
112 AtkValueIface *iface;
114 g_return_if_fail (value != NULL);
115 g_return_if_fail (ATK_IS_VALUE (obj));
117 iface = ATK_VALUE_GET_IFACE (obj);
119 if (iface->get_minimum_value)
121 if (G_IS_VALUE (value))
122 g_value_unset (value);
124 memset (value, 0, sizeof (*value));
126 (iface->get_minimum_value) (obj, value);
131 * atk_value_get_minimum_increment:
132 * @obj: a GObject instance that implements AtkValueIface
133 * @value: a #GValue representing the minimum increment by which the accessible value may be changed
135 * Gets the minimum increment by which the value of this object may be changed. If zero,
136 * the minimum increment is undefined, which may mean that it is limited only by the
137 * floating point precision of the platform.
142 atk_value_get_minimum_increment (AtkValue *obj,
145 AtkValueIface *iface;
147 g_return_if_fail (value != NULL);
148 g_return_if_fail (ATK_IS_VALUE (obj));
150 iface = ATK_VALUE_GET_IFACE (obj);
152 if (iface->get_minimum_increment)
154 if (G_IS_VALUE (value))
155 g_value_unset (value);
157 memset (value, 0, sizeof (*value));
159 (iface->get_minimum_increment) (obj, value);
164 * atk_value_set_current_value:
165 * @obj: a GObject instance that implements AtkValueIface
166 * @value: a #GValue which is the desired new accessible value.
168 * Sets the value of this object.
170 * Returns: %TRUE if new value is successfully set, %FALSE otherwise.
173 atk_value_set_current_value (AtkValue *obj,
176 AtkValueIface *iface;
178 g_return_val_if_fail (ATK_IS_VALUE (obj), FALSE);
179 g_return_val_if_fail (G_IS_VALUE (value), FALSE);
181 iface = ATK_VALUE_GET_IFACE (obj);
183 if (iface->set_current_value)
184 return (iface->set_current_value) (obj, value);