From 403c014bd25e399b4d4fa6c17f9a2f1583250070 Mon Sep 17 00:00:00 2001 From: YeongJong Lee Date: Mon, 26 Feb 2018 21:22:08 +0900 Subject: efl.ui.progressbar: change signal name for icon/text Summary: see also 73f8b3b78f0ff92ddfc1c16426bf7c176f10293a Test Plan: 1. elementary_test -to progressbar and elementary_test -to efl.ui.progressbar 2. check that icon and text are visible Reviewers: cedric, woohyun, Jaehyun_Cho Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5818 --- src/Makefile_Elementary.am | 1 + src/bin/elementary/test_ui_progressbar.c | 7 ++ src/lib/elementary/efl_ui_progressbar.c | 119 ++++++++++++++------- src/lib/elementary/efl_ui_progressbar.eo | 2 - src/lib/elementary/efl_ui_progressbar_legacy.eo | 3 + .../elementary/efl_ui_progressbar_legacy_part.eo | 8 ++ 6 files changed, 98 insertions(+), 42 deletions(-) create mode 100644 src/lib/elementary/efl_ui_progressbar_legacy_part.eo (limited to 'src') diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 27cab7b3ae..a2e82a5f71 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -109,6 +109,7 @@ elm_public_eolian_files += \ lib/elementary/efl_ui_button_legacy_part.eo \ lib/elementary/efl_ui_radio_legacy_part.eo \ lib/elementary/efl_ui_check_legacy_part.eo \ + lib/elementary/efl_ui_progressbar_legacy_part.eo \ lib/elementary/elm_spinner.eo \ lib/elementary/elm_multibuttonentry_item.eo \ lib/elementary/elm_interface_scrollable.eo \ diff --git a/src/bin/elementary/test_ui_progressbar.c b/src/bin/elementary/test_ui_progressbar.c index e1391421b1..0af6c6aaad 100644 --- a/src/bin/elementary/test_ui_progressbar.c +++ b/src/bin/elementary/test_ui_progressbar.c @@ -113,6 +113,7 @@ test_ui_progressbar(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_inf { Eo *win, *bx, *btbx; pbdata *pd; + char buf[PATH_MAX]; pd = (pbdata *)calloc(1, sizeof(pbdata)); @@ -135,6 +136,12 @@ test_ui_progressbar(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_inf efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(250, 20)) ); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + efl_add(EFL_UI_IMAGE_CLASS, pd->pb1, + efl_file_set(efl_added, buf, NULL), + efl_content_set(pd->pb1, efl_added) + ); + pd->pb2 = efl_add(EFL_UI_PROGRESSBAR_CLASS, bx, efl_pack(bx, efl_added), efl_text_set(efl_added, "10-100"), diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c index 40a6a66a1b..64c0f22643 100644 --- a/src/lib/elementary/efl_ui_progressbar.c +++ b/src/lib/elementary/efl_ui_progressbar.c @@ -169,41 +169,6 @@ _efl_ui_progressbar_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Progressbar_Data *_pd evas_object_size_hint_max_set(obj, -1, -1); } -/* FIXME: replicated from elm_layout just because progressbar's icon - * spot is elm.swallow.content, not elm.swallow.icon. Fix that - * whenever we can changed the theme API */ -static void -_icon_signal_emit(Evas_Object *obj) -{ - char buf[64]; - - if (!elm_widget_resize_object_get(obj)) return; - snprintf(buf, sizeof(buf), "elm,state,icon,%s", - elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); - - elm_layout_signal_emit(obj, buf, "elm"); -} - -EOLIAN static Eina_Bool -_efl_ui_progressbar_efl_ui_widget_widget_sub_object_del(Eo *obj, Efl_Ui_Progressbar_Data *pd EINA_UNUSED, Evas_Object *sobj) -{ - if (!efl_ui_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj)) - return EINA_FALSE; - - _icon_signal_emit(obj); - return EINA_TRUE; -} - -static Eina_Bool -_efl_ui_progressbar_efl_ui_widget_widget_sub_object_add(Eo *obj, Efl_Ui_Progressbar_Data *pd EINA_UNUSED, Evas_Object *sobj) -{ - if (!efl_ui_widget_sub_object_add(efl_super(obj, MY_CLASS), sobj)) - return EINA_FALSE; - - _icon_signal_emit(obj); - return EINA_TRUE; -} - //TODO: efl_ui_slider also use this. static const char * _theme_group_modify_pos_get(const char *cur_group, const char *search, size_t len, Eina_Bool is_legacy) @@ -307,11 +272,6 @@ _efl_ui_progressbar_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data * _units_set(obj); _val_set(obj); - /* FIXME: replicated from elm_layout just because progressbar's - * icon spot is elm.swallow.content, not elm.swallow.icon. Fix that - * whenever we can changed the theme API */ - _icon_signal_emit(obj); - edje_object_message_signal_process(wd->resize_obj); elm_layout_sizing_eval(obj); @@ -745,6 +705,7 @@ ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(efl_ui_progressbar) #include "efl_ui_progressbar.eo.c" #include "efl_ui_progressbar_legacy.eo.h" +#include "efl_ui_progressbar_legacy_part.eo.h" #define MY_CLASS_NAME_LEGACY "elm_progressbar" @@ -762,6 +723,84 @@ _efl_ui_progressbar_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) return obj; } +/* FIXME: replicated from elm_layout just because progressbar's icon spot + * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we + * can changed the theme API */ +static void +_icon_signal_emit(Evas_Object *obj) +{ + char buf[64]; + + if (!elm_widget_resize_object_get(obj)) return; + snprintf(buf, sizeof(buf), "elm,state,icon,%s", + elm_layout_content_get(obj, "icon") ? "visible" : "hidden"); + + elm_layout_signal_emit(obj, buf, "elm"); + edje_object_message_signal_process(elm_layout_edje_get(obj)); + elm_layout_sizing_eval(obj); +} + +/* FIXME: replicated from elm_layout just because progressbar's icon spot + * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we + * can changed the theme API */ +EOLIAN static Efl_Ui_Theme_Apply +_efl_ui_progressbar_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED) +{ + Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED; + + int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS)); + if (!int_ret) return EFL_UI_THEME_APPLY_FAILED; + _icon_signal_emit(obj); + + return int_ret; +} + +/* FIXME: replicated from elm_layout just because progressbar's icon spot + * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we + * can changed the theme API */ +EOLIAN static Eina_Bool +_efl_ui_progressbar_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *sobj) +{ + Eina_Bool int_ret = EINA_FALSE; + + int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), sobj); + if (!int_ret) return EINA_FALSE; + + _icon_signal_emit(obj); + + return EINA_TRUE; +} + +/* FIXME: replicated from elm_layout just because progressbar's icon spot + * is elm.swallow.content, not elm.swallow.icon. Fix that whenever we + * can changed the theme API */ +static Eina_Bool +_efl_ui_progressbar_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *part, Evas_Object *content) +{ + Eina_Bool int_ret = EINA_FALSE; + + int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_PROGRESSBAR_LEGACY_CLASS), part), content); + if (!int_ret) return EINA_FALSE; + + _icon_signal_emit(obj); + + return EINA_TRUE; +} + +/* Efl.Part for legacy begin */ + +static Eina_Bool +_part_is_efl_ui_progressbar_legacy_part(const Eo *obj EINA_UNUSED, const char *part) +{ + return eina_streq(part, "elm.swallow.content"); +} + +ELM_PART_OVERRIDE_PARTIAL(efl_ui_progressbar_legacy, EFL_UI_PROGRESSBAR_LEGACY, void, _part_is_efl_ui_progressbar_legacy_part) +ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_progressbar_legacy, EFL_UI_PROGRESSBAR_LEGACY, void) +#include "efl_ui_progressbar_legacy_part.eo.c" + +/* Efl.Part for legacy end */ + EAPI Evas_Object * elm_progressbar_add(Evas_Object *parent) { diff --git a/src/lib/elementary/efl_ui_progressbar.eo b/src/lib/elementary/efl_ui_progressbar.eo index c8c16f1d31..4187d9c55b 100644 --- a/src/lib/elementary/efl_ui_progressbar.eo +++ b/src/lib/elementary/efl_ui_progressbar.eo @@ -51,8 +51,6 @@ class Efl.Ui.Progressbar (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Format, implements { Efl.Object.constructor; Efl.Ui.Widget.theme_apply; - Efl.Ui.Widget.widget_sub_object_add; - Efl.Ui.Widget.widget_sub_object_del; Efl.Ui.Range.range_value { get; set; } Efl.Ui.Range.range_min_max {get; set; } Efl.Ui.Direction.direction { get; set; } diff --git a/src/lib/elementary/efl_ui_progressbar_legacy.eo b/src/lib/elementary/efl_ui_progressbar_legacy.eo index b6bf882c24..fab761f3bb 100644 --- a/src/lib/elementary/efl_ui_progressbar_legacy.eo +++ b/src/lib/elementary/efl_ui_progressbar_legacy.eo @@ -5,5 +5,8 @@ class Efl.Ui.Progressbar_Legacy (Efl.Ui.Progressbar, Efl.Ui.Legacy) implements { class.constructor; Efl.Object.constructor; + Efl.Ui.Widget.theme_apply; + Efl.Ui.Widget.widget_sub_object_del; + Efl.Part.part; } } diff --git a/src/lib/elementary/efl_ui_progressbar_legacy_part.eo b/src/lib/elementary/efl_ui_progressbar_legacy_part.eo new file mode 100644 index 0000000000..18a713d851 --- /dev/null +++ b/src/lib/elementary/efl_ui_progressbar_legacy_part.eo @@ -0,0 +1,8 @@ +class Efl.Ui.Progressbar_Legacy.Part (Efl.Ui.Layout.Part_Content) +{ + [[Elementary progressbar internal part class]] + data: null; + implements { + Efl.Content.content { set; } + } +} -- cgit v1.2.1