Esempio n. 1
0
/**
 * @brief Implementation AtkObject->ref_child callback
 *
 * ATK doc says:\n
 * Gets a reference to the specified accessible child of the object. The
 * accessible children are 0-based so the first accessible child is at index 0,
 * the second at index 1 and so on.
 *
 * @returns an AtkObject representing the specified accessible child of the
 * accessible.
 */
static AtkObject *
eail_naviframe_ref_child(AtkObject *obj, gint i)
{
   Eina_List *list;
   EailNaviframe *naviframe;
   EailWidget *widget;
   Evas_Object *e_object;

   g_return_val_if_fail(EAIL_IS_NAVIFRAME(obj), NULL);

   naviframe = EAIL_NAVIFRAME(obj);
   widget = EAIL_WIDGET(naviframe);

   e_object = eail_widget_get_widget(widget);

   list = elm_naviframe_items_get(e_object);
   int list_count = eina_list_count(list);
   if (i >= list_count)
     {
        eina_list_free(list);
        return NULL;
     }

   AtkObject *child = eail_naviframe_page_new(obj, i);
   atk_object_initialize(child, eina_list_nth(list, i));
   g_object_ref(child);
   naviframe->cached_pages = eina_list_append(naviframe->cached_pages, child);

   eina_list_free(list);

   return child;
}
Esempio n. 2
0
/**
 * @brief Initializer for AtkObjectClass
 *
 * @param obj an AtkObject
 * @param data initialization data
 */
static void
eail_naviframe_initialize(AtkObject *obj, gpointer data)
{
   Evas_Object *nested_widget = NULL;
   EailNaviframe *naviframe_obj = NULL;
   ATK_OBJECT_CLASS(eail_naviframe_parent_class)->initialize(obj, data);

   obj->role = ATK_ROLE_PAGE_TAB_LIST;
   g_return_if_fail(EAIL_IS_WIDGET(obj));

   nested_widget = eail_widget_get_widget(EAIL_WIDGET(obj));
   if (!nested_widget)
     {
        ERR("No evas object inside EailWidget was found");
        return;
     }

   evas_object_smart_callback_add(nested_widget, "transition,finished",
                                _eail_naviframe_handle_page_changed_event, obj);

   eail_naviframe_actions_init(EAIL_ACTION_WIDGET(obj));

   naviframe_obj = EAIL_NAVIFRAME(obj);
   /* storing last numbers of children to be for checking if children-changed
    * signal has to be propagated */
   naviframe_obj->child_count_last = eail_naviframe_n_children_get(obj);
}
Esempio n. 3
0
/**
 * @brief handler for event which is raised when naviframe page is changed
 * ("transition,finished" event)
 *
 * @param data passed to callback
 * @param obj object that raised event
 * @param event_info additional event info
 */
void
_eail_naviframe_handle_page_changed_event(void *data,
                                          Evas_Object *obj,
                                          void *event_info)
{
   EailNaviframe *naviframe_obj = NULL;
   g_return_if_fail(EAIL_IS_NAVIFRAME(data));
   gint n_children = 0;

   eail_emit_atk_signal
                  (ATK_OBJECT(data), "visible-data-changed", ATK_TYPE_OBJECT);

   naviframe_obj = EAIL_NAVIFRAME(data);
   if (!naviframe_obj) return;

   _eail_naviframe_emit_signals_changed(ATK_OBJECT(naviframe_obj));

   n_children = eail_naviframe_n_children_get(ATK_OBJECT(naviframe_obj));
   DBG("N_CHILDREN: %d", n_children);

   if (n_children && n_children > naviframe_obj->child_count_last)
     {
         eail_emit_children_changed(TRUE, ATK_OBJECT(data), n_children - 1);
     }
   else if(n_children < naviframe_obj->child_count_last)
    {
         eail_emit_children_changed(FALSE, ATK_OBJECT(data), n_children);
    }

   naviframe_obj->child_count_last = n_children;
}
Esempio n. 4
0
/**
 * @brief Destructor for naviframe object
 */
static void
eail_naviframe_finalize(GObject *obj)
{
   EailNaviframe *naviframe = EAIL_NAVIFRAME(obj);

   if (naviframe->click_description)
     free(naviframe->click_description);

   G_OBJECT_CLASS(eail_naviframe_parent_class)->finalize(obj);
}
Esempio n. 5
0
/**
 * @brief Implementation AtkObject->get_n_children callback
 *
 * ATK doc says:\n
 * Gets the number of accessible children of the accessible.
 *
 * @param obj an AtkObject
 *
 * @returns an integer representing the number of accessible children of
 * the accessible
 */
static gint
eail_naviframe_n_children_get(AtkObject *obj)
{
   EailNaviframe *naviframe;
   Evas_Object *widget;
   Eina_List *list;
   int list_count;

   g_return_val_if_fail(EAIL_IS_NAVIFRAME(obj), -1);

   naviframe = EAIL_NAVIFRAME(obj);
   widget = eail_widget_get_widget(EAIL_WIDGET(naviframe));
   list = elm_naviframe_items_get(widget);
   list_count = eina_list_count(list);
   eina_list_free(list);

   return list_count;
}
Esempio n. 6
0
/**
 * @brief click action callback
 *
 * @param action an AtkAction
 * @param data user data
 * @return TRUE on success, FALSE otherwise
 */
static gboolean
eail_naviframe_action_click(AtkAction *action, void *data)
{
   EailNaviframe *naviframe;
   Evas_Object *widget, *target;
   Elm_Object_Item *it;

   g_return_val_if_fail(EAIL_IS_NAVIFRAME(action), FALSE);

   naviframe = EAIL_NAVIFRAME(action);

   widget = eail_widget_get_widget(EAIL_WIDGET(naviframe));
   it = elm_naviframe_top_item_get(widget);
   if (!elm_naviframe_item_title_visible_get(it)) return FALSE;

   target = elm_object_item_widget_get(it);
   if (!target) return FALSE;

   evas_object_smart_callback_call(target, "title,clicked", it);

   return TRUE;
}