From: shilpa singh Date: Wed, 5 Jan 2011 08:07:45 +0000 (+0530) Subject: [popup]- theme hook and content set modified, navigationbar - checks added. X-Git-Tag: REL_I9200_20110603-1~524^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4836aabd8a6807014207653d4def91b89e683c28;p=framework%2Fuifw%2Felementary.git [popup]- theme hook and content set modified, navigationbar - checks added. --- diff --git a/src/lib/elm_navigationbar.c b/src/lib/elm_navigationbar.c index 7a867b9..9be75fd 100644 --- a/src/lib/elm_navigationbar.c +++ b/src/lib/elm_navigationbar.c @@ -136,13 +136,23 @@ _delete_item(Item *it) if (!it) return; Evas_Object *list_obj; - evas_object_del(it->back_btn); - elm_object_unfocus(it->fn_btn1); - evas_object_del(it->fn_btn1); - elm_object_unfocus(it->fn_btn2); - evas_object_del(it->fn_btn2); - elm_object_unfocus(it->fn_btn3); - evas_object_del(it->fn_btn3); + if(it->back_btn) + evas_object_del(it->back_btn); + if(it->fn_btn1) + { + elm_object_unfocus(it->fn_btn1); + evas_object_del(it->fn_btn1); + } + if(it->fn_btn2) + { + elm_object_unfocus(it->fn_btn2); + evas_object_del(it->fn_btn2); + } + if(it->fn_btn3) + { + elm_object_unfocus(it->fn_btn3); + evas_object_del(it->fn_btn3); + } if (it->title) eina_stringshare_del(it->title); if (it->subtitle) diff --git a/src/lib/elm_popup.c b/src/lib/elm_popup.c index e03cd91..ae3c269 100644 --- a/src/lib/elm_popup.c +++ b/src/lib/elm_popup.c @@ -24,6 +24,8 @@ struct _Widget_Data Evas_Object *action_area; Eina_List *button_list; int rot_angle; + int no_of_buttons; + Evas_Object *content; Elm_Notify_Orient notify_orient; Ecore_Job *del_job; Eina_Bool delete_me : 1; @@ -111,19 +113,25 @@ _theme_hook(Evas_Object *obj) char buf[4096]; Eina_List *list = NULL; Action_Area_Data *action_data = NULL; - + int index =0; + if (!wd) return; elm_layout_theme_set(wd->layout, "popup", "base", elm_widget_style_get(obj)); elm_notify_orient_set(wd->notify, wd->notify_orient); edje_object_message_signal_process(elm_layout_edje_get(wd->layout)); - if (wd->action_area) { + snprintf(buf, sizeof(buf), "buttons%d", wd->no_of_buttons); + elm_layout_theme_set(wd->action_area, "popup", buf, elm_widget_style_get(obj)); EINA_LIST_FOREACH(wd->button_list, list, action_data) { snprintf(buf, sizeof(buf), "popup_button/%s", elm_widget_style_get(obj)); elm_object_style_set(action_data->btn, buf); + ++index; + snprintf(buf, sizeof(buf), "actionbtn%d", index); + elm_layout_content_set(wd->action_area, buf, action_data->btn); } + elm_layout_content_set(wd->layout, "elm.swallow.buttonArea", wd->action_area); } if (wd->content_area) { @@ -132,8 +140,18 @@ _theme_hook(Evas_Object *obj) { snprintf(buf, sizeof(buf), "popup_description/%s", elm_widget_style_get(obj)); elm_object_style_set(wd->desc_label, buf); + elm_layout_content_set(wd->content_area, "elm.swallow.content", wd->desc_label); + } + else if(wd->content) + { + elm_layout_content_set(wd->content_area, "elm.swallow.content", wd->content); } + elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content_area); } + if(wd->title_area) + { + edje_object_part_text_set(elm_layout_edje_get(wd->layout), "elm.swallow.title", wd->title_area); + } _sizing_eval(obj); } @@ -218,7 +236,6 @@ static void _hide(void *data, Evas *e, Evas_Object *obj, void *event_info) { Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return; edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,hide", "elm"); edje_object_message_signal_process(wd->layout); @@ -348,7 +365,7 @@ elm_popup_add(Evas_Object *parent_app) evas_object_resize(parent, w, h); evas_object_move(parent, x, y); if (rotation != -1) - elm_win_rotation_with_resize_set(parent, rotation); + elm_win_rotation_with_resize_set(parent, rotation); } else @@ -392,7 +409,7 @@ elm_popup_add(Evas_Object *parent_app) evas_object_event_callback_add(parent, EVAS_CALLBACK_DEL, _del_parent, obj); } - ecore_x_netwm_window_type_get(elm_win_xwindow_get(parent), &type); + ecore_x_netwm_window_type_get(elm_win_xwindow_get(parent), &type); if (type == ECORE_X_WINDOW_TYPE_DIALOG) { elm_object_style_set(wd->notify, "popup"); @@ -438,6 +455,7 @@ elm_popup_with_buttons_add(Evas_Object *parent, char *title, char *desc_text,int wd->action_area = elm_layout_add(popup); elm_layout_content_set(wd->layout, "elm.swallow.buttonArea", wd->action_area); snprintf(buf,sizeof(buf), "buttons%d", no_of_buttons); + wd->no_of_buttons = no_of_buttons; elm_layout_theme_set(wd->action_area, "popup", buf, elm_widget_style_get(popup)); edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,button,visible", "elm"); if (wd->title_area) @@ -612,19 +630,24 @@ elm_popup_content_set(Evas_Object *obj, Evas_Object *content) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); - + if (!wd) return; + if (wd->content == content) return; if (wd->content_area) { evas_object_del(wd->content_area); wd->content_area = NULL; } - wd->content_area = elm_layout_add(obj); - elm_layout_theme_set(wd->content_area, "popup","content", elm_widget_style_get(obj)); - elm_layout_content_set(wd->content_area, "elm.swallow.content", content); - elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content_area); - evas_object_event_callback_add(wd->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _changed_size_hints, obj); + wd->content = content; + if(content) + { + wd->content_area = elm_layout_add(obj); + elm_layout_theme_set(wd->content_area, "popup","content", elm_widget_style_get(obj)); + elm_layout_content_set(wd->content_area, "elm.swallow.content", content); + elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content_area); + evas_object_event_callback_add(wd->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + } _sizing_eval(obj); } @@ -641,12 +664,9 @@ elm_popup_content_get(Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; Widget_Data *wd = elm_widget_data_get(obj); - Evas_Object *content; - + if (!wd) return NULL; - content = edje_object_part_swallow_get(elm_layout_edje_get(wd->content_area), - "elm.swallow.content"); - return content; + return wd->content; } /** @@ -660,13 +680,12 @@ elm_popup_content_get(Evas_Object *obj) */ EAPI void elm_popup_buttons_add(Evas_Object *obj,int no_of_buttons, char *first_button_text, ...) - { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); char buf[4096]; va_list args; - + if (!wd) return; va_start(args, first_button_text); if (wd->action_area) @@ -680,9 +699,10 @@ elm_popup_buttons_add(Evas_Object *obj,int no_of_buttons, char *first_button_tex evas_object_size_hint_align_set(wd->action_area, EVAS_HINT_FILL, EVAS_HINT_FILL); snprintf(buf, sizeof(buf), "buttons%d", no_of_buttons); elm_layout_theme_set(wd->action_area, "popup", buf, elm_widget_style_get(obj)); + wd->no_of_buttons = no_of_buttons; edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,button,visible", "elm"); if (wd->title_area) - edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,button,title,visible", "elm"); + edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,button,title,visible", "elm"); _elm_popup_buttons_add_valist (obj, first_button_text, args); va_end(args); edje_object_message_signal_process(wd->layout); @@ -703,7 +723,7 @@ elm_popup_timeout_set(Evas_Object *obj, int timeout) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); - + if (!wd) return; elm_notify_timeout_set(wd->notify, timeout); evas_object_smart_callback_add(wd->notify, "notify,timeout", _elm_popup_timeout, obj); @@ -863,7 +883,7 @@ elm_popup_run(Evas_Object *obj) /*Finger waggle warning*/ _elm_dangerous_call_check(__FUNCTION__); evas_object_show(obj); - evas_object_smart_callback_add(obj, "response", response_cb, &response_id); + evas_object_smart_callback_add(obj, "response", response_cb, &response_id); _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, &response_id); ecore_main_loop_begin(); if (_elm_exit_handler)