| 1 |
/* GTK+ - accessibility implementations |
| 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, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
#include "config.h" |
| 19 |
|
| 20 |
#include <gtk/gtk.h> |
| 21 |
#include "gtkarrowaccessible.h" |
| 22 |
|
| 23 |
struct _GtkArrowAccessiblePrivate |
| 24 |
{ |
| 25 |
gchar *image_description; |
| 26 |
}; |
| 27 |
|
| 28 |
static void atk_image_interface_init (AtkImageIface *iface); |
| 29 |
|
| 30 |
G_DEFINE_TYPE_WITH_CODE (GtkArrowAccessible, gtk_arrow_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, |
| 31 |
G_ADD_PRIVATE (GtkArrowAccessible) |
| 32 |
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init)) |
| 33 |
|
| 34 |
static void |
| 35 |
gtk_arrow_accessible_initialize (AtkObject *accessible, |
| 36 |
gpointer data) |
| 37 |
{ |
| 38 |
ATK_OBJECT_CLASS (gtk_arrow_accessible_parent_class)->initialize (accessible, data); |
| 39 |
|
| 40 |
accessible->role = ATK_ROLE_ICON; |
| 41 |
} |
| 42 |
|
| 43 |
static void |
| 44 |
gtk_arrow_accessible_finalize (GObject *object) |
| 45 |
{ |
| 46 |
GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (object); |
| 47 |
|
| 48 |
g_free (arrow->priv->image_description); |
| 49 |
|
| 50 |
G_OBJECT_CLASS (gtk_arrow_accessible_parent_class)->finalize (object); |
| 51 |
} |
| 52 |
|
| 53 |
static void |
| 54 |
gtk_arrow_accessible_class_init (GtkArrowAccessibleClass *klass) |
| 55 |
{ |
| 56 |
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); |
| 57 |
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); |
| 58 |
|
| 59 |
atk_object_class->initialize = gtk_arrow_accessible_initialize; |
| 60 |
|
| 61 |
gobject_class->finalize = gtk_arrow_accessible_finalize; |
| 62 |
} |
| 63 |
|
| 64 |
static void |
| 65 |
gtk_arrow_accessible_init (GtkArrowAccessible *arrow) |
| 66 |
{ |
| 67 |
arrow->priv = gtk_arrow_accessible_get_instance_private (arrow); |
| 68 |
} |
| 69 |
|
| 70 |
static const gchar * |
| 71 |
gtk_arrow_accessible_get_image_description (AtkImage *obj) |
| 72 |
{ |
| 73 |
GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj); |
| 74 |
|
| 75 |
return arrow->priv->image_description; |
| 76 |
} |
| 77 |
|
| 78 |
static gboolean |
| 79 |
gtk_arrow_accessible_set_image_description (AtkImage *obj, |
| 80 |
const gchar *description) |
| 81 |
{ |
| 82 |
GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj); |
| 83 |
|
| 84 |
g_free (arrow->priv->image_description); |
| 85 |
arrow->priv->image_description = g_strdup (description); |
| 86 |
|
| 87 |
return TRUE; |
| 88 |
|
| 89 |
} |
| 90 |
|
| 91 |
static void |
| 92 |
atk_image_interface_init (AtkImageIface *iface) |
| 93 |
{ |
| 94 |
iface->get_image_description = gtk_arrow_accessible_get_image_description; |
| 95 |
iface->set_image_description = gtk_arrow_accessible_set_image_description; |
| 96 |
} |