aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-24 19:52:54 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-24 19:52:54 +0900
commitfebe5995495cbf427a0cad57d150d6016500c6bf (patch)
treeab5d81a0a76b7353158b05c2b238630559ba3928
parentEfl.Ui.Popup: add resize callback to update align (diff)
downloadefl-devs/jaehyun/efl_popup_test2.tar.gz
-rw-r--r--src/bin/elementary/test_ui_popup.c4
-rw-r--r--src/lib/elementary/efl_ui_popup.c3
-rw-r--r--src/lib/elementary/efl_ui_popup_alert.c17
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_scroll.c17
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text.c189
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text.eo1
-rw-r--r--src/lib/elementary/efl_ui_popup_alert_text_private.h4
7 files changed, 158 insertions, 77 deletions
diff --git a/src/bin/elementary/test_ui_popup.c b/src/bin/elementary/test_ui_popup.c
index 04651f8cb2..99e278bac5 100644
--- a/src/bin/elementary/test_ui_popup.c
+++ b/src/bin/elementary/test_ui_popup.c
@@ -461,9 +461,11 @@ _alert_text_case3_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
efl_text_set(efl_ui_popup, "This is Text Popup");
+ printf("\nSTART!\n\n");
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");
+ printf("\nFINISH!\n\n");
efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_text_clicked_cb, NULL);
}
@@ -479,9 +481,11 @@ _alert_text_case4_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_text_set(efl_part(efl_ui_popup, "title"), "title");
efl_text_set(efl_ui_popup, "This is Text Popup");
+ printf("\nSTART!\n\n");
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");
+ printf("\nFINISH!\n\n");
efl_ui_popup_alert_text_expandable_set(efl_ui_popup, EINA_TRUE, EINA_FALSE);
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index e2b0f9d330..9166d2d880 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -239,7 +239,7 @@ _efl_ui_popup_efl_object_destructor(Eo *obj, Efl_Ui_Popup_Data *pd)
}
EOLIAN static void
-_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
+_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
Evas_Coord minw = -1, minh = -1;
@@ -254,6 +254,7 @@ _efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
Eina_Size2D new_size;
new_size.w = (minw > size.w ? minw : size.w);
new_size.h = (minh > size.h ? minh : size.h);
+
efl_gfx_size_set(obj, new_size);
_calc_align(obj);
diff --git a/src/lib/elementary/efl_ui_popup_alert.c b/src/lib/elementary/efl_ui_popup_alert.c
index 13e708f50b..da1e8cc65b 100644
--- a/src/lib/elementary/efl_ui_popup_alert.c
+++ b/src/lib/elementary/efl_ui_popup_alert.c
@@ -12,20 +12,6 @@
#define MY_CLASS EFL_UI_POPUP_ALERT_CLASS
#define MY_CLASS_NAME "Efl.Ui.Popup.Alert"
-EOLIAN static void
-_efl_ui_popup_alert_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Data *pd EINA_UNUSED)
-{
- 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);
- efl_gfx_size_hint_min_set(obj, EINA_SIZE2D(minw, minh));
-}
-
static Eina_Bool
_efl_ui_popup_alert_text_set(Eo *obj, Efl_Ui_Popup_Alert_Data *pd, const char *part, const char *label)
{
@@ -264,7 +250,4 @@ ELM_PART_OVERRIDE_TEXT_GET(efl_ui_popup_alert, EFL_UI_POPUP_ALERT, Efl_Ui_Popup_
/* Efl.Part end */
-#define EFL_UI_POPUP_ALERT_EXTRA_OPS \
- ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_popup_alert)
-
#include "efl_ui_popup_alert.eo.c"
diff --git a/src/lib/elementary/efl_ui_popup_alert_scroll.c b/src/lib/elementary/efl_ui_popup_alert_scroll.c
index ac57b3d6b4..ab06d654ab 100644
--- a/src/lib/elementary/efl_ui_popup_alert_scroll.c
+++ b/src/lib/elementary/efl_ui_popup_alert_scroll.c
@@ -17,8 +17,6 @@ _scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, Eina_Size2D m
{
Eina_Rect geom = efl_gfx_geometry_get(obj);
- pd->is_sizing_eval = EINA_TRUE;
-
if (pd->is_expandable_w && !pd->is_expandable_h)
{
if ((pd->max_scroll.w > -1) && (min.w > pd->max_scroll.w))
@@ -47,21 +45,26 @@ _scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Scroll_Data *pd, Eina_Size2D m
if (wdir && !hdir)
{
elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
- efl_gfx_size_set(obj, EINA_SIZE2D(pd->max_scroll.w, geom.h));
+ efl_gfx_size_set(obj, EINA_SIZE2D(pd->max_scroll.w, min.h));
}
else if (!wdir && hdir)
{
elm_scroller_content_min_limit(pd->scroller, EINA_TRUE, EINA_FALSE);
- efl_gfx_size_set(obj, EINA_SIZE2D(geom.w, pd->max_scroll.h));
+ efl_gfx_size_set(obj, EINA_SIZE2D(min.w, pd->max_scroll.h));
}
else if(wdir && hdir)
{
elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
efl_gfx_size_set(obj, pd->max_scroll);
}
+ else
+ {
+ Eina_Size2D new_size;
+ new_size.w = min.w > geom.w ? min.w : geom.w;
+ new_size.h = min.h > geom.h ? min.h : geom.h;
+ efl_gfx_size_set(obj, new_size);
+ }
}
-
- pd->is_sizing_eval = EINA_FALSE;
}
EOLIAN static void
@@ -69,8 +72,6 @@ _efl_ui_popup_alert_scroll_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Sc
{
if (pd->is_sizing_eval) return;
- elm_layout_sizing_eval(efl_super(obj, MY_CLASS));
-
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
Evas_Coord minw = -1, minh = -1;
diff --git a/src/lib/elementary/efl_ui_popup_alert_text.c b/src/lib/elementary/efl_ui_popup_alert_text.c
index 74e77833a6..232cb7fe82 100644
--- a/src/lib/elementary/efl_ui_popup_alert_text.c
+++ b/src/lib/elementary/efl_ui_popup_alert_text.c
@@ -15,15 +15,13 @@
static void
_scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Size2D min)
{
- pd->is_sizing_eval = EINA_TRUE;
-
Eina_Rect geom = efl_gfx_geometry_get(obj);
int cur_minw, cur_max_scroll_w;
- if (min.w > pd->max_minw)
+ if (min.w > pd->message_minw)
cur_minw = min.w;
else
- cur_minw = pd->max_minw;
+ cur_minw = pd->message_minw;
if (min.w > pd->max_scroll_w)
cur_max_scroll_w = min.w;
@@ -32,66 +30,159 @@ _scroller_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Size2D min
if (pd->is_expandable_w && !pd->is_expandable_h)
{
- if ((pd->max_scroll_w > -1) && (cur_minw >= cur_max_scroll_w))
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(cur_max_scroll_w, geom.h));
+ if (pd->max_scroll_w > -1)
+ {
+ if (cur_minw > cur_max_scroll_w)
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_max_scroll_w, geom.h));
+ }
+ else
+ {
+ pd->is_sizing_eval = EINA_TRUE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, geom.h));
+ pd->is_sizing_eval = EINA_FALSE;
+ }
+ }
else
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(cur_minw, geom.h));
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, geom.h));
+ }
}
else if (!pd->is_expandable_w && pd->is_expandable_h)
{
- if (pd->pre_minh != -1)
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(geom.w, pd->max_scroll_h));
- else if ((pd->max_scroll_h > -1) && (min.h >= pd->max_scroll_h))
+ if (pd->max_scroll_h > -1)
{
- elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(geom.w, pd->max_scroll_h));
- pd->pre_minh = pd->max_scroll_h;
+ if (min.h > pd->max_scroll_h)
+ {
+ pd->is_sizing_eval = EINA_TRUE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(geom.w, pd->max_scroll_h));
+ pd->is_sizing_eval = EINA_FALSE;
+ }
+ else
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(geom.w, min.h));
+ }
}
else
{
- elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(geom.w, min.h));
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(geom.w, min.h));
}
}
else if (pd->is_expandable_w && pd->is_expandable_h)
{
- if ((pd->max_scroll_w > -1) && (cur_minw <= cur_max_scroll_w))
+ /*
+ Eina_Bool wdir, hdir;
+ wdir = hdir = EINA_FALSE;
+
+ ERR("[CJH] cur_max_scroll_w(%d) cur_minw(%d)", cur_max_scroll_w, cur_minw);
+ ERR("[CJH] pd->max_scroll_h(%d) min.h(%d)", pd->max_scroll_h, min.h);
+ if ((cur_max_scroll_w > -1) && (cur_minw > cur_max_scroll_w))
+ wdir = 1;
+ if ((pd->max_scroll_h > -1) && (min.h > pd->max_scroll_h))
+ hdir = 1;
+
+ if (wdir && !hdir)
{
elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(cur_minw, min.h));
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_max_scroll_w, min.h));
}
- else if ((pd->max_scroll_w > -1) && (cur_minw > cur_max_scroll_w))
+ else if (!wdir && hdir)
{
-
- if (pd->pre_minh != -1)
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(cur_max_scroll_w, pd->max_scroll_h));
- else if (min.h >= pd->max_scroll_h)
- {
- elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(cur_max_scroll_w, pd->max_scroll_h));
- pd->pre_minh = pd->max_scroll_h;
- }
- else
- {
- elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(cur_max_scroll_w, min.h));
- }
+ pd->is_sizing_eval = EINA_TRUE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, pd->max_scroll_h));
+ pd->is_sizing_eval = EINA_FALSE;
}
- else
+ else if (wdir && hdir)
{
- elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
- efl_gfx_size_set(efl_super(obj, MY_CLASS), EINA_SIZE2D(cur_minw, min.h));
+ pd->is_sizing_eval = EINA_TRUE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_max_scroll_w, pd->max_scroll_h));
+ pd->is_sizing_eval = EINA_FALSE;
}
- }
+ */
+ Eina_Bool wdir, hdir;
+ wdir = hdir = EINA_FALSE;
- pd->is_sizing_eval = EINA_FALSE;
-}
+ if (cur_minw > cur_max_scroll_w)
+ wdir = EINA_TRUE;
+ if (min.h > pd->max_scroll_h)
+ hdir = EINA_TRUE;
-static void
-_efl_ui_popup_alert_text_efl_gfx_size_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, Eina_Size2D size)
-{
- evas_object_resize(pd->message, size.w, size.h);
- efl_gfx_size_set(efl_super(obj, MY_CLASS), size);
+ if (cur_max_scroll_w <= -1)
+ {
+ // -1 !-1
+ if (pd->max_scroll_h > -1)
+ {
+ if (hdir)
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, pd->max_scroll_h));
+ }
+ else
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, min.h));
+ }
+ }
+ // -1 -1
+ else
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, min.h));
+ }
+ }
+ else if (pd->max_scroll_h <= -1)
+ {
+ // !-1 -1
+ if (wdir)
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_max_scroll_w, min.h));
+ }
+ else
+ {
+ pd->is_sizing_eval = EINA_TRUE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, min.h));
+ pd->is_sizing_eval = EINA_FALSE;
+ }
+ }
+ else if ((cur_max_scroll_w > -1) && (pd->max_scroll_h > -1))
+ {
+ // !-1 !-1
+ if (wdir && hdir)
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_max_scroll_w, pd->max_scroll_h));
+ }
+ else if (wdir && !hdir)
+ {
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_max_scroll_w, min.h));
+ }
+ else if (!wdir && hdir)
+ {
+ pd->is_sizing_eval = EINA_TRUE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_FALSE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, pd->max_scroll_h));
+ pd->is_sizing_eval = EINA_FALSE;
+ }
+ else
+ {
+ pd->is_sizing_eval = EINA_TRUE;
+ elm_scroller_content_min_limit(pd->scroller, EINA_FALSE, EINA_TRUE);
+ efl_gfx_size_set(obj, EINA_SIZE2D(cur_minw, min.h));
+ pd->is_sizing_eval = EINA_FALSE;
+ }
+ }
+ }
}
EOLIAN static void
@@ -101,10 +192,10 @@ _efl_ui_popup_alert_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Alert_Text
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);
efl_gfx_size_hint_min_set(obj, EINA_SIZE2D(minw, minh));
+ ERR("[CJH] minw(%d) minh(%d)", minw, minh);
_scroller_sizing_eval(obj, pd, EINA_SIZE2D(minw, minh));
}
@@ -140,12 +231,12 @@ _efl_ui_popup_alert_text_text_set(Eo *obj, Efl_Ui_Popup_Alert_Text_Data *pd, con
efl_content_set(efl_part(pd->scroller, "default"), pd->message);
}
- pd->max_minw = -1;
+ pd->message_minw = -1;
pd->pre_minh = -1;
elm_object_text_set(pd->message, label);
elm_label_line_wrap_set(pd->message, ELM_WRAP_NONE);
Eina_Size2D message_size = efl_gfx_size_hint_combined_min_get(pd->message);
- pd->max_minw = message_size.w;
+ pd->message_minw = message_size.w;
elm_label_line_wrap_set(pd->message, ELM_WRAP_MIXED);
elm_layout_sizing_eval(obj);
@@ -192,10 +283,10 @@ _efl_ui_popup_alert_text_expandable_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Alert_
if (pd->message)
{
pd->pre_minh = -1;
- pd->max_minw = -1;
+ pd->message_minw = -1;
elm_label_line_wrap_set(pd->message, ELM_WRAP_NONE);
Eina_Size2D message_size = efl_gfx_size_hint_combined_min_get(pd->message);
- pd->max_minw = message_size.w;
+ pd->message_minw = message_size.w;
elm_label_line_wrap_set(pd->message, ELM_WRAP_MIXED);
}
@@ -230,7 +321,7 @@ _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->max_minw = -1;
+ pd->message_minw = -1;
pd->pre_minh = -1;
pd->max_scroll_w = -1;
pd->max_scroll_h = -1;
diff --git a/src/lib/elementary/efl_ui_popup_alert_text.eo b/src/lib/elementary/efl_ui_popup_alert_text.eo
index 6cffd05bd7..b455f0ce2c 100644
--- a/src/lib/elementary/efl_ui_popup_alert_text.eo
+++ b/src/lib/elementary/efl_ui_popup_alert_text.eo
@@ -19,7 +19,6 @@ class Efl.Ui.Popup.Alert.Text(Efl.Ui.Popup.Alert, Efl.Text)
implements {
Efl.Object.constructor;
Efl.Gfx.Size.Hint.hint_max { set;}
- Efl.Gfx.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 5a8bdcb768..1a5746dd9c 100644
--- a/src/lib/elementary/efl_ui_popup_alert_text_private.h
+++ b/src/lib/elementary/efl_ui_popup_alert_text_private.h
@@ -8,10 +8,12 @@ struct _Efl_Ui_Popup_Alert_Text_Data
{
Eo *scroller;
Eo *message;
- Evas_Coord max_minw;
+ Evas_Coord message_minw;
Evas_Coord pre_minh;
Evas_Coord max_scroll_w;
Evas_Coord max_scroll_h;
+ Eina_Size2D prev_geom;
+ Eina_Size2D prev_min;
Eina_Bool is_expandable_w : 1;
Eina_Bool is_expandable_h : 1;
Eina_Bool is_sizing_eval: 1;