2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
23 * @brief Header for Eail Utility functions
35 #define EAIL_STR_SCROLL_UP "scroll_up" /**< @brief String for 'scroll up'*/
36 #define EAIL_STR_SCROLL_DOWN "scroll_down" /**< @brief String for 'scroll down'*/
37 #define EAIL_STR_SCROLL_LEFT "scroll_left" /**< @brief String for 'scroll left'*/
38 #define EAIL_STR_SCROLL_RIGHT "scroll_right" /**< @brief String for 'scroll right'*/
40 #define float_epsilon 0.00001
41 #define float_equal(a,b) (fabs((a) - (b)) < float_epsilon)
44 * @enum EAIL_SCROLL_TYPE Type of scroll direction
48 EAIL_SCROLL_TYPE_UP,/**< scroll 'up' direction */
49 EAIL_SCROLL_TYPE_DOWN,/**< scroll 'down' direction */
50 EAIL_SCROLL_TYPE_LEFT,/**< scroll 'left' direction */
51 EAIL_SCROLL_TYPE_RIGHT/**< scroll 'right' direction */
55 * @brief Helper function gets substring from string
57 gchar *eail_get_substring(const gchar* string, gint start_offset, gint end_offset);
60 * @brief Generic function for generating ref_state for Evas_Objects stored in
64 AtkStateSet *eail_evas_obj_ref_state_set(Evas_Object *widget,
65 AtkStateSet *state_set);
68 * @brief Generic function for grabbing focus on Evas_Object stored in ATK object
70 gboolean eail_evas_obj_grab_focus(Evas_Object *widget);
73 * @brief Emulates mouse 'press' event at given coordinates
75 void eail_mouse_press_on_coords(Evas_Object *widget, int x, int y);
78 * @brief Emulates mouse 'release' event at given coordinates
80 void eail_mouse_release_on_coords(Evas_Object *widget, int x, int y);
83 * @brief Emulates mouse 'click' event at given coordinates
85 void eail_mouse_click_on_coords(Evas_Object *widget, int x, int y);
88 * @brief Gets coordinates of center of given widget
90 void eail_get_coords_widget_center(Evas_Object *widget, int *x, int *y);
93 * @brief Gets edje parts list for item
96 Eina_List *eail_get_edje_parts_for_item(Elm_Object_Item *item);
99 * @brief Gets edje object for item
102 Evas_Object *eail_get_edje_obj_from_item(Elm_Object_Item *item);
105 * @brief Gets text content from item (each text is put into field in Eina_List
108 Eina_List *eail_item_get_content_strings(Elm_Object_Item *item);
111 * @brief Scrolls screen to given direction
113 gboolean eail_handle_scroll(Evas_Object *widget,
114 enum EAIL_SCROLL_TYPE type);
117 * @brief Scrolls screen up
119 gboolean eail_action_scroll_up(Evas_Object *widget,
123 * @brief Scrolls screen down
125 gboolean eail_action_scroll_down(Evas_Object *widget,
129 * @brief Scrolls screen left
131 gboolean eail_action_scroll_left(Evas_Object *widget,
135 * @brief Scrolls screen right
137 gboolean eail_action_scroll_right(Evas_Object *widget,
141 * @brief Emits signal for ATK Object
143 void eail_emit_atk_signal(AtkObject * atk_obj,
144 const gchar *signal_name,
148 * @brief Handler for selected event in for list-based content
150 void eail_list_item_handle_selected_event(void *data,
155 * @brief Handler for unselected event for list-based content
157 void eail_list_item_handle_unselected_event(void *data,
163 * @brief Gets raw evas object list for eail item
165 Eina_List *eail_get_raw_evas_obj_list_from_item(Elm_Object_Item *item);
168 * @brief Helper function for emitting 'children changed' signal when needed
170 void eail_emit_children_changed(gboolean added,
175 * @brief Helper function for emit children changed signal when needed (func
176 * version that takes object instead of index-number)
178 void eail_emit_children_changed_obj(gboolean added,
180 AtkObject *changed_obj);
183 * @brief Helper function to notify windows about focus changes of its children
185 void eail_notify_child_focus_changes(void);
188 * @brief Helper function to get a slice of the text from textblock after offset
190 * Use g_free() to free the returned string.
192 * @param textblock Evas textblock
193 * @param offset character offset
194 * @param boundary_type AtkTextBoundary instance
195 * @param [out] start_offset start position of the returned text
196 * @param [out] end_offset end position of the returned text
197 * @returns newly allocated string containg a slice of text from textblock
200 eail_get_text_after(const Evas_Object *textblock,
202 AtkTextBoundary boundary_type,
206 * @brief Helper function to get a slice of the text from textblock at offset
208 * Use g_free() to free the returned string.
210 * @param textblock Evas textblock
211 * @param offset character offset
212 * @param boundary_type AtkTextBoundary instance
213 * @param [out] start_offset start position of the returned text
214 * @param [out] end_offset end position of the return text
215 * @returns newly allocated string containing a slice of text from textblock
218 eail_get_text_at(const Evas_Object *textblock,
220 AtkTextBoundary boundary_type,
224 * @brief Helper function to get a slice of the text from textblock before offset
226 * Use g_free() to free the returned string.
228 * @param textblock Evas textblock
229 * @param entry entry widget instance
230 * @param offset character offset
231 * @param boundary_type AtkTextBoundary instance
232 * @param [out] start_offset start position of the returned text
233 * @param [out] end_offset end position of the returned text
234 * @returns newly allocated string containing a slice of text from textblock
237 eail_get_text_before(const Evas_Object *textblock,
239 AtkTextBoundary boundary_type,
243 * @brief Helper function to add attribute to attribute set
245 * @param attrib_set AtkAttributeSet to add the attribute to
246 * @param attr AtkTextAttrribute to be added
247 * @param value attribute value
249 * Creates an AtkAttribute from attr and value, and adds it
252 * @returns AtkAttributeSet containing set with added attribute
255 eail_utils_text_add_attribute(AtkAttributeSet *attrib_set,
256 AtkTextAttribute attr,