Added better gtk-doc 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       NULL,
32       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  * Note: callers should not rely on %NULL or on a zero value for
49  * indication of whether AtkValue is implemented, they should
50  * use type checking/interface checking macros or the
51  * atk_get_accessible_value() convenience method.
52  **/
53 void
54 atk_value_get_current_value (AtkValue *obj,
55                              GValue   *value)
56 {
57   AtkValueIface *iface;
58
59   g_return_if_fail (obj != NULL);
60   g_return_if_fail (value != NULL);
61   g_return_if_fail (ATK_IS_VALUE (obj));
62
63   iface = ATK_VALUE_GET_IFACE (obj);
64
65   if (iface->get_current_value)
66     (iface->get_current_value) (obj, value);
67 }
68
69 /**
70  * atk_value_get_maximum_value:
71  * @obj: a GObject instance that implements AtkValueIface
72  * @value: a #GValue representing the maximum accessible value
73  *
74  * Gets the maximum value of this object
75  * Note: callers should not rely on %NULL or on a zero value for
76  * indication of whether AtkValue is implemented, they should
77  * use type checking/interface checking macros or the
78  * atk_get_accessible_value() convenience method.
79  **/
80 void
81 atk_value_get_maximum_value  (AtkValue *obj,
82                               GValue   *value)
83 {
84   AtkValueIface *iface;
85
86   g_return_if_fail (obj != NULL);
87   g_return_if_fail (value != NULL);
88   g_return_if_fail (ATK_IS_VALUE (obj));
89
90   iface = ATK_VALUE_GET_IFACE (obj);
91
92   if (iface->get_maximum_value)
93     (iface->get_maximum_value) (obj, value);
94 }
95
96 /**
97  * atk_value_get_minimum_value:
98  * @obj: a GObject instance that implements AtkValueIface
99  * @value: a #GValue representing the minimum accessible value
100  *
101  * Gets the mimnimum value of this object
102  * Note: callers should not rely on %NULL or on a zero value for
103  * indication of whether AtkValue is implemented, they should
104  * use type checking/interface checking macros or the
105  * atk_get_accessible_value() convenience method.
106  **/
107 void
108 atk_value_get_minimum_value (AtkValue *obj,
109                              GValue   *value)
110 {
111   AtkValueIface *iface;
112
113   g_return_if_fail (obj != NULL);
114   g_return_if_fail (value != NULL);
115   g_return_if_fail (ATK_IS_VALUE (obj));
116
117   iface = ATK_VALUE_GET_IFACE (obj);
118
119   if (iface->get_minimum_value)
120     return (iface->get_minimum_value) (obj, value);
121 }
122
123 /**
124  * atk_value_set_current_value:
125  * @obj: a GObject instance that implements AtkValueIface
126  * @value: a #GValue which is the desired new accessible value.
127  *
128  * Sets the value of this object
129  *
130  * Returns: %true if new value is successfully set, %false otherwise.
131  **/
132 gboolean
133 atk_value_set_current_value (AtkValue *obj, 
134                              GValue   *value)
135 {
136   AtkValueIface *iface;
137
138   g_return_val_if_fail (obj != NULL, FALSE);
139   g_return_val_if_fail (value != NULL, FALSE);
140   g_return_val_if_fail (ATK_IS_VALUE (obj), FALSE);
141   g_return_val_if_fail (G_IS_VALUE (value), FALSE);
142
143   iface = ATK_VALUE_GET_IFACE (obj);
144
145   if (iface->set_current_value)
146     return (iface->set_current_value) (obj, value);
147   else
148     return FALSE;
149 }