2002-09-13 Michael Meeks <michael@ximian.com>
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_value.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001, 2002 Sun Microsystems Inc.,
6  * Copyright 2001, 2002 Ximian, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #include <cspi/spi-private.h>
25
26 /**
27  * AccessibleValue_ref:
28  * @obj: a pointer to the #AccessibleValue implementor on which to operate.
29  *
30  * Increment the reference count for an #AccessibleValue object.
31  **/
32 void
33 AccessibleValue_ref (AccessibleValue *obj)
34 {
35   cspi_object_ref (obj);
36 }
37
38 /**
39  * AccessibleValue_unref:
40  * @obj: a pointer to the #AccessibleValue implementor on which to operate. 
41  *
42  * Decrement the reference count for an #AccessibleValue object.
43  **/
44 void
45 AccessibleValue_unref (AccessibleValue *obj)
46 {
47   cspi_object_unref (obj);
48 }
49
50 /**
51  * AccessibleValue_getMinimumValue:
52  * @obj: a pointer to the #AccessibleValue implementor on which to operate. 
53  *
54  * Get the minimum allowed value for an #AccessibleValue.
55  *
56  * Returns: the minimum allowed value for this object.
57  *
58  **/
59 double
60 AccessibleValue_getMinimumValue (AccessibleValue *obj)
61 {
62   double retval;
63
64   cspi_return_val_if_fail (obj != NULL, 0.0);
65
66   retval = 
67     Accessibility_Value__get_minimumValue (CSPI_OBJREF (obj), cspi_ev ());
68   
69   cspi_return_val_if_ev ("getMinimumValue", 0.0);
70
71   return retval;
72 }
73
74 /**
75  * AccessibleValue_getCurrentValue:
76  * @obj: a pointer to the #AccessibleValue implementor on which to operate. 
77  *
78  * Get the current value for an #AccessibleValue.
79  *
80  * Returns: the current value for this object.
81  **/
82 double
83 AccessibleValue_getCurrentValue (AccessibleValue *obj)
84 {
85   double retval;
86
87   cspi_return_val_if_fail (obj != NULL, 0.0);
88
89   retval =
90     Accessibility_Value__get_currentValue (CSPI_OBJREF (obj), cspi_ev ());
91
92   cspi_return_val_if_ev ("getCurrentValue", 0.0);
93
94   return retval;
95 }
96
97 /**
98  * AccessibleValue_getMaximumValue:
99  * @obj: a pointer to the #AccessibleValue implementor on which to operate. 
100  *
101  * Get the maximum allowed value for an #AccessibleValue.
102  *
103  * Returns: the maximum allowed value for this object.
104  **/
105 double
106 AccessibleValue_getMaximumValue (AccessibleValue *obj)
107 {
108   double retval;        
109   cspi_return_val_if_fail (obj != NULL, 0.0);
110
111   retval =
112     Accessibility_Value__get_maximumValue (CSPI_OBJREF (obj), cspi_ev ());
113
114   cspi_return_val_if_ev ("getMaximumValue", 0.0);
115
116   return retval;
117 }
118
119 /**
120  * AccessibleValue_setCurrentValue:
121  * @obj: a pointer to the #AccessibleValue implementor on which to operate.
122  * @newValue: a #float value which is the desired new value of the object.
123  *
124  * Set the current value of an #AccessibleValue.
125  *
126  * Returns: #TRUE if the value could be assigned the specified value,
127  *          #FALSE otherwise.
128  **/
129 SPIBoolean
130 AccessibleValue_setCurrentValue (AccessibleValue *obj,
131                                  double newValue)
132 {
133   cspi_return_val_if_fail (obj != NULL, FALSE);
134
135   Accessibility_Value__set_currentValue (
136     CSPI_OBJREF (obj), newValue, cspi_ev ());
137
138   cspi_return_val_if_ev ("setCurrentValue", FALSE);
139
140   return TRUE;
141 }
142
143