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
21 from dbus.types import UInt32
27 #------------------------------------------------------------------------------
29 class Image(Accessible):
31 An interface implemented by objects which render image data or
32 pictorial information to the screen. When onscreen components
33 include graphical information that is not purely intended to
34 enhance "3d effect" or visual layout, but which conveys some
35 semantic or informational content to the sighted user, they should
36 implement Image, and that semantic content should be conveyed
37 textually to the extent possible via the image description, as
38 well as the Accessible::name and Accessible::description properties.
41 def getImageExtents(self, coordType):
43 Obtain a bounding box which entirely contains the image contents,
44 as displayed on screen. The bounds returned do not account for
45 any viewport clipping or the fact that the image may be partially
46 or wholly obscured by other onscreen content.
48 If 0, the returned bounding box position is returned relative
49 to the screen; if 1, the bounding box position is returned relative
50 to the containing window.
51 @return a BoundingBox enclosing the image's onscreen representation.
53 func = self.get_dbus_method("getImageExtents", dbus_interface=ATSPI_IMAGE)
54 return BoundingBox(*func(UInt32(coordType)))
56 def getImagePosition(self, coord_type):
58 Get the coordinates of the current image position on screen.
60 Back-filled with the x coordinate of the onscreen image (i.e.
61 the minimum x coordinate)
63 Back-filled with the y coordinate of the onscreen image (i.e.
64 the minimum y coordinate)
66 If 0, the returned x and y coordinates are returned relative
67 to the screen; if 1, they are returned relative to the containing
70 func = self.get_dbus_method("getImagePosition", dbus_interface=ATSPI_IMAGE)
71 return func(UInt32(coord_type))
73 def getImageSize(self):
75 Obtain the width and height of the current onscreen view of the
76 image. The extents returned do not account for any viewport clipping
77 or the fact that the image may be partially or wholly obscured
78 by other onscreen content.
80 Back-filled with the x extents of the onscreen image (i.e. the
81 image width in pixels)
83 Back-filled with the y extents of the onscreen image (i.e. the
84 image height in pixels)
86 func = self.get_dbus_method("getImageSize", dbus_interface=ATSPI_IMAGE)
89 def get_imageDescription(self):
90 return dbus.String(self._pgetter(self._dbus_interface, "imageDescription"))
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, doc=_imageDescriptionDoc)
98 def get_imageLocale(self):
99 return dbus.String(self._pgetter(self._dbus_interface, "imageLocale"))
102 A string corresponding to the POSIX LC_MESSAGES locale used by
103 the imageDescription.
105 imageLocale = property(fget=get_imageLocale, doc=_imageLocaleDoc)
107 # Register the accessible class with the factory.
108 accessible_factory.register_accessible_class(ATSPI_IMAGE, Image)
110 #END----------------------------------------------------------------------------