1 #Copyright (C) 2008 Codethink Ltd
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.
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.
16 from interfaces import *
17 from accessible import Accessible
18 from factory import accessible_factory
19 from accessible import BoundingBox
25 #------------------------------------------------------------------------------
27 class Image(Accessible):
29 An interface implemented by objects which render image data or
30 pictorial information to the screen. When onscreen components
31 include graphical information that is not purely intended to
32 enhance "3d effect" or visual layout, but which conveys some
33 semantic or informational content to the sighted user, they should
34 implement Image, and that semantic content should be conveyed
35 textually to the extent possible via the image description, as
36 well as the Accessible::name and Accessible::description properties.
39 def getImageExtents(self, coordType):
41 Obtain a bounding box which entirely contains the image contents,
42 as displayed on screen. The bounds returned do not account for
43 any viewport clipping or the fact that the image may be partially
44 or wholly obscured by other onscreen content.
46 If 0, the returned bounding box position is returned relative
47 to the screen; if 1, the bounding box position is returned relative
48 to the containing window.
49 @return a BoundingBox enclosing the image's onscreen representation.
51 func = self.get_dbus_method("getImageExtents", dbus_interface=ATSPI_IMAGE)
52 return BoundingBox(*func(dbus.Int16(coordType)))
54 def getImagePosition(self, *args, **kwargs):
56 Get the coordinates of the current image position on screen.
58 Back-filled with the x coordinate of the onscreen image (i.e.
59 the minimum x coordinate)
61 Back-filled with the y coordinate of the onscreen image (i.e.
62 the minimum y coordinate)
64 If 0, the returned x and y coordinates are returned relative
65 to the screen; if 1, they are returned relative to the containing
68 func = self.get_dbus_method("getImagePosition", dbus_interface=ATSPI_IMAGE)
69 return func(*args, **kwargs)
71 def getImageSize(self, *args, **kwargs):
73 Obtain the width and height of the current onscreen view of the
74 image. The extents returned do not account for any viewport clipping
75 or the fact that the image may be partially or wholly obscured
76 by other onscreen content.
78 Back-filled with the x extents of the onscreen image (i.e. the
79 image width in pixels)
81 Back-filled with the y extents of the onscreen image (i.e. the
82 image height in pixels)
84 func = self.get_dbus_method("getImageSize", dbus_interface=ATSPI_IMAGE)
85 return func(*args, **kwargs)
87 def get_imageDescription(self):
88 return self._pgetter(self._dbus_interface, "imageDescription")
89 def set_imageDescription(self, value):
90 self._psetter(self._dbus_interface, "imageDescription", value)
91 _imageDescriptionDoc = \
93 A UTF-8 string providing a textual description of what is visually
94 depicted in the image.
96 imageDescription = property(fget=get_imageDescription, fset=set_imageDescription, doc=_imageDescriptionDoc)
98 def get_imageLocale(self):
99 return self._pgetter(self._dbus_interface, "imageLocale")
100 def set_imageLocale(self, value):
101 self._psetter(self._dbus_interface, "imageLocale", value)
104 A string corresponding to the POSIX LC_MESSAGES locale used by
105 the imageDescription.
107 imageLocale = property(fget=get_imageLocale, fset=set_imageLocale, doc=_imageLocaleDoc)
109 # Register the accessible class with the factory.
110 accessible_factory.register_accessible_class(ATSPI_IMAGE, Image)
112 #END----------------------------------------------------------------------------