cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=465c0dbeb8922ac511f25cb34bcc7bfa1b9d8888

commit 465c0dbeb8922ac511f25cb34bcc7bfa1b9d8888
Author: Youngbok Shin <youngb.s...@samsung.com>
Date:   Wed Feb 17 14:43:33 2016 -0800

    entry: add elm.swallow.background part to all of groups
    
    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 <ced...@osg.samsung.com>
---
 data/themes/edc/elm/entry.edc | 13 +++++++++++++
 src/lib/elm_entry.c           | 29 +++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/data/themes/edc/elm/entry.edc b/data/themes/edc/elm/entry.edc
index 9a97a03..1ed14ee 100644
--- a/data/themes/edc/elm/entry.edc
+++ b/data/themes/edc/elm/entry.edc
@@ -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;
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 70cc5ae..3e057b8 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -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");
      }
 

-- 


Reply via email to