Smart_Data * sd = evas_object_smart_data_get(obj); \
if (!sd) return;
+#undef elm_widget_text_set_hook_set
+#undef elm_widget_text_get_hook_set
+#undef elm_widget_content_set_hook_set
+#undef elm_widget_content_get_hook_set
+#undef elm_widget_content_unset_hook_set
+
typedef struct _Smart_Data Smart_Data;
typedef struct _Edje_Signal_Data Edje_Signal_Data;
typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data;
Evas_Object *obj;
const char *type;
Evas_Object *parent_obj;
+ Evas_Object *parent2;
Evas_Coord x, y, w, h;
Eina_List *subobjs;
Evas_Object *resize_obj;
Evas_Coord *y,
Evas_Coord *w,
Evas_Coord *h);
- void (*on_text_set_func)(Evas_Object *obj,
- const char *item,
- const char *text);
- const char *(*on_text_get_func)(const Evas_Object *obj,
- const char *item);
- void (*on_content_set_func)(Evas_Object *obj,
- const char *item,
- Evas_Object *content);
- Evas_Object *(*on_content_get_func)(const Evas_Object *obj,
- const char *item);
- Evas_Object *(*on_content_unset_func)(Evas_Object *obj,
- const char *item);
+ Elm_Widget_On_Text_Set_Cb on_text_set_func;
+ Elm_Widget_On_Text_Get_Cb on_text_get_func;
+ Elm_Widget_On_Content_Set_Cb on_content_set_func;
+ Elm_Widget_On_Content_Get_Cb on_content_get_func;
+ Elm_Widget_On_Content_Unset_Cb on_content_unset_func;
void *data;
Evas_Coord rx, ry, rw, rh;
int scroll_hold;
double scale;
Elm_Theme *theme;
const char *style;
+ const char *access_info;
unsigned int focus_order;
Eina_Bool focus_order_on_calc;
Eina_Bool can_focus : 1;
Eina_Bool child_can_focus : 1;
Eina_Bool focused : 1;
+ Eina_Bool top_win_focused : 1;
Eina_Bool tree_unfocusable : 1;
Eina_Bool highlight_ignore : 1;
Eina_Bool highlight_in_theme : 1;
}
static void
-_sub_obj_mouse_down(void *data __UNUSED__,
- Evas *e __UNUSED__,
- Evas_Object *obj,
- void *event_info __UNUSED__)
+_sub_obj_mouse_up(void *data __UNUSED__,
+ Evas *e __UNUSED__,
+ Evas_Object *obj,
+ void *event_info)
{
- elm_widget_focus_mouse_down_handle(obj);
+ Evas_Event_Mouse_Up *ev = event_info;
+ if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
+ elm_widget_focus_mouse_up_handle(obj);
}
static void
focus_order++;
sd->focus_order = focus_order;
- sd->focused = EINA_TRUE;
- if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
- if (sd->focus_func) sd->focus_func(obj);
-
- _elm_widget_focus_region_show(obj);
-
+ if (sd->top_win_focused)
+ {
+ sd->focused = EINA_TRUE;
+ if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
+ if (sd->focus_func) sd->focus_func(obj);
+ _elm_widget_focus_region_show(obj);
+ }
sd->focus_order_on_calc = EINA_FALSE;
}
widtypes = eina_list_append(widtypes, (void *)ptr);
}
+/**
+ * @defgroup Widget Widget
+ *
+ * @internal
+ * Disposed api for making widgets
+ */
+EAPI void
+elm_widget_type_unregister(const char **ptr)
+{
+ widtypes = eina_list_remove(widtypes, (void *)ptr);
+}
+
EAPI Eina_Bool
elm_widget_api_check(int ver)
{
EAPI void
elm_widget_text_set_hook_set(Evas_Object *obj,
- void (*func)(Evas_Object *obj,
- const char *item,
- const char *text))
+ Elm_Widget_On_Text_Set_Cb func)
{
API_ENTRY return;
sd->on_text_set_func = func;
EAPI void
elm_widget_text_get_hook_set(Evas_Object *obj,
- const char *(*func)(const Evas_Object *obj,
- const char *item))
+ Elm_Widget_On_Text_Get_Cb func)
{
API_ENTRY return;
sd->on_text_get_func = func;
EAPI void
elm_widget_content_set_hook_set(Evas_Object *obj,
- void (*func)(Evas_Object *obj,
- const char *item,
- Evas_Object *content))
+ Elm_Widget_On_Content_Set_Cb func)
{
API_ENTRY return;
sd->on_content_set_func = func;
EAPI void
elm_widget_content_get_hook_set(Evas_Object *obj,
- Evas_Object *(*func)(const Evas_Object *obj, const char *item))
+ Elm_Widget_On_Content_Get_Cb func)
{
API_ENTRY return;
sd->on_content_get_func = func;
EAPI void
elm_widget_content_unset_hook_set(Evas_Object *obj,
- Evas_Object *(*func)(Evas_Object *obj,
- const char *item))
+ Elm_Widget_On_Content_Unset_Cb func)
{
API_ENTRY return;
sd->on_content_unset_func = func;
if (sd2->parent_obj)
elm_widget_sub_object_del(sd2->parent_obj, sobj);
sd2->parent_obj = obj;
+ sd2->top_win_focused = sd->top_win_focused;
if (!sd->child_can_focus && (_is_focusable(sobj)))
sd->child_can_focus = EINA_TRUE;
}
}
evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_DEL,
_sub_obj_del, sd);
- evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_DOWN,
- _sub_obj_mouse_down, sd);
+ evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_UP,
+ _sub_obj_mouse_up, sd);
evas_object_smart_member_del(sd->resize_obj);
if (_elm_widget_is(sd->resize_obj))
{
}
evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL,
_sub_obj_del, sd);
- evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_DOWN,
- _sub_obj_mouse_down, sd);
+ evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_UP,
+ _sub_obj_mouse_up, sd);
evas_object_smart_member_del(sobj);
if (_elm_widget_is(sobj))
{
if (_elm_widget_is(sd->resize_obj))
{
Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
- if (sd2) sd2->parent_obj = obj;
+ if (sd2)
+ {
+ sd2->parent_obj = obj;
+ sd2->top_win_focused = sd->top_win_focused;
+ }
evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE,
_sub_obj_hide, sd);
}
evas_object_smart_member_add(sobj, obj);
evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL,
_sub_obj_del, sd);
- evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_DOWN,
- _sub_obj_mouse_down, sd);
+ evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_UP,
+ _sub_obj_mouse_up, sd);
_smart_reconfigure(sd);
evas_object_data_set(sobj, "elm-parent", obj);
evas_object_smart_callback_call(obj, "sub-object-add", sobj);
* This API makes the widget object and its children to be unfocusable.
*
* This API can be helpful for an object to be deleted.
- * When an object will be deleted soon, it and its children may not
+ * When an object will be deleted soon, it and its children may not
* want to get focus (by focus reverting or by other focus controls).
* Then, just use this API before deleting.
*
return sd->tree_unfocusable;
}
+/**
+ * @internal
+ *
+ * Get the list of focusable child objects.
+ *
+ * This function retruns list of child objects which can get focus.
+ *
+ * @param obj The parent widget
+ * @retrun list of focusable child objects.
+ *
+ * @ingroup Widget
+ */
+EAPI Eina_List *
+elm_widget_can_focus_child_list_get(const Evas_Object *obj)
+{
+ API_ENTRY return NULL;
+
+ const Eina_List *l;
+ Eina_List *child_list = NULL;
+ Evas_Object *child;
+
+ if (sd->subobjs)
+ {
+ EINA_LIST_FOREACH(sd->subobjs, l, child)
+ {
+ if ((elm_widget_can_focus_get(child)) &&
+ (evas_object_visible_get(child)) &&
+ (!elm_widget_disabled_get(child)))
+ child_list = eina_list_append(child_list, child);
+ else if (elm_widget_is(child))
+ {
+ Eina_List *can_focus_list;
+ can_focus_list = elm_widget_can_focus_child_list_get(child);
+ if (can_focus_list)
+ child_list = eina_list_merge(child_list, can_focus_list);
+ }
+ }
+ }
+ return child_list;
+}
+
EAPI void
elm_widget_highlight_ignore_set(Evas_Object *obj,
Eina_Bool ignore)
return parent;
}
+EAPI Evas_Object *
+elm_widget_parent2_get(const Evas_Object *obj)
+{
+ if (_elm_widget_is(obj))
+ {
+ Smart_Data *sd = evas_object_smart_data_get(obj);
+ if (sd) return sd->parent2;
+ }
+ return NULL;
+}
+
+EAPI void
+elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent)
+{
+ API_ENTRY return;
+ sd->parent2 = parent;
+}
+
EAPI void
elm_widget_event_callback_add(Evas_Object *obj,
Elm_Event_Cb func,
Elm_Focus_Direction dir,
Evas_Object **next)
{
- Eina_List *(*list_next)(const Eina_List * list);
+ Eina_List *(*list_next)(const Eina_List * list) = NULL;
if (!next)
return EINA_FALSE;
EAPI void
elm_widget_focus_steal(Evas_Object *obj)
{
- Evas_Object *parent, *o;
+ Evas_Object *parent, *parent2, *o;
API_ENTRY return;
if (sd->focused) return;
if (sd->focused) break;
parent = o;
}
- if (!elm_widget_parent_get(parent))
- elm_widget_focused_object_clear(parent);
+ if ((!elm_widget_parent_get(parent)) &&
+ (!elm_widget_parent2_get(parent)))
+ elm_widget_focused_object_clear(parent);
else
{
- parent = elm_widget_parent_get(parent);
+ parent2 = elm_widget_parent_get(parent);
+ if (!parent2) parent2 = elm_widget_parent2_get(parent);
+ parent = parent2;
sd = evas_object_smart_data_get(parent);
- if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj)))
- elm_widget_focused_object_clear(sd->resize_obj);
- else
+ if (sd)
{
- const Eina_List *l;
- Evas_Object *child;
- EINA_LIST_FOREACH(sd->subobjs, l, child)
+ if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj)))
+ elm_widget_focused_object_clear(sd->resize_obj);
+ else
{
- if (elm_widget_focus_get(child))
+ const Eina_List *l;
+ Evas_Object *child;
+ EINA_LIST_FOREACH(sd->subobjs, l, child)
{
- elm_widget_focused_object_clear(child);
- break;
+ if (elm_widget_focus_get(child))
+ {
+ elm_widget_focused_object_clear(child);
+ break;
+ }
}
}
}
}
EAPI void
+elm_widget_focus_restore(Evas_Object *obj)
+{
+ Evas_Object *newest = NULL;
+ unsigned int newest_focus_order = 0;
+ API_ENTRY return;
+
+ newest = _newest_focus_order_get(obj, &newest_focus_order, EINA_TRUE);
+ if (newest)
+ {
+ elm_object_focus_set(newest, EINA_FALSE);
+ elm_object_focus_set(newest, EINA_TRUE);
+ }
+}
+
+void
+_elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused)
+{
+ const Eina_List *l;
+ Evas_Object *child;
+ API_ENTRY return;
+
+ if (sd->top_win_focused == top_win_focused) return;
+ if (sd->resize_obj)
+ _elm_widget_top_win_focused_set(sd->resize_obj, top_win_focused);
+ EINA_LIST_FOREACH(sd->subobjs, l, child)
+ {
+ _elm_widget_top_win_focused_set(child, top_win_focused);
+ }
+ sd->top_win_focused = top_win_focused;
+}
+
+Eina_Bool
+_elm_widget_top_win_focused_get(const Evas_Object *obj)
+{
+ API_ENTRY return EINA_FALSE;
+ return sd->top_win_focused;
+}
+
+EAPI void
elm_widget_activate(Evas_Object *obj)
{
API_ENTRY return;
}
EAPI void
-elm_widget_text_part_set(Evas_Object *obj, const char *item, const char *label)
+elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label)
{
API_ENTRY return;
if (!sd->on_text_set_func)
return;
- sd->on_text_set_func(obj, item, label);
+ sd->on_text_set_func(obj, part, label);
}
EAPI const char *
-elm_widget_text_part_get(const Evas_Object *obj, const char *item)
+elm_widget_text_part_get(const Evas_Object *obj, const char *part)
{
API_ENTRY return NULL;
if (!sd->on_text_get_func)
return NULL;
- return sd->on_text_get_func(obj, item);
+ return sd->on_text_get_func(obj, part);
}
EAPI void
-elm_widget_content_part_set(Evas_Object *obj, const char *item, Evas_Object *content)
+elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content)
{
API_ENTRY return;
if (!sd->on_content_set_func) return;
- sd->on_content_set_func(obj, item, content);
+ sd->on_content_set_func(obj, part, content);
}
EAPI Evas_Object *
-elm_widget_content_part_get(const Evas_Object *obj, const char *item)
+elm_widget_content_part_get(const Evas_Object *obj, const char *part)
{
API_ENTRY return NULL;
if (!sd->on_content_get_func) return NULL;
- return sd->on_content_get_func(obj, item);
+ return sd->on_content_get_func(obj, part);
}
EAPI Evas_Object *
-elm_widget_content_part_unset(Evas_Object *obj, const char *item)
+elm_widget_content_part_unset(Evas_Object *obj, const char *part)
{
API_ENTRY return NULL;
if (!sd->on_content_unset_func) return NULL;
- return sd->on_content_unset_func(obj, item);
+ return sd->on_content_unset_func(obj, part);
+}
+
+EAPI void
+elm_widget_access_info_set(Evas_Object *obj, const char *txt)
+{
+ API_ENTRY return;
+ if (sd->access_info) eina_stringshare_del(sd->access_info);
+ if (!txt) sd->access_info = NULL;
+ else sd->access_info = eina_stringshare_add(txt);
+}
+
+EAPI const char *
+elm_widget_access_info_get(Evas_Object *obj)
+{
+ API_ENTRY return NULL;
+ return sd->access_info;
}
EAPI Elm_Theme *
}
EAPI Eina_Bool
+elm_widget_is_check(const Evas_Object *obj)
+{
+ static int abort_on_warn = -1;
+ if (elm_widget_is(obj))
+ return EINA_TRUE;
+
+ ERR("Passing Object: %p.", obj);
+ if (abort_on_warn == -1)
+ {
+ if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
+ else abort_on_warn = 0;
+ }
+ if (abort_on_warn == 1) abort();
+ return EINA_FALSE;
+}
+
+EAPI Eina_Bool
elm_widget_type_check(const Evas_Object *obj,
- const char *type)
+ const char *type,
+ const char *func)
{
const char *provided, *expected = "(unknown)";
static int abort_on_warn = -1;
if ((!provided) || (!provided[0]))
provided = "(unknown)";
}
- ERR("Passing Object: %p, of type: '%s' when expecting type: '%s'", obj, provided, expected);
+ ERR("Passing Object: %p in function: %s, of type: '%s' when expecting type: '%s'", obj, func, provided, expected);
if (abort_on_warn == -1)
{
if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
}
EAPI void
-elm_widget_focus_mouse_down_handle(Evas_Object *obj)
+elm_widget_focus_mouse_up_handle(Evas_Object *obj)
{
Evas_Object *o = obj;
do
if (item->view)
evas_object_del(item->view);
+ if (item->access)
+ {
+ _elm_access_clear(item->access);
+ free(item->access);
+ item->access = NULL;
+ }
+ if (item->access_info)
+ {
+ eina_stringshare_del(item->access_info);
+ item->access_info = NULL;
+ }
+
EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
free(item);
}
}
}
+EAPI void
+_elm_widget_item_content_part_set(Elm_Widget_Item *item,
+ const char *part,
+ Evas_Object *content)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ if (!item->on_content_set_func) return;
+ item->on_content_set_func((Elm_Object_Item *) item, part, content);
+}
+
+EAPI Evas_Object *
+_elm_widget_item_content_part_get(const Elm_Widget_Item *item,
+ const char *part)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
+ if (!item->on_content_get_func) return NULL;
+ return item->on_content_get_func((Elm_Object_Item *) item, part);
+}
+
+EAPI Evas_Object *
+_elm_widget_item_content_part_unset(Elm_Widget_Item *item,
+ const char *part)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
+ if (!item->on_content_unset_func) return NULL;
+ return item->on_content_unset_func((Elm_Object_Item *) item, part);
+}
+
+EAPI void
+_elm_widget_item_text_part_set(Elm_Widget_Item *item,
+ const char *part,
+ const char *label)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ if (!item->on_text_set_func) return;
+ item->on_text_set_func((Elm_Object_Item *) item, part, label);
+}
+
+EAPI void
+_elm_widget_item_signal_emit(Elm_Widget_Item *item,
+ const char *emission,
+ const char *source)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ if (item->on_signal_emit_func)
+ item->on_signal_emit_func((Elm_Object_Item *) item, emission, source);
+}
+
+EAPI const char *
+_elm_widget_item_text_part_get(const Elm_Widget_Item *item,
+ const char *part)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
+ if (!item->on_text_get_func) return NULL;
+ return item->on_text_get_func((Elm_Object_Item *) item, part);
+}
+
+EAPI void
+_elm_widget_item_content_set_hook_set(Elm_Widget_Item *item,
+ Elm_Widget_On_Content_Set_Cb func)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ item->on_content_set_func = func;
+}
+
+EAPI void
+_elm_widget_item_content_get_hook_set(Elm_Widget_Item *item,
+ Elm_Widget_On_Content_Get_Cb func)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ item->on_content_get_func = func;
+}
+
+EAPI void
+_elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item,
+ Elm_Widget_On_Content_Unset_Cb func)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ item->on_content_unset_func = func;
+}
+
+EAPI void
+_elm_widget_item_text_set_hook_set(Elm_Widget_Item *item,
+ Elm_Widget_On_Text_Set_Cb func)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ item->on_text_set_func = func;
+}
+
+EAPI void
+_elm_widget_item_text_get_hook_set(Elm_Widget_Item *item,
+ Elm_Widget_On_Text_Get_Cb func)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ item->on_text_get_func = func;
+}
+
+EAPI void
+_elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *item,
+ Elm_Widget_On_Signal_Emit_Cb func)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ item->on_signal_emit_func = func;
+}
+
+EAPI void
+_elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt)
+{
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+ if (item->access_info) eina_stringshare_del(item->access_info);
+ if (!txt) item->access_info = NULL;
+ else item->access_info = eina_stringshare_add(txt);
+}
+
+
static void
_smart_add(Evas_Object *obj)
{
newest = _newest_focus_order_get(top, &newest_focus_order, can_focus_only);
if (newest)
{
- elm_object_unfocus(newest);
- elm_object_focus(newest);
+ elm_object_focus_set(newest, EINA_FALSE);
+ elm_object_focus_set(newest, EINA_TRUE);
}
}
}
if (sd->type) eina_stringshare_del(sd->type);
if (sd->theme) elm_theme_free(sd->theme);
_if_focused_revert(obj, EINA_TRUE);
+ if (sd->access_info) eina_stringshare_del(sd->access_info);
free(sd);
}
_smart_init(void)
{
if (_e_smart) return;
- {
- static const Evas_Smart_Class sc =
- {
- SMART_NAME,
- EVAS_SMART_CLASS_VERSION,
- _smart_add,
- _smart_del,
- _smart_move,
- _smart_resize,
- _smart_show,
- _smart_hide,
- _smart_color_set,
- _smart_clip_set,
- _smart_clip_unset,
- _smart_calculate,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- };
- _e_smart = evas_smart_class_new(&sc);
- }
+ {
+ static const Evas_Smart_Class sc =
+ {
+ SMART_NAME,
+ EVAS_SMART_CLASS_VERSION,
+ _smart_add,
+ _smart_del,
+ _smart_move,
+ _smart_resize,
+ _smart_show,
+ _smart_hide,
+ _smart_color_set,
+ _smart_clip_set,
+ _smart_clip_unset,
+ _smart_calculate,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ };
+ _e_smart = evas_smart_class_new(&sc);
+ }
}
/* happy debug functions */