aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJinYong Park <j4939.park@samsung.com>2017-10-24 20:13:04 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-28 17:15:42 +0900
commit2b2bc50e8bd35a358c113a67ae31ced85b0c8e7c (patch)
tree14c678e99e71f4bffc7f265f7f58549bced78a27 /src
parenttest_popup: Fix Efl Ui Popup Anchor test title (diff)
downloadefl-2b2bc50e8bd35a358c113a67ae31ced85b0c8e7c.tar.gz
efl_ui_popup: replace title_set to efl_text_set with efl_part
Summary: Replace Efl.Ui.Popup.Alert's title set method to using efl_text_set with efl_part Test Plan: elementary_test -to efluipopupalert Reviewers: jpeg, Jaehyun_Cho, woohyun, herb Reviewed By: Jaehyun_Cho Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5359
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/bin/elementary/test_popup.c6
-rw-r--r--src/lib/elementary/efl_ui_popup_alert.c77
-rw-r--r--src/lib/elementary/efl_ui_popup_alert.eo12
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_part.eo10
5 files changed, 76 insertions, 30 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index f62e9f2d9d..b6602554c2 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -35,6 +35,7 @@ elm_public_eolian_files = \
lib/elementary/efl_ui_text.eo \
lib/elementary/efl_ui_popup.eo \
lib/elementary/efl_ui_popup_alert.eo \
+ lib/elementary/efl_ui_popup_alert_part.eo \
lib/elementary/efl_ui_popup_alert_scroll.eo \
lib/elementary/efl_ui_popup_alert_scroll_part.eo \
lib/elementary/efl_ui_popup_alert_text.eo \
diff --git a/src/bin/elementary/test_popup.c b/src/bin/elementary/test_popup.c
index 1f85961f8a..4975a0f6f1 100644
--- a/src/bin/elementary/test_popup.c
+++ b/src/bin/elementary/test_popup.c
@@ -1136,7 +1136,7 @@ test_efl_ui_popup_alert(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_CLASS, win);
- efl_ui_popup_alert_title_set(efl_ui_popup, "title");
+ efl_text_set(efl_part(efl_ui_popup, "title"), "title");
evas_object_resize(efl_ui_popup, 160, 160);
evas_object_show(efl_ui_popup);
@@ -1168,7 +1168,7 @@ test_efl_ui_popup_alert_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_SCROLL_CLASS, win);
- efl_ui_popup_alert_title_set(efl_ui_popup, "title");
+ efl_text_set(efl_part(efl_ui_popup, "title"), "title");
evas_object_resize(efl_ui_popup, 160, 160);
evas_object_show(efl_ui_popup);
@@ -1203,7 +1203,7 @@ test_efl_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
- efl_ui_popup_alert_title_set(efl_ui_popup, "title");
+ efl_text_set(efl_part(efl_ui_popup, "title"), "title");
evas_object_resize(efl_ui_popup, 160, 160);
evas_object_show(efl_ui_popup);
diff --git a/src/lib/elementary/efl_ui_popup_alert.c b/src/lib/elementary/efl_ui_popup_alert.c
index 6c7a9a57a1..2b38d34ba3 100644
--- a/src/lib/elementary/efl_ui_popup_alert.c
+++ b/src/lib/elementary/efl_ui_popup_alert.c
@@ -6,6 +6,8 @@
#include "elm_priv.h"
#include "efl_ui_popup_alert_private.h"
+#include "efl_ui_popup_alert_part.eo.h"
+#include "elm_part_helper.h"
#define MY_CLASS EFL_UI_POPUP_ALERT_CLASS
#define MY_CLASS_NAME "Efl.Ui.Popup.Alert"
@@ -27,30 +29,61 @@ _efl_ui_popup_alert_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Data *pd
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
}
-EOLIAN static void
-_efl_ui_popup_alert_title_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd, const char *text)
+static Eina_Bool
+_efl_ui_popup_alert_text_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd, const char *part, const char *label)
{
- if (pd->title_text)
+ if (part && !strcmp(part, "title"))
{
- eina_stringshare_del(pd->title_text);
- pd->title_text = NULL;
+ if (pd->title_text)
+ {
+ eina_stringshare_del(pd->title_text);
+ pd->title_text = NULL;
+ }
+
+ pd->title_text = eina_stringshare_add(label);
+ elm_object_part_text_set(obj, "elm.text.title", label);
+ elm_layout_signal_emit(obj, "elm,title,show", "elm");
+
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
+ edje_object_message_signal_process(wd->resize_obj);
+ elm_layout_sizing_eval(obj);
}
+ else
+ efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label);
- pd->title_text = eina_stringshare_add(text);
- elm_object_part_text_set(obj, "elm.text.title", text);
- elm_layout_signal_emit(obj, "elm,title,show", "elm");
+ return EINA_TRUE;
+}
- ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
- edje_object_message_signal_process(wd->resize_obj);
- elm_layout_sizing_eval(obj);
+const char *
+_efl_ui_popup_alert_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Data *pd, const char *part)
+{
+ if (part && !strcmp(part, "title"))
+ {
+ if (pd->title_text)
+ return pd->title_text;
+
+ return NULL;
+ }
+
+ return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
}
-EOLIAN static const char *
-_efl_ui_popup_alert_title_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Data *pd)
+static Eina_Bool
+_efl_ui_popup_alert_content_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd EINA_UNUSED, const char *part, Evas_Object *content)
{
- if (pd->title_text)
- return pd->title_text;
- return NULL;
+ return efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
+}
+
+Evas_Object *
+_efl_ui_popup_alert_content_get(Eo *obj, Efl_Ui_Popup_Alert_Data *pd EINA_UNUSED, const char *part)
+{
+ return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part));
+}
+
+static Evas_Object *
+_efl_ui_popup_alert_content_unset(Eo *obj, Efl_Ui_Popup_Alert_Data *pd EINA_UNUSED, const char *part)
+{
+ return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part));
}
static void
@@ -211,6 +244,18 @@ _efl_ui_popup_alert_class_constructor(Efl_Class *klass)
evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
}
+/* Efl.Part begin */
+
+ELM_PART_OVERRIDE(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
+ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
+ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
+ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
+ELM_PART_OVERRIDE_TEXT_SET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
+ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_Alert_Data)
+#include "efl_ui_popup_alert_part.eo.c"
+
+/* Efl.Part end */
+
#define EFL_UI_POPUP_ALERT_EXTRA_OPS \
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_popup_alert), \
ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert)
diff --git a/src/lib/elementary/efl_ui_popup_alert.eo b/src/lib/elementary/efl_ui_popup_alert.eo
index 8ac37993a7..27c9cc3828 100644
--- a/src/lib/elementary/efl_ui_popup_alert.eo
+++ b/src/lib/elementary/efl_ui_popup_alert.eo
@@ -8,17 +8,6 @@ enum Efl.Ui.Popup.Alert.Button {
class Efl.Ui.Popup.Alert(Efl.Ui.Popup)
{
methods {
- @property title {
- set {
- [[Set the title of popup.]]
- }
- get {
- [[Get the title of popup.]]
- }
- values {
- text: string;
- }
- }
@property button {
set {
[[Set popup buttons.]]
@@ -33,6 +22,7 @@ class Efl.Ui.Popup.Alert(Efl.Ui.Popup)
}
implements {
class.constructor;
+ Efl.Part.part;
}
events {
clicked;
diff --git a/src/lib/elementary/efl_ui_popup_alert_part.eo b/src/lib/elementary/efl_ui_popup_alert_part.eo
new file mode 100644
index 0000000000..3fc255d602
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_part.eo
@@ -0,0 +1,10 @@
+class Efl.Ui.Popup.Alert.Part (Efl.Ui.Layout.Part_Content, Efl.Ui.Layout.Part_Text)
+{
+ [[Efl UI Popup Alert internal part class]]
+ data: null;
+ implements {
+ Efl.Container.content { get; set; }
+ Efl.Container.content_unset;
+ Efl.Text.text { get; set; }
+ }
+}