summaryrefslogtreecommitdiff
path: root/src/examples/elementary
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-29 13:03:37 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-20 16:02:00 +0200
commitc9177a9f8d75fc7bd2634a0adb63106492f3e94c (patch)
treec116e4c39d0f3f7d36233fdfc9b57dedc6b91441 /src/examples/elementary
parent42b293ae1f89aa3737fe7a4d81ebc3596fd2c631 (diff)
Introduce Efl.Ui.Radio_Group & Efl.Ui.Radio_Box
Radio_Group is a interface that manages that radio groups can be grouped inside a external object, the current API of radio was considered confusing in that regard. It is implemented in the Radio_Group_Internal class which is private to EFL, a instance of it can be found with get due to the class function in efl_ui_radio.eo. This architecture was taken like this, in order to have implementation and interface seperated. With those two seperated we can inherit from regular widgets, implement the interface, and composite attach the internal object to the regular widget. This makes a lot of things easier. Radio_Box is a class which is extending Efl.Ui.Box, which has an internal Radio_Group. This is extremly usefull for cases where you just want to have a list of radio buttons in your UI. The radio group is also exposed using composition to the internal object. Simular things can be done for the table. For now i did not add API to find the group of a radio button. However, this can be quickly added if requested. ref T7867 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D9058
Diffstat (limited to 'src/examples/elementary')
-rw-r--r--src/examples/elementary/efl_ui_radio_example_01.c46
-rw-r--r--src/examples/elementary/meson.build3
2 files changed, 48 insertions, 1 deletions
diff --git a/src/examples/elementary/efl_ui_radio_example_01.c b/src/examples/elementary/efl_ui_radio_example_01.c
new file mode 100644
index 0000000..b6b72e2
--- /dev/null
+++ b/src/examples/elementary/efl_ui_radio_example_01.c
@@ -0,0 +1,46 @@
1/*
2 * gcc -o efl_ui_radio_example_01 efl_ui_radio_example_01.c `pkg-config --cflags --libs elementary`
3 */
4#define EFL_BETA_API_SUPPORT 1
5
6#include <Efl_Ui.h>
7#include <Elementary.h>
8
9const char *example_strings[] = {
10 "Seoul",
11 "Karlsruhe",
12 "New York",
13 "Hong Kong",
14 "Hamburg",
15 "Berlin",
16 "Paris",
17 NULL
18};
19
20EAPI_MAIN void
21efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
22{
23 Eo *win, *box;
24
25 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
26
27 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
28 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
29 efl_text_set(efl_added, "Efl.Ui.Radio example"),
30 efl_ui_win_autodel_set(efl_added, EINA_TRUE)
31 );
32
33 box = efl_add(EFL_UI_RADIO_BOX_CLASS, win,
34 efl_content_set(win, efl_added));
35
36 for (int i = 0; example_strings[i]; ++i)
37 {
38 Eo *radio;
39
40 radio = efl_add(EFL_UI_RADIO_CLASS, box);
41 efl_text_set(radio, example_strings[i]);
42 efl_ui_radio_state_value_set(radio, i + 1);
43 efl_pack_end(box, radio);
44 }
45}
46EFL_MAIN()
diff --git a/src/examples/elementary/meson.build b/src/examples/elementary/meson.build
index 35a7eea..f29a94f 100644
--- a/src/examples/elementary/meson.build
+++ b/src/examples/elementary/meson.build
@@ -117,7 +117,8 @@ examples = [
117 'efl_canvas_layout_text', 117 'efl_canvas_layout_text',
118 'efl_ui_theme_example_01', 118 'efl_ui_theme_example_01',
119 'efl_ui_theme_example_02', 119 'efl_ui_theme_example_02',
120 'efl_ui_slideshow_example' 120 'efl_ui_slideshow_example',
121 'efl_ui_radio_example_01',
121] 122]
122 123
123foreach example : examples 124foreach example : examples