summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-07-25 22:02:55 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-07-25 22:02:55 +0200
commit98bb23014cfdfe7101797c4b7c44192e87c12c35 (patch)
tree45c4a03df4e7f898fa8ca0efc04582ce6010f7b0
parentecb44d740c3df1af5e5e5a47305aafe5f9aeb64b (diff)
elm_items_display: Present a pan abstract which implements most of the
work The most work of the pan object is the same and is not bound to the layout of the items, so present a abstraction for that.
-rw-r--r--src/lib/items/CMakeLists.txt2
-rw-r--r--src/lib/items/Elm_Items.h1
-rw-r--r--src/lib/items/elm_items_display.c127
-rw-r--r--src/lib/items/elm_items_display.eo12
-rw-r--r--src/lib/items/elm_items_list.c267
-rw-r--r--src/lib/items/elm_items_list_pan.eo21
-rw-r--r--src/lib/items/elm_items_pan.eo36
-rw-r--r--src/lib/items/elm_items_priv.h11
8 files changed, 280 insertions, 197 deletions
diff --git a/src/lib/items/CMakeLists.txt b/src/lib/items/CMakeLists.txt
index dba1e36..6f500fe 100644
--- a/src/lib/items/CMakeLists.txt
+++ b/src/lib/items/CMakeLists.txt
@@ -15,6 +15,8 @@ LIST(APPEND ELM_ITEMS_LIBRARY
15 elm_items_list.eo.h 15 elm_items_list.eo.h
16 elm_items_list_pan.eo.x 16 elm_items_list_pan.eo.x
17 elm_items_list_pan.eo.h 17 elm_items_list_pan.eo.h
18 elm_items_pan.eo.x
19 elm_items_pan.eo.h
18 ) 20 )
19 21
20string(REPLACE "\n" "" EOLIAN_EO_DIR_WITHOUT_NEWLINE 22string(REPLACE "\n" "" EOLIAN_EO_DIR_WITHOUT_NEWLINE
diff --git a/src/lib/items/Elm_Items.h b/src/lib/items/Elm_Items.h
index 62baa38..bdbfb78 100644
--- a/src/lib/items/Elm_Items.h
+++ b/src/lib/items/Elm_Items.h
@@ -10,7 +10,6 @@
10#include "elm_items_item.eo.h" 10#include "elm_items_item.eo.h"
11#include "elm_items_display.eo.h" 11#include "elm_items_display.eo.h"
12#include "elm_items_list.eo.h" 12#include "elm_items_list.eo.h"
13#include "elm_items_list_pan.eo.h"
14 13
15EAPI int elm_items_init(); 14EAPI int elm_items_init();
16EAPI int elm_items_shutdown(); 15EAPI int elm_items_shutdown();
diff --git a/src/lib/items/elm_items_display.c b/src/lib/items/elm_items_display.c
index c79a336..aad2df7 100644
--- a/src/lib/items/elm_items_display.c
+++ b/src/lib/items/elm_items_display.c
@@ -1,13 +1,103 @@
1#include "elm_items_priv.h" 1#include "elm_items_priv.h"
2 2
3typedef struct { 3typedef struct {
4 Efl_Tree_Base *root; //< the root item of the item node 4 struct {
5 Eina_List *realized; //< list of realized items 5 int w;
6 Evas_Object *pane; //< the pane of the implementor 6 int h;
7 Eina_Strbuf *search; 7 } content;
8 Ecore_Idler *recalc_idler; 8 Elm_Items_Rect viewport;
9 Eina_List *selected; //< list of selected items 9 Elm_Items_Position position;
10} Elm_Items_Display_Data; 10} Elm_Items_Pan_Data;
11
12//==================================
13// Pan implement
14//==================================
15
16EOLIAN static void
17_elm_items_pan_realitems(Eo *obj, Elm_Items_Pan_Data *pd, Eina_List *list EINA_UNUSED)
18{
19 //the items has changed
20 eo_do(obj, elm_items_pan_content_size_get(&pd->content.w, &pd->content.h));
21 printf("Content size: (%d-%d)\n", pd->content.w, pd->content.h);
22 eo_do(obj, eo_event_callback_call(ELM_PAN_EVENT_CHANGED, NULL));
23}
24
25EOLIAN static void
26_elm_items_pan_elm_pan_pos_set(Eo *obj, Elm_Items_Pan_Data *pd, Evas_Coord x, Evas_Coord y)
27{
28 pd->position.y = y;
29 pd->position.x = x;
30
31 eo_do(obj, elm_items_pan_viewport_changed(pd->viewport, pd->position));
32}
33
34EOLIAN static void
35_elm_items_pan_elm_pan_pos_get(Eo *obj EINA_UNUSED, Elm_Items_Pan_Data *pd, Evas_Coord *x, Evas_Coord *y)
36{
37 if (x)
38 *x = pd->position.x;
39
40 if (y)
41 *y = pd->position.y;
42}
43
44EOLIAN static void
45_elm_items_pan_elm_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Items_Pan_Data *pd, Evas_Coord *w, Evas_Coord *h)
46{
47 if (w)
48 *w = pd->content.w;
49 if (h)
50 *h = pd->content.h;
51}
52
53EOLIAN static void
54_elm_items_pan_elm_pan_pos_min_get(Eo *obj EINA_UNUSED, Elm_Items_Pan_Data *pd EINA_UNUSED, Evas_Coord *x, Evas_Coord *y)
55{
56 if (x)
57 *x = 0;
58 if (y)
59 *y = 0;
60}
61
62EOLIAN static void
63_elm_items_pan_elm_pan_pos_max_get(Eo *obj EINA_UNUSED, Elm_Items_Pan_Data *pd, Evas_Coord *x, Evas_Coord *y)
64{
65 if (x)
66 {
67 *x = pd->content.w - pd->viewport.w;
68 if (*x < 0)
69 *x = 0;
70 }
71
72 if (y)
73 {
74 *y = pd->content.h - pd->viewport.h;
75 if (*y < 0)
76 *y = 0;
77 }
78}
79
80EOLIAN static void
81_elm_items_pan_evas_object_smart_resize(Eo *obj, Elm_Items_Pan_Data *pd, Evas_Coord w, Evas_Coord h)
82{
83 pd->viewport.w = w;
84 pd->viewport.h = h;
85 eo_do(obj, elm_items_pan_viewport_changed(pd->viewport, pd->position));
86 eo_do(obj, eo_event_callback_call(ELM_PAN_EVENT_CHANGED, NULL));
87}
88
89EOLIAN static void
90_elm_items_pan_evas_object_smart_move(Eo *obj, Elm_Items_Pan_Data *pd, Evas_Coord x, Evas_Coord y)
91{
92 pd->viewport.pos.x = x;
93 pd->viewport.pos.y = y;
94 eo_do(obj, elm_items_pan_viewport_changed(pd->viewport, pd->position));
95 eo_do(obj, eo_event_callback_call(ELM_PAN_EVENT_CHANGED, NULL));
96}
97
98//==================================
99// Displayer implement
100//==================================
11 101
12EOLIAN static Efl_Tree_Base * 102EOLIAN static Efl_Tree_Base *
13_elm_items_display_tree_get(Eo *obj EINA_UNUSED, Elm_Items_Display_Data *pd) 103_elm_items_display_tree_get(Eo *obj EINA_UNUSED, Elm_Items_Display_Data *pd)
@@ -187,7 +277,7 @@ _del(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description2 *desc EINA_UNU
187 eo_do(good, eo_event_callback_del(ELM_ITEMS_ITEM_EVENT_SELECTED, _selected, data); 277 eo_do(good, eo_event_callback_del(ELM_ITEMS_ITEM_EVENT_SELECTED, _selected, data);
188 eo_event_callback_del(ELM_ITEMS_ITEM_EVENT_UNSELECTED, _unselected, data); 278 eo_event_callback_del(ELM_ITEMS_ITEM_EVENT_UNSELECTED, _unselected, data);
189 ); 279 );
190 280 //TODO remove from realitems list
191 //remove from selected 281 //remove from selected
192 pd->selected = eina_list_remove(pd->selected, good); 282 pd->selected = eina_list_remove(pd->selected, good);
193 //remove from potential realized 283 //remove from potential realized
@@ -205,6 +295,7 @@ _add(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description2 *desc EINA_UNU
205 eo_do(good, eo_event_callback_add(ELM_ITEMS_ITEM_EVENT_SELECTED, _selected, data); 295 eo_do(good, eo_event_callback_add(ELM_ITEMS_ITEM_EVENT_SELECTED, _selected, data);
206 eo_event_callback_add(ELM_ITEMS_ITEM_EVENT_UNSELECTED, _unselected, data); 296 eo_event_callback_add(ELM_ITEMS_ITEM_EVENT_UNSELECTED, _unselected, data);
207 ); 297 );
298 //TODO put in realitems list
208 //XXX: check if selected and add to list 299 //XXX: check if selected and add to list
209 return EO_CALLBACK_CONTINUE; 300 return EO_CALLBACK_CONTINUE;
210} 301}
@@ -223,13 +314,14 @@ _elm_items_display_eo_base_constructor(Eo *obj, Elm_Items_Display_Data *pd)
223 pd->root = eo_add(EFL_TREE_BASE_CLASS, NULL); 314 pd->root = eo_add(EFL_TREE_BASE_CLASS, NULL);
224 315
225 eo_do(pd->root, 316 eo_do(pd->root,
226 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_DEL_RECURSIVE, _del, obj); 317 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_DEL_RECURSIVE, _del, obj);
227 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_DEL_DIRECT, _del, obj); 318 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_DEL_DIRECT, _del, obj);
228 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_ADD_RECURSIVE, _add, obj); 319 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_ADD_RECURSIVE, _add, obj);
229 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_ADD_DIRECT, _add, obj); 320 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_ADD_DIRECT, _add, obj);
230 ); 321 );
231 322
232 eo_do_super(obj, ELM_ITEMS_DISPLAY_CLASS, eo = eo_constructor()); 323 eo_do_super(obj, ELM_ITEMS_DISPLAY_CLASS, eo = eo_constructor());
324
233 return eo; 325 return eo;
234} 326}
235 327
@@ -295,17 +387,13 @@ _elm_items_display_realizes_get(Eo *obj EINA_UNUSED, Elm_Items_Display_Data *pd)
295EOLIAN static Eina_List * 387EOLIAN static Eina_List *
296_elm_items_display_item_search_xywh(Eo *obj EINA_UNUSED, Elm_Items_Display_Data *pd, int xx, int yy, int ww, int hh) 388_elm_items_display_item_search_xywh(Eo *obj EINA_UNUSED, Elm_Items_Display_Data *pd, int xx, int yy, int ww, int hh)
297{ 389{
298 Eina_List *children, *node; 390 Eina_List *node;
299 Efl_Tree_Base *treeitem;
300 Elm_Items_Item *item; 391 Elm_Items_Item *item;
301 Eina_List *items = NULL; 392 Eina_List *items = NULL;
302 Eina_Rectangle viewport; 393 Eina_Rectangle viewport;
303 394
304 EINA_RECTANGLE_SET(&viewport, xx, yy, ww, hh); 395 EINA_RECTANGLE_SET(&viewport, xx, yy, ww, hh);
305 396
306 //get all the childs
307 //eo_do(pd->root, children = efl_tree_base_children(EINA_TRUE));
308
309 //iterate throuw all the childs 397 //iterate throuw all the childs
310 EINA_LIST_FOREACH(pd->realized, node, item) 398 EINA_LIST_FOREACH(pd->realized, node, item)
311 { 399 {
@@ -325,4 +413,5 @@ _elm_items_display_item_search_xywh(Eo *obj EINA_UNUSED, Elm_Items_Display_Data
325 return items; 413 return items;
326} 414}
327 415
328#include "elm_items_display.eo.x" \ No newline at end of file 416#include "elm_items_display.eo.x"
417#include "elm_items_pan.eo.x" \ No newline at end of file
diff --git a/src/lib/items/elm_items_display.eo b/src/lib/items/elm_items_display.eo
index 7ed639b..2693aed 100644
--- a/src/lib/items/elm_items_display.eo
+++ b/src/lib/items/elm_items_display.eo
@@ -2,6 +2,17 @@ enum Elm.Items.Move_Dir {
2 NORTH, WEST, EAST, SOUTH 2 NORTH, WEST, EAST, SOUTH
3} 3}
4 4
5struct Elm.Items.Position{
6 x : int;
7 y : int;
8}
9
10struct Elm.Items.Rect {
11 pos : Elm.Items.Position;
12 w : int;
13 h : int;
14}
15
5abstract Elm.Items.Display (Elm.Scroller) { 16abstract Elm.Items.Display (Elm.Scroller) {
6 [[]] 17 [[]]
7 methods { 18 methods {
@@ -35,6 +46,7 @@ abstract Elm.Items.Display (Elm.Scroller) {
35 search : const(char)*; 46 search : const(char)*;
36 } 47 }
37 } 48 }
49
38 @property selected { 50 @property selected {
39 get { 51 get {
40 52
diff --git a/src/lib/items/elm_items_list.c b/src/lib/items/elm_items_list.c
index 72aa2ab..0c3e485 100644
--- a/src/lib/items/elm_items_list.c
+++ b/src/lib/items/elm_items_list.c
@@ -11,18 +11,101 @@ typedef struct {
11} Elm_Items_List_Data; 11} Elm_Items_List_Data;
12 12
13typedef struct { 13typedef struct {
14 Evas_Box *box;
15 Eo *obj; 14 Eo *obj;
16 int w,h; 15 Evas_Box *box;
17 int px,py; 16 unsigned int old_first, old_last;
18 int y;
19 int old_first;
20 int old_last;
21 Eina_List *realitems; 17 Eina_List *realitems;
22 Eina_List *realized; 18 Eina_List *realized;
23} Elm_Items_List_Pan_Data; 19} Elm_Items_List_Pan_Data;
24 20
21#if 0
22#define PRINT_DEBUG
23#endif
24
25#define HACKY_HEIGHT 30 25#define HACKY_HEIGHT 30
26//==================================
27// Pan implement
28//==================================
29
30EOLIAN static void
31_elm_items_list_pan_elm_items_pan_realitems(Eo *obj EINA_UNUSED, Elm_Items_List_Pan_Data *pd, Eina_List *list)
32{
33 pd->realitems = list;
34 eo_do_super(obj, ELM_ITEMS_LIST_PAN_CLASS, elm_items_pan_realitems(list));
35}
36
37EOLIAN static void
38_elm_items_list_pan_elm_items_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Items_List_Pan_Data *pd, int *w, int *h)
39{
40 *w = 0;
41 *h = eina_list_count(pd->realitems) * HACKY_HEIGHT;
42}
43
44EOLIAN static void
45_elm_items_list_pan_elm_items_pan_viewport_changed(Eo *obj, Elm_Items_List_Pan_Data *pd, Elm_Items_Rect viewport, Elm_Items_Position position)
46{
47 unsigned int first_item, last_item;
48 int gap;
49 Eina_List *realizes = NULL;
50
51 gap = position.y % (HACKY_HEIGHT);
52 first_item = position.y / HACKY_HEIGHT;
53 last_item = ((position.y + viewport.h) / HACKY_HEIGHT);
54
55 if (last_item > eina_list_count(pd->realitems))
56 last_item = eina_list_count(pd->realitems);
57
58 #ifdef PRINT_DEBUG
59 printf("Size : (%d-%d-%d-%d) Pos :(%d-%d) Items:(%d-%d)\n", viewport.pos.x, viewport.pos.y, viewport.w, viewport.h, position.x, position.y, first_item, last_item);
60 #endif
61
62 //remove all children from the box if we have new items
63 if (pd->old_last != last_item || pd->old_first != first_item)
64 evas_object_box_remove_all(pd->box, EINA_FALSE);
65
66 //move the box to the new position
67 evas_object_move(pd->box, viewport.pos.x, viewport.pos.y - (gap));
68 evas_object_resize(pd->box, viewport.w, (last_item - first_item) * HACKY_HEIGHT);
69
70 if (pd->old_last != last_item || pd->old_first != first_item)
71 {
72 Eina_List *itemlist;
73 //add the new items
74 itemlist = eina_list_nth_list(pd->realitems, first_item);
75
76 for (unsigned int i = first_item; i <= last_item; i++)
77 {
78 Eo *item;
79
80 item = eina_list_data_get(itemlist);
81
82 evas_object_box_append(pd->box, item);
83 realizes = eina_list_append(realizes, item);
84 itemlist = eina_list_next(itemlist);
85 }
86 //update old items
87 pd->old_first = first_item;
88 pd->old_last = last_item;
89 //set new realizes
90 eo_do(pd->obj, elm_items_display_realizes_set(realizes));
91 }
92}
93
94EOLIAN static void
95_elm_items_list_pan_evas_object_smart_add(Eo *obj, Elm_Items_List_Pan_Data *pd)
96{
97 eo_do_super(obj, ELM_ITEMS_LIST_PAN_CLASS, evas_obj_smart_add());
98
99 pd->box = evas_object_box_add(evas_object_evas_get(obj));
100 evas_object_smart_member_add(pd->box, obj);
101 evas_object_box_layout_set(pd->box, evas_object_box_layout_vertical, pd->box, NULL);
102 evas_object_box_align_set(pd->box, 0.0, 0.0);
103 evas_object_show(pd->box);
104}
105
106//==================================
107// List implement
108//==================================
26 109
27EOLIAN static void 110EOLIAN static void
28_elm_items_list_elm_items_display_select(Eo *obj, Elm_Items_List_Data *pd EINA_UNUSED) 111_elm_items_list_elm_items_display_select(Eo *obj, Elm_Items_List_Data *pd EINA_UNUSED)
@@ -47,6 +130,18 @@ EOLIAN static void
47_elm_items_list_evas_object_smart_add(Eo *obj, Elm_Items_List_Data *pd EINA_UNUSED) 130_elm_items_list_evas_object_smart_add(Eo *obj, Elm_Items_List_Data *pd EINA_UNUSED)
48{ 131{
49 eo_do_super(obj, ELM_ITEMS_LIST_CLASS, evas_obj_smart_add()); 132 eo_do_super(obj, ELM_ITEMS_LIST_CLASS, evas_obj_smart_add());
133
134 pd->pan = eo_add(ELM_ITEMS_LIST_PAN_CLASS, obj);
135
136 {
137 Elm_Items_List_Pan_Data *pdpan = eo_data_scope_get(pd->pan, ELM_ITEMS_LIST_PAN_CLASS);
138 pdpan->obj = obj;
139 evas_object_show(pd->pan);
140 //set pan object
141 Elm_Items_Display_Data *display_pd = eo_data_scope_get(obj, ELM_ITEMS_DISPLAY_CLASS);
142 display_pd->pan = pd->pan;
143 }
144
50} 145}
51 146
52static Eina_Bool 147static Eina_Bool
@@ -108,7 +203,7 @@ _idle_tree_flush(void *data)
108 Elm_Items_List_Data *pd; 203 Elm_Items_List_Data *pd;
109 204
110 pd = eo_data_scope_get(data, ELM_ITEMS_LIST_CLASS); 205 pd = eo_data_scope_get(data, ELM_ITEMS_LIST_CLASS);
111 eo_do(pd->pan, elm_items_list_pan_realitems(pd->realitems)); 206 eo_do(pd->pan, elm_items_pan_realitems(pd->realitems));
112 207
113 pd->flush_idle = NULL; 208 pd->flush_idle = NULL;
114 209
@@ -174,7 +269,10 @@ _elm_items_list_eo_base_constructor(Eo *obj, Elm_Items_List_Data *pd)
174 eo_do_super(obj, ELM_ITEMS_LIST_CLASS, eo = eo_constructor()); 269 eo_do_super(obj, ELM_ITEMS_LIST_CLASS, eo = eo_constructor());
175 270
176 if (!eo) 271 if (!eo)
177 return eo; 272 return NULL;
273
274 //set pan
275 eo_do(obj, elm_interface_scrollable_extern_pan_set(pd->pan));
178 276
179 //get the root 277 //get the root
180 eo_do(obj, pd->root = elm_items_display_tree_get()); 278 eo_do(obj, pd->root = elm_items_display_tree_get());
@@ -184,161 +282,8 @@ _elm_items_list_eo_base_constructor(Eo *obj, Elm_Items_List_Data *pd)
184 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_ADD_DIRECT, _add, obj); 282 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_ADD_DIRECT, _add, obj);
185 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_DEL_DIRECT, _del, obj); 283 eo_event_callback_add(EFL_TREE_BASE_EVENT_CHILDREN_DEL_DIRECT, _del, obj);
186 ); 284 );
187
188 pd->pan = eo_add(ELM_ITEMS_LIST_PAN_CLASS, obj);
189 {
190 Elm_Items_List_Pan_Data *pdpan = eo_data_scope_get(pd->pan, ELM_ITEMS_LIST_PAN_CLASS);
191 pdpan->obj = obj;
192 pdpan->box = evas_object_box_add(evas_object_evas_get(obj));
193 evas_object_smart_member_add(pdpan->box, pd->pan);
194 evas_object_box_padding_set(pdpan->box, 0, 0);
195 evas_object_box_align_set(pdpan->box, 0.0, 0.0);
196 evas_object_box_layout_set(pdpan->box, evas_object_box_layout_vertical, pdpan->box, NULL);
197 evas_object_show(pdpan->box);
198 }
199
200 eo_do(obj, elm_interface_scrollable_extern_pan_set(pd->pan));
201 return eo; 285 return eo;
202} 286}
203 287
204//===== pan element =====
205
206static void
207_pan_update(Eo *obj, Elm_Items_List_Pan_Data *pd)
208{
209 int first_item, last_item;
210 int gap;
211 Eina_Bool realize_dir;
212 Eina_List *realizes = NULL;
213
214 gap = pd->y % (HACKY_HEIGHT);
215 first_item = pd->y / HACKY_HEIGHT;
216 last_item = ((pd->y + pd->h) / HACKY_HEIGHT);
217
218 //remove all children from the box if we have new items
219 if (pd->old_last != last_item || pd->old_first != first_item)
220 evas_object_box_remove_all(pd->box, EINA_FALSE);
221
222 //move the box to the new position
223 evas_object_move(pd->box, pd->px, pd->py - (gap));
224 evas_object_resize(pd->box, pd->w, (last_item - first_item) * HACKY_HEIGHT);
225
226
227 if (pd->old_last != last_item || pd->old_first != first_item)
228 {
229 Eina_List *itemlist;
230 //add the new items
231 itemlist = eina_list_nth_list(pd->realitems, first_item);
232
233 for (int i = first_item; i <= last_item; i++)
234 {
235 Eo *item;
236
237 item = eina_list_data_get(itemlist);
238
239 evas_object_box_append(pd->box, item);
240 realizes = eina_list_append(realizes, item);
241 itemlist = eina_list_next(itemlist);
242 }
243 //update old items
244 pd->old_first = first_item;
245 pd->old_last = last_item;
246 //set new realizes
247 eo_do(pd->obj, elm_items_display_realizes_set(realizes));
248 }
249}
250
251EOLIAN static void
252_elm_items_list_pan_realitems(Eo *obj, Elm_Items_List_Pan_Data *pd, Eina_List *list)
253{
254 eo_do(pd->obj, elm_items_display_realizes_set(NULL));
255 pd->old_first = -1;
256 pd->old_last = -1;
257 //set new list
258 pd->realized = NULL;
259 pd->realitems = list;
260 //update pan
261 _pan_update(obj, pd);
262 eo_do(obj, eo_event_callback_call(ELM_PAN_EVENT_CHANGED, NULL));
263}
264
265EOLIAN static void
266_elm_items_list_pan_elm_pan_gravity_set(Eo *obj, Elm_Items_List_Pan_Data *pd, double x, double y)
267{
268
269}
270
271EOLIAN static void
272_elm_items_list_pan_elm_pan_gravity_get(Eo *obj, Elm_Items_List_Pan_Data *pd, double *x, double *y)
273{
274 if (x)
275 *x = 0;
276 if (y)
277 *y = 0;
278}
279
280EOLIAN static void
281_elm_items_list_pan_elm_pan_pos_set(Eo *obj, Elm_Items_List_Pan_Data *pd, Evas_Coord x, Evas_Coord y)
282{
283 if (pd->y == y) return;
284 pd->y = y;
285
286 _pan_update(obj, pd);
287}
288
289EOLIAN static void
290_elm_items_list_pan_elm_pan_pos_get(Eo *obj EINA_UNUSED, Elm_Items_List_Pan_Data *pd, Evas_Coord *x, Evas_Coord *y)
291{
292 if (x)
293 *x = 0;
294 if (y)
295 *y = pd->y;
296}
297
298EOLIAN static void
299_elm_items_list_pan_elm_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Items_List_Pan_Data *pd, Evas_Coord *w, Evas_Coord *h)
300{
301 if (w)
302 *w = 10;
303 if (h)
304 *h = eina_list_count(pd->realitems) * HACKY_HEIGHT;
305}
306
307EOLIAN static void
308_elm_items_list_pan_elm_pan_pos_min_get(Eo *obj EINA_UNUSED, Elm_Items_List_Pan_Data *pd EINA_UNUSED, Evas_Coord *x, Evas_Coord *y)
309{
310 if (x)
311 *x = 0;
312 if (y)
313 *y = 0;
314}
315
316EOLIAN static void
317_elm_items_list_pan_elm_pan_pos_max_get(Eo *obj EINA_UNUSED, Elm_Items_List_Pan_Data *pd, Evas_Coord *x, Evas_Coord *y)
318{
319 if (x)
320 *x = 0;
321 if (y)
322 *y = eina_list_count(pd->realitems) * HACKY_HEIGHT - pd->h;
323}
324
325EOLIAN static void
326_elm_items_list_pan_evas_object_smart_resize(Eo *obj EINA_UNUSED, Elm_Items_List_Pan_Data *pd, Evas_Coord w, Evas_Coord h)
327{
328 pd->w = w;
329 pd->h = h;
330 _pan_update(obj, pd);
331 eo_do_super(obj, ELM_ITEMS_LIST_PAN_CLASS, evas_obj_smart_resize(w, h));
332}
333
334EOLIAN static void
335_elm_items_list_pan_evas_object_smart_move(Eo *obj, Elm_Items_List_Pan_Data *pd, Evas_Coord x, Evas_Coord y)
336{
337 pd->px = x;
338 pd->py = y;
339 _pan_update(obj, pd);
340 eo_do_super(obj, ELM_ITEMS_LIST_PAN_CLASS, evas_obj_smart_move(x, y));
341}
342
343#include "elm_items_list.eo.x" 288#include "elm_items_list.eo.x"
344#include "elm_items_list_pan.eo.x" \ No newline at end of file 289#include "elm_items_list_pan.eo.x" \ No newline at end of file
diff --git a/src/lib/items/elm_items_list_pan.eo b/src/lib/items/elm_items_list_pan.eo
index 0a70132..9dc5859 100644
--- a/src/lib/items/elm_items_list_pan.eo
+++ b/src/lib/items/elm_items_list_pan.eo
@@ -1,21 +1,12 @@
1class Elm.Items.List.Pan (Elm_Pan) { 1class Elm.Items.List.Pan (Elm.Items.Pan) {
2 methods { 2 methods {
3 realitems { 3
4 params {
5 list : list<Elm.Items.Item*>*;
6 }
7 }
8 } 4 }
9 5
10 implements { 6 implements {
11 Elm_Pan.gravity.set; 7 Elm.Items.Pan.realitems;
12 Elm_Pan.gravity.get; 8 Elm.Items.Pan.content_size.get;
13 Elm_Pan.pos.set; 9 Elm.Items.Pan.viewport_changed;
14 Elm_Pan.pos.get; 10 Evas.Object_Smart.add;
15 Elm_Pan.content_size.get;
16 Elm_Pan.pos_min.get;
17 Elm_Pan.pos_max.get;
18 Evas.Object_Smart.resize;
19 Evas.Object_Smart.move;
20 } 11 }
21} \ No newline at end of file 12} \ No newline at end of file
diff --git a/src/lib/items/elm_items_pan.eo b/src/lib/items/elm_items_pan.eo
new file mode 100644
index 0000000..81c33a2
--- /dev/null
+++ b/src/lib/items/elm_items_pan.eo
@@ -0,0 +1,36 @@
1abstract Elm.Items.Pan (Elm_Pan) {
2 methods {
3 realitems {
4 params {
5 list : list<Elm.Items.Item*>*;
6 }
7 }
8 @property content_size {
9 get {
10
11 }
12 values {
13 w : int;
14 h : int;
15 }
16 }
17 viewport_changed {
18 params {
19 viewport : Elm.Items.Rect;
20 position : Elm.Items.Position;
21 }
22 }
23 }
24
25 implements {
26 @virtual .content_size.get;
27 @virtual .viewport_changed;
28 Elm_Pan.pos.set;
29 Elm_Pan.pos.get;
30 Elm_Pan.content_size.get;
31 Elm_Pan.pos_min.get;
32 Elm_Pan.pos_max.get;
33 Evas.Object_Smart.resize;
34 Evas.Object_Smart.move;
35 }
36} \ No newline at end of file
diff --git a/src/lib/items/elm_items_priv.h b/src/lib/items/elm_items_priv.h
index eb3291e..b23a61b 100644
--- a/src/lib/items/elm_items_priv.h
+++ b/src/lib/items/elm_items_priv.h
@@ -2,7 +2,8 @@
2#define ELM_ITEMS_PRIV 2#define ELM_ITEMS_PRIV
3 3
4#include "Elm_Items.h" 4#include "Elm_Items.h"
5 5#include "elm_items_pan.eo.h"
6#include "elm_items_list_pan.eo.h"
6#define ELM_INTERNAL_API_ARGESFSDFEFC 7#define ELM_INTERNAL_API_ARGESFSDFEFC
7#include <elm_widget.h> 8#include <elm_widget.h>
8 9
@@ -40,4 +41,12 @@ extern int log_domain;
40#define INF(...) EINA_LOG_DOM_INFO(log_domain, __VA_ARGS__) 41#define INF(...) EINA_LOG_DOM_INFO(log_domain, __VA_ARGS__)
41#define DBG(...) EINA_LOG_DOM_DBG(log_domain, __VA_ARGS__) 42#define DBG(...) EINA_LOG_DOM_DBG(log_domain, __VA_ARGS__)
42 43
44typedef struct {
45 Efl_Tree_Base *root; //< the root item of the item node
46 Eina_List *realized; //< list of realized items
47 Eina_Strbuf *search;
48 Eina_List *selected; //< list of selected items
49 Eo *pan;
50} Elm_Items_Display_Data;
51
43#endif \ No newline at end of file 52#endif \ No newline at end of file