};
#define ELM_CTXPOPUP_ITEM_CHECK_RETURN(it, ...) \
- ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
-ELM_CHECK_WIDTYPE(item->base.widget, widtype) __VA_ARGS__;
+ ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
+ ELM_CHECK_WIDTYPE(item->base.widget, widtype) __VA_ARGS__;
static void
_freeze_on(void *data __UNUSED__, Evas_Object *obj,
{
Widget_Data *wd = elm_widget_data_get(data);
- if (!wd)
- return;
+ if (!wd) return;
if (wd->visible)
{
{
Widget_Data *wd = elm_widget_data_get(data);
- if (!wd)
- return;
+ if (!wd) return;
if (wd->visible)
{
{
Widget_Data *wd = elm_widget_data_get(data);
- if (!wd)
- return;
+ if (!wd) return;
wd->hover_parent = NULL;
}
{
Evas_Coord min_w = -1, min_h = -1, max_w = -1, max_h = -1;
- Evas_Coord x, y, w, h;
-
- if (!item)
- return;
+ if (!item) return;
- evas_object_geometry_get(item->base.view, &x, &y, &w, &h);
edje_object_size_min_restricted_calc(item->base.view, &min_w, &min_h, min_w,
min_h);
evas_object_size_hint_min_set(item->base.view, min_w, min_h);
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
if (wd->visible)
_sizing_eval(obj);
Evas_Coord_Point _box_size = { 0, 0 };
wd = elm_widget_data_get(obj);
- if ((!wd) || (!wd->parent))
- return;
+ if ((!wd) || (!wd->parent)) return;
//Box, Scroller
EINA_LIST_FOREACH(wd->items, elist, item)
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE,
_parent_resize, obj);
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
elm_ctxpopup_clear(obj);
evas_object_del(wd->arrow);
Elm_Ctxpopup_Item *item;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
//Items
EINA_LIST_FOREACH(wd->items, elist, item)
_elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow",
elm_widget_style_get(obj));
- if(wd->scr)
+ if (wd->scr)
{
if (!strncmp(elm_object_style_get(obj), "default",
strlen("default")))
Widget_Data *wd;
wd = elm_widget_data_get(data);
- if (!wd)
- return;
+ if (!wd) return;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
evas_object_resize(wd->bg, w, h);
- if (!wd->visible)
- return;
+ if (!wd->visible) return;
_hide(data);
}
int idx = 0;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
- if ((!wd->items) && (!wd->content))
- return;
+ if ((!wd->items) && (!wd->content)) return;
wd->visible = EINA_TRUE;
{
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
evas_object_hide(wd->bg);
evas_object_hide(wd->arrow);
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- if (!wd->visible)
+ if ((!wd) || (!wd->visible))
return;
_hide(obj);
Evas_Coord w, h;
wd = elm_widget_data_get(data);
- if (!wd)
- return;
-
- if (!wd->visible)
- return;
- if (wd->finished)
- return;
+ if (!wd) return;
+ if (!wd->visible) return;
+ if (wd->finished) return;
evas_object_geometry_get(obj, 0, 0, &w, &h);
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
if (wd->visible)
evas_object_show(wd->arrow);
{
Elm_Ctxpopup_Item *item = data;
- if (!item)
- return;
- if (item->disabled)
- return;
+ if (!item) return;
+ if (item->disabled) return;
if (item->func)
- {
item->func((void*) item->base.data, item->base.widget, data);
- }
}
static void
Widget_Data *wd;
wd = elm_widget_data_get(item->base.widget);
- if (!wd)
- return;
+ if (!wd) return;
item->base.view = edje_object_add(evas_object_evas_get(wd->base));
_elm_theme_object_set(item->base.widget, item->base.view, "ctxpopup", group_name,
static void
_list_del(Widget_Data *wd)
{
- if (!wd->scr)
- return;
+ if (!wd->scr) return;
edje_object_part_unswallow(wd->base, wd->scr);
evas_object_del(wd->scr);
{
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
//scroller
wd->scr = elm_scroller_add(obj);
elm_ctxpopup_horizontal_set(obj, wd->horizontal);
}
+static void
+_remove_items(Widget_Data *wd)
+{
+ Eina_List *elist;
+ Elm_Ctxpopup_Item *item;
+
+ if (!wd->items) return;
+
+ EINA_LIST_FOREACH(wd->items, elist, item)
+ {
+ if (item->label)
+ eina_stringshare_del(item->label);
+ if (item->icon)
+ evas_object_del(item->icon);
+ wd->items = eina_list_remove(wd->items, item);
+ free(item);
+ }
+
+ wd->items = NULL;
+}
+
/**
* Add a new Ctxpopup object to the parent.
*
wd = ELM_NEW(Widget_Data);
e = evas_object_evas_get(parent);
- if (!e)
- return NULL;
+ if (!e) return NULL;
obj = elm_widget_add(e);
ELM_SET_WIDTYPE(widtype, "ctxpopup");
elm_widget_type_set(obj, "ctxpopup");
Widget_Data *wd;
wd = elm_widget_data_get(item->base.widget);
- if (!wd)
- return;
+ if (!wd) return;
_item_icon_set(item, icon);
Widget_Data *wd;
wd = elm_widget_data_get(item->base.widget);
- if (!wd)
- return;
+ if (!wd) return;
_item_label_set(item, label);
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
_hover_parent_callbacks_del(obj);
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return NULL;
+ if (!wd) return NULL;
return wd->hover_parent;
}
-static void
-_remove_items(Widget_Data *wd)
-{
- Eina_List *elist;
- Elm_Ctxpopup_Item *item;
-
- if (!wd->items)
- return;
-
- EINA_LIST_FOREACH(wd->items, elist, item)
- {
- if (item->label)
- eina_stringshare_del(item->label);
- if (item->icon)
- evas_object_del(item->icon);
- wd->items = eina_list_remove(wd->items, item);
- free(item);
- }
-
- wd->items = NULL;
-}
-
/**
* Clear all items in the given ctxpopup object.
*
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd)
- return;
+ if (!wd) return;
_remove_items(wd);
_list_del(wd);
EAPI void
elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
+ ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd;
Eina_List *elist;
int idx = 0;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
wd->horizontal = !!horizontal;
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return EINA_FALSE;
+ if (!wd) return EINA_FALSE;
return wd->horizontal;
}
Elm_Ctxpopup_Item *item;
wd = elm_widget_data_get(obj);
- if (!wd)
- return NULL;
+ if (!wd) return NULL;
item = elm_widget_item_new(obj, Elm_Ctxpopup_Item);
- if (!item)
- return NULL;
+ if (!item) return NULL;
//The first item is appended.
if (wd->content)
Widget_Data *wd;
wd = elm_widget_data_get(item->base.widget);
- if (!wd)
- return;
+ if (!wd) return;
if (item->icon)
evas_object_del(item->icon);
Widget_Data *wd;
wd = elm_widget_data_get(item->base.widget);
- if (!wd)
- return;
+ if (!wd) return;
if (disabled == item->disabled)
return;
Evas_Object *content;
wd = elm_widget_data_get(obj);
- if (!wd)
- return NULL;
+ if (!wd) return NULL;
content = wd->content;
- if (!content)
- return NULL;
+ if (!content) return NULL;
edje_object_part_unswallow(wd->base, content);
elm_widget_sub_object_del(obj, content);
evas_object_event_callback_del(content, EVAS_CALLBACK_DEL, _content_del);
- evas_object_event_callback_del(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _content_changed_size_hints);
+// evas_object_event_callback_del(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _content_changed_size_hints);
edje_object_signal_emit(wd->base, "elm,state,content,disable", "elm");
wd->content = NULL;
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
wd->dir_priority[0] = first;
wd->dir_priority[1] = second;
Widget_Data *wd;
wd = elm_widget_data_get(obj);
- if (!wd)
- return;
+ if (!wd) return;
if (first)
*first = wd->dir_priority[0];