1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 _sel_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
10 Elm_Flipselector_Item *it;
13 printf("label of selected item is: %s\n", elm_flipselector_item_label_get(it));
17 _unsel_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
19 Elm_Flipselector_Item *it;
20 Evas_Object *fp = data;
21 it = elm_flipselector_selected_item_get(fp);
22 elm_flipselector_item_selected_set(it, EINA_FALSE);
26 _third_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
28 Elm_Flipselector_Item *it;
29 Evas_Object *fp = data;
30 it = elm_flipselector_first_item_get(fp);
31 it = elm_flipselector_item_next_get(it);
32 it = elm_flipselector_item_next_get(it);
33 elm_flipselector_item_selected_set(it, EINA_TRUE);
37 _underflow_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
39 printf("underflow!\n");
43 _overflow_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
45 printf("overflow!\n");
49 test_flipselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
53 Evas_Object *win, *bg, *bx, *fp, *bt;
54 static const char *lbl[] = {
65 win = elm_win_add(NULL, "flipselector", ELM_WIN_BASIC);
66 elm_win_title_set(win, "Flip Selector");
67 elm_win_autodel_set(win, EINA_TRUE);
70 elm_win_resize_object_add(win, bg);
71 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
74 bx = elm_box_add(win);
75 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
76 elm_win_resize_object_add(win, bx);
79 fp = elm_flipselector_add(win);
80 evas_object_size_hint_weight_set(fp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
81 evas_object_smart_callback_add(fp, "selected", _sel_cb, NULL);
82 evas_object_smart_callback_add(fp, "underflowed", _overflow_cb, NULL);
83 evas_object_smart_callback_add(fp, "overflowed", _underflow_cb, NULL);
84 for (i = 0; i < sizeof(lbl)/sizeof(char *); i++)
85 elm_flipselector_item_append(fp, lbl[i], NULL, NULL);
86 elm_box_pack_end(bx, fp);
89 fp = elm_flipselector_add(win);
90 evas_object_smart_callback_add(fp, "underflowed", _overflow_cb, NULL);
91 evas_object_smart_callback_add(fp, "overflowed", _underflow_cb, NULL);
92 evas_object_size_hint_weight_set(fp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93 for (i = 2099; i >= 1990; i--)
95 snprintf(buf, 8, "%d", i);
96 elm_flipselector_item_append(fp, buf, _sel_cb, NULL);
98 elm_box_pack_end(bx, fp);
101 bt = elm_button_add(win);
102 elm_object_text_set(bt, "Select 2097");
103 evas_object_smart_callback_add(bt, "clicked", _third_cb, fp);
104 elm_box_pack_end(bx, bt);
105 evas_object_show(bt);
107 bt = elm_button_add(win);
108 elm_object_text_set(bt, "Unselect year");
109 evas_object_smart_callback_add(bt, "clicked", _unsel_cb, fp);
110 elm_box_pack_end(bx, bt);
111 evas_object_show(bt);
113 evas_object_show(win);