summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-07-25 22:16:04 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-07-25 22:16:04 +0200
commitc306761f27b55b75ba1000a51f12922792b6657d (patch)
tree8bf088fb06f1378af93dffd98757746133f3a7cf
parent98bb23014cfdfe7101797c4b7c44192e87c12c35 (diff)
Elm_Items_Pan: move realized items into the pan
The pan object is kept private, so its better to have the items there.
-rw-r--r--src/lib/items/elm_items_display.c109
-rw-r--r--src/lib/items/elm_items_display.eo6
-rw-r--r--src/lib/items/elm_items_list.c2
-rw-r--r--src/lib/items/elm_items_pan.eo12
-rw-r--r--src/lib/items/elm_items_priv.h1
5 files changed, 70 insertions, 60 deletions
diff --git a/src/lib/items/elm_items_display.c b/src/lib/items/elm_items_display.c
index aad2df7..4fb3d70 100644
--- a/src/lib/items/elm_items_display.c
+++ b/src/lib/items/elm_items_display.c
@@ -7,6 +7,7 @@ typedef struct {
7 } content; 7 } content;
8 Elm_Items_Rect viewport; 8 Elm_Items_Rect viewport;
9 Elm_Items_Position position; 9 Elm_Items_Position position;
10 Eina_List *realized;
10} Elm_Items_Pan_Data; 11} Elm_Items_Pan_Data;
11 12
12//================================== 13//==================================
@@ -95,6 +96,56 @@ _elm_items_pan_evas_object_smart_move(Eo *obj, Elm_Items_Pan_Data *pd, Evas_Coor
95 eo_do(obj, eo_event_callback_call(ELM_PAN_EVENT_CHANGED, NULL)); 96 eo_do(obj, eo_event_callback_call(ELM_PAN_EVENT_CHANGED, NULL));
96} 97}
97 98
99EOLIAN static void
100_elm_items_pan_realizes_set(Eo *obj EINA_UNUSED, Elm_Items_Pan_Data *pd, Eina_List *realized)
101{
102 Eina_List *node;
103 Eina_List *realizes = NULL;
104
105 Elm_Items_Item *item;
106 //get the diff between the two sets of items
107 EINA_LIST_FOREACH(realized, node, item)
108 {
109 if (eina_list_data_find_list(pd->realized, item))
110 {
111 //this item is allready realized
112 pd->realized = eina_list_remove(pd->realized, item);
113 }
114 else
115 {
116 //this items needs to be realized
117 realizes = eina_list_append(realizes, item);
118 }
119 }
120 //realize the new ones
121 EINA_LIST_FREE(realizes, item)
122 {
123 eo_do(item, elm_items_item_realize());
124 evas_object_show(item);
125 }
126
127 //unrealize the old realized which are not realized anymore
128 EINA_LIST_FREE(pd->realized, item)
129 {
130 eo_do(item, elm_items_item_unrealize());
131 evas_object_hide(item);
132 }
133
134 pd->realized = realized;
135}
136
137EOLIAN static Eina_List *
138_elm_items_pan_realizes_get(Eo *obj EINA_UNUSED, Elm_Items_Pan_Data *pd)
139{
140 return pd->realized;
141}
142
143EOLIAN static void
144_elm_items_pan_item_del(Eo *obj EINA_UNUSED, Elm_Items_Pan_Data *pd, Elm_Items_Item *item)
145{
146 pd->realized = eina_list_remove(pd->realized, item);
147}
148
98//================================== 149//==================================
99// Displayer implement 150// Displayer implement
100//================================== 151//==================================
@@ -281,7 +332,7 @@ _del(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description2 *desc EINA_UNU
281 //remove from selected 332 //remove from selected
282 pd->selected = eina_list_remove(pd->selected, good); 333 pd->selected = eina_list_remove(pd->selected, good);
283 //remove from potential realized 334 //remove from potential realized
284 pd->realized = eina_list_remove(pd->realized, good); 335 eo_do(pd->pan, elm_items_pan_item_del(good));
285 return EO_CALLBACK_CONTINUE; 336 return EO_CALLBACK_CONTINUE;
286} 337}
287 338
@@ -328,62 +379,11 @@ _elm_items_display_eo_base_constructor(Eo *obj, Elm_Items_Display_Data *pd)
328EOLIAN static void 379EOLIAN static void
329_elm_items_display_eo_base_destructor(Eo *obj, Elm_Items_Display_Data *pd) 380_elm_items_display_eo_base_destructor(Eo *obj, Elm_Items_Display_Data *pd)
330{ 381{
331 Elm_Items_Item *item;
332
333 EINA_LIST_FREE(pd->realized, item)
334 {
335 eo_do(item, eo_event_callback_del(EO_BASE_EVENT_DEL, _del, obj));
336 }
337
338 eo_del(pd->root); 382 eo_del(pd->root);
339 383
340 eo_do_super(obj, ELM_ITEMS_DISPLAY_CLASS, eo_destructor()); 384 eo_do_super(obj, ELM_ITEMS_DISPLAY_CLASS, eo_destructor());
341} 385}
342 386
343EOLIAN static void
344_elm_items_display_realizes_set(Eo *obj EINA_UNUSED, Elm_Items_Display_Data *pd, Eina_List *realized)
345{
346 Eina_List *node;
347 Eina_List *realizes = NULL;
348
349 Elm_Items_Item *item;
350 //get the diff between the two sets of items
351 EINA_LIST_FOREACH(realized, node, item)
352 {
353 if (eina_list_data_find_list(pd->realized, item))
354 {
355 //this item is allready realized
356 pd->realized = eina_list_remove(pd->realized, item);
357 }
358 else
359 {
360 //this items needs to be realized
361 realizes = eina_list_append(realizes, item);
362 }
363 }
364 //realize the new ones
365 EINA_LIST_FREE(realizes, item)
366 {
367 eo_do(item, elm_items_item_realize());
368 evas_object_show(item);
369 }
370
371 //unrealize the old realized which are not realized anymore
372 EINA_LIST_FREE(pd->realized, item)
373 {
374 eo_do(item, elm_items_item_unrealize());
375 evas_object_hide(item);
376 }
377
378 pd->realized = realized;
379}
380
381EOLIAN static Eina_List *
382_elm_items_display_realizes_get(Eo *obj EINA_UNUSED, Elm_Items_Display_Data *pd)
383{
384 return pd->realized;
385}
386
387EOLIAN static Eina_List * 387EOLIAN static Eina_List *
388_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)
389{ 389{
@@ -391,11 +391,14 @@ _elm_items_display_item_search_xywh(Eo *obj EINA_UNUSED, Elm_Items_Display_Data
391 Elm_Items_Item *item; 391 Elm_Items_Item *item;
392 Eina_List *items = NULL; 392 Eina_List *items = NULL;
393 Eina_Rectangle viewport; 393 Eina_Rectangle viewport;
394 Eina_List *realized;
395
396 eo_do(pd->pan, realized = elm_items_pan_realizes_get());
394 397
395 EINA_RECTANGLE_SET(&viewport, xx, yy, ww, hh); 398 EINA_RECTANGLE_SET(&viewport, xx, yy, ww, hh);
396 399
397 //iterate throuw all the childs 400 //iterate throuw all the childs
398 EINA_LIST_FOREACH(pd->realized, node, item) 401 EINA_LIST_FOREACH(realized, node, item)
399 { 402 {
400 int x,y,w,h; 403 int x,y,w,h;
401 Eina_Rectangle itemrect; 404 Eina_Rectangle itemrect;
diff --git a/src/lib/items/elm_items_display.eo b/src/lib/items/elm_items_display.eo
index 2693aed..a9abbba 100644
--- a/src/lib/items/elm_items_display.eo
+++ b/src/lib/items/elm_items_display.eo
@@ -55,11 +55,7 @@ abstract Elm.Items.Display (Elm.Scroller) {
55 selected : list<Elm.Items.Item*>*; 55 selected : list<Elm.Items.Item*>*;
56 } 56 }
57 } 57 }
58 @property realizes { 58
59 values {
60 realizes : list <Elm.Items.Item*>*;
61 }
62 }
63 } 59 }
64 implements { 60 implements {
65 @virtual .sel_move; 61 @virtual .sel_move;
diff --git a/src/lib/items/elm_items_list.c b/src/lib/items/elm_items_list.c
index 0c3e485..e4a684e 100644
--- a/src/lib/items/elm_items_list.c
+++ b/src/lib/items/elm_items_list.c
@@ -87,7 +87,7 @@ _elm_items_list_pan_elm_items_pan_viewport_changed(Eo *obj, Elm_Items_List_Pan_D
87 pd->old_first = first_item; 87 pd->old_first = first_item;
88 pd->old_last = last_item; 88 pd->old_last = last_item;
89 //set new realizes 89 //set new realizes
90 eo_do(pd->obj, elm_items_display_realizes_set(realizes)); 90 eo_do(obj, elm_items_pan_realizes_set(realizes));
91 } 91 }
92} 92}
93 93
diff --git a/src/lib/items/elm_items_pan.eo b/src/lib/items/elm_items_pan.eo
index 81c33a2..d7eb3dc 100644
--- a/src/lib/items/elm_items_pan.eo
+++ b/src/lib/items/elm_items_pan.eo
@@ -1,5 +1,17 @@
1abstract Elm.Items.Pan (Elm_Pan) { 1abstract Elm.Items.Pan (Elm_Pan) {
2 methods { 2 methods {
3 @property realizes {
4 [[Set a list of items which should be realized]]
5 values {
6 realizes : list <Elm.Items.Item*>*;
7 }
8 }
9 item_del {
10 [[called from the display if a item out of the tree got deleted]]
11 params {
12 item : Elm.Items.Item*;
13 }
14 }
3 realitems { 15 realitems {
4 params { 16 params {
5 list : list<Elm.Items.Item*>*; 17 list : list<Elm.Items.Item*>*;
diff --git a/src/lib/items/elm_items_priv.h b/src/lib/items/elm_items_priv.h
index b23a61b..a09aad7 100644
--- a/src/lib/items/elm_items_priv.h
+++ b/src/lib/items/elm_items_priv.h
@@ -43,7 +43,6 @@ extern int log_domain;
43 43
44typedef struct { 44typedef struct {
45 Efl_Tree_Base *root; //< the root item of the item node 45 Efl_Tree_Base *root; //< the root item of the item node
46 Eina_List *realized; //< list of realized items
47 Eina_Strbuf *search; 46 Eina_Strbuf *search;
48 Eina_List *selected; //< list of selected items 47 Eina_List *selected; //< list of selected items
49 Eo *pan; 48 Eo *pan;