예제 #1
0
JNIEXPORT jstring JNICALL
Java_org_gnome_atk_AtkAction_atk_1action_1get_1name
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jint _i
)
{
	const gchar* result;
	jstring _result;
	AtkAction* self;
	gint i;

	// convert parameter self
	self = (AtkAction*) _self;

	// convert parameter i
	i = (gint) _i;

	// call function
	result = atk_action_get_name(self, i);

	// cleanup parameter self

	// cleanup parameter i

	// translate return value to JNI type
	_result = (jstring) bindings_java_newString(env, result);

	// and finally
	return _result;
}
예제 #2
0
static DBusMessage *
impl_get_name (DBusConnection * bus, DBusMessage * message, void *user_data)
{
  DBusMessage *reply;
  dbus_int32_t index;
  const char *name;
  AtkAction *action = (AtkAction *) user_data;

  g_return_val_if_fail (ATK_IS_ACTION (user_data),
                        droute_not_yet_handled_error (message));
  if (!dbus_message_get_args
      (message, NULL, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID))
    {
      return droute_invalid_arguments_error (message);
    }
  name = atk_action_get_name (action, index);
  if (!name)
    name = "";
  reply = dbus_message_new_method_return (message);
  if (reply)
    {
      dbus_message_append_args (reply, DBUS_TYPE_STRING, &name,
                                DBUS_TYPE_INVALID);
    }
  return reply;
}
bool AccessibilityUIElement::isPressActionSupported()
{
    if (!ATK_IS_ACTION(m_element.get()))
        return false;

    const gchar* actionName = atk_action_get_name(ATK_ACTION(m_element.get()), 0);
    return equalIgnoringCase(actionName, String("press")) || equalIgnoringCase(actionName, String("jump"));
}
예제 #4
0
// This is used to set ATK action descriptions.
void glade_set_atk_action_description (AtkAction *action, const gchar *action_name, const gchar *description)
  {
  gint n_actions, i;

  n_actions = atk_action_get_n_actions (action);
  for (i = 0; i < n_actions; i++)
    if (!strcmp (atk_action_get_name (action, i), action_name))
      atk_action_set_description (action, i, description);
  }
예제 #5
0
static DBusMessage *
impl_GetActions (DBusConnection * bus, DBusMessage * message, void *user_data)
{
  AtkAction *action = (AtkAction *) user_data;
  DBusMessage *reply;
  gint count;
  gint i;
  DBusMessageIter iter, iter_array, iter_struct;

  g_return_val_if_fail (ATK_IS_ACTION (user_data),
                        droute_not_yet_handled_error (message));
  count = atk_action_get_n_actions (action);
  reply = dbus_message_new_method_return (message);
  if (!reply)
    goto oom;
  dbus_message_iter_init_append (reply, &iter);
  if (!dbus_message_iter_open_container
      (&iter, DBUS_TYPE_ARRAY, "(sss)", &iter_array))
    goto oom;
  for (i = 0; i < count; i++)
    {
      const char *name = atk_action_get_name (action, i);
      const char *lname = atk_action_get_localized_name (action, i);
      const char *desc = atk_action_get_description (action, i);
      const char *kb = atk_action_get_keybinding (action, i);
      if (!name)
        name = "";
      if (!lname)
        lname = "";
      if (!desc)
        desc = "";
      if (!kb)
        kb = "";
      if (!dbus_message_iter_open_container
          (&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct))
        goto oom;
      dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
      dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &lname);
      dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc);
      dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &kb);
      if (!dbus_message_iter_close_container (&iter_array, &iter_struct))
        goto oom;
    }
  if (!dbus_message_iter_close_container (&iter, &iter_array))
    goto oom;
  return reply;
oom:
  // TODO: handle out-of-memory
  return reply;
}
예제 #6
0
/**
 * @brief Performs the specified action on the object
 *
 * Implementation of do_action from AtkAction interface.
 *
 * @param action AtkAction instance
 * @param i action index
 *
 * @return TRUE on success, FALSE otherwise
 */
static gboolean
eail_ctxpopup_do_action(AtkAction *action,
                        int i)
{
   Evas_Object *widget;

   widget = eail_widget_get_widget(EAIL_WIDGET(action));
   if (!widget) return FALSE;

   if ((elm_object_disabled_get(widget)) || (!evas_object_visible_get(widget)))
     return FALSE;

   const char *action_name = atk_action_get_name(action, i);
   if (!action_name) return FALSE;

   if (!g_strcmp0(action_name, "dismiss"))
     elm_ctxpopup_dismiss(widget);
   else
     return FALSE;

   return TRUE;
}
예제 #7
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;
}
예제 #8
0
파일: testmenuitem.c 프로젝트: BYC/gtk
static void 
_check_object (AtkObject *obj)
{
  AtkRole role;
  static G_CONST_RETURN char *name = NULL;
  static gboolean first_time = TRUE;

  role = atk_object_get_role (obj);
  if (role == ATK_ROLE_FRAME)
  /*
   * Find the specified menu item
   */
  {
    AtkRole valid_roles[NUM_VALID_ROLES];
    AtkObject *atk_menu_item;
    GtkWidget *widget;

    if (name == NULL)
    {
      valid_roles[0] = ATK_ROLE_MENU_ITEM;

      name = g_getenv ("TEST_ACCESSIBLE_NAME");
      if (name == NULL)
        name = "foo";
    }
    atk_menu_item = find_object_by_accessible_name_and_role (obj, name,
                     valid_roles, NUM_VALID_ROLES);

    if (atk_menu_item == NULL)
    {
      g_print ("Object not found for %s\n", name);
      return;
    }

    g_assert (GTK_IS_ACCESSIBLE (atk_menu_item));
    widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_menu_item));
    g_assert (GTK_IS_MENU_ITEM (widget));

    if (first_time)
      first_time = FALSE;
    else
      return;

    /*
     * This action opens the menu whose name is "foo" or whatever
     * was specified in the environment variable TEST_ACCESSIBLE_NAME
     */
    atk_action_do_action (ATK_ACTION (atk_menu_item), 0);
  }
  else if ((role == ATK_ROLE_MENU_ITEM) ||
           (role == ATK_ROLE_CHECK_MENU_ITEM) ||
           (role == ATK_ROLE_RADIO_MENU_ITEM) ||
           (role == ATK_ROLE_TEAR_OFF_MENU_ITEM))
  {
    G_CONST_RETURN char *keybinding;
    G_CONST_RETURN char *accessible_name;

    accessible_name = atk_object_get_name (obj);
    if (accessible_name)
      g_print ("Name: %s\n", accessible_name);
    g_print ("Action: %s\n", atk_action_get_name (ATK_ACTION (obj), 0));
    keybinding = atk_action_get_keybinding (ATK_ACTION (obj), 0);
    if (keybinding)
      g_print ("KeyBinding: %s\n", keybinding);
    /*
     * Do the action associated with the menu item once, otherwise
     * we get into a loop
     */
    if (strcmp (name, accessible_name) == 0)
    {
      if (first_time)
        first_time = FALSE;
      else
        return;
      if (g_getenv ("TEST_ACCESSIBLE_AUTO"))
        {
          g_idle_add (_do_menu_item_action, obj);
        }
    }
  }
  else
  {
    G_CONST_RETURN char *accessible_name;

    accessible_name = atk_object_get_name (obj);
    if (accessible_name)
      g_print ("Name: %s\n", accessible_name);
    else if (GTK_IS_ACCESSIBLE (obj))
    {
      GtkWidget *widget;

      widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
      g_print ("Type: %s\n", g_type_name (G_OBJECT_TYPE (widget)));
    } 
  }
}