Add two new relations ATK_RELATION_NODE_CHILDREN and
[atk.git] / atk / atkvalue.c
blob60653465596fcb673b8acd117b7703ab9a2cccf2
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 (GBaseInitFunc) NULL,
32 (GBaseFinalizeFunc) 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 * Gets the value of this object.
48 **/
49 void
50 atk_value_get_current_value (AtkValue *obj,
51 GValue *value)
53 AtkValueIface *iface;
55 g_return_if_fail (value != NULL);
56 g_return_if_fail (ATK_IS_VALUE (obj));
58 iface = ATK_VALUE_GET_IFACE (obj);
60 if (iface->get_current_value)
61 (iface->get_current_value) (obj, value);
64 /**
65 * atk_value_get_maximum_value:
66 * @obj: a GObject instance that implements AtkValueIface
67 * @value: a #GValue representing the maximum accessible value
69 * Gets the maximum value of this object.
70 **/
71 void
72 atk_value_get_maximum_value (AtkValue *obj,
73 GValue *value)
75 AtkValueIface *iface;
77 g_return_if_fail (value != NULL);
78 g_return_if_fail (ATK_IS_VALUE (obj));
80 iface = ATK_VALUE_GET_IFACE (obj);
82 if (iface->get_maximum_value)
83 (iface->get_maximum_value) (obj, value);
86 /**
87 * atk_value_get_minimum_value:
88 * @obj: a GObject instance that implements AtkValueIface
89 * @value: a #GValue representing the minimum accessible value
91 * Gets the minimum value of this object.
92 **/
93 void
94 atk_value_get_minimum_value (AtkValue *obj,
95 GValue *value)
97 AtkValueIface *iface;
99 g_return_if_fail (value != NULL);
100 g_return_if_fail (ATK_IS_VALUE (obj));
102 iface = ATK_VALUE_GET_IFACE (obj);
104 if (iface->get_minimum_value)
105 (iface->get_minimum_value) (obj, value);
109 * atk_value_set_current_value:
110 * @obj: a GObject instance that implements AtkValueIface
111 * @value: a #GValue which is the desired new accessible value.
113 * Sets the value of this object.
115 * Returns: %TRUE if new value is successfully set, %FALSE otherwise.
117 gboolean
118 atk_value_set_current_value (AtkValue *obj,
119 const GValue *value)
121 AtkValueIface *iface;
123 g_return_val_if_fail (ATK_IS_VALUE (obj), FALSE);
124 g_return_val_if_fail (G_IS_VALUE (value), FALSE);
126 iface = ATK_VALUE_GET_IFACE (obj);
128 if (iface->set_current_value)
129 return (iface->set_current_value) (obj, value);
130 else
131 return FALSE;