From: Hyunsil Park Date: Tue, 24 Aug 2010 07:35:30 +0000 (+0900) Subject: [elm_multibuttonentry] add checking widtype X-Git-Tag: beat-winset-test_0.1.1-40~19^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5089163f3f8e64734896dfe9b158a974c9de7f38;p=framework%2Fuifw%2Felementary.git [elm_multibuttonentry] add checking widtype --- diff --git a/src/lib/elm_multibuttonentry.c b/src/lib/elm_multibuttonentry.c index ed24be3..613d01a 100755 --- a/src/lib/elm_multibuttonentry.c +++ b/src/lib/elm_multibuttonentry.c @@ -41,6 +41,7 @@ struct _Widget_Data { Evas_Coord w_box, h_box; }; +static const char *widtype = NULL; static void _del_hook(Evas_Object *obj); static void _theme_hook(Evas_Object *obj); @@ -61,6 +62,7 @@ static void _view_init(Evas_Object *obj); static void _del_hook(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if(!wd) return; @@ -83,16 +85,21 @@ _del_hook(Evas_Object *obj) static void _theme_hook(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; _elm_theme_object_set(obj, wd->base, "multibuttonentry", "base", elm_widget_style_get(obj)); + // re swallow + //edje_object_scale_set(wd->btn, elm_widget_scale_get(obj) * _elm_config->scale); + // refer to button _sizing_eval(obj); } static void _sizing_eval(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); Evas_Coord minw = -1, minh = -1, minw_box = -1, minh_box = -1; Evas_Coord left_padding, right_padding, top_padding, bottom_padding; @@ -114,14 +121,19 @@ _sizing_eval(Evas_Object *obj) static void _resize_cb(void *data, Evas *evas, Evas_Object *obj, void *event) { + ELM_CHECK_WIDTYPE(data, widtype); Widget_Data *wd = elm_widget_data_get(data); if (!wd) return; - evas_object_geometry_get(wd->box, NULL, NULL, &wd->w_box, &wd->h_box); + + evas_object_geometry_get(wd->box, NULL, NULL, &wd->w_box, &wd->h_box); + evas_object_resize(wd->box, 0, 0); + edje_object_part_swallow(wd->base, "box.swallow", wd->box); } static void _event_init(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if(!wd || !wd->base) return; evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE, _resize_cb, obj); @@ -130,6 +142,7 @@ _event_init(Evas_Object *obj) static void _set_label(Evas_Object *obj, const char* str) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if(!wd) return; @@ -151,9 +164,10 @@ _set_label(Evas_Object *obj, const char* str) static void _change_current_button(Evas_Object *obj, Evas_Object *btn) { + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); Eina_List *l; Elm_Multibuttonentry_Item *item; - Widget_Data *wd = elm_widget_data_get(obj); Evas_Object *label; if (!wd) return; @@ -187,6 +201,7 @@ _change_current_button(Evas_Object *obj, Evas_Object *btn) static void _button_clicked(void *data, Evas_Object *obj, const char *emission, const char *source) { + ELM_CHECK_WIDTYPE(data, widtype); Widget_Data *wd = elm_widget_data_get(data); if (!wd) return; @@ -196,8 +211,9 @@ _button_clicked(void *data, Evas_Object *obj, const char *emission, const char * static void _del_button_obj(Evas_Object *obj, Evas_Object *btn) { - Evas_Object *label; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *label; if(!wd || !btn) return; if(btn){ @@ -219,6 +235,7 @@ _item_del(Elm_Multibuttonentry_Item *item) if(!item) return; Widget_Data *wd; + ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype); wd = elm_widget_data_get(item->multibuttonentry); if (!wd) return; @@ -239,6 +256,7 @@ _item_del(Elm_Multibuttonentry_Item *item) static void _del_button(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); Elm_Multibuttonentry_Item *item; if(!wd || !wd->items) return; @@ -262,6 +280,7 @@ _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, co Evas_Object *btn; Evas_Object *label; Evas_Coord w_label, h_label, w_btn, h_btn, padding_outer, padding_inner; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if(!wd || !wd->box || !wd->entry) return NULL; @@ -340,6 +359,7 @@ _add_button_item(Evas_Object *obj, const char *str, Multibuttonentry_Pos pos, co static void _add_button(Evas_Object *obj, char *str) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if(!wd) return; @@ -353,8 +373,9 @@ _add_button(Evas_Object *obj, char *str) static void _evas_key_up_cb(void *data, Evas *e , Evas_Object *obj , void *event_info ) { - Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *) event_info; + ELM_CHECK_WIDTYPE(data, widtype); Widget_Data *wd = elm_widget_data_get(data); + Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *) event_info; static char str[MAX_STR]; if(!wd || !wd->base || !wd->box) return; @@ -373,6 +394,7 @@ _evas_key_up_cb(void *data, Evas *e , Evas_Object *obj , void *event_info ) static void _view_init(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -422,6 +444,7 @@ elm_multibuttonentry_add(Evas_Object *parent) wd = ELM_NEW(Widget_Data); e = evas_object_evas_get(parent); obj = elm_widget_add(e); + ELM_SET_WIDTYPE(widtype, "multibuttonentry"); elm_widget_type_set(obj, "multibuttonentry"); elm_widget_sub_object_add(parent, obj); elm_widget_data_set(obj, wd); @@ -452,6 +475,7 @@ elm_multibuttonentry_add(Evas_Object *parent) EAPI const char * elm_multibuttonentry_label_get(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return NULL; @@ -473,6 +497,7 @@ elm_multibuttonentry_label_get(Evas_Object *obj) EAPI void elm_multibuttonentry_label_set(Evas_Object *obj, const char *label) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -490,10 +515,11 @@ elm_multibuttonentry_label_set(Evas_Object *obj, const char *label) EAPI Evas_Object * elm_multibuttonentry_entry_get(Evas_Object *obj) { - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - - return wd->entry; + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + return wd->entry; } /** @@ -509,8 +535,9 @@ elm_multibuttonentry_entry_get(Evas_Object *obj) EAPI Elm_Multibuttonentry_Item * elm_multibuttonentry_item_add_start(Evas_Object *obj, const char *label, void *data) { - Elm_Multibuttonentry_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + Elm_Multibuttonentry_Item *item; if (!wd) return NULL; item = _add_button_item(obj, label, MULTIBUTONENTRY_POS_START, NULL, data); @@ -530,8 +557,9 @@ elm_multibuttonentry_item_add_start(Evas_Object *obj, const char *label, void *d EAPI Elm_Multibuttonentry_Item * elm_multibuttonentry_item_add_end(Evas_Object *obj, const char *label, void *data) { - Elm_Multibuttonentry_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + Elm_Multibuttonentry_Item *item; if (!wd) return NULL; item = _add_button_item(obj, label, MULTIBUTONENTRY_POS_END, NULL, data); @@ -552,8 +580,9 @@ elm_multibuttonentry_item_add_end(Evas_Object *obj, const char *label, void *dat EAPI Elm_Multibuttonentry_Item * elm_multibuttonentry_item_add_before(Evas_Object *obj, const char *label, Elm_Multibuttonentry_Item *before, void *data) { - Elm_Multibuttonentry_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + Elm_Multibuttonentry_Item *item; if (!wd) return NULL; item = _add_button_item(obj, label, MULTIBUTONENTRY_POS_BEFORE, before, data); @@ -573,8 +602,9 @@ elm_multibuttonentry_item_add_before(Evas_Object *obj, const char *label, Elm_Mu EAPI Elm_Multibuttonentry_Item * elm_multibuttonentry_item_add_after(Evas_Object *obj, const char *label, Elm_Multibuttonentry_Item *after, void *data) { - Elm_Multibuttonentry_Item *item; + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); + Elm_Multibuttonentry_Item *item; if (!wd) return NULL; item = _add_button_item(obj, label, MULTIBUTONENTRY_POS_AFTER, after, data); @@ -592,6 +622,7 @@ elm_multibuttonentry_item_add_after(Evas_Object *obj, const char *label, Elm_Mul EAPI const Eina_List * elm_multibuttonentry_items_get(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return NULL; return wd->items; @@ -608,9 +639,8 @@ elm_multibuttonentry_items_get(Evas_Object *obj) EAPI Elm_Multibuttonentry_Item * elm_multibuttonentry_item_first_get(Evas_Object *obj) { - Widget_Data *wd; - if (!obj) return NULL; - wd = elm_widget_data_get(obj); + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); if (!wd || !wd->items) return NULL; return eina_list_data_get(wd->items); } @@ -626,9 +656,8 @@ elm_multibuttonentry_item_first_get(Evas_Object *obj) EAPI Elm_Multibuttonentry_Item * elm_multibuttonentry_item_last_get(Evas_Object *obj) { - Widget_Data *wd; - if (!obj) return NULL; - wd = elm_widget_data_get(obj); + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); if (!wd || !wd->items) return NULL; return eina_list_data_get(eina_list_last(wd->items)); } @@ -644,6 +673,7 @@ elm_multibuttonentry_item_last_get(Evas_Object *obj) EAPI Elm_Multibuttonentry_Item * elm_multibuttonentry_item_selected_get(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd || !wd->current) return NULL; return eina_list_data_get(wd->current); @@ -664,6 +694,7 @@ elm_multibuttonentry_item_selected_set(Elm_Multibuttonentry_Item *item) Elm_Multibuttonentry_Item *_item; if (!item) return; + ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype); wd = elm_widget_data_get(item->multibuttonentry); if (!wd) return; @@ -684,6 +715,7 @@ elm_multibuttonentry_item_selected_set(Elm_Multibuttonentry_Item *item) EAPI void elm_multibuttonentry_items_del(Evas_Object *obj) { + ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; @@ -729,6 +761,7 @@ elm_multibuttonentry_item_label_get(Elm_Multibuttonentry_Item *item) Elm_Multibuttonentry_Item *_item; if (!item) return NULL; + ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype); wd = elm_widget_data_get(item->multibuttonentry); if (!wd || !wd->items) return NULL; @@ -757,6 +790,7 @@ elm_multibuttonentry_item_label_set(Elm_Multibuttonentry_Item *item, const char Elm_Multibuttonentry_Item *_item; if (!item || !str) return; + ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype); wd = elm_widget_data_get(item->multibuttonentry); if (!wd || !wd->items) return; @@ -784,6 +818,7 @@ elm_multibuttonentry_item_prev(Elm_Multibuttonentry_Item *item) Elm_Multibuttonentry_Item *_item; if (!item) return NULL; + ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype); wd = elm_widget_data_get(item->multibuttonentry); if (!wd || !wd->items) return NULL; @@ -812,6 +847,7 @@ elm_multibuttonentry_item_next(Elm_Multibuttonentry_Item *item) Elm_Multibuttonentry_Item *_item; if (!item) return NULL; + ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype); wd = elm_widget_data_get(item->multibuttonentry); if (!wd || !wd->items) return NULL;