Add missing files vs @64925
[framework/uifw/elementary.git] / src / bin / test_icon_animated.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6 static void
7 icon_clicked(void *data , Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
8 {
9    Evas_Object *ic;
10    ic = data;
11    Eina_Bool rec;
12    rec = elm_icon_animated_play_get(ic);
13    rec = !rec;
14    printf("clicked!rec =%d\n",rec);
15    elm_icon_animated_play_set(ic, rec);
16 }
17
18 void
19 test_icon_animated(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
20 {
21    Evas_Object *win, *ic;
22    char buf[PATH_MAX];
23
24    win = elm_win_add(NULL, "icon-animated-gif", ELM_WIN_BASIC);
25    elm_win_title_set(win, "Icon Animated Gif");
26    elm_win_autodel_set(win, EINA_TRUE);
27    elm_win_alpha_set(win, 1);
28
29    ic = elm_icon_add(win);
30    snprintf(buf, sizeof(buf), "%s/images/animated_logo.gif", elm_app_data_dir_get());
31    elm_icon_file_set(ic, buf, NULL);
32    if (elm_icon_animated_available_get(ic))
33      {
34         printf("============Support animator==============\n");
35         elm_icon_animated_set(ic, EINA_TRUE);
36         elm_icon_animated_play_set(ic, EINA_TRUE);
37      }
38    elm_icon_scale_set(ic, 0, 0);
39    elm_icon_no_scale_set(ic, 1);
40    evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
41    evas_object_size_hint_fill_set(ic, 0.5, 0.5);
42    elm_win_resize_object_add(win, ic);
43    evas_object_show(ic);
44
45    evas_object_smart_callback_add(ic, "clicked", icon_clicked, ic);
46
47    evas_object_show(win);
48 }
49 #endif