From: Rajeev Ranjan Date: Wed, 8 Dec 2010 05:59:06 +0000 (+0530) Subject: [src/lib/elm_gridbox.c] E-Coding Compliance X-Git-Tag: REL_I9200_20110603-1~584^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5fab08872eacb5ac3d6bd8e1b5c3622b06be604;p=framework%2Fuifw%2Felementary.git [src/lib/elm_gridbox.c] E-Coding Compliance --- diff --git a/src/lib/elm_gridbox.c b/src/lib/elm_gridbox.c index b4129d8..cbd7db4 100644 --- a/src/lib/elm_gridbox.c +++ b/src/lib/elm_gridbox.c @@ -1,4 +1,5 @@ #include + #include "elm_priv.h" /** @@ -20,28 +21,23 @@ struct _Widget_Data Eina_Bool homogeneous:1; }; -static void _del_hook(Evas_Object * obj); +static void _del_hook(Evas_Object *obj); -static void _sizing_eval(Evas_Object * obj, int mode); +static void _sizing_eval(Evas_Object *obj, int mode); -static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, - void *event_info); -static void _changed_size_min(void *data, Evas *e, Evas_Object *obj, - void *event_info); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _changed_size_min(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _sub_del(void *data, Evas_Object *obj, void *event_info); static void _show_event(void *data, Evas *e, Evas_Object *obj, void *event_info); static void -_del_pre_hook(Evas_Object * obj) +_del_pre_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); - evas_object_event_callback_del_full(wd->tbl, - EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _changed_size_hints, obj); - evas_object_event_callback_del_full(wd->tbl, EVAS_CALLBACK_RESIZE, - _changed_size_min, obj); + evas_object_event_callback_del_full(wd->tbl, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + evas_object_event_callback_del_full(wd->tbl, EVAS_CALLBACK_RESIZE, _changed_size_min, obj); evas_object_del(wd->tbl); wd->tbl = NULL; evas_object_del(wd->scr); @@ -49,7 +45,7 @@ _del_pre_hook(Evas_Object * obj) } static void -_del_hook(Evas_Object * obj) +_del_hook(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -57,7 +53,7 @@ _del_hook(Evas_Object * obj) } static Eina_Bool -_arrange_table(Evas_Object * obj) +_arrange_table(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -69,32 +65,28 @@ _arrange_table(Evas_Object * obj) if (wd) { - if (wd->tbl) - { - int index = - eina_list_count(evas_object_table_children_get(wd->tbl)); - if (!index) - return EINA_FALSE; - - elm_gridbox_item_size_set(obj, wd->itemsize_h, wd->itemsize_v); - l = evas_object_table_children_get(wd->tbl); - - EINA_LIST_FOREACH(l, l_temp, item) - { - evas_object_table_unpack(wd->tbl, item); - elm_widget_sub_object_del(wd->tbl, item); - evas_object_table_pack(wd->tbl, item, i % wd->x, i / wd->x, 1, - 1); - i++; - } - } + if (wd->tbl) + { + int index = eina_list_count(evas_object_table_children_get(wd->tbl)); + if (!index) return EINA_FALSE; + + elm_gridbox_item_size_set(obj, wd->itemsize_h, wd->itemsize_v); + l = evas_object_table_children_get(wd->tbl); + + EINA_LIST_FOREACH(l, l_temp, item) + { + evas_object_table_unpack(wd->tbl, item); + elm_widget_sub_object_del(wd->tbl, item); + evas_object_table_pack(wd->tbl, item, i % wd->x, i / wd->x, 1, 1); + i++; + } + } } - return EINA_TRUE; } static void -_sizing_eval(Evas_Object * obj, int mode) +_sizing_eval(Evas_Object *obj, int mode) { Widget_Data *wd = elm_widget_data_get(obj); @@ -108,31 +100,29 @@ _sizing_eval(Evas_Object * obj, int mode) evas_object_size_hint_max_set(obj, maxw, maxh); evas_object_geometry_get(wd->scr, NULL, NULL, &w, &h); - if (w < minw) - w = minw; - if (h < minh) - h = minh; - if ((maxw >= 0) && (w > maxw)) - w = maxw; + if (w < minw) w = minw; + if (h < minh) h = minh; + if ((maxw >= 0) && (w > maxw)) + w = maxw; if ((maxh >= 0) && (h > maxh)) - h = maxh; + h = maxh; evas_object_resize(obj, w, h); wd->minw = w; wd->minh = h; if (w < wd->itemsize_h || h < wd->itemsize_v) - return; + return; if (wd->homogeneous) { - wd->x = w / wd->itemsize_h; - wd->y = h / wd->itemsize_v; - wd->horizontal = (wd->minw - wd->x * wd->itemsize_h) / wd->x; - wd->vertical = (wd->minh - wd->y * wd->itemsize_v) / wd->y; - elm_gridbox_padding_set(obj, wd->horizontal, wd->vertical); + wd->x = w / wd->itemsize_h; + wd->y = h / wd->itemsize_v; + wd->horizontal = (wd->minw - wd->x * wd->itemsize_h) / wd->x; + wd->vertical = (wd->minh - wd->y * wd->itemsize_v) / wd->y; + elm_gridbox_padding_set(obj, wd->horizontal, wd->vertical); } if (!mode) - _arrange_table(obj); + _arrange_table(obj); } static void @@ -164,18 +154,16 @@ _freeze_on(void *data, Evas_Object *obj, void *event_info) { Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) - return; + if (!wd) return; evas_object_smart_callback_call(wd->scr, "scroll-freeze-on", NULL); } static void -_freeze_off(void *data, Evas_Object * obj, void *event_info) +_freeze_off(void *data, Evas_Object *obj, void *event_info) { Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) - return; + if (!wd) return; evas_object_smart_callback_call(wd->scr, "scroll-freeze-off", NULL); } @@ -188,7 +176,7 @@ _freeze_off(void *data, Evas_Object * obj, void *event_info) * @ingroup Gridbox */ EAPI Evas_Object * -elm_gridbox_add(Evas_Object * parent) +elm_gridbox_add(Evas_Object *parent) { Evas_Object *obj; @@ -214,12 +202,9 @@ elm_gridbox_add(Evas_Object * parent) elm_scroller_content_set(wd->scr, wd->tbl); evas_object_show(wd->tbl); - evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _changed_size_hints, obj); - evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, - _changed_size_min, obj); - evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_SHOW, _show_event, - obj); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE, _changed_size_min, obj); + evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_SHOW, _show_event, obj); evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj); @@ -240,18 +225,16 @@ elm_gridbox_add(Evas_Object * parent) * @ingroup Gridbox */ EAPI void -elm_gridbox_padding_set(Evas_Object * obj, Evas_Coord horizontal, - Evas_Coord vertical) +elm_gridbox_padding_set(Evas_Object *obj, Evas_Coord horizontal, Evas_Coord vertical) { Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) - return; + if (!wd) return; wd->horizontal = horizontal; wd->vertical = vertical; if (wd->tbl) - evas_object_table_padding_set(wd->tbl, horizontal, vertical); + evas_object_table_padding_set(wd->tbl, horizontal, vertical); } /** @@ -264,8 +247,7 @@ elm_gridbox_padding_set(Evas_Object * obj, Evas_Coord horizontal, * @ingroup Gridbox */ EAPI void -elm_gridbox_item_size_set(Evas_Object * obj, Evas_Coord h_itemsize, - Evas_Coord v_itemsize) +elm_gridbox_item_size_set(Evas_Object *obj, Evas_Coord h_itemsize, Evas_Coord v_itemsize) { Widget_Data *wd = elm_widget_data_get(obj); @@ -273,24 +255,23 @@ elm_gridbox_item_size_set(Evas_Object * obj, Evas_Coord h_itemsize, Evas_Coord w, h; - if (!wd) - return; + if (!wd) return; wd->itemsize_h = h_itemsize; wd->itemsize_v = v_itemsize; evas_object_size_hint_min_get(wd->scr, &minw, &minh); evas_object_geometry_get(obj, NULL, NULL, &w, &h); if (w < minw) - w = minw; + w = minw; if (h < minh) - h = minh; + h = minh; wd->x = w / h_itemsize; wd->y = h / v_itemsize; if (!wd->x) - wd->x = 1; + wd->x = 1; if (!wd->y) - wd->y = 1; + wd->y = 1; _sizing_eval(obj, 1); } @@ -303,7 +284,7 @@ elm_gridbox_item_size_set(Evas_Object * obj, Evas_Coord h_itemsize, * @ingroup Gridbox */ EAPI void -elm_gridbox_pack(Evas_Object * obj, Evas_Object * subobj) +elm_gridbox_pack(Evas_Object *obj, Evas_Object *subobj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -324,7 +305,7 @@ elm_gridbox_pack(Evas_Object * obj, Evas_Object * subobj) * @ingroup Gridbox */ EAPI Eina_Bool -elm_gridbox_unpack(Evas_Object * obj, Evas_Object * subobj) +elm_gridbox_unpack(Evas_Object *obj, Evas_Object *subobj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -346,7 +327,7 @@ elm_gridbox_unpack(Evas_Object * obj, Evas_Object * subobj) * @ingroup Gridbox */ EAPI Eina_List * -elm_gridbox_children_get(Evas_Object * obj) +elm_gridbox_children_get(Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); @@ -366,7 +347,7 @@ elm_gridbox_children_get(Evas_Object * obj) * @ingroup Gridbox */ EAPI void -elm_gridbox_homogenous_padding_set(Evas_Object * obj, Eina_Bool homogenous) +elm_gridbox_homogenous_padding_set(Evas_Object *obj, Eina_Bool homogenous) { Widget_Data *wd = elm_widget_data_get(obj);