aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Jr <larry.olj@gmail.com>2017-10-24 14:55:10 -0200
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>2017-11-15 17:06:45 +0900
commit4cc7bd52b144a3bc9dc668275e399b34654258c1 (patch)
treedcf3c7ca9eab869781c5c0dca12ec3a7413890ec
parentelm: efl_ui_list_precise_layout use hint_combined_min_get (diff)
downloadefl-4cc7bd52b144a3bc9dc668275e399b34654258c1.tar.gz
elm: efl_ui_list precise layout scroll WIP
-rw-r--r--src/lib/elementary/efl_ui_list.c204
-rw-r--r--src/lib/elementary/efl_ui_list.eo1
-rw-r--r--src/lib/elementary/efl_ui_list_model.eo10
-rw-r--r--src/lib/elementary/efl_ui_list_precise_layouter.c138
-rw-r--r--src/lib/elementary/efl_ui_list_precise_layouter.eo1
-rw-r--r--src/lib/elementary/efl_ui_list_private.h12
-rw-r--r--src/lib/elementary/efl_ui_list_segarray.c3
7 files changed, 202 insertions, 167 deletions
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
index a818451e09..78746bc81d 100644
--- a/src/lib/elementary/efl_ui_list.c
+++ b/src/lib/elementary/efl_ui_list.c
@@ -62,87 +62,73 @@ _horiz(Efl_Orient dir)
}
EOLIAN static void
-_efl_ui_list_pan_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_List_Pan_Data *pd)
+_efl_ui_list_pan_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_List_Pan_Data *psd)
{
DBG("");
/* if (pd->recalc) return; */
/* _efl_ui_list_custom_layout(obj); */
+ evas_object_smart_changed(psd->wobj);
}
-EOLIAN static void
-_efl_ui_list_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_List_Data *pd)
-{
- DBG("");
- /* if (pd->recalc) return; */
-
- _layout(pd);
- /* _efl_ui_list_custom_layout(obj); */
-}
EOLIAN static void
-_efl_ui_list_pan_elm_pan_pos_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd EINA_UNUSED,
- Evas_Coord x EINA_UNUSED, Evas_Coord y EINA_UNUSED)
+_efl_ui_list_pan_elm_pan_pos_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord x, Evas_Coord y)
{
- DBG("x: %d y: %d", (int)x, (int)y);
- _layout(psd->wpd);
-}
-/* EOLIAN static void */
-/* _efl_ui_list_pan_elm_pan_pos_set(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord x, Evas_Coord y) */
-/* { */
-/* Evas_Coord ox, oy, ow, oh, cw; */
-/* Efl_Ui_List_Data *pd = psd->wpd; */
-/* Efl_Ui_List_Item **litem; */
+ Evas_Coord ox, oy, ow, oh, cw;
-/* EINA_SAFETY_ON_NULL_RETURN(pd); */
-/* if (((x == pd->pan.x) && (y == pd->pan.y))) return; */
+ DBG("x: %d y: %d", (int)x, (int)y);
+ if ((x == psd->x) && (y == psd->y)) return;
-/* evas_object_geometry_get(pd->obj, &ox, &oy, &ow, &oh); */
-/* if (_horiz(pd->orient)) */
-/* { */
-/* pd->pan.move_diff += x - pd->pan.x; */
-/* cw = ow / 4; */
-/* } */
-/* else */
-/* { */
-/* pd->pan.move_diff += y - pd->pan.y; */
-/* cw = oh / 4; */
-/* } */
+// evas_object_geometry_get(pd->obj, &ox, &oy, &ow, &oh);
+// if (_horiz(pd->orient))
+// {
+// pd->pan.move_diff += x - pd->pan.x;
+// cw = ow / 4;
+// }
+// else
+// {
+// pd->pan.move_diff += y - pd->pan.y;
+// cw = oh / 4;
+// }
-/* pd->pan.x = x; */
-/* pd->pan.y = y; */
+ psd->x = x;
+ psd->y = y;
-/* if (abs(pd->pan.move_diff) > cw) */
-/* { */
-/* pd->pan.move_diff = 0; */
-/* _update_items(obj, pd); */
-/* } */
-/* else */
-/* { */
-/* EINA_INARRAY_FOREACH(&pd->items.array, litem) */
-/* evas_object_move((*litem)->layout, ((*litem)->x + 0 - pd->pan.x), ((*litem)->y + 0 - pd->pan.y)); */
-/* } */
-/* } */
+// if (abs(pd->pan.move_diff) > cw)
+// {
+// pd->pan.move_diff = 0;
+// _update_items(obj, pd);
+// }
+// else
+// {
+// EINA_INARRAY_FOREACH(&pd->items.array, litem)
+// evas_object_move((*litem)->layout, ((*litem)->x + 0 - pd->pan.x), ((*litem)->y + 0 - pd->pan.y));
+// }
+//
+ evas_object_smart_changed(psd->wobj);
+}
EOLIAN static void
_efl_ui_list_pan_elm_pan_pos_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
{
- Efl_Ui_List_Data *pd = psd->wpd;
-
- if (x) *x = pd->pan.x;
- if (y) *y = pd->pan.y;
+ if (x) *x = psd->x;
+ if (y) *y = psd->y;
}
EOLIAN static void
_efl_ui_list_pan_elm_pan_pos_max_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
{
Evas_Coord ow, oh;
+ Eina_Size2D min;
elm_interface_scrollable_content_viewport_geometry_get
(psd->wobj, NULL, NULL, &ow, &oh);
- ow = psd->wpd->minw - ow;
+
+ min = efl_ui_list_model_min_size_get(psd->wobj);
+ ow = min.w - ow;
if (ow < 0) ow = 0;
- oh = psd->wpd->minh - oh;
+ oh = min.h - oh;
if (oh < 0) oh = 0;
if (x) *x = ow;
@@ -159,17 +145,18 @@ _efl_ui_list_pan_elm_pan_pos_min_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *
EOLIAN static void
_efl_ui_list_pan_elm_pan_content_size_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Pan_Data *psd, Evas_Coord *w, Evas_Coord *h)
{
- Efl_Ui_List_Data *pd = psd->wpd;
- EINA_SAFETY_ON_NULL_RETURN(pd);
+ Eina_Size2D min;
+ min = efl_ui_list_model_min_size_get(psd->wobj);
- if (w) *w = pd->minw;
- if (h) *h = pd->minh;
+ if (w) *w = min.w;
+ if (h) *h = min.h;
+
+ DBG("w: %d h: %d", *w, *h);
}
EOLIAN static void
_efl_ui_list_pan_efl_object_destructor(Eo *obj, Efl_Ui_List_Pan_Data *psd)
{
- efl_data_unref(psd->wobj, psd->wpd);
efl_destructor(efl_super(obj, MY_PAN_CLASS));
}
@@ -809,8 +796,7 @@ _show_region_hook(void *data EINA_UNUSED, Evas_Object *obj)
{
EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
Eina_Rect r = elm_obj_widget_show_region_get(obj);
- r.x += pd->pan.x;
- r.y += pd->pan.y;
+ elm_pan_pos_get(pd->pan_obj, &r.x, &r.y);
elm_interface_scrollable_content_region_show(obj, r.x, r.y, r.w, r.h);
}
@@ -887,20 +873,24 @@ _efl_ui_list_elm_widget_theme_apply(Eo *obj, Efl_Ui_List_Data *pd EINA_UNUSED)
EOLIAN static void
_efl_ui_list_efl_gfx_position_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Position2D p)
{
+ int pan_x, pan_y;
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, p.x, p.y))
return;
efl_gfx_position_set(efl_super(obj, MY_CLASS), p);
+ elm_pan_pos_get(pd->pan_obj, &pan_x, &pan_y);
evas_object_move(pd->hit_rect, p.x, p.y);
- evas_object_move(pd->pan.obj, p.x - pd->pan.x, p.y - pd->pan.y);
+ evas_object_move(pd->pan_obj, p.x - pan_x, p.y - pan_y);
evas_object_smart_changed(pd->obj);
}
EOLIAN static void
_efl_ui_list_elm_interface_scrollable_region_bring_in(Eo *obj, Efl_Ui_List_Data *pd, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
{
- elm_interface_scrollable_region_bring_in(efl_super(obj, MY_CLASS), x + pd->pan.x, y + pd->pan.y, w, h);
+ int pan_x, pan_y;
+ elm_pan_pos_get(pd->pan_obj, &pan_x, &pan_y);
+ elm_interface_scrollable_region_bring_in(efl_super(obj, MY_CLASS), x + pan_x, y + pan_y, w, h);
}
EOLIAN static void
@@ -934,6 +924,16 @@ _efl_ui_list_efl_gfx_size_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Size2D size)
}
EOLIAN static void
+_efl_ui_list_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_List_Data *pd)
+{
+ DBG("");
+ /* if (pd->recalc) return; */
+
+ _layout(pd);
+ /* _efl_ui_list_custom_layout(obj); */
+}
+
+EOLIAN static void
_efl_ui_list_efl_canvas_group_group_member_add(Eo *obj, Efl_Ui_List_Data *pd, Evas_Object *member)
{
efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
@@ -1001,16 +1001,12 @@ _efl_ui_list_efl_canvas_group_group_add(Eo *obj, Efl_Ui_List_Data *pd EINA_UNUSE
pd->mode = ELM_LIST_COMPRESS;
elm_interface_atspi_accessible_type_set(obj, ELM_ATSPI_TYPE_DISABLED);
- pd->pan.obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj));
- pan_data = efl_data_scope_get(pd->pan.obj, MY_PAN_CLASS);
- efl_data_ref(obj, MY_CLASS);
+ pd->pan_obj = efl_add(MY_PAN_CLASS, evas_object_evas_get(obj));
+ pan_data = efl_data_scope_get(pd->pan_obj, MY_PAN_CLASS);
pan_data->wobj = obj;
- pan_data->wpd = pd;
- pd->pan.x = 0;
- pd->pan.y = 0;
- elm_interface_scrollable_extern_pan_set(obj, pd->pan.obj);
- evas_object_show(pd->pan.obj);
+ elm_interface_scrollable_extern_pan_set(obj, pd->pan_obj);
+ evas_object_show(pd->pan_obj);
edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
@@ -1023,7 +1019,7 @@ _efl_ui_list_efl_canvas_group_group_del(Eo *obj, Efl_Ui_List_Data *pd)
{
//_efl_ui_list_children_free(obj, pd);
- ELM_SAFE_FREE(pd->pan.obj, evas_object_del);
+ ELM_SAFE_FREE(pd->pan_obj, evas_object_del);
efl_canvas_group_del(efl_super(obj, MY_CLASS));
}
@@ -1070,6 +1066,8 @@ _efl_ui_list_efl_object_constructor(Eo *obj, Efl_Ui_List_Data *pd)
pd->orient = EFL_ORIENT_DOWN;
pd->align.h = 0;
pd->align.v = 0;
+ pd->min.w = 0;
+ pd->min.h = 0;
return obj;
}
@@ -1381,27 +1379,6 @@ _efl_ui_list_elm_widget_widget_event(Eo *obj, Efl_Ui_List_Data *pd, Efl_Event co
return EINA_TRUE;
}
-
-EOLIAN static Efl_Ui_List_LayoutItem *
-_efl_ui_list_efl_ui_list_model_realize(Eo *obj, Efl_Ui_List_Data *pd, Efl_Ui_List_LayoutItem *item)
-{
- DBG("model_realize");
- Efl_Ui_List_Item_Event evt;
- EINA_SAFETY_ON_NULL_RETURN_VAL(item->children, item);
-
- item->layout = efl_ui_factory_create(pd->factory, item->children, obj);
-// evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, item);
- efl_ui_view_model_set(item->layout, item->children);
-
- evt.child = item->children;
- evt.layout = item->layout;
- evt.index = item->index;
- efl_event_callback_call(obj, EFL_UI_LIST_EVENT_ITEM_REALIZED, &evt);
-
- evas_object_show(item->layout);
- return item;
-}
-
Eina_Bool
_efl_ui_list_item_select_clear(Eo *obj)
{
@@ -1511,11 +1488,52 @@ _children_slice_then(void * data, Efl_Event const* event)
pd->outstanding_slice.slice_start = pd->outstanding_slice.slice_count = 0;
}
+
+/* EFL UI LIST MODEL INTERFACE */
+EOLIAN static Eina_Size2D
+_efl_ui_list_efl_ui_list_model_min_size_get(Eo *obj, Efl_Ui_List_Data *pd)
+{
+ return pd->min;
+}
+
+EOLIAN static void
+_efl_ui_list_efl_ui_list_model_min_size_set(Eo *obj, Efl_Ui_List_Data *pd, Eina_Size2D min)
+{
+ ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+
+ pd->min.w = min.w;
+ pd->min.h = min.h;
+
+ evas_object_size_hint_min_set(wd->resize_obj, pd->min.w, pd->min.h);
+ DBG("min_size_set w:%d h:%d", pd->min.w, pd->min.h);
+
+ efl_event_callback_legacy_call(pd->pan_obj, ELM_PAN_EVENT_CHANGED, NULL);
+}
+
+EOLIAN static Efl_Ui_List_LayoutItem *
+_efl_ui_list_efl_ui_list_model_realize(Eo *obj, Efl_Ui_List_Data *pd, Efl_Ui_List_LayoutItem *item)
+{
+ DBG("model_realize");
+ Efl_Ui_List_Item_Event evt;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item->children, item);
+
+ item->layout = efl_ui_factory_create(pd->factory, item->children, obj);
+// evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, item);
+ efl_ui_view_model_set(item->layout, item->children);
+
+ evt.child = item->children;
+ evt.layout = item->layout;
+ evt.index = item->index;
+ efl_event_callback_call(obj, EFL_UI_LIST_EVENT_ITEM_REALIZED, &evt);
+
+ evas_object_show(item->layout);
+ return item;
+}
+
EOLIAN static void
_efl_ui_list_efl_ui_list_model_load_range_set(Eo* obj, Efl_Ui_List_Data* pd, int first, int count)
{
// slice
- printf(">>> range_set %d %d\n", first, count);
if(!pd->slice_future)
{
pd->slice_future = efl_model_children_slice_get(pd->model, first, count);
diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo
index d71ca5f6eb..749b182342 100644
--- a/src/lib/elementary/efl_ui_list.eo
+++ b/src/lib/elementary/efl_ui_list.eo
@@ -72,6 +72,7 @@ class Efl.Ui.List (Efl.Ui.Layout, Efl.Ui.View, Elm.Interface_Scrollable,
Efl.Ui.List.Model.load_range { set;}
Efl.Ui.List.Model.realize;
Efl.Ui.List.Model.size { get; }
+ Efl.Ui.List.Model.min_size { get; set; }
// Widget
Elm.Widget.theme_apply;
diff --git a/src/lib/elementary/efl_ui_list_model.eo b/src/lib/elementary/efl_ui_list_model.eo
index 67f3ed8088..bb685b9d25 100644
--- a/src/lib/elementary/efl_ui_list_model.eo
+++ b/src/lib/elementary/efl_ui_list_model.eo
@@ -29,5 +29,15 @@ interface Efl.Ui.List.Model (Efl.Interface)
s: int;
}
}
+ @property min_size {
+ [[Minimal content size.]]
+ set {}
+ get {}
+ values {
+ min: Eina.Size2D;
+ }
+ }
+
+
}
}
diff --git a/src/lib/elementary/efl_ui_list_precise_layouter.c b/src/lib/elementary/efl_ui_list_precise_layouter.c
index f6d7440a41..85f1d43a41 100644
--- a/src/lib/elementary/efl_ui_list_precise_layouter.c
+++ b/src/lib/elementary/efl_ui_list_precise_layouter.c
@@ -21,12 +21,12 @@ typedef struct _Efl_Ui_List_Precise_Layouter_Data
{
Eina_Bool initialized;
Eina_Hash* size_information;
- Evas_Coord width, height;
+ Eina_Size2D min;
} Efl_Ui_List_Precise_Layouter_Data;
typedef struct _Efl_Ui_List_Precise_Layouter_Size
{
- Evas_Coord min_width, min_height;
+ Eina_Size2D min;
double weight_x, weight_y;
} Efl_Ui_List_Precise_Layouter_Size;
@@ -60,13 +60,13 @@ _item_min_calc(Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_Precise_Layout
// else
// {
- pd->height += new_h - size->min_height;
+ pd->min.h += new_h - size->min.h;
- if(pd->width <= new_w)
- pd->width = new_w;
- else if (pd->width == size->min_width)
+ if(pd->min.w <= new_w)
+ pd->min.w = new_w;
+ else if (pd->min.w == size->min.w)
{
- pd->width = new_w;
+ pd->min.w = new_w;
/*EINA_INARRAY_FOREACH(&pd->items.array, it) //find new minimal width
{
litem = *it;
@@ -81,11 +81,21 @@ _item_min_calc(Efl_Ui_List_Precise_Layouter_Data *pd, Efl_Ui_List_Precise_Layout
}
// }
- size->min_width = new_w;
- size->min_height = new_h;
+ size->min.w = new_w;
+ size->min.h = new_h;
}
-static void
+
+EOLIAN static Efl_Object *
+_efl_ui_list_precise_layouter_efl_object_constructor(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd)
+{
+ obj = efl_constructor(efl_super(obj, MY_CLASS));
+ pd->initialized = EINA_FALSE;
+
+ return obj;
+}
+
+EOLIAN static void
_efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
(Eo *obj EINA_UNUSED, Efl_Ui_List_Precise_Layouter_Data *pd
, Efl_Ui_List_Model *modeler, int first, int count, Eina_Accessor *items)
@@ -94,7 +104,7 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
Efl_Ui_List_Precise_Layouter_Size* size;
int i = 0;
Eina_Bool horiz = EINA_FALSE/*_horiz(pd->orient)*/, zeroweight = EINA_FALSE;
- Evas_Coord ow, oh, want, minw, minh;
+ Evas_Coord ow, oh, want, minw, minh, scr_x, scr_y;
int boxx, boxy, boxw, boxh, length, /*pad, */extra = 0, rounding = 0;
int boxl = 0, boxr = 0, boxt = 0, boxb = 0;
double cur_pos = 0, scale, box_align[2], weight[2] = { 0, 0 };
@@ -102,34 +112,34 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
Eina_List *order = NULL;
int pad[4];
- DBG("layout_do");
-
+ DBG("layout_do first %d count %d", first, count);
EINA_SAFETY_ON_NULL_RETURN(items);
- printf("** >>> %s first %d count %d\n", __FUNCTION__, first, count);
if(!pd->initialized)
{
efl_ui_list_model_load_range_set(modeler, 0, 0); // load all
pd->size_information = eina_hash_pointer_new(&free);
pd->initialized = EINA_TRUE;
+ pd->min.w = 0;
+ pd->min.h = 0;
+ DBG("************ w:%d h:%d", pd->min.w, pd->min.h);
}
// cache size of new items
EINA_ACCESSOR_FOREACH(items, i, layout_item)
{
- printf("item %d\n", i);
size = eina_hash_find(pd->size_information, &layout_item);
- DBG("size %p", size);
+// DBG("size %p", size);
if(!size)
{
if(!layout_item->layout)
{
- DBG("no layout, realizing");
+// DBG("no layout, realizing");
efl_ui_list_model_realize(modeler, layout_item);
}
else
{
- DBG("already realized");
+// DBG("already realized");
/* if(!layout_item->layout) */
/* { */
/* // error */
@@ -138,29 +148,29 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
size = calloc(1, sizeof(Efl_Ui_List_Precise_Layouter_Size));
Eina_Size2D min = efl_gfx_size_hint_combined_min_get(layout_item->layout);
- //edje_object_size_min_calc(layout_item->layout, &size->min_width, &size->min_height);
- size->min_width = min.w;
- size->min_height = min.h;
+ //edje_object_size_min_calc(layout_item->layout, &size->min.w, &size->min.h);
+ size->min.w = min.w;
+ size->min.h = min.h;
- if(size->min_width && size->min_height)
+ if(size->min.w && size->min.h)
{
- DBG("size was calculated");
+// DBG("size was calculated");
efl_gfx_size_hint_margin_get(layout_item->layout, &pad[0], &pad[1], &pad[2], &pad[3]);
efl_gfx_size_hint_weight_get(layout_item->layout, &size->weight_x, &size->weight_y);
- size->min_width += pad[0] + pad[1];
- size->min_height += pad[2] + pad[3];
- pd->height += size->min_height;
+ size->min.w += pad[0] + pad[1];
+ size->min.h += pad[2] + pad[3];
+ pd->min.h += size->min.h;
- if (pd->width < size->min_width)
- pd->width = size->min_width;
+ if (pd->min.w < size->min.w)
+ pd->min.w = size->min.w;
eina_hash_add(pd->size_information, &layout_item, size);
- DBG("size information for item %d width %d height %d", i, size->min_width, size->min_height);
+// DBG("size information for item %d width %d height %d", i, size->min.w, size->min.h);
}
else
{
- DBG("size was NOT calculated, not loaded yet probably");
+// DBG("size was NOT calculated, not loaded yet probably");
free(size);
}
}
@@ -189,8 +199,6 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
//count = 1;
/* count = eina_inarray_count(&pd->items.array); */
- elm_interface_scrollable_content_viewport_geometry_get
- (modeler, NULL, NULL, &ow, &oh);
// box outer margin
boxw -= boxl + boxr;
boxh -= boxt + boxb;
@@ -224,7 +232,7 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
{
int pad;
length = boxh;
- want = pd->height;
+ want = pd->min.h;
pad = 1;//pd->pad.scalable ? (pd->pad.v * scale) : pd->pad.v;
// padding can not be squeezed (note: could make it an option)
@@ -232,21 +240,20 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
// available space. if <0 we overflow
extra = length - want;
- minw = pd->width + boxl + boxr;
- minh = 100;//pd->height + pad * (count - 1) + boxt + boxb;
+ minw = pd->min.w + boxl + boxr;
+ minh = pd->min.h + pad * (count - 1) + boxt + boxb;
/* if (pd->item_count > count) */
/* minh = pd->item_count * average_item_size; */
}
- /* if (pd->minh != minh || pd->minw != minw) */
- /* { */
- /* pd->minw = minw; */
- /* pd->minh = minh; */
-
- /* efl_event_callback_legacy_call(pd->pan.obj, ELM_PAN_EVENT_CHANGED, NULL); */
- /* } */
+ if (pd->min.h != minh || pd->min.w != minw)
+ {
+ pd->min.w = minw;
+ pd->min.h = minh;
+ }
- /* evas_object_size_hint_min_set(wd->resize_obj, pd->minw, pd->minh); */
+ DBG("min_size_set w:%d h:%d", pd->min.w, pd->min.h);
+ efl_ui_list_model_min_size_set(modeler, pd->min);
if (extra < 0) extra = 0;
@@ -267,6 +274,10 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
weight[!horiz] = count;
}
+ elm_interface_scrollable_content_viewport_geometry_get
+ (modeler, NULL, NULL, &ow, &oh);
+
+ elm_interface_scrollable_content_pos_get(modeler, &scr_x, &scr_y);
/* cur_pos += average_item_size * pd->realized.start; */
/* // scan all items, get their properties, calculate total weight & min size */
// cache size of new items
@@ -282,7 +293,7 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
if(size)
{
- DBG("size information for item %d width %d height %d", i, size->min_width, size->min_height);
+// DBG("size information for item %d width %d height %d", i, size->min.w, size->min.h);
assert(layout_item->layout != NULL);
efl_gfx_size_hint_align_get(layout_item->layout, &align[0], &align[1]);
@@ -296,8 +307,8 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
if (max.w <= 0) max.w = INT_MAX;
if (max.h <= 0) max.h = INT_MAX;
- if (max.w < size->min_width) max.w = size->min_width;
- if (max.h < size->min_height) max.h = size->min_height;
+ if (max.w < size->min.w) max.w = size->min.w;
+ if (max.h < size->min.h) max.h = size->min.h;
/* // extra rounding up (compensate cumulative error) */
/* if ((id == (count - 1)) && (cur_pos - floor(cur_pos) >= 0.5)) */
@@ -307,7 +318,7 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
{
cx = boxx + cur_pos;
cy = boxy;
- cw = size->min_width + rounding + (zeroweight ? 1.0 : size->weight_x) * extra / weight[0];
+ cw = size->min.w + rounding + (zeroweight ? 1.0 : size->weight_x) * extra / weight[0];
ch = boxh;
cur_pos += cw + pad;
}
@@ -316,14 +327,14 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
cx = boxx;
cy = boxy + cur_pos;
cw = boxw;
- ch = size->min_height + rounding + (zeroweight ? 1.0 : size->weight_y) * extra / weight[1];
+ ch = size->min.h + rounding + (zeroweight ? 1.0 : size->weight_y) * extra / weight[1];
cur_pos += ch + pad;
}
// horizontally
if (max.w < INT_MAX)
{
- w = MIN(MAX(size->min_width - item_pad[0] - item_pad[1], max.w), cw);
+ w = MIN(MAX(size->min.w - item_pad[0] - item_pad[1], max.w), cw);
if (align[0] < 0)
{
// bad case: fill+max are not good together
@@ -340,14 +351,14 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
}
else
{
- w = size->min_width - item_pad[0] - item_pad[1];
+ w = size->min.w - item_pad[0] - item_pad[1];
x = cx + ((cw - w) * align[0]) + item_pad[0];
}
// vertically
if (max.h < INT_MAX)
{
- h = MIN(MAX(size->min_height - item_pad[2] - item_pad[3], max.h), ch);
+ h = MIN(MAX(size->min.h - item_pad[2] - item_pad[3], max.h), ch);
if (align[1] < 0)
{
// bad case: fill+max are not good together
@@ -364,22 +375,22 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
}
else
{
- h = size->min_height - item_pad[2] - item_pad[3];
+ h = size->min.h - item_pad[2] - item_pad[3];
y = cy + ((ch - h) * align[1]) + item_pad[2];
}
- /* if (horiz) */
- /* { */
- /* if (h < pd->minh) h = pd->minh; */
- /* if (h > oh) h = oh; */
- /* } */
- /* else */
- /* { */
- /* if (w < pd->minw) w = pd->minw; */
- /* if (w > ow) w = ow; */
- /* } */
+ if (horiz)
+ {
+ if (h < pd->min.h) h = pd->min.h;
+ if (h > oh) h = oh;
+ }
+ else
+ {
+ if (w < pd->min.w) w = pd->min.w;
+ if (w > ow) w = ow;
+ }
- evas_object_geometry_set(layout_item->layout, (x + 0 - /*pd->pan.x*/0), (y + 0 - /*pd->pan.y*/0), w, h);
+ evas_object_geometry_set(layout_item->layout, (x + 0 - scr_x), (y + 0 - scr_y), w, h);
/* layout_item->x = x; */
/* layout_item->y = y; */
@@ -392,7 +403,6 @@ _efl_ui_list_precise_layouter_efl_ui_list_relayout_layout_do
/* // , eina_inarray_count(&pd->items.array) ? (/\*horz*\/ EINA_FALSE ? pd->realized.w : pd->realized.h) / eina_inarray_count(&pd->items.array) : AVERAGE_SIZE_INIT); */
}
}
-
}
#include "efl_ui_list_precise_layouter.eo.c"
diff --git a/src/lib/elementary/efl_ui_list_precise_layouter.eo b/src/lib/elementary/efl_ui_list_precise_layouter.eo
index f06dbc3379..dc49c8d85e 100644
--- a/src/lib/elementary/efl_ui_list_precise_layouter.eo
+++ b/src/lib/elementary/efl_ui_list_precise_layouter.eo
@@ -1,6 +1,7 @@
class Efl.Ui.List.Precise_Layouter (Efl.Object, Efl.Ui.List.Relayout)
{
implements {
+ Efl.Object.constructor;
Efl.Ui.List.Relayout.layout_do;
}
}
diff --git a/src/lib/elementary/efl_ui_list_private.h b/src/lib/elementary/efl_ui_list_private.h
index 5baade5484..be88bf34d1 100644
--- a/src/lib/elementary/efl_ui_list_private.h
+++ b/src/lib/elementary/efl_ui_list_private.h
@@ -64,11 +64,8 @@ struct _Efl_Ui_List_Data
int segarray_first;
Efl_Ui_List_SegArray segarray;
-
- struct {
- Evas_Coord x, y, move_diff;
- Evas_Object *obj;
- } pan;
+
+ Evas_Object *pan_obj;
Efl_Ui_Layout_Factory *factory;
Eina_List *selected_items;
@@ -80,7 +77,7 @@ struct _Efl_Ui_List_Data
Elm_List_Mode mode;
Efl_Ui_Focus_Manager *manager;
- Evas_Coord minw, minh;
+ Eina_Size2D min;
int /*average_item_size, avsom, */item_count;
Efl_Future *slice_future;
Efl_Future *count_future;
@@ -100,7 +97,8 @@ typedef struct _Efl_Ui_List_Pan_Data Efl_Ui_List_Pan_Data;
struct _Efl_Ui_List_Pan_Data
{
Eo *wobj;
- Efl_Ui_List_Data *wpd;
+ Evas_Coord x, y, move_diff;
+
Ecore_Job *resize_job;
};
diff --git a/src/lib/elementary/efl_ui_list_segarray.c b/src/lib/elementary/efl_ui_list_segarray.c
index aca7c42b6e..48bdf25c8d 100644
--- a/src/lib/elementary/efl_ui_list_segarray.c
+++ b/src/lib/elementary/efl_ui_list_segarray.c
@@ -179,8 +179,6 @@ void efl_ui_list_segarray_insert_accessor(Efl_Ui_List_SegArray* segarray, int fi
/* } */
/* } */
}
-
- printf("** accessor count %d **\n", i);
}
int efl_ui_list_segarray_count(Efl_Ui_List_SegArray const* segarray)
@@ -216,7 +214,6 @@ _efl_ui_list_segarray_accessor_get_at(Efl_Ui_List_Segarray_Eina_Accessor* acc,
}
else
DBG("no node found with index %d", idx);
- printf(">> NOOO %s - idx:%d\n", __FUNCTION__, idx);
return EINA_FALSE;
}