Introduce Separator

Summary:
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.

Reviewers: zmike, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11125
This commit is contained in:
Marcel Hollerbach 2020-01-17 16:06:52 +01:00 committed by Xavi Artigas
parent 25e52f8106
commit bac185e8f3
10 changed files with 131 additions and 3 deletions

View File

@ -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"
}

View File

@ -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;
}
}
}
}

View File

@ -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'

View File

@ -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);

View File

@ -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));
}

View File

@ -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

View File

@ -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"

View File

@ -0,0 +1,20 @@
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.
@since 1.24
]]
implements {
Efl.Object.constructor;
Efl.Ui.Widget.theme_apply;
Efl.Ui.Layout_Orientable.orientation { get; set; }
}
constructors {
Efl.Ui.Layout_Orientable.orientation;
}
}

View File

@ -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]

View File

@ -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",