forked from enlightenment/efl
multibuttonentry: internal label object status, box pack, unpack logic clean up.
Summary: Even user sets empty string here for text, label still packed in box with min size(finger size). label_set internal logic is not clear before. ex: object min set, resize check the string length then sending signal, min set again. so i deleted the signal emit code here, we can handle label show, hide status in code and it's more clear. Besides "sd->label" is always true all of the case. we need to check whether it's packed or not. The label will be added to parent's sub object when it's packed into box. label_set as empty string in adding time also meaningless. @fix Test Plan: Run multibuttonentry sample. Set a text somthing for it then set an empty string here. Reviewers: Hermet, woohyun Differential Revision: https://phab.enlightenment.org/D2841 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
fac449d7f9
commit
4890319e3e
|
@ -25,25 +25,6 @@ group { name: "elm/multibuttonentry/label/default";
|
|||
rel1.offset: 2 2;
|
||||
rel2.offset: -5 -5;
|
||||
}
|
||||
description { state: "no_text" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
text.min: 0 1;
|
||||
rel1.offset: 0 0;
|
||||
rel2.offset: -1 -1;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program {
|
||||
signal: "elm,mbe,set_text"; source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.text";
|
||||
}
|
||||
program {
|
||||
signal: "elm,mbe,clear_text"; source: "elm";
|
||||
action: STATE_SET "no_text" 0.0;
|
||||
target: "elm.text";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ _shrink_mode_set(Evas_Object *obj,
|
|||
// pack buttons only 1line
|
||||
w = sd->w_box;
|
||||
|
||||
if (sd->label)
|
||||
if (sd->label && sd->label_packed)
|
||||
{
|
||||
elm_box_pack_end(sd->box, sd->label);
|
||||
evas_object_size_hint_min_get(sd->label, &w_tmp, NULL);
|
||||
|
@ -260,7 +260,7 @@ _shrink_mode_set(Evas_Object *obj,
|
|||
|
||||
// pack buttons only 1line
|
||||
|
||||
if (sd->label) elm_box_pack_end(sd->box, sd->label);
|
||||
if (sd->label && sd->label_packed) elm_box_pack_end(sd->box, sd->label);
|
||||
|
||||
// pack remain btns
|
||||
eo_item = NULL;
|
||||
|
@ -782,7 +782,7 @@ _item_new(Elm_Multibuttonentry_Data *sd,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (sd->label)
|
||||
if (sd->label && sd->label_packed)
|
||||
elm_box_pack_after(sd->box, VIEW(item), sd->label);
|
||||
else
|
||||
elm_box_pack_start(sd->box, VIEW(item));
|
||||
|
@ -1156,26 +1156,23 @@ _label_set(Evas_Object *obj,
|
|||
|
||||
eina_stringshare_replace(&sd->label_str, str);
|
||||
|
||||
evas_object_size_hint_min_set(sd->label, 0, 0);
|
||||
evas_object_resize(sd->label, 0, 0);
|
||||
edje_object_part_text_escaped_set(sd->label, "elm.text", str);
|
||||
|
||||
if (!strlen(str))
|
||||
{
|
||||
edje_object_signal_emit(sd->label, "elm,mbe,clear_text", "elm");
|
||||
edje_object_size_min_calc(sd->label, &width, &height);
|
||||
sd->label_packed = EINA_FALSE;
|
||||
elm_box_unpack(sd->box, sd->label);
|
||||
evas_object_hide(sd->label);
|
||||
}
|
||||
else
|
||||
{
|
||||
edje_object_signal_emit(sd->label, "elm,mbe,set_text", "elm");
|
||||
sd->label_packed = EINA_TRUE;
|
||||
edje_object_size_min_calc(sd->label, &width, &height);
|
||||
evas_object_size_hint_min_set(sd->label, width, height);
|
||||
elm_box_pack_start(sd->box, sd->label);
|
||||
evas_object_show(sd->label);
|
||||
}
|
||||
|
||||
elm_coords_finger_size_adjust(1, &width, 1, &height);
|
||||
evas_object_size_hint_min_set(sd->label, width, height);
|
||||
evas_object_show(sd->label);
|
||||
_view_update(sd);
|
||||
}
|
||||
|
||||
|
@ -1375,8 +1372,6 @@ _view_init(Evas_Object *obj, Elm_Multibuttonentry_Data *sd)
|
|||
elm_widget_theme_object_set
|
||||
(obj, sd->label, "multibuttonentry", "label",
|
||||
elm_widget_style_get(obj));
|
||||
_label_set(obj, "");
|
||||
elm_widget_sub_object_add(obj, sd->label);
|
||||
|
||||
// ACCESS
|
||||
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||
|
|
|
@ -105,6 +105,7 @@ struct _Elm_Multibuttonentry_Data
|
|||
Eina_Bool last_it_select : 1;
|
||||
Eina_Bool editable : 1;
|
||||
Eina_Bool focused : 1;
|
||||
Eina_Bool label_packed : 1;
|
||||
|
||||
Ecore_Timer *longpress_timer;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue