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