aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/elementary
diff options
context:
space:
mode:
authorWoochanlee <wc0917.lee@samsung.com>2018-12-20 11:32:28 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2018-12-20 11:32:28 +0900
commitd9a222ecf59622ec9cf80a908b0a987d18f87b0f (patch)
tree0308b4cb7934e65a51c9cdda7b436ade745b527c /src/bin/elementary
parentdoc: Remove misplaced blank line (diff)
downloadefl-d9a222ecf59622ec9cf80a908b0a987d18f87b0f.tar.gz
Intruduce Efl.Ui.Panel (Create Efl Ui Widget from elm widget(elm_panel))
Summary: Create Efl Ui Widget from elm widget(elm_panel) Test Plan: elementary_test -> efl_ui_panel Reviewers: woohyun, Jaehyun_Cho, segfaultxavi Reviewed By: Jaehyun_Cho, segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7238
Diffstat (limited to 'src/bin/elementary')
-rw-r--r--src/bin/elementary/Makefile.am1
-rw-r--r--src/bin/elementary/meson.build1
-rw-r--r--src/bin/elementary/test.c4
-rw-r--r--src/bin/elementary/test_ui_panel.c159
4 files changed, 165 insertions, 0 deletions
diff --git a/src/bin/elementary/Makefile.am b/src/bin/elementary/Makefile.am
index 8828276e26..290ea0e110 100644
--- a/src/bin/elementary/Makefile.am
+++ b/src/bin/elementary/Makefile.am
@@ -136,6 +136,7 @@ test_ui_buttonspin.c \
test_ui_datepicker.c \
test_ui_timepicker.c \
test_ui_tags.c \
+test_ui_panel.c \
test_store.c \
test_sys_notify.c \
test_systray.c \
diff --git a/src/bin/elementary/meson.build b/src/bin/elementary/meson.build
index ddc778ba2c..f8ca71e9c8 100644
--- a/src/bin/elementary/meson.build
+++ b/src/bin/elementary/meson.build
@@ -98,6 +98,7 @@ elementary_test_src = [
'test_panel.c',
'test_panes.c',
'test_ui_panes.c',
+ 'test_ui_panel.c',
'test_part_bg.c',
'test_part_shadow.c',
'test_photo.c',
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 9298e9b2e2..de66b96582 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -189,6 +189,8 @@ void test_ui_spin_button(void *data, Evas_Object *obj, void *event_info);
void test_ui_datepicker(void *data, Evas_Object *obj, void *event_info);
void test_ui_timepicker(void *data, Evas_Object *obj, void *event_info);
void test_ui_tags(void *data, Evas_Object *obj, void *event_info);
+void test_ui_panel(void *data, Evas_Object *obj, void *event_info);
+void test_ui_panel2(void *data, Evas_Object *obj, void *event_info);
void test_index(void *data, Evas_Object *obj, void *event_info);
void test_index2(void *data, Evas_Object *obj, void *event_info);
void test_index3(void *data, Evas_Object *obj, void *event_info);
@@ -1165,6 +1167,8 @@ add_tests:
ADD_TEST(NULL, "Dividers", "Panel Scrollable", test_panel2);
ADD_TEST(NULL, "Dividers", "Panes", test_panes);
ADD_TEST_EO(NULL, "Dividers", "Efl.Ui.Panes", test_panes_minsize);
+ ADD_TEST_EO(NULL, "Dividers", "Efl.Ui.Panel", test_ui_panel);
+ ADD_TEST_EO(NULL, "Dividers", "Efl.Ui.Panel Scrollable", test_ui_panel2);
//------------------------------//
ADD_TEST(NULL, "Standardization", "Conformant", test_conformant);
diff --git a/src/bin/elementary/test_ui_panel.c b/src/bin/elementary/test_ui_panel.c
new file mode 100644
index 0000000000..eed8d14759
--- /dev/null
+++ b/src/bin/elementary/test_ui_panel.c
@@ -0,0 +1,159 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+void
+test_ui_panel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ char buf[PATH_MAX] = {0};
+ Eo *win, *table, *panel;
+
+ win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
+ efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
+ efl_text_set(efl_added, "Efl.Ui.Panel"),
+ efl_ui_win_autodel_set(efl_added, EINA_TRUE));
+
+ table = efl_add(EFL_UI_TABLE_CLASS, win,
+ efl_content_set(win, efl_added));
+
+ snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
+ efl_add(EFL_UI_IMAGE_CLASS, table,
+ efl_file_set(efl_added, buf, NULL),
+ efl_gfx_size_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
+ efl_gfx_size_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
+ efl_pack_table(table, efl_added, 0, 0, 4, 5));
+
+ // Top Panel
+ panel = efl_add(EFL_UI_PANEL_CLASS, table,
+ efl_ui_panel_orient_set(efl_added, EFL_UI_PANEL_ORIENT_TOP),
+ efl_pack_table(table, efl_added, 0, 0, 4, 1));
+
+ efl_add(EFL_UI_BUTTON_CLASS, panel,
+ efl_text_set(efl_added, "Top Panel"),
+ efl_content_set(panel, efl_added));
+
+ // Left Panel
+ panel = efl_add(EFL_UI_PANEL_CLASS, table,
+ efl_ui_panel_orient_set(efl_added, EFL_UI_PANEL_ORIENT_LEFT),
+ efl_pack_table(table, efl_added, 0, 2, 2, 1));
+
+ efl_add(EFL_UI_BUTTON_CLASS, panel,
+ efl_text_set(efl_added, "Left Panel"),
+ efl_content_set(panel, efl_added));
+
+ // Right Panel
+ panel = efl_add(EFL_UI_PANEL_CLASS, table,
+ efl_ui_panel_orient_set(efl_added, EFL_UI_PANEL_ORIENT_RIGHT),
+ efl_pack_table(table, efl_added, 2, 2, 2, 1));
+
+ efl_add(EFL_UI_BUTTON_CLASS, panel,
+ efl_text_set(efl_added, "Right Panel"),
+ efl_content_set(panel, efl_added));
+
+ // Bottom Panel
+ panel = efl_add(EFL_UI_PANEL_CLASS, table,
+ efl_ui_panel_orient_set(efl_added, EFL_UI_PANEL_ORIENT_BOTTOM),
+ efl_pack_table(table, efl_added, 0, 4, 4, 1));
+
+ efl_add(EFL_UI_BUTTON_CLASS, panel,
+ efl_text_set(efl_added, "Bottom Panel"),
+ efl_content_set(panel, efl_added));
+
+ efl_gfx_entity_size_set(win, EINA_SIZE2D(280, 320));
+}
+
+static void
+_check_changed(void *data EINA_UNUSED, const Efl_Event *ev)
+{
+ elm_config_scroll_thumbscroll_enabled_set(efl_ui_nstate_value_get(ev->object));
+}
+
+static void
+_panel_toggled(void *data, const Efl_Event *ev)
+{
+ Evas_Object *list;
+ int i;
+
+ if (!efl_ui_nstate_value_get(data)) return;
+
+ list = efl_content_get(ev->object);
+ evas_object_del(list);
+
+ list = elm_list_add(ev->object);
+ evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ for (i = 0; i < 7; i++)
+ elm_list_item_append(list, "panel list item", NULL, NULL, NULL, NULL);
+ efl_content_set(ev->object, list);
+
+ printf("Panel toggled:%s\n", efl_ui_panel_hidden_get(ev->object) ? "hidden" : "visible");
+}
+
+static void
+_btn_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+ Eo *panel = data;
+ efl_ui_panel_toggle(panel);
+}
+void
+test_ui_panel2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ int i;
+ Eo *win, *box, *check, *btn, *table, *list, *panel;
+
+ win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
+ efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
+ efl_text_set(efl_added, "Efl.Ui.Panel"),
+ efl_ui_win_autodel_set(efl_added, EINA_TRUE));
+
+ box = efl_add(EFL_UI_BOX_CLASS, win,
+ efl_content_set(win, efl_added));
+
+ efl_add(EFL_UI_CHECK_CLASS, box,
+ efl_ui_check_selected_set(efl_added, elm_config_scroll_thumbscroll_enabled_get()),
+ efl_text_set(efl_added, "Enable thumb scroll (temporarily"),
+ efl_event_callback_add(efl_added, EFL_UI_NSTATE_EVENT_CHANGED, _check_changed, NULL),
+ efl_gfx_size_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0),
+ efl_pack(box, efl_added));
+
+ check = efl_add(EFL_UI_CHECK_CLASS, box,
+ efl_text_set(efl_added, "Reset content on toggle"),
+ efl_gfx_size_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0),
+ efl_pack(box, efl_added));
+
+ btn = efl_add(EFL_UI_BUTTON_CLASS, box,
+ efl_text_set(efl_added, "toggle"),
+ efl_gfx_size_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0),
+ efl_pack(box, efl_added));
+
+ table = efl_add(EFL_UI_TABLE_CLASS, box,
+ efl_pack(box, efl_added));
+
+ list = elm_list_add(table);
+ evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(list);
+ for (i = 0; i < 20; i++)
+ elm_list_item_append(list, "center list item", NULL, NULL, NULL, NULL);
+ efl_pack_table(table, list, 0, 0, 1, 1);
+
+ panel = efl_add(EFL_UI_PANEL_CLASS, table,
+ efl_ui_panel_orient_set(efl_added, EFL_UI_PANEL_ORIENT_LEFT),
+ efl_ui_panel_scrollable_set(efl_added, EINA_TRUE),
+ efl_ui_panel_hidden_set(efl_added, EINA_TRUE),
+ efl_ui_panel_scrollable_content_size_set(efl_added, 0.75),
+ efl_pack_table(table, efl_added, 0, 0, 1, 1));
+
+ list = elm_list_add(panel);
+ evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ for (i = 0; i < 7; i++)
+ elm_list_item_append(list, "left panel item", NULL, NULL, NULL, NULL);
+ efl_content_set(panel, list);
+
+ efl_event_callback_add(panel, EFL_UI_PANEL_EVENT_TOGGLED, _panel_toggled, check);
+ efl_event_callback_add(btn, EFL_UI_EVENT_CLICKED, _btn_clicked, panel);
+
+ efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400));
+}