summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaehyub Kim <taehyub.kim@samsung.com>2017-08-31 13:20:05 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-28 17:15:42 +0900
commit3dccf133bbfa3869217578219870e65687f4092c (patch)
tree18cb12e9c6be6d2dd630a66c308dd043421205a9
parentf22d40b1e66d76dc5c1b38bcd3829d1ec5fe9948 (diff)
downloadefl-3dccf133bbfa3869217578219870e65687f4092c.tar.gz
efl_ui_popup_alert_text: add Efl.Ui.Popup.Alert.Text Class
Summary: Add initial code for Efl.Ui.Popup.Alert.Text Class. It supports setting texts on the content area. Test Plan: 1. run elementary_text -to efluipopupalerttext Reviewers: Jaehyun_Cho, jpeg, thiepha, cedric, woohyun, Blackmole Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5124
-rw-r--r--src/Makefile_Elementary.am4
-rw-r--r--src/bin/elementary/test.c2
-rw-r--r--src/bin/elementary/test_popup.c33
-rw-r--r--src/lib/elementary/Elementary.h1
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text.c182
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text.eo24
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text_part.eo10
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text_private.h15
8 files changed, 271 insertions, 0 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 5c5c607501..cbee49167e 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -37,6 +37,8 @@ elm_public_eolian_files = \
lib/elementary/efl_ui_popup_alert.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 \
+ lib/elementary/efl_ui_popup_alert_text_part.eo \
lib/elementary/efl_ui_text_editable.eo \
lib/elementary/efl_ui_text_async.eo \
lib/elementary/efl_ui_textpath.eo \
@@ -292,6 +294,7 @@ includesunstable_HEADERS = \
lib/elementary/efl_ui_popup_private.h \
lib/elementary/efl_ui_popup_alert_private.h \
lib/elementary/efl_ui_popup_alert_scroll_private.h \
+ lib/elementary/efl_ui_popup_alert_text_private.h \
lib/elementary/elm_widget_index.h \
lib/elementary/elm_widget_inwin.h \
lib/elementary/elm_widget_label.h \
@@ -704,6 +707,7 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/efl_ui_popup.c \
lib/elementary/efl_ui_popup_alert.c \
lib/elementary/efl_ui_popup_alert_scroll.c \
+ lib/elementary/efl_ui_popup_alert_text.c \
lib/elementary/efl_ui_grid.c \
lib/elementary/efl_ui_grid_static.c \
lib/elementary/efl_ui_grid_private.h \
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index f5450f2a15..f5666e52ff 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -277,6 +277,7 @@ void test_popup(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_popup(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_popup_alert(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_popup_alert_scroll(void *data, Evas_Object *obj, void *event_info);
+void test_efl_ui_popup_alert_text(void *data, Evas_Object *obj, void *event_info);
void test_dayselector(void *data, Evas_Object *obj, void *event_info);
void test_image(void *data, Evas_Object *obj, void *event_info);
void test_image_scale_type(void *data, Evas_Object *obj, void *event_info);
@@ -1048,6 +1049,7 @@ add_tests:
ADD_TEST(NULL, "Popups", "Efl UI Popup", test_efl_ui_popup);
ADD_TEST(NULL, "Popups", "Efl UI Popup Alert", test_efl_ui_popup_alert);
ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Scroll", test_efl_ui_popup_alert_scroll);
+ ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Text", test_efl_ui_popup_alert_text);
//------------------------------//
ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar);
diff --git a/src/bin/elementary/test_popup.c b/src/bin/elementary/test_popup.c
index 299644f17d..afc29a5858 100644
--- a/src/bin/elementary/test_popup.c
+++ b/src/bin/elementary/test_popup.c
@@ -1172,3 +1172,36 @@ test_efl_ui_popup_alert_scroll(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
}
+
+void
+test_efl_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win;
+
+ win = elm_win_util_standard_add("Efl UI Popup Alert Text", "Efl UI Popup Alert Text");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+
+ Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+ efl_ui_popup_alert_title_set(efl_ui_popup, "title");
+
+ evas_object_resize(efl_ui_popup, 160, 160);
+ evas_object_show(efl_ui_popup);
+
+ efl_text_set(efl_ui_popup,
+ "This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup"
+ "This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup"
+ "This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup This is Text Popup");
+
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
+
+ efl_ui_popup_alert_text_expandable_set(efl_ui_popup, EINA_TRUE);
+ efl_gfx_size_hint_max_set(efl_ui_popup, EINA_SIZE2D(100, 180));
+
+ efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
+}
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 016cc86bc8..6ea73c2de1 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -304,6 +304,7 @@ EAPI extern Elm_Version *elm_version;
# include <efl_ui_popup.eo.h>
# include <efl_ui_popup_alert.eo.h>
# include <efl_ui_popup_alert_scroll.eo.h>
+# include <efl_ui_popup_alert_text.eo.h>
# include <efl_ui_text_editable.eo.h>
# include <efl_ui_text_async.eo.h>
# include <efl_ui_clock.eo.h>
diff --git a/src/lib/elementary/efl_ui_popup_alert_text.c b/src/lib/elementary/efl_ui_popup_alert_text.c
new file mode 100644
index 0000000000..808aa7a8cb
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_text.c
@@ -0,0 +1,182 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <Elementary.h>
+
+#include "elm_priv.h"
+#include "efl_ui_popup_alert_text_private.h"
+#include "efl_ui_popup_alert_text_part.eo.h"
+#include "elm_part_helper.h"
+
+#define MY_CLASS EFL_UI_POPUP_ALERT_TEXT_CLASS
+#define MY_CLASS_NAME "Efl.Ui.Popup.Alert.Text"
+
+static void
+_scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, Evas_Coord minh)
+{
+ Evas_Coord w, h;
+ evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+
+ if (pd->is_expandable_h)
+ {
+ if ((pd->max_scroll_h > -1) && (minh > pd->max_scroll_h))
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ evas_object_resize(obj, w, pd->max_scroll_h);
+ }
+ }
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
+{
+ elm_layout_sizing_eval(efl_super(obj, MY_CLASS));
+
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+ Evas_Coord minw = -1, minh = -1;
+
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, minw, minh);
+ evas_object_size_hint_min_set(obj, minw, minh);
+
+ _scroller_sizing_eval(obj, pd, minh);
+}
+
+static Eina_Bool
+_efl_ui_popup_alert_text_content_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd EINA_UNUSED, const char *part, Evas_Object *content)
+{
+ return efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
+}
+
+Evas_Object *
+_efl_ui_popup_alert_text_content_get(Eo *obj, Efl_Ui_Popup_Alert_Text_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_text_content_unset(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd EINA_UNUSED, const char *part)
+{
+ return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part));
+}
+
+static Eina_Bool
+_efl_ui_popup_alert_text_text_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, const char *part, const char *label)
+{
+ if (part && !strcmp(part, "elm.text"))
+ {
+ if (!pd->message)
+ {
+ pd->message = elm_label_add(obj);
+ elm_label_line_wrap_set(pd->message, ELM_WRAP_MIXED);
+ evas_object_size_hint_weight_set(pd->message, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ efl_content_set(efl_part(pd->scroller, "default"), pd->message);
+ }
+ elm_object_text_set(pd->message, label);
+ elm_layout_sizing_eval(obj);
+ }
+ else
+ efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label);
+
+ return EINA_TRUE;
+}
+
+const char *
+_efl_ui_popup_alert_text_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Text_Data *pd, const char *part)
+{
+ if (part && !strcmp(part, "elm.text"))
+ {
+ if (pd->message)
+ return elm_object_text_get(pd->message);
+
+ return NULL;
+ }
+
+ return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_text_efl_text_text_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, const char *label)
+{
+ _efl_ui_popup_alert_text_text_set(obj, pd, "elm.text", label);
+}
+
+EOLIAN static const char*
+_efl_ui_popup_alert_text_efl_text_text_get(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
+{
+ return _efl_ui_popup_alert_text_text_get(obj, pd, "elm.text");
+}
+
+static void
+_efl_ui_popup_alert_text_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Bool is_expandable_h)
+{
+ if (is_expandable_h)
+ {
+ pd->is_expandable_h = EINA_TRUE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
+ }
+ else
+ {
+ pd->is_expandable_h = EINA_FALSE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ }
+}
+
+static void
+_efl_ui_popup_alert_text_efl_gfx_size_hint_hint_max_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Size2D size)
+{
+ efl_gfx_size_hint_max_set(efl_super(obj, MY_CLASS), size);
+ pd->max_scroll_h = size.h;
+ elm_layout_sizing_eval(obj);
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
+{
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+ efl_canvas_group_add(efl_super(obj, MY_CLASS));
+ elm_widget_sub_object_parent_add(obj);
+
+ pd->scroller = elm_scroller_add(obj);
+ elm_object_style_set(pd->scroller, "popup/no_inset_shadow");
+ elm_scroller_policy_set(pd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+ efl_content_set(efl_part(efl_super(obj, MY_CLASS), "elm.swallow.content"), pd->scroller);
+
+ pd->max_scroll_h = -1;
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd EINA_UNUSED)
+{
+ efl_canvas_group_del(efl_super(obj, MY_CLASS));
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_text_class_constructor(Efl_Class *klass)
+{
+ evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
+}
+
+/* Efl.Part begin */
+
+ELM_PART_OVERRIDE(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
+ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
+ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
+ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
+ELM_PART_OVERRIDE_TEXT_SET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
+ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
+#include "efl_ui_popup_alert_text_part.eo.c"
+
+/* Efl.Part end */
+
+/* Internal EO APIs and hidden overrides */
+
+#define EFL_UI_POPUP_ALERT_TEXT_EXTRA_OPS \
+ EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_popup_alert_text), \
+ ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert_text)
+
+#include "efl_ui_popup_alert_text.eo.c"
diff --git a/src/lib/elementary/efl_ui_popup_alert_text.eo b/src/lib/elementary/efl_ui_popup_alert_text.eo
new file mode 100644
index 0000000000..5c2539f8b1
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_text.eo
@@ -0,0 +1,24 @@
+class Efl.Ui.Popup.Alert.Text(Efl.Ui.Popup.Alert, Efl.Text)
+{
+ methods {
+ @property expandable {
+ set {
+ [[Set the expandable of popup.
+
+ If the contents of the popup has min size, popup will be increased by min size to the y direction.
+ If max hint is set, it will be increased to value of max hint,
+ and then scrolling will occur.
+ ]]
+ }
+ values {
+ is_expandable: bool;
+ }
+ }
+ }
+ implements {
+ class.constructor;
+ Efl.Gfx.Size.Hint.hint_max { set;}
+ Efl.Text.text { get; set; }
+ Efl.Part.part;
+ }
+}
diff --git a/src/lib/elementary/efl_ui_popup_alert_text_part.eo b/src/lib/elementary/efl_ui_popup_alert_text_part.eo
new file mode 100644
index 0000000000..f9e5fda8a3
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_text_part.eo
@@ -0,0 +1,10 @@
+class Efl.Ui.Popup.Alert.Text.Part (Efl.Ui.Layout.Part_Content, Efl.Ui.Layout.Part_Text)
+{
+ [[Efl UI Popup Alert Text internal part class]]
+ data: null;
+ implements {
+ Efl.Container.content { get; set; }
+ Efl.Container.content_unset;
+ Efl.Text.text { get; set; }
+ }
+}
diff --git a/src/lib/elementary/efl_ui_popup_alert_text_private.h b/src/lib/elementary/efl_ui_popup_alert_text_private.h
new file mode 100644
index 0000000000..d15f1b8e2d
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_text_private.h
@@ -0,0 +1,15 @@
+#ifndef EFL_UI_POPUP_ALERT_TEXT_H
+#define EFL_UI_POPUP_ALERT_TEXT_H
+
+#include "Elementary.h"
+
+typedef struct _Efl_Ui_Popup_Alert_Text_Data Efl_Ui_Popup_Alert_Text_Data;
+struct _Efl_Ui_Popup_Alert_Text_Data
+{
+ Evas_Object *scroller;
+ Evas_Object *message;
+ Evas_Coord max_scroll_h;
+ Eina_Bool is_expandable_h;
+};
+
+#endif