efl_ui_list_view: Hide SegArray and PreciseLayouter
Summary: Changed seg_array eolian class to struct Changed PreciseLayouter and Relayout to private eolian Removed relayout set/get in Efl.Ui.List.View Reviewers: cedric, felipealmeida, SanghyeonLee Reviewed By: cedric, felipealmeida, SanghyeonLee Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7724
This commit is contained in:
parent
b735376ed5
commit
7e0a5a7cf2
|
@ -81,8 +81,6 @@ elm_public_eolian_files = \
|
||||||
lib/elementary/efl_ui_list_view.eo \
|
lib/elementary/efl_ui_list_view.eo \
|
||||||
lib/elementary/efl_ui_list_view_model.eo \
|
lib/elementary/efl_ui_list_view_model.eo \
|
||||||
lib/elementary/efl_ui_list_view_pan.eo \
|
lib/elementary/efl_ui_list_view_pan.eo \
|
||||||
lib/elementary/efl_ui_list_view_seg_array.eo \
|
|
||||||
lib/elementary/efl_ui_list_view_relayout.eo \
|
|
||||||
lib/elementary/efl_ui_item.eo \
|
lib/elementary/efl_ui_item.eo \
|
||||||
lib/elementary/efl_ui_list_item.eo \
|
lib/elementary/efl_ui_list_item.eo \
|
||||||
lib/elementary/efl_ui_list_default_item_part_icon.eo \
|
lib/elementary/efl_ui_list_default_item_part_icon.eo \
|
||||||
|
@ -175,6 +173,8 @@ elm_private_eolian_files = \
|
||||||
tests/elementary/focus_test_sub_main.eo \
|
tests/elementary/focus_test_sub_main.eo \
|
||||||
lib/elementary/efl_ui_selection_manager.eo \
|
lib/elementary/efl_ui_selection_manager.eo \
|
||||||
lib/elementary/efl_datetime_manager.eo \
|
lib/elementary/efl_datetime_manager.eo \
|
||||||
|
lib/elementary/efl_ui_list_view_relayout.eo \
|
||||||
|
lib/elementary/efl_ui_list_view_precise_layouter.eo \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# Legacy classes - not part of public EO API
|
# Legacy classes - not part of public EO API
|
||||||
|
@ -284,7 +284,6 @@ elm_legacy_eolian_files = \
|
||||||
lib/elementary/elm_slideshow_item.eo \
|
lib/elementary/elm_slideshow_item.eo \
|
||||||
lib/elementary/elm_table.eo \
|
lib/elementary/elm_table.eo \
|
||||||
lib/elementary/elm_thumb.eo \
|
lib/elementary/elm_thumb.eo \
|
||||||
lib/elementary/efl_ui_list_view_precise_layouter.eo \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
elm_eolian_type_files = \
|
elm_eolian_type_files = \
|
||||||
|
|
|
@ -344,7 +344,6 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
|
||||||
# include <efl_ui_grid.eo.h>
|
# include <efl_ui_grid.eo.h>
|
||||||
# include <efl_ui_list_view_types.eot.h>
|
# include <efl_ui_list_view_types.eot.h>
|
||||||
# include <efl_ui_list_view_seg_array.h>
|
# include <efl_ui_list_view_seg_array.h>
|
||||||
# include <efl_ui_list_view_seg_array.eo.h>
|
|
||||||
# include <efl_ui_list_view_model.eo.h>
|
# include <efl_ui_list_view_model.eo.h>
|
||||||
# include <efl_ui_list_view_relayout.eo.h>
|
# include <efl_ui_list_view_relayout.eo.h>
|
||||||
# include <efl_ui_list_view.eo.h>
|
# include <efl_ui_list_view.eo.h>
|
||||||
|
|
|
@ -675,7 +675,7 @@ _efl_ui_list_view_efl_object_constructor(Eo *obj, Efl_Ui_List_View_Data *pd)
|
||||||
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
||||||
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_LIST);
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_LIST);
|
||||||
|
|
||||||
pd->seg_array = efl_new(EFL_UI_LIST_VIEW_SEG_ARRAY_CLASS, efl_ui_list_view_seg_array_setup(efl_added, 32));
|
pd->seg_array = efl_ui_list_view_seg_array_setup(32);
|
||||||
|
|
||||||
efl_event_callback_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED, _list_element_focused, NULL);
|
efl_event_callback_add(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED, _list_element_focused, NULL);
|
||||||
|
|
||||||
|
@ -703,8 +703,7 @@ _efl_ui_list_view_efl_object_destructor(Eo *obj, Efl_Ui_List_View_Data *pd)
|
||||||
efl_replace(&pd->relayout, NULL);
|
efl_replace(&pd->relayout, NULL);
|
||||||
efl_replace(&pd->factory, NULL);
|
efl_replace(&pd->factory, NULL);
|
||||||
|
|
||||||
efl_ui_list_view_seg_array_flush(pd->seg_array);
|
efl_ui_list_view_seg_array_free(pd->seg_array);
|
||||||
efl_unref(pd->seg_array);
|
|
||||||
|
|
||||||
eina_stringshare_del(pd->style);
|
eina_stringshare_del(pd->style);
|
||||||
efl_destructor(efl_super(obj, MY_CLASS));
|
efl_destructor(efl_super(obj, MY_CLASS));
|
||||||
|
@ -831,19 +830,6 @@ _efl_ui_list_view_item_select_set(Efl_Ui_List_View_Layout_Item *item, Eina_Bool
|
||||||
eina_stringshare_del(sprop);
|
eina_stringshare_del(sprop);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_efl_ui_list_view_relayout_set(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED, Efl_Ui_List_View_Relayout *object)
|
|
||||||
{
|
|
||||||
if (efl_replace(&pd->relayout, object) && pd->model && pd->relayout)
|
|
||||||
efl_ui_list_view_relayout_model_set(pd->relayout, pd->model);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Efl_Ui_List_View_Relayout *
|
|
||||||
_efl_ui_list_view_relayout_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Data *pd EINA_UNUSED)
|
|
||||||
{
|
|
||||||
return pd->relayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Value
|
static Eina_Value
|
||||||
_children_slice_then(void * data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED)
|
_children_slice_then(void * data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,11 +11,6 @@ class Efl.Ui.List_View extends Efl.Ui.Layout implements Efl.Ui.Scrollable_Intera
|
||||||
Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.List_View_Model, Efl.Ui.Widget_Focus_Manager
|
Efl.Ui.Clickable, Efl.Ui.Selectable, Efl.Ui.List_View_Model, Efl.Ui.Widget_Focus_Manager
|
||||||
{
|
{
|
||||||
methods {
|
methods {
|
||||||
@property relayout {
|
|
||||||
values {
|
|
||||||
object: Efl.Ui.List_View_Relayout;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@property homogeneous {
|
@property homogeneous {
|
||||||
get {
|
get {
|
||||||
[[Get whether the homogeneous mode is enabled.]]
|
[[Get whether the homogeneous mode is enabled.]]
|
||||||
|
@ -83,12 +78,8 @@ class Efl.Ui.List_View extends Efl.Ui.Layout implements Efl.Ui.Scrollable_Intera
|
||||||
Efl.Ui.Focus.Composition.prepare;
|
Efl.Ui.Focus.Composition.prepare;
|
||||||
Efl.Ui.View.model { get; set; }
|
Efl.Ui.View.model { get; set; }
|
||||||
|
|
||||||
// Efl.Ui.Scrollable_Interactive.scroll;
|
|
||||||
Efl.Layout.Signal.signal_callback_add;
|
Efl.Layout.Signal.signal_callback_add;
|
||||||
Efl.Layout.Signal.signal_callback_del;
|
Efl.Layout.Signal.signal_callback_del;
|
||||||
// Elm.Interface.Atspi_Accessible.children { get; }
|
|
||||||
// Elm.Interface.Atspi_Widget.Action.elm_actions { get; }
|
|
||||||
// Efl.Access.Widget.Action.elm_actions { get; }
|
|
||||||
Efl.Access.Object.access_children { get; }
|
Efl.Access.Object.access_children { get; }
|
||||||
Efl.Access.Selection.selected_children_count { get; }
|
Efl.Access.Selection.selected_children_count { get; }
|
||||||
Efl.Access.Selection.selected_child { get; }
|
Efl.Access.Selection.selected_child { get; }
|
||||||
|
|
|
@ -21,13 +21,6 @@ interface Efl.Ui.List_View_Model extends Efl.Interface
|
||||||
item: ptr(Efl.Ui.List_View_Layout_Item);
|
item: ptr(Efl.Ui.List_View_Layout_Item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @property visible_range {
|
|
||||||
// set {}
|
|
||||||
// values {
|
|
||||||
// first: int;
|
|
||||||
// count: int;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@property model_size {
|
@property model_size {
|
||||||
get {}
|
get {}
|
||||||
values {
|
values {
|
||||||
|
|
|
@ -353,7 +353,7 @@ _initilize(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd, Efl_
|
||||||
pd->recalc = EINA_TRUE;
|
pd->recalc = EINA_TRUE;
|
||||||
pd->initialized = EINA_TRUE;
|
pd->initialized = EINA_TRUE;
|
||||||
|
|
||||||
efl_replace(&pd->seg_array, seg_array);
|
pd->seg_array = seg_array;
|
||||||
|
|
||||||
efl_ui_list_view_model_load_range_set(pd->modeler, 0, pd->count_total); // load all
|
efl_ui_list_view_model_load_range_set(pd->modeler, 0, pd->count_total); // load all
|
||||||
efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILD_ADDED, _child_added_cb, pd);
|
efl_event_callback_add(pd->model, EFL_MODEL_EVENT_CHILD_ADDED, _child_added_cb, pd);
|
||||||
|
@ -400,7 +400,7 @@ _finalize(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Precise_Layouter_Data *pd)
|
||||||
efl_ui_list_view_model_min_size_set(pd->modeler, pd->min);
|
efl_ui_list_view_model_min_size_set(pd->modeler, pd->min);
|
||||||
}
|
}
|
||||||
|
|
||||||
efl_replace(&pd->seg_array, NULL);
|
pd->seg_array = NULL;
|
||||||
efl_replace(&pd->modeler, NULL);
|
efl_replace(&pd->modeler, NULL);
|
||||||
|
|
||||||
pd->initialized = EINA_FALSE;
|
pd->initialized = EINA_FALSE;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
type @extern Efl_Ui_List_View_Seg_Array: __undefined_type;
|
||||||
|
|
||||||
interface Efl.Ui.List_View_Relayout extends Efl.Interface
|
interface Efl.Ui.List_View_Relayout extends Efl.Interface
|
||||||
{
|
{
|
||||||
methods {
|
methods {
|
||||||
|
@ -5,7 +7,7 @@ interface Efl.Ui.List_View_Relayout extends Efl.Interface
|
||||||
params {
|
params {
|
||||||
modeler: Efl.Ui.List_View_Model;
|
modeler: Efl.Ui.List_View_Model;
|
||||||
first: int;
|
first: int;
|
||||||
children: Efl.Ui.List_View_Seg_Array;
|
children: ptr(Efl_Ui_List_View_Seg_Array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
content_created {
|
content_created {
|
||||||
|
|
|
@ -5,13 +5,11 @@
|
||||||
#include <Efl.h>
|
#include <Efl.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define MY_CLASS EFL_UI_LIST_VIEW_SEG_ARRAY_CLASS
|
|
||||||
#define MY_CLASS_NAME "Efl.Ui.List_View_Seg_Array"
|
|
||||||
|
|
||||||
#include "efl_ui_list_view_private.h"
|
#include "efl_ui_list_view_private.h"
|
||||||
#include "efl_ui_list_view_seg_array.h"
|
#include "efl_ui_list_view_seg_array.h"
|
||||||
|
|
||||||
static int _search_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int length EINA_UNUSED, void* data EINA_UNUSED)
|
static int
|
||||||
|
_search_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int length EINA_UNUSED, void* data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Seg_Array_Node const* node = (void const*)rbtree;
|
Efl_Ui_List_View_Seg_Array_Node const* node = (void const*)rbtree;
|
||||||
int index = *(int*)key;
|
int index = *(int*)key;
|
||||||
|
@ -29,7 +27,8 @@ static int _search_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int len
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _insert_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int length EINA_UNUSED, void* data EINA_UNUSED)
|
static int
|
||||||
|
_insert_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int length EINA_UNUSED, void* data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Seg_Array_Node const* node = (void const*)rbtree;
|
Efl_Ui_List_View_Seg_Array_Node const* node = (void const*)rbtree;
|
||||||
int index = *(int*)key;
|
int index = *(int*)key;
|
||||||
|
@ -47,7 +46,8 @@ static int _insert_lookup_cb(Eina_Rbtree const* rbtree, const void* key, int len
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Rbtree_Direction _rbtree_compare(Efl_Ui_List_View_Seg_Array_Node const* left,
|
static Eina_Rbtree_Direction
|
||||||
|
_rbtree_compare(Efl_Ui_List_View_Seg_Array_Node const* left,
|
||||||
Efl_Ui_List_View_Seg_Array_Node const* right, void* data EINA_UNUSED)
|
Efl_Ui_List_View_Seg_Array_Node const* right, void* data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
if(left->first < right->first)
|
if(left->first < right->first)
|
||||||
|
@ -73,7 +73,7 @@ _free_node(Efl_Ui_List_View_Seg_Array_Node* node, void* data EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Efl_Ui_List_View_Seg_Array_Node*
|
static Efl_Ui_List_View_Seg_Array_Node*
|
||||||
_alloc_node(Efl_Ui_List_View_Seg_Array_Data* pd, int first)
|
_alloc_node(Efl_Ui_List_View_Seg_Array* pd, int first)
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Seg_Array_Node* node;
|
Efl_Ui_List_View_Seg_Array_Node* node;
|
||||||
node = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array_Node) + pd->step_size*sizeof(Efl_Ui_List_View_Layout_Item*));
|
node = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array_Node) + pd->step_size*sizeof(Efl_Ui_List_View_Layout_Item*));
|
||||||
|
@ -85,25 +85,16 @@ _alloc_node(Efl_Ui_List_View_Seg_Array_Data* pd, int first)
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
static Efl_Ui_List_View_Layout_Item*
|
||||||
_efl_ui_list_view_seg_array_flush(Eo* obj EINA_UNUSED, Efl_Ui_List_View_Seg_Array_Data *pd)
|
_create_item_partial(Efl_Model* model)
|
||||||
{
|
|
||||||
if (pd->root)
|
|
||||||
eina_rbtree_delete(EINA_RBTREE_GET(pd->root), EINA_RBTREE_FREE_CB(_free_node), NULL);
|
|
||||||
|
|
||||||
pd->root = NULL;
|
|
||||||
pd->node_count = 0;
|
|
||||||
pd->count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Efl_Ui_List_View_Layout_Item* _create_item_partial(Efl_Model* model)
|
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Layout_Item* item = calloc(1, sizeof(Efl_Ui_List_View_Layout_Item));
|
Efl_Ui_List_View_Layout_Item* item = calloc(1, sizeof(Efl_Ui_List_View_Layout_Item));
|
||||||
item->children = efl_ref(model);
|
item->children = efl_ref(model);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Efl_Ui_List_View_Layout_Item* _create_item(Efl_Model* model, Efl_Ui_List_View_Seg_Array_Node* node, unsigned int index)
|
static Efl_Ui_List_View_Layout_Item*
|
||||||
|
_create_item(Efl_Model* model, Efl_Ui_List_View_Seg_Array_Node* node, unsigned int index)
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Layout_Item* item = _create_item_partial(model);
|
Efl_Ui_List_View_Layout_Item* item = _create_item_partial(model);
|
||||||
item->index_offset = index - node->first;
|
item->index_offset = index - node->first;
|
||||||
|
@ -111,43 +102,9 @@ static Efl_Ui_List_View_Layout_Item* _create_item(Efl_Model* model, Efl_Ui_List_
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Efl_Ui_List_View_Layout_Item*
|
|
||||||
_efl_ui_list_view_seg_array_remove(Eo* obj EINA_UNUSED, Efl_Ui_List_View_Seg_Array_Data *pd, int index)
|
|
||||||
{
|
|
||||||
Efl_Ui_List_View_Seg_Array_Node *node;
|
|
||||||
Efl_Ui_List_View_Layout_Item *item, *rt;
|
|
||||||
Eina_Iterator* iterator;
|
|
||||||
int offset;
|
|
||||||
|
|
||||||
node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root),
|
|
||||||
&index, sizeof(index), &_insert_lookup_cb, NULL);
|
|
||||||
if (!node) return NULL;
|
|
||||||
|
|
||||||
offset = index - node->first;
|
|
||||||
if (offset >= node->length) return NULL;
|
|
||||||
|
|
||||||
rt = node->pointers[offset];
|
|
||||||
pd->count--;
|
|
||||||
node->length--;
|
|
||||||
|
|
||||||
while (offset < node->length)
|
|
||||||
{
|
|
||||||
node->pointers[offset] = node->pointers[offset+1];
|
|
||||||
item = node->pointers[offset];
|
|
||||||
--item->index_offset;
|
|
||||||
++offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
node = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT];
|
|
||||||
iterator = eina_rbtree_iterator_infix((void*)node);
|
|
||||||
while(eina_iterator_next(iterator, (void**)&node))
|
|
||||||
node->first--;
|
|
||||||
|
|
||||||
return rt;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_efl_ui_list_view_seg_array_insert_at_node(Efl_Ui_List_View_Seg_Array_Data* pd, int index, Efl_Ui_List_View_Layout_Item* item, Efl_Ui_List_View_Seg_Array_Node* node)
|
_efl_ui_list_view_seg_array_insert_at_node(Efl_Ui_List_View_Seg_Array* pd, int index,
|
||||||
|
Efl_Ui_List_View_Layout_Item* item, Efl_Ui_List_View_Seg_Array_Node* node)
|
||||||
{
|
{
|
||||||
Eina_Iterator* iterator;
|
Eina_Iterator* iterator;
|
||||||
int pos;
|
int pos;
|
||||||
|
@ -193,83 +150,28 @@ _efl_ui_list_view_seg_array_insert_at_node(Efl_Ui_List_View_Seg_Array_Data* pd,
|
||||||
eina_iterator_free(iterator);
|
eina_iterator_free(iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_list_view_seg_array_insert(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Seg_Array_Data* pd, int index, Efl_Model* model)
|
|
||||||
{
|
|
||||||
Efl_Ui_List_View_Seg_Array_Node* node, *next;
|
|
||||||
Efl_Ui_List_View_Layout_Item* item;
|
|
||||||
|
|
||||||
item = _create_item_partial(model);
|
|
||||||
|
|
||||||
node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root),
|
|
||||||
&index, sizeof(index), &_insert_lookup_cb, NULL);
|
|
||||||
if(node)
|
|
||||||
{
|
|
||||||
next = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT];
|
|
||||||
if(next && next->first <= index)
|
|
||||||
_efl_ui_list_view_seg_array_insert_at_node(pd, index, item, next);
|
|
||||||
else
|
|
||||||
_efl_ui_list_view_seg_array_insert_at_node(pd, index, item, node);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_efl_ui_list_view_seg_array_insert_at_node(pd, index, item, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
efl_ui_list_view_seg_array_insert_object(Efl_Ui_List_View_Seg_Array_Data *seg_array, unsigned int index, Efl_Model *children)
|
_efl_ui_list_view_seg_array_insert_object(Efl_Ui_List_View_Seg_Array *pd, unsigned int index, Efl_Model *children)
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Seg_Array_Node *node;
|
Efl_Ui_List_View_Seg_Array_Node *node;
|
||||||
|
|
||||||
node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(seg_array->root),
|
node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root),
|
||||||
&index, sizeof(index), &_insert_lookup_cb, NULL);
|
&index, sizeof(index), &_insert_lookup_cb, NULL);
|
||||||
if (!node)
|
if (!node)
|
||||||
{
|
{
|
||||||
node = _alloc_node(seg_array, index);
|
node = _alloc_node(pd, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(node->length < node->max);
|
assert(node->length < node->max);
|
||||||
node->pointers[node->length] = _create_item(children, node, index);
|
node->pointers[node->length] = _create_item(children, node, index);
|
||||||
node->length++;
|
node->length++;
|
||||||
seg_array->count++;
|
pd->count++;
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_list_view_seg_array_insert_value(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Seg_Array_Data *seg_array, int first, Eina_Value v)
|
|
||||||
{
|
|
||||||
Efl_Model *children;
|
|
||||||
unsigned int i, len;
|
|
||||||
|
|
||||||
if (eina_value_type_get(&v) == EINA_VALUE_TYPE_OBJECT)
|
|
||||||
{
|
|
||||||
children = eina_value_object_get(&v);
|
|
||||||
efl_ui_list_view_seg_array_insert_object(seg_array, first, children);
|
|
||||||
}
|
|
||||||
else if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ARRAY)
|
|
||||||
{
|
|
||||||
EINA_VALUE_ARRAY_FOREACH(&v, len, i, children)
|
|
||||||
{
|
|
||||||
unsigned int idx = first + i;
|
|
||||||
|
|
||||||
efl_ui_list_view_seg_array_insert_object(seg_array, idx, children);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Unknow type !\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static int
|
|
||||||
_efl_ui_list_view_seg_array_count(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Seg_Array_Data* pd)
|
|
||||||
{
|
|
||||||
return pd->count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _Efl_Ui_List_View_Segarray_Eina_Accessor
|
typedef struct _Efl_Ui_List_View_Segarray_Eina_Accessor
|
||||||
{
|
{
|
||||||
Eina_Accessor vtable;
|
Eina_Accessor vtable;
|
||||||
Efl_Ui_List_View_Seg_Array_Data* seg_array;
|
Efl_Ui_List_View_Seg_Array* seg_array;
|
||||||
} Efl_Ui_List_View_Segarray_Eina_Accessor;
|
} Efl_Ui_List_View_Segarray_Eina_Accessor;
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -289,30 +191,6 @@ _efl_ui_list_view_seg_array_accessor_get_at(Efl_Ui_List_View_Segarray_Eina_Acces
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_list_view_seg_array_setup(Eo *obj EINA_UNUSED, Efl_Ui_List_View_Seg_Array_Data *pd, int size)
|
|
||||||
{
|
|
||||||
pd->step_size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Eo *
|
|
||||||
_efl_ui_list_view_seg_array_efl_object_constructor(Eo *obj, Efl_Ui_List_View_Seg_Array_Data *pd EINA_UNUSED)
|
|
||||||
{
|
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_list_view_seg_array_efl_object_destructor(Eo *obj, Efl_Ui_List_View_Seg_Array_Data *pd)
|
|
||||||
{
|
|
||||||
if (pd->root)
|
|
||||||
eina_rbtree_delete(EINA_RBTREE_GET(pd->root), EINA_RBTREE_FREE_CB(_free_node), NULL);
|
|
||||||
|
|
||||||
pd->root = NULL;
|
|
||||||
efl_destructor(efl_super(obj, MY_CLASS));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void*
|
static void*
|
||||||
_efl_ui_list_view_seg_array_accessor_get_container(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED)
|
_efl_ui_list_view_seg_array_accessor_get_container(Efl_Ui_List_View_Segarray_Eina_Accessor* acc EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +222,7 @@ _efl_ui_list_view_seg_array_accessor_clone(Efl_Ui_List_View_Segarray_Eina_Access
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_efl_ui_list_view_seg_array_accessor_setup(Efl_Ui_List_View_Segarray_Eina_Accessor* acc, Efl_Ui_List_View_Seg_Array_Data* seg_array)
|
_efl_ui_list_view_seg_array_accessor_setup(Efl_Ui_List_View_Segarray_Eina_Accessor* acc, Efl_Ui_List_View_Seg_Array* seg_array)
|
||||||
{
|
{
|
||||||
EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR);
|
EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR);
|
||||||
acc->vtable.version = EINA_ACCESSOR_VERSION;
|
acc->vtable.version = EINA_ACCESSOR_VERSION;
|
||||||
|
@ -357,18 +235,10 @@ _efl_ui_list_view_seg_array_accessor_setup(Efl_Ui_List_View_Segarray_Eina_Access
|
||||||
acc->seg_array = seg_array;
|
acc->seg_array = seg_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Accessor*
|
|
||||||
_efl_ui_list_view_seg_array_accessor_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Seg_Array_Data* pd)
|
|
||||||
{
|
|
||||||
Efl_Ui_List_View_Segarray_Eina_Accessor* acc = calloc(1, sizeof(Efl_Ui_List_View_Segarray_Eina_Accessor));
|
|
||||||
_efl_ui_list_view_seg_array_accessor_setup(acc, pd);
|
|
||||||
return &acc->vtable;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct _Efl_Ui_List_View_Segarray_Node_Accessor
|
typedef struct _Efl_Ui_List_View_Segarray_Node_Accessor
|
||||||
{
|
{
|
||||||
Eina_Accessor vtable;
|
Eina_Accessor vtable;
|
||||||
Efl_Ui_List_View_Seg_Array_Data* seg_array;
|
Efl_Ui_List_View_Seg_Array* seg_array;
|
||||||
Eina_Iterator* pre_iterator;
|
Eina_Iterator* pre_iterator;
|
||||||
Efl_Ui_List_View_Seg_Array_Node* current_node;
|
Efl_Ui_List_View_Seg_Array_Node* current_node;
|
||||||
int current_index;
|
int current_index;
|
||||||
|
@ -442,7 +312,7 @@ _efl_ui_list_view_seg_array_node_accessor_clone(Efl_Ui_List_View_Segarray_Node_A
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_efl_ui_list_view_seg_array_node_accessor_setup(Efl_Ui_List_View_Segarray_Node_Accessor* acc, Efl_Ui_List_View_Seg_Array_Data* seg_array)
|
_efl_ui_list_view_seg_array_node_accessor_setup(Efl_Ui_List_View_Segarray_Node_Accessor* acc, Efl_Ui_List_View_Seg_Array* seg_array)
|
||||||
{
|
{
|
||||||
EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR);
|
EINA_MAGIC_SET(&acc->vtable, EINA_MAGIC_ACCESSOR);
|
||||||
acc->vtable.version = EINA_ACCESSOR_VERSION;
|
acc->vtable.version = EINA_ACCESSOR_VERSION;
|
||||||
|
@ -458,18 +328,147 @@ _efl_ui_list_view_seg_array_node_accessor_setup(Efl_Ui_List_View_Segarray_Node_A
|
||||||
acc->current_node = NULL;
|
acc->current_node = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Accessor*
|
/* External Functions */
|
||||||
_efl_ui_list_view_seg_array_node_accessor_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_View_Seg_Array_Data* pd)
|
|
||||||
|
Efl_Ui_List_View_Seg_Array *
|
||||||
|
efl_ui_list_view_seg_array_setup(int size)
|
||||||
|
{
|
||||||
|
Efl_Ui_List_View_Seg_Array *pd = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array));
|
||||||
|
pd->step_size = size;
|
||||||
|
|
||||||
|
return pd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
efl_ui_list_view_seg_array_free(Efl_Ui_List_View_Seg_Array *pd)
|
||||||
|
{
|
||||||
|
if (pd->root)
|
||||||
|
eina_rbtree_delete(EINA_RBTREE_GET(pd->root), EINA_RBTREE_FREE_CB(_free_node), NULL);
|
||||||
|
|
||||||
|
pd->root = NULL;
|
||||||
|
free(pd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
efl_ui_list_view_seg_array_flush(Efl_Ui_List_View_Seg_Array *pd)
|
||||||
|
{
|
||||||
|
if (pd->root)
|
||||||
|
eina_rbtree_delete(EINA_RBTREE_GET(pd->root), EINA_RBTREE_FREE_CB(_free_node), NULL);
|
||||||
|
|
||||||
|
pd->root = NULL;
|
||||||
|
pd->node_count = 0;
|
||||||
|
pd->count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
efl_ui_list_view_seg_array_count(Efl_Ui_List_View_Seg_Array* pd)
|
||||||
|
{
|
||||||
|
return pd->count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
efl_ui_list_view_seg_array_insert(Efl_Ui_List_View_Seg_Array* pd, int index, Efl_Model* model)
|
||||||
|
{
|
||||||
|
Efl_Ui_List_View_Seg_Array_Node* node, *next;
|
||||||
|
Efl_Ui_List_View_Layout_Item* item;
|
||||||
|
|
||||||
|
item = _create_item_partial(model);
|
||||||
|
|
||||||
|
node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root),
|
||||||
|
&index, sizeof(index), &_insert_lookup_cb, NULL);
|
||||||
|
if(node)
|
||||||
|
{
|
||||||
|
next = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT];
|
||||||
|
if(next && next->first <= index)
|
||||||
|
_efl_ui_list_view_seg_array_insert_at_node(pd, index, item, next);
|
||||||
|
else
|
||||||
|
_efl_ui_list_view_seg_array_insert_at_node(pd, index, item, node);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_efl_ui_list_view_seg_array_insert_at_node(pd, index, item, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
efl_ui_list_view_seg_array_insert_value(Efl_Ui_List_View_Seg_Array *pd, int first, Eina_Value v)
|
||||||
|
{
|
||||||
|
Efl_Model *children;
|
||||||
|
unsigned int i, len;
|
||||||
|
|
||||||
|
if (eina_value_type_get(&v) == EINA_VALUE_TYPE_OBJECT)
|
||||||
|
{
|
||||||
|
children = eina_value_object_get(&v);
|
||||||
|
_efl_ui_list_view_seg_array_insert_object(pd, first, children);
|
||||||
|
}
|
||||||
|
else if (eina_value_type_get(&v) == EINA_VALUE_TYPE_ARRAY)
|
||||||
|
{
|
||||||
|
EINA_VALUE_ARRAY_FOREACH(&v, len, i, children)
|
||||||
|
{
|
||||||
|
unsigned int idx = first + i;
|
||||||
|
|
||||||
|
_efl_ui_list_view_seg_array_insert_object(pd, idx, children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Unknow type !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Efl_Ui_List_View_Layout_Item*
|
||||||
|
efl_ui_list_view_seg_array_remove(Efl_Ui_List_View_Seg_Array *pd, int index)
|
||||||
|
{
|
||||||
|
Efl_Ui_List_View_Seg_Array_Node *node;
|
||||||
|
Efl_Ui_List_View_Layout_Item *item, *rt;
|
||||||
|
Eina_Iterator* iterator;
|
||||||
|
int offset;
|
||||||
|
|
||||||
|
node = (void*)eina_rbtree_inline_lookup(EINA_RBTREE_GET(pd->root),
|
||||||
|
&index, sizeof(index), &_insert_lookup_cb, NULL);
|
||||||
|
if (!node) return NULL;
|
||||||
|
|
||||||
|
offset = index - node->first;
|
||||||
|
if (offset >= node->length) return NULL;
|
||||||
|
|
||||||
|
rt = node->pointers[offset];
|
||||||
|
pd->count--;
|
||||||
|
node->length--;
|
||||||
|
|
||||||
|
while (offset < node->length)
|
||||||
|
{
|
||||||
|
node->pointers[offset] = node->pointers[offset+1];
|
||||||
|
item = node->pointers[offset];
|
||||||
|
--item->index_offset;
|
||||||
|
++offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
node = (void*)EINA_RBTREE_GET(node)->son[EINA_RBTREE_LEFT];
|
||||||
|
iterator = eina_rbtree_iterator_infix((void*)node);
|
||||||
|
while(eina_iterator_next(iterator, (void**)&node))
|
||||||
|
node->first--;
|
||||||
|
|
||||||
|
return rt;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Accessor*
|
||||||
|
efl_ui_list_view_seg_array_accessor_get(Efl_Ui_List_View_Seg_Array* pd)
|
||||||
|
{
|
||||||
|
Efl_Ui_List_View_Segarray_Eina_Accessor* acc = calloc(1, sizeof(Efl_Ui_List_View_Segarray_Eina_Accessor));
|
||||||
|
_efl_ui_list_view_seg_array_accessor_setup(acc, pd);
|
||||||
|
return &acc->vtable;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Accessor*
|
||||||
|
efl_ui_list_view_seg_array_node_accessor_get(Efl_Ui_List_View_Seg_Array* pd)
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Segarray_Node_Accessor* acc = calloc(1, sizeof(Efl_Ui_List_View_Segarray_Node_Accessor));
|
Efl_Ui_List_View_Segarray_Node_Accessor* acc = calloc(1, sizeof(Efl_Ui_List_View_Segarray_Node_Accessor));
|
||||||
_efl_ui_list_view_seg_array_node_accessor_setup(acc, pd);
|
_efl_ui_list_view_seg_array_node_accessor_setup(acc, pd);
|
||||||
return &acc->vtable;
|
return &acc->vtable;
|
||||||
}
|
}
|
||||||
|
|
||||||
int efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item* item)
|
int
|
||||||
|
efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item* item)
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Seg_Array_Node* node = item->tree_node;
|
Efl_Ui_List_View_Seg_Array_Node* node = item->tree_node;
|
||||||
return item->index_offset + node->first;
|
return item->index_offset + node->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "efl_ui_list_view_seg_array.eo.c"
|
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
import efl_ui_list_view_types;
|
|
||||||
|
|
||||||
class Efl.Ui.List_View_Seg_Array extends Efl.Object
|
|
||||||
{
|
|
||||||
methods {
|
|
||||||
@property accessor {
|
|
||||||
get {
|
|
||||||
[[ Get a Seg_Array List items accessor ]]
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
acc: accessor<ptr(Efl.Ui.List_View_Layout_Item)>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@property node_accessor {
|
|
||||||
get {
|
|
||||||
[[ Get a Seg_Array node accessor ]]
|
|
||||||
}
|
|
||||||
values {
|
|
||||||
acc: accessor<ptr(Efl.Ui.List_View_Seg_Array_Node)>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
insert_value {
|
|
||||||
[[ Insert a accessor in segarray tree ]]
|
|
||||||
params {
|
|
||||||
@in first: int;
|
|
||||||
@in v: any_value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
count {
|
|
||||||
[[ Get the number of items in Seg_Array tree ]]
|
|
||||||
return: int;
|
|
||||||
}
|
|
||||||
setup {
|
|
||||||
[[ Configure a step of Seg_Array tree, this is the max node size ]]
|
|
||||||
params {
|
|
||||||
@in initial_step_size: int;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
flush {
|
|
||||||
[[ flush the Seg_Array tree ]]
|
|
||||||
}
|
|
||||||
insert {
|
|
||||||
[[ Insert a new model in Seg_Array tree at index position ]]
|
|
||||||
params {
|
|
||||||
@in index: int;
|
|
||||||
@in model: Efl.Model;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
remove {
|
|
||||||
[[ Remove the item at index position in Seg_Array tree ]]
|
|
||||||
params {
|
|
||||||
@in index: int;
|
|
||||||
}
|
|
||||||
return: ptr(Efl.Ui.List_View_Layout_Item) @owned;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
implements {
|
|
||||||
Efl.Object.constructor;
|
|
||||||
Efl.Object.destructor;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,13 +14,29 @@ typedef struct _Efl_Ui_List_View_SegArray_Node
|
||||||
Efl_Ui_List_View_Layout_Item* pointers[0];
|
Efl_Ui_List_View_Layout_Item* pointers[0];
|
||||||
} Efl_Ui_List_View_Seg_Array_Node;
|
} Efl_Ui_List_View_Seg_Array_Node;
|
||||||
|
|
||||||
typedef struct _Efl_Ui_List_View_Seg_Array_Data
|
typedef struct _Efl_Ui_List_View_Seg_Array
|
||||||
{
|
{
|
||||||
Efl_Ui_List_View_Seg_Array_Node *root;
|
Efl_Ui_List_View_Seg_Array_Node *root;
|
||||||
|
|
||||||
int step_size;
|
int step_size;
|
||||||
int node_count;
|
int node_count;
|
||||||
int count;
|
int count;
|
||||||
} Efl_Ui_List_View_Seg_Array_Data;
|
} Efl_Ui_List_View_Seg_Array;
|
||||||
|
|
||||||
|
|
||||||
|
Efl_Ui_List_View_Seg_Array * efl_ui_list_view_seg_array_setup(int size);
|
||||||
|
void efl_ui_list_view_seg_array_free(Efl_Ui_List_View_Seg_Array *seg_array);
|
||||||
|
void efl_ui_list_view_seg_array_flush(Efl_Ui_List_View_Seg_Array *seg_array);
|
||||||
|
int efl_ui_list_view_seg_array_count(Efl_Ui_List_View_Seg_Array* seg_array);
|
||||||
|
int efl_ui_list_view_item_index_get(Efl_Ui_List_View_Layout_Item* item);
|
||||||
|
|
||||||
|
|
||||||
|
void efl_ui_list_view_seg_array_insert(Efl_Ui_List_View_Seg_Array* seg_array, int index, Efl_Model* model);
|
||||||
|
void efl_ui_list_view_seg_array_insert_value(Efl_Ui_List_View_Seg_Array *seg_array, int first, Eina_Value value);
|
||||||
|
Efl_Ui_List_View_Layout_Item* efl_ui_list_view_seg_array_remove(Efl_Ui_List_View_Seg_Array *seg_array, int index);
|
||||||
|
|
||||||
|
Eina_Accessor* efl_ui_list_view_seg_array_accessor_get(Efl_Ui_List_View_Seg_Array* seg_array);
|
||||||
|
Eina_Accessor* efl_ui_list_view_seg_array_node_accessor_get(Efl_Ui_List_View_Seg_Array* seg_array);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,5 +8,3 @@ struct @free(free) Efl.Ui.List_View_Layout_Item {
|
||||||
size: Eina.Size2D;
|
size: Eina.Size2D;
|
||||||
pos: Eina.Position2D;
|
pos: Eina.Position2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct @extern Efl.Ui.List_View_Seg_Array_Node; [[ ]]
|
|
||||||
|
|
|
@ -105,7 +105,6 @@ pub_legacy_eo_files = [
|
||||||
'elm_table.eo',
|
'elm_table.eo',
|
||||||
'elm_thumb.eo',
|
'elm_thumb.eo',
|
||||||
'efl_ui_textpath_legacy.eo',
|
'efl_ui_textpath_legacy.eo',
|
||||||
'efl_ui_list_view_precise_layouter.eo'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
pub_eo_file_target = []
|
pub_eo_file_target = []
|
||||||
|
@ -207,8 +206,6 @@ pub_eo_files = [
|
||||||
'efl_ui_list_view.eo',
|
'efl_ui_list_view.eo',
|
||||||
'efl_ui_list_view_model.eo',
|
'efl_ui_list_view_model.eo',
|
||||||
'efl_ui_list_view_pan.eo',
|
'efl_ui_list_view_pan.eo',
|
||||||
'efl_ui_list_view_seg_array.eo',
|
|
||||||
'efl_ui_list_view_relayout.eo',
|
|
||||||
'efl_ui_item.eo',
|
'efl_ui_item.eo',
|
||||||
'efl_ui_list_item.eo',
|
'efl_ui_list_item.eo',
|
||||||
'efl_ui_list_default_item_part_icon.eo',
|
'efl_ui_list_default_item_part_icon.eo',
|
||||||
|
@ -339,6 +336,8 @@ priv_eo_files = [
|
||||||
'efl_ui_model_state.eo',
|
'efl_ui_model_state.eo',
|
||||||
'efl_ui_selection_manager.eo',
|
'efl_ui_selection_manager.eo',
|
||||||
'efl_datetime_manager.eo',
|
'efl_datetime_manager.eo',
|
||||||
|
'efl_ui_list_view_precise_layouter.eo',
|
||||||
|
'efl_ui_list_view_relayout.eo',
|
||||||
]
|
]
|
||||||
|
|
||||||
priv_eo_file_target = []
|
priv_eo_file_target = []
|
||||||
|
|
Loading…
Reference in New Issue