seoz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=8f497603fa7d32c781030679417b40d7830fa416

commit 8f497603fa7d32c781030679417b40d7830fa416
Author: Jaehyun Cho <jae_hyun....@samsung.com>
Date:   Thu Oct 17 00:54:54 2013 +0900

    [elm_widget] Enable not to add resize object to or delete resize object 
from sub object when the resize object is set.
    
    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
---
 src/lib/elc_naviframe.c    |  4 ++--
 src/lib/elm_box.c          |  3 ++-
 src/lib/elm_diskselector.c |  2 +-
 src/lib/elm_entry.c        |  6 +++---
 src/lib/elm_factory.c      |  2 +-
 src/lib/elm_glview.c       |  2 +-
 src/lib/elm_grid.c         |  2 +-
 src/lib/elm_layout.c       |  2 +-
 src/lib/elm_map.c          |  2 +-
 src/lib/elm_mapbuf.c       |  2 +-
 src/lib/elm_notify.c       |  2 +-
 src/lib/elm_photo.c        |  2 +-
 src/lib/elm_photocam.c     |  2 +-
 src/lib/elm_plug.c         |  2 +-
 src/lib/elm_prefs.c        |  2 +-
 src/lib/elm_table.c        |  2 +-
 src/lib/elm_thumb.c        |  2 +-
 src/lib/elm_toolbar.c      |  2 +-
 src/lib/elm_web.c          |  2 +-
 src/lib/elm_web2.c         |  2 +-
 src/lib/elm_widget.c       | 24 ++++++++++++++----------
 src/lib/elm_widget.h       |  7 ++++---
 22 files changed, 42 insertions(+), 36 deletions(-)

diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c
index 4f35439..32f1f79 100644
--- a/src/lib/elc_naviframe.c
+++ b/src/lib/elc_naviframe.c
@@ -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));
      }
 }
diff --git a/src/lib/elm_box.c b/src/lib/elm_box.c
index f51f00b..5937685 100644
--- a/src/lib/elm_box.c
+++ b/src/lib/elm_box.c
@@ -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);
diff --git a/src/lib/elm_diskselector.c b/src/lib/elm_diskselector.c
index 35eed91..6308d52 100644
--- a/src/lib/elm_diskselector.c
+++ b/src/lib/elm_diskselector.c
@@ -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());
 
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index b259dca..0b472cd 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -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);
diff --git a/src/lib/elm_factory.c b/src/lib/elm_factory.c
index 14ef56b..a2ebe38 100644
--- a/src/lib/elm_factory.c
+++ b/src/lib/elm_factory.c
@@ -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);
diff --git a/src/lib/elm_glview.c b/src/lib/elm_glview.c
index bc791d0..c1f0a4e 100644
--- a/src/lib/elm_glview.c
+++ b/src/lib/elm_glview.c
@@ -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());
diff --git a/src/lib/elm_grid.c b/src/lib/elm_grid.c
index d1dc9c5..cd42724 100644
--- a/src/lib/elm_grid.c
+++ b/src/lib/elm_grid.c
@@ -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());
diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c
index bf499fc..b185141 100644
--- a/src/lib/elm_layout.c
+++ b/src/lib/elm_layout.c
@@ -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());
 
diff --git a/src/lib/elm_map.c b/src/lib/elm_map.c
index dab41fb..9520f97 100644
--- a/src/lib/elm_map.c
+++ b/src/lib/elm_map.c
@@ -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());
 
diff --git a/src/lib/elm_mapbuf.c b/src/lib/elm_mapbuf.c
index 6c81f92..678dd2f 100644
--- a/src/lib/elm_mapbuf.c
+++ b/src/lib/elm_mapbuf.c
@@ -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);
diff --git a/src/lib/elm_notify.c b/src/lib/elm_notify.c
index 912a001..b4a8c64 100644
--- a/src/lib/elm_notify.c
+++ b/src/lib/elm_notify.c
@@ -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);
diff --git a/src/lib/elm_photo.c b/src/lib/elm_photo.c
index 9c28089..c3a0189 100644
--- a/src/lib/elm_photo.c
+++ b/src/lib/elm_photo.c
@@ -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");
diff --git a/src/lib/elm_photocam.c b/src/lib/elm_photocam.c
index c90af48..2bd67f3 100644
--- a/src/lib/elm_photocam.c
+++ b/src/lib/elm_photocam.c
@@ -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());
 
diff --git a/src/lib/elm_plug.c b/src/lib/elm_plug.c
index de28231..5890a3e 100644
--- a/src/lib/elm_plug.c
+++ b/src/lib/elm_plug.c
@@ -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,
diff --git a/src/lib/elm_prefs.c b/src/lib/elm_prefs.c
index 28694a2..2d679a6 100644
--- a/src/lib/elm_prefs.c
+++ b/src/lib/elm_prefs.c
@@ -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);
 
diff --git a/src/lib/elm_table.c b/src/lib/elm_table.c
index 5a00529..9a8de54 100644
--- a/src/lib/elm_table.c
+++ b/src/lib/elm_table.c
@@ -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);
diff --git a/src/lib/elm_thumb.c b/src/lib/elm_thumb.c
index 43a19d8..bb2ccf0 100644
--- a/src/lib/elm_thumb.c
+++ b/src/lib/elm_thumb.c
@@ -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)))
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index 7d0c8d9..1672a4c 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -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());
 
diff --git a/src/lib/elm_web.c b/src/lib/elm_web.c
index 39d40e9..c1cfe62 100644
--- a/src/lib/elm_web.c
+++ b/src/lib/elm_web.c
@@ -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());
 
diff --git a/src/lib/elm_web2.c b/src/lib/elm_web2.c
index 02764e3..c192a70 100644
--- a/src/lib/elm_web2.c
+++ b/src/lib/elm_web2.c
@@ -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());
 
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 9e15e6c..7f434ac 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -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);
diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h
index 0bc8854..f426d5a 100644
--- a/src/lib/elm_widget.h
+++ b/src/lib/elm_widget.h
@@ -131,7 +131,7 @@
  *      (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

-- 


Reply via email to