summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorLi Yuan <li.yuan@sun.com>2009-07-24 16:11:30 +0800
committerLi Yuan <li.yuan@sun.com>2009-07-24 16:17:59 +0800
commitde718dbe93f16499fd6c3485270d7136446b0bf0 (patch)
treed1cb86a6951c828ff69d0ce753c9030fb2612a53 /modules
parent9660bfe9daaee78c4cd78a1ccc8004129a0fb9a0 (diff)
downloadgtk+-de718dbe93f16499fd6c3485270d7136446b0bf0.tar.gz
Remove ATK_STATE_SHOWING state when menuitem is not visible
When the menu is not selected, remove ATK_STATE_SHOWING state. And emit state change signal if the menu is selected/unselected.
Diffstat (limited to 'modules')
-rw-r--r--modules/other/gail/gailmenuitem.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/modules/other/gail/gailmenuitem.c b/modules/other/gail/gailmenuitem.c
index 2accc8389d..173eace98c 100644
--- a/modules/other/gail/gailmenuitem.c
+++ b/modules/other/gail/gailmenuitem.c
@@ -33,6 +33,7 @@ static void gail_menu_item_real_initialize
static gint gail_menu_item_get_n_children (AtkObject *obj);
static AtkObject* gail_menu_item_ref_child (AtkObject *obj,
gint i);
+static AtkStateSet* gail_menu_item_ref_state_set (AtkObject *obj);
static void gail_menu_item_finalize (GObject *object);
static void atk_action_interface_init (AtkActionIface *iface);
@@ -73,6 +74,7 @@ gail_menu_item_class_init (GailMenuItemClass *klass)
class->get_n_children = gail_menu_item_get_n_children;
class->ref_child = gail_menu_item_ref_child;
+ class->ref_state_set = gail_menu_item_ref_state_set;
class->initialize = gail_menu_item_real_initialize;
}
@@ -239,6 +241,28 @@ gail_menu_item_ref_child (AtkObject *obj,
return accessible;
}
+static AtkStateSet*
+gail_menu_item_ref_state_set (AtkObject *obj)
+{
+ AtkObject *menu_item;
+ AtkStateSet *state_set, *parent_state_set;
+
+ state_set = ATK_OBJECT_CLASS (gail_menu_item_parent_class)->ref_state_set (obj);
+
+ menu_item = atk_object_get_parent (obj);
+
+ if (!GTK_IS_MENU_ITEM (GTK_ACCESSIBLE (menu_item)->widget))
+ return state_set;
+
+ parent_state_set = atk_object_ref_state_set (menu_item);
+ if (!atk_state_set_contains_state (parent_state_set, ATK_STATE_SELECTED))
+ {
+ atk_state_set_remove_state (state_set, ATK_STATE_FOCUSED);
+ }
+
+ return state_set;
+}
+
static void
atk_action_interface_init (AtkActionIface *iface)
{
@@ -608,10 +632,18 @@ menu_item_selection (GtkItem *item,
gboolean selected)
{
AtkObject *obj, *parent;
+ gint i;
obj = gtk_widget_get_accessible (GTK_WIDGET (item));
atk_object_notify_state_change (obj, ATK_STATE_SELECTED, selected);
-
+
+ for (i = 0; i < atk_object_get_n_accessible_children (obj); i++)
+ {
+ AtkObject *child;
+ child = atk_object_ref_accessible_child (obj, i);
+ atk_object_notify_state_change (child, ATK_STATE_SHOWING, selected);
+ g_object_unref (child);
+ }
parent = atk_object_get_parent (obj);
g_signal_emit_by_name (parent, "selection_changed");
}