Added better gtk-doc comments.
[platform/upstream/atk.git] / atk / atkimage.c
1 /* ATK -  Accessibility Toolkit
2  * Copyright 2001 Sun Microsystems Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "atkimage.h"
21
22 GType
23 atk_image_get_type ()
24 {
25   static GType type = 0;
26
27   if (!type) {
28     static const GTypeInfo tinfo =
29     {
30       sizeof (AtkImageIface),
31       NULL,
32       NULL,
33
34     };
35
36     type = g_type_register_static (G_TYPE_INTERFACE, "AtkImage", &tinfo, 0);
37   }
38
39   return type;
40 }
41
42 /**
43  * atk_image_get_storage_type:
44  * @image: a GObject instance that implements AtkImageIface
45  *
46  * Gets the type of representation being used to store image data
47  * [maybe this method will be replaced, watch this space.]
48  *
49  * Returns: a AtkStorageType representing the image storage type
50  **/
51 AtkImageType
52 atk_image_get_storage_type (AtkImage *obj)
53 {
54   AtkImageIface *iface;
55
56   g_return_val_if_fail (obj != NULL, 0);
57   g_return_val_if_fail (ATK_IS_IMAGE (obj), 0);
58
59   iface = ATK_IMAGE_GET_IFACE (obj);
60
61   if (iface->get_storage_type)
62     {
63       return (iface->get_storage_type) (obj);
64     }
65   else
66     {
67       return 0;
68     }
69 }
70
71 /**
72  * atk_image_get_image_description:
73  * @image: a GObject instance that implements AtkImageIface
74  *
75  * Get a textual description of this image.
76  *
77  * Returns: a gchar* representing the image description
78  **/
79 G_CONST_RETURN gchar*
80 atk_image_get_image_description (AtkImage *obj)
81 {
82   AtkImageIface *iface;
83
84   g_return_val_if_fail (obj != NULL, NULL);
85   g_return_val_if_fail (ATK_IS_IMAGE (obj), NULL);
86
87   iface = ATK_IMAGE_GET_IFACE (obj);
88
89   if (iface->get_image_description)
90     {
91       return (iface->get_image_description) (obj);
92     }
93   else
94     {
95       return NULL;
96     }
97 }
98
99 /**
100  * atk_image_get_image_height:
101  * @image: a GObject instance that implements AtkImageIface
102  *
103  * Get the height, in pixels/screen coords, of this image.
104  *
105  * Returns: a gint representing the image height in pixel coords
106  **/
107 gint
108 atk_image_get_image_height (AtkImage *obj)
109 {
110   AtkImageIface *iface;
111
112   g_return_val_if_fail (obj != NULL, 0);
113   g_return_val_if_fail (ATK_IS_IMAGE (obj), 0);
114
115   iface = ATK_IMAGE_GET_IFACE (obj);
116
117   if (iface->get_image_height)
118     {
119       return (iface->get_image_height) (obj);
120     }
121   else
122     {
123       return 0;
124     }
125 }
126
127 /**
128  * atk_image_get_image_width:
129  * @image: a GObject instance that implements AtkImageIface
130  *
131  * Get the width, in pixel/screen coords, of this image.
132  *
133  * Returns: a gint representing the image width
134  **/
135 gint
136 atk_image_get_image_width (AtkImage *obj)
137 {
138   AtkImageIface *iface;
139
140   g_return_val_if_fail (obj != NULL, 0);
141   g_return_val_if_fail (ATK_IS_IMAGE (obj), 0);
142
143   iface = ATK_IMAGE_GET_IFACE (obj);
144
145   if (iface->get_image_width)
146     {
147       return (iface->get_image_width) (obj);
148     }
149   else
150     {
151       return 0;
152     }
153 }
154
155 /**
156  * atk_image_set_image_description:
157  * @image: a GObject instance that implements AtkImageIface
158  * @description: a #gchar desciption to set for @image
159  *
160  * Sets the textual description for this image.
161  *
162  * Returns: boolean TRUE, or FALSE if operation could
163  * not be completed.
164  **/
165 gboolean
166 atk_image_set_image_description (AtkImage        *obj,
167                               const gchar     *description)
168 {
169   AtkImageIface *iface;
170
171   g_return_val_if_fail (obj != NULL, FALSE);
172   g_return_val_if_fail (ATK_IS_IMAGE (obj), FALSE);
173
174   iface = ATK_IMAGE_GET_IFACE (obj);
175
176   if (iface->set_image_description)
177     {
178       return (iface->set_image_description) (obj, description);
179     }
180   else
181     {
182       return FALSE;
183     }
184 }