forked from enlightenment/efl
elm_test:ui.image.zoomable: Allow image click to enable/disable animation
its better to have animation start/stop on image click rather than clicking a button.
This commit is contained in:
parent
baf4cdc1c6
commit
af2de9f2c0
|
@ -733,20 +733,19 @@ test_photocam_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_btn_clicked_cb(void *data , Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_zoomable_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *zoomable = data;
|
Eina_Bool play;
|
||||||
Eina_Bool play = EINA_FALSE;
|
|
||||||
|
|
||||||
play = !efl_player_play_get(zoomable);
|
play = !efl_player_play_get(obj);
|
||||||
printf("image clicked! play = %d\n", play);
|
printf("image clicked! play = %d\n", play);
|
||||||
efl_player_play_set(zoomable, play);
|
efl_player_play_set(obj, play);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_photocam_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
test_photocam_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *bx, *lbl, *zoomable, *btn;
|
Evas_Object *win, *bx, *lbl, *zoomable;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||||
|
@ -760,7 +759,7 @@ test_photocam_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
lbl = elm_label_add(bx);
|
lbl = elm_label_add(bx);
|
||||||
elm_object_text_set(lbl, "Clicking the button will play/pause animation.");
|
elm_object_text_set(lbl, "Clicking the image will play/pause animation.");
|
||||||
elm_box_pack_end(bx, lbl);
|
elm_box_pack_end(bx, lbl);
|
||||||
evas_object_show(lbl);
|
evas_object_show(lbl);
|
||||||
|
|
||||||
|
@ -776,12 +775,7 @@ test_photocam_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
|
||||||
evas_object_size_hint_fill_set(zoomable, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_fill_set(zoomable, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_box_pack_end(bx, zoomable);
|
elm_box_pack_end(bx, zoomable);
|
||||||
evas_object_show(zoomable);
|
evas_object_show(zoomable);
|
||||||
|
evas_object_smart_callback_add(zoomable, "clicked", _zoomable_clicked_cb, NULL);
|
||||||
btn = efl_add(EFL_UI_BUTTON_CLASS, bx);
|
|
||||||
efl_text_set(btn, "start/stop");
|
|
||||||
evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, zoomable);
|
|
||||||
elm_box_pack_end(bx, btn);
|
|
||||||
evas_object_show(btn);
|
|
||||||
|
|
||||||
evas_object_resize(win, 320, 320);
|
evas_object_resize(win, 320, 320);
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
|
|
Loading…
Reference in New Issue