[elm_widget] Enable not to add resize object to or delete resize object from sub...
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Wed, 16 Oct 2013 15:54:54 +0000 (00:54 +0900)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Wed, 16 Oct 2013 16:19:40 +0000 (01:19 +0900)
Summary: Add one more argument, 'Eina_Bool sub_object' to elm_widget_resize_object_set. If the argument, 'sub_object' is set as EINA_TRUE, the new resize object is added to the sub object and the previous resize object is deleted from the sub object.

Reviewers: Hermet, seoz

CC: Jaehyun_Cho, seoz, raster
Differential Revision: https://phab.enlightenment.org/D265

22 files changed:
src/lib/elc_naviframe.c
src/lib/elm_box.c
src/lib/elm_diskselector.c
src/lib/elm_entry.c
src/lib/elm_factory.c
src/lib/elm_glview.c
src/lib/elm_grid.c
src/lib/elm_layout.c
src/lib/elm_map.c
src/lib/elm_mapbuf.c
src/lib/elm_notify.c
src/lib/elm_photo.c
src/lib/elm_photocam.c
src/lib/elm_plug.c
src/lib/elm_prefs.c
src/lib/elm_table.c
src/lib/elm_thumb.c
src/lib/elm_toolbar.c
src/lib/elm_web.c
src/lib/elm_web2.c
src/lib/elm_widget.c
src/lib/elm_widget.h

index 4f3543909906314d3153def86563269f114ec5a6..32f1f79aa835745a1c30619dcb89a8581f32d47c 100644 (file)
@@ -45,7 +45,7 @@ _resize_object_reset(Evas_Object *obj, Elm_Naviframe_Item *it,
    //Recover previous smart members.
    if (prev_it)
      {
-        elm_widget_resize_object_set(obj, NULL);
+        elm_widget_resize_object_set(obj, NULL, EINA_TRUE);
         elm_widget_sub_object_add(obj, VIEW(prev_it));
         evas_object_smart_member_add(VIEW(prev_it), obj);
      }
@@ -54,7 +54,7 @@ _resize_object_reset(Evas_Object *obj, Elm_Naviframe_Item *it,
 
    if (it)
      {
-        elm_widget_resize_object_set(obj, VIEW(it));
+        elm_widget_resize_object_set(obj, VIEW(it), EINA_TRUE);
         evas_object_raise(VIEW(it));
      }
 }
index f51f00bcaf8ba788e12cee7b20b2496282131120..5937685a86d349738a80401bd3ad3a0dfdf8cfcf 100644 (file)
@@ -396,7 +396,8 @@ _elm_box_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
 {
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
    elm_widget_resize_object_set(obj,
-                                evas_object_box_add(evas_object_evas_get(obj)));
+                                evas_object_box_add(evas_object_evas_get(obj)),
+                                EINA_TRUE);
 
    evas_object_box_layout_set(wd->resize_obj, _elm_box_custom_layout,
                               obj, NULL);
index 35eed91c9d276861265e6a27701b7dea312119d8..6308d52b9ceb22b0b0a53f3dbec32ae9dcaed33a 100644 (file)
@@ -1275,7 +1275,7 @@ _elm_diskselector_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
    evas_event_freeze(evas);
 
    edje = edje_object_add(evas);
-   elm_widget_resize_object_set(obj, edje);
+   elm_widget_resize_object_set(obj, edje, EINA_TRUE);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
 
index b259dcaccb7e67f42bac0149224052bd574fb8b6..0b472cd671fa700e3eebea82f5058f856fc4f0fc 100644 (file)
@@ -4757,7 +4757,7 @@ _scrollable_set(Eo *obj, void *_pd, va_list *list)
         /* we now must re-theme ourselves to a scroller decoration
          * and move the entry looking object to be the content of the
          * scrollable view */
-        elm_widget_resize_object_set(obj, NULL);
+        elm_widget_resize_object_set(obj, NULL, EINA_TRUE);
         elm_widget_sub_object_add(obj, sd->entry_edje);
 
         if (!sd->scr_edje)
@@ -4776,7 +4776,7 @@ _scrollable_set(Eo *obj, void *_pd, va_list *list)
              evas_object_propagate_events_set(sd->scr_edje, EINA_TRUE);
           }
 
-        elm_widget_resize_object_set(obj, sd->scr_edje);
+        elm_widget_resize_object_set(obj, sd->scr_edje, EINA_TRUE);
 
         eo_do(obj, elm_scrollable_interface_objects_set(sd->scr_edje, sd->hit_rect));
 
@@ -4795,7 +4795,7 @@ _scrollable_set(Eo *obj, void *_pd, va_list *list)
              eo_do(obj, elm_scrollable_interface_content_set(NULL));
              evas_object_hide(sd->scr_edje);
           }
-        elm_widget_resize_object_set(obj, sd->entry_edje);
+        elm_widget_resize_object_set(obj, sd->entry_edje, EINA_TRUE);
 
         if (sd->scr_edje)
           elm_widget_sub_object_add(obj, sd->scr_edje);
index 14ef56bb08a128a7bd1e88e0df3fe557be226173..a2ebe38da1884af3c9eac754d3d5a0d8dc5970c2 100644 (file)
@@ -258,7 +258,7 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
    wd->content = content;
    if (!content) return;
 
-   elm_widget_resize_object_set(obj, content);
+   elm_widget_resize_object_set(obj, content, EINA_TRUE);
    evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _child_del, obj);
    evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
                                   _child_change, obj);
index bc791d02ef7e1b4e5fe5bdfc349d0baf5069be75..c1f0a4ee22463c7850d85bd7dd17208f6683e126 100644 (file)
@@ -205,7 +205,7 @@ _elm_glview_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
 
    // Create image to render Evas_GL Surface
    img = evas_object_image_filled_add(evas_object_evas_get(obj));
-   elm_widget_resize_object_set(obj, img);
+   elm_widget_resize_object_set(obj, img, EINA_TRUE);
    evas_object_image_size_set(img, 1, 1);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
index d1dc9c594f831adafc624f48b8336abd12549329..cd42724f6cc70e032c69865b2e94a344deafaf2e 100644 (file)
@@ -137,7 +137,7 @@ _elm_grid_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
    elm_widget_sub_object_parent_add(obj);
 
    grid = evas_object_grid_add(evas_object_evas_get(obj));
-   elm_widget_resize_object_set(obj, grid);
+   elm_widget_resize_object_set(obj, grid, EINA_TRUE);
    evas_object_grid_size_set(wd->resize_obj, 100, 100);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
index bf499fc507029dc684344842d2a38f1c00cc9cd2..b1851416f08fcbea9716dd8554a600797196fbc2 100644 (file)
@@ -718,7 +718,7 @@ _elm_layout_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
 
    /* has to be there *before* parent's smart_add() */
    edje = edje_object_add(evas_object_evas_get(obj));
-   elm_widget_resize_object_set(obj, edje);
+   elm_widget_resize_object_set(obj, edje, EINA_TRUE);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
 
index dab41fb63bd177ac478dfdd64e65e5d5f18cd7ff..9520f97ee4cdd59a284f31dfd954481029837d8b 100644 (file)
@@ -3978,7 +3978,7 @@ _elm_map_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
    elm_widget_sub_object_parent_add(obj);
 
    edje = edje_object_add(evas_object_evas_get(obj));
-   elm_widget_resize_object_set(obj, edje);
+   elm_widget_resize_object_set(obj, edje, EINA_TRUE);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
 
index 6c81f928d6a931e431acd450fb9ca9886b1dbc43..678dd2f697aec697420284aec24854e82ecea58b 100644 (file)
@@ -267,7 +267,7 @@ _elm_mapbuf_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
 {
    Elm_Mapbuf_Smart_Data *priv = _pd;
    Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(obj));
-   elm_widget_resize_object_set(obj, rect);
+   elm_widget_resize_object_set(obj, rect, EINA_TRUE);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
    elm_widget_sub_object_parent_add(obj);
index 912a001a7f3fbd8dfc84645a6579f31ee0e6873f..b4a8c64070bce2f0cb21575d0089d91b30925fd5 100644 (file)
@@ -728,7 +728,7 @@ _allow_events_set(Eo *obj, void *_pd, va_list *list)
      {
         sd->block_events = elm_layout_add(obj);
         _block_events_theme_apply(obj);
-        elm_widget_resize_object_set(obj, sd->block_events);
+        elm_widget_resize_object_set(obj, sd->block_events, EINA_TRUE);
         elm_layout_signal_callback_add
           (sd->block_events, "elm,action,click", "elm",
           _block_area_clicked_cb, obj);
index 9c28089059cd9a8a56d068e2fee3f206cbf78e6b..c3a018922ef49c913d5fad8fcd2f426d814ecccb 100644 (file)
@@ -283,7 +283,7 @@ _elm_photo_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
    _sizing_eval(obj);
 
    elm_widget_resize_object_set
-       (obj, edje_object_add(evas_object_evas_get(obj)));
+       (obj, edje_object_add(evas_object_evas_get(obj)), EINA_TRUE);
 
    elm_widget_theme_object_set
      (obj, wd->resize_obj, "photo", "base", "default");
index c90af48dccb3d4a4d0960d2bfd78957f9b4e30a8..2bd67f32f53dee4767d2832e18f48ead052bbe1a 100644 (file)
@@ -1328,7 +1328,7 @@ _elm_photocam_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
    elm_widget_sub_object_parent_add(obj);
 
    edje = edje_object_add(evas_object_evas_get(obj));
-   elm_widget_resize_object_set(obj, edje);
+   elm_widget_resize_object_set(obj, edje, EINA_TRUE);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
 
index de282319b96e276f346abdb34ffb9e9ce3da7ebf..5890a3e87f0d3ec33ed6bbb0477936f3313ba63c 100644 (file)
@@ -102,7 +102,7 @@ _elm_plug_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
    p_obj = ecore_evas_extn_plug_new(ee);
    if (!p_obj) return;
 
-   elm_widget_resize_object_set(obj, p_obj);
+   elm_widget_resize_object_set(obj, p_obj, EINA_TRUE);
 
    evas_object_event_callback_add
      (wd->resize_obj, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up,
index 28694a2ffce1e085d49fc84fae69c410001ee4ae..2d679a69cb4458403e67503b5726ae72ec6adc4d 100644 (file)
@@ -1195,7 +1195,7 @@ _elm_prefs_file_set(Eo *obj, void *_pd, va_list *list)
         return;
      }
 
-   elm_widget_resize_object_set(obj, sd->root->w_obj);
+   elm_widget_resize_object_set(obj, sd->root->w_obj, EINA_TRUE);
 
    _elm_prefs_values_get_default(sd->root, EINA_FALSE);
 
index 5a005298f0d11bfdce92b33ded3172cd7ce67344..9a8de5498be2a18892f85a95c8781ca58d8de2c7 100644 (file)
@@ -188,7 +188,7 @@ _elm_table_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
    elm_widget_sub_object_parent_add(obj);
 
    table = evas_object_table_add(evas_object_evas_get(obj));
-   elm_widget_resize_object_set(obj, table);
+   elm_widget_resize_object_set(obj, table, EINA_TRUE);
 
    evas_object_event_callback_add
      (table, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_size_hints_changed, obj);
index 43a19d82936c5eaf62395b69b39989909736109a..bb2ccf04af555e7e33c23cb79106e9e4e1f040ae 100644 (file)
@@ -598,7 +598,7 @@ _elm_thumb_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
    elm_widget_sub_object_parent_add(obj);
-   elm_widget_resize_object_set(obj, elm_layout_add(obj));
+   elm_widget_resize_object_set(obj, elm_layout_add(obj), EINA_TRUE);
 
    if (!elm_layout_theme_set(wd->resize_obj, "thumb", "base",
                              elm_widget_style_get(obj)))
index 7d0c8d9c1da29fcef0d89f216706e40a75627a32..1672a4cec19489ba6c91d29c9a0d76231e061e86 100644 (file)
@@ -2494,7 +2494,7 @@ _elm_toolbar_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
    elm_widget_sub_object_parent_add(obj);
 
    edje = edje_object_add(evas_object_evas_get(obj));
-   elm_widget_resize_object_set(obj, edje);
+   elm_widget_resize_object_set(obj, edje, EINA_TRUE);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
 
index 39d40e975b58f4e5b42b3285da263be0e004f3bd..c1cfe62e648a19fc61a8caf636853a14d0afedc2 100644 (file)
@@ -1145,7 +1145,7 @@ _elm_web_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
    elm_object_text_set(resize_obj, "WebKit not supported!");
 #endif
 
-   elm_widget_resize_object_set(obj, resize_obj);
+   elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
 
index 02764e35a6d3c769bde666b6f19e6abfbddba887..c192a709b388a8138e1429bdcc6f38d949528a5d 100644 (file)
@@ -138,7 +138,7 @@ _elm_web_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
    Evas_Object *resize_obj;
 
    resize_obj = _view_add(obj);
-   elm_widget_resize_object_set(obj, resize_obj);
+   elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
 
    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
 
index 9e15e6cf8cff80f8a5a6d9dffed4b2f6f56c051e..7f434ac5bdb43d7951e9f6898e3520aba303d9b5 100644 (file)
@@ -159,7 +159,7 @@ _on_sub_obj_del(void *data,
    if (obj == sd->resize_obj)
      {
         /* already dels sub object */
-        elm_widget_resize_object_set(sd->obj, NULL);
+        elm_widget_resize_object_set(sd->obj, NULL, EINA_TRUE);
         return;
      }
    else if (obj == sd->hover_obj)
@@ -251,7 +251,7 @@ _elm_widget_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
         Evas_Object *r_obj = priv->resize_obj;
         priv->resize_obj = NULL;
 
-        elm_widget_resize_object_set(obj, r_obj);
+        elm_widget_resize_object_set(obj, r_obj, EINA_TRUE);
      }
 }
 
@@ -1190,21 +1190,24 @@ _elm_widget_sub_object_del(Eo *obj, void *_pd, va_list *list)
 /*
  * @internal
  *
- * a resize object is a sub object with some more callbacks on it and
- * a smart member of the parent
+ * a resize object is a smart member of the parent.
+ * a resize object is added to and deleted from the sub object of the parent
+ * if the third argument, Eina_Bool sub_obj, is set as EINA_TRUE.
  */
 EAPI void
 elm_widget_resize_object_set(Evas_Object *obj,
-                             Evas_Object *sobj)
+                             Evas_Object *sobj,
+                             Eina_Bool sub_obj)
 {
    ELM_WIDGET_CHECK(obj);
-   eo_do(obj, elm_wdg_resize_object_set(sobj));
+   eo_do(obj, elm_wdg_resize_object_set(sobj, sub_obj));
 }
 
 static void
 _elm_widget_resize_object_set(Eo *obj, void *_pd, va_list *list)
 {
    Evas_Object *sobj = va_arg(*list, Evas_Object *);
+   Eina_Bool sub_obj = va_arg(*list, int);
    Evas_Object *parent;
 
    Elm_Widget_Smart_Data *sd = _pd;
@@ -1222,7 +1225,7 @@ _elm_widget_resize_object_set(Eo *obj, void *_pd, va_list *list)
              if (elm_widget_focus_get(sd->resize_obj)) _parents_unfocus(obj);
           }
 
-        elm_widget_sub_object_del(obj, sd->resize_obj);
+        if (sub_obj) elm_widget_sub_object_del(obj, sd->resize_obj);
      }
 
    sd->resize_obj = sobj;
@@ -1238,12 +1241,13 @@ _elm_widget_resize_object_set(Eo *obj, void *_pd, va_list *list)
         if (sdp)
           {
              if (sdp->resize_obj == sobj)
-               elm_widget_resize_object_set(parent, NULL);
-             else
+               elm_widget_resize_object_set(parent, NULL, sub_obj);
+             else if (sub_obj)
                elm_widget_sub_object_del(parent, sobj);
           }
      }
-   elm_widget_sub_object_add(obj, sobj);
+   if (sub_obj) elm_widget_sub_object_add(obj, sobj);
+
    evas_object_smart_member_add(sobj, obj);
 
    _smart_reconfigure(sd);
index 0bc885450b1f2ac2a69723274b342c62693af428..f426d5a5583cd5473caa043b4407a2c26ed34522 100644 (file)
  *      (priv->sub, "elm,action,click", "", _clicked_signal_cb, obj);
  *    // set this sub object as the "resize object". widgets get 1 resize
  *    // object that is resized along with the object wrapper.
- *    elm_widget_resize_object_set(obj, priv->sub);
+ *    elm_widget_resize_object_set(obj, priv->sub, EINA_TRUE);
  * }
  *
  * static void
@@ -603,7 +603,7 @@ EAPI void             elm_widget_on_show_region_hook_set(Evas_Object *obj, void
 EAPI Eina_Bool        elm_widget_sub_object_parent_add(Evas_Object *sobj);
 EAPI Eina_Bool        elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
 EAPI Eina_Bool        elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
-EAPI void             elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
+EAPI void             elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj, Eina_Bool sub_obj);
 EAPI void             elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
 EAPI void             elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
 EAPI void             elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
@@ -1621,9 +1621,10 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l);
  * No description supplied by the EAPI.
  *
  * @param[in] sobj
+ * @param[in] sub_object
  *
  */
-#define elm_wdg_resize_object_set(sobj) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_RESIZE_OBJECT_SET), EO_TYPECHECK(Evas_Object *, sobj)
+#define elm_wdg_resize_object_set(sobj, sub_obj) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_RESIZE_OBJECT_SET), EO_TYPECHECK(Evas_Object *, sobj), EO_TYPECHECK(Eina_Bool, sub_obj)
 
 /**
  * @def elm_wdg_hover_object_set