forked from enlightenment/efl
Compare commits
7 Commits
master
...
devs/bu5hm
Author | SHA1 | Date |
---|---|---|
Marcel Hollerbach | 5766d172cb | |
Marcel Hollerbach | 3ee12d7cc6 | |
Marcel Hollerbach | 4bce4cd34b | |
Marcel Hollerbach | ac1a0e54c0 | |
Marcel Hollerbach | ab69729c5c | |
Marcel Hollerbach | bb66d72147 | |
Marcel Hollerbach | c1fad0f97f |
|
@ -8,10 +8,16 @@ group { "efl/spotlight"; data.item: "version" "123";
|
|||
min: 0 50;
|
||||
}
|
||||
}
|
||||
swallow { "efl.event";
|
||||
}
|
||||
}
|
||||
group { "efl/spotlight/indicator_holder"; data.item: "version" "123";
|
||||
parts {
|
||||
swallow { "efl.indicator";
|
||||
scale;
|
||||
repeat_events: 1;
|
||||
desc { "default";
|
||||
rel2.relative: 1.0 0.0;
|
||||
align: 0.5 0.0;
|
||||
min: 0 50;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ view_add(View_Type p, Eo *parent)
|
|||
snprintf(buf, sizeof(buf), "List Page - Item #%d", i);
|
||||
elm_list_item_append(page, buf, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
efl_gfx_hint_size_min_set(page, EINA_SIZE2D(200, 200));
|
||||
evas_object_size_hint_weight_set(page, EVAS_HINT_EXPAND,
|
||||
EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(page, EVAS_HINT_FILL,
|
||||
|
@ -880,12 +881,10 @@ test_ui_spotlight_stack(void *data EINA_UNUSED,
|
|||
efl_file_load(efl_added),
|
||||
efl_content_set(efl_part(panes, "second"), efl_added));
|
||||
|
||||
spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
|
||||
spotlight = efl_add(EFL_UI_STACK_CLASS, layout,
|
||||
efl_content_set(efl_part(layout, "pager"), efl_added),
|
||||
efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
|
||||
|
||||
efl_ui_spotlight_manager_set(spotlight, efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS));
|
||||
|
||||
efl_add(EFL_UI_BUTTON_CLASS, layout,
|
||||
efl_text_set(efl_added, "Pop"),
|
||||
efl_event_callback_add(efl_added,
|
||||
|
@ -1072,12 +1071,10 @@ test_ui_spotlight_scroll(void *data EINA_UNUSED,
|
|||
efl_file_load(efl_added),
|
||||
efl_content_set(efl_part(panes, "second"), efl_added));
|
||||
|
||||
spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
|
||||
spotlight = efl_add(EFL_UI_PAGER_CLASS, layout,
|
||||
efl_content_set(efl_part(layout, "pager"), efl_added),
|
||||
efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
|
||||
|
||||
efl_ui_spotlight_manager_set(spotlight, efl_new(EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS));
|
||||
|
||||
efl_add(EFL_UI_BUTTON_CLASS, layout,
|
||||
efl_text_set(efl_added, "Prev"),
|
||||
efl_event_callback_add(efl_added,
|
||||
|
|
|
@ -273,6 +273,8 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
|
|||
# include <efl_ui_spotlight_manager_scroll.eo.h>
|
||||
# include <efl_ui_spotlight_manager_stack.eo.h>
|
||||
# include <efl_ui_spotlight_util.eo.h>
|
||||
# include <efl_ui_stack.eo.h>
|
||||
# include <efl_ui_pager.eo.h>
|
||||
|
||||
# include <efl_ui_navigation_bar.eo.h>
|
||||
# include <efl_ui_navigation_bar_part.eo.h>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#include <Efl_Ui.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
#define MY_CLASS EFL_UI_PAGER_CLASS
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Efl_Ui_Pager_Data;
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_ui_pager_efl_object_constructor(Eo *obj, Efl_Ui_Pager_Data *sd EINA_UNUSED)
|
||||
{
|
||||
Eo *scroller;
|
||||
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
|
||||
scroller = efl_new(EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS);
|
||||
efl_ui_spotlight_manager_set(obj, scroller);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
#include "efl_ui_pager.eo.c"
|
|
@ -0,0 +1,10 @@
|
|||
class @beta Efl.Ui.Pager extends Efl.Ui.Spotlight.Container
|
||||
{
|
||||
[[A spotlight with predefined @Efl.Ui.Spotlight.Container.spotlight_manager
|
||||
|
||||
The container will slide in the content sideways, the old content will slide out.
|
||||
]]
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ typedef struct _Efl_Ui_Spotlight_Container_Data
|
|||
} transition_done;
|
||||
Efl_Ui_Spotlight_Manager *transition;
|
||||
Efl_Ui_Spotlight_Indicator *indicator;
|
||||
Eina_Size2D min, max;
|
||||
double position;
|
||||
Eina_Bool fill_width: 1;
|
||||
Eina_Bool fill_height: 1;
|
||||
|
@ -157,37 +158,48 @@ _transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data
|
|||
}
|
||||
|
||||
static void
|
||||
_resize_cb(void *data, const Efl_Event *ev)
|
||||
_emit_page_size(Efl_Ui_Spotlight_Container *obj, Efl_Ui_Spotlight_Container_Data *pd)
|
||||
{
|
||||
Efl_Ui_Spotlight_Container_Data *pd = data;
|
||||
Eina_Size2D sz;
|
||||
|
||||
sz = efl_gfx_entity_size_get(ev->object);
|
||||
sz = efl_gfx_entity_size_get(obj);
|
||||
|
||||
if (pd->fill_width) pd->page_spec.sz.w = sz.w;
|
||||
if (pd->fill_height) pd->page_spec.sz.h = sz.h;
|
||||
if (!pd->fill_width)
|
||||
sz.w = MIN(pd->page_spec.sz.w, sz.w);
|
||||
|
||||
if (!pd->fill_height)
|
||||
sz.h = MIN(pd->page_spec.sz.h, sz.h);
|
||||
|
||||
if (pd->transition)
|
||||
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
|
||||
efl_ui_spotlight_manager_size_set(pd->transition, sz);
|
||||
}
|
||||
|
||||
static void
|
||||
_resize_cb(void *data, const Efl_Event *ev)
|
||||
{
|
||||
_emit_page_size(ev->object, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_position_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||
{
|
||||
_emit_page_size(ev->object, data);
|
||||
}
|
||||
|
||||
EFL_CALLBACKS_ARRAY_DEFINE(spotlight_resized,
|
||||
{EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb},
|
||||
{EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _position_cb},
|
||||
)
|
||||
|
||||
EOLIAN static Eo *
|
||||
_efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
|
||||
Efl_Ui_Spotlight_Container_Data *pd)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "spotlight");
|
||||
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
|
||||
if (elm_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC)
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
pd->max = EINA_SIZE2D(INT_MAX, INT_MAX);
|
||||
pd->animation_enabled = EINA_TRUE;
|
||||
pd->position = -1;
|
||||
pd->curr.page = NULL;
|
||||
|
@ -203,14 +215,7 @@ _efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
|
|||
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
||||
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, pd);
|
||||
|
||||
pd->event = efl_add(EFL_CANVAS_RECTANGLE_CLASS,
|
||||
evas_object_evas_get(obj));
|
||||
evas_object_color_set(pd->event, 0, 0, 0, 0);
|
||||
evas_object_repeat_events_set(pd->event, EINA_TRUE);
|
||||
efl_content_set(efl_part(obj, "efl.event"), pd->event);
|
||||
|
||||
efl_event_callback_array_add(obj, spotlight_resized(), pd);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -265,9 +270,41 @@ _child_inv(void *data, const Efl_Event *ev)
|
|||
_unpack(data, pd, ev->object, index);
|
||||
}
|
||||
|
||||
#define ADJUST_PRIVATE_MIN_MAX(obj, subobj, pd) \
|
||||
do \
|
||||
{ \
|
||||
min = efl_gfx_hint_size_combined_min_get(subobj); \
|
||||
max = efl_gfx_hint_size_combined_max_get(subobj); \
|
||||
pd->min.w = MAX(pd->min.w, min.w); \
|
||||
pd->min.h = MAX(pd->min.h, min.h); \
|
||||
pd->max.w = MIN(pd->max.w, max.w); \
|
||||
pd->max.h = MIN(pd->max.h, max.h); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#define FLUSH_MIN_MAX(obj, pd) \
|
||||
do \
|
||||
{ \
|
||||
efl_gfx_hint_size_restricted_min_set(obj, pd->min); \
|
||||
efl_gfx_hint_size_restricted_max_set(obj, pd->max); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
static void
|
||||
_hints_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||
{
|
||||
efl_canvas_group_change(data);
|
||||
}
|
||||
|
||||
EFL_CALLBACKS_ARRAY_DEFINE(children_evt,
|
||||
{EFL_EVENT_INVALIDATE, _child_inv},
|
||||
{EFL_GFX_ENTITY_EVENT_HINTS_CHANGED, _hints_changed_cb}
|
||||
)
|
||||
|
||||
static Eina_Bool
|
||||
_register_child(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj)
|
||||
{
|
||||
Eina_Size2D min, max;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(subobj, EINA_FALSE);
|
||||
if (eina_list_data_find(pd->content_list, subobj))
|
||||
{
|
||||
|
@ -277,7 +314,10 @@ _register_child(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gf
|
|||
if (!efl_ui_widget_sub_object_add(obj, subobj))
|
||||
return EINA_FALSE;
|
||||
|
||||
efl_event_callback_add(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj);
|
||||
efl_event_callback_array_add(subobj, children_evt(), obj);
|
||||
|
||||
ADJUST_PRIVATE_MIN_MAX(obj, subobj, pd);
|
||||
FLUSH_MIN_MAX(obj, pd);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -545,7 +585,8 @@ _unpack(Eo *obj,
|
|||
pd->indicator && !pd->transition)
|
||||
efl_ui_spotlight_indicator_position_update(pd->indicator, efl_pack_index_get(obj, pd->curr.page));
|
||||
|
||||
efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj);
|
||||
efl_event_callback_array_del(subobj, children_evt(), obj);
|
||||
efl_canvas_group_change(obj);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
|
@ -649,7 +690,6 @@ _efl_ui_spotlight_container_indicator_set(Eo *obj, Efl_Ui_Spotlight_Container_Da
|
|||
{
|
||||
if (pd->indicator)
|
||||
{
|
||||
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
|
||||
efl_del(pd->indicator);
|
||||
}
|
||||
pd->indicator = indicator;
|
||||
|
@ -758,6 +798,28 @@ _efl_ui_spotlight_container_animated_transition_get(const Eo *obj EINA_UNUSED, E
|
|||
return pd->animation_enabled;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_spotlight_container_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
|
||||
{
|
||||
Efl_Ui_Widget *content;
|
||||
Eina_List *n;
|
||||
|
||||
efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
|
||||
|
||||
pd->min = EINA_SIZE2D(0,0);
|
||||
pd->max = EINA_SIZE2D(INT_MAX, INT_MAX);
|
||||
|
||||
EINA_LIST_FOREACH(pd->content_list, n, content)
|
||||
{
|
||||
Eina_Size2D min, max;
|
||||
|
||||
min = efl_gfx_hint_size_combined_min_get(content);
|
||||
max = efl_gfx_hint_size_combined_max_get(content);
|
||||
|
||||
ADJUST_PRIVATE_MIN_MAX(obj, content, pd);
|
||||
}
|
||||
FLUSH_MIN_MAX(obj, pd);
|
||||
}
|
||||
|
||||
|
||||
#include "efl_ui_spotlight_container.eo.c"
|
||||
|
|
|
@ -4,7 +4,7 @@ struct @beta Efl.Ui.Spotlight.Transition_Event {
|
|||
to : int; [[The index to where the transition is headed, -1 if not known.]]
|
||||
}
|
||||
|
||||
class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl.Pack_Linear
|
||||
class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Widget implements Efl.Pack_Linear
|
||||
{
|
||||
[[The Spotlight widget is a container for other sub-widgets, where only one sub-widget is active at any given time.
|
||||
|
||||
|
@ -131,5 +131,6 @@ class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl
|
|||
Efl.Pack_Linear.pack_content_get;
|
||||
Efl.Pack_Linear.pack_index_get;
|
||||
Efl.Pack_Linear.pack_unpack_at;
|
||||
Efl.Canvas.Group.group_calculate;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
typedef struct {
|
||||
Efl_Ui_Box *indicator;
|
||||
Efl_Ui_Spotlight_Container *container;
|
||||
Efl_Canvas_Layout *layout;
|
||||
double last_position;
|
||||
Eina_Size2D min, max;
|
||||
} Efl_Ui_Spotlight_Indicator_Icon_Data;
|
||||
|
||||
static void
|
||||
|
@ -32,6 +34,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_weight_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);
|
||||
_flush_state(item, 0.0);
|
||||
}
|
||||
|
@ -70,22 +73,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))));
|
||||
}
|
||||
|
||||
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
|
||||
_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)
|
||||
{
|
||||
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_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_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)
|
||||
{
|
||||
Eo *subobj = efl_pack_content_get(pd->container, i);
|
||||
_add_item(obj, pd);
|
||||
efl_gfx_stack_above(pd->layout, subobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +126,7 @@ _efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_add(Eo *obj,
|
|||
{
|
||||
_add_item(obj, pd);
|
||||
_flush_position(obj, pd);
|
||||
efl_gfx_stack_above(pd->layout, subobj);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -111,4 +143,16 @@ _efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_position_update(Eo *
|
|||
_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"
|
||||
|
|
|
@ -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_add;
|
||||
Efl.Ui.Spotlight.Indicator.position_update;
|
||||
Efl.Object.destructor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
typedef struct {
|
||||
Efl_Ui_Spotlight_Container * container;
|
||||
Efl_Gfx_Entity *foreclip, *backclip;
|
||||
Efl_Canvas_Rectangle *event;
|
||||
Eina_Size2D page_size;
|
||||
struct {
|
||||
Eina_Bool active;
|
||||
|
@ -47,6 +48,7 @@ _apply_box_properties(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd)
|
|||
else
|
||||
current_pos = efl_pack_index_get(pd->container, efl_ui_spotlight_active_element_get(pd->container));
|
||||
|
||||
efl_gfx_entity_geometry_set(pd->event, group_pos);
|
||||
efl_gfx_entity_geometry_set(pd->foreclip, group_pos);
|
||||
//first calculate the size
|
||||
geometry.h = pd->page_size.h;
|
||||
|
@ -174,17 +176,22 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_S
|
|||
efl_gfx_entity_visible_set(pd->backclip, EINA_FALSE);
|
||||
efl_canvas_group_member_add(spotlight, pd->backclip);
|
||||
|
||||
pd->event = efl_add(EFL_CANVAS_RECTANGLE_CLASS,
|
||||
evas_object_evas_get(obj));
|
||||
efl_canvas_object_repeat_events_set(pd->event, EINA_TRUE);
|
||||
efl_event_callback_array_add(pd->event, mouse_listeners(), obj);
|
||||
efl_canvas_group_member_add(spotlight, pd->event);
|
||||
efl_gfx_color_set(pd->event, 0, 0, 0, 0);
|
||||
|
||||
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
|
||||
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
|
||||
efl_canvas_object_clipper_set(elem, pd->backclip);
|
||||
efl_canvas_group_member_add(pd->container, elem);
|
||||
efl_gfx_entity_visible_set(elem, EINA_TRUE);
|
||||
efl_gfx_stack_above(pd->event, elem);
|
||||
}
|
||||
_apply_box_properties(obj, pd);
|
||||
|
||||
efl_event_callback_array_add(efl_content_get(efl_part(pd->container, "efl.event")), mouse_listeners(), obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -193,7 +200,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_add(Eo *obj EI
|
|||
efl_gfx_entity_visible_set(subobj, EINA_TRUE);
|
||||
efl_canvas_object_clipper_set(subobj, pd->backclip);
|
||||
efl_canvas_group_member_add(pd->container, subobj);
|
||||
|
||||
efl_gfx_stack_above(pd->event, subobj);
|
||||
if (!pd->transition.active)
|
||||
_apply_box_properties(obj, pd);
|
||||
}
|
||||
|
@ -311,7 +318,7 @@ _efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animated_transition_ge
|
|||
EOLIAN static void
|
||||
_efl_ui_spotlight_manager_scroll_efl_object_invalidate(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd EINA_UNUSED)
|
||||
{
|
||||
efl_event_callback_array_del(efl_content_get(efl_part(pd->container, "efl.event")), mouse_listeners(), obj);
|
||||
efl_del(pd->event);
|
||||
efl_del(pd->backclip);
|
||||
efl_del(pd->foreclip);
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#include <Efl_Ui.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
#define MY_CLASS EFL_UI_STACK_CLASS
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Efl_Ui_Stack_Data;
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_ui_stack_efl_object_constructor(Eo *obj, Efl_Ui_Stack_Data *sd EINA_UNUSED)
|
||||
{
|
||||
Eo *stack;
|
||||
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
|
||||
stack = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS);
|
||||
efl_ui_spotlight_manager_set(obj, stack);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
#include "efl_ui_stack.eo.c"
|
|
@ -0,0 +1,10 @@
|
|||
class @beta Efl.Ui.Stack extends Efl.Ui.Spotlight.Container
|
||||
{
|
||||
[[A spotlight with predefined @Efl.Ui.Spotlight.Container.spotlight_manager
|
||||
|
||||
The container will alpha-blend the new content over the old content.
|
||||
]]
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
}
|
||||
}
|
|
@ -188,6 +188,8 @@ pub_eo_files = [
|
|||
'efl_ui_collection_view.eo',
|
||||
'efl_ui_collection_view_focus_manager.eo',
|
||||
'efl_ui_grid_view.eo',
|
||||
'efl_ui_pager.eo',
|
||||
'efl_ui_stack.eo',
|
||||
]
|
||||
|
||||
foreach eo_file : pub_eo_files
|
||||
|
@ -944,6 +946,8 @@ elementary_src = [
|
|||
'efl_ui_select_model.c',
|
||||
'efl_ui_view_model.c',
|
||||
'efl_ui_collection_view.c',
|
||||
'efl_ui_pager.c',
|
||||
'efl_ui_stack.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]
|
||||
|
|
|
@ -255,19 +255,18 @@ EFL_START_TEST (efl_ui_spotlight_active_index)
|
|||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST (efl_ui_smart_transition_calls)
|
||||
static void
|
||||
_verify_transition_calls(int number_of_animation_calls, Eina_Bool animation_value)
|
||||
{
|
||||
Efl_Ui_Widget *w, *w1, *w2;
|
||||
Efl_Ui_Spotlight_Manager*t = _create_transition();
|
||||
|
||||
w = efl_add(WIDGET_CLASS, win);
|
||||
w1 = efl_add(WIDGET_CLASS, win);
|
||||
w2 = efl_add(WIDGET_CLASS, win);
|
||||
|
||||
efl_ui_spotlight_manager_set(container, t);
|
||||
transition_calls.last_position = -2.0;
|
||||
ck_assert_int_eq(transition_calls.animation.called, 2);
|
||||
ck_assert_int_eq(transition_calls.animation.value, EINA_TRUE);
|
||||
ck_assert_int_eq(transition_calls.animation.called, number_of_animation_calls);
|
||||
ck_assert_int_eq(transition_calls.animation.value, animation_value);
|
||||
ck_assert_int_eq(transition_calls.spotlight.called, 1);
|
||||
ck_assert_ptr_eq(transition_calls.spotlight.spotlight, container);
|
||||
//We cannot verify group
|
||||
|
@ -345,6 +344,24 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
|
|||
ck_assert_ptr_eq(transition_calls.content_del.current_page_at_call, w2);
|
||||
transition_calls.content_del.called = 0;
|
||||
}
|
||||
|
||||
EFL_START_TEST (efl_ui_smart_transition_calls)
|
||||
{
|
||||
Efl_Ui_Spotlight_Manager*t = _create_transition();
|
||||
efl_ui_spotlight_manager_set(container, t);
|
||||
|
||||
_verify_transition_calls(2, EINA_TRUE);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST (efl_ui_smart_transition_calls_no_animation)
|
||||
{
|
||||
Efl_Ui_Spotlight_Manager*t = _create_transition();
|
||||
efl_ui_spotlight_manager_set(container, t);
|
||||
efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
|
||||
|
||||
_verify_transition_calls(3, EINA_FALSE);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
|
||||
|
@ -648,6 +665,47 @@ EFL_START_TEST (efl_ui_spotlight_animated_transition)
|
|||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST (efl_ui_spotlight_min_max_sizing)
|
||||
{
|
||||
Efl_Ui_Button *btn0, *btn1;
|
||||
Eina_Size2D min, size;
|
||||
|
||||
btn0 = efl_add(WIDGET_CLASS, container);
|
||||
efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 200));
|
||||
|
||||
btn1 = efl_add(WIDGET_CLASS, container);
|
||||
efl_gfx_hint_size_min_set(btn1, EINA_SIZE2D(200, 20));
|
||||
|
||||
efl_pack_end(container, btn0);
|
||||
efl_pack_end(container, btn1);
|
||||
min = efl_gfx_hint_size_restricted_min_get(container);
|
||||
ck_assert_int_eq(min.w, 200);
|
||||
ck_assert_int_eq(min.h, 200);
|
||||
|
||||
efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 300));
|
||||
efl_canvas_group_calculate(container);
|
||||
|
||||
min = efl_gfx_hint_size_restricted_min_get(container);
|
||||
ck_assert_int_eq(min.w, 200);
|
||||
ck_assert_int_eq(min.h, 300);
|
||||
|
||||
efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 20));
|
||||
efl_canvas_group_calculate(container);
|
||||
|
||||
min = efl_gfx_hint_size_restricted_min_get(container);
|
||||
ck_assert_int_eq(min.w, 200);
|
||||
ck_assert_int_eq(min.h, 20);
|
||||
|
||||
efl_ui_spotlight_size_set(container, EINA_SIZE2D(2000, 2000));
|
||||
|
||||
efl_gfx_entity_size_set(container, EINA_SIZE2D(200, 200));
|
||||
size = efl_gfx_entity_size_get(btn0);
|
||||
ck_assert_int_eq(size.w, 200);
|
||||
ck_assert_int_eq(size.h, 200);
|
||||
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
static void
|
||||
spotlight_setup()
|
||||
{
|
||||
|
@ -674,6 +732,7 @@ void efl_ui_test_spotlight(TCase *tc)
|
|||
tcase_add_test(tc, efl_ui_spotlight_init);
|
||||
tcase_add_test(tc, efl_ui_spotlight_active_index);
|
||||
tcase_add_test(tc, efl_ui_smart_transition_calls);
|
||||
tcase_add_test(tc, efl_ui_smart_transition_calls_no_animation);
|
||||
tcase_add_test(tc, efl_ui_smart_transition_lifetime);
|
||||
tcase_add_test(tc, efl_ui_smart_indicator_calls);
|
||||
tcase_add_test(tc, efl_ui_smart_indicator_transition_calls);
|
||||
|
@ -684,4 +743,5 @@ void efl_ui_test_spotlight(TCase *tc)
|
|||
tcase_add_test(tc, efl_ui_spotlight_test_pop2);
|
||||
tcase_add_test(tc, efl_ui_spotlight_test_pop3);
|
||||
tcase_add_test(tc, efl_ui_spotlight_animated_transition);
|
||||
tcase_add_test(tc, efl_ui_spotlight_min_max_sizing);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,9 @@
|
|||
"Efl.Ui.Relative_Container",
|
||||
"Efl.Ui.Animation_View",
|
||||
"Efl.Ui.Table",
|
||||
"Efl.Ui.Flip"
|
||||
"Efl.Ui.Flip",
|
||||
"Efl.Ui.Stack",
|
||||
"Efl.Ui.Pager"
|
||||
],
|
||||
"custom-mapping" : {
|
||||
"Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS",
|
||||
|
|
Loading…
Reference in New Issue