label: fix to get proper minimum size from legacy label theme
authorYoungbok Shin <youngb.shin@samsung.com>
Thu, 7 Dec 2017 04:33:11 +0000 (13:33 +0900)
committerJiyoun Park <jy0703.park@samsung.com>
Thu, 21 Dec 2017 11:47:55 +0000 (20:47 +0900)
It needs part_text_min_policy property functions from Edje.

@tizen_fix

Change-Id: Iecb0285a08557fafef6047e6c01d802c7e2cfb0a

src/lib/elementary/elm_label.c

index 16adbcd..f5b7da4 100644 (file)
@@ -231,7 +231,33 @@ _elm_label_elm_layout_sizing_eval(Eo *obj, Elm_Label_Data *_pd EINA_UNUSED)
    else
      {
         evas_event_freeze(evas_object_evas_get(obj));
+
+        /* TIZEN_ONLY(20161130): fix to get proper minimum size from legacy label theme */
+        Eina_Bool min_x, min_y;
+        Eina_Bool policy_set_ret = EINA_FALSE;
+
+        if (!sd->ellipsis && (sd->slide_mode == ELM_LABEL_SLIDE_MODE_NONE) &&
+            edje_object_part_text_min_policy_get(wd->resize_obj, "elm.text", "default", &min_x, &min_y))
+          {
+             /* If min policy for width is 0, it couldn't be expanded.
+                It uses legacy theme. */
+             if (min_x == EINA_FALSE)
+               {
+                  /* Set min policy as singleline. */
+                  policy_set_ret = edje_object_part_text_min_policy_set(wd->resize_obj, "elm.text", "default", 1, 1);
+                  ERR("[text.min: %d %d] is set on elm.text part. You need to change it to [text.min: 1 1] if your label does not have any wrap mode.", min_x, min_y);
+               }
+          }
+        /* END */
+
         edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
+
+        /* TIZEN_ONLY(20161130): fix to get proper minimum size from legacy label theme */
+        /* Restore min policy. */
+        if (policy_set_ret)
+          edje_object_part_text_min_policy_set(wd->resize_obj, "elm.text", "default", min_x, min_y);
+        /* END */
+
         if (sd->wrap_w > 0 && minw > sd->wrap_w) minw = sd->wrap_w;
         evas_object_size_hint_min_set(obj, minw, minh);
         /* TIZEN_ONLY(20161109): wrap width will work as min and max width */