diff options
-rw-r--r-- | data/elementary/themes/default.edc | 1 | ||||
-rw-r--r-- | data/elementary/themes/edc/efl/separator.edc | 29 | ||||
-rw-r--r-- | src/bin/elementary/meson.build | 1 | ||||
-rw-r--r-- | src/bin/elementary/test.c | 3 | ||||
-rw-r--r-- | src/bin/elementary/test_ui_separator.c | 26 | ||||
-rw-r--r-- | src/lib/elementary/Efl_Ui.h | 1 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_separator.c | 46 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_separator.eo | 15 | ||||
-rw-r--r-- | src/lib/elementary/meson.build | 4 | ||||
-rw-r--r-- | src/tests/elementary/spec/efl_test_basics.c | 3 |
10 files changed, 126 insertions, 3 deletions
diff --git a/data/elementary/themes/default.edc b/data/elementary/themes/default.edc index 315a5e7ca3..47d8e6c7c0 100644 --- a/data/elementary/themes/default.edc +++ b/data/elementary/themes/default.edc @@ -209,4 +209,5 @@ collections { #include "edc/efl/tab_page.edc" #include "edc/efl/collection.edc" #include "edc/efl/group_item.edc" +#include "edc/efl/separator.edc" } diff --git a/data/elementary/themes/edc/efl/separator.edc b/data/elementary/themes/edc/efl/separator.edc new file mode 100644 index 0000000000..5107bfabff --- /dev/null +++ b/data/elementary/themes/edc/efl/separator.edc @@ -0,0 +1,29 @@ +group { name: "efl/separator/horizontal"; + data.item: "version" "124"; + images.image: "bevel_dark_in.png" COMP; + parts { + part { name: "base"; + description { state: "default" 0.0; + min: 2 2; + max: 99999 2; + rel1.offset: 4 4; + rel2.offset: -5 -5; + image.normal: "bevel_dark_in.png"; + image.border: 2 2 2 2; + fill.smooth: 0; + } + } + } +} +group { name: "efl/separator/vertical"; + data.item: "version" "124"; + inherit: "efl/separator/horizontal"; + parts { + part { name: "base"; + description { state: "default" 0.0; + max: 2 99999; + } + } + } +} + diff --git a/src/bin/elementary/meson.build b/src/bin/elementary/meson.build index 2195ded204..7eddf03b48 100644 --- a/src/bin/elementary/meson.build +++ b/src/bin/elementary/meson.build @@ -161,6 +161,7 @@ elementary_test_src = [ 'test_ui_collection_view.c', 'test_ui_items.c', 'test_ui_frame.c', + 'test_ui_separator.c', 'test_efl_ui_vg_animation.c', 'test_efl_gfx_vg_value_provider.c', 'test.h' diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 94b4b3df91..b86505a370 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -409,6 +409,7 @@ void test_ui_frame(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e void test_efl_ui_vg_animation(void *data, Evas_Object *obj, void *event_info); void test_efl_gfx_vg_value_provider(void *data, Evas_Object *obj, void *event_info); +void test_ui_separator(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED); static void _list_udpate(void); @@ -1151,7 +1152,7 @@ add_tests: // FIXME: add frame test ADD_TEST(NULL, "Boundaries", "Bubble", test_bubble); ADD_TEST(NULL, "Boundaries", "Separator", test_separator); - + ADD_TEST_EO(NULL, "Boundaries", "Separator", test_ui_separator); //------------------------------// ADD_TEST(NULL, "Range Values", "Spinner", test_spinner); ADD_TEST_EO(NULL, "Range Values", "Efl.Ui.Spin", test_ui_spin); diff --git a/src/bin/elementary/test_ui_separator.c b/src/bin/elementary/test_ui_separator.c new file mode 100644 index 0000000000..f3601e872b --- /dev/null +++ b/src/bin/elementary/test_ui_separator.c @@ -0,0 +1,26 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif +#include <Efl_Ui.h> + +void +test_ui_separator(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Eo *win, *table, *sep; + + win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), + efl_text_set(efl_added, "Efl.Ui.Separator"), + efl_ui_win_autodel_set(efl_added, EINA_TRUE)); + + table = efl_add(EFL_UI_TABLE_CLASS, win); + efl_content_set(win, table); + + sep = efl_add(EFL_UI_SEPARATOR_CLASS, win); + efl_pack_table(table, sep, 0, 0, 2, 1); + + sep = efl_add(EFL_UI_SEPARATOR_CLASS,win, + efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL)); + efl_pack_table(table, sep, 0, 0, 2, 1); + + efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 120)); +} diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h index 2fe6b95961..4ec831f2a2 100644 --- a/src/lib/elementary/Efl_Ui.h +++ b/src/lib/elementary/Efl_Ui.h @@ -328,6 +328,7 @@ typedef Eo Efl_Ui_Spotlight_Indicator; # include <efl_ui_timepicker.eo.h> # include <efl_ui_datepicker.eo.h> # include <efl_ui_calendar.eo.h> +# include <efl_ui_separator.eo.h> /** * Initialize Elementary diff --git a/src/lib/elementary/efl_ui_separator.c b/src/lib/elementary/efl_ui_separator.c new file mode 100644 index 0000000000..887cfb3c40 --- /dev/null +++ b/src/lib/elementary/efl_ui_separator.c @@ -0,0 +1,46 @@ +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#endif + +#include <Efl_Ui.h> +#include "elm_priv.h" + +typedef struct { + Efl_Ui_Layout_Orientation dir; +} Efl_Ui_Separator_Data; + +#define MY_CLASS EFL_UI_SEPARATOR_CLASS + + +EOLIAN static Efl_Object* +_efl_ui_separator_efl_object_constructor(Eo *obj, Efl_Ui_Separator_Data *pd EINA_UNUSED) +{ + if (!elm_widget_theme_klass_get(obj)) + elm_widget_theme_klass_set(obj, "separator"); + return efl_constructor(efl_super(obj, MY_CLASS)); +} + +EOLIAN static void +_efl_ui_separator_efl_ui_layout_orientable_orientation_set(Eo *obj EINA_UNUSED, Efl_Ui_Separator_Data *pd, Efl_Ui_Layout_Orientation dir) +{ + pd->dir = dir; +} + +EOLIAN static Efl_Ui_Layout_Orientation +_efl_ui_separator_efl_ui_layout_orientable_orientation_get(const Eo *ob EINA_UNUSED, Efl_Ui_Separator_Data *pd) +{ + return pd->dir; +} + +EOLIAN static Eina_Error +_efl_ui_separator_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Separator_Data *pd) +{ + if (efl_ui_layout_orientation_is_horizontal(pd->dir, EINA_TRUE)) + elm_widget_theme_element_set(obj, "horizontal"); + else + elm_widget_theme_element_set(obj, "vertical"); + return efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS)); +} + + +#include "efl_ui_separator.eo.c" diff --git a/src/lib/elementary/efl_ui_separator.eo b/src/lib/elementary/efl_ui_separator.eo new file mode 100644 index 0000000000..e1d21866c8 --- /dev/null +++ b/src/lib/elementary/efl_ui_separator.eo @@ -0,0 +1,15 @@ +class Efl.Ui.Separator extends Efl.Ui.Item implements Efl.Ui.Layout_Orientable +{ + [[Vertical or horizontal separator line. + + Use it to separate groups of buttons in a toolbar, for example, or items on a list. + The length of the line adapts to the size of the container, and its width is + controlled by the theme. + ]] + + implements { + Efl.Object.constructor; + Efl.Ui.Widget.theme_apply; + Efl.Ui.Layout_Orientable.orientation { get; set; } + } +} diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 3ca7b935c6..6606f084de 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -189,6 +189,7 @@ pub_eo_files = [ 'efl_ui_grid_view.eo', 'efl_ui_pager.eo', 'efl_ui_stack.eo', + 'efl_ui_separator.eo' ] foreach eo_file : pub_eo_files @@ -945,7 +946,8 @@ elementary_src = [ 'efl_ui_view_model.c', 'efl_ui_collection_view.c', 'efl_ui_pager.c', - 'efl_ui_stack.c' + 'efl_ui_stack.c', + 'efl_ui_separator.c' ] elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl] diff --git a/src/tests/elementary/spec/efl_test_basics.c b/src/tests/elementary/spec/efl_test_basics.c index 81f134af33..2774b2ae8f 100644 --- a/src/tests/elementary/spec/efl_test_basics.c +++ b/src/tests/elementary/spec/efl_test_basics.c @@ -49,7 +49,8 @@ "Efl.Ui.Table", "Efl.Ui.Flip", "Efl.Ui.Stack", - "Efl.Ui.Pager" + "Efl.Ui.Pager", + "Efl.Ui.Separator" ], "custom-mapping" : { "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS", |