summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2017-02-14 16:16:45 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-14 16:17:02 +0900
commita6fff5bc1e5e30a946e435369bcbaa406dd5d5ba (patch)
tree83d082c44c74dfccc9d5bb18048bd796e4eb8051 /src/lib/elementary
parentc39855a8ac6f86c2dd8b1856ed70f85e0e521f3e (diff)
Edje calc: Fix textblock size calculation logic
Summary: In singleline textblock, using "text.min: 1 0" and min, max width, Edje allows to use expandable text with ellipsis. It shows ellipsis when only text's width reach the max width. But, Edje couldn't support same feature on multiline textblock. Edje dose not use max height or text.max properly if ellipsis is enabled. This feature is very useful to make a layout with dynamically aligned text. @fix Reviewers: cedric, tasn, woohyun, raster, herdsman Subscribers: z-wony, eagleeye, jpeg Differential Revision: https://phab.enlightenment.org/D3595
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/elm_label.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/lib/elementary/elm_label.c b/src/lib/elementary/elm_label.c
index 7af1237278..76cb63c22c 100644
--- a/src/lib/elementary/elm_label.c
+++ b/src/lib/elementary/elm_label.c
@@ -52,18 +52,13 @@ _recalc(void *data)
52 resw = w; 52 resw = w;
53 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, resw, 0); 53 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, resw, 0);
54 54
55 /* This is a hack to workaround the way min size hints are treated. 55 /* If wrap_w is not set, label's width has to be controlled
56 * If the minimum width is smaller than the restricted width, it means 56 by outside of label. So, we don't need to set minimum width. */
57 * the minimum doesn't matter. */ 57 if (sd->wrap_w == -1)
58 if ((minw <= resw) && (minw != sd->wrap_w)) 58 evas_object_size_hint_min_set(data, 0, minh);
59 { 59 else
60 Evas_Coord ominw = -1; 60 evas_object_size_hint_min_set(data, minw, minh);
61
62 efl_gfx_size_hint_combined_min_get(data, &ominw, NULL);
63 minw = ominw;
64 }
65 61
66 evas_object_size_hint_min_set(data, minw, minh);
67 evas_event_thaw(evas_object_evas_get(data)); 62 evas_event_thaw(evas_object_evas_get(data));
68 evas_event_thaw_eval(evas_object_evas_get(data)); 63 evas_event_thaw_eval(evas_object_evas_get(data));
69} 64}
@@ -178,6 +173,18 @@ _label_slide_change(Evas_Object *obj)
178 } 173 }
179} 174}
180 175
176static void
177_elm_label_horizontal_size_policy_update(Eo *obj, Elm_Label_Data *sd)
178{
179 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
180
181 if (!sd->ellipsis && (sd->linewrap == ELM_WRAP_NONE))
182 edje_object_signal_emit(wd->resize_obj, "elm,state,horizontal,expandable", "elm");
183 else
184 edje_object_signal_emit(wd->resize_obj, "elm,state,horizontal,fixed", "elm");
185 edje_object_message_signal_process(wd->resize_obj);
186}
187
181EOLIAN static Elm_Theme_Apply 188EOLIAN static Elm_Theme_Apply
182_elm_label_elm_widget_theme_apply(Eo *obj, Elm_Label_Data *sd) 189_elm_label_elm_widget_theme_apply(Eo *obj, Elm_Label_Data *sd)
183{ 190{
@@ -190,6 +197,8 @@ _elm_label_elm_widget_theme_apply(Eo *obj, Elm_Label_Data *sd)
190 int_ret = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS)); 197 int_ret = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS));
191 if (!int_ret) return ELM_THEME_APPLY_FAILED; 198 if (!int_ret) return ELM_THEME_APPLY_FAILED;
192 199
200 _elm_label_horizontal_size_policy_update(obj, sd);
201
193 _label_format_set(wd->resize_obj, sd->format); 202 _label_format_set(wd->resize_obj, sd->format);
194 _label_slide_change(obj); 203 _label_slide_change(obj);
195 204
@@ -437,6 +446,10 @@ _elm_label_line_wrap_set(Eo *obj, Elm_Label_Data *sd, Elm_Wrap_Type wrap)
437 if (sd->linewrap == wrap) return; 446 if (sd->linewrap == wrap) return;
438 447
439 sd->linewrap = wrap; 448 sd->linewrap = wrap;
449 sd->lastw = -1;
450
451 _elm_label_horizontal_size_policy_update(obj, sd);
452
440 text = elm_layout_text_get(obj, NULL); 453 text = elm_layout_text_get(obj, NULL);
441 if (!text) return; 454 if (!text) return;
442 455
@@ -510,6 +523,9 @@ _elm_label_ellipsis_set(Eo *obj, Elm_Label_Data *sd, Eina_Bool ellipsis)
510 523
511 if (sd->ellipsis == ellipsis) return; 524 if (sd->ellipsis == ellipsis) return;
512 sd->ellipsis = ellipsis; 525 sd->ellipsis = ellipsis;
526 sd->lastw = -1;
527
528 _elm_label_horizontal_size_policy_update(obj, sd);
513 529
514 text = elm_layout_text_get(obj, NULL); 530 text = elm_layout_text_get(obj, NULL);
515 if (!text) return; 531 if (!text) return;