aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-11-24 14:41:31 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-24 16:00:22 +0900
commit3c47a4f9f9ef7705992a61148f1f53311bcade49 (patch)
treeb8bb34bf921dbb028da42d1e97ea8ad7c260e895
parentEfl.Ui.Format: add string format checking for user input (diff)
downloadefl-3c47a4f9f9ef7705992a61148f1f53311bcade49.tar.gz
efl_ui_layout: create efl_ui_bg when efl_part for background is called.
Reviewers: woohyun, jpeg, cedric Subscribers: felipealmeida, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5151
-rw-r--r--src/Makefile_Elementary.am3
-rw-r--r--src/bin/elementary/Makefile.am1
-rw-r--r--src/bin/elementary/test.c4
-rw-r--r--src/bin/elementary/test_part_bg.c183
-rw-r--r--src/lib/elementary/Elementary.h2
-rw-r--r--src/lib/elementary/efl_ui_layout.c79
-rw-r--r--src/lib/elementary/efl_ui_layout_part_bg.eo11
-rw-r--r--src/lib/elementary/efl_ui_widget_part_bg.eo22
-rw-r--r--src/lib/elementary/elm_part_helper.h2
-rw-r--r--src/lib/elementary/elm_widget.c108
-rw-r--r--src/lib/elementary/elm_widget.h1
11 files changed, 411 insertions, 5 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 5c45cd62e1..be45275fa8 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -54,6 +54,7 @@ elm_public_eolian_files = \
lib/elementary/efl_ui_layout_part_content.eo \
lib/elementary/efl_ui_layout_part_text.eo \
lib/elementary/efl_ui_layout_part_table.eo \
+ lib/elementary/efl_ui_layout_part_bg.eo \
lib/elementary/efl_ui_layout_part_legacy.eo \
lib/elementary/efl_ui_multibuttonentry_part.eo \
lib/elementary/efl_ui_panes_part.eo \
@@ -61,6 +62,7 @@ elm_public_eolian_files = \
lib/elementary/efl_ui_slider_part.eo \
lib/elementary/efl_ui_textpath_part.eo \
lib/elementary/efl_ui_widget_part.eo \
+ lib/elementary/efl_ui_widget_part_bg.eo \
lib/elementary/efl_ui_win_part.eo \
lib/elementary/efl_access.eo \
lib/elementary/efl_access_action.eo \
@@ -862,6 +864,7 @@ bin/elementary/test_notify.c \
bin/elementary/test_nstate.c \
bin/elementary/test_panel.c \
bin/elementary/test_panes.c \
+bin/elementary/test_part_bg.c \
bin/elementary/test_photo.c \
bin/elementary/test_photocam.c \
bin/elementary/test_popup.c \
diff --git a/src/bin/elementary/Makefile.am b/src/bin/elementary/Makefile.am
index df71027a38..0ce67b0483 100644
--- a/src/bin/elementary/Makefile.am
+++ b/src/bin/elementary/Makefile.am
@@ -113,6 +113,7 @@ test_notify.c \
test_nstate.c \
test_panel.c \
test_panes.c \
+test_part_bg.c \
test_photo.c \
test_photocam.c \
test_popup.c \
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 07afe07ed0..e4ba05f74c 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -302,6 +302,7 @@ void test_win_dialog(void *data, Evas_Object *obj, void *event_info);
void test_win_modal(void *data, Evas_Object *obj, void *event_info);
void test_box_disable(void *data, Evas_Object *obj, void *event_info);
void test_layout_disable(void *data, Evas_Object *obj, void *event_info);
+void test_part_background(void *data, Evas_Object *obj, void *event_info);
void test_colorclass(void *data, Evas_Object *obj, void *event_info);
@@ -1130,6 +1131,9 @@ add_tests:
//------------------------------//
ADD_TEST(NULL, "Widgets Disable/Enable", "Box", test_box_disable);
ADD_TEST(NULL, "Widgets Disable/Enable", "Layout", test_layout_disable);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Widgets Part", "Part Background", test_part_background);
#undef ADD_TEST
if (autorun)
diff --git a/src/bin/elementary/test_part_bg.c b/src/bin/elementary/test_part_bg.c
new file mode 100644
index 0000000000..cdad4845f7
--- /dev/null
+++ b/src/bin/elementary/test_part_bg.c
@@ -0,0 +1,183 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+const Efl_Class *content_class[17];
+
+
+static void
+_reset_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ Evas_Object *radio = data;
+ Evas_Object *target;
+
+ radio = efl_ui_radio_selected_object_get(radio);
+ target = evas_object_data_get(radio, "data");
+
+ efl_gfx_color_set(efl_part(target, "background"), 0, 0, 0, 0);
+ efl_file_set(efl_part(target, "background"), NULL, NULL);
+}
+
+static void
+_color_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ Evas_Object *radio = data;
+ Evas_Object *target;
+ static Eina_Bool i;
+
+ radio = efl_ui_radio_selected_object_get(radio);
+ target = evas_object_data_get(radio, "data");
+ i ^= EINA_TRUE;
+ efl_gfx_color_set(efl_part(target, "background"), (i) ? 255 : 0, (i) ? 0 : 255, 0, 255);
+}
+
+static void
+_scale_type_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ Evas_Object *radio = data;
+ Evas_Object *target;
+ Efl_Ui_Image_Scale_Type type;
+ char buf[PATH_MAX];
+
+ radio = efl_ui_radio_selected_object_get(radio);
+ target = evas_object_data_get(radio, "data");
+
+ snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
+ efl_file_set(efl_part(target, "background"), buf, NULL);
+ type = efl_ui_image_scale_type_get(efl_part(target, "background"));
+ type = (type + 1) % 5;
+ efl_ui_image_scale_type_set(efl_part(target, "background"), type);
+}
+
+static Evas_Object *
+_create_box_contents(Evas_Object *box)
+{
+ Evas_Object *hbox;
+ Evas_Object *radio_group, *radio;
+ Evas_Object *content;
+ char buf[PATH_MAX];
+ unsigned int i;
+
+ hbox = efl_add(EFL_UI_BOX_CLASS, box,
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_HORIZONTAL),
+ efl_gfx_size_hint_weight_set(efl_added, 1, 1),
+ efl_pack_end(box, efl_added));
+
+ radio_group = radio = efl_add(EFL_UI_RADIO_CLASS, hbox,
+ efl_pack_end(hbox, efl_added),
+ efl_gfx_size_hint_weight_set(efl_added, 0, 0),
+ efl_ui_radio_state_value_set(efl_added, 0));
+
+ content = efl_add(EFL_UI_BOX_CLASS, hbox,
+ efl_pack_end(hbox, efl_added));
+ evas_object_data_set(radio, "data", content);
+
+ content = efl_add(EFL_UI_TEXT_CLASS, content,
+ efl_text_set(efl_added, "box"),
+ efl_ui_text_interactive_editable_set(efl_added, EINA_FALSE),
+ efl_pack_end(content, efl_added));
+
+ for (i = 0; i < (sizeof(content_class) / sizeof(content_class[0])) ; i++)
+ {
+ if (!content_class[i]) continue;
+
+ hbox = efl_add(EFL_UI_BOX_CLASS, box,
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_HORIZONTAL),
+ efl_pack_end(box, efl_added));
+
+ radio = efl_add(EFL_UI_RADIO_CLASS, hbox,
+ efl_ui_radio_group_add(efl_added, radio_group),
+ efl_pack_end(hbox, efl_added),
+ efl_ui_radio_state_value_set(efl_added, i + 1),
+ efl_gfx_size_hint_weight_set(efl_added, 0, 0)
+ );
+
+ content = efl_add(content_class[i], hbox,
+ efl_pack_end(hbox, efl_added));
+ if (efl_isa(content, efl_text_interface_get()))
+ efl_text_set(content, "text");
+
+ if (efl_isa(content, EFL_UI_IMAGE_CLASS))
+ {
+ snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
+ efl_file_set(content, buf, NULL);
+ }
+
+ evas_object_data_set(radio, "data", content);
+ }
+
+ efl_ui_nstate_value_set(radio_group, 0);
+
+ return radio_group;
+}
+
+void
+test_part_background(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win;
+ Evas_Object *scr;
+ Evas_Object *vbox, *hbox;
+ Evas_Object *radio_group;
+ Evas_Object *reset_btn, *color_btn, *scale_btn;
+
+ content_class[0] = EFL_UI_CALENDAR_CLASS;
+ content_class[1] = EFL_UI_SLIDER_CLASS;
+ content_class[2] = EFL_UI_SLIDER_INTERVAL_CLASS;
+ content_class[3] = EFL_UI_MULTIBUTTONENTRY_CLASS;
+ content_class[4] = EFL_UI_PROGRESSBAR_CLASS;
+ content_class[5] = EFL_UI_CLOCK_CLASS;
+ content_class[6] = EFL_UI_BUTTON_CLASS;
+ content_class[7] = EFL_UI_CHECK_CLASS;
+ content_class[8] = EFL_UI_RADIO_CLASS;
+ content_class[9] = EFL_UI_TEXT_CLASS;
+ content_class[10] = EFL_UI_FLIP_CLASS;
+ content_class[11] = EFL_UI_PANES_CLASS;
+ content_class[12] = EFL_UI_VIDEO_CLASS;
+ content_class[13] = EFL_UI_BG_CLASS;
+ content_class[14] = EFL_UI_IMAGE_CLASS;
+ content_class[15] = EFL_UI_IMAGE_ZOOMABLE_CLASS;
+ content_class[16] = EFL_UI_NSTATE_CLASS;
+ //content_class[17] = EFL_UI_SPINNER_CLASS;
+
+ win = efl_add(EFL_UI_WIN_CLASS, NULL,
+ efl_text_set(efl_added, "Widget Part Background"),
+ efl_ui_win_autodel_set(efl_added, EINA_TRUE));
+
+ vbox = efl_add(EFL_UI_BOX_CLASS, win,
+ efl_gfx_size_hint_weight_set(efl_added, 1, 1),
+ efl_content_set(win, efl_added));
+
+ hbox = efl_add(EFL_UI_BOX_CLASS, vbox,
+ efl_ui_direction_set(efl_added, EFL_UI_DIR_HORIZONTAL),
+ efl_gfx_size_hint_weight_set(efl_added, 1.0, 0.0),
+ efl_pack_end(vbox, efl_added));
+
+ reset_btn = efl_add(EFL_UI_BUTTON_CLASS, hbox,
+ efl_pack_end(hbox, efl_added),
+ efl_text_set(efl_added, "reset"));
+ color_btn = efl_add(EFL_UI_BUTTON_CLASS, hbox,
+ efl_pack_end(hbox, efl_added),
+ efl_text_set(efl_added, "color"));
+ scale_btn = efl_add(EFL_UI_BUTTON_CLASS, hbox,
+ efl_pack_end(hbox, efl_added),
+ efl_text_set(efl_added, "scale_type"));
+
+ scr = elm_scroller_add(vbox);
+ evas_object_show(scr);
+ evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(scr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ efl_pack_end(vbox, scr);
+
+ vbox = efl_add(EFL_UI_BOX_CLASS, scr,
+ efl_gfx_size_hint_weight_set(efl_added, 1, 1),
+ efl_content_set(scr, efl_added));
+
+ radio_group = _create_box_contents(vbox);
+
+ efl_event_callback_add(reset_btn, EFL_UI_EVENT_CLICKED, _reset_cb, radio_group);
+ efl_event_callback_add(color_btn, EFL_UI_EVENT_CLICKED, _color_cb, radio_group);
+ efl_event_callback_add(scale_btn, EFL_UI_EVENT_CLICKED, _scale_type_cb, radio_group);
+
+ efl_gfx_size_set(win, EINA_SIZE2D(300, 200));
+}
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 9cecb35bc3..431c1e8e7b 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -282,9 +282,11 @@ EAPI extern Elm_Version *elm_version;
#ifdef EFL_EO_API_SUPPORT
# include <efl_config_global.eo.h>
# include <efl_ui_widget_part.eo.h>
+# include <efl_ui_widget_part_bg.eo.h>
# include <efl_ui_layout_part.eo.h>
# include <efl_ui_layout_part_box.eo.h>
# include <efl_ui_layout_part_content.eo.h>
+# include <efl_ui_layout_part_bg.eo.h>
# include <efl_ui_layout_part_text.eo.h>
# include <efl_ui_layout_part_table.eo.h>
# include <efl_ui_win_part.eo.h>
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index be0e5c9642..a4cd798cb2 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -4,6 +4,7 @@
#define EFL_ACCESS_PROTECTED
#define ELM_LAYOUT_PROTECTED
+#define EFL_UI_WIDGET_PART_BG_PROTECTED
#include <Elementary.h>
@@ -2382,6 +2383,8 @@ _efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd, const char *
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
ELM_WIDGET_DATA_GET_OR_RETURN((Eo *) obj, wd, NULL);
+ if (eina_streq(part, "background"))
+ return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_BG_CLASS, obj, part);
// Check part type without using edje_object_part_object_get(), as this
// can cause recalc, which has side effects... and could be slow.
type = efl_canvas_layout_part_type_get(efl_part(wd->resize_obj, part));
@@ -2391,7 +2394,6 @@ _efl_ui_layout_efl_part_part(const Eo *obj, Efl_Ui_Layout_Data *sd, const char *
ERR("Invalid type found for part '%s' in group '%s'", part, sd->group);
return NULL;
}
-
switch (type)
{
case EFL_CANVAS_LAYOUT_PART_TYPE_BOX:
@@ -2526,9 +2528,84 @@ _efl_ui_layout_part_legacy_efl_ui_translatable_translatable_text_set(Eo *obj, vo
elm_widget_part_translatable_text_set(pd->obj, pd->part, label, domain);
}
+/* Efl.Ui.Layout.Part.Bg (common) */
+EOLIAN static void
+_efl_ui_layout_part_bg_efl_ui_widget_part_bg_bg_set(Eo *obj, void *_pd EINA_UNUSED, Efl_Canvas_Object *bg)
+{
+ Efl_Canvas_Layout_Part_Type type;
+ Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
+ Efl_Ui_Layout_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
+ ELM_WIDGET_DATA_GET_OR_RETURN(pd->obj, wd);
+
+ // Check part type without using edje_object_part_object_get(), as this
+ // can cause recalc, which has side effects... and could be slow.
+ type = efl_canvas_layout_part_type_get(efl_part(wd->resize_obj, "background"));
+ if (type != EFL_CANVAS_LAYOUT_PART_TYPE_SWALLOW)
+ efl_ui_widget_part_bg_set(efl_super(obj, EFL_UI_LAYOUT_PART_BG_CLASS), bg);
+
+ if (wd->bg == bg)
+ return;
+
+ efl_del(wd->bg);
+ wd->bg = bg;
+ if (!wd->bg)
+ return;
+
+ _efl_ui_layout_content_set(pd->obj, sd, "background", bg);
+}
+
+EOLIAN static Eina_Bool
+_efl_ui_layout_part_bg_efl_file_file_set(Eo *obj, void *pd EINA_UNUSED, const char *file, const char *key)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ return efl_file_set(bg_obj, file, key);
+}
+
+EOLIAN static void
+_efl_ui_layout_part_bg_efl_file_file_get(Eo *obj, void *pd EINA_UNUSED, const char **file, const char **key)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ efl_file_get(bg_obj, file, key);
+}
+
+EOLIAN static void
+_efl_ui_layout_part_bg_efl_gfx_color_set(Eo *obj, void *pd EINA_UNUSED, int r, int g, int b, int a)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ efl_gfx_color_set(bg_obj, r, g, b, a);
+}
+
+EOLIAN static void
+_efl_ui_layout_part_bg_efl_gfx_color_get(Eo *obj, void *pd EINA_UNUSED, int *r, int *g, int *b, int *a)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ efl_gfx_color_get(bg_obj, r, g, b, a);
+}
+
+EOLIAN static void
+_efl_ui_layout_part_bg_efl_ui_image_scale_type_set(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Image_Scale_Type scale_type)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ efl_ui_image_scale_type_set(bg_obj, scale_type);
+}
+
+EOLIAN static Efl_Ui_Image_Scale_Type
+_efl_ui_layout_part_bg_efl_ui_image_scale_type_get(Eo *obj, void *pd EINA_UNUSED)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ return efl_ui_image_scale_type_get(bg_obj);
+}
+
/* Efl.Ui.Layout.Part_Xxx includes */
#include "efl_ui_layout_part.eo.c"
#include "efl_ui_layout_part_content.eo.c"
+#include "efl_ui_layout_part_bg.eo.c"
#include "efl_ui_layout_part_text.eo.c"
#include "efl_ui_layout_part_legacy.eo.c"
diff --git a/src/lib/elementary/efl_ui_layout_part_bg.eo b/src/lib/elementary/efl_ui_layout_part_bg.eo
new file mode 100644
index 0000000000..9da3921797
--- /dev/null
+++ b/src/lib/elementary/efl_ui_layout_part_bg.eo
@@ -0,0 +1,11 @@
+class Efl.Ui.Layout.Part.Bg (Efl.Ui.Widget.Part.Bg, Efl.Ui.Bg)
+{
+ [[Elementary layout internal part background class]]
+ data: null;
+ implements {
+ Efl.Ui.Widget.Part.Bg.bg { set; }
+ Efl.File.file { get; set; }
+ Efl.Gfx.color { set; get; }
+ Efl.Ui.Image.scale_type { get; set; }
+ }
+}
diff --git a/src/lib/elementary/efl_ui_widget_part_bg.eo b/src/lib/elementary/efl_ui_widget_part_bg.eo
new file mode 100644
index 0000000000..47e5c6e8bf
--- /dev/null
+++ b/src/lib/elementary/efl_ui_widget_part_bg.eo
@@ -0,0 +1,22 @@
+class Efl.Ui.Widget.Part.Bg (Efl.Ui.Widget.Part, Efl.Ui.Bg)
+{
+ [[Elementary widget internal part background class]]
+ data: null;
+ methods {
+ @property bg @protected {
+ [[Background object]]
+ set {
+ }
+ get {
+ }
+ values {
+ bg: Efl.Canvas.Object;
+ }
+ }
+ }
+ implements {
+ Efl.File.file { get; set; }
+ Efl.Gfx.color { set; get; }
+ Efl.Ui.Image.scale_type { get; set; }
+ }
+}
diff --git a/src/lib/elementary/elm_part_helper.h b/src/lib/elementary/elm_part_helper.h
index 7eb3ae82e3..b74bd5734e 100644
--- a/src/lib/elementary/elm_part_helper.h
+++ b/src/lib/elementary/elm_part_helper.h
@@ -90,6 +90,8 @@ EOLIAN static Efl_Object * \
_ ## type ## _efl_part_part(const Eo *obj, typedata *priv EINA_UNUSED, const char *part) \
{ \
EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \
+ if (eina_streq(part, "background")) \
+ return efl_part(efl_super(obj, MY_CLASS), part); \
return ELM_PART_IMPLEMENT(TYPE ## _PART_CLASS, obj, part); \
}
diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c
index d95b34c5c3..c4e6823348 100644
--- a/src/lib/elementary/elm_widget.c
+++ b/src/lib/elementary/elm_widget.c
@@ -10,6 +10,7 @@
#define EFL_INPUT_EVENT_PROTECTED
#define EFL_UI_TRANSLATABLE_PROTECTED
#define EFL_UI_FOCUS_OBJECT_PROTECTED
+#define EFL_UI_WIDGET_PART_BG_PROTECTED
#include <Elementary.h>
@@ -814,6 +815,11 @@ _smart_reconfigure(Elm_Widget_Smart_Data *sd)
evas_object_move(sd->hover_obj, sd->x, sd->y);
evas_object_resize(sd->hover_obj, sd->w, sd->h);
}
+ if (sd->bg)
+ {
+ evas_object_move(sd->bg, sd->x, sd->y);
+ evas_object_resize(sd->bg, sd->w, sd->h);
+ }
}
EOLIAN static void
@@ -902,7 +908,7 @@ _elm_widget_efl_gfx_visible_set(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool vi
}
EOLIAN static void
-_elm_widget_efl_gfx_color_set(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, int r, int g, int b, int a)
+_elm_widget_efl_gfx_color_set(Eo *obj, Elm_Widget_Smart_Data *pd, int r, int g, int b, int a)
{
Eina_Iterator *it;
Evas_Object *o;
@@ -913,6 +919,7 @@ _elm_widget_efl_gfx_color_set(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, i
it = evas_object_smart_iterator_new(obj);
EINA_ITERATOR_FOREACH(it, o)
{
+ if (pd->bg == o) continue;
if (evas_object_data_get(o, "_elm_leaveme")) continue;
evas_object_color_set(o, r, g, b, a);
}
@@ -983,15 +990,18 @@ _elm_widget_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Elm_Widget_Sma
}
EOLIAN static void
-_elm_widget_efl_canvas_group_group_member_add(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Evas_Object *child)
+_elm_widget_efl_canvas_group_group_member_add(Eo *obj, Elm_Widget_Smart_Data *pd, Evas_Object *child)
{
int r, g, b, a;
efl_canvas_group_member_add(efl_super(obj, MY_CLASS), child);
if (evas_object_data_get(child, "_elm_leaveme")) return;
- evas_object_color_get(obj, &r, &g, &b, &a);
- evas_object_color_set(child, r, g, b, a);
+ if (pd->bg != child)
+ {
+ evas_object_color_get(obj, &r, &g, &b, &a);
+ evas_object_color_set(child, r, g, b, a);
+ }
efl_canvas_object_no_render_set(child, efl_canvas_object_no_render_get(obj));
evas_object_clip_set(child, evas_object_clip_get(obj));
@@ -5522,6 +5532,8 @@ elm_widget_signal_callback_del(Eo *obj, const char *emission, const char *source
EOLIAN static Efl_Object *
_elm_widget_efl_part_part(const Eo *obj, Elm_Widget_Smart_Data *wd EINA_UNUSED, const char *part)
{
+ if (eina_streq(part, "background"))
+ return ELM_PART_IMPLEMENT(EFL_UI_WIDGET_PART_BG_CLASS, obj, part);
return ELM_PART_IMPLEMENT(EFL_UI_WIDGET_PART_CLASS, obj, part);
}
@@ -5537,6 +5549,94 @@ _efl_ui_widget_part_efl_object_destructor(Eo *obj, Elm_Part_Data *pd)
/* Efl.Part end */
+/* Efl.Part Bg implementation */
+EOLIAN static void
+_efl_ui_widget_part_bg_bg_set(Eo *obj, void *_pd EINA_UNUSED, Efl_Canvas_Object *bg)
+{
+ Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
+ Elm_Widget_Smart_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
+
+ if (sd->bg == bg)
+ return;
+
+ efl_del(sd->bg);
+ sd->bg = bg;
+ if (!sd->bg)
+ return;
+
+ efl_canvas_group_member_add(pd->obj, sd->bg);
+ evas_object_stack_below(sd->bg, sd->resize_obj);
+ _smart_reconfigure(sd);
+}
+
+EOLIAN static Efl_Canvas_Object *
+_efl_ui_widget_part_bg_bg_get(Eo *obj, void *_pd EINA_UNUSED)
+{
+ Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
+ Elm_Widget_Smart_Data *sd = efl_data_scope_get(pd->obj, MY_CLASS);
+ Evas_Object *bg_obj = sd->bg;
+
+ if (!bg_obj)
+ {
+ bg_obj = efl_add(EFL_UI_BG_CLASS, pd->obj);
+ efl_ui_widget_part_bg_set(obj, bg_obj);
+ }
+
+ return bg_obj;
+}
+
+EOLIAN static Eina_Bool
+_efl_ui_widget_part_bg_efl_file_file_set(Eo *obj, void *pd EINA_UNUSED, const char *file, const char *key)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ return efl_file_set(bg_obj, file, key);
+}
+
+EOLIAN static void
+_efl_ui_widget_part_bg_efl_file_file_get(Eo *obj, void *pd EINA_UNUSED, const char **file, const char **key)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ efl_file_get(bg_obj, file, key);
+}
+
+EOLIAN static void
+_efl_ui_widget_part_bg_efl_gfx_color_set(Eo *obj, void *pd EINA_UNUSED, int r, int g, int b, int a)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ efl_gfx_color_set(bg_obj, r, g, b, a);
+}
+
+EOLIAN static void
+_efl_ui_widget_part_bg_efl_gfx_color_get(Eo *obj, void *pd EINA_UNUSED, int *r, int *g, int *b, int *a)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ efl_gfx_color_get(bg_obj, r, g, b, a);
+}
+
+EOLIAN static void
+_efl_ui_widget_part_bg_efl_ui_image_scale_type_set(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Image_Scale_Type scale_type)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ efl_ui_image_scale_type_set(bg_obj, scale_type);
+}
+
+EOLIAN static Efl_Ui_Image_Scale_Type
+_efl_ui_widget_part_bg_efl_ui_image_scale_type_get(Eo *obj, void *pd EINA_UNUSED)
+{
+ Evas_Object *bg_obj = efl_ui_widget_part_bg_get(obj);
+
+ return efl_ui_image_scale_type_get(bg_obj);
+}
+
+#include "efl_ui_widget_part_bg.eo.c"
+
+/* Efl.Part Bg end */
+
/* Internal EO APIs and hidden overrides */
diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h
index c8ae55b6f8..b37fed5337 100644
--- a/src/lib/elementary/elm_widget.h
+++ b/src/lib/elementary/elm_widget.h
@@ -387,6 +387,7 @@ typedef struct _Elm_Widget_Smart_Data
Eina_List *subobjs; /**< list of widgets' sub objects in the elementary tree */
Evas_Object *resize_obj; /**< an unique object for each widget that shows the look of a widget. Resize object's geometry is same as the widget. This resize object is different from that of window's resize object. */
Evas_Object *hover_obj;
+ Evas_Object *bg;
Eina_List *tooltips, *cursors;
Evas_Object *focus_previous, *focus_next;
Evas_Object *focus_up, *focus_down, *focus_right, *focus_left;