aboutsummaryrefslogtreecommitdiffstats
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
parentLabel: Fix slide style groups (diff)
downloadelementary-devs/youngbok/interface_next.tar.gz
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)
}
}
+/* The following functions are added for
+ * elm_label_wrap_width_set, get APIs */
+void
+_elm_entry_wrap_width_set(Eo *obj, Evas_Coord w)
+{
+ ELM_ENTRY_DATA_GET(obj, sd);
+
+ if (w < 0) w = 0;
+
+ if (sd->wrap_w == w) return;
+
+ sd->wrap_w = w;
+
+ elm_layout_sizing_eval(obj);
+}
+
+Evas_Coord
+_elm_entry_wrap_width_get(Eo *obj)
+{
+ ELM_ENTRY_DATA_GET(obj, sd);
+
+ return sd->wrap_w;
+}
+
static inline void
_entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
{
@@ -958,6 +982,9 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
evas_object_geometry_get(obj, NULL, NULL, &resw, &resh);
+ if (sd->wrap_w > resw)
+ resw = sd->wrap_w;
+
if (!sd->single_line && sd->line_wrap)
{
if ((resw == sd->last_w) && (!sd->changed))
@@ -992,6 +1019,7 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
elm_interface_scrollable_content_viewport_geometry_get
(obj, NULL, NULL, &vw, &vh);
+
edje_object_size_min_restricted_calc
(sd->entry_edje, &minw, &minh, vw, 0);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
@@ -1016,6 +1044,8 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
if (sd->single_line) h = vmh + minh;
else h = vmh;
+ w = sd->wrap_w;
+
evas_object_resize(sd->entry_edje, vw, vh);
evas_object_size_hint_min_set(obj, w, h);
@@ -1026,7 +1056,7 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
}
else if (resw > 0)
{
- Evas_Coord fw = 0;
+ Evas_Coord obj_minw = sd->wrap_w;
edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, resw, 0);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
@@ -1043,8 +1073,8 @@ _entry_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
sd->ent_mw = minw;
sd->ent_mh = minh;
- elm_coords_finger_size_adjust(1, &fw, 1, &minh);
- evas_object_size_hint_min_set(obj, fw, minh);
+ elm_coords_finger_size_adjust(1, &obj_minw, 1, &minh);
+ evas_object_size_hint_min_set(obj, obj_minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
}
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)
}
EOLIAN static void
-_elm_label_wrap_width_set(Eo *obj, Elm_Label_Data *sd, Evas_Coord w)
+_elm_label_wrap_width_set(Eo *obj, Elm_Label_Data *sd EINA_UNUSED, Evas_Coord w)
{
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
-
- if (w < 0) w = 0;
-
- if (sd->wrap_w == w) return;
-
- if (sd->ellipsis)
- _label_format_set(obj, sd->format);
- sd->wrap_w = w;
-
- elm_layout_sizing_eval(obj);
+ _elm_entry_wrap_width_set(obj, w);
}
EOLIAN static Evas_Coord
-_elm_label_wrap_width_get(Eo *obj EINA_UNUSED, Elm_Label_Data *sd)
+_elm_label_wrap_width_get(Eo *obj, Elm_Label_Data *sd EINA_UNUSED)
{
- return sd->wrap_w;
+ return _elm_entry_wrap_width_get(obj);
}
EOLIAN 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);
void _elm_menu_menu_bar_set(Eo *obj, Eina_Bool menu_bar);
void _elm_menu_menu_bar_hide(Eo *obj);
+void _elm_entry_wrap_width_set(Eo *obj, Evas_Coord w);
+Evas_Coord _elm_entry_wrap_width_get(Eo *obj);
/* DEPRECATED, will be removed on next release */
void _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
Evas_Coord last_w, ent_mw, ent_mh;
Evas_Coord downx, downy;
Evas_Coord ox, oy;
+ Evas_Coord wrap_w; /** wrap width by pixel for the line wrap support **/
Eina_List *items; /** context menu item list */
Eina_List *item_providers;
Eina_List *markup_filters;