widget: Remove sub_obj arg to resize_object_set

This removes an argument that was false only for a single widget:
naviframe. Hopefully this logic is now simpler, even though it involves
a small hack within naviframe itself.

Ref T5363
This commit is contained in:
Jean-Philippe Andre 2017-08-08 21:06:43 +09:00
parent 76088133dc
commit 2450038436
25 changed files with 43 additions and 57 deletions

View File

@ -176,7 +176,7 @@ _efl_ui_box_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Box_Data *_pd EINA_UNUSED
Evas *e = evas_object_evas_get(obj);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
elm_widget_resize_object_set(obj, evas_object_box_add(e), EINA_TRUE);
elm_widget_resize_object_set(obj, evas_object_box_add(e));
evas_object_box_layout_set(wd->resize_obj, _evas_box_custom_layout, obj, NULL);
evas_object_event_callback_add(wd->resize_obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_size_hints_changed, obj);

View File

@ -227,7 +227,7 @@ _efl_ui_grid_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Grid_Data *pd)
custom->parent = obj;
evas_object_table_homogeneous_set(table, EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE);
elm_widget_resize_object_set(obj, table, EINA_TRUE);
elm_widget_resize_object_set(obj, table);
evas_object_event_callback_add
(table, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _table_size_hints_changed, obj);

View File

@ -1426,7 +1426,7 @@ _efl_ui_image_zoomable_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Image_Zoomable
elm_widget_sub_object_parent_add(obj);
edje = edje_object_add(evas_object_evas_get(obj));
elm_widget_resize_object_set(obj, edje, EINA_TRUE);
elm_widget_resize_object_set(obj, edje);
efl_canvas_group_add(efl_super(obj, MY_CLASS));

View File

@ -726,7 +726,7 @@ _efl_ui_layout_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Layout_Data *_pd EINA_
/* 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, EINA_TRUE);
elm_widget_resize_object_set(obj, edje);
efl_canvas_group_add(efl_super(obj, MY_CLASS));

View File

@ -3699,7 +3699,7 @@ _efl_ui_text_scrollable_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool scroll)
/* 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, EINA_TRUE);
elm_widget_resize_object_set(obj, NULL);
elm_widget_sub_object_add(obj, sd->entry_edje);
if (!sd->scr_edje)
@ -3718,7 +3718,7 @@ _efl_ui_text_scrollable_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool scroll)
evas_object_propagate_events_set(sd->scr_edje, EINA_TRUE);
}
elm_widget_resize_object_set(obj, sd->scr_edje, EINA_TRUE);
elm_widget_resize_object_set(obj, sd->scr_edje);
elm_interface_scrollable_objects_set(obj, sd->scr_edje, sd->hit_rect);
@ -3740,7 +3740,7 @@ _efl_ui_text_scrollable_set(Eo *obj, Efl_Ui_Text_Data *sd, Eina_Bool scroll)
elm_interface_scrollable_content_set(obj, NULL);
evas_object_hide(sd->scr_edje);
}
elm_widget_resize_object_set(obj, sd->entry_edje, EINA_TRUE);
elm_widget_resize_object_set(obj, sd->entry_edje);
if (sd->scr_edje)
elm_widget_sub_object_add(obj, sd->scr_edje);

View File

@ -60,10 +60,9 @@ static const Elm_Action key_actions[] = {
EOLIAN static void
_elm_naviframe_elm_widget_resize_object_set(Eo *obj, Elm_Naviframe_Data *pd EINA_UNUSED,
Efl_Canvas_Object *sobj, Eina_Bool sub_obj)
Efl_Canvas_Object *sobj)
{
if (!sobj || !efl_finalized_get(obj)) goto super;
EINA_SAFETY_ON_TRUE_RETURN(sub_obj);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
if (wd->resize_obj == sobj) return;
@ -74,7 +73,7 @@ _elm_naviframe_elm_widget_resize_object_set(Eo *obj, Elm_Naviframe_Data *pd EINA
wd->resize_obj = NULL;
super:
elm_obj_widget_resize_object_set(efl_super(obj, MY_CLASS), sobj, EINA_TRUE);
elm_obj_widget_resize_object_set(efl_super(obj, MY_CLASS), sobj);
}
static void
@ -82,7 +81,7 @@ _resize_object_reset(Evas_Object *obj, Elm_Naviframe_Item_Data *it)
{
if (it)
{
elm_widget_resize_object_set(obj, VIEW(it), EINA_FALSE);
elm_widget_resize_object_set(obj, VIEW(it));
evas_object_raise(VIEW(it));
}
}
@ -1833,7 +1832,7 @@ _elm_naviframe_item_pop(Eo *obj, Elm_Naviframe_Data *sd)
evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE);
}
elm_widget_resize_object_set(obj, VIEW(prev_it), EINA_FALSE);
elm_widget_resize_object_set(obj, VIEW(prev_it));
/* these 2 signals MUST take place simultaneously */
elm_object_signal_emit(VIEW(it), "elm,state,cur,popped", "elm");

View File

@ -370,9 +370,7 @@ EOLIAN static void
_elm_box_efl_canvas_group_group_add(Eo *obj, Elm_Box_Data *_pd 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)),
EINA_TRUE);
elm_widget_resize_object_set(obj, evas_object_box_add(evas_object_evas_get(obj)));
evas_object_box_layout_set(wd->resize_obj, _elm_box_custom_layout,
obj, NULL);

View File

@ -1282,7 +1282,7 @@ _elm_diskselector_efl_canvas_group_group_add(Eo *obj, Elm_Diskselector_Data *pri
evas_event_freeze(evas);
edje = edje_object_add(evas);
elm_widget_resize_object_set(obj, edje, EINA_TRUE);
elm_widget_resize_object_set(obj, edje);
efl_canvas_group_add(efl_super(obj, MY_CLASS));

View File

@ -5015,7 +5015,7 @@ _elm_entry_scrollable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool scroll)
/* 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, EINA_TRUE);
elm_widget_resize_object_set(obj, NULL);
elm_widget_sub_object_add(obj, sd->entry_edje);
if (!sd->scr_edje)
@ -5034,7 +5034,7 @@ _elm_entry_scrollable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool scroll)
evas_object_propagate_events_set(sd->scr_edje, EINA_TRUE);
}
elm_widget_resize_object_set(obj, sd->scr_edje, EINA_TRUE);
elm_widget_resize_object_set(obj, sd->scr_edje);
elm_interface_scrollable_objects_set(obj, sd->scr_edje, sd->hit_rect);
@ -5056,7 +5056,7 @@ _elm_entry_scrollable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool scroll)
elm_interface_scrollable_content_set(obj, NULL);
evas_object_hide(sd->scr_edje);
}
elm_widget_resize_object_set(obj, sd->entry_edje, EINA_TRUE);
elm_widget_resize_object_set(obj, sd->entry_edje);
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, EINA_TRUE);
elm_widget_resize_object_set(obj, content);
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

@ -231,7 +231,7 @@ _elm_glview_efl_canvas_group_group_add(Eo *obj, Elm_Glview_Data *priv EINA_UNUSE
// 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, EINA_TRUE);
elm_widget_resize_object_set(obj, img);
evas_object_image_size_set(img, 1, 1);
efl_canvas_group_add(efl_super(obj, MY_CLASS));

View File

@ -134,7 +134,7 @@ _elm_grid_efl_canvas_group_group_add(Eo *obj, void *_pd 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, EINA_TRUE);
elm_widget_resize_object_set(obj, grid);
evas_object_grid_size_set(wd->resize_obj, 100, 100);
efl_canvas_group_add(efl_super(obj, MY_CLASS));

View File

@ -4094,7 +4094,7 @@ _elm_map_efl_canvas_group_group_add(Eo *obj, Elm_Map_Data *priv)
elm_widget_sub_object_parent_add(obj);
edje = edje_object_add(evas_object_evas_get(obj));
elm_widget_resize_object_set(obj, edje, EINA_TRUE);
elm_widget_resize_object_set(obj, edje);
efl_canvas_group_add(efl_super(obj, MY_CLASS));

View File

@ -278,7 +278,7 @@ _elm_mapbuf_efl_canvas_group_group_add(Eo *obj, Elm_Mapbuf_Data *priv)
Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(obj));
int i;
elm_widget_resize_object_set(obj, rect, EINA_TRUE);
elm_widget_resize_object_set(obj, rect);
efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj);

View File

@ -684,7 +684,7 @@ _elm_notify_allow_events_set(Eo *obj, Elm_Notify_Data *sd, Eina_Bool allow)
{
sd->block_events = elm_layout_add(obj);
_block_events_theme_apply(obj);
elm_widget_resize_object_set(obj, sd->block_events, EINA_TRUE);
elm_widget_resize_object_set(obj, sd->block_events);
evas_object_stack_above(sd->notify, sd->block_events);
elm_layout_signal_callback_add
(sd->block_events, "elm,action,click", "elm",

View File

@ -1355,7 +1355,7 @@ _elm_panel_scrollable_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool scrollable)
{
elm_layout_content_unset(obj, "elm.swallow.content");
elm_widget_resize_object_set(obj, NULL, EINA_TRUE);
elm_widget_resize_object_set(obj, NULL);
elm_widget_sub_object_add(obj, sd->panel_edje);
if (!sd->scr_edje)
@ -1375,7 +1375,7 @@ _elm_panel_scrollable_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool scrollable)
sd->handler_size = (int) (elm_object_scale_get(obj)) * (atoi(handler_size));
}
elm_widget_resize_object_set(obj, sd->scr_edje, EINA_TRUE);
elm_widget_resize_object_set(obj, sd->scr_edje);
if (!sd->hit_rect)
{
@ -1454,10 +1454,10 @@ _elm_panel_scrollable_set(Eo *obj, Elm_Panel_Data *sd, Eina_Bool scrollable)
evas_object_event_callback_del(sd->scr_event, EVAS_CALLBACK_MOUSE_UP,
_event_mouse_up);
elm_widget_resize_object_set(obj, NULL, EINA_TRUE);
elm_widget_resize_object_set(obj, NULL);
elm_widget_sub_object_add(obj, sd->scr_edje);
elm_widget_resize_object_set(obj, sd->panel_edje, EINA_TRUE);
elm_widget_resize_object_set(obj, sd->panel_edje);
elm_layout_content_unset(sd->scr_ly, "elm.swallow.content");
elm_layout_content_set(obj, "elm.swallow.content", sd->bx);

View File

@ -274,8 +274,7 @@ _elm_photo_efl_canvas_group_group_add(Eo *obj, Elm_Photo_Data *priv)
_sizing_eval(obj);
elm_widget_resize_object_set
(obj, edje_object_add(evas_object_evas_get(obj)), EINA_TRUE);
elm_widget_resize_object_set(obj, edje_object_add(evas_object_evas_get(obj)));
elm_widget_theme_object_set
(obj, wd->resize_obj, "photo", "base", "default");

View File

@ -122,7 +122,7 @@ _elm_plug_efl_canvas_group_group_add(Eo *obj, void *sd EINA_UNUSED)
p_obj = ecore_evas_extn_plug_new(ee);
if (!p_obj) return;
elm_widget_resize_object_set(obj, p_obj, EINA_TRUE);
elm_widget_resize_object_set(obj, p_obj);
evas_object_event_callback_add
(wd->resize_obj, EVAS_CALLBACK_MOUSE_UP, _on_mouse_up,

View File

@ -1168,7 +1168,7 @@ _elm_prefs_efl_file_file_set(Eo *obj, Elm_Prefs_Data *sd, const char *file, cons
return EINA_FALSE;
}
elm_widget_resize_object_set(obj, sd->root->w_obj, EINA_TRUE);
elm_widget_resize_object_set(obj, sd->root->w_obj);
_elm_prefs_values_get_default(sd->root, EINA_FALSE);

View File

@ -168,7 +168,7 @@ _elm_table_efl_canvas_group_group_add(Eo *obj, void *_pd 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, EINA_TRUE);
elm_widget_resize_object_set(obj, table);
evas_object_event_callback_add
(table, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_size_hints_changed, obj);

View File

@ -2798,7 +2798,7 @@ _elm_toolbar_efl_canvas_group_group_add(Eo *obj, Elm_Toolbar_Data *priv)
elm_widget_sub_object_parent_add(obj);
edje = edje_object_add(evas_object_evas_get(obj));
elm_widget_resize_object_set(obj, edje, EINA_TRUE);
elm_widget_resize_object_set(obj, edje);
efl_canvas_group_add(efl_super(obj, MY_CLASS));

View File

@ -514,7 +514,7 @@ _on_sub_obj_del(void *data, const Efl_Event *event)
if (event->object == sd->resize_obj)
{
/* already dels sub object */
elm_widget_resize_object_set(sd->obj, NULL, EINA_TRUE);
elm_widget_resize_object_set(sd->obj, NULL);
}
else if (event->object == sd->hover_obj)
{
@ -1594,23 +1594,17 @@ _elm_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj
return EINA_TRUE;
}
/*
* @internal
*
* a resize object is added to and deleted from the smart member and the sub object
* of the parent if the third argument, Eina_Bool sub_obj, is set as EINA_TRUE.
*/
/* protected function - for widget developers only */
EOLIAN static void
_elm_widget_resize_object_set(Eo *obj, Elm_Widget_Smart_Data *sd,
Evas_Object *sobj,
Eina_Bool sub_obj)
_elm_widget_resize_object_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eo *sobj)
{
Evas_Object *parent;
if (sd->resize_obj == sobj) return;
EINA_SAFETY_ON_TRUE_RETURN(sobj && !efl_isa(sobj, EFL_CANVAS_OBJECT_CLASS));
// orphan previous resize obj
if (sd->resize_obj && sub_obj)
if (sd->resize_obj)
{
evas_object_clip_unset(sd->resize_obj);
evas_object_smart_member_del(sd->resize_obj);
@ -1635,17 +1629,14 @@ _elm_widget_resize_object_set(Eo *obj, Elm_Widget_Smart_Data *sd,
if (sdp)
{
if (sdp->resize_obj == sobj)
elm_widget_resize_object_set(parent, NULL, sub_obj);
else if (sub_obj)
elm_widget_resize_object_set(parent, NULL);
else
elm_widget_sub_object_del(parent, sobj);
}
}
if (sub_obj)
{
elm_widget_sub_object_add(obj, sobj);
evas_object_smart_member_add(sobj, obj);
}
elm_widget_sub_object_add(obj, sobj);
evas_object_smart_member_add(sobj, obj);
_smart_reconfigure(sd);
}

View File

@ -52,7 +52,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
values {
sobj: Efl.Canvas.Object @nullable;
[[A canvas object (often a $Efl.Canvas.Layout object).]]
sub_obj: bool; [[$true if sub object exists, $false otherwise]]
}
}

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, EINA_TRUE);
* elm_widget_resize_object_set(obj, priv->sub);
* }
*
* static void
@ -645,7 +645,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, Eina_Bool sub_obj);
EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
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);

View File

@ -50,7 +50,7 @@ _elm_web_none_efl_canvas_group_group_add(Eo *obj, Elm_Web_None_Data *_pd EINA_UN
resize_obj = elm_label_add(obj);
elm_object_text_set(resize_obj, "WebKit not supported!");
elm_widget_resize_object_set(obj, resize_obj, EINA_TRUE);
elm_widget_resize_object_set(obj, resize_obj);
efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj);