Implemented clutter_actor_get_accessible

Added the implementation for clutter_actor_get_accessible, virtual
ClutterActor function, used to obtain the accessible object of
any ClutterActor.

As it is defined virtual, it would be possible to redefine it, so
any custom clutter actor could implement their accessibility object,
withouth relying totally on a accessibility implementation module.

See gtkiconview as example.

http://bugzilla.openedhand.com/show_bug.cgi?id=2070
This commit is contained in:
Alejandro Piñeiro 2010-04-12 20:10:24 +02:00 committed by Emmanuele Bassi
parent fd584e1841
commit 6a313ec2e2
2 changed files with 54 additions and 1 deletions

View File

@ -3314,6 +3314,50 @@ clutter_actor_finalize (GObject *object)
G_OBJECT_CLASS (clutter_actor_parent_class)->finalize (object); G_OBJECT_CLASS (clutter_actor_parent_class)->finalize (object);
} }
/**
* clutter_actor_get_accessible:
* @actor: a #ClutterActor
*
* Returns the accessible object that describes the actor to an
* assistive technology.
*
* If no class-specific #AtkObject implementation is available for the
* actor instance in question, it will inherit an #AtkObject
* implementation from the first ancestor class for which such an
* implementation is defined.
*
* The documentation of the <ulink
* url="http://developer.gnome.org/doc/API/2.0/atk/index.html">ATK</ulink>
* library contains more information about accessible objects and
* their uses.
*
* Returns: (transfer none): the #AtkObject associated with @actor
*/
AtkObject*
clutter_actor_get_accessible (ClutterActor *actor)
{
ClutterActorClass *klass;
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
klass = CLUTTER_ACTOR_GET_CLASS (actor);
g_return_val_if_fail (klass->get_accessible != NULL, NULL);
return klass->get_accessible (actor);
}
static AtkObject*
clutter_actor_real_get_accessible (ClutterActor *actor)
{
AtkObject* accessible;
accessible = atk_gobject_accessible_for_object (G_OBJECT (actor));
return accessible;
}
static void static void
clutter_actor_class_init (ClutterActorClass *klass) clutter_actor_class_init (ClutterActorClass *klass)
{ {
@ -4685,6 +4729,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
klass->queue_redraw = clutter_actor_real_queue_redraw; klass->queue_redraw = clutter_actor_real_queue_redraw;
klass->queue_relayout = clutter_actor_real_queue_relayout; klass->queue_relayout = clutter_actor_real_queue_relayout;
klass->apply_transform = clutter_actor_real_apply_transform; klass->apply_transform = clutter_actor_real_apply_transform;
klass->get_accessible = clutter_actor_real_get_accessible;
} }
static void static void

View File

@ -33,6 +33,7 @@
#include <glib-object.h> #include <glib-object.h>
#include <pango/pango.h> #include <pango/pango.h>
#include <atk/atk.h>
#include <clutter/clutter-color.h> #include <clutter/clutter-color.h>
#include <clutter/clutter-types.h> #include <clutter/clutter-types.h>
@ -208,6 +209,8 @@ struct _ClutterActor
* @apply_transform: virtual function, used when applying the transformations * @apply_transform: virtual function, used when applying the transformations
* to an actor before painting it or when transforming coordinates or * to an actor before painting it or when transforming coordinates or
* the allocation; it must chain up to the parent's implementation * the allocation; it must chain up to the parent's implementation
* @get_accessible: virtual function, returns the accessible object that
* describes the actor to an assistive technology.
* @parent_set: signal class handler for the #ClutterActor::parent-set * @parent_set: signal class handler for the #ClutterActor::parent-set
* @destroy: signal class handler for #ClutterActor::destroy * @destroy: signal class handler for #ClutterActor::destroy
* @pick: virtual function, used to draw an outline of the actor with * @pick: virtual function, used to draw an outline of the actor with
@ -273,6 +276,9 @@ struct _ClutterActorClass
void (* apply_transform) (ClutterActor *actor, void (* apply_transform) (ClutterActor *actor,
CoglMatrix *matrix); CoglMatrix *matrix);
/* accessibility support */
AtkObject* (*get_accessible) (ClutterActor *actor);
/* event signals */ /* event signals */
gboolean (* event) (ClutterActor *actor, gboolean (* event) (ClutterActor *actor,
ClutterEvent *event); ClutterEvent *event);
@ -301,7 +307,7 @@ struct _ClutterActorClass
/*< private >*/ /*< private >*/
/* padding for future expansion */ /* padding for future expansion */
gpointer _padding_dummy[31]; gpointer _padding_dummy[30];
}; };
GType clutter_actor_get_type (void) G_GNUC_CONST; GType clutter_actor_get_type (void) G_GNUC_CONST;
@ -564,6 +570,8 @@ void clutter_actor_pop_internal (ClutterActor *sel
gboolean clutter_actor_has_allocation (ClutterActor *self); gboolean clutter_actor_has_allocation (ClutterActor *self);
AtkObject* clutter_actor_get_accessible (ClutterActor *actor);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_ACTOR_H__ */ #endif /* __CLUTTER_ACTOR_H__ */