summaryrefslogtreecommitdiff
path: root/src/examples
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
parent42b293ae1f89aa3737fe7a4d81ebc3596fd2c631 (diff)
downloadefl-c9177a9f8d75fc7bd2634a0adb63106492f3e94c.tar.gz
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')
-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 0000000000..b6b72e2ae2
--- /dev/null
+++ b/src/examples/elementary/efl_ui_radio_example_01.c
@@ -0,0 +1,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()
diff --git a/src/examples/elementary/meson.build b/src/examples/elementary/meson.build
index 35a7eeac03..f29a94f687 100644
--- a/src/examples/elementary/meson.build
+++ b/src/examples/elementary/meson.build
@@ -117,7 +117,8 @@ examples = [
'efl_canvas_layout_text',
'efl_ui_theme_example_01',
'efl_ui_theme_example_02',
- 'efl_ui_slideshow_example'
+ 'efl_ui_slideshow_example',
+ 'efl_ui_radio_example_01',
]
foreach example : examples