From 4c51b04d1987576167742726ec26e720675170a1 Mon Sep 17 00:00:00 2001 From: Padraig O'Briain Date: Tue, 24 Jul 2001 10:24:59 +0000 Subject: [PATCH] Default implementations for some some functions atk_object_real_get_name, * atk/atkobject.[c|h] Move some implementation from GAIL: Default implementations for some some functions atk_object_real_get_name, atk_object_real_set_name, atk_object_real_get_description, atk_object_real_set_description, atk_object_real_get_parent, atk_object_real_set_parent, atk_object_real_get_role, atk_object_real_connect_property_change_handler, atk_object_real_remove_property_change_handler, atk_object_notify, definition of property-changed signal. Initialize pointers to NULL in atk_object_init(). Initialize uninitialized function pointers to NULL in atk_object_class_init(). --- ChangeLog | 48 +++++++++++++++ atk/atkobject.c | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++----- atk/atkobject.h | 7 +++ 3 files changed, 221 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f8a03c..59c6c10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,22 @@ +2001-07-24 Padraig O'Briain + + * atk/atkobject.[c|h] + Move some implementation from GAIL: + Default implementations for some some functions + atk_object_real_get_name, atk_object_real_set_name, + atk_object_real_get_description, atk_object_real_set_description, + atk_object_real_get_parent, atk_object_real_set_parent, + atk_object_real_get_role, + atk_object_real_connect_property_change_handler, + atk_object_real_remove_property_change_handler, + atk_object_notify, + definition of property-changed signal. + Initialize pointers to NULL in atk_object_init(). + Initialize uninitialized function pointers to NULL in + atk_object_class_init(). + 2001-07-23 Brian Cameron + * atk/atkobject.c Changed children_changed signal to allow NULL pointers for the 2nd argument to the signal handler. @@ -9,16 +27,19 @@ * atk/makefile.msc : updated win32 build 2001-07-20 Padraig O'Briain + * atk/atkaction.[c|h], docs/atk-sections.txt, docs/tmpl/atkaction.sgml Add atk_action_get_name() and atk_action_set_description() 2001-07-18 Padraig O'Briain + * atk/atkstate.[c|h] Add ATK_STATE_ENABLED so we can distinguish between a consistent and inconsistent GtkToggleButton 2001-07-16 Brian Cameron + * atk/atkeditabletext.c atk/atktext.c atk/atktext.h atk/atkutil.h docs/atk-sections.txt docs/tmpl/atktext.sgml docs/tmpl/atkutil.sgml gail_textattributes_update.pat is for gail/gail and integrates the @@ -40,14 +61,17 @@ configure file doesn't include AM_CONFIG_HEADER. 2001-07-11 Brian Cameron + * tmpl/atkdocument.sgml Added new file for docs. 2001-07-11 Padraig O'Briain + * atk/atkimage.c atk/atkutil.c Changes to build with Sun's FORTE compiler. 2001-07-10 Brian Cameron + * tmpl/atk-unused.sgml tmpl/atkcomponent.sgml tmpl/atkeditabletext.sgml tmpl/atkimage.sgml tmpl/atkselection.sgml tmpl/atkstate.sgml tmpl/atkstreamablecontent.sgml tmpl/atktable.sgml @@ -62,17 +86,20 @@ Mon Jul 2 06:37:09 2001 Tim Janik to adapt to recent GSignal changes. 2001-06-28 Brian Cameron + * atk/atkutil.c atk/atkutil.h docs/atk-sections.txt docs/tmpl/atkutil.sgml Added new functiosn to AtkUtil. 2001-06-28 Brian Cameron + * atk/Makefile.am atk/atk.h atk/atkdocument.c atk/atkdocument.h docs/atk-docs.sgml docs/atk-sections.txt docs/tmpl/atk-unused.sgml docs/tmpl/atkobject.sgml Added new atk document interface. 2001-06-28 Brian Cameron + * atk/atkcomponent.c atk/atkcomponent.h atk/atkimage.c atk/atkimage.h atk/atktext.c atk/atktext.h atk/atkutil.h Updated so that functions that take screen coords as @@ -81,6 +108,7 @@ Mon Jul 2 06:37:09 2001 Tim Janik Updated docs as well. 2001-06-28 Brian Cameron + *atk/atkaction.c atk/atkcomponent.c atk/atkeditabletext.c atk/atkhyperlink.c atk/atkobject.c atk/atkregistry.c atk/atkstate.c atk/atkstateset.c atk/atkstreamablecontent.c @@ -89,14 +117,17 @@ Mon Jul 2 06:37:09 2001 Tim Janik Cleaned up docs. Added atkstreamablecontent.sgml 2001-06-28 Brian Cameron + *atk/atktable.h, atk/atktable.c Updated signal handler definitions. 2001-06-27 Brian Cameron + *atk/atktext.h Updated AtkXYCoords enum. 2001-06-27 Brian Cameron + *atk/atkaction.c atk/atkaction.h atk/atkcomponent.c atk/atkcomponent.h atk/atkhyperlink.c atk/atkhypertext.c atk/atkimage.c atk/atkimage.h atk/atkobject.c @@ -109,11 +140,13 @@ Mon Jul 2 06:37:09 2001 Tim Janik changes to the API. 2001-06-27 Louise Miller + *atk/atkselection.h, atk/atkselection.c changed return type to gboolean for atk_selection_select_all_selection 2001-06-26 Brian Cameron + *atk/atkstate.h atk/atkstate.c docs/tmpl/atk-unused.sgml docs/tmpl/atkselection.sgml docs/tmpl/atkstate.sgml docs/tmpl/atktable.sgml @@ -121,46 +154,55 @@ Mon Jul 2 06:37:09 2001 Tim Janik Added ATK_STATE_STALE. Updated docs. 2001-06-22 Lucy Brophy + *atk/atktext.h Removed the macro ATK_TEXT_BOUNDARY_CURSOR_POS 2001-06-21 Brian Cameron + * atk/atkeditabletext.h, atk/atkobject.h, atktext.[ch] Added AtkAttributeSet_free() convenience function. 2001-06-20 Peter Williams + * atk/atknoopobject.h: Correct prototype name: agtk_widget_get_type -> atk_no_op_object_get_type. Change #ifdef __cplusplus mess to nicer G_{BEGIN,END}_DECLS. 2001-06-20 Brian Cameron + * atk/atktable.c, atk/atkmarshal.list Removed needless marshal and updated signal handlers in atktable.c 2001-06-20 Louise Miller + *atk/atktable.h, atk/table.c, docs/tmpl/atktable.sgml Changed parameters for get_selected_rows/get_selected_columns Added 4 new functions, add_row_selection, remove_row_selection, add_column_selection, remove_column_selection 2001-06-19 Brian Cameron + * atk/atktable.c Fixed minor bug with signals. 2001-06-18 Brian Cameron + * atk/atktable Added signals. 2001-06-15 Brian Cameron & Lucy Brophy + * atk/atkselection.h atk/atkselection.c Now add_selection, clear_selection, and remove_selection return a boolean indicating SUCCESS/FAILURE to indicate if the operation was successful. 2001-06-13 Brian Cameron & Lucy Brophy + * atk/atktable.h atk/atktable.h Updated so now the get_text_before|at|after functions return the start & end offset of the string. Updated the @@ -256,6 +298,7 @@ Thu Jun 7 17:03:37 2001 Owen Taylor * New files atk/atkstreamablecontent.[ch] Updated files: atk/Makefile.am, atk/atk.h + * atk/atkvalue.c: Updated comments 2001-06-06 Padraig O'Briain @@ -270,11 +313,13 @@ Thu Jun 7 17:03:37 2001 Owen Taylor * atk/atkobject.c: Add support for setting and getting accessible-value property. + * atk/atkvalue.[ch] Make GValue in atk_value_set_current_value const Fri Jun 01 Brian Cameron * atk/atkeditabletext.[ch], atk/atktext.[ch] + * docs/atk-overrides.txt, docs/Makefile.am Updated the interface for dealing with selected text to handle multiple selected regions. Removed @@ -300,7 +345,9 @@ Tue May 29 18:17:11 2001 Owen Taylor accessible-caret, accessible-selection and accessible-value 2001-05-29 Brian Cameron + * docs/atk-sections.txt + * docs/tmpl/* Improved the layout/formatting of the atk docs. Added docs/tmpl files. @@ -327,6 +374,7 @@ Tue May 29 18:17:11 2001 Owen Taylor 2001-05-23 Padraig O'Briain * atk/atkobject.h: Correct naming of role for status bar + * atk/atktext.c: Clarify behaviour of atk_text_get_text_after/at/before_offset diff --git a/atk/atkobject.c b/atk/atkobject.c index f3b9ba5..c2e53da 100755 --- a/atk/atkobject.c +++ b/atk/atkobject.c @@ -52,25 +52,52 @@ enum enum { CHILDREN_CHANGED, FOCUS_EVENT, + PROPERTY_CHANGE, + LAST_SIGNAL }; -static void atk_object_class_init (AtkObjectClass *klass); -static void atk_object_init (AtkObject *accessible, - AtkObjectClass *klass); -static AtkRelationSet* atk_object_real_ref_relation_set (AtkObject *accessible); - -static void atk_object_real_set_property(GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void atk_object_real_get_property(GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void atk_object_finalize (GObject *object); +static void atk_object_class_init (AtkObjectClass *klass); +static void atk_object_init (AtkObject *accessible, + AtkObjectClass *klass); +static AtkRelationSet* atk_object_real_ref_relation_set + (AtkObject *accessible); + +static void atk_object_real_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void atk_object_real_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void atk_object_finalize (GObject *object); +static G_CONST_RETURN gchar* + atk_object_real_get_name (AtkObject *object); +static G_CONST_RETURN gchar* + atk_object_real_get_description + (AtkObject *object); +static AtkObject* atk_object_real_get_parent (AtkObject *object); +static AtkRole atk_object_real_get_role (AtkObject *object); +static void atk_object_real_set_name (AtkObject *object, + const gchar *name); +static void atk_object_real_set_description + (AtkObject *object, + const gchar *description); +static void atk_object_real_set_parent (AtkObject *object, + AtkObject *parent); static void atk_object_real_set_role (AtkObject *object, AtkRole role); +static guint atk_object_real_connect_property_change_handler + (AtkObject *obj, + AtkPropertyChangeHandler + *handler); +static void atk_object_real_remove_property_change_handler + (AtkObject *obj, + guint handler_id); +static void atk_object_notify (GObject *obj, + GParamSpec *pspec); + static guint atk_object_signals[LAST_SIGNAL] = { 0, }; @@ -129,15 +156,32 @@ atk_object_class_init (AtkObjectClass *klass) gobject_class->set_property = atk_object_real_set_property; gobject_class->get_property = atk_object_real_get_property; gobject_class->finalize = atk_object_finalize; - + gobject_class->notify = atk_object_notify; + + klass->get_name = atk_object_real_get_name; + klass->get_description = atk_object_real_get_description; + klass->get_parent = atk_object_real_get_parent; + klass->get_n_children = NULL; + klass->ref_child = NULL; + klass->get_index_in_parent = NULL; klass->ref_relation_set = atk_object_real_ref_relation_set; + klass->get_role = atk_object_real_get_role; + klass->ref_state_set = NULL; + klass->set_name = atk_object_real_set_name; + klass->set_description = atk_object_real_set_description; + klass->set_parent = atk_object_real_set_parent; klass->set_role = atk_object_real_set_role; + klass->connect_property_change_handler = + atk_object_real_connect_property_change_handler; + klass->remove_property_change_handler = + atk_object_real_remove_property_change_handler; /* * We do not define default signal handlers here */ - klass->focus_event = NULL; klass->children_changed = NULL; + klass->focus_event = NULL; + klass->property_change = NULL; g_object_class_install_property (gobject_class, PROP_NAME, @@ -302,12 +346,26 @@ atk_object_class_init (AtkObjectClass *klass) g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + atk_object_signals[PROPERTY_CHANGE] = + g_signal_new ("property_change", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AtkObjectClass, property_change), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); } static void atk_object_init (AtkObject *accessible, AtkObjectClass *klass) { + accessible->name = NULL; + accessible->description = NULL; + accessible->accessible_parent = NULL; + accessible->relation_set = NULL; + accessible->role = ATK_ROLE_UNKNOWN; } GType @@ -820,9 +878,101 @@ atk_object_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } +static G_CONST_RETURN gchar* +atk_object_real_get_name (AtkObject *object) +{ + return object->name; +} + +static G_CONST_RETURN gchar* +atk_object_real_get_description (AtkObject *object) +{ + return object->description; +} + +static AtkObject* +atk_object_real_get_parent (AtkObject *object) +{ + return object->accessible_parent; +} + +static AtkRole +atk_object_real_get_role (AtkObject *object) +{ + return object->role; +} + +static void +atk_object_real_set_name (AtkObject *object, + const gchar *name) +{ + g_free (object->name); + object->name = g_strdup (name); +} + +static void +atk_object_real_set_description (AtkObject *object, + const gchar *description) +{ + g_free (object->description); + object->description = g_strdup (description); +} + +static void +atk_object_real_set_parent (AtkObject *object, + AtkObject *parent) +{ + object->accessible_parent = parent; + +} + static void atk_object_real_set_role (AtkObject *object, AtkRole role) { object->role = role; } + +static guint +atk_object_real_connect_property_change_handler (AtkObject *obj, + AtkPropertyChangeHandler *handler) +{ + return g_signal_connect_closure_by_id (obj, + atk_object_signals[PROPERTY_CHANGE], + 0, + g_cclosure_new ( + G_CALLBACK (handler), NULL, + (GClosureNotify) NULL), + FALSE); +} + +static void +atk_object_real_remove_property_change_handler (AtkObject *obj, + guint handler_id) +{ + g_signal_handler_disconnect (obj, handler_id); +} + +/* + * This function is a signal handler for notify signal which gets emitted + * when a property changes value. + * + * It constructs an AtkPropertyValues structure and emits a "property_changed" + * signal which causes the user specified AtkPropertyChangeHandler + * to be called. + */ +static void +atk_object_notify (GObject *obj, + GParamSpec *pspec) +{ + AtkPropertyValues values; + + memset (&values.old_value, 0, sizeof (GValue)); + memset (&values.new_value, 0, sizeof (GValue)); + g_value_init (&values.new_value, pspec->value_type); + g_object_get_property(obj, pspec->name, &values.new_value); + values.property_name = pspec->name; + g_signal_emit (obj, atk_object_signals[PROPERTY_CHANGE], 0, + &values, NULL); +} + diff --git a/atk/atkobject.h b/atk/atkobject.h index 51b7541..d021331 100755 --- a/atk/atkobject.h +++ b/atk/atkobject.h @@ -333,6 +333,13 @@ void (* remove_property_change_handler) (AtkObject */ void (*focus_event) (AtkObject *accessible, gboolean focus_in); + /* + * The signal handler which is executed when there is a property_change + * signal for an object. + */ + gint (*property_change) (AtkObject *accessible, + AtkPropertyValues *values); + }; GType atk_object_get_type (void); -- 2.7.4