[popup]- theme hook and content set modified, navigationbar - checks added.
authorshilpa singh <shilpa.singh@samsung.com>
Wed, 5 Jan 2011 08:07:45 +0000 (13:37 +0530)
committershilpa singh <shilpa.singh@samsung.com>
Wed, 5 Jan 2011 08:07:45 +0000 (13:37 +0530)
src/lib/elm_navigationbar.c
src/lib/elm_popup.c

index 7a867b9..9be75fd 100644 (file)
@@ -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) 
index e03cd91..ae3c269 100644 (file)
@@ -24,6 +24,8 @@ struct _Widget_Data
    Evas_Object *action_area;\r
    Eina_List *button_list;\r
    int rot_angle;\r
+   int no_of_buttons;\r
+   Evas_Object *content;\r
    Elm_Notify_Orient notify_orient;\r
    Ecore_Job *del_job;\r
    Eina_Bool delete_me : 1;\r
@@ -111,19 +113,25 @@ _theme_hook(Evas_Object *obj)
    char buf[4096];\r
    Eina_List *list = NULL;\r
    Action_Area_Data *action_data = NULL;\r
-\r
+   int index =0; \r
+   \r
    if (!wd) return;\r
    elm_layout_theme_set(wd->layout, "popup", "base", elm_widget_style_get(obj));\r
    elm_notify_orient_set(wd->notify, wd->notify_orient);\r
    edje_object_message_signal_process(elm_layout_edje_get(wd->layout));\r
-\r
    if (wd->action_area)\r
      {\r
+        snprintf(buf, sizeof(buf), "buttons%d", wd->no_of_buttons);  \r
+        elm_layout_theme_set(wd->action_area, "popup", buf, elm_widget_style_get(obj));         \r
         EINA_LIST_FOREACH(wd->button_list, list, action_data)\r
           {\r
              snprintf(buf, sizeof(buf), "popup_button/%s", elm_widget_style_get(obj));\r
              elm_object_style_set(action_data->btn, buf);\r
+             ++index;\r
+             snprintf(buf, sizeof(buf), "actionbtn%d", index);       \r
+             elm_layout_content_set(wd->action_area, buf, action_data->btn);                    \r
           }\r
+        elm_layout_content_set(wd->layout, "elm.swallow.buttonArea", wd->action_area);\r
      }\r
    if (wd->content_area)\r
      {\r
@@ -132,8 +140,18 @@ _theme_hook(Evas_Object *obj)
           {\r
              snprintf(buf, sizeof(buf), "popup_description/%s", elm_widget_style_get(obj));\r
              elm_object_style_set(wd->desc_label, buf);\r
+             elm_layout_content_set(wd->content_area, "elm.swallow.content", wd->desc_label);  \r
+          }\r
+        else if(wd->content)\r
+          {\r
+             elm_layout_content_set(wd->content_area, "elm.swallow.content", wd->content);\r
           }\r
+        elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content_area);\r
      }     \r
+   if(wd->title_area)\r
+     {\r
+        edje_object_part_text_set(elm_layout_edje_get(wd->layout), "elm.swallow.title", wd->title_area);\r
+     }\r
    _sizing_eval(obj);\r
 }\r
 \r
@@ -218,7 +236,6 @@ static void
 _hide(void *data, Evas *e, Evas_Object *obj, void *event_info)\r
 {\r
    Widget_Data *wd = elm_widget_data_get(obj);\r
-\r
    if (!wd) return;\r
    edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,hide", "elm");\r
    edje_object_message_signal_process(wd->layout);\r
@@ -348,7 +365,7 @@ elm_popup_add(Evas_Object *parent_app)
         evas_object_resize(parent, w, h);\r
         evas_object_move(parent, x, y);\r
         if (rotation != -1) \r
-           elm_win_rotation_with_resize_set(parent, rotation);   \r
+           elm_win_rotation_with_resize_set(parent, rotation);    \r
 \r
      }\r
    else\r
@@ -392,7 +409,7 @@ elm_popup_add(Evas_Object *parent_app)
         evas_object_event_callback_add(parent, EVAS_CALLBACK_DEL, _del_parent, obj);\r
      }\r
 \r
-   ecore_x_netwm_window_type_get(elm_win_xwindow_get(parent), &type);   \r
+   ecore_x_netwm_window_type_get(elm_win_xwindow_get(parent), &type);    \r
    if (type == ECORE_X_WINDOW_TYPE_DIALOG)\r
      {\r
         elm_object_style_set(wd->notify, "popup");\r
@@ -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);\r
         elm_layout_content_set(wd->layout, "elm.swallow.buttonArea", wd->action_area);\r
         snprintf(buf,sizeof(buf), "buttons%d", no_of_buttons);\r
+                                wd->no_of_buttons = no_of_buttons;\r
         elm_layout_theme_set(wd->action_area, "popup", buf, elm_widget_style_get(popup));\r
         edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,button,visible", "elm");\r
         if (wd->title_area)\r
@@ -612,19 +630,24 @@ elm_popup_content_set(Evas_Object *obj, Evas_Object *content)
 {\r
    ELM_CHECK_WIDTYPE(obj, widtype);\r
    Widget_Data *wd = elm_widget_data_get(obj);  \r
-\r
+   \r
    if (!wd) return;\r
+   if (wd->content == content) return;\r
    if (wd->content_area)\r
      {\r
         evas_object_del(wd->content_area);\r
         wd->content_area = NULL;\r
      }        \r
-   wd->content_area = elm_layout_add(obj);\r
-   elm_layout_theme_set(wd->content_area, "popup","content", elm_widget_style_get(obj));\r
-   elm_layout_content_set(wd->content_area, "elm.swallow.content", content);     \r
-   elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content_area);     \r
-   evas_object_event_callback_add(wd->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS,\r
-                                  _changed_size_hints, obj);\r
+   wd->content = content;\r
+   if(content)\r
+     {\r
+        wd->content_area = elm_layout_add(obj);\r
+        elm_layout_theme_set(wd->content_area, "popup","content", elm_widget_style_get(obj));\r
+        elm_layout_content_set(wd->content_area, "elm.swallow.content", content);     \r
+        elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content_area);     \r
+        evas_object_event_callback_add(wd->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS,\r
+                                       _changed_size_hints, obj);\r
+     }\r
    _sizing_eval(obj);\r
 }\r
 \r
@@ -641,12 +664,9 @@ elm_popup_content_get(Evas_Object *obj)
 {\r
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
    Widget_Data *wd = elm_widget_data_get(obj);\r
-   Evas_Object *content;\r
-             \r
+   \r
    if (!wd) return NULL;\r
-   content = edje_object_part_swallow_get(elm_layout_edje_get(wd->content_area), \r
-                                          "elm.swallow.content");\r
-   return content;\r
+   return wd->content;\r
 }\r
 \r
 /**\r
@@ -660,13 +680,12 @@ elm_popup_content_get(Evas_Object *obj)
  */\r
 EAPI void \r
 elm_popup_buttons_add(Evas_Object *obj,int no_of_buttons, char *first_button_text,  ...)\r
-\r
 {\r
    ELM_CHECK_WIDTYPE(obj, widtype);\r
    Widget_Data *wd = elm_widget_data_get(obj);  \r
    char buf[4096];  \r
    va_list args;  \r
-\r
+   \r
    if (!wd) return;\r
    va_start(args, first_button_text); \r
    if (wd->action_area)\r
@@ -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);\r
    snprintf(buf, sizeof(buf), "buttons%d", no_of_buttons);  \r
    elm_layout_theme_set(wd->action_area, "popup", buf, elm_widget_style_get(obj));     \r
+   wd->no_of_buttons = no_of_buttons;\r
    edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,button,visible", "elm");\r
    if (wd->title_area)\r
-      edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,button,title,visible", "elm");\r
+     edje_object_signal_emit(elm_layout_edje_get(wd->layout), "elm,state,button,title,visible", "elm");\r
    _elm_popup_buttons_add_valist (obj, first_button_text, args);\r
    va_end(args);\r
    edje_object_message_signal_process(wd->layout);\r
@@ -703,7 +723,7 @@ elm_popup_timeout_set(Evas_Object *obj, int timeout)
 {  \r
    ELM_CHECK_WIDTYPE(obj, widtype);\r
    Widget_Data *wd = elm_widget_data_get(obj);\r
-\r
+   \r
    if (!wd) return;  \r
    elm_notify_timeout_set(wd->notify, timeout);\r
    evas_object_smart_callback_add(wd->notify, "notify,timeout", _elm_popup_timeout, obj);\r
@@ -863,7 +883,7 @@ elm_popup_run(Evas_Object *obj)
    /*Finger waggle warning*/\r
    _elm_dangerous_call_check(__FUNCTION__);\r
    evas_object_show(obj);\r
-   evas_object_smart_callback_add(obj, "response", response_cb, &response_id); \r
+   evas_object_smart_callback_add(obj, "response", response_cb, &response_id);  \r
    _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, &response_id);\r
    ecore_main_loop_begin();\r
    if (_elm_exit_handler)\r