elementary/ctxpopup - just reduces code lines

SVN revision: 56988
This commit is contained in:
ChunEon Park 2011-02-13 15:19:35 +00:00
parent 66dbccf4c9
commit d1877609ad
1 changed files with 46 additions and 96 deletions

View File

@ -128,8 +128,7 @@ _freeze_on(void *data __UNUSED__, Evas_Object *obj,
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
elm_object_scroll_freeze_push(wd->scr);
}
@ -139,8 +138,7 @@ _freeze_off(void *data __UNUSED__, Evas_Object *obj,
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
elm_object_scroll_freeze_pop(wd->scr);
}
@ -149,8 +147,7 @@ _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
elm_object_scroll_hold_push(wd->scr);
}
@ -159,8 +156,7 @@ _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
elm_object_scroll_hold_pop(wd->scr);
}
@ -194,8 +190,7 @@ _hover_parent_resize(void *data, Evas *e __UNUSED__,
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd)
return;
if (!wd) return;
if (wd->visible)
{
@ -210,8 +205,7 @@ _hover_parent_move(void *data, Evas *e __UNUSED__,
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd)
return;
if (!wd) return;
if (wd->visible)
{
@ -226,8 +220,7 @@ _hover_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd)
return;
if (!wd) return;
wd->hover_parent = NULL;
}
@ -239,8 +232,7 @@ _item_sizing_eval(Elm_Ctxpopup_Item *item)
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,
@ -292,8 +284,7 @@ _ctxpopup_changed_size_hints(void *data __UNUSED__, Evas *e __UNUSED__,
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
if (wd->visible)
_sizing_eval(obj);
@ -489,8 +480,7 @@ _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir)
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
evas_object_geometry_get(wd->arrow, NULL, NULL, &arrow_size.w,
@ -536,8 +526,7 @@ _sizing_eval(Evas_Object *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)
@ -612,8 +601,7 @@ _del_pre_hook(Evas_Object *obj)
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);
@ -627,8 +615,7 @@ _del_hook(Evas_Object *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);
@ -644,8 +631,7 @@ _theme_hook(Evas_Object *obj)
Elm_Ctxpopup_Item *item;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
//Items
EINA_LIST_FOREACH(wd->items, elist, item)
@ -707,14 +693,12 @@ _parent_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj,
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);
}
@ -726,11 +710,9 @@ _ctxpopup_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
Widget_Data *wd;
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;
@ -748,8 +730,7 @@ _hide(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
evas_object_hide(wd->bg);
evas_object_hide(wd->arrow);
@ -768,10 +749,7 @@ _ctxpopup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd->visible)
if ((!wd) || (!wd->visible))
return;
_hide(obj);
@ -785,13 +763,9 @@ _scroller_resize(void *data, Evas *e __UNUSED__, Evas_Object *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);
@ -821,8 +795,7 @@ _ctxpopup_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
if (wd->visible)
evas_object_show(wd->arrow);
@ -837,10 +810,8 @@ _item_select_cb(void *data, Evas_Object *obj __UNUSED__,
{
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);
@ -876,8 +847,7 @@ _item_new(Elm_Ctxpopup_Item *item, char *group_name)
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,
@ -898,8 +868,7 @@ _content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
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);
@ -912,8 +881,7 @@ _list_new(Evas_Object *obj)
{
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
//scroller
wd->scr = elm_scroller_add(obj);
@ -938,8 +906,7 @@ _remove_items(Widget_Data *wd)
Eina_List *elist;
Elm_Ctxpopup_Item *item;
if (!wd->items)
return;
if (!wd->items) return;
EINA_LIST_FOREACH(wd->items, elist, item)
{
@ -974,8 +941,7 @@ elm_ctxpopup_add(Evas_Object *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");
@ -1068,8 +1034,7 @@ elm_ctxpopup_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon)
Widget_Data *wd;
wd = elm_widget_data_get(item->base.widget);
if (!wd)
return;
if (!wd) return;
_item_icon_set(item, icon);
@ -1112,8 +1077,7 @@ elm_ctxpopup_item_label_set(Elm_Ctxpopup_Item *item, const char *label)
Widget_Data *wd;
wd = elm_widget_data_get(item->base.widget);
if (!wd)
return;
if (!wd) return;
_item_label_set(item, label);
@ -1145,8 +1109,7 @@ elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *hover_parent)
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
_hover_parent_callbacks_del(obj);
@ -1180,8 +1143,7 @@ elm_ctxpopup_hover_parent_get(const Evas_Object *obj)
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return NULL;
if (!wd) return NULL;
return wd->hover_parent;
}
@ -1199,9 +1161,7 @@ elm_ctxpopup_clear(Evas_Object * obj)
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);
@ -1223,8 +1183,7 @@ elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
wd->horizontal = !!horizontal;
@ -1262,8 +1221,7 @@ elm_ctxpopup_horizontal_get(const Evas_Object *obj)
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return EINA_FALSE;
if (!wd) return EINA_FALSE;
return wd->horizontal;
}
@ -1294,12 +1252,10 @@ elm_ctxpopup_item_append(Evas_Object *obj, const char *label,
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)
@ -1347,8 +1303,7 @@ elm_ctxpopup_item_del(Elm_Ctxpopup_Item *item)
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);
@ -1384,8 +1339,7 @@ elm_ctxpopup_item_disabled_set(Elm_Ctxpopup_Item *item, Eina_Bool disabled)
Widget_Data *wd;
wd = elm_widget_data_get(item->base.widget);
if (!wd)
return;
if (!wd) return;
if (disabled == item->disabled)
return;
@ -1476,12 +1430,10 @@ elm_ctxpopup_content_unset(Evas_Object *obj)
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);
@ -1516,8 +1468,7 @@ elm_ctxpopup_direction_priority_set(Evas_Object *obj,
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;
@ -1552,8 +1503,7 @@ elm_ctxpopup_direction_priority_get(Evas_Object *obj,
Widget_Data *wd;
wd = elm_widget_data_get(obj);
if (!wd)
return;
if (!wd) return;
if (first)
*first = wd->dir_priority[0];