Released 0.1
[atk.git] / atk / atkvalue.c
bloba389dabeef1db7cdf4fce36cd3a7e0c43a103791
1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 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.
20 #include "atkvalue.h"
22 GType
23 atk_value_get_type ()
25 static GType type = 0;
27 if (!type) {
28 GTypeInfo tinfo =
30 sizeof (AtkValueIface),
31 NULL,
32 NULL,
36 type = g_type_register_static (G_TYPE_INTERFACE, "AtkValue", &tinfo, 0);
39 return type;
42 /**
43 * atk_value_get_current_value:
44 * @obj@: a GObject instance that implements AtkValueIface
45 * @value: a #GValue representing the current accessible value
47 * WARNING: callers should not rely on %NULL or on a zero value for
48 * indication of whether AtkValue is implemented, they should
49 * use type checking/interface checking macros or the
50 * atk_get_accessible_value() convenience method.
51 **/
52 void
53 atk_value_get_current_value (AtkValue *obj,
54 GValue *value)
56 AtkValueIface *iface;
58 g_return_if_fail (obj != NULL);
59 g_return_if_fail (value != NULL);
60 g_return_if_fail (ATK_IS_VALUE (obj));
62 iface = ATK_VALUE_GET_IFACE (obj);
64 if (iface->get_current_value)
65 (iface->get_current_value) (obj, value);
68 /**
69 * atk_value_get_maximum_value:
70 * @obj: a GObject instance that implements AtkValueIface
71 * @value: a #GValue representing the maximum accessible value
73 * WARNING: callers should not rely on %NULL or on a zero value for
74 * indication of whether AtkValue is implemented, they should
75 * use type checking/interface checking macros or the
76 * atk_get_accessible_value() convenience method.
77 **/
78 void
79 atk_value_get_maximum_value (AtkValue *obj,
80 GValue *value)
82 AtkValueIface *iface;
84 g_return_if_fail (obj != NULL);
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)
91 (iface->get_maximum_value) (obj, value);
94 /**
95 * atk_value_get_minimum_value:
96 * @obj: a GObject instance that implements AtkValueIface
97 * @value: a #GValue representing the minimum accessible value
99 * WARNING: callers should not rely on %NULL or on a zero value for
100 * indication of whether AtkValue is implemented, they should
101 * use type checking/interface checking macros or the
102 * atk_get_accessible_value() convenience method.
104 void
105 atk_value_get_minimum_value (AtkValue *obj,
106 GValue *value)
108 AtkValueIface *iface;
110 g_return_if_fail (obj != NULL);
111 g_return_if_fail (value != NULL);
112 g_return_if_fail (ATK_IS_VALUE (obj));
114 iface = ATK_VALUE_GET_IFACE (obj);
116 if (iface->get_minimum_value)
117 return (iface->get_minimum_value) (obj, value);
121 * atk_value_set_current_value:
122 * @obj: a GObject instance that implements AtkValueIface
123 * @value: a #GValue which is the desired new accessible value.
124 * @return: %true if new value is successfully set, %false otherwise.
126 gboolean
127 atk_value_set_current_value (AtkValue *obj,
128 GValue *value)
130 AtkValueIface *iface;
132 g_return_val_if_fail (obj != NULL, FALSE);
133 g_return_val_if_fail (value != NULL, FALSE);
134 g_return_val_if_fail (ATK_IS_VALUE (obj), FALSE);
135 g_return_val_if_fail (G_IS_VALUE (value), FALSE);
137 iface = ATK_VALUE_GET_IFACE (obj);
139 if (iface->set_current_value)
140 return (iface->set_current_value) (obj, value);
141 else
142 return FALSE;