aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/bin/test_transit.c
diff options
context:
space:
mode:
authorGodly T Alias <godlytalias@yahoo.co.in>2016-02-05 08:08:16 +0100
committerCedric BAIL <cedric@osg.samsung.com>2016-02-05 08:45:19 +0100
commitcb8a5cb38c01b275df78b596398b734d502c5123 (patch)
treeb191bf1bff51a35217022358bffd3c6eeb6e176a /legacy/elementary/src/bin/test_transit.c
parenthoversel: improve key_action_move to handle disabled items (diff)
downloadefl-cb8a5cb38c01b275df78b596398b734d502c5123.tar.gz
transit: add possibility to revert an ongoing transition during play
Summary: Currently the feature available in transit to reverse play a transition is auto-reverse which will play a transition in reverse mode once a transition is complete. This feature helps the user to revert a transition at any point of time when transition is going on. New API added. @feature https://phab.enlightenment.org/T3019 Use Case: While doing pinch zoom, we will be doing zoom transit effect from one step to other, during that transit if user do the pinch in reverse direction this API can be called so that transition will be reverted easily. Signed-off-by: godly.talias <godly.talias@samsung.com> Test Plan: elementary_test Transit Resizing / Transit Zoom / Transit Bezier / Transit Custom / Transit Fade / Transit Flip Reviewers: raster, prince.dubey, shilpasingh, Hermet, seoz, cedric Subscribers: rajeshps, govi Differential Revision: https://phab.enlightenment.org/D3567 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'legacy/elementary/src/bin/test_transit.c')
-rw-r--r--legacy/elementary/src/bin/test_transit.c109
1 files changed, 97 insertions, 12 deletions
diff --git a/legacy/elementary/src/bin/test_transit.c b/legacy/elementary/src/bin/test_transit.c
index fb4e524560..bfdd2d95a3 100644
--- a/legacy/elementary/src/bin/test_transit.c
+++ b/legacy/elementary/src/bin/test_transit.c
@@ -22,6 +22,21 @@ struct _Custom_Effect
};
static void
+_transit_revert(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Elm_Transit *trans = (Elm_Transit*)data;
+ elm_transit_revert_go(trans);
+}
+
+static void
+_transit_rev_cb_del(void *data, Elm_Transit *trans EINA_UNUSED)
+{
+ Evas_Object *rev_bt = (Evas_Object*)data;
+ evas_object_smart_callback_del(rev_bt, "clicked", _transit_revert);
+ elm_object_disabled_set(rev_bt, EINA_TRUE);
+}
+
+static void
_custom_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
{
if (!effect) return;
@@ -145,13 +160,16 @@ _transit_image_animation(void *data, Evas_Object *obj, void *event_info EINA_UNU
}
static void
-_transit_resizing(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+_transit_resizing(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Elm_Transit *trans;
-
+ Evas_Object *rev_bt = (Evas_Object*)data;
+ elm_object_disabled_set(rev_bt, EINA_FALSE);
trans = elm_transit_add();
elm_transit_object_add(trans, obj);
+ elm_transit_del_cb_set(trans, _transit_rev_cb_del, rev_bt);
+ evas_object_smart_callback_add(rev_bt, "clicked", _transit_revert, trans);
elm_transit_effect_resizing_add(trans, 100, 50, 300, 150);
elm_transit_duration_set(trans, 5.0);
@@ -163,11 +181,15 @@ _transit_flip(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Elm_Transit *trans;
Evas_Object *obj2 = data;
+ Evas_Object *rev_bt = (Evas_Object*)evas_object_data_get(obj, "revert");
+ elm_object_disabled_set(rev_bt, EINA_FALSE);
trans = elm_transit_add();
elm_transit_object_add(trans, obj);
elm_transit_object_add(trans, obj2);
+ elm_transit_del_cb_set(trans, _transit_rev_cb_del, rev_bt);
+ evas_object_smart_callback_add(rev_bt, "clicked", _transit_revert, trans);
elm_transit_effect_flip_add(trans, ELM_TRANSIT_EFFECT_FLIP_AXIS_X, EINA_TRUE);
elm_transit_duration_set(trans, 5.0);
@@ -180,8 +202,12 @@ _transit_zoom(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UN
Elm_Transit *trans;
trans = elm_transit_add();
+ Evas_Object *rev_bt = (Evas_Object*)data;
+ elm_object_disabled_set(rev_bt, EINA_FALSE);
elm_transit_object_add(trans, obj);
+ elm_transit_del_cb_set(trans, _transit_rev_cb_del, rev_bt);
+ evas_object_smart_callback_add(rev_bt, "clicked", _transit_revert, trans);
elm_transit_effect_zoom_add(trans, 1.0, 3.0);
elm_transit_duration_set(trans, 5.0);
@@ -193,10 +219,15 @@ _transit_blend(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Elm_Transit *trans;
Evas_Object *obj2 = data;
+ Evas_Object *rev_bt = (Evas_Object*)evas_object_data_get(obj, "revert");
+ elm_object_disabled_set(rev_bt, EINA_FALSE);
trans = elm_transit_add();
elm_transit_object_add(trans, obj);
elm_transit_object_add(trans, obj2);
+ elm_transit_del_cb_set(trans, _transit_rev_cb_del, rev_bt);
+
+ evas_object_smart_callback_add(rev_bt, "clicked", _transit_revert, trans);
elm_transit_effect_blend_add(trans);
@@ -209,10 +240,15 @@ _transit_fade(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Elm_Transit *trans;
Evas_Object *obj2 = data;
+ Evas_Object *rev_bt = (Evas_Object*)evas_object_data_get(obj, "revert");
+ elm_object_disabled_set(rev_bt, EINA_FALSE);
trans = elm_transit_add();
elm_transit_object_add(trans, obj);
elm_transit_object_add(trans, obj2);
+ elm_transit_del_cb_set(trans, _transit_rev_cb_del, rev_bt);
+
+ evas_object_smart_callback_add(rev_bt, "clicked", _transit_revert, trans);
elm_transit_effect_fade_add(trans);
@@ -358,7 +394,7 @@ test_transit(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i
void
test_transit_resizing(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win, *bt;
+ Evas_Object *win, *bt, *rev_bt;
win = elm_win_util_standard_add("transit2", "Transit Resizing");
elm_win_autodel_set(win, EINA_TRUE);
@@ -368,7 +404,15 @@ test_transit_resizing(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
evas_object_show(bt);
evas_object_move(bt, 50, 100);
evas_object_resize(bt, 100, 50);
- evas_object_smart_callback_add(bt, "clicked", _transit_resizing, NULL);
+
+ rev_bt = elm_button_add(win);
+ elm_object_text_set(rev_bt, "Revert");
+ evas_object_resize(rev_bt, 100, 50);
+ evas_object_move(rev_bt, 50, 300);
+ evas_object_show(rev_bt);
+ elm_object_disabled_set(rev_bt, EINA_TRUE);
+
+ evas_object_smart_callback_add(bt, "clicked", _transit_resizing, rev_bt);
evas_object_resize(win, 400, 400);
evas_object_show(win);
@@ -378,7 +422,7 @@ test_transit_resizing(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
void
test_transit_flip(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win, *bt, *bt2;
+ Evas_Object *win, *bt, *bt2, *rev_bt;
win = elm_win_util_standard_add("transit3", "Transit Flip");
elm_win_autodel_set(win, EINA_TRUE);
@@ -394,7 +438,16 @@ test_transit_flip(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
evas_object_move(bt2, 50, 50);
evas_object_resize(bt2, 200, 200);
- evas_object_resize(win, 300, 300);
+ rev_bt = elm_button_add(win);
+ elm_object_text_set(rev_bt, "Revert");
+ evas_object_resize(rev_bt, 100, 50);
+ evas_object_move(rev_bt, 50, 300);
+ evas_object_show(rev_bt);
+ elm_object_disabled_set(rev_bt, EINA_TRUE);
+ evas_object_data_set(bt, "revert", rev_bt);
+ evas_object_data_set(bt2, "revert", rev_bt);
+
+ evas_object_resize(win, 400, 400);
evas_object_show(win);
evas_object_smart_callback_add(bt, "clicked", _transit_flip, bt2);
@@ -405,7 +458,7 @@ test_transit_flip(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
void
test_transit_zoom(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win, *bt;
+ Evas_Object *win, *bt, *rev_bt;
win = elm_win_util_standard_add("transit4", "Transit Zoom");
elm_win_autodel_set(win, EINA_TRUE);
@@ -416,7 +469,14 @@ test_transit_zoom(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
evas_object_move(bt, 100, 125);
evas_object_show(bt);
- evas_object_smart_callback_add(bt, "clicked", _transit_zoom, NULL);
+ rev_bt = elm_button_add(win);
+ elm_object_text_set(rev_bt, "Revert");
+ evas_object_resize(rev_bt, 100, 50);
+ evas_object_move(rev_bt, 100, 250);
+ evas_object_show(rev_bt);
+ elm_object_disabled_set(rev_bt, EINA_TRUE);
+
+ evas_object_smart_callback_add(bt, "clicked", _transit_zoom, rev_bt);
evas_object_resize(win, 300, 300);
evas_object_show(win);
@@ -426,7 +486,7 @@ test_transit_zoom(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
void
test_transit_blend(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win, *bt, *bt2, *ic;
+ Evas_Object *win, *bt, *bt2, *ic, *rev_bt;
char buf[PATH_MAX];
win = elm_win_util_standard_add("transit5", "Transit Blend");
@@ -455,7 +515,16 @@ test_transit_blend(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
evas_object_move(bt2, 25, 125);
evas_object_resize(bt2, 250, 50);
- evas_object_resize(win, 300, 300);
+ rev_bt = elm_button_add(win);
+ elm_object_text_set(rev_bt, "Revert");
+ evas_object_resize(rev_bt, 100, 50);
+ evas_object_move(rev_bt, 50, 300);
+ evas_object_show(rev_bt);
+ elm_object_disabled_set(rev_bt, EINA_TRUE);
+ evas_object_data_set(bt, "revert", rev_bt);
+ evas_object_data_set(bt2, "revert", rev_bt);
+
+ evas_object_resize(win, 300, 400);
evas_object_show(win);
evas_object_smart_callback_add(bt, "clicked", _transit_blend, bt2);
@@ -466,7 +535,7 @@ test_transit_blend(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
void
test_transit_fade(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win, *bt, *bt2, *ic;
+ Evas_Object *win, *bt, *bt2, *ic, *rev_bt;
char buf[PATH_MAX];
win = elm_win_util_standard_add("transit6","Transit Fade");
@@ -495,7 +564,16 @@ test_transit_fade(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
evas_object_move(bt2, 25, 125);
evas_object_resize(bt2, 250, 50);
- evas_object_resize(win, 300, 300);
+ rev_bt = elm_button_add(win);
+ elm_object_text_set(rev_bt, "Revert");
+ evas_object_resize(rev_bt, 100, 50);
+ evas_object_move(rev_bt, 50, 300);
+ evas_object_show(rev_bt);
+ elm_object_disabled_set(rev_bt, EINA_TRUE);
+ evas_object_data_set(bt, "revert", rev_bt);
+ evas_object_data_set(bt2, "revert", rev_bt);
+
+ evas_object_resize(win, 300, 400);
evas_object_show(win);
evas_object_smart_callback_add(bt, "clicked", _transit_fade, bt2);
@@ -559,6 +637,13 @@ test_transit_custom(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
elm_transit_repeat_times_set(trans, -1);
elm_transit_go(trans);
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Revert");
+ evas_object_resize(bt, 150, 50);
+ evas_object_move(bt, 50, 250);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(bt, "clicked", _transit_revert, trans);
+
evas_object_resize(win, 400, 400);
evas_object_show(win);
}