Initial revision
[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 /* Superseded by atkimage.c */
21 #include "atkimage.h"
22
23 GType
24 atk_image_get_type ()
25 {
26   static GType type = 0;
27
28   if (!type) {
29     static const GTypeInfo tinfo =
30     {
31       sizeof (AtkImageIface),
32       NULL,
33       NULL,
34
35     };
36
37     type = g_type_register_static (G_TYPE_INTERFACE, "AtkImage", &tinfo, 0);
38   }
39
40   return type;
41 }
42
43 /**
44  * atk_image_get_storage_type:
45  * @value: a GObject instance that implements AtkImageIface
46  * @return: a AtkStorageType representing the image storage type, or 0
47  * if value does not implement this interface.
48  *
49  * WARNING: callers should not rely on %NULL or on a zero value for
50  * indication of whether AtkImageIface is implemented, they should
51  * use type checking/interface checking macros or the
52  * atk_get_accessible_image() convenience method.
53  **/
54 AtkImageType
55 atk_image_get_storage_type (AtkImage *obj)
56 {
57   AtkImageIface *iface;
58
59   g_return_val_if_fail (obj != NULL, 0);
60   g_return_val_if_fail (ATK_IS_IMAGE (obj), 0);
61
62   iface = ATK_IMAGE_GET_IFACE (obj);
63
64   if (iface->get_storage_type)
65     return (iface->get_storage_type) (obj);
66   else
67     return 0;
68 }
69
70 /**
71  * atk_image_get_image_description:
72  * @value: a GObject instance that implements AtkImageIface
73  * @return: a gchar* representing the image description, or NULL
74  * if value does not implement this interface.
75  *
76  * WARNING: callers should not rely on %NULL or on a zero value for
77  * indication of whether AtkImageIface is implemented, they should
78  * use type checking/interface checking macros or the
79  * atk_get_accessible_image() convenience method.
80  **/
81 G_CONST_RETURN gchar*
82 atk_image_get_image_description (AtkImage *obj)
83 {
84   AtkImageIface *iface;
85
86   g_return_val_if_fail (obj != NULL, NULL);
87   g_return_val_if_fail (ATK_IS_IMAGE (obj), NULL);
88
89   iface = ATK_IMAGE_GET_IFACE (obj);
90
91   if (iface->get_image_description)
92     return (iface->get_image_description) (obj);
93   else
94     return NULL;
95 }
96
97 /**
98  * atk_image_get_image_height:
99  * @value: a GObject instance that implements AtkImageIface
100  * @return: a gint representing the image height, or 0
101  * if value does not implement this interface.
102  *
103  * WARNING: callers should not rely on %NULL or on a zero value for
104  * indication of whether AtkImageIface is implemented, they should
105  * use type checking/interface checking macros or the
106  * atk_get_accessible_image() convenience method.
107  **/
108 gint
109 atk_image_get_image_height (AtkImage *obj)
110 {
111   AtkImageIface *iface;
112
113   g_return_val_if_fail (obj != NULL, 0);
114   g_return_val_if_fail (ATK_IS_IMAGE (obj), 0);
115
116   iface = ATK_IMAGE_GET_IFACE (obj);
117
118   if (iface->get_image_height)
119     return (iface->get_image_height) (obj);
120   else
121     return 0;
122 }
123
124 /**
125  * atk_image_get_image_width:
126  * @value: a GObject instance that implements AtkImageIface
127  * @return: a gint representing the image width, or 0
128  * if value does not implement this interface.
129  *
130  * WARNING: callers should not rely on %NULL or on a zero value for
131  * indication of whether AtkImageIface is implemented, they should
132  * use type checking/interface checking macros or the
133  * atk_get_accessible_image() convenience method.
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     return (iface->get_image_width) (obj);
147   else
148     return 0;
149 }
150
151 /**
152  * atk_image_set_image_description:
153  * @value: a GObject instance that implements AtkImageIface
154  * @return: void
155  **/
156 void
157 atk_image_set_image_description (AtkImage        *obj,
158                               const gchar     *description)
159 {
160   AtkImageIface *iface;
161
162   g_return_if_fail (obj != NULL);
163   g_return_if_fail (ATK_IS_IMAGE (obj));
164
165   iface = ATK_IMAGE_GET_IFACE (obj);
166
167   if (iface->set_image_description)
168     (iface->set_image_description) (obj, description);
169 }