/** * @brief Implementation of get_image_position from AtkImage interface * * @param image EailButton instance * @param [out] x horizontal coordinate * @param [out] y vertical coordinate * @param coord_type coord type */ static void eail_button_get_image_position(AtkImage *image, gint *x, gint *y, AtkCoordType coord_type) { Evas_Object *button_image; Evas_Object *widget; AtkObject *obj; widget = eail_widget_get_widget(EAIL_WIDGET(image)); if (!widget) { *x = G_MININT; *y = G_MININT; return; } button_image = elm_object_part_content_get(widget, "icon"); if (button_image) { obj = eail_factory_get_accessible(button_image); atk_image_get_image_position(ATK_IMAGE(obj), x, y, coord_type); } else { *x = G_MININT; *y = G_MININT; } }
/** * @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; }
/** * @brief Gets obj state set * * The caller must unreference it when it is no longer needed * * @param obj an AtkObject * @return obj state set */ static AtkStateSet * eail_multibuttonentry_ref_state_set(AtkObject *obj) { AtkStateSet *state_set; Evas_Object *widget; g_return_val_if_fail(EAIL_MULTIBUTTONENTRY(obj), NULL); widget = eail_widget_get_widget(EAIL_WIDGET(obj)); state_set = ATK_OBJECT_CLASS(eail_multibuttonentry_parent_class)->ref_state_set(obj); if (!widget) return state_set; if (elm_multibuttonentry_expanded_get(widget)) { atk_state_set_add_state(state_set, ATK_STATE_EXPANDED); if (elm_multibuttonentry_editable_get(widget)) atk_state_set_add_state(state_set, ATK_STATE_EDITABLE); } else { atk_state_set_add_state(state_set, ATK_STATE_DEFAULT); } return state_set; }
/** * @brief Implementation of get_image_size from AtkImage interface * * @param image EailButton instance * @param [out] width width image * @param [out] height height image */ static void eail_button_get_image_size(AtkImage *image, gint *width, gint *height) { Evas_Object *widget; Evas_Object *button_image; AtkObject *obj; widget = eail_widget_get_widget(EAIL_WIDGET(image)); if (!widget) { *width = -1; *height = -1; return; } button_image = elm_object_part_content_get(widget, "icon"); if (button_image) { obj = eail_factory_get_accessible(button_image); atk_image_get_image_size(ATK_IMAGE(obj), width, height); } else { *width = -1; *height = -1; } }
/** * @brief Cuts text content from entry to clipboard * * @param text an AtkEditableText * @param start_pos start position of cursor * @param end_pos end position of cursor */ static void eail_multibuttonentry_cut_text(AtkEditableText *text, gint start_pos, gint end_pos) { Evas_Object *widget; Evas_Object *entry; const char *entry_text; char *tmp; GString *s; widget = eail_widget_get_widget(EAIL_WIDGET(text)); if (!widget || !elm_multibuttonentry_editable_get(widget)) return; entry = elm_multibuttonentry_entry_get(widget); entry_text = elm_entry_entry_get(entry); tmp = eail_get_substring(entry_text, start_pos, end_pos); eail_clipboard_set_text(tmp); g_free(tmp); s = g_string_new(entry_text); s = g_string_erase(s, start_pos, end_pos - start_pos); elm_entry_entry_set(entry, s->str); g_string_free(s, TRUE); }
/** * @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); }
/** * @brief Gets multibuttonentry items list * * @param multibuttonentry an EailMultibuttonentry * @return multibuttonentry items list * */ static const Eina_List * eail_multibuttonentry_get_items(EailMultibuttonentry *multibuttonentry) { Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(multibuttonentry)); if (!widget) return NULL; return elm_multibuttonentry_items_get(widget); }
/** * @brief Get list of created widgets * * @param gengrid EailGengrid instance * * @returns list of widgets elm_gengrid holds */ static Eina_List * eail_gengrid_items_get(EailGengrid *gengrid) { g_return_val_if_fail(EAIL_IS_WIDGET(gengrid), NULL); Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(gengrid)); return elm_gengrid_realized_items_get(widget); }
/** * @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_segment_control_get_n_children(AtkObject *obj) { gint n_items; Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(obj)); n_items = elm_segment_control_item_count_get(widget); return n_items; }
/** * @brief gets list of Elm_Object_Item* that is contained in index widget * * @param obj and EailIndex AtkObject * * @returns const Eina_List * with Elm_Object_Item* for every index */ static const Eina_List * eail_index_get_index_items(AtkObject *obj) { Evas_Object *index_widget = NULL; index_widget = eail_widget_get_widget(EAIL_WIDGET(obj)); g_return_val_if_fail(index_widget, NULL); ELM_INDEX_DATA_GET(index_widget, index_sd); g_return_val_if_fail(index_sd, NULL); return index_sd->items; }
/** * @brief Click action callback * * @param action an AtkAction * @param data data passed to callback * @return TRUE on success, FALSE otherwise */ static gboolean _eail_photocam_action_click(AtkAction *action, void *data) { Evas_Object *widget; g_return_val_if_fail(EAIL_IS_PHOTOCAM(action), FALSE); widget = eail_widget_get_widget(EAIL_WIDGET(action)); if (!widget) return FALSE; evas_object_smart_callback_call(widget, "clicked", NULL); return TRUE; }
/** * @brief Scrollup action callback * * @param action an AtkAction * @param data additional callback data * @returns TRUE on success, FALSE otherwise */ static gboolean _action_scroll_up(AtkAction *action, void *data) { Evas_Object *widget; g_return_val_if_fail(EAIL_IS_SCROLLABLE_WIDGET(action), FALSE); widget = eail_widget_get_widget(EAIL_WIDGET(action)); _eail_scrollable_handle_scroll_event(action, widget, NULL); return eail_action_scroll_up(widget, NULL); }
/** * @brief Helper function to getting "elm_popup" Evas_Object* from Atk EailPopup * * @returns nested "elm_popup" widget */ static Evas_Object * _eail_get_popup_widget_from_atkobj(AtkObject *obj) { Evas_Object *popup_widget = NULL; popup_widget = eail_widget_get_widget(EAIL_WIDGET(obj)); if (!popup_widget) { ERR("No widget found for notification object!"); return NULL; } return popup_widget; }
/** * @brief EailSlider object initialization * * @param obj EailSlider object * @param data user set additional initialization data */ static void eail_slider_initialize(AtkObject *obj, gpointer data) { Evas_Object *nested_widget = NULL; ATK_OBJECT_CLASS(eail_slider_parent_class)->initialize(obj, data); obj->role = ATK_ROLE_SLIDER; g_return_if_fail(EAIL_IS_WIDGET(obj)); nested_widget = eail_widget_get_widget(EAIL_WIDGET(obj)); evas_object_smart_callback_add(nested_widget, "changed", _eail_slider_handle_changed_event, obj); }
/** * @brief Gets the character at offset * * @param text AtkText instance * @param offset character offset * @returns char representing the character at offset */ static gunichar eail_button_get_character_at_offset(AtkText *text, gint offset) { gunichar character = '\0'; Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(text)); if (widget) character = g_utf8_get_char( g_utf8_offset_to_pointer(elm_object_text_get(widget), offset)); return character; }
/** * @brief Gets text bounded by start_offset and end_offset * * Use g_free() to free the returned string. * * @param text AtkText instance * @param start_offset start position * @param end_offset end position, -1 for the end of the string * * @return string containing the text from start_offset up to, * but not including end_offset */ static gchar* eail_button_get_text(AtkText *text, gint start_offset, gint end_offset) { gchar *string = NULL; Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(text)); if (widget) string = (gchar *)elm_object_text_get(widget); return eail_get_substring(string, start_offset, end_offset); }
/** * @brief Implementation of ref_state_set from AtkObject * * @param obj EailGengrid instance * * @returns reference to an state set of accessible */ static AtkStateSet * eail_gengrid_ref_state_set(AtkObject *obj) { Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(obj)); AtkStateSet *state_set = ATK_OBJECT_CLASS(eail_gengrid_parent_class)->ref_state_set(obj); if (!widget) return state_set; if (elm_gengrid_multi_select_get(widget)) atk_state_set_add_state(state_set, ATK_STATE_MULTISELECTABLE); return state_set; }
/** * @brief Inits Action interface for PANEL * * @param action an AtkAction * @param data data passed to callback * @returns TRUE on success, FALSE otherwise */ static gboolean eail_panel_action_toggle(AtkAction *action, void *data) { Evas_Object *widget; g_return_val_if_fail(EAIL_IS_PANEL(action), FALSE); widget = eail_widget_get_widget(EAIL_WIDGET(action)); if (!widget) return FALSE; elm_panel_toggle(widget); return TRUE; }
/** * @brief Gets the image size * * @param image AtkImage instance * @param [out] width photo width or -1 if value cannot be obtained * @param [out] height photo height or -1 if value cannot be obtained */ static void eail_photo_size_get(AtkImage *image, gint *width, gint *height) { g_return_if_fail(ATK_IS_IMAGE(image)); Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(image)); if (!widget) { *width = -1; *height = -1; return; } evas_object_geometry_get(widget, NULL, NULL, width, height); }
/** * @brief Gets name of EailItem * * Implementation of AtkObject->get_name callback * * ATK doc says:\n * Gets the accessible name of the accessible. * * @returns a character string representing the accessible description of * the accessible. */ static const gchar * eail_popup_get_name(AtkObject *obj) { Evas_Object *popup_widget = NULL; popup_widget = eail_widget_get_widget(EAIL_WIDGET(obj)); if (!popup_widget) { ERR("No widget found for notification object!"); return NULL; } return elm_object_part_text_get(popup_widget, "title,text"); }
/** * @brief ZoomOut action callback * * @param action an AtkAction * @param data data passed to callback * @return TRUE on success, FALSE otherwise */ static gboolean _eail_photocam_action_zoom_out(AtkAction *action, void *data) { Evas_Object *widget; double zoom_level; g_return_val_if_fail(EAIL_IS_PHOTOCAM(action), FALSE); widget = eail_widget_get_widget(EAIL_WIDGET(action)); if (!widget) return FALSE; zoom_level = elm_photocam_zoom_get(widget) + EAIL_PHOTOCAM_ZOOM_STEP; elm_photocam_zoom_set(widget, zoom_level); return TRUE; }
/** * @brief Prepares Eina_List filled with Elm_Object_Item* objects * representing items in the list * * @return filled list with list items. Call eina_list_free on that list when * results processing has been finished */ static Eina_List * eail_genlist_get_items(EailGenlist *genlist) { Eina_List *items = NULL; Elm_Object_Item *item; Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(genlist)); item = elm_genlist_first_item_get(widget); while (item) { items = eina_list_append(items, item); item = elm_genlist_item_next_get(item); } return items; }
/** * @brief Implementation of ref_state_set from AtkObject * * @param object EailVideo instance * * @returns referred AtkStateSet object with accessible state set */ static AtkStateSet* eail_video_ref_state_set(AtkObject *object) { AtkStateSet *state_set; Evas_Object *widget; g_return_val_if_fail(EAIL_IS_VIDEO(object), NULL); widget = eail_widget_get_widget(EAIL_WIDGET(object)); if (!widget) return NULL; state_set = ATK_OBJECT_CLASS(eail_video_parent_class)->ref_state_set(object); atk_state_set_add_state(state_set, ATK_STATE_ANIMATED); return state_set; }
/** * @brief Gets slider name * * @param obj EailSlider instance * @returns accessible name */ static const gchar* eail_progressbar_get_name(AtkObject *obj) { const gchar *name; Evas_Object *widget; name = ATK_OBJECT_CLASS(eail_progressbar_parent_class)->get_name(obj); if (name) return name; widget = eail_widget_get_widget(EAIL_WIDGET(obj)); if (widget) name = (const gchar*)elm_object_text_get(widget); return name; }
/** * @brief Helper function for getting nested content of elm_popup widget * * @param obj AtkObject instance * * @returns Evas_Object representing the nested widget content * from elm_popup widget */ static Evas_Object * _eail_get_nested_widget(AtkObject *obj) { Evas_Object *ctxpopup_widget = NULL, *nested_widget = NULL; /* getting widget of ctxpopup class */ ctxpopup_widget = eail_widget_get_widget(EAIL_WIDGET(obj)); if (!ctxpopup_widget) { ERR("No widget found for EailCtxpopup object!"); } nested_widget = elm_object_part_content_get(ctxpopup_widget, "default"); return nested_widget; }
/** * @brief Helper function for getting nested content in notify widget * * @param obj an AtkObject * * @returns nested widget content from notify widget */ static Evas_Object * _eail_get_nested_widget(AtkObject *obj) { Evas_Object *notify_widget = NULL, *nested_widget = NULL; /* getting widget of notify class */ notify_widget = eail_widget_get_widget(EAIL_WIDGET(obj)); if (!notify_widget) { ERR("No widget found for notification object!"); } nested_widget = elm_object_part_content_get(notify_widget, "default"); return nested_widget; }
/** * @brief Gets the list of widget's children * * @param widget EailWidget instance * * @returns Eina_list representing the list of children * or NULL if widget has no children */ static Eina_List * eail_button_get_widget_children(EailWidget *widget) { Eina_List *list = NULL; Evas_Object *child, *obj; obj = eail_widget_get_widget(EAIL_WIDGET(widget)); if (obj) { child = elm_object_part_content_get(obj, "icon"); if (child && elm_object_widget_check(child)) list = eina_list_append(list, child); } return list; }
/** * @brief 'release' action callback * * @param action AtkAction instance * @param data user data passed to callback * * @returns TRUE if action was successfull, FALSE otherwise */ static gboolean eail_button_action_release_cb(AtkAction *action, void *data) { 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; evas_object_smart_callback_call(widget, "unpressed", NULL); eail_button_atk_notify_release(action, NULL, NULL); return TRUE; }
/** * @brief Implementation of get_name from AtkObject * * @param object EailVideo instance * * @returns played video file title or NULL if not set */ static const gchar* eail_video_name_get(AtkObject *object) { Evas_Object *video; const gchar *atk_name; g_return_val_if_fail(EAIL_IS_VIDEO(object), NULL); atk_name = ATK_OBJECT_CLASS(eail_video_parent_class)->get_name(object); if (atk_name) return atk_name; video = eail_widget_get_widget(EAIL_WIDGET(object)); if (!video) return NULL; return elm_video_title_get(video); }
/** * @brief Implementation of get_n_children from AtkObject interface * * @param obj EailSlideshow instance * @returns number of widget childs */ static gint eail_slideshow_n_children_get(AtkObject *obj) { Evas_Object *widget; gint items_count; g_return_val_if_fail(EAIL_IS_SLIDESHOW(obj), 0); widget = eail_widget_get_widget(EAIL_WIDGET(obj)); if (!widget) return 0; /*the real number of items stored in slideshow widget is returned by elm_slideshow_count_get. However we will not be able to return all items widget since only those stored in cache are created.*/ items_count = elm_slideshow_count_get(widget); return items_count; }