edje: add part_text_valign property for internal usage 18/115318/6
authorYoungbok Shin <youngb.shin@samsung.com>
Fri, 17 Feb 2017 09:08:32 +0000 (18:08 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Wed, 31 May 2017 04:29:34 +0000 (04:29 +0000)
There is a need of changing vertical align using API from EFL C# dev team.

@tizen_feature

Change-Id: Ib9376ce4088624654cc96f169a3058f5d4d532be

src/lib/edje/edje_calc.c
src/lib/edje/edje_edit.c
src/lib/edje/edje_load.c
src/lib/edje/edje_object.eo
src/lib/edje/edje_private.h
src/lib/edje/edje_util.c

index e5feb5d..27b21f2 100644 (file)
@@ -2013,6 +2013,11 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
           }
         /* END */
 
+        /* TIZEN_ONLY(20170217): add part_text_valign property for internal usage */
+        if (ep->typedata.text->valign != -1.0)
+          evas_object_textblock_valign_set(ep->object, TO_DOUBLE(ep->typedata.text->valign));
+        else
+        /* END */
         evas_object_textblock_valign_set(ep->object, TO_DOUBLE(chosen_desc->text.align.y));
      }
 }
index b979a9a..f462ac8 100644 (file)
@@ -3196,6 +3196,9 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
         rp->type = EDJE_RP_TYPE_TEXT;
         rp->typedata.text = calloc(1, sizeof(Edje_Real_Part_Text));
         rp->object = evas_object_textblock_add(ed->base->evas);
+        /* TIZEN_ONLY(20170217): add part_text_valign property for internal usage */
+        rp->typedata.text->valign = -1.0;
+        /* END */
      }
    else if (ep->type == EDJE_PART_TYPE_BOX)
      {
index 10f6a35..d348850 100644 (file)
@@ -694,6 +694,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
                        rp->type = EDJE_RP_TYPE_TEXT;
                        rp->typedata.text = calloc(1, sizeof(Edje_Real_Part_Text));
                        if (!rp->typedata.text) memerr = EINA_TRUE;
+                       /* TIZEN_ONLY(20170217): add part_text_valign property for internal usage */
+                       else rp->typedata.text->valign = -1.0;
+                       /* END */
                        break;
 
                      case EDJE_PART_TYPE_VECTOR:
index d46157c..ce15a74 100644 (file)
@@ -3039,6 +3039,31 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
          }
       }
       /* END */
+      /* TIZEN_ONLY(20170217): add part_text_valign property for internal usage */
+      @property part_text_valign @internal {
+         set {
+            [[Sets the valign for text.
+
+              Do not use this API without understanding whats going on.
+              It is made for internal usage.
+            ]]
+            return: bool; [[$true, on success or $false, on error]]
+         }
+         get {
+            [[Gets the valign for text.
+
+              Do not use this API without understanding whats going on.
+              It is made for internal usage.
+            ]]
+         }
+         keys {
+            part: const(char)*; [[The part name]]
+         }
+         values {
+            valign: double; [[The valign 0.0~1.0. -1.0 for respect EDC's align value.]]
+         }
+      }
+      /* END */
    }
    implements {
       Eo.Base.constructor;
index dc93926..547067e 100644 (file)
@@ -1923,6 +1923,9 @@ struct _Edje_Real_Part_Text
    const char            *style; // 4
    Edje_Position          offset; // 8
    short                  size; // 2
+   /* TIZEN_ONLY(20170217): add part_text_valign property for internal usage */
+   FLOAT_T                valign; // 4
+   /* END */
    /* TIZEN_ONLY(20160920): Add fade_ellipsis feature to TEXTBLOCK, TEXT part. */
    struct {
       Evas_Object *object; // 4
index 27192fb..2600eb8 100644 (file)
@@ -6913,4 +6913,67 @@ _edje_object_part_text_min_policy_get(Eo *eo_obj EINA_UNUSED, Edje *ed, const ch
 }
 /* END */
 
+/* TIZEN_ONLY(20170217): add part_text_valign property for internal usage */
+EOLIAN Eina_Bool
+_edje_object_part_text_valign_set(Eo *eo_obj EINA_UNUSED, Edje *ed, const char *part, double valign)
+{
+   Edje_Real_Part *rp;
+   Edje_Part_Description_Text *desc;
+
+   if (!part) return EINA_FALSE;
+   rp = _edje_real_part_recursive_get(&ed, part);
+   if (!rp) return EINA_FALSE;
+   if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) &&
+       (rp->part->type != EDJE_PART_TYPE_TEXT))
+     return EINA_FALSE;
+
+   if (rp->typedata.text)
+     {
+        rp->typedata.text->valign = FROM_DOUBLE(valign);
+
+        if (rp->typedata.text->valign == -1.0)
+          {
+             desc = (Edje_Part_Description_Text *)rp->chosen_description;
+             evas_object_textblock_valign_set(rp->object, TO_DOUBLE(desc->text.align.y));
+          }
+        else
+          {
+             evas_object_textblock_valign_set(rp->object, valign);
+          }
+        return EINA_TRUE;
+     }
+
+   return EINA_FALSE;
+}
+
+EOLIAN double
+_edje_object_part_text_valign_get(Eo *eo_obj EINA_UNUSED, Edje *ed, const char *part)
+{
+   Edje_Real_Part *rp;
+   Edje_Part_Description_Text *desc;
+
+   if (!part) return -1,0;
+   rp = _edje_real_part_recursive_get(&ed, part);
+   if (!rp) return -1.0;
+   if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) &&
+       (rp->part->type != EDJE_PART_TYPE_TEXT))
+     return -1.0;
+
+   if (rp->typedata.text)
+     {
+        if (rp->typedata.text->valign == -1.0)
+          {
+             desc = (Edje_Part_Description_Text *)rp->chosen_description;
+             return TO_DOUBLE(desc->text.align.y);
+          }
+        else
+          {
+             return TO_DOUBLE(rp->typedata.text->valign);
+          }
+     }
+
+   return -1.0;
+}
+/* END */
+
 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/