forked from enlightenment/efl
efl_ui_spotlight_indicator: make this undependend from the main widget
the main widget before presented a layout to hold the indicator, however, for the causual case, this is not really needed. The indicator itself is anyways going to be a more general prupose widget soon, where the layout here can be taken as an starting point. Additionally, this fixes general displaying of the indicator, before the box padding refactor, a padding would have changed the minsize of the mix, this is not the case anymore, which forces us to calculate the minsize of the indicator theme. Differential Revision: https://phab.enlightenment.org/D10764
This commit is contained in:
parent
d51bdf3c77
commit
acfd031e47
|
@ -10,6 +10,18 @@ group { "efl/spotlight"; data.item: "version" "123";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
group { "efl/spotlight/indicator_holder"; data.item: "version" "123";
|
||||||
|
parts {
|
||||||
|
swallow { "efl.indicator";
|
||||||
|
scale;
|
||||||
|
desc { "default";
|
||||||
|
rel2.relative: 1.0 0.0;
|
||||||
|
align: 0.5 0.0;
|
||||||
|
min: 0 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
group { "efl/spotlight/indicator"; data.item: "version" "123";
|
group { "efl/spotlight/indicator"; data.item: "version" "123";
|
||||||
images {
|
images {
|
||||||
|
|
|
@ -656,7 +656,6 @@ _efl_ui_spotlight_container_indicator_set(Eo *obj, Efl_Ui_Spotlight_Container_Da
|
||||||
{
|
{
|
||||||
if (pd->indicator)
|
if (pd->indicator)
|
||||||
{
|
{
|
||||||
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
|
|
||||||
efl_del(pd->indicator);
|
efl_del(pd->indicator);
|
||||||
}
|
}
|
||||||
pd->indicator = indicator;
|
pd->indicator = indicator;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Efl_Ui_Box *indicator;
|
Efl_Ui_Box *indicator;
|
||||||
Efl_Ui_Spotlight_Container *container;
|
Efl_Ui_Spotlight_Container *container;
|
||||||
|
Efl_Canvas_Layout *layout;
|
||||||
double last_position;
|
double last_position;
|
||||||
} Efl_Ui_Spotlight_Indicator_Icon_Data;
|
} Efl_Ui_Spotlight_Indicator_Icon_Data;
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ _add_item(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd)
|
||||||
efl_gfx_hint_align_set(item, 0.5, 0.5);
|
efl_gfx_hint_align_set(item, 0.5, 0.5);
|
||||||
efl_gfx_hint_weight_set(item, 0, 0);
|
efl_gfx_hint_weight_set(item, 0, 0);
|
||||||
efl_gfx_hint_fill_set(item, 0, 0);
|
efl_gfx_hint_fill_set(item, 0, 0);
|
||||||
|
efl_gfx_hint_size_min_set(item, efl_layout_calc_size_min(item, EINA_SIZE2D(0, 0)));
|
||||||
efl_pack_end(pd->indicator, item);
|
efl_pack_end(pd->indicator, item);
|
||||||
_flush_state(item, 0.0);
|
_flush_state(item, 0.0);
|
||||||
}
|
}
|
||||||
|
@ -70,22 +72,50 @@ _flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd)
|
||||||
_flush_state(efl_pack_content_get(pd->indicator, next), fabs(1.0f - fabs((next - pd->last_position))));
|
_flush_state(efl_pack_content_get(pd->indicator, next), fabs(1.0f - fabs((next - pd->last_position))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_resize_cb(void *data, const Efl_Event *ev)
|
||||||
|
{
|
||||||
|
efl_gfx_entity_size_set(data, efl_gfx_entity_size_get(ev->object));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_position_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
|
{
|
||||||
|
efl_gfx_entity_position_set(data, efl_gfx_entity_position_get(ev->object));
|
||||||
|
}
|
||||||
|
|
||||||
|
EFL_CALLBACKS_ARRAY_DEFINE(spotlight_resized,
|
||||||
|
{EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb},
|
||||||
|
{EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _position_cb},
|
||||||
|
)
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Ui_Spotlight_Container *spotlight)
|
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Ui_Spotlight_Container *spotlight)
|
||||||
{
|
{
|
||||||
if (spotlight)
|
if (spotlight)
|
||||||
{
|
{
|
||||||
pd->container = spotlight;
|
pd->container = spotlight;
|
||||||
pd->indicator = efl_add(EFL_UI_BOX_CLASS, spotlight);
|
efl_event_callback_array_add(pd->container, spotlight_resized(), pd->layout);
|
||||||
|
pd->layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, pd->container);
|
||||||
|
|
||||||
|
if (elm_widget_theme_object_set(pd->container, pd->layout,
|
||||||
|
"spotlight",
|
||||||
|
"indicator_holder",
|
||||||
|
elm_widget_theme_style_get(pd->container)) == EFL_UI_THEME_APPLY_ERROR_GENERIC)
|
||||||
|
CRI("Failed to set layout!");
|
||||||
|
efl_canvas_group_member_add(pd->container, pd->layout);
|
||||||
|
efl_gfx_entity_geometry_set(pd->layout, efl_gfx_entity_geometry_get(pd->container));
|
||||||
|
|
||||||
|
pd->indicator = efl_add(EFL_UI_BOX_CLASS, pd->container);
|
||||||
efl_ui_widget_internal_set(pd->indicator, EINA_TRUE);
|
efl_ui_widget_internal_set(pd->indicator, EINA_TRUE);
|
||||||
efl_content_set(efl_part(pd->container, "efl.indicator"), pd->indicator);
|
|
||||||
efl_gfx_entity_visible_set(pd->indicator, EINA_TRUE);
|
|
||||||
efl_ui_layout_orientation_set(pd->indicator, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
efl_ui_layout_orientation_set(pd->indicator, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
||||||
efl_gfx_arrangement_content_padding_set(pd->indicator, 15, 15);
|
efl_content_set(efl_part(pd->layout, "efl.indicator"), pd->indicator);
|
||||||
|
|
||||||
for (int i = 0; i < efl_content_count(pd->container); ++i)
|
for (int i = 0; i < efl_content_count(pd->container); ++i)
|
||||||
{
|
{
|
||||||
|
Eo *subobj = efl_pack_content_get(pd->container, i);
|
||||||
_add_item(obj, pd);
|
_add_item(obj, pd);
|
||||||
|
efl_gfx_stack_above(pd->layout, subobj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,6 +125,7 @@ _efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_add(Eo *obj,
|
||||||
{
|
{
|
||||||
_add_item(obj, pd);
|
_add_item(obj, pd);
|
||||||
_flush_position(obj, pd);
|
_flush_position(obj, pd);
|
||||||
|
efl_gfx_stack_above(pd->layout, subobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -111,4 +142,16 @@ _efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_position_update(Eo *
|
||||||
_flush_position(obj, pd);
|
_flush_position(obj, pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_spotlight_indicator_icon_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd)
|
||||||
|
{
|
||||||
|
if (pd->layout)
|
||||||
|
efl_del(pd->layout);
|
||||||
|
if (pd->indicator)
|
||||||
|
efl_del(pd->indicator);
|
||||||
|
|
||||||
|
efl_destructor(efl_super(obj, EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "efl_ui_spotlight_indicator_icon.eo.c"
|
#include "efl_ui_spotlight_indicator_icon.eo.c"
|
||||||
|
|
|
@ -4,5 +4,6 @@ class @beta Efl.Ui.Spotlight.Indicator_Icon extends Efl.Ui.Spotlight.Indicator {
|
||||||
Efl.Ui.Spotlight.Indicator.content_del;
|
Efl.Ui.Spotlight.Indicator.content_del;
|
||||||
Efl.Ui.Spotlight.Indicator.content_add;
|
Efl.Ui.Spotlight.Indicator.content_add;
|
||||||
Efl.Ui.Spotlight.Indicator.position_update;
|
Efl.Ui.Spotlight.Indicator.position_update;
|
||||||
|
Efl.Object.destructor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue