From 4322a20cbecf1aa8e9aba0eafc3fecbbd71f3bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Mon, 23 May 2011 21:35:28 +0200 Subject: [PATCH] Added StButtonAccessible Basic skeleton and the proper role (ATK_ROLE_PUSH_BUTTON) --- src/st/st-button.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/st/st-button.c b/src/st/st-button.c index 47647cfb5..67d7b55eb 100644 --- a/src/st/st-button.c +++ b/src/st/st-button.c @@ -45,6 +45,8 @@ #include "st-texture-cache.h" #include "st-private.h" +#include + enum { PROP_0, @@ -84,6 +86,8 @@ static guint button_signals[LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE (StButton, st_button, ST_TYPE_BIN); +static GType st_button_accessible_get_type (void) G_GNUC_CONST; + static void st_button_update_label_style (StButton *button) { @@ -392,6 +396,7 @@ st_button_class_init (StButtonClass *klass) actor_class->leave_event = st_button_leave; widget_class->style_changed = st_button_style_changed; + widget_class->get_accessible_type = st_button_accessible_get_type; pspec = g_param_spec_string ("label", "Label", @@ -686,3 +691,74 @@ st_button_fake_release (StButton *button) clutter_ungrab_pointer (); } } + +/******************************************************************************/ +/*************************** ACCESSIBILITY SUPPORT ****************************/ +/******************************************************************************/ + +#define ST_TYPE_BUTTON_ACCESSIBLE st_button_accessible_get_type () + +#define ST_BUTTON_ACCESSIBLE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + ST_TYPE_BUTTON_ACCESSIBLE, StButtonAccessible)) + +#define ST_IS_BUTTON_ACCESSIBLE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + ST_TYPE_BUTTON_ACCESSIBLE)) + +#define ST_BUTTON_ACCESSIBLE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + ST_TYPE_BUTTON_ACCESSIBLE, StButtonAccessibleClass)) + +#define ST_IS_BUTTON_ACCESSIBLE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + ST_TYPE_BUTTON_ACCESSIBLE)) + +#define ST_BUTTON_ACCESSIBLE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + ST_TYPE_BUTTON_ACCESSIBLE, StButtonAccessibleClass)) + +typedef struct _StButtonAccessible StButtonAccessible; +typedef struct _StButtonAccessibleClass StButtonAccessibleClass; + +struct _StButtonAccessible +{ + StWidgetAccessible parent; +}; + +struct _StButtonAccessibleClass +{ + StWidgetAccessibleClass parent_class; +}; + +static void st_button_accessible_class_init (StButtonAccessibleClass *klass); +static void st_button_accessible_init (StButtonAccessible *button); + +/* AtkObject */ +static void st_button_accessible_initialize (AtkObject *obj, + gpointer data); + +G_DEFINE_TYPE (StButtonAccessible, st_button_accessible, ST_TYPE_WIDGET_ACCESSIBLE) + +static void +st_button_accessible_class_init (StButtonAccessibleClass *klass) +{ + AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); + + atk_class->initialize = st_button_accessible_initialize; +} + +static void +st_button_accessible_init (StButtonAccessible *self) +{ + /* initialization done on AtkObject->initialize */ +} + +static void +st_button_accessible_initialize (AtkObject *obj, + gpointer data) +{ + ATK_OBJECT_CLASS (st_button_accessible_parent_class)->initialize (obj, data); + + obj->role = ATK_ROLE_PUSH_BUTTON; +}