Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
Archivo: testcombo.c Proyecto: BYC/gtk
static void _test_selection (AtkObject *obj)
{
  gint count;
  gint n_children;
  AtkObject *list;

  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_if_fail (count == 0);

  list = atk_object_ref_accessible_child (obj, 0);
  n_children = atk_object_get_n_accessible_children (list); 
  g_object_unref (G_OBJECT (list));

  atk_selection_add_selection (ATK_SELECTION (obj), n_children - 1);
  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_if_fail (count == 1);
  g_return_if_fail (atk_selection_is_child_selected (ATK_SELECTION (obj),
                     n_children - 1));	
  atk_selection_add_selection (ATK_SELECTION (obj), 0);
  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_if_fail (count == 1);
  g_return_if_fail (atk_selection_is_child_selected (ATK_SELECTION (obj), 0));
  atk_selection_clear_selection (ATK_SELECTION (obj));
  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_if_fail (count == 0);
}
Ejemplo n.º 3
0
static G_CONST_RETURN gchar*
jaw_object_get_name (AtkObject *atk_obj)
{
	JawObject *jaw_obj = JAW_OBJECT(atk_obj);
	jobject ac = jaw_obj->acc_context;
	JNIEnv *jniEnv = jaw_util_get_jni_env();

	if (atk_object_get_role(atk_obj) == ATK_ROLE_COMBO_BOX
			&& atk_object_get_n_accessible_children(atk_obj) == 1) {
		AtkSelection *selection = ATK_SELECTION(atk_obj);
		if (selection != NULL) {
			AtkObject *child = atk_selection_ref_selection(selection, 0);
			if (child != NULL) {
				return atk_object_get_name(child);
			}
		}
	}
	
	jclass classAccessibleContext = (*jniEnv)->FindClass( jniEnv, "javax/accessibility/AccessibleContext" );
	jmethodID jmid = (*jniEnv)->GetMethodID( jniEnv, classAccessibleContext, "getAccessibleName", "()Ljava/lang/String;" );
	jstring jstr = (*jniEnv)->CallObjectMethod( jniEnv, ac, jmid );

	if (atk_obj->name != NULL) {
		(*jniEnv)->ReleaseStringUTFChars(jniEnv, jaw_obj->jstrName, atk_obj->name);
		(*jniEnv)->DeleteGlobalRef(jniEnv, jaw_obj->jstrName);
	}

	if (jstr != NULL) {
		jaw_obj->jstrName = (*jniEnv)->NewGlobalRef(jniEnv, jstr);
		atk_obj->name = (gchar*)(*jniEnv)->GetStringUTFChars(jniEnv, jaw_obj->jstrName, NULL);
	}

	return atk_obj->name;
}
Ejemplo n.º 4
0
Archivo: testcombo.c Proyecto: BYC/gtk
static gint _close_combo_list (gpointer data)
{
  AtkObject *obj = ATK_OBJECT (data);

  gint count;
  gint n_children;
  AtkObject *list;

  count = atk_selection_get_selection_count (ATK_SELECTION (obj));
  g_return_val_if_fail (count == 0, FALSE);

  list = atk_object_ref_accessible_child (obj, 0);
  n_children = atk_object_get_n_accessible_children (list); 
  g_object_unref (G_OBJECT (list));

  atk_selection_add_selection (ATK_SELECTION (obj), n_children - 1);

  atk_action_do_action (ATK_ACTION (obj), 0);

  return FALSE;
}
Ejemplo n.º 5
0
static void
_do_test(AtkObject *obj)
{
   g_assert(ATK_IS_ACTION(obj));

   eailu_test_action_activate(ATK_ACTION(obj), "scroll_left");
   eailu_test_action_activate(ATK_ACTION(obj), "scroll_right");
   eailu_test_action_activate(ATK_ACTION(obj), "scroll_up");
   eailu_test_action_activate(ATK_ACTION(obj), "scroll_down");
   eailu_test_action_activate(ATK_ACTION(obj), "next");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 1));
   eailu_test_action_activate(ATK_ACTION(obj), "next");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 2));
   eailu_test_action_activate(ATK_ACTION(obj), "next");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 3));
   eailu_test_action_activate(ATK_ACTION(obj), "previous");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), 2));

   eailu_test_action_description_all(ATK_ACTION(obj));

   eailu_test_code_called = 1;
}
Ejemplo n.º 6
0
static void
_test_index_child_for_object(AtkObject *obj, int index)
{
   g_assert(0 == atk_selection_get_selection_count(ATK_SELECTION(obj)));
   g_assert(atk_selection_add_selection(ATK_SELECTION(obj), index));

   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), index));
   g_assert(1 == atk_selection_get_selection_count(ATK_SELECTION(obj)));

   g_assert(atk_selection_clear_selection(ATK_SELECTION(obj)));
   g_assert(0 == atk_selection_get_selection_count(ATK_SELECTION(obj)));
}
Ejemplo n.º 7
0
static void
ea_day_view_main_item_time_change_cb (EDayView *day_view,
                                      gpointer data)
{
	EaDayViewMainItem *ea_main_item;
	AtkObject *item_cell = NULL;

	g_return_if_fail (E_IS_DAY_VIEW (day_view));
	g_return_if_fail (data);
	g_return_if_fail (EA_IS_DAY_VIEW_MAIN_ITEM (data));

	ea_main_item = EA_DAY_VIEW_MAIN_ITEM (data);

#ifdef ACC_DEBUG
	printf ("EvoAcc: ea_day_view_main_item time changed cb\n");
#endif
	/* only deal with the first selected child, for now */
	item_cell = atk_selection_ref_selection (
		ATK_SELECTION (ea_main_item), 0);
	if (item_cell) {
		AtkStateSet *state_set;
		state_set = atk_object_ref_state_set (item_cell);
		atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
		g_object_unref (state_set);

		g_signal_emit_by_name (
			ea_main_item,
			"active-descendant-changed",
			item_cell);
		g_signal_emit_by_name (data, "selection_changed");

		atk_focus_tracker_notify (item_cell);
		g_object_unref (item_cell);
	}

}
void
_do_test(AtkObject *obj)
{
   const char *type_name = g_type_name(G_TYPE_FROM_INSTANCE(obj));

   g_assert(ATK_IS_OBJECT(obj));
   g_assert_cmpstr(type_name, ==, "EailFlipselector");

   g_assert(atk_object_get_n_accessible_children(obj) == ITEMS_COUNT);

   /*
    * AtkSelection tests
    */
   g_assert(ATK_IS_SELECTION(obj));

   /* atk_selection_add_selection test */
   g_assert(atk_selection_add_selection(ATK_SELECTION(obj), ITEM_SEL_EINA));
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));

   /* atk_selection_clear_selection test */
   g_assert(atk_selection_clear_selection(ATK_SELECTION(obj)) == FALSE);

   /* eail_flipselector_ref_selection test */
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));

   /* atk_selection_get_selection_count test */
   g_assert(atk_selection_get_selection_count(ATK_SELECTION(obj)) == MAX_SELECTIONS);

   /* atk_selection_is_child_selected test */
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));

   /* atk_selection_remove_selection test */
   g_assert(atk_selection_remove_selection(ATK_SELECTION(obj), ITEM_SEL_EINA));
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_ELM));

   /* atk_selection_select_all_selection test */
   g_assert(atk_selection_select_all_selection(ATK_SELECTION(obj)) == FALSE);

   /*
    * AtkAction tests
    */
   g_assert(ATK_IS_ACTION(obj));

   /* atk_action_get_n_actions test */
   g_assert(atk_action_get_n_actions(ATK_ACTION(obj)) == ACTIONS_COUNT);

   /* test existing actions */
   g_assert(atk_selection_add_selection(ATK_SELECTION(obj), ITEM_SEL_EINA));
   eailu_test_action_activate(ATK_ACTION(obj), "next");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EDJE));

   eailu_test_action_activate(ATK_ACTION(obj), "prev");
   g_assert(atk_selection_is_child_selected(ATK_SELECTION(obj), ITEM_SEL_EINA));

   /* test for non-existing action */
   g_assert((eailu_get_action_number(ATK_ACTION(obj), "typo")) == -1);

   /* test set/get action description */
   eailu_test_action_description_all(ATK_ACTION(obj));
}
Ejemplo n.º 9
0
static void
_test_slideshow_object(AtkObject *obj)
{
   int child_count, selection_count, action_count;
   AtkObject *child, *selection;
   gboolean result;
   const gchar *action_name, *action_description;
   /*sometimes this is called several times*/
   static int tested = 0;
   fprintf(stdout, "Testing slideshow\n");
   if (tested > 0) return;
   tested++;

   g_object_ref(obj);

   g_assert(eailu_is_object_with_role(obj, ATK_ROLE_LIST));

   child_count = atk_object_get_n_accessible_children(obj);
   g_assert(child_count == 9);

   for (int i = 0; i < child_count; i++)
     {
        child = atk_object_ref_accessible_child(obj, i);
        AtkRole role = atk_object_get_role(child);
        fprintf(stdout, "index %d child role: %s\n", i,
                atk_role_get_name(role));
        g_assert(eailu_is_object_with_role(child, ATK_ROLE_IMAGE));
        g_object_unref(child);
     }

   /*test AtkSelectionIface*/
   g_assert(ATK_IS_SELECTION(obj));
   selection = atk_selection_ref_selection(ATK_SELECTION(obj), 0);
   /*this may fail due to a problem with  slideshow cache*/
   g_assert(ATK_IS_OBJECT(selection));
   g_assert(eailu_is_object_with_role(selection, ATK_ROLE_IMAGE));
   g_object_unref(selection);
   selection_count = atk_selection_get_selection_count(ATK_SELECTION(obj));
   g_assert(selection_count == 1);
   result = atk_selection_add_selection(ATK_SELECTION(obj), 5);
   g_assert(result);
   result = atk_selection_is_child_selected(ATK_SELECTION(obj), 5);
   g_assert(result);

   /*test AtkActionIface*/
   g_assert(ATK_IS_ACTION(obj));
   /* test set/get action description */
   eailu_test_action_description_all(ATK_ACTION(obj));
   action_count = atk_action_get_n_actions(ATK_ACTION(obj));
   g_assert(4 == action_count);
   action_name = atk_action_get_name(ATK_ACTION(obj), 0);
   g_assert(!strcmp("next", action_name));
   action_name = atk_action_get_name(ATK_ACTION(obj), 1);
   g_assert(!strcmp("previous", action_name));
   result = atk_action_set_description(ATK_ACTION(obj), 2,
                                       "start the slideshow");
   g_assert(result);
   action_description = atk_action_get_description(ATK_ACTION(obj), 2);
   g_assert(!strcmp("start the slideshow", action_description));
   result = atk_action_do_action(ATK_ACTION(obj), 0);
   g_assert(result);
   result = atk_selection_is_child_selected(ATK_SELECTION(obj), 6);
   g_assert(result);

   eailu_test_atk_focus(obj, TRUE);

   g_object_unref(obj);
   eail_test_code_called = TRUE;
}