2 * Simple Elementary's <b>segment_control widget</b> example, illustrating its
5 * See stdout/stderr for output. Compile with:
8 * gcc -g segment_control_example.c -o segment_control_example `pkg-config --cflags --libs elementary`
12 #include <Elementary.h>
15 elm_main(int argc, char **argv)
17 Evas_Object *win, *sc, *ic;
18 Elm_Object_Item *seg_it;
21 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
23 win = elm_win_util_standard_add("segment_control", "Segment Control Example");
24 elm_win_autodel_set(win, EINA_TRUE);
26 sc = elm_segment_control_add(win);
27 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
28 elm_win_resize_object_add(win, sc);
31 elm_segment_control_item_add(sc, NULL, "only text");
33 ic = elm_icon_add(win);
34 elm_icon_standard_set(ic, "close");
35 elm_segment_control_item_add(sc, ic, NULL);
37 ic = elm_icon_add(win);
38 elm_icon_standard_set(ic, "home");
39 elm_segment_control_item_add(sc, ic, "Home");
41 ic = elm_icon_add(win);
42 elm_icon_standard_set(ic, "close");
43 elm_segment_control_item_add(sc, ic, "");
45 count = elm_segment_control_item_count_get(sc);
46 elm_segment_control_item_insert_at(sc, NULL, "Inserted at", count - 1);
48 seg_it = elm_segment_control_item_insert_at(sc, NULL, "To be deleted", 2);
49 elm_object_item_del(seg_it);
51 elm_segment_control_item_insert_at(sc, NULL, "To be deleted", 2);
52 elm_segment_control_item_del_at(sc, 2);
54 seg_it = elm_segment_control_item_get(sc, 0);
55 elm_object_item_text_set(seg_it, "Only Text");
57 count = elm_segment_control_item_count_get(sc);
58 seg_it = elm_segment_control_item_get(sc, count / 2);
59 elm_segment_control_item_selected_set(seg_it, EINA_TRUE);
60 seg_it = elm_segment_control_item_selected_get(sc);
61 idx = elm_segment_control_item_index_get(seg_it);
62 printf("Item selected: %i\n", idx);
64 evas_object_show(win);