diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index bef2ced14e..32916de27b 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -751,3 +751,27 @@ gtk_accessible_should_present (GtkAccessible *self) return TRUE; } + +void +gtk_accessible_update_children (GtkAccessible *self, + GtkAccessible *child, + GtkAccessibleChildState state) +{ + GtkATContext *context; + + if (GTK_IS_WIDGET (self) && + gtk_widget_get_root (GTK_WIDGET (self)) == NULL) + return; + + context = gtk_accessible_get_at_context (self); + + /* propagate changes up from ignored widgets */ + if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE) + context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self)))); + + if (context == NULL) + return; + + gtk_at_context_child_changed (context, state, child); + gtk_at_context_update (context); +} diff --git a/gtk/gtkaccessibleprivate.h b/gtk/gtkaccessibleprivate.h index 966efc3abb..873af7009a 100644 --- a/gtk/gtkaccessibleprivate.h +++ b/gtk/gtkaccessibleprivate.h @@ -49,4 +49,8 @@ gboolean gtk_accessible_get_platform_state (GtkAccessible *s void gtk_accessible_bounds_changed (GtkAccessible *self); +void gtk_accessible_update_children (GtkAccessible *self, + GtkAccessible *child, + GtkAccessibleChildState state); + G_END_DECLS diff --git a/gtk/gtkatcontext.c b/gtk/gtkatcontext.c index dd771bc10c..6e0c54693f 100644 --- a/gtk/gtkatcontext.c +++ b/gtk/gtkatcontext.c @@ -155,6 +155,13 @@ gtk_at_context_real_bounds_change (GtkATContext *self) { } +static void +gtk_at_context_real_child_change (GtkATContext *self, + GtkAccessibleChildChange change, + GtkAccessible *child) +{ +} + static void gtk_at_context_class_init (GtkATContextClass *klass) { @@ -167,6 +174,7 @@ gtk_at_context_class_init (GtkATContextClass *klass) klass->state_change = gtk_at_context_real_state_change; klass->platform_change = gtk_at_context_real_platform_change; klass->bounds_change = gtk_at_context_real_bounds_change; + klass->child_change = gtk_at_context_real_child_change; /** * GtkATContext:accessible-role: @@ -979,3 +987,11 @@ gtk_at_context_bounds_changed (GtkATContext *self) { GTK_AT_CONTEXT_GET_CLASS (self)->bounds_change (self); } + +void +gtk_at_context_child_changed (GtkATContext *self, + GtkAccessibleChildChange change, + GtkAccessible *child) +{ + GTK_AT_CONTEXT_GET_CLASS (self)->child_change (self, change, child); +} diff --git a/gtk/gtkatcontextprivate.h b/gtk/gtkatcontextprivate.h index edc7fa3c94..85d897be90 100644 --- a/gtk/gtkatcontextprivate.h +++ b/gtk/gtkatcontextprivate.h @@ -90,6 +90,16 @@ typedef enum { GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSED = 1 << GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED, } GtkAccessiblePlatformChange; +typedef enum { + GTK_ACCESSIBLE_CHILD_STATE_ADDED, + GTK_ACCESSIBLE_CHILD_STATE_REMOVED +} GtkAccessibleChildState; + +typedef enum { + GTK_ACCESSIBLE_CHILD_CHANGE_ADDED = 1 << GTK_ACCESSIBLE_CHILD_STATE_ADDED, + GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED = 1 << GTK_ACCESSIBLE_CHILD_STATE_REMOVED +} GtkAccessibleChildChange; + struct _GtkATContext { GObject parent_instance; @@ -124,6 +134,10 @@ struct _GtkATContextClass GtkAccessiblePlatformChange changed_platform); void (* bounds_change) (GtkATContext *self); + + void (* child_change) (GtkATContext *self, + GtkAccessibleChildChange changed_child, + GtkAccessible *child); }; GdkDisplay * gtk_at_context_get_display (GtkATContext *self); @@ -158,6 +172,9 @@ char * gtk_at_context_get_description (GtkATContext void gtk_at_context_platform_changed (GtkATContext *self, GtkAccessiblePlatformChange change); void gtk_at_context_bounds_changed (GtkATContext *self); +void gtk_at_context_child_changed (GtkATContext *self, + GtkAccessibleChildChange change, + GtkAccessible *child); const char * gtk_accessible_property_get_attribute_name (GtkAccessibleProperty property); const char * gtk_accessible_relation_get_attribute_name (GtkAccessibleRelation relation);