summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2016-03-22 18:14:44 +0900
committerYoungbok Shin <youngb.shin@samsung.com>2016-03-22 18:14:44 +0900
commitf1930fc2a6435979d84a5257e47d2bf3706a3cce (patch)
tree1886981ca076a287c7588b8765d0c842eb013dad
parentade21280ba2788e046d6adc5d0d9029fd569cc41 (diff)
Entry: Support wrap_width concept for elm_label_wrap_width_* APIsdevs/youngbok/interface_next
The APIs are going to be deprecated.
-rw-r--r--src/lib/elm_entry.c36
-rw-r--r--src/lib/elm_label.c18
-rw-r--r--src/lib/elm_priv.h2
-rw-r--r--src/lib/elm_widget_entry.h1
4 files changed, 40 insertions, 17 deletions
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 73a27235b..f7be44c5c 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -949,6 +949,30 @@ _cursor_geometry_recalc(Evas_Object *obj)
949 } 949 }
950} 950}
951 951
952/* The following functions are added for
953 * elm_label_wrap_width_set, get APIs */
954void
955_elm_entry_wrap_width_set(Eo *obj, Evas_Coord w)
956{
957 ELM_ENTRY_DATA_GET(obj, sd);
958
959 if (w < 0) w = 0;
960
961 if (sd->wrap_w == w) return;
962
963 sd->wrap_w = w;
964
965 elm_layout_sizing_eval(obj);
966}
967
968Evas_Coord
969_elm_entry_wrap_width_get(Eo *obj)
970{
971 ELM_ENTRY_DATA_GET(obj, sd);
972
973 return sd->wrap_w;
974}
975
952static inline void 976static inline void
953_entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd) 977_entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
954{ 978{
@@ -958,6 +982,9 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
958 982
959 evas_object_geometry_get(obj, NULL, NULL, &resw, &resh); 983 evas_object_geometry_get(obj, NULL, NULL, &resw, &resh);
960 984
985 if (sd->wrap_w > resw)
986 resw = sd->wrap_w;
987
961 if (!sd->single_line && sd->line_wrap) 988 if (!sd->single_line && sd->line_wrap)
962 { 989 {
963 if ((resw == sd->last_w) && (!sd->changed)) 990 if ((resw == sd->last_w) && (!sd->changed))
@@ -992,6 +1019,7 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
992 edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh); 1019 edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
993 elm_interface_scrollable_content_viewport_geometry_get 1020 elm_interface_scrollable_content_viewport_geometry_get
994 (obj, NULL, NULL, &vw, &vh); 1021 (obj, NULL, NULL, &vw, &vh);
1022
995 edje_object_size_min_restricted_calc 1023 edje_object_size_min_restricted_calc
996 (sd->entry_edje, &minw, &minh, vw, 0); 1024 (sd->entry_edje, &minw, &minh, vw, 0);
997 elm_coords_finger_size_adjust(1, &minw, 1, &minh); 1025 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
@@ -1016,6 +1044,8 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
1016 if (sd->single_line) h = vmh + minh; 1044 if (sd->single_line) h = vmh + minh;
1017 else h = vmh; 1045 else h = vmh;
1018 1046
1047 w = sd->wrap_w;
1048
1019 evas_object_resize(sd->entry_edje, vw, vh); 1049 evas_object_resize(sd->entry_edje, vw, vh);
1020 evas_object_size_hint_min_set(obj, w, h); 1050 evas_object_size_hint_min_set(obj, w, h);
1021 1051
@@ -1026,7 +1056,7 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
1026 } 1056 }
1027 else if (resw > 0) 1057 else if (resw > 0)
1028 { 1058 {
1029 Evas_Coord fw = 0; 1059 Evas_Coord obj_minw = sd->wrap_w;
1030 1060
1031 edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, resw, 0); 1061 edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, resw, 0);
1032 elm_coords_finger_size_adjust(1, &minw, 1, &minh); 1062 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
@@ -1043,8 +1073,8 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
1043 sd->ent_mw = minw; 1073 sd->ent_mw = minw;
1044 sd->ent_mh = minh; 1074 sd->ent_mh = minh;
1045 1075
1046 elm_coords_finger_size_adjust(1, &fw, 1, &minh); 1076 elm_coords_finger_size_adjust(1, &obj_minw, 1, &minh);
1047 evas_object_size_hint_min_set(obj, fw, minh); 1077 evas_object_size_hint_min_set(obj, obj_minw, minh);
1048 evas_object_size_hint_max_set(obj, -1, -1); 1078 evas_object_size_hint_max_set(obj, -1, -1);
1049 } 1079 }
1050 1080
diff --git a/src/lib/elm_label.c b/src/lib/elm_label.c
index fe34dae6d..e9dd03800 100644
--- a/src/lib/elm_label.c
+++ b/src/lib/elm_label.c
@@ -332,25 +332,15 @@ _elm_label_eo_base_constructor(Eo *obj, Elm_Label_Data *_pd EINA_UNUSED)
332} 332}
333 333
334EOLIAN static void 334EOLIAN static void
335_elm_label_wrap_width_set(Eo *obj, Elm_Label_Data *sd, Evas_Coord w) 335_elm_label_wrap_width_set(Eo *obj, Elm_Label_Data *sd EINA_UNUSED, Evas_Coord w)
336{ 336{
337 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 337 _elm_entry_wrap_width_set(obj, w);
338
339 if (w < 0) w = 0;
340
341 if (sd->wrap_w == w) return;
342
343 if (sd->ellipsis)
344 _label_format_set(obj, sd->format);
345 sd->wrap_w = w;
346
347 elm_layout_sizing_eval(obj);
348} 338}
349 339
350EOLIAN static Evas_Coord 340EOLIAN static Evas_Coord
351_elm_label_wrap_width_get(Eo *obj EINA_UNUSED, Elm_Label_Data *sd) 341_elm_label_wrap_width_get(Eo *obj, Elm_Label_Data *sd EINA_UNUSED)
352{ 342{
353 return sd->wrap_w; 343 return _elm_entry_wrap_width_get(obj);
354} 344}
355 345
356EOLIAN static void 346EOLIAN static void
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 91b4285a6..4d297ff81 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -536,6 +536,8 @@ void _elm_dbus_menu_item_select_cb(Elm_Object_Item *obj_item);
536 536
537void _elm_menu_menu_bar_set(Eo *obj, Eina_Bool menu_bar); 537void _elm_menu_menu_bar_set(Eo *obj, Eina_Bool menu_bar);
538void _elm_menu_menu_bar_hide(Eo *obj); 538void _elm_menu_menu_bar_hide(Eo *obj);
539void _elm_entry_wrap_width_set(Eo *obj, Evas_Coord w);
540Evas_Coord _elm_entry_wrap_width_get(Eo *obj);
539 541
540/* DEPRECATED, will be removed on next release */ 542/* DEPRECATED, will be removed on next release */
541void _elm_icon_signal_emit(Evas_Object *obj, 543void _elm_icon_signal_emit(Evas_Object *obj,
diff --git a/src/lib/elm_widget_entry.h b/src/lib/elm_widget_entry.h
index 9bf3452c8..624c9da81 100644
--- a/src/lib/elm_widget_entry.h
+++ b/src/lib/elm_widget_entry.h
@@ -52,6 +52,7 @@ struct _Elm_Entry_Data
52 Evas_Coord last_w, ent_mw, ent_mh; 52 Evas_Coord last_w, ent_mw, ent_mh;
53 Evas_Coord downx, downy; 53 Evas_Coord downx, downy;
54 Evas_Coord ox, oy; 54 Evas_Coord ox, oy;
55 Evas_Coord wrap_w; /** wrap width by pixel for the line wrap support **/
55 Eina_List *items; /** context menu item list */ 56 Eina_List *items; /** context menu item list */
56 Eina_List *item_providers; 57 Eina_List *item_providers;
57 Eina_List *markup_filters; 58 Eina_List *markup_filters;