diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-01-17 11:02:44 +0100 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-01-17 13:14:52 +0100 |
commit | ea0b36613f6577a31942864a8c6dbafda192f9fd (patch) | |
tree | d5e040310c04a2b1bcf62d9b9f117d98bfc74d63 /src/lib | |
parent | bdaf20fb4c4bca57c165fc3a7126b3963306750a (diff) | |
download | efl-ea0b36613f6577a31942864a8c6dbafda192f9fd.tar.gz |
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.
Diffstat (limited to 'src/lib')
-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 |
4 files changed, 65 insertions, 1 deletions
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] |