121d5c8e213735473ff0035e6e980509fb2e58f4
[platform/core/uifw/at-spi2-atk.git] / pyatspi / value.py
1 #Copyright (C) 2008 Codethink Ltd
2
3 #This library is free software; you can redistribute it and/or
4 #modify it under the terms of the GNU Lesser General Public
5 #License version 2 as published by the Free Software Foundation.
6
7 #This program is distributed in the hope that it will be useful,
8 #but WITHOUT ANY WARRANTY; without even the implied warranty of
9 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 #GNU General Public License for more details.
11 #You should have received a copy of the GNU Lesser General Public License
12 #along with this program; if not, write to the Free Software
13 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14
15 from interfaces import *
16 from accessible import Accessible
17 from factory import accessible_factory
18
19 import dbus
20
21 __all__ = [
22            "Value",
23           ]
24
25 #------------------------------------------------------------------------------
26
27 class Value(Accessible):
28         """
29         An interface supporting controls which allow a one-dimensional,
30         scalar quantity to be modified or which reflect a scalar quantity.
31         (If STATE_EDITABLE is not present, the valuator is treated as
32         "read only".
33         """
34
35         def get_currentValue(self):
36                 return dbus.Double(self._pgetter(self._dbus_interface, "currentValue"))
37         def set_currentValue(self, value):
38                 self._psetter(self._dbus_interface, "currentValue", dbus.Double(value, variant_level=1))
39         _currentValueDoc = \
40                 """
41                 The current value of the valuator.
42                 """
43         currentValue = property(fget=get_currentValue, fset=set_currentValue, doc=_currentValueDoc)
44
45         def get_maximumValue(self):
46                 return dbus.Double(self._pgetter(self._dbus_interface, "maximumValue"))
47         _maximumValueDoc = \
48                 """
49                 The maximum value allowed by this valuator.
50                 """
51         maximumValue = property(fget=get_maximumValue, doc=_maximumValueDoc)
52
53         def get_minimumIncrement(self):
54                 return dbus.Double(self._pgetter(self._dbus_interface, "minimumIncrement"))
55         _minimumIncrementDoc = \
56                 """
57                 The smallest incremental change which this valuator allows. If
58                 0, the incremental changes to the valuator are limited only by
59                 the precision of a double precision value on the platform.
60                 """
61         minimumIncrement = property(fget=get_minimumIncrement, doc=_minimumIncrementDoc)
62
63         def get_minimumValue(self):
64                 return dbus.Double(self._pgetter(self._dbus_interface, "minimumValue"))
65         _minimumValueDoc = \
66                 """
67                 The minimum value allowed by this valuator.
68                 """
69         minimumValue = property(fget=get_minimumValue, doc=_minimumValueDoc)
70
71 # Register the accessible class with the factory.
72 accessible_factory.register_accessible_class(ATSPI_VALUE, Value)
73
74 #END----------------------------------------------------------------------------