static gboolean gal_a11y_e_cell_grab_focus (AtkComponent *component) { GalA11yECell *a11y; gint index; GtkWidget *toplevel; GalA11yETableItem *a11yTableItem; a11y = GAL_A11Y_E_CELL (component); /* for e_cell_vbox's children, we just grab the e_cell_vbox */ if (GAL_A11Y_IS_E_CELL_VBOX (a11y->parent)) { return atk_component_grab_focus (ATK_COMPONENT (a11y->parent)); } a11yTableItem = GAL_A11Y_E_TABLE_ITEM (a11y->parent); index = atk_object_get_index_in_parent (ATK_OBJECT (a11y)); atk_selection_clear_selection (ATK_SELECTION (a11yTableItem)); atk_selection_add_selection (ATK_SELECTION (a11yTableItem), index); gtk_widget_grab_focus ( GTK_WIDGET (GNOME_CANVAS_ITEM (a11y->item)->canvas)); toplevel = gtk_widget_get_toplevel ( GTK_WIDGET (GNOME_CANVAS_ITEM (a11y->item)->canvas)); if (toplevel && gtk_widget_is_toplevel (toplevel)) gtk_window_present (GTK_WINDOW (toplevel)); return TRUE; }
static DBusMessage * impl_GrabFocus (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkComponent *component = (AtkComponent *) user_data; dbus_bool_t rv; DBusMessage *reply; g_return_val_if_fail (ATK_IS_COMPONENT (user_data), droute_not_yet_handled_error (message)); rv = atk_component_grab_focus (component); reply = dbus_message_new_method_return (message); if (reply) { dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv, DBUS_TYPE_INVALID); } return reply; }
static void _test_focus_on_entry(AtkObject *obj) { AtkObject *focused_obj = NULL; gboolean success = FALSE; _printf("Testing focus....\n"); /* changing focus */ g_assert(ATK_IS_COMPONENT(obj)); success = atk_component_grab_focus(ATK_COMPONENT(obj)); g_assert(success); /* now focus should point to our button*/ focused_obj = atk_get_focus_object(); g_assert(focused_obj); g_assert(focused_obj == obj); _printf("DONE. All focus test passed successfully \n"); eail_test_code_called = TRUE; }
static VALUE rg_grab_focus(VALUE self) { return CBOOL2RVAL(atk_component_grab_focus(_SELF(self))); }