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)
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 5c5c607..cbee491 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -37,6 +37,8 @@ elm_public_eolian_files = \
37 lib/elementary/efl_ui_popup_alert.eo \ 37 lib/elementary/efl_ui_popup_alert.eo \
38 lib/elementary/efl_ui_popup_alert_scroll.eo \ 38 lib/elementary/efl_ui_popup_alert_scroll.eo \
39 lib/elementary/efl_ui_popup_alert_scroll_part.eo \ 39 lib/elementary/efl_ui_popup_alert_scroll_part.eo \
40 lib/elementary/efl_ui_popup_alert_text.eo \
41 lib/elementary/efl_ui_popup_alert_text_part.eo \
40 lib/elementary/efl_ui_text_editable.eo \ 42 lib/elementary/efl_ui_text_editable.eo \
41 lib/elementary/efl_ui_text_async.eo \ 43 lib/elementary/efl_ui_text_async.eo \
42 lib/elementary/efl_ui_textpath.eo \ 44 lib/elementary/efl_ui_textpath.eo \
@@ -292,6 +294,7 @@ includesunstable_HEADERS = \
292 lib/elementary/efl_ui_popup_private.h \ 294 lib/elementary/efl_ui_popup_private.h \
293 lib/elementary/efl_ui_popup_alert_private.h \ 295 lib/elementary/efl_ui_popup_alert_private.h \
294 lib/elementary/efl_ui_popup_alert_scroll_private.h \ 296 lib/elementary/efl_ui_popup_alert_scroll_private.h \
297 lib/elementary/efl_ui_popup_alert_text_private.h \
295 lib/elementary/elm_widget_index.h \ 298 lib/elementary/elm_widget_index.h \
296 lib/elementary/elm_widget_inwin.h \ 299 lib/elementary/elm_widget_inwin.h \
297 lib/elementary/elm_widget_label.h \ 300 lib/elementary/elm_widget_label.h \
@@ -704,6 +707,7 @@ lib_elementary_libelementary_la_SOURCES = \
704 lib/elementary/efl_ui_popup.c \ 707 lib/elementary/efl_ui_popup.c \
705 lib/elementary/efl_ui_popup_alert.c \ 708 lib/elementary/efl_ui_popup_alert.c \
706 lib/elementary/efl_ui_popup_alert_scroll.c \ 709 lib/elementary/efl_ui_popup_alert_scroll.c \
710 lib/elementary/efl_ui_popup_alert_text.c \
707 lib/elementary/efl_ui_grid.c \ 711 lib/elementary/efl_ui_grid.c \
708 lib/elementary/efl_ui_grid_static.c \ 712 lib/elementary/efl_ui_grid_static.c \
709 lib/elementary/efl_ui_grid_private.h \ 713 lib/elementary/efl_ui_grid_private.h \
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index f5450f2..f5666e5 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);
277void test_efl_ui_popup(void *data, Evas_Object *obj, void *event_info); 277void test_efl_ui_popup(void *data, Evas_Object *obj, void *event_info);
278void test_efl_ui_popup_alert(void *data, Evas_Object *obj, void *event_info); 278void test_efl_ui_popup_alert(void *data, Evas_Object *obj, void *event_info);
279void test_efl_ui_popup_alert_scroll(void *data, Evas_Object *obj, void *event_info); 279void test_efl_ui_popup_alert_scroll(void *data, Evas_Object *obj, void *event_info);
280void test_efl_ui_popup_alert_text(void *data, Evas_Object *obj, void *event_info);
280void test_dayselector(void *data, Evas_Object *obj, void *event_info); 281void test_dayselector(void *data, Evas_Object *obj, void *event_info);
281void test_image(void *data, Evas_Object *obj, void *event_info); 282void test_image(void *data, Evas_Object *obj, void *event_info);
282void test_image_scale_type(void *data, Evas_Object *obj, void *event_info); 283void test_image_scale_type(void *data, Evas_Object *obj, void *event_info);
@@ -1048,6 +1049,7 @@ add_tests:
1048 ADD_TEST(NULL, "Popups", "Efl UI Popup", test_efl_ui_popup); 1049 ADD_TEST(NULL, "Popups", "Efl UI Popup", test_efl_ui_popup);
1049 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert", test_efl_ui_popup_alert); 1050 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert", test_efl_ui_popup_alert);
1050 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Scroll", test_efl_ui_popup_alert_scroll); 1051 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Scroll", test_efl_ui_popup_alert_scroll);
1052 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Text", test_efl_ui_popup_alert_text);
1051 1053
1052 //------------------------------// 1054 //------------------------------//
1053 ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar); 1055 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 299644f..afc29a5 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
1172 1172
1173 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL); 1173 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
1174} 1174}
1175
1176void
1177test_efl_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1178{
1179 Evas_Object *win;
1180
1181 win = elm_win_util_standard_add("Efl UI Popup Alert Text", "Efl UI Popup Alert Text");
1182 elm_win_autodel_set(win, EINA_TRUE);
1183
1184 evas_object_resize(win, 320, 320);
1185 evas_object_show(win);
1186
1187 Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
1188
1189 efl_ui_popup_alert_title_set(efl_ui_popup, "title");
1190
1191 evas_object_resize(efl_ui_popup, 160, 160);
1192 evas_object_show(efl_ui_popup);
1193
1194 efl_text_set(efl_ui_popup,
1195 "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"
1196 "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"
1197 "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");
1198
1199 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
1200 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
1201 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
1202
1203 efl_ui_popup_alert_text_expandable_set(efl_ui_popup, EINA_TRUE);
1204 efl_gfx_size_hint_max_set(efl_ui_popup, EINA_SIZE2D(100, 180));
1205
1206 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
1207}
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 016cc86..6ea73c2 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -304,6 +304,7 @@ EAPI extern Elm_Version *elm_version;
304# include <efl_ui_popup.eo.h> 304# include <efl_ui_popup.eo.h>
305# include <efl_ui_popup_alert.eo.h> 305# include <efl_ui_popup_alert.eo.h>
306# include <efl_ui_popup_alert_scroll.eo.h> 306# include <efl_ui_popup_alert_scroll.eo.h>
307# include <efl_ui_popup_alert_text.eo.h>
307# include <efl_ui_text_editable.eo.h> 308# include <efl_ui_text_editable.eo.h>
308# include <efl_ui_text_async.eo.h> 309# include <efl_ui_text_async.eo.h>
309# include <efl_ui_clock.eo.h> 310# 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 0000000..808aa7a
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_text.c
@@ -0,0 +1,182 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6
7#include "elm_priv.h"
8#include "efl_ui_popup_alert_text_private.h"
9#include "efl_ui_popup_alert_text_part.eo.h"
10#include "elm_part_helper.h"
11
12#define MY_CLASS EFL_UI_POPUP_ALERT_TEXT_CLASS
13#define MY_CLASS_NAME "Efl.Ui.Popup.Alert.Text"
14
15static void
16_scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, Evas_Coord minh)
17{
18 Evas_Coord w, h;
19 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
20
21 if (pd->is_expandable_h)
22 {
23 if ((pd->max_scroll_h > -1) && (minh > pd->max_scroll_h))
24 {
25 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
26 evas_object_resize(obj, w, pd->max_scroll_h);
27 }
28 }
29}
30
31EOLIAN static void
32_efl_ui_popup_alert_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
33{
34 elm_layout_sizing_eval(efl_super(obj, MY_CLASS));
35
36 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
37 Evas_Coord minw = -1, minh = -1;
38
39 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
40 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, minw, minh);
41 evas_object_size_hint_min_set(obj, minw, minh);
42
43 _scroller_sizing_eval(obj, pd, minh);
44}
45
46static Eina_Bool
47_efl_ui_popup_alert_text_content_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd EINA_UNUSED, const char *part, Evas_Object *content)
48{
49 return efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
50}
51
52Evas_Object *
53_efl_ui_popup_alert_text_content_get(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd EINA_UNUSED, const char *part)
54{
55 return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part));
56}
57
58static Evas_Object *
59_efl_ui_popup_alert_text_content_unset(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd EINA_UNUSED, const char *part)
60{
61 return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part));
62}
63
64static Eina_Bool
65_efl_ui_popup_alert_text_text_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, const char *part, const char *label)
66{
67 if (part && !strcmp(part, "elm.text"))
68 {
69 if (!pd->message)
70 {
71 pd->message = elm_label_add(obj);
72 elm_label_line_wrap_set(pd->message, ELM_WRAP_MIXED);
73 evas_object_size_hint_weight_set(pd->message, EVAS_HINT_EXPAND,
74 EVAS_HINT_EXPAND);
75 efl_content_set(efl_part(pd->scroller, "default"), pd->message);
76 }
77 elm_object_text_set(pd->message, label);
78 elm_layout_sizing_eval(obj);
79 }
80 else
81 efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), label);
82
83 return EINA_TRUE;
84}
85
86const char *
87_efl_ui_popup_alert_text_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Text_Data *pd, const char *part)
88{
89 if (part && !strcmp(part, "elm.text"))
90 {
91 if (pd->message)
92 return elm_object_text_get(pd->message);
93
94 return NULL;
95 }
96
97 return efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
98}
99
100EOLIAN static void
101_efl_ui_popup_alert_text_efl_text_text_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, const char *label)
102{
103 _efl_ui_popup_alert_text_text_set(obj, pd, "elm.text", label);
104}
105
106EOLIAN static const char*
107_efl_ui_popup_alert_text_efl_text_text_get(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
108{
109 return _efl_ui_popup_alert_text_text_get(obj, pd, "elm.text");
110}
111
112static void
113_efl_ui_popup_alert_text_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Bool is_expandable_h)
114{
115 if (is_expandable_h)
116 {
117 pd->is_expandable_h = EINA_TRUE;
118 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
119 }
120 else
121 {
122 pd->is_expandable_h = EINA_FALSE;
123 elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
124 }
125}
126
127static void
128_efl_ui_popup_alert_text_efl_gfx_size_hint_hint_max_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Size2D size)
129{
130 efl_gfx_size_hint_max_set(efl_super(obj, MY_CLASS), size);
131 pd->max_scroll_h = size.h;
132 elm_layout_sizing_eval(obj);
133}
134
135EOLIAN static void
136_efl_ui_popup_alert_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
137{
138 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
139
140 efl_canvas_group_add(efl_super(obj, MY_CLASS));
141 elm_widget_sub_object_parent_add(obj);
142
143 pd->scroller = elm_scroller_add(obj);
144 elm_object_style_set(pd->scroller, "popup/no_inset_shadow");
145 elm_scroller_policy_set(pd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
146
147 efl_content_set(efl_part(efl_super(obj, MY_CLASS), "elm.swallow.content"), pd->scroller);
148
149 pd->max_scroll_h = -1;
150}
151
152EOLIAN static void
153_efl_ui_popup_alert_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd EINA_UNUSED)
154{
155 efl_canvas_group_del(efl_super(obj, MY_CLASS));
156}
157
158EOLIAN static void
159_efl_ui_popup_alert_text_class_constructor(Efl_Class *klass)
160{
161 evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
162}
163
164/* Efl.Part begin */
165
166ELM_PART_OVERRIDE(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
167ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
168ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
169ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
170ELM_PART_OVERRIDE_TEXT_SET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
171ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert_text, EFL_UI_POPUP_ALERT_TEXT, Efl_Ui_Popup_Alert_Text_Data)
172#include "efl_ui_popup_alert_text_part.eo.c"
173
174/* Efl.Part end */
175
176/* Internal EO APIs and hidden overrides */
177
178#define EFL_UI_POPUP_ALERT_TEXT_EXTRA_OPS \
179 EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_popup_alert_text), \
180 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert_text)
181
182#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 0000000..5c2539f
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_text.eo
@@ -0,0 +1,24 @@
1class Efl.Ui.Popup.Alert.Text(Efl.Ui.Popup.Alert, Efl.Text)
2{
3 methods {
4 @property expandable {
5 set {
6 [[Set the expandable of popup.
7
8 If the contents of the popup has min size, popup will be increased by min size to the y direction.
9 If max hint is set, it will be increased to value of max hint,
10 and then scrolling will occur.
11 ]]
12 }
13 values {
14 is_expandable: bool;
15 }
16 }
17 }
18 implements {
19 class.constructor;
20 Efl.Gfx.Size.Hint.hint_max { set;}
21 Efl.Text.text { get; set; }
22 Efl.Part.part;
23 }
24}
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 0000000..f9e5fda
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_text_part.eo
@@ -0,0 +1,10 @@
1class Efl.Ui.Popup.Alert.Text.Part (Efl.Ui.Layout.Part_Content, Efl.Ui.Layout.Part_Text)
2{
3 [[Efl UI Popup Alert Text internal part class]]
4 data: null;
5 implements {
6 Efl.Container.content { get; set; }
7 Efl.Container.content_unset;
8 Efl.Text.text { get; set; }
9 }
10}
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 0000000..d15f1b8
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_alert_text_private.h
@@ -0,0 +1,15 @@
1#ifndef EFL_UI_POPUP_ALERT_TEXT_H
2#define EFL_UI_POPUP_ALERT_TEXT_H
3
4#include "Elementary.h"
5
6typedef struct _Efl_Ui_Popup_Alert_Text_Data Efl_Ui_Popup_Alert_Text_Data;
7struct _Efl_Ui_Popup_Alert_Text_Data
8{
9 Evas_Object *scroller;
10 Evas_Object *message;
11 Evas_Coord max_scroll_h;
12 Eina_Bool is_expandable_h;
13};
14
15#endif