summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-17 11:02:44 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-17 13:14:52 +0100
commitea0b36613f6577a31942864a8c6dbafda192f9fd (patch)
treed5e040310c04a2b1bcf62d9b9f117d98bfc74d63
parentbdaf20fb4c4bca57c165fc3a7126b3963306750a (diff)
Introduce Separatordevs/bu5hm4n/work_seperator
this is just like elm_separator, just written for unified widgets. This inherits from item, which has the advantage that this separator can also be added into item container.
-rw-r--r--data/elementary/themes/default.edc1
-rw-r--r--data/elementary/themes/edc/efl/separator.edc29
-rw-r--r--src/bin/elementary/meson.build1
-rw-r--r--src/bin/elementary/test.c3
-rw-r--r--src/bin/elementary/test_ui_separator.c26
-rw-r--r--src/lib/elementary/Efl_Ui.h1
-rw-r--r--src/lib/elementary/efl_ui_separator.c46
-rw-r--r--src/lib/elementary/efl_ui_separator.eo15
-rw-r--r--src/lib/elementary/meson.build4
-rw-r--r--src/tests/elementary/spec/efl_test_basics.c3
10 files changed, 126 insertions, 3 deletions
diff --git a/data/elementary/themes/default.edc b/data/elementary/themes/default.edc
index 315a5e7..47d8e6c 100644
--- a/data/elementary/themes/default.edc
+++ b/data/elementary/themes/default.edc
@@ -209,4 +209,5 @@ collections {
209#include "edc/efl/tab_page.edc" 209#include "edc/efl/tab_page.edc"
210#include "edc/efl/collection.edc" 210#include "edc/efl/collection.edc"
211#include "edc/efl/group_item.edc" 211#include "edc/efl/group_item.edc"
212#include "edc/efl/separator.edc"
212} 213}
diff --git a/data/elementary/themes/edc/efl/separator.edc b/data/elementary/themes/edc/efl/separator.edc
new file mode 100644
index 0000000..5107bfa
--- /dev/null
+++ b/data/elementary/themes/edc/efl/separator.edc
@@ -0,0 +1,29 @@
1group { name: "efl/separator/horizontal";
2 data.item: "version" "124";
3 images.image: "bevel_dark_in.png" COMP;
4 parts {
5 part { name: "base";
6 description { state: "default" 0.0;
7 min: 2 2;
8 max: 99999 2;
9 rel1.offset: 4 4;
10 rel2.offset: -5 -5;
11 image.normal: "bevel_dark_in.png";
12 image.border: 2 2 2 2;
13 fill.smooth: 0;
14 }
15 }
16 }
17}
18group { name: "efl/separator/vertical";
19 data.item: "version" "124";
20 inherit: "efl/separator/horizontal";
21 parts {
22 part { name: "base";
23 description { state: "default" 0.0;
24 max: 2 99999;
25 }
26 }
27 }
28}
29
diff --git a/src/bin/elementary/meson.build b/src/bin/elementary/meson.build
index 2195ded..7eddf03 100644
--- a/src/bin/elementary/meson.build
+++ b/src/bin/elementary/meson.build
@@ -161,6 +161,7 @@ elementary_test_src = [
161 'test_ui_collection_view.c', 161 'test_ui_collection_view.c',
162 'test_ui_items.c', 162 'test_ui_items.c',
163 'test_ui_frame.c', 163 'test_ui_frame.c',
164 'test_ui_separator.c',
164 'test_efl_ui_vg_animation.c', 165 'test_efl_ui_vg_animation.c',
165 'test_efl_gfx_vg_value_provider.c', 166 'test_efl_gfx_vg_value_provider.c',
166 'test.h' 167 'test.h'
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 94b4b3d..b86505a 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
409 409
410void test_efl_ui_vg_animation(void *data, Evas_Object *obj, void *event_info); 410void test_efl_ui_vg_animation(void *data, Evas_Object *obj, void *event_info);
411void test_efl_gfx_vg_value_provider(void *data, Evas_Object *obj, void *event_info); 411void test_efl_gfx_vg_value_provider(void *data, Evas_Object *obj, void *event_info);
412void test_ui_separator(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED);
412 413
413static void _list_udpate(void); 414static void _list_udpate(void);
414 415
@@ -1151,7 +1152,7 @@ add_tests:
1151 // FIXME: add frame test 1152 // FIXME: add frame test
1152 ADD_TEST(NULL, "Boundaries", "Bubble", test_bubble); 1153 ADD_TEST(NULL, "Boundaries", "Bubble", test_bubble);
1153 ADD_TEST(NULL, "Boundaries", "Separator", test_separator); 1154 ADD_TEST(NULL, "Boundaries", "Separator", test_separator);
1154 1155 ADD_TEST_EO(NULL, "Boundaries", "Separator", test_ui_separator);
1155 //------------------------------// 1156 //------------------------------//
1156 ADD_TEST(NULL, "Range Values", "Spinner", test_spinner); 1157 ADD_TEST(NULL, "Range Values", "Spinner", test_spinner);
1157 ADD_TEST_EO(NULL, "Range Values", "Efl.Ui.Spin", test_ui_spin); 1158 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 0000000..f3601e8
--- /dev/null
+++ b/src/bin/elementary/test_ui_separator.c
@@ -0,0 +1,26 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Efl_Ui.h>
5
6void
7test_ui_separator(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
8{
9 Eo *win, *table, *sep;
10
11 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
12 efl_text_set(efl_added, "Efl.Ui.Separator"),
13 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
14
15 table = efl_add(EFL_UI_TABLE_CLASS, win);
16 efl_content_set(win, table);
17
18 sep = efl_add(EFL_UI_SEPARATOR_CLASS, win);
19 efl_pack_table(table, sep, 0, 0, 2, 1);
20
21 sep = efl_add(EFL_UI_SEPARATOR_CLASS,win,
22 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL));
23 efl_pack_table(table, sep, 0, 0, 2, 1);
24
25 efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 120));
26}
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h
index 2fe6b95..4ec831f 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;
328# include <efl_ui_timepicker.eo.h> 328# include <efl_ui_timepicker.eo.h>
329# include <efl_ui_datepicker.eo.h> 329# include <efl_ui_datepicker.eo.h>
330# include <efl_ui_calendar.eo.h> 330# include <efl_ui_calendar.eo.h>
331# include <efl_ui_separator.eo.h>
331 332
332/** 333/**
333 * Initialize Elementary 334 * 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 0000000..887cfb3
--- /dev/null
+++ b/src/lib/elementary/efl_ui_separator.c
@@ -0,0 +1,46 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Efl_Ui.h>
6#include "elm_priv.h"
7
8typedef struct {
9 Efl_Ui_Layout_Orientation dir;
10} Efl_Ui_Separator_Data;
11
12#define MY_CLASS EFL_UI_SEPARATOR_CLASS
13
14
15EOLIAN static Efl_Object*
16_efl_ui_separator_efl_object_constructor(Eo *obj, Efl_Ui_Separator_Data *pd EINA_UNUSED)
17{
18 if (!elm_widget_theme_klass_get(obj))
19 elm_widget_theme_klass_set(obj, "separator");
20 return efl_constructor(efl_super(obj, MY_CLASS));
21}
22
23EOLIAN static void
24_efl_ui_separator_efl_ui_layout_orientable_orientation_set(Eo *obj EINA_UNUSED, Efl_Ui_Separator_Data *pd, Efl_Ui_Layout_Orientation dir)
25{
26 pd->dir = dir;
27}
28
29EOLIAN static Efl_Ui_Layout_Orientation
30_efl_ui_separator_efl_ui_layout_orientable_orientation_get(const Eo *ob EINA_UNUSED, Efl_Ui_Separator_Data *pd)
31{
32 return pd->dir;
33}
34
35EOLIAN static Eina_Error
36_efl_ui_separator_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Separator_Data *pd)
37{
38 if (efl_ui_layout_orientation_is_horizontal(pd->dir, EINA_TRUE))
39 elm_widget_theme_element_set(obj, "horizontal");
40 else
41 elm_widget_theme_element_set(obj, "vertical");
42 return efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
43}
44
45
46#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 0000000..e1d2186
--- /dev/null
+++ b/src/lib/elementary/efl_ui_separator.eo
@@ -0,0 +1,15 @@
1class Efl.Ui.Separator extends Efl.Ui.Item implements Efl.Ui.Layout_Orientable
2{
3 [[Vertical or horizontal separator line.
4
5 Use it to separate groups of buttons in a toolbar, for example, or items on a list.
6 The length of the line adapts to the size of the container, and its width is
7 controlled by the theme.
8 ]]
9
10 implements {
11 Efl.Object.constructor;
12 Efl.Ui.Widget.theme_apply;
13 Efl.Ui.Layout_Orientable.orientation { get; set; }
14 }
15}
diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build
index 3ca7b93..6606f08 100644
--- a/src/lib/elementary/meson.build
+++ b/src/lib/elementary/meson.build
@@ -189,6 +189,7 @@ pub_eo_files = [
189 'efl_ui_grid_view.eo', 189 'efl_ui_grid_view.eo',
190 'efl_ui_pager.eo', 190 'efl_ui_pager.eo',
191 'efl_ui_stack.eo', 191 'efl_ui_stack.eo',
192 'efl_ui_separator.eo'
192] 193]
193 194
194foreach eo_file : pub_eo_files 195foreach eo_file : pub_eo_files
@@ -945,7 +946,8 @@ elementary_src = [
945 'efl_ui_view_model.c', 946 'efl_ui_view_model.c',
946 'efl_ui_collection_view.c', 947 'efl_ui_collection_view.c',
947 'efl_ui_pager.c', 948 'efl_ui_pager.c',
948 'efl_ui_stack.c' 949 'efl_ui_stack.c',
950 'efl_ui_separator.c'
949] 951]
950 952
951elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl] 953elementary_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 81f134a..2774b2a 100644
--- a/src/tests/elementary/spec/efl_test_basics.c
+++ b/src/tests/elementary/spec/efl_test_basics.c
@@ -49,7 +49,8 @@
49 "Efl.Ui.Table", 49 "Efl.Ui.Table",
50 "Efl.Ui.Flip", 50 "Efl.Ui.Flip",
51 "Efl.Ui.Stack", 51 "Efl.Ui.Stack",
52 "Efl.Ui.Pager" 52 "Efl.Ui.Pager",
53 "Efl.Ui.Separator"
53 ], 54 ],
54 "custom-mapping" : { 55 "custom-mapping" : {
55 "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS", 56 "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS",