2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
28 #include "my-atk-object.h"
29 #include "my-atk-image.h"
31 typedef struct _MyAtkImageInfo MyAtkImageInfo;
33 static void atk_image_interface_init (AtkImageIface *iface);
35 G_DEFINE_TYPE_WITH_CODE (MyAtkImage,
38 G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE,
39 atk_image_interface_init));
42 my_atk_set_image (AtkImage *image,
50 g_return_val_if_fail (MY_IS_ATK_IMAGE (image), FALSE);
52 MyAtkImage *self = MY_ATK_IMAGE (image);
54 self->description = g_strdup (desc);
58 self->height = height;
59 self->locale = g_strdup (locale);
65 my_atk_image_init (MyAtkImage *obj)
67 MyAtkImage *self = MY_ATK_IMAGE (obj);
68 self->description = NULL;
76 void my_atk_image_get_image_position (AtkImage *obj, gint *x, gint *y, AtkCoordType coord_type)
78 g_return_if_fail (MY_IS_ATK_IMAGE (obj));
80 MyAtkImage *self = MY_ATK_IMAGE (obj);
86 my_atk_image_get_image_description (AtkImage *obj)
88 g_return_val_if_fail (MY_IS_ATK_IMAGE (obj), NULL);
90 MyAtkImage *self = MY_ATK_IMAGE (obj);
92 return g_strdup (self->description);
95 void my_atk_image_get_image_size (AtkImage *obj, gint *width, gint *height)
97 g_return_if_fail (MY_IS_ATK_IMAGE (obj));
99 MyAtkImage *self = MY_ATK_IMAGE (obj);
100 *width = self->width;
101 *height = self->height;
105 my_atk_image_set_image_description (AtkImage *obj, const gchar * desc)
107 g_return_val_if_fail (MY_IS_ATK_IMAGE (obj), FALSE);
109 MyAtkImage *self = MY_ATK_IMAGE (obj);
111 g_free (self->description);
112 self->description = g_strdup (desc);
118 my_atk_image_get_image_locale (AtkImage *obj)
120 g_return_val_if_fail (MY_IS_ATK_IMAGE (obj), NULL);
122 MyAtkImage *self = MY_ATK_IMAGE (obj);
128 atk_image_interface_init (AtkImageIface *iface)
131 iface->get_image_position = my_atk_image_get_image_position;
132 iface->set_image_description = my_atk_image_set_image_description;
133 iface->get_image_description = my_atk_image_get_image_description;
134 iface->get_image_size = my_atk_image_get_image_size;
135 iface->get_image_locale = my_atk_image_get_image_locale;
139 my_atk_image_initialize (AtkObject *obj, gpointer data)
144 my_atk_image_finalize (GObject *object)
149 my_atk_image_class_init (MyAtkImageClass *my_class)
151 AtkObjectClass *atk_class = ATK_OBJECT_CLASS (my_class);
152 GObjectClass *gobject_class = G_OBJECT_CLASS (my_class);
154 gobject_class->finalize = my_atk_image_finalize;
156 atk_class->initialize = my_atk_image_initialize;