entry: add elm.swallow.background part to all of groups
authorYoungbok Shin <youngb.shin@samsung.com>
Wed, 17 Feb 2016 22:43:33 +0000 (14:43 -0800)
committerCedric BAIL <cedric@osg.samsung.com>
Thu, 18 Feb 2016 01:05:39 +0000 (17:05 -0800)
Summary:
elm.swallow.background part will be a default part for
widget's background image.
When entry widget's scrollable status is changed,
the background object will be moved to scr_edje or entry_edje.

Test Plan: N/A

Reviewers: kimcinoo, woohyun, cedric

Differential Revision: https://phab.enlightenment.org/D3677

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
legacy/elementary/data/themes/edc/elm/entry.edc
legacy/elementary/src/lib/elm_entry.c

index 9a97a03..1ed14ee 100644 (file)
@@ -2,6 +2,13 @@ group { name: "elm/scroller/entry/default";
    inherit: "elm/scroller/base/default";
    image: "bg_glow_in.png" COMP;
    parts {
+      part { name: "elm.swallow.background"; type: SWALLOW;
+         clip_to: "clipper";
+         description { state: "default" 0.0;
+            rel1.offset: 1 1;
+            rel2.offset: -2 -2;
+         }
+      }
       part { name: "validation_glow";
          type: RECT;
          insert_before: "bg";
@@ -553,6 +560,12 @@ group { name: "elm/entry/base/default";
    }
 //   data.item: "context_menu_orientation" "horizontal";
    parts {
+      part { name: "elm.swallow.background"; type: SWALLOW;
+         description { state: "default" 0.0;
+            rel1.offset: 1 1;
+            rel2.offset: -2 -2;
+         }
+      }
       part { name: "elm.guide"; type: TEXTBLOCK; mouse_events: 0;
          scale: 1;
          description { state: "default" 0.0;
index 70cc5ae..3e057b8 100644 (file)
@@ -765,6 +765,31 @@ _elm_entry_elm_widget_disable(Eo *obj, Elm_Entry_Data *sd)
    return EINA_TRUE;
 }
 
+/* It gets the background object from from_edje object and
+ * sets the background object to to_edje object.
+ * The background object has to be moved to proper Edje object
+ * when scrollable status is changed. */
+static void
+_elm_entry_background_switch(Evas_Object *from_edje, Evas_Object *to_edje)
+{
+   Evas_Object *bg_obj;
+
+   if (!from_edje || !to_edje) return;
+
+   if (edje_object_part_exists(from_edje, "elm.swallow.background") &&
+       edje_object_part_exists(to_edje, "elm.swallow.background") &&
+       !edje_object_part_swallow_get(to_edje, "elm.swallow.background"))
+     {
+        bg_obj = edje_object_part_swallow_get(from_edje, "elm.swallow.background");
+
+        if (bg_obj)
+          {
+             edje_object_part_unswallow(from_edje, bg_obj);
+             edje_object_part_swallow(to_edje, "elm.swallow.background", bg_obj);
+          }
+     }
+}
+
 /* we can't issue the layout's theming code here, cause it assumes an
  * unique edje object, always */
 EOLIAN static Eina_Bool
@@ -853,10 +878,14 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
           elm_widget_theme_object_set
           (obj, sd->scr_edje, "scroller", "entry", style);
 
+        _elm_entry_background_switch(sd->entry_edje, sd->scr_edje);
+
         str = edje_object_data_get(sd->scr_edje, "focus_highlight");
      }
    else
      {
+        _elm_entry_background_switch(sd->scr_edje, sd->entry_edje);
+
         str = edje_object_data_get(sd->entry_edje, "focus_highlight");
      }