2008-08-25 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / pyatspi / image.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 import interfaces
16 from base import BaseProxy
17 from factory import add_accessible_class
18
19 __all__ = [
20            "Image",
21           ]
22
23 #------------------------------------------------------------------------------
24
25 class Image(BaseProxy):
26     """
27     An interface implemented by objects which render image data or
28     pictorial information to the screen. When onscreen components
29     include graphical information that is not purely intended to
30     enhance "3d effect" or visual layout, but which conveys some
31     semantic or informational content to the sighted user, they should
32     implement Image, and that semantic content should be conveyed
33     textually to the extent possible via the image description, as
34     well as the Accessible::name and Accessible::description properties.
35     """
36     
37     def getImageExtents(self, *args, **kwargs):
38         """
39         Obtain a bounding box which entirely contains the image contents,
40         as displayed on screen. The bounds returned do not account for
41         any viewport clipping or the fact that the image may be partially
42         or wholly obscured by other onscreen content. 
43         @param : coordType
44         If 0, the returned bounding box position is returned relative
45         to the screen; if 1, the bounding box position is returned relative
46         to the containing window. 
47         @return a BoundingBox enclosing the image's onscreen representation.
48         """
49         func = self.get_dbus_method("getImageExtents")
50         return func(*args, **kwargs)
51     
52     def getImagePosition(self, *args, **kwargs):
53         """
54         Get the coordinates of the current image position on screen.
55         @param : x
56         Back-filled with the x coordinate of the onscreen image (i.e.
57         the minimum x coordinate) 
58         @param : y
59         Back-filled with the y coordinate of the onscreen image (i.e.
60         the minimum y coordinate) 
61         @param : coordType
62         If 0, the returned x and y coordinates are returned relative
63         to the screen; if 1, they are returned relative to the containing
64         window.
65         """
66         func = self.get_dbus_method("getImagePosition")
67         return func(*args, **kwargs)
68     
69     def getImageSize(self, *args, **kwargs):
70         """
71         Obtain the width and height of the current onscreen view of the
72         image. The extents returned do not account for any viewport clipping
73         or the fact that the image may be partially or wholly obscured
74         by other onscreen content. 
75         @param : width
76         Back-filled with the x extents of the onscreen image (i.e. the
77         image width in pixels) 
78         @param : height
79         Back-filled with the y extents of the onscreen image (i.e. the
80         image height in pixels)
81         """
82         func = self.get_dbus_method("getImageSize")
83         return func(*args, **kwargs)
84
85     def get_imageDescription(self):
86         self._pgetter(self._dbus_interface, "imageDescription")
87     def set_imageDescription(self, value):
88         self._psetter(self._dbus_interface, "imageDescription", value)
89     _imageDescriptionDoc = \
90         """
91         A UTF-8 string providing a textual description of what is visually
92         depicted in the image.
93         """
94     imageDescription = property(fget=get_imageDescription, fset=set_imageDescription, doc=_imageDescriptionDoc)
95     
96     def get_imageLocale(self):
97         self._pgetter(self._dbus_interface, "imageLocale")
98     def set_imageLocale(self, value):
99         self._psetter(self._dbus_interface, "imageLocale", value)
100     _imageLocaleDoc = \
101         """
102         A string corresponding to the POSIX LC_MESSAGES locale used by
103         the imageDescription.
104         """
105     imageLocale = property(fget=get_imageLocale, fset=set_imageLocale, doc=_imageLocaleDoc)
106
107 # ATTENTION - Register the Application class with the accessible factory.
108 add_accessible_class(interfaces.ATSPI_IMAGE, Image)
109
110 #END----------------------------------------------------------------------------