[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
This commit is contained in:
Jaehyun Cho 2013-10-17 00:54:54 +09:00 committed by Daniel Juyung Seo
parent cdd5ab5ec9
commit db2d711d64
22 changed files with 42 additions and 36 deletions

View 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));
}
}

View 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);

View 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());

View 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);

View 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);

View 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());

View 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());

View 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());

View 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());

View 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);

View 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);

View 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");

View 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());

View 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,

View 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);

View 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);

View 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)))

View 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());

View 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());

View 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());

View 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);

View File

@ -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