forked from enlightenment/efl
introduce group item
this brings a group item in the style of genlist / gengrid group items. The group item theme does currently not provide the signals in the theme that would be needed for selecting it. This is kind of intended, but we might need API to express that. ref T8115 Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9583
This commit is contained in:
parent
2dfc69397b
commit
3ce3b3d48c
|
@ -208,4 +208,5 @@ collections {
|
||||||
#include "edc/efl/tab_bar.edc"
|
#include "edc/efl/tab_bar.edc"
|
||||||
#include "edc/efl/tab_page.edc"
|
#include "edc/efl/tab_page.edc"
|
||||||
#include "edc/efl/item_container.edc"
|
#include "edc/efl/item_container.edc"
|
||||||
|
#include "edc/efl/group_item.edc"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
|
||||||
|
|
||||||
|
group { "efl/group_item"; nomouse; program_source: "efl";
|
||||||
|
images.image: "shadow_square_tiny.png" COMP;
|
||||||
|
images.image: "bevel_out.png" COMP;
|
||||||
|
images.image: "horizontal_separated_bar_small_glow.png" COMP;
|
||||||
|
|
||||||
|
parts {
|
||||||
|
image { "shadow_vbar";
|
||||||
|
desc { "default";
|
||||||
|
rel1.offset: -3 -2;
|
||||||
|
rel1.to: "base_vbar";
|
||||||
|
rel2.offset: 2 4;
|
||||||
|
rel2.to: "base_vbar";
|
||||||
|
image.normal: "shadow_square_tiny.png";
|
||||||
|
image.border: 6 6 6 6;
|
||||||
|
fill.smooth: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
image { "base_vbar";
|
||||||
|
desc { "default";
|
||||||
|
image.normal: "vgrad_med_lighter.png";
|
||||||
|
fill.smooth: 0;
|
||||||
|
min: 5 13;
|
||||||
|
TILED_HORIZ(120)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
image { "bevel_vbar";
|
||||||
|
desc { "default";
|
||||||
|
rel1.to: "base_vbar";
|
||||||
|
rel2.to: "base_vbar";
|
||||||
|
image.normal: "bevel_out.png";
|
||||||
|
image.border: 1 1 1 1;
|
||||||
|
image.middle: 0;
|
||||||
|
fill.smooth: 0;
|
||||||
|
min: 5 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
text { "efl.text";
|
||||||
|
effect: SHADOW BOTTOM;
|
||||||
|
scale;
|
||||||
|
desc { "default";
|
||||||
|
rel1.offset: 2 3;
|
||||||
|
rel1.relative: 1.0 0.0;
|
||||||
|
rel1.to_x: "efl.icon";
|
||||||
|
rel2.offset: -3 -3;
|
||||||
|
rel2.relative: 0.0 1.0;
|
||||||
|
rel2.to_x: "efl.extra";
|
||||||
|
color: FN_COL_DEFAULT;
|
||||||
|
color_class: "list_group_item";
|
||||||
|
text { font: FNBD; size: 10;
|
||||||
|
min: 1 1;
|
||||||
|
ellipsis: -1;
|
||||||
|
align: 0.0 0.5;
|
||||||
|
text_class: "list_group_item";
|
||||||
|
}
|
||||||
|
link.base: "efl,state,enabled";
|
||||||
|
}
|
||||||
|
desc { "disabled";
|
||||||
|
inherit: "default";
|
||||||
|
color: FN_COL_DISABLE;
|
||||||
|
color_class: "list_group_item_disabled";
|
||||||
|
link.base: "efl,state,disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
swallow { "pad"; mouse;
|
||||||
|
desc { "default";
|
||||||
|
fixed: 1 0;
|
||||||
|
align: 0.0 0.5;
|
||||||
|
rel1.offset: 2 2;
|
||||||
|
rel2.relative: 0.0 1.0;
|
||||||
|
rel2.offset: 2 -3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
swallow { "efl.icon"; mouse;
|
||||||
|
desc { "default";
|
||||||
|
fixed: 1 0;
|
||||||
|
align: 0.0 0.5;
|
||||||
|
rel1.to_x: "pad";
|
||||||
|
rel1.relative: 1.0 0.0;
|
||||||
|
rel1.offset: -1 2;
|
||||||
|
rel2.to_x: "pad";
|
||||||
|
rel2.relative: 1.0 1.0;
|
||||||
|
rel2.offset: -1 -3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
swallow { "efl.extra"; mouse;
|
||||||
|
desc { "default";
|
||||||
|
fixed: 1 0;
|
||||||
|
align: 1.0 0.5;
|
||||||
|
rel1.offset: -3 2;
|
||||||
|
rel1.relative: 1.0 0.0;
|
||||||
|
rel2.offset: -3 -3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
image { "bar";
|
||||||
|
desc { "default";
|
||||||
|
image.normal: "horizontal_separated_bar_small_glow.png";
|
||||||
|
image.border: 4 4 4 4;
|
||||||
|
fill.smooth: 0;
|
||||||
|
fixed: 0 1;
|
||||||
|
rel1.relative: 0.0 1.0;
|
||||||
|
rel1.offset: -3 -6;
|
||||||
|
rel2.offset: 2 3;
|
||||||
|
link.base: "efl,state,enabled";
|
||||||
|
}
|
||||||
|
desc { "disabled";
|
||||||
|
inherit: "default";
|
||||||
|
color: 255 255 255 64;
|
||||||
|
link.base: "efl,state,disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -84,4 +84,13 @@ void test_efl_ui_item(void *data EINA_UNUSED,
|
||||||
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40));
|
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40));
|
||||||
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
||||||
efl_pack_end(box, o);
|
efl_pack_end(box, o);
|
||||||
|
|
||||||
|
o = _item_add(box, EFL_UI_GROUP_ITEM_CLASS, 5);
|
||||||
|
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40+40));
|
||||||
|
efl_pack_end(box, o);
|
||||||
|
|
||||||
|
o = _item_add(box, EFL_UI_GROUP_ITEM_CLASS, 6);
|
||||||
|
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40));
|
||||||
|
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
||||||
|
efl_pack_end(box, o);
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,6 +183,7 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
|
||||||
# include <efl_ui_layout_part_table.eo.h>
|
# include <efl_ui_layout_part_table.eo.h>
|
||||||
# include <efl_ui_item.eo.h>
|
# include <efl_ui_item.eo.h>
|
||||||
# include <efl_ui_default_item.eo.h>
|
# include <efl_ui_default_item.eo.h>
|
||||||
|
# include <efl_ui_group_item.eo.h>
|
||||||
# include <efl_ui_win_part.eo.h>
|
# include <efl_ui_win_part.eo.h>
|
||||||
# include <efl_ui_bg.eo.h>
|
# include <efl_ui_bg.eo.h>
|
||||||
# include <efl_ui_box.eo.h>
|
# include <efl_ui_box.eo.h>
|
||||||
|
@ -269,7 +270,8 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
|
||||||
# include <efl_ui_text_alert_popup.eo.h>
|
# include <efl_ui_text_alert_popup.eo.h>
|
||||||
# include <efl_ui_anchor_popup.eo.h>
|
# include <efl_ui_anchor_popup.eo.h>
|
||||||
# include <efl_ui_popup_part_backwall.eo.h>
|
# include <efl_ui_popup_part_backwall.eo.h>
|
||||||
|
# include <efl_ui_grid.eo.h>
|
||||||
|
# include <efl_ui_list.eo.h>
|
||||||
/**
|
/**
|
||||||
* Initialize Elementary
|
* Initialize Elementary
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,303 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EFL_UI_LIST_DEFAULT_ITEM_PROTECTED
|
||||||
|
#define EFL_PART_PROTECTED
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
|
||||||
|
#include "elm_priv.h"
|
||||||
|
#include "elm_part_helper.h"
|
||||||
|
|
||||||
|
#define MY_CLASS EFL_UI_GROUP_ITEM_CLASS
|
||||||
|
#define MY_CLASS_PFX efl_ui_group_item
|
||||||
|
|
||||||
|
#define MY_CLASS_NAME "Efl.Ui.Grid_Default_Item"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Eina_List *registered_items;
|
||||||
|
} Efl_Ui_Group_Item_Data;
|
||||||
|
|
||||||
|
EOLIAN static Efl_Object*
|
||||||
|
_efl_ui_group_item_efl_object_constructor(Eo *obj, Efl_Ui_Group_Item_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
if (!elm_widget_theme_klass_get(obj))
|
||||||
|
elm_widget_theme_klass_set(obj, "group_item");
|
||||||
|
|
||||||
|
return efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_group_item_efl_object_invalidate(Eo *obj, Efl_Ui_Group_Item_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
efl_pack_clear(obj);
|
||||||
|
efl_invalidate(efl_super(obj, MY_CLASS));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _unregister_item(Eo *obj EINA_UNUSED, Efl_Ui_Group_Item_Data *pd, Efl_Gfx_Entity *subobj);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_invalidate(void *data, const Efl_Event *ev)
|
||||||
|
{
|
||||||
|
Efl_Ui_Group_Item_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
|
||||||
|
if (!pd) return;
|
||||||
|
_unregister_item(data, pd, ev->object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_register_item(Eo *obj, Efl_Ui_Group_Item_Data *pd, Efl_Gfx_Entity *subobj)
|
||||||
|
{
|
||||||
|
efl_ui_item_parent_set(subobj, obj);
|
||||||
|
efl_event_callback_add(subobj, EFL_EVENT_INVALIDATE, _invalidate, obj);
|
||||||
|
pd->registered_items = eina_list_append(pd->registered_items, subobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_unregister_item(Eo *obj EINA_UNUSED, Efl_Ui_Group_Item_Data *pd, Efl_Gfx_Entity *subobj)
|
||||||
|
{
|
||||||
|
efl_ui_item_container_set(subobj, NULL);
|
||||||
|
efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _invalidate, obj);
|
||||||
|
pd->registered_items = eina_list_remove(pd->registered_items, subobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_pack_clear(Eo *obj EINA_UNUSED, Efl_Ui_Group_Item_Data *pd)
|
||||||
|
{
|
||||||
|
Eo *item;
|
||||||
|
|
||||||
|
while(pd->registered_items)
|
||||||
|
{
|
||||||
|
item = eina_list_data_get(pd->registered_items);
|
||||||
|
efl_del(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_unpack_all(Eo *obj, Efl_Ui_Group_Item_Data *pd)
|
||||||
|
{
|
||||||
|
Eo *item;
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, EINA_FALSE);
|
||||||
|
|
||||||
|
EINA_LIST_FREE(pd->registered_items, item)
|
||||||
|
{
|
||||||
|
efl_pack_unpack(container, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_unpack(Eo *obj, Efl_Ui_Group_Item_Data *pd, Efl_Gfx_Entity *subobj)
|
||||||
|
{
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, EINA_FALSE);
|
||||||
|
|
||||||
|
if (!efl_pack_unpack(container, subobj))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
_unregister_item(obj, pd, subobj);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HANDLE_REG_CALL(cond) \
|
||||||
|
if (!(cond)) \
|
||||||
|
{ \
|
||||||
|
_unregister_item(obj, pd, subobj); \
|
||||||
|
return EINA_FALSE; \
|
||||||
|
} \
|
||||||
|
return EINA_TRUE;
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_pack(Eo *obj, Efl_Ui_Group_Item_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(subobj == obj, EINA_FALSE);
|
||||||
|
return efl_pack_end(obj, subobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_linear_pack_end(Eo *obj, Efl_Ui_Group_Item_Data *pd, Efl_Gfx_Entity *subobj)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(subobj == obj, EINA_FALSE);
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, EINA_FALSE);
|
||||||
|
int group_index = efl_pack_index_get(container, obj);
|
||||||
|
|
||||||
|
_register_item(obj, pd, subobj);
|
||||||
|
HANDLE_REG_CALL(efl_pack_at(container, subobj, group_index + eina_list_count(pd->registered_items) + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_linear_pack_begin(Eo *obj, Efl_Ui_Group_Item_Data *pd, Efl_Gfx_Entity *subobj)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(subobj == obj, EINA_FALSE);
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, EINA_FALSE);
|
||||||
|
int group_index = efl_pack_index_get(container, obj);
|
||||||
|
|
||||||
|
_register_item(obj, pd, subobj);
|
||||||
|
HANDLE_REG_CALL(efl_pack_at(container, subobj, group_index + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_linear_pack_before(Eo *obj, Efl_Ui_Group_Item_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj, const Efl_Gfx_Entity *existing)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(subobj == obj, EINA_FALSE);
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, EINA_FALSE);
|
||||||
|
|
||||||
|
//FIXME, maybe we should check if existing is really part of this group
|
||||||
|
_register_item(obj, pd, subobj);
|
||||||
|
HANDLE_REG_CALL(efl_pack_before(container, subobj, existing));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_linear_pack_after(Eo *obj, Efl_Ui_Group_Item_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj, const Efl_Gfx_Entity *existing)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(subobj == obj, EINA_FALSE);
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, EINA_FALSE);
|
||||||
|
|
||||||
|
//FIXME, maybe we should check if existing is really part of this group
|
||||||
|
_register_item(obj, pd, subobj);
|
||||||
|
HANDLE_REG_CALL(efl_pack_after(container, subobj, existing));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_efl_ui_group_item_efl_pack_linear_pack_at(Eo *obj, Efl_Ui_Group_Item_Data *pd, Efl_Gfx_Entity *subobj, int index)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(subobj == obj, EINA_FALSE);
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, EINA_FALSE);
|
||||||
|
int group_index = efl_pack_index_get(container, obj);
|
||||||
|
|
||||||
|
int count = eina_list_count(pd->registered_items);
|
||||||
|
|
||||||
|
if (index < -count)
|
||||||
|
return efl_pack_begin(obj, subobj);
|
||||||
|
|
||||||
|
if (index >= count)
|
||||||
|
return efl_pack_end(obj, subobj);
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
index += count;
|
||||||
|
|
||||||
|
_register_item(obj, pd, subobj);
|
||||||
|
HANDLE_REG_CALL(efl_pack_at(container, subobj, group_index + 1 + index));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Efl_Gfx_Entity*
|
||||||
|
_efl_ui_group_item_efl_pack_linear_pack_unpack_at(Eo *obj, Efl_Ui_Group_Item_Data *pd, int index)
|
||||||
|
{
|
||||||
|
Eo *result, *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, NULL);
|
||||||
|
int group_index = efl_pack_index_get(container, obj);
|
||||||
|
int count = eina_list_count(pd->registered_items);
|
||||||
|
|
||||||
|
if (index <= -count)
|
||||||
|
index = 0;
|
||||||
|
else if (index >= count)
|
||||||
|
index = eina_list_count(pd->registered_items);
|
||||||
|
else if (index < 0)
|
||||||
|
index += count;
|
||||||
|
|
||||||
|
result = efl_pack_unpack_at(container, group_index + 1 + index);
|
||||||
|
if (result)
|
||||||
|
_unregister_item(obj, pd, result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static int
|
||||||
|
_efl_ui_group_item_efl_pack_linear_pack_index_get(Eo *obj, Efl_Ui_Group_Item_Data *pd, const Efl_Gfx_Entity *subobj)
|
||||||
|
{
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, -1);
|
||||||
|
int first_index = efl_pack_index_get(container, obj) + 1;
|
||||||
|
int subobj_index = efl_pack_index_get(container, subobj);
|
||||||
|
|
||||||
|
if (subobj_index == -1) return -1;
|
||||||
|
|
||||||
|
EINA_SAFETY_ON_FALSE_RETURN_VAL(first_index <= subobj_index && subobj_index < (first_index + (int)eina_list_count(pd->registered_items)), -1);
|
||||||
|
|
||||||
|
return subobj_index - (first_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Efl_Gfx_Entity*
|
||||||
|
_efl_ui_group_item_efl_pack_linear_pack_content_get(Eo *obj, Efl_Ui_Group_Item_Data *pd EINA_UNUSED, int index)
|
||||||
|
{
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, NULL);
|
||||||
|
int group_index = efl_pack_index_get(container, obj);
|
||||||
|
|
||||||
|
int count = eina_list_count(pd->registered_items);
|
||||||
|
|
||||||
|
if (index <= -count)
|
||||||
|
return eina_list_data_get(pd->registered_items);
|
||||||
|
|
||||||
|
if (index >= count)
|
||||||
|
return eina_list_last_data_get(pd->registered_items);
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
index += count;
|
||||||
|
|
||||||
|
|
||||||
|
return efl_pack_content_get(container, group_index + 1 + index);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Eina_Iterator iterator;
|
||||||
|
unsigned int current;
|
||||||
|
unsigned int max;
|
||||||
|
Eo *container;
|
||||||
|
} Efl_Ui_Group_Item_Iterator;
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_next_item(Efl_Ui_Group_Item_Iterator *it, void **data)
|
||||||
|
{
|
||||||
|
if (it->current >= it->max) return EINA_FALSE;
|
||||||
|
|
||||||
|
*data = efl_pack_content_get(it->container, it->current);
|
||||||
|
it->current++;
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Iterator*
|
||||||
|
_efl_ui_group_item_efl_container_content_iterate(Eo *obj, Efl_Ui_Group_Item_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Eo *container = efl_ui_item_container_get(obj);
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(container, NULL);
|
||||||
|
Efl_Ui_Group_Item_Iterator *it;
|
||||||
|
|
||||||
|
it = calloc(1, sizeof (Efl_Ui_Group_Item_Iterator));
|
||||||
|
if (!it) return NULL;
|
||||||
|
|
||||||
|
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
|
||||||
|
|
||||||
|
it->current = efl_pack_index_get(container, obj) + 1;
|
||||||
|
it->max = it->current + eina_list_count(pd->registered_items);
|
||||||
|
it->container = container;
|
||||||
|
|
||||||
|
it->iterator.version = EINA_ITERATOR_VERSION;
|
||||||
|
it->iterator.next = FUNC_ITERATOR_NEXT(_next_item);
|
||||||
|
it->iterator.get_container = NULL;
|
||||||
|
it->iterator.free = FUNC_ITERATOR_FREE(free);
|
||||||
|
|
||||||
|
return &it->iterator;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static int
|
||||||
|
_efl_ui_group_item_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Group_Item_Data *pd)
|
||||||
|
{
|
||||||
|
return eina_list_count(pd->registered_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "efl_ui_group_item.eo.c"
|
|
@ -0,0 +1,22 @@
|
||||||
|
class @beta Efl.Ui.Group_Item extends Efl.Ui.Default_Item implements Efl.Pack_Linear
|
||||||
|
{
|
||||||
|
[[Group item for grids and lists]]
|
||||||
|
implements {
|
||||||
|
Efl.Object.constructor;
|
||||||
|
Efl.Object.invalidate;
|
||||||
|
Efl.Pack.pack_clear;
|
||||||
|
Efl.Pack.unpack_all;
|
||||||
|
Efl.Pack.unpack;
|
||||||
|
Efl.Pack.pack;
|
||||||
|
Efl.Pack_Linear.pack_end;
|
||||||
|
Efl.Pack_Linear.pack_begin;
|
||||||
|
Efl.Pack_Linear.pack_before;
|
||||||
|
Efl.Pack_Linear.pack_after;
|
||||||
|
Efl.Pack_Linear.pack_at;
|
||||||
|
Efl.Pack_Linear.pack_unpack_at;
|
||||||
|
Efl.Pack_Linear.pack_index_get;
|
||||||
|
Efl.Pack_Linear.pack_content_get;
|
||||||
|
Efl.Container.content_iterate;
|
||||||
|
Efl.Container.content_count;
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,9 +17,9 @@ _item_select(Eo *obj, Efl_Ui_Item_Data *pd)
|
||||||
{
|
{
|
||||||
Efl_Ui_Select_Mode m;
|
Efl_Ui_Select_Mode m;
|
||||||
|
|
||||||
if (pd->parent)
|
if (pd->container)
|
||||||
{
|
{
|
||||||
m = efl_ui_select_mode_get(pd->parent);
|
m = efl_ui_select_mode_get(pd->container);
|
||||||
if (m == EFL_UI_SELECT_MODE_NONE || (pd->selected && m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS))
|
if (m == EFL_UI_SELECT_MODE_NONE || (pd->selected && m != EFL_UI_SELECT_MODE_SINGLE_ALWAYS))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ _efl_ui_item_efl_object_destructor(Eo *obj, Efl_Ui_Item_Data *pd EINA_UNUSED)
|
||||||
EOLIAN static int
|
EOLIAN static int
|
||||||
_efl_ui_item_index_get(const Eo *obj, Efl_Ui_Item_Data *pd)
|
_efl_ui_item_index_get(const Eo *obj, Efl_Ui_Item_Data *pd)
|
||||||
{
|
{
|
||||||
return efl_pack_index_get(pd->parent, obj);
|
return efl_pack_index_get(pd->container, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -142,15 +142,48 @@ _efl_ui_item_efl_ui_selectable_selected_get(const Eo *obj EINA_UNUSED, Efl_Ui_It
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_item_container_set(Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd, Efl_Ui_Widget *container)
|
_efl_ui_item_container_set(Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd, Efl_Ui_Widget *container)
|
||||||
{
|
{
|
||||||
pd->parent = container;
|
pd->container = container;
|
||||||
|
if (!pd->container)
|
||||||
|
{
|
||||||
|
pd->parent = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Efl_Ui_Widget*
|
EOLIAN static Efl_Ui_Widget*
|
||||||
_efl_ui_item_container_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd)
|
_efl_ui_item_container_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd)
|
||||||
|
{
|
||||||
|
return pd->container;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_item_item_parent_set(Eo *obj, Efl_Ui_Item_Data *pd, Efl_Ui_Item *parent)
|
||||||
|
{
|
||||||
|
if (pd->parent)
|
||||||
|
{
|
||||||
|
ERR("Parent is already set on object %p", obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (efl_invalidated_get(obj) || efl_invalidating_get(obj))
|
||||||
|
{
|
||||||
|
ERR("Parent cannot be set during invalidate");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pd->container)
|
||||||
|
{
|
||||||
|
ERR("Parent must be set before adding the object to the container");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pd->parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EOLIAN static Efl_Ui_Item*
|
||||||
|
_efl_ui_item_item_parent_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd)
|
||||||
{
|
{
|
||||||
return pd->parent;
|
return pd->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "efl_ui_item.eo.c"
|
#include "efl_ui_item.eo.c"
|
||||||
#include "efl_ui_selectable.eo.c"
|
#include "efl_ui_selectable.eo.c"
|
||||||
#include "efl_ui_multi_selectable.eo.c"
|
#include "efl_ui_multi_selectable.eo.c"
|
||||||
|
|
|
@ -40,6 +40,15 @@ abstract @beta Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectab
|
||||||
container : Efl.Ui.Widget; [[The container this item is in.]]
|
container : Efl.Ui.Widget; [[The container this item is in.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@property item_parent {
|
||||||
|
[[The parent of the item.
|
||||||
|
|
||||||
|
This property expresses a tree structure of items. If the parent is NULL the item is added in the root level of the content. The item parent can only be set once, when the object is invalidated, the item parent is set to NULL and still cannot be reset.
|
||||||
|
]]
|
||||||
|
values {
|
||||||
|
parent : Efl.Ui.Item;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
implements {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
typedef struct _Efl_Ui_Item_Data
|
typedef struct _Efl_Ui_Item_Data
|
||||||
{
|
{
|
||||||
// Eo Objects
|
// Eo Objects
|
||||||
Eo *parent; /* Parent Widget */
|
Eo *container; /* Parent Widget */
|
||||||
|
Efl_Ui_Item *parent;
|
||||||
|
|
||||||
// Boolean Data
|
// Boolean Data
|
||||||
Eina_Bool selected : 1; /* State for item selected */
|
Eina_Bool selected : 1; /* State for item selected */
|
||||||
|
|
|
@ -118,6 +118,7 @@ pub_eo_files = [
|
||||||
'efl_ui_list_view_pan.eo',
|
'efl_ui_list_view_pan.eo',
|
||||||
'efl_ui_item.eo',
|
'efl_ui_item.eo',
|
||||||
'efl_ui_default_item.eo',
|
'efl_ui_default_item.eo',
|
||||||
|
'efl_ui_group_item.eo',
|
||||||
'efl_ui_list_default_item.eo',
|
'efl_ui_list_default_item.eo',
|
||||||
'efl_ui_list_placeholder_item.eo',
|
'efl_ui_list_placeholder_item.eo',
|
||||||
'efl_ui_list.eo',
|
'efl_ui_list.eo',
|
||||||
|
@ -893,6 +894,7 @@ elementary_src = [
|
||||||
'elm_widget_item_static_focus.c',
|
'elm_widget_item_static_focus.c',
|
||||||
'efl_ui_item.c',
|
'efl_ui_item.c',
|
||||||
'efl_ui_default_item.c',
|
'efl_ui_default_item.c',
|
||||||
|
'efl_ui_group_item.c',
|
||||||
'efl_ui_list_default_item.c',
|
'efl_ui_list_default_item.c',
|
||||||
'efl_ui_list_placeholder_item.c',
|
'efl_ui_list_placeholder_item.c',
|
||||||
'efl_ui_list.c',
|
'efl_ui_list.c',
|
||||||
|
|
|
@ -6,6 +6,21 @@
|
||||||
#include "efl_ui_spec_suite.h"
|
#include "efl_ui_spec_suite.h"
|
||||||
#include "suite_helpers.h"
|
#include "suite_helpers.h"
|
||||||
|
|
||||||
|
|
||||||
|
Efl_Ui_Widget*
|
||||||
|
efl_test_parent_get(Eo *obj)
|
||||||
|
{
|
||||||
|
if (efl_isa(widget, EFL_UI_GROUP_ITEM_CLASS))
|
||||||
|
{
|
||||||
|
return efl_ui_item_parent_get(obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return efl_ui_widget_parent_get(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len)
|
efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,7 +137,7 @@ EFL_START_TEST(unpack1)
|
||||||
_setup_std_pack(wid);
|
_setup_std_pack(wid);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_unpack(widget, wid[2]), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_unpack(widget, wid[2]), EINA_TRUE);
|
||||||
ck_assert_ptr_ne(efl_ui_widget_parent_get(wid[2]), widget);
|
ck_assert_ptr_ne(efl_test_parent_get(wid[2]), widget);
|
||||||
ck_assert_int_eq(efl_ref_count(wid[2]), 1);
|
ck_assert_int_eq(efl_ref_count(wid[2]), 1);
|
||||||
efl_test_container_content_equal(wid, 2);
|
efl_test_container_content_equal(wid, 2);
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ EFL_START_TEST(pack1)
|
||||||
for (i = 0; i < sizeof(wid)/sizeof(Efl_Ui_Widget*); ++i)
|
for (i = 0; i < sizeof(wid)/sizeof(Efl_Ui_Widget*); ++i)
|
||||||
{
|
{
|
||||||
ck_assert_int_eq(efl_ref_count(wid[i]), 1);
|
ck_assert_int_eq(efl_ref_count(wid[i]), 1);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
efl_test_container_content_equal(wid, 3);
|
efl_test_container_content_equal(wid, 3);
|
||||||
|
@ -292,6 +292,7 @@ EFL_END_TEST
|
||||||
void
|
void
|
||||||
efl_pack_behavior_test(TCase *tc)
|
efl_pack_behavior_test(TCase *tc)
|
||||||
{
|
{
|
||||||
|
tcase_add_test(tc, pack2);
|
||||||
tcase_add_test(tc, base2);
|
tcase_add_test(tc, base2);
|
||||||
tcase_add_test(tc, pack_clear1);
|
tcase_add_test(tc, pack_clear1);
|
||||||
tcase_add_test(tc, pack_clear2);
|
tcase_add_test(tc, pack_clear2);
|
||||||
|
@ -301,7 +302,6 @@ efl_pack_behavior_test(TCase *tc)
|
||||||
tcase_add_test(tc, unpack2);
|
tcase_add_test(tc, unpack2);
|
||||||
tcase_add_test(tc, unpack3);
|
tcase_add_test(tc, unpack3);
|
||||||
tcase_add_test(tc, pack1);
|
tcase_add_test(tc, pack1);
|
||||||
tcase_add_test(tc, pack2);
|
|
||||||
tcase_add_test(tc, pack3);
|
tcase_add_test(tc, pack3);
|
||||||
tcase_add_test(tc, evt_content_added);
|
tcase_add_test(tc, evt_content_added);
|
||||||
tcase_add_test(tc, evt_content_removed);
|
tcase_add_test(tc, evt_content_removed);
|
||||||
|
|
|
@ -9,10 +9,11 @@
|
||||||
|
|
||||||
/* spec-meta-start
|
/* spec-meta-start
|
||||||
{"test-interface":"Efl.Pack_Linear",
|
{"test-interface":"Efl.Pack_Linear",
|
||||||
"test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid", "Efl.Ui.Spotlight.Container", "Efl.Ui.List"],
|
"test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid", "Efl.Ui.Spotlight.Container", "Efl.Ui.List", "Efl.Ui.Group_Item" ],
|
||||||
"custom-mapping" : {
|
"custom-mapping" : {
|
||||||
"Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS",
|
"Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS",
|
||||||
"Efl.Ui.List" : "EFL_UI_LIST_DEFAULT_ITEM_CLASS"
|
"Efl.Ui.List" : "EFL_UI_LIST_DEFAULT_ITEM_CLASS",
|
||||||
|
"Efl.Ui.Group_Item" : "EFL_UI_LIST_DEFAULT_ITEM_CLASS"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spec-meta-end */
|
spec-meta-end */
|
||||||
|
@ -46,7 +47,7 @@ EFL_START_TEST(pack_begin1)
|
||||||
for (int i = 2; i >= 0; i--)
|
for (int i = 2; i >= 0; i--)
|
||||||
{
|
{
|
||||||
efl_pack_begin(widget, wid[i]);
|
efl_pack_begin(widget, wid[i]);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
|
||||||
}
|
}
|
||||||
_ordering_equals(wid, 3);
|
_ordering_equals(wid, 3);
|
||||||
efl_pack_begin(widget, inv);
|
efl_pack_begin(widget, inv);
|
||||||
|
@ -65,7 +66,7 @@ EFL_START_TEST(pack_begin2)
|
||||||
for (int i = 2; i >= 0; i--)
|
for (int i = 2; i >= 0; i--)
|
||||||
{
|
{
|
||||||
efl_pack_begin(widget, wid[i]);
|
efl_pack_begin(widget, wid[i]);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_ERROR_START;
|
EXPECT_ERROR_START;
|
||||||
|
@ -85,7 +86,7 @@ EFL_START_TEST(pack_end1)
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ordering_equals(wid, 3);
|
_ordering_equals(wid, 3);
|
||||||
|
@ -105,7 +106,7 @@ EFL_START_TEST(pack_end2)
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_ERROR_START;
|
EXPECT_ERROR_START;
|
||||||
|
@ -126,13 +127,13 @@ EFL_START_TEST(pack_before1)
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2]};
|
Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2]};
|
||||||
_ordering_equals(wid2, 4);
|
_ordering_equals(wid2, 4);
|
||||||
efl_pack_unpack(widget, inv);
|
efl_pack_unpack(widget, inv);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_before(widget, inv, wid[2]), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_before(widget, inv, wid[2]), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
Efl_Ui_Widget *wid3[] = {wid[0], wid[1], inv, wid[2]};
|
Efl_Ui_Widget *wid3[] = {wid[0], wid[1], inv, wid[2]};
|
||||||
_ordering_equals(wid3, 4);
|
_ordering_equals(wid3, 4);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +150,7 @@ EFL_START_TEST(pack_before2)
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2]};
|
Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2]};
|
||||||
_ordering_equals(wid2, 4);
|
_ordering_equals(wid2, 4);
|
||||||
|
|
||||||
|
@ -170,13 +171,13 @@ EFL_START_TEST(pack_after1)
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
Efl_Ui_Widget *wid2[] = {wid[0], inv, wid[1], wid[2]};
|
Efl_Ui_Widget *wid2[] = {wid[0], inv, wid[1], wid[2]};
|
||||||
_ordering_equals(wid2, 4);
|
_ordering_equals(wid2, 4);
|
||||||
efl_pack_unpack(widget, inv);
|
efl_pack_unpack(widget, inv);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_after(widget, inv, wid[2]), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_after(widget, inv, wid[2]), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
Efl_Ui_Widget *wid3[] = {wid[0], wid[1], wid[2], inv};
|
Efl_Ui_Widget *wid3[] = {wid[0], wid[1], wid[2], inv};
|
||||||
_ordering_equals(wid3, 4);
|
_ordering_equals(wid3, 4);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +194,7 @@ EFL_START_TEST(pack_after2)
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
Efl_Ui_Widget *wid2[] = {wid[0], inv, wid[1], wid[2]};
|
Efl_Ui_Widget *wid2[] = {wid[0], inv, wid[1], wid[2]};
|
||||||
_ordering_equals(wid2, 4);
|
_ordering_equals(wid2, 4);
|
||||||
|
|
||||||
|
@ -216,7 +217,7 @@ EFL_START_TEST(pack_at1)
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
|
|
||||||
efl_pack_at(widget, inv, x);
|
efl_pack_at(widget, inv, x);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
|
|
||||||
for (i = 0; i < 4; ++i)
|
for (i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +248,7 @@ EFL_START_TEST(pack_at2)
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_at(widget, inv, x), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_at(widget, inv, x), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
|
|
||||||
EXPECT_ERROR_START;
|
EXPECT_ERROR_START;
|
||||||
ck_assert_int_eq(efl_pack_at(widget, inv, x - 1), EINA_FALSE);
|
ck_assert_int_eq(efl_pack_at(widget, inv, x - 1), EINA_FALSE);
|
||||||
|
@ -281,9 +282,9 @@ EFL_START_TEST(pack_at3)
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
|
|
||||||
ck_assert_int_eq(efl_pack_at(widget, inv,-100000), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_at(widget, inv,-100000), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv), widget);
|
||||||
ck_assert_int_eq(efl_pack_at(widget, inv2, 100000), EINA_TRUE);
|
ck_assert_int_eq(efl_pack_at(widget, inv2, 100000), EINA_TRUE);
|
||||||
ck_assert_ptr_eq(efl_ui_widget_parent_get(inv2), widget);
|
ck_assert_ptr_eq(efl_test_parent_get(inv2), widget);
|
||||||
Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2], inv2};
|
Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2], inv2};
|
||||||
_ordering_equals(wid2, 5);
|
_ordering_equals(wid2, 5);
|
||||||
}
|
}
|
||||||
|
@ -377,15 +378,27 @@ EFL_START_TEST(pack_unpack_at3)
|
||||||
efl_pack_end(widget, wid[i]);
|
efl_pack_end(widget, wid[i]);
|
||||||
ck_assert_ptr_eq(efl_pack_unpack_at(widget, x), wid[(3+x)%3]);
|
ck_assert_ptr_eq(efl_pack_unpack_at(widget, x), wid[(3+x)%3]);
|
||||||
ck_assert_int_eq(efl_content_count(widget), 2);
|
ck_assert_int_eq(efl_content_count(widget), 2);
|
||||||
ck_assert_ptr_ne(efl_ui_widget_parent_get(wid[(3+x)%3]), widget);
|
ck_assert_ptr_ne(efl_test_parent_get(wid[(3+x)%3]), widget);
|
||||||
efl_pack_unpack_all(widget);
|
efl_pack_unpack_all(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
void
|
||||||
|
object_setup(void)
|
||||||
|
{
|
||||||
|
if (efl_isa(widget, EFL_UI_GROUP_ITEM_CLASS))
|
||||||
|
{
|
||||||
|
Efl_Ui_Collection *collection = efl_add(EFL_UI_GRID_CLASS, win);
|
||||||
|
efl_content_set(win, collection);
|
||||||
|
efl_pack_end(collection, widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
efl_pack_linear_behavior_test(TCase *tc)
|
efl_pack_linear_behavior_test(TCase *tc)
|
||||||
{
|
{
|
||||||
|
tcase_add_checked_fixture(tc, object_setup, NULL);
|
||||||
tcase_add_test(tc, pack_begin1);
|
tcase_add_test(tc, pack_begin1);
|
||||||
tcase_add_test(tc, pack_begin2);
|
tcase_add_test(tc, pack_begin2);
|
||||||
tcase_add_test(tc, pack_end1);
|
tcase_add_test(tc, pack_end1);
|
||||||
|
|
|
@ -25,6 +25,7 @@ void efl_ui_selectable_behavior_test(TCase *tc);
|
||||||
|
|
||||||
void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len);
|
void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len);
|
||||||
void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data);
|
void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data);
|
||||||
|
Efl_Ui_Widget* efl_test_parent_get(Eo *obj);
|
||||||
|
|
||||||
Eo* create_test_widget(void);
|
Eo* create_test_widget(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue