Correct return type for atk_image_set_image_description()
[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  * 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)
55 {
56   AtkValueIface *iface;
57
58   g_return_if_fail (obj != NULL);
59   g_return_if_fail (value != NULL);
60   g_return_if_fail (ATK_IS_VALUE (obj));
61
62   iface = ATK_VALUE_GET_IFACE (obj);
63
64   if (iface->get_current_value)
65     (iface->get_current_value) (obj, value);
66 }
67
68 /**
69  * atk_value_get_maximum_value:
70  * @obj: a GObject instance that implements AtkValueIface
71  * @value: a #GValue representing the maximum accessible value
72  *
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)
81 {
82   AtkValueIface *iface;
83
84   g_return_if_fail (obj != NULL);
85   g_return_if_fail (value != NULL);
86   g_return_if_fail (ATK_IS_VALUE (obj));
87
88   iface = ATK_VALUE_GET_IFACE (obj);
89
90   if (iface->get_maximum_value)
91     (iface->get_maximum_value) (obj, value);
92 }
93
94 /**
95  * atk_value_get_minimum_value:
96  * @obj: a GObject instance that implements AtkValueIface
97  * @value: a #GValue representing the minimum accessible value
98  *
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.
103  **/
104 void
105 atk_value_get_minimum_value (AtkValue *obj,
106                              GValue   *value)
107 {
108   AtkValueIface *iface;
109
110   g_return_if_fail (obj != NULL);
111   g_return_if_fail (value != NULL);
112   g_return_if_fail (ATK_IS_VALUE (obj));
113
114   iface = ATK_VALUE_GET_IFACE (obj);
115
116   if (iface->get_minimum_value)
117     return (iface->get_minimum_value) (obj, value);
118 }
119
120 /**
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.
125  **/
126 gboolean
127 atk_value_set_current_value (AtkValue *obj, 
128                              GValue   *value)
129 {
130   AtkValueIface *iface;
131
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);
136
137   iface = ATK_VALUE_GET_IFACE (obj);
138
139   if (iface->set_current_value)
140     return (iface->set_current_value) (obj, value);
141   else
142     return FALSE;
143 }