jaehyun pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=cf36e21e0787b63aa784907a87d19c2983061beb

commit cf36e21e0787b63aa784907a87d19c2983061beb
Author: Taehyub Kim <[email protected]>
Date:   Wed Dec 13 17:46:26 2017 +0900

    efl_ui_popup_alert_text: add expandable feature
    
    Summary: add expandable feature for text popup
    
    Test Plan:
    1. run elementary_text -to Ui.Popup.Alert.Text
    2. check the cases of the sample
    
    Reviewers: Jaehyun_Cho, jpeg, woohyun, thiepha, Blackmole, cedric
    
    Reviewed By: Jaehyun_Cho
    
    Differential Revision: https://phab.enlightenment.org/D5547
---
 src/bin/elementary/test_ui_popup.c                 | 434 ++++++++++++++++++++-
 src/lib/elementary/efl_ui_popup_alert_text.c       | 187 ++++++++-
 src/lib/elementary/efl_ui_popup_alert_text.eo      |  19 +
 .../elementary/efl_ui_popup_alert_text_private.h   |   3 +
 4 files changed, 624 insertions(+), 19 deletions(-)

diff --git a/src/bin/elementary/test_ui_popup.c 
b/src/bin/elementary/test_ui_popup.c
index 161cded8f5..04bd30828c 100644
--- a/src/bin/elementary/test_ui_popup.c
+++ b/src/bin/elementary/test_ui_popup.c
@@ -527,31 +527,441 @@ test_ui_popup_alert_scroll(void *data EINA_UNUSED, 
Evas_Object *obj EINA_UNUSED,
    efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_scroll_case5_cb, win);
 }
 
-void
-test_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 
void *event_info EINA_UNUSED)
+static void
+efl_ui_popup_alert_text_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev)
 {
-   Eo *win = efl_add(EFL_UI_WIN_CLASS, NULL,
-                     efl_text_set(efl_added, "Efl.Ui.Popup.Alert.Text"),
-                     efl_ui_win_autodel_set(efl_added, EINA_TRUE));
+   Efl_Ui_Popup_Alert_Clicked_Event *event = ev->info;
 
-   efl_gfx_size_set(win, EINA_SIZE2D(320, 320));
+   if (event->button_type == EFL_UI_POPUP_ALERT_BUTTON_POSITIVE)
+     efl_text_set(ev->object, "Text is changed");
+   else
+     efl_del(ev->object);
+}
 
+static void
+create_message(Eina_Strbuf *message_buf, const char *message, int iterate_cnt)
+{
+   int i;
+   for (i = 0; i < iterate_cnt; i++)
+      eina_strbuf_append(message_buf, message);
+}
+
+static void
+_alert_text_case1_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
    Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
 
    efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, "This is Text Popup");
 
-   efl_gfx_size_set(efl_ui_popup, EINA_SIZE2D(160, 160));
+   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_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+}
+
+static void
+_alert_text_case2_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
 
-   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");
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 50);
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
 
    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_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_clicked_cb, NULL);
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+   efl_ui_popup_alert_text_expandable_set(efl_ui_popup, EINA_SIZE2D(300, 300));
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_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_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+}
+
+static void
+_alert_text_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_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_SIZE2D(300, -1));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+}
+
+static void
+_alert_text_case5_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_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_SIZE2D(-1, 300));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+}
+
+static void
+_alert_text_case6_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 50);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(300, 300));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case7_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 50);
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(300, -1));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case8_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 50);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(-1, 300));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case9_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 50);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(10, 10));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case10_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 10);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(150, 150));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case11_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 10);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(150, -1));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case12_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 10);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(300, -1));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case13_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 20);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(-1, 150));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+static void
+_alert_text_case14_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   Eo *win = data;
+   Eo *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_TEXT_CLASS, win);
+
+   Eina_Strbuf *message_buf = eina_strbuf_new();
+   create_message(message_buf, "This is Text Popup ", 50);
+
+   efl_text_set(efl_part(efl_ui_popup, "title"), "title");
+   efl_text_set(efl_ui_popup, eina_strbuf_string_get(message_buf));
+
+   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_SIZE2D(-1, 300));
+
+   efl_ui_popup_size_set(efl_ui_popup, EINA_SIZE2D(200, 200));
+
+   efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, 
efl_ui_popup_alert_text_clicked_cb, NULL);
+
+   eina_strbuf_free(message_buf);
+}
+
+void
+test_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 
void *event_info EINA_UNUSED)
+{
+   Eo *win = efl_add(EFL_UI_WIN_CLASS, NULL,
+                     efl_text_set(efl_added, "Efl.Ui.Popup.Alert.Text"),
+                     efl_ui_win_autodel_set(efl_added, EINA_TRUE));
+
+   efl_gfx_size_set(win, EINA_SIZE2D(500, 700));
+
+   Eo *create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "1. size(200,200), text(short), expand(-1,-1)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 0));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case1_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "2. size(200,200), text(long), expand(-1,-1)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 50));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case2_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "3. size(200,200), text(short), expand(300,300)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 100));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case3_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "4. size(200,200), text(short), expand(300,-1)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 150));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case4_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "5. size(200,200), text(short), expand(-1,300)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 200));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case5_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "6. size(200,200), text(long), expand(300,300)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 250));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case6_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "7. size(200,200), text(long), expand(300,-1)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 300));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case7_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "8. size(200,200), text(long), expand(-1,300)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 350));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case8_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "9. size(200,200), text(long), expand(10, 10)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 400));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case9_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "10. size(200,200), text(long), expand(150,150)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 450));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case10_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "11. size(200,200), text(long), expand(150,-1)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 500));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case11_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "12. size(200,200), text(long), expand(300,-1)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 550));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case12_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "13. size(200,200), text(long), expand(-1,150)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 600));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case13_cb, win);
+
+   create_btn = efl_add(EFL_UI_BUTTON_CLASS, win);
+   efl_text_set(create_btn, "14. size(200,200), text(long), expand(-1,300)");
+   efl_gfx_position_set(create_btn, EINA_POSITION2D(0, 650));
+   efl_gfx_size_set(create_btn, EINA_SIZE2D(500, 50));
+   efl_event_callback_add(create_btn, EFL_UI_EVENT_CLICKED, 
_alert_text_case14_cb, win);
 }
 
 static void
diff --git a/src/lib/elementary/efl_ui_popup_alert_text.c 
b/src/lib/elementary/efl_ui_popup_alert_text.c
index afc39f4600..e74b448ab7 100644
--- a/src/lib/elementary/efl_ui_popup_alert_text.c
+++ b/src/lib/elementary/efl_ui_popup_alert_text.c
@@ -14,17 +14,161 @@
 
 //static const char PART_NAME_TEXT[] = "text";
 
+static void
+_scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Size2D 
obj_min, Eina_Size2D text_min)
+{
+   Eina_Size2D max_size;
+   max_size.w = -1;
+   max_size.h = -1;
+
+   if (pd->max_size.w != -1)
+     max_size.w = (obj_min.w > pd->max_size.w) ? obj_min.w : pd->max_size.w;
+   if (pd->max_size.h != -1)
+     max_size.h = (obj_min.h > pd->max_size.h) ? obj_min.h : pd->max_size.h;
+
+  Eina_Size2D size;
+  size.w = (obj_min.w > pd->size.w) ? obj_min.w : pd->size.w;
+  size.h = (obj_min.h > pd->size.h) ? obj_min.h : pd->size.h;
+
+  text_min.w = (obj_min.w > text_min.w) ? obj_min.w : text_min.w;
+  text_min.h = (obj_min.h > text_min.h) ? obj_min.h : text_min.h;
+
+  Eina_Size2D new_min = obj_min;
+
+  if ((max_size.w == -1) && (max_size.h == -1))
+    {
+       elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+       efl_gfx_size_set(obj, size);
+    }
+  else if ((max_size.w == -1) && (max_size.h != -1))
+    {
+       if (max_size.h < text_min.h)
+         {
+            elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, 
EINA_FALSE);
+            efl_gfx_size_set(obj, EINA_SIZE2D(size.w, max_size.h));
+         }
+       else
+         {
+            new_min.h = text_min.h;
+            elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, 
EINA_TRUE);
+            efl_gfx_size_set(obj, EINA_SIZE2D(size.w, text_min.h));
+         }
+    }
+  else if ((max_size.w != -1) && (max_size.h == -1))
+    {
+       if (max_size.w < text_min.w)
+         {
+            elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, 
EINA_FALSE);
+            efl_gfx_size_set(obj, EINA_SIZE2D(max_size.w, size.h));
+         }
+       else
+         {
+            new_min.w = text_min.w;
+            elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, 
EINA_FALSE);
+            efl_gfx_size_set(obj, EINA_SIZE2D(text_min.w, size.h));
+         }
+    }
+  else if ((max_size.w != -1) && (max_size.h != -1))
+    {
+       Eina_Size2D new_size;
+       Eina_Bool min_limit_w = EINA_FALSE;
+       Eina_Bool min_limit_h = EINA_FALSE;
+
+       if (max_size.w < text_min.w)
+         {
+            new_size.w = max_size.w;
+         }
+       else
+         {
+            min_limit_w = EINA_TRUE;
+            new_min.w = text_min.w;
+            new_size.w = text_min.w;
+         }
+
+       if (max_size.h < text_min.h)
+         {
+            new_size.h = max_size.h;
+         }
+       else
+         {
+            min_limit_h = EINA_TRUE;
+            new_min.h = text_min.h;
+            new_size.h = text_min.h;
+         }
+
+        elm_scroller_content_min_limit(pd->scroller, min_limit_w, min_limit_h);
+        efl_gfx_size_set(obj, new_size);
+    }
+
+    efl_gfx_size_hint_min_set(obj, new_min);
+}
+
 EOLIAN static void
-_efl_ui_popup_alert_text_elm_layout_sizing_eval(Eo *obj, 
Efl_Ui_Popup_Alert_Text_Data *pd EINA_UNUSED)
+_efl_ui_popup_alert_text_efl_ui_popup_popup_size_set(Eo *obj, 
Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Size2D size)
 {
-   elm_layout_sizing_eval(efl_super(obj, MY_CLASS));
+   pd->size = size;
 
+   efl_gfx_size_set(obj, size);
+
+   elm_layout_sizing_eval(obj);
+}
+
+static void
+_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd)
+{
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
-   Evas_Coord minw = -1, minh = -1;
+   Evas_Coord obj_minw = -1, obj_minh = -1;
+   Evas_Coord text_minw = -1, text_minh = -1;
+   Eina_Size2D text_min;
+
+   //Calculate popup's min size including scroller's min size
+     {
+        elm_label_line_wrap_set(pd->message, ELM_WRAP_NONE);
+        text_min = efl_gfx_size_hint_combined_min_get(pd->message);
+        elm_label_line_wrap_set(pd->message, ELM_WRAP_MIXED);
+
+        elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
+
+        elm_coords_finger_size_adjust(1, &text_minw, 1, &text_minh);
+        edje_object_size_min_restricted_calc
+           (wd->resize_obj, &text_minw, &text_minh, text_minw, text_minh);
+     }
+
+   //Calculate popup's min size except scroller's min size
+     {
+        elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+
+        elm_coords_finger_size_adjust(1, &obj_minw, 1, &obj_minh);
+        edje_object_size_min_restricted_calc
+           (wd->resize_obj, &obj_minw, &obj_minh, obj_minw, obj_minh);
+     }
+
+   text_min.h = text_minh;
+   _scroller_sizing_eval(obj, pd, EINA_SIZE2D(obj_minw, obj_minh), text_min);
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_text_elm_layout_sizing_eval(Eo *obj, 
Efl_Ui_Popup_Alert_Text_Data *pd)
+{
+   if (pd->needs_size_calc) return;
+   pd->needs_size_calc = EINA_TRUE;
+
+   evas_object_smart_changed(obj);
+}
+
+EOLIAN static void
+_efl_ui_popup_alert_text_efl_canvas_group_group_calculate(Eo *obj, 
Efl_Ui_Popup_Alert_Text_Data *pd)
+{
+   /* When elm_layout_sizing_eval() is called, just flag is set instead of size
+    * calculation.
+    * The actual size calculation is done here when the object is rendered to
+    * avoid duplicate size calculations. */
+   if (pd->needs_size_calc)
+     {
+        _sizing_eval(obj, pd);
 
-   elm_coords_finger_size_adjust(1, &minw, 1, &minh);
-   edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, minw, 
minh);
-   efl_gfx_size_hint_min_set(obj, EINA_SIZE2D(minw, minh));
+        pd->needs_size_calc = EINA_FALSE;
+     }
 }
 
 static Eina_Bool
@@ -55,7 +199,6 @@ _efl_ui_popup_alert_text_text_set(Eo *obj, 
Efl_Ui_Popup_Alert_Text_Data *pd, con
              // TODO: Change internal component to Efl.Ui.Widget
              pd->message = elm_label_add(obj);
              //elm_widget_element_update(obj, pd->message, PART_NAME_TEXT);
-             elm_label_line_wrap_set(pd->message, ELM_WRAP_MIXED);
              efl_gfx_size_hint_weight_set(pd->message, EVAS_HINT_EXPAND,
                                           EVAS_HINT_EXPAND);
              efl_content_set(efl_part(pd->scroller, "default"), pd->message);
@@ -95,6 +238,32 @@ _efl_ui_popup_alert_text_efl_text_text_get(Eo *obj, 
Efl_Ui_Popup_Alert_Text_Data
    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_Size2D max_size)
+{
+   Eina_Bool valid_max_w = EINA_FALSE;
+   Eina_Bool valid_max_h = EINA_FALSE;
+
+   if ((max_size.w == -1) || (max_size.w >= 0))
+     valid_max_w = EINA_TRUE;
+
+   if ((max_size.h == -1) || (max_size.h >= 0))
+     valid_max_h = EINA_TRUE;
+
+   if (!valid_max_w || !valid_max_h)
+     {
+        ERR("Invalid max size(%d, %d)!"
+            "The max size should be equal to or bigger than 0. "
+            "To disable expandable property, set -1 to the max size.",
+            max_size.w, max_size.h);
+        return;
+     }
+
+   pd->max_size = max_size;
+
+   elm_layout_sizing_eval(obj);
+}
+
 EOLIAN static Eo *
 _efl_ui_popup_alert_text_efl_object_constructor(Eo *obj,
                                                 Efl_Ui_Popup_Alert_Text_Data 
*pd)
@@ -116,6 +285,10 @@ _efl_ui_popup_alert_text_efl_object_constructor(Eo *obj,
    efl_content_set(efl_part(efl_super(obj, MY_CLASS), "elm.swallow.content"),
                    pd->scroller);
 
+   pd->size = EINA_SIZE2D(0, 0);
+   pd->max_size = EINA_SIZE2D(-1, -1);
+   pd->needs_size_calc = EINA_FALSE;
+
    return obj;
 }
 
diff --git a/src/lib/elementary/efl_ui_popup_alert_text.eo 
b/src/lib/elementary/efl_ui_popup_alert_text.eo
index c4d1a60f29..a11a5177f8 100644
--- a/src/lib/elementary/efl_ui_popup_alert_text.eo
+++ b/src/lib/elementary/efl_ui_popup_alert_text.eo
@@ -1,8 +1,27 @@
+import eina_types;
+
 class Efl.Ui.Popup_Alert_Text(Efl.Ui.Popup_Alert, Efl.Text)
 {
    [[EFL UI Popup Alert Text class]]
+   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 {
+            max_size: Eina.Size2D; [[A 2D max size in pixel uinits.]]
+         }
+      }
+   }
    implements {
       Efl.Object.constructor;
+      Efl.Canvas.Group.group_calculate;
+      Efl.Ui.Popup.popup_size { set;}
       Efl.Text.text { get; set; }
       Efl.Part.part;
    }
diff --git a/src/lib/elementary/efl_ui_popup_alert_text_private.h 
b/src/lib/elementary/efl_ui_popup_alert_text_private.h
index 8205630f7c..5820425189 100644
--- a/src/lib/elementary/efl_ui_popup_alert_text_private.h
+++ b/src/lib/elementary/efl_ui_popup_alert_text_private.h
@@ -8,6 +8,9 @@ struct _Efl_Ui_Popup_Alert_Text_Data
 {
    Eo *scroller;
    Eo *message;
+   Eina_Size2D size;
+   Eina_Size2D max_size;
+   Eina_Bool  needs_size_calc : 1;
 };
 
 #endif

-- 


Reply via email to