atk/Makefile.am, atk/atk.h Updated comments
[platform/upstream/atk.git] / atk / atkvalue.c
1 /* ATK -  Accessibility Toolkit
2  * Copyright 2001 Sun Microsystems Inc.
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include "atkvalue.h"
21
22 GType
23 atk_value_get_type ()
24 {
25   static GType type = 0;
26
27   if (!type) {
28     GTypeInfo tinfo =
29     {
30       sizeof (AtkValueIface),
31       (GBaseInitFunc) NULL,
32       (GBaseFinalizeFunc) NULL,
33
34     };
35
36     type = g_type_register_static (G_TYPE_INTERFACE, "AtkValue", &tinfo, 0);
37   }
38
39   return type;
40 }
41
42 /**
43  * atk_value_get_current_value:
44  * @obj: a GObject instance that implements AtkValueIface
45  * @value: a #GValue representing the current accessible value
46  *
47  * Gets the value of this object
48  **/
49 void
50 atk_value_get_current_value (AtkValue *obj,
51                              GValue   *value)
52 {
53   AtkValueIface *iface;
54
55   g_return_if_fail (obj != NULL);
56   g_return_if_fail (value != NULL);
57   g_return_if_fail (ATK_IS_VALUE (obj));
58
59   iface = ATK_VALUE_GET_IFACE (obj);
60
61   if (iface->get_current_value)
62     (iface->get_current_value) (obj, value);
63 }
64
65 /**
66  * atk_value_get_maximum_value:
67  * @obj: a GObject instance that implements AtkValueIface
68  * @value: a #GValue representing the maximum accessible value
69  *
70  * Gets the maximum value of this object
71  **/
72 void
73 atk_value_get_maximum_value  (AtkValue *obj,
74                               GValue   *value)
75 {
76   AtkValueIface *iface;
77
78   g_return_if_fail (obj != NULL);
79   g_return_if_fail (value != NULL);
80   g_return_if_fail (ATK_IS_VALUE (obj));
81
82   iface = ATK_VALUE_GET_IFACE (obj);
83
84   if (iface->get_maximum_value)
85     (iface->get_maximum_value) (obj, value);
86 }
87
88 /**
89  * atk_value_get_minimum_value:
90  * @obj: a GObject instance that implements AtkValueIface
91  * @value: a #GValue representing the minimum accessible value
92  *
93  * Gets the minimum value of this object
94  **/
95 void
96 atk_value_get_minimum_value (AtkValue *obj,
97                              GValue   *value)
98 {
99   AtkValueIface *iface;
100
101   g_return_if_fail (obj != NULL);
102   g_return_if_fail (value != NULL);
103   g_return_if_fail (ATK_IS_VALUE (obj));
104
105   iface = ATK_VALUE_GET_IFACE (obj);
106
107   if (iface->get_minimum_value)
108     (iface->get_minimum_value) (obj, value);
109 }
110
111 /**
112  * atk_value_set_current_value:
113  * @obj: a GObject instance that implements AtkValueIface
114  * @value: a #GValue which is the desired new accessible value.
115  *
116  * Sets the value of this object
117  *
118  * Returns: %TRUE if new value is successfully set, %FALSE otherwise.
119  **/
120 gboolean
121 atk_value_set_current_value (AtkValue       *obj, 
122                              const GValue   *value)
123 {
124   AtkValueIface *iface;
125
126   g_return_val_if_fail (obj != NULL, FALSE);
127   g_return_val_if_fail (value != NULL, FALSE);
128   g_return_val_if_fail (ATK_IS_VALUE (obj), FALSE);
129   g_return_val_if_fail (G_IS_VALUE (value), FALSE);
130
131   iface = ATK_VALUE_GET_IFACE (obj);
132
133   if (iface->set_current_value)
134     return (iface->set_current_value) (obj, value);
135   else
136     return FALSE;
137 }