forked from enlightenment/efl
flip: proper api: elm_flip_go_to().
In real world it's very likely you're flipping to something, back or front, not randomly flipping around based on one button. I'd say we should deprecate the elm_flip_go(). SVN revision: 74360
This commit is contained in:
parent
e6f2ea6708
commit
88abf5f63d
|
@ -340,3 +340,7 @@
|
|||
2012-07-24 Hermet (ChunEon Park)
|
||||
|
||||
* fixed scroller to not have the hold flag when mouse up happened.
|
||||
|
||||
2012-07-24 Gustavo Sverzut Barbieri (k-s)
|
||||
|
||||
* Add elm_flip_go_to()
|
||||
|
|
|
@ -18,6 +18,7 @@ Additions:
|
|||
* Use Edje to enable accessibility on TEXTBLOCK.
|
||||
* Initialize Emotion when necessary.
|
||||
* Elm_Win_Trap and elm_win_trap_set() to allow e17 integration.
|
||||
* elm_flip_go_to()
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ void test_flip(void *data, Evas_Object *obj, void *event_info);
|
|||
void test_flip2(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_flip3(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_flip4(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_flip5(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_flip_page(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_label(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_label2(void *data, Evas_Object *obj, void *event_info);
|
||||
|
@ -518,6 +519,7 @@ add_tests:
|
|||
ADD_TEST(NULL, "Effects", "Flip 2", test_flip2);
|
||||
ADD_TEST(NULL, "Effects", "Flip 3", test_flip3);
|
||||
ADD_TEST(NULL, "Effects", "Flip Interactive", test_flip4);
|
||||
ADD_TEST(NULL, "Effects", "Flip To", test_flip5);
|
||||
ADD_TEST(NULL, "Effects", "Flip Page", test_flip_page);
|
||||
ADD_TEST(NULL, "Effects", "Animation", test_anim);
|
||||
|
||||
|
|
|
@ -60,6 +60,20 @@ my_fl_8(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
|||
elm_flip_go(fl, ELM_FLIP_CUBE_DOWN);
|
||||
}
|
||||
|
||||
void
|
||||
my_fl_front(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *fl = data;
|
||||
elm_flip_go_to(fl, EINA_TRUE, ELM_FLIP_ROTATE_X_CENTER_AXIS);
|
||||
}
|
||||
|
||||
void
|
||||
my_fl_back(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *fl = data;
|
||||
elm_flip_go_to(fl, EINA_FALSE, ELM_FLIP_ROTATE_X_CENTER_AXIS);
|
||||
}
|
||||
|
||||
void
|
||||
test_flip(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
|
@ -607,4 +621,81 @@ test_flip4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
|||
evas_object_resize(win, 320, 480);
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
void
|
||||
test_flip5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Evas_Object *win, *bx, *bx2, *fl, *o, *bt, *ly;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
win = elm_win_util_standard_add("flip4", "Flip 4");
|
||||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_win_resize_object_add(win, bx);
|
||||
evas_object_show(bx);
|
||||
|
||||
fl = elm_flip_add(win);
|
||||
evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_box_pack_end(bx, fl);
|
||||
|
||||
o = elm_bg_add(win);
|
||||
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_01.jpg");
|
||||
elm_bg_file_set(o, buf, NULL);
|
||||
elm_object_part_content_set(fl, "front", o);
|
||||
evas_object_show(o);
|
||||
|
||||
ly = elm_layout_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
||||
elm_layout_file_set(ly, buf, "layout");
|
||||
evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_object_part_content_set(fl, "back", ly);
|
||||
evas_object_show(ly);
|
||||
|
||||
bt = elm_button_add(ly);
|
||||
elm_object_text_set(bt, "Button 1");
|
||||
elm_object_part_content_set(ly, "element1", bt);
|
||||
|
||||
bt = elm_button_add(ly);
|
||||
elm_object_text_set(bt, "Button 2");
|
||||
elm_object_part_content_set(ly, "element2", bt);
|
||||
|
||||
bt = elm_button_add(ly);
|
||||
elm_object_text_set(bt, "Button 3");
|
||||
elm_object_part_content_set(ly, "element3", bt);
|
||||
|
||||
evas_object_show(fl);
|
||||
|
||||
bx2 = elm_box_add(win);
|
||||
elm_box_horizontal_set(bx2, EINA_TRUE);
|
||||
evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Show Front");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_fl_front, fl);
|
||||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
|
||||
elm_box_pack_end(bx2, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_object_text_set(bt, "Show Back");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_fl_back, fl);
|
||||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
|
||||
elm_box_pack_end(bx2, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
elm_box_pack_end(bx, bx2);
|
||||
evas_object_show(bx2);
|
||||
|
||||
evas_object_resize(win, 320, 480);
|
||||
evas_object_show(win);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1949,19 +1949,19 @@ elm_flip_perspective_set(Evas_Object *obj,
|
|||
|
||||
// FIXME: add ambient and lighting control
|
||||
|
||||
EAPI void
|
||||
elm_flip_go(Evas_Object *obj,
|
||||
Elm_Flip_Mode mode)
|
||||
static void
|
||||
_elm_flip_go_to(Elm_Flip_Smart_Data *sd,
|
||||
Eina_Bool front,
|
||||
Elm_Flip_Mode mode)
|
||||
{
|
||||
ELM_FLIP_CHECK(obj);
|
||||
ELM_FLIP_DATA_GET(obj, sd);
|
||||
Evas_Object *obj = ELM_WIDGET_DATA(sd)->obj;
|
||||
|
||||
if (!sd->animator) sd->animator = ecore_animator_add(_animate, obj);
|
||||
_flip_show_hide(obj);
|
||||
|
||||
sd->mode = mode;
|
||||
sd->start = ecore_loop_time_get();
|
||||
sd->next_state = !sd->next_state;
|
||||
sd->next_state = front;
|
||||
sd->len = 0.5; // FIXME: make config val
|
||||
if ((sd->mode == ELM_FLIP_PAGE_LEFT) ||
|
||||
(sd->mode == ELM_FLIP_PAGE_RIGHT) ||
|
||||
|
@ -1982,6 +1982,29 @@ elm_flip_go(Evas_Object *obj,
|
|||
evas_object_smart_callback_call(obj, SIG_ANIMATE_BEGIN, NULL);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_flip_go_to(Evas_Object *obj,
|
||||
Eina_Bool front,
|
||||
Elm_Flip_Mode mode)
|
||||
{
|
||||
ELM_FLIP_CHECK(obj);
|
||||
ELM_FLIP_DATA_GET(obj, sd);
|
||||
|
||||
if (sd->next_state == front) return;
|
||||
|
||||
_elm_flip_go_to(sd, front, mode);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_flip_go(Evas_Object *obj,
|
||||
Elm_Flip_Mode mode)
|
||||
{
|
||||
ELM_FLIP_CHECK(obj);
|
||||
ELM_FLIP_DATA_GET(obj, sd);
|
||||
|
||||
_elm_flip_go_to(sd, !sd->state, mode);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_flip_interaction_set(Evas_Object *obj,
|
||||
Elm_Flip_Interaction mode)
|
||||
|
|
|
@ -150,10 +150,65 @@ EAPI void elm_flip_perspective_set(Evas_Object *obj, Evas_Coord
|
|||
* @image html elm_flip.png
|
||||
* @image latex elm_flip.eps width=\textwidth
|
||||
*
|
||||
* @see elm_flip_go_to()
|
||||
*
|
||||
* @ingroup Flip
|
||||
*/
|
||||
EAPI void elm_flip_go(Evas_Object *obj, Elm_Flip_Mode mode);
|
||||
|
||||
/**
|
||||
* @brief Runs the flip animation to front or back.
|
||||
*
|
||||
* @param obj The flip object
|
||||
* @param front if @c EINA_TRUE, makes front visible, otherwise makes back.
|
||||
* @param mode The mode type
|
||||
*
|
||||
* Flips the front and back contents using the @p mode animation. This
|
||||
* effectively hides the currently visible content and shows the hidden one.
|
||||
*
|
||||
* There a number of possible animations to use for the flipping:
|
||||
* @li ELM_FLIP_ROTATE_X_CENTER_AXIS - Rotate the currently visible content
|
||||
* around a horizontal axis in the middle of its height, the other content
|
||||
* is shown as the other side of the flip.
|
||||
* @li ELM_FLIP_ROTATE_Y_CENTER_AXIS - Rotate the currently visible content
|
||||
* around a vertical axis in the middle of its width, the other content is
|
||||
* shown as the other side of the flip.
|
||||
* @li ELM_FLIP_ROTATE_XZ_CENTER_AXIS - Rotate the currently visible content
|
||||
* around a diagonal axis in the middle of its width, the other content is
|
||||
* shown as the other side of the flip.
|
||||
* @li ELM_FLIP_ROTATE_YZ_CENTER_AXIS - Rotate the currently visible content
|
||||
* around a diagonal axis in the middle of its height, the other content is
|
||||
* shown as the other side of the flip.
|
||||
* @li ELM_FLIP_CUBE_LEFT - Rotate the currently visible content to the left
|
||||
* as if the flip was a cube, the other content is show as the right face of
|
||||
* the cube.
|
||||
* @li ELM_FLIP_CUBE_RIGHT - Rotate the currently visible content to the
|
||||
* right as if the flip was a cube, the other content is show as the left
|
||||
* face of the cube.
|
||||
* @li ELM_FLIP_CUBE_UP - Rotate the currently visible content up as if the
|
||||
* flip was a cube, the other content is show as the bottom face of the cube.
|
||||
* @li ELM_FLIP_CUBE_DOWN - Rotate the currently visible content down as if
|
||||
* the flip was a cube, the other content is show as the upper face of the
|
||||
* cube.
|
||||
* @li ELM_FLIP_PAGE_LEFT - Move the currently visible content to the left as
|
||||
* if the flip was a book, the other content is shown as the page below that.
|
||||
* @li ELM_FLIP_PAGE_RIGHT - Move the currently visible content to the right
|
||||
* as if the flip was a book, the other content is shown as the page below
|
||||
* that.
|
||||
* @li ELM_FLIP_PAGE_UP - Move the currently visible content up as if the
|
||||
* flip was a book, the other content is shown as the page below that.
|
||||
* @li ELM_FLIP_PAGE_DOWN - Move the currently visible content down as if the
|
||||
* flip was a book, the other content is shown as the page below that.
|
||||
*
|
||||
* @image html elm_flip.png
|
||||
* @image latex elm_flip.eps width=\textwidth
|
||||
*
|
||||
* @since 1.7
|
||||
*
|
||||
* @ingroup Flip
|
||||
*/
|
||||
EAPI void elm_flip_go_to(Evas_Object *obj, Eina_Bool front, Elm_Flip_Mode mode);
|
||||
|
||||
/**
|
||||
* @brief Set the interactive flip mode
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue