summaryrefslogtreecommitdiff
path: root/src/examples/elementary/efl_ui_radio_example_01.c
blob: b6b72e2ae29eeeb6cd7a5c70aa0bf6b7f2bd32ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * gcc -o efl_ui_radio_example_01 efl_ui_radio_example_01.c `pkg-config --cflags --libs elementary`
 */
#define EFL_BETA_API_SUPPORT 1

#include <Efl_Ui.h>
#include <Elementary.h>

const char *example_strings[] = {
  "Seoul",
  "Karlsruhe",
  "New York",
  "Hong Kong",
  "Hamburg",
  "Berlin",
  "Paris",
   NULL
};

EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
   Eo *win, *box;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
                 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
                 efl_text_set(efl_added, "Efl.Ui.Radio example"),
                 efl_ui_win_autodel_set(efl_added, EINA_TRUE)
                );

   box = efl_add(EFL_UI_RADIO_BOX_CLASS, win,
                 efl_content_set(win, efl_added));

   for (int i = 0; example_strings[i]; ++i)
     {
        Eo *radio;

        radio = efl_add(EFL_UI_RADIO_CLASS, box);
        efl_text_set(radio, example_strings[i]);
        efl_ui_radio_state_value_set(radio, i + 1);
        efl_pack_end(box, radio);
     }
}
EFL_MAIN()