summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-10-21 22:55:45 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-10-21 22:55:45 +0000
commit5852948858047f41005f266a213d8d101005100f (patch)
tree7bd227c996057b3bdb7bf94eec6b13f56fb6da05 /legacy
parent136032470ce3630db88b641387e7a7d8916a17a6 (diff)
more genlist/gengrid merging: select+clear are now abstracted
SVN revision: 64275
Diffstat (limited to 'legacy')
-rw-r--r--legacy/elementary/src/lib/Elementary.h.in12
-rw-r--r--legacy/elementary/src/lib/elm_gen.c217
-rw-r--r--legacy/elementary/src/lib/elm_gen.h11
-rw-r--r--legacy/elementary/src/lib/elm_gengrid.c213
-rw-r--r--legacy/elementary/src/lib/elm_genlist.c263
5 files changed, 355 insertions, 361 deletions
diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in
index fa82c6e032..8d514c81c2 100644
--- a/legacy/elementary/src/lib/Elementary.h.in
+++ b/legacy/elementary/src/lib/Elementary.h.in
@@ -7901,6 +7901,7 @@ extern "C" {
7901 * @} 7901 * @}
7902 */ 7902 */
7903 7903
7904 /* TEMPORARY: DOCS WILL BE FILLED IN WITH CNP/SED */
7904 typedef struct Elm_Gen_Item Elm_Gen_Item; 7905 typedef struct Elm_Gen_Item Elm_Gen_Item;
7905 typedef struct _Elm_Gen_Item_Class Elm_Gen_Item_Class; 7906 typedef struct _Elm_Gen_Item_Class Elm_Gen_Item_Class;
7906 typedef struct _Elm_Gen_Item_Class_Func Elm_Gen_Item_Class_Func; /**< Class functions for gen item classes. */ 7907 typedef struct _Elm_Gen_Item_Class_Func Elm_Gen_Item_Class_Func; /**< Class functions for gen item classes. */
@@ -7908,13 +7909,6 @@ extern "C" {
7908 typedef Evas_Object *(*Elm_Gen_Item_Icon_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Icon fetching class function for gen item classes. */ 7909 typedef Evas_Object *(*Elm_Gen_Item_Icon_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Icon fetching class function for gen item classes. */
7909 typedef Eina_Bool (*Elm_Gen_Item_State_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< State fetching class function for gen item classes. */ 7910 typedef Eina_Bool (*Elm_Gen_Item_State_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< State fetching class function for gen item classes. */
7910 typedef void (*Elm_Gen_Item_Del_Cb) (void *data, Evas_Object *obj); /**< Deletion class function for gen item classes. */ 7911 typedef void (*Elm_Gen_Item_Del_Cb) (void *data, Evas_Object *obj); /**< Deletion class function for gen item classes. */
7911
7912 /**
7913 * @struct _Elm_Gen_Item_Class
7914 *
7915 * Gen item class definition. See @ref Gen_Item_Class for
7916 * field details.
7917 */
7918 struct _Elm_Gen_Item_Class 7912 struct _Elm_Gen_Item_Class
7919 { 7913 {
7920 const char *item_style; 7914 const char *item_style;
@@ -7925,7 +7919,9 @@ extern "C" {
7925 Elm_Gen_Item_State_Get_Cb state_get; 7919 Elm_Gen_Item_State_Get_Cb state_get;
7926 Elm_Gen_Item_Del_Cb del; 7920 Elm_Gen_Item_Del_Cb del;
7927 } func; 7921 } func;
7928 }; /**< #Elm_Gen_Item_Class member definitions */ 7922 };
7923 EAPI void elm_gen_clear(Evas_Object *obj);
7924 EAPI void elm_gen_item_selected_set(Elm_Gen_Item *it, Eina_Bool selected);
7929 7925
7930 /** 7926 /**
7931 * @defgroup Gengrid Gengrid (Generic grid) 7927 * @defgroup Gengrid Gengrid (Generic grid)
diff --git a/legacy/elementary/src/lib/elm_gen.c b/legacy/elementary/src/lib/elm_gen.c
index b47358baab..6fe7652415 100644
--- a/legacy/elementary/src/lib/elm_gen.c
+++ b/legacy/elementary/src/lib/elm_gen.c
@@ -1,8 +1,21 @@
1#include <Elementary.h> 1#include <Elementary.h>
2#include <Elementary_Cursor.h> 2#include <Elementary_Cursor.h>
3#include "elm_priv.h" 3#include "elm_priv.h"
4#include "els_scroller.h"
4#include "elm_gen.h" 5#include "elm_gen.h"
5 6
7/* TEMPORARY */
8#undef ELM_CHECK_WIDTYPE
9#define ELM_CHECK_WIDTYPE(obj, widtype) \
10 if ((!obj) || (!elm_gen_type_check((obj), __func__))) return
11#undef ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN
12#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
13 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
14 ELM_CHECK_WIDTYPE(WIDGET((it)), widtype) __VA_ARGS__;
15
16static const char *_gengrid = NULL;
17static const char *_genlist = NULL;
18
6struct _Widget_Data 19struct _Widget_Data
7{ 20{
8 Eina_Inlist_Sorted_State *state; 21 Eina_Inlist_Sorted_State *state;
@@ -19,6 +32,8 @@ struct _Widget_Data
19 int walking; 32 int walking;
20 int item_width, item_height; 33 int item_width, item_height;
21 int group_item_width, group_item_height; 34 int group_item_width, group_item_height;
35 int minw, minh;
36 long count;
22 Evas_Coord pan_x, pan_y; 37 Evas_Coord pan_x, pan_y;
23 Eina_Bool reorder_mode : 1; 38 Eina_Bool reorder_mode : 1;
24 Eina_Bool on_hold : 1; 39 Eina_Bool on_hold : 1;
@@ -26,8 +41,77 @@ struct _Widget_Data
26 Eina_Bool no_select : 1; 41 Eina_Bool no_select : 1;
27 Eina_Bool wasselected : 1; 42 Eina_Bool wasselected : 1;
28 Eina_Bool always_select : 1; 43 Eina_Bool always_select : 1;
44 Eina_Bool clear_me : 1;
45 Ecore_Cb del_cb, calc_cb, sizing_cb;
46 Ecore_Cb clear_cb;
29}; 47};
30 48
49static const char SIG_ACTIVATED[] = "activated";
50static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
51static const char SIG_SELECTED[] = "selected";
52static const char SIG_UNSELECTED[] = "unselected";
53static const char SIG_EXPANDED[] = "expanded";
54static const char SIG_CONTRACTED[] = "contracted";
55static const char SIG_EXPAND_REQUEST[] = "expand,request";
56static const char SIG_CONTRACT_REQUEST[] = "contract,request";
57static const char SIG_REALIZED[] = "realized";
58static const char SIG_UNREALIZED[] = "unrealized";
59static const char SIG_DRAG_START_UP[] = "drag,start,up";
60static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
61static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
62static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
63static const char SIG_DRAG_STOP[] = "drag,stop";
64static const char SIG_DRAG[] = "drag";
65static const char SIG_LONGPRESSED[] = "longpressed";
66static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
67static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
68static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
69static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
70static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this
71static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this
72static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this
73static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this
74static const char SIG_EDGE_TOP[] = "edge,top";
75static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
76static const char SIG_EDGE_LEFT[] = "edge,left";
77static const char SIG_EDGE_RIGHT[] = "edge,right";
78static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
79static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
80static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
81static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
82static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
83static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
84static const char SIG_SWIPE[] = "swipe";
85static const char SIG_MOVED[] = "moved";
86
87/* THIS FUNCTION IS HACKY AND TEMPORARY!!! */
88Eina_Bool
89elm_gen_type_check(const Evas_Object *obj,
90 const char *func)
91{
92 const char *provided, *expected = "(unknown)";
93 static int abort_on_warn = -1;
94 provided = elm_widget_type_get(obj);
95 if (!_genlist) _genlist = eina_stringshare_add("genlist");
96 if (!_gengrid) _gengrid = eina_stringshare_add("gengrid");
97 if (EINA_LIKELY(provided == _genlist) || EINA_LIKELY(provided == _gengrid))
98 return EINA_TRUE;
99 if ((!provided) || (!provided[0]))
100 {
101 provided = evas_object_type_get(obj);
102 if ((!provided) || (!provided[0]))
103 provided = "(unknown)";
104 }
105 ERR("Passing Object: %p in function: %s, of type: '%s' when expecting type: '%s'", obj, func, provided, expected);
106 if (abort_on_warn == -1)
107 {
108 if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
109 else abort_on_warn = 0;
110 }
111 if (abort_on_warn == 1) abort();
112 return EINA_FALSE;
113}
114
31static const char * 115static const char *
32_item_label_hook(Elm_Gen_Item *it, const char *part) 116_item_label_hook(Elm_Gen_Item *it, const char *part)
33{ 117{
@@ -228,11 +312,44 @@ _item_single_select_right(Widget_Data *wd)
228 return EINA_TRUE; 312 return EINA_TRUE;
229} 313}
230#endif 314#endif
315
316
317static void
318_item_select(Elm_Gen_Item *it)
319{
320 if ((it->wd->no_select) || (it->delete_me) || (it->mode_set)) return;
321 if (!it->selected)
322 {
323 it->selected = EINA_TRUE;
324 it->wd->selected = eina_list_append(it->wd->selected, it);
325 }
326 else if (!it->wd->always_select) return;
327
328 evas_object_ref(WIDGET(it));
329 it->walking++;
330 it->wd->walking++;
331 if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), it);
332 if (!it->delete_me)
333 evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
334 it->walking--;
335 it->wd->walking--;
336 if ((it->wd->clear_me) && (!it->wd->walking))
337 elm_gen_clear(WIDGET(it));
338 else
339 {
340 if ((!it->walking) && (it->delete_me))
341 {
342 if (!it->relcount) it->del_cb(it);
343 }
344 else
345 it->wd->last_selected_item = it;
346 }
347 evas_object_unref(WIDGET(it));
348}
231/******************************************************************************/ 349/******************************************************************************/
232void 350void
233elm_gen_item_unrealize(Elm_Gen_Item *it, 351elm_gen_item_unrealize(Elm_Gen_Item *it,
234 Eina_Bool calc, 352 Eina_Bool calc)
235 Ecore_Cb extra_cb)
236{ 353{
237 Evas_Object *icon; 354 Evas_Object *icon;
238 355
@@ -240,7 +357,7 @@ elm_gen_item_unrealize(Elm_Gen_Item *it,
240 if (it->wd->reorder_it == it) return; 357 if (it->wd->reorder_it == it) return;
241 evas_event_freeze(evas_object_evas_get(WIDGET(it))); 358 evas_event_freeze(evas_object_evas_get(WIDGET(it)));
242 if (!calc) 359 if (!calc)
243 evas_object_smart_callback_call(WIDGET(it), "unrealized", it); 360 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
244 if (it->long_timer) 361 if (it->long_timer)
245 { 362 {
246 ecore_timer_del(it->long_timer); 363 ecore_timer_del(it->long_timer);
@@ -257,7 +374,7 @@ elm_gen_item_unrealize(Elm_Gen_Item *it,
257 EINA_LIST_FREE(it->icon_objs, icon) 374 EINA_LIST_FREE(it->icon_objs, icon)
258 evas_object_del(icon); 375 evas_object_del(icon);
259 376
260 if (extra_cb) extra_cb(it); 377 it->unrealize_cb(it);
261 378
262 it->realized = EINA_FALSE; 379 it->realized = EINA_FALSE;
263 it->want_unrealize = EINA_FALSE; 380 it->want_unrealize = EINA_FALSE;
@@ -277,13 +394,9 @@ elm_gen_item_del_notserious(Elm_Gen_Item *it)
277} 394}
278 395
279void 396void
280elm_gen_item_del_serious(Elm_Gen_Item *it, Ecore_Cb job) 397elm_gen_item_del_serious(Elm_Gen_Item *it)
281{ 398{
282 elm_widget_item_pre_notify_del(it); 399 elm_gen_item_del_notserious(it);
283 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
284 it->delete_me = EINA_TRUE;
285 if ((!it->delete_me) && (it->itc->func.del))
286 it->itc->func.del((void *)it->base.data, WIDGET(it));
287 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it)); 400 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
288 if (it->tooltip.del_cb) 401 if (it->tooltip.del_cb)
289 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it); 402 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
@@ -293,7 +406,7 @@ elm_gen_item_del_serious(Elm_Gen_Item *it, Ecore_Cb job)
293 it->wd->group_items = eina_list_remove(it->wd->group_items, it); 406 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
294 407
295 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); 408 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
296 it->wd->calc_job = ecore_job_add(job, it->wd); 409 it->wd->calc_job = ecore_job_add(it->wd->calc_cb, it->wd);
297 free(it->item); 410 free(it->item);
298 it->item = NULL; 411 it->item = NULL;
299 elm_widget_item_del(it); 412 elm_widget_item_del(it);
@@ -317,8 +430,90 @@ elm_gen_item_new(Widget_Data *wd,
317 it->parent = parent; 430 it->parent = parent;
318 it->func.func = func; 431 it->func.func = func;
319 it->func.data = func_data; 432 it->func.data = func_data;
433 /* TEMPORARY */
434 it->sel_cb = (Ecore_Cb)_item_select;
320 435
321 elm_widget_item_text_get_hook_set(it, _item_label_hook); 436 elm_widget_item_text_get_hook_set(it, _item_label_hook);
322 return it; 437 return it;
323} 438}
324/******************************************************************************/ 439/******************************************************************************/
440
441EAPI void
442elm_gen_item_selected_set(Elm_Gen_Item *it,
443 Eina_Bool selected)
444{
445 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
446 Widget_Data *wd = it->wd;
447 if (!wd) return;
448 if ((it->delete_me) || (it->disabled)) return;
449 selected = !!selected;
450 if (it->selected == selected) return;
451
452 if (selected)
453 {
454 if (!wd->multi)
455 {
456 while (wd->selected)
457 {
458 if (it->unhighlight_cb) it->unhighlight_cb(wd->selected->data);
459 it->unsel_cb(wd->selected->data);
460 }
461 }
462 it->highlight_cb(it);
463 _item_select(it);
464 return;
465 }
466 if (it->unhighlight_cb) it->unhighlight_cb(it);
467 it->unsel_cb(it);
468}
469
470EAPI void
471elm_gen_clear(Evas_Object *obj)
472{
473 ELM_CHECK_WIDTYPE(obj, widtype);
474 Widget_Data *wd = elm_widget_data_get(obj);
475 if (!wd) return;
476
477 if (wd->state)
478 {
479 eina_inlist_sorted_state_free(wd->state);
480 wd->state = NULL;
481 }
482
483 if (wd->walking > 0)
484 {
485 Elm_Gen_Item *it;
486 wd->clear_me = 1;
487 EINA_INLIST_FOREACH(wd->items, it)
488 it->delete_me = 1;
489 return;
490 }
491 evas_event_freeze(evas_object_evas_get(wd->obj));
492 while (wd->items)
493 {
494 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
495 it->del_cb(it);
496 }
497 wd->clear_me = 0;
498 if (wd->calc_job)
499 {
500 ecore_job_del(wd->calc_job);
501 wd->calc_job = NULL;
502 }
503 if (wd->selected) wd->selected = eina_list_free(wd->selected);
504 if (wd->clear_cb) wd->clear_cb(wd);
505 wd->pan_x = 0;
506 wd->pan_y = 0;
507 wd->minw = 0;
508 wd->minh = 0;
509 wd->count = 0;
510 if (wd->pan_smart)
511 {
512 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
513 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
514 }
515 if (wd->sizing_cb) wd->sizing_cb(wd->obj);
516 elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
517 evas_event_thaw(evas_object_evas_get(wd->obj));
518 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
519}
diff --git a/legacy/elementary/src/lib/elm_gen.h b/legacy/elementary/src/lib/elm_gen.h
index 3c7cbbf8b9..18ba6d4b56 100644
--- a/legacy/elementary/src/lib/elm_gen.h
+++ b/legacy/elementary/src/lib/elm_gen.h
@@ -2,6 +2,9 @@
2#include <Elementary_Cursor.h> 2#include <Elementary_Cursor.h>
3#include "elm_priv.h" 3#include "elm_priv.h"
4 4
5#define ELM_GEN_ITEM_FROM_INLIST(it) \
6 ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
7
5typedef struct Elm_Gen_Item_Type Elm_Gen_Item_Type; 8typedef struct Elm_Gen_Item_Type Elm_Gen_Item_Type;
6typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip; 9typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip;
7typedef struct _Widget_Data Widget_Data; 10typedef struct _Widget_Data Widget_Data;
@@ -46,6 +49,8 @@ struct Elm_Gen_Item
46 } func; 49 } func;
47 50
48 Elm_Gen_Item_Tooltip tooltip; 51 Elm_Gen_Item_Tooltip tooltip;
52 Ecore_Cb del_cb, sel_cb, highlight_cb;
53 Ecore_Cb unsel_cb, unhighlight_cb, unrealize_cb;
49 54
50 Eina_Bool want_unrealize : 1; 55 Eina_Bool want_unrealize : 1;
51 Eina_Bool display_only : 1; 56 Eina_Bool display_only : 1;
@@ -58,6 +63,7 @@ struct Elm_Gen_Item
58 Eina_Bool down : 1; 63 Eina_Bool down : 1;
59 Eina_Bool group : 1; 64 Eina_Bool group : 1;
60 Eina_Bool reorder : 1; 65 Eina_Bool reorder : 1;
66 Eina_Bool mode_set : 1; /* item uses style mode for highlight/select */
61}; 67};
62 68
63Elm_Gen_Item * 69Elm_Gen_Item *
@@ -70,10 +76,9 @@ elm_gen_item_new(Widget_Data *wd,
70 76
71void 77void
72elm_gen_item_unrealize(Elm_Gen_Item *it, 78elm_gen_item_unrealize(Elm_Gen_Item *it,
73 Eina_Bool calc, 79 Eina_Bool calc);
74 Ecore_Cb extra_cb);
75void 80void
76elm_gen_item_del_serious(Elm_Gen_Item *it, Ecore_Cb job); 81elm_gen_item_del_serious(Elm_Gen_Item *it);
77 82
78void 83void
79elm_gen_item_del_notserious(Elm_Gen_Item *it); 84elm_gen_item_del_notserious(Elm_Gen_Item *it);
diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c
index 7dc6b85351..1c445e2598 100644
--- a/legacy/elementary/src/lib/elm_gengrid.c
+++ b/legacy/elementary/src/lib/elm_gengrid.c
@@ -12,6 +12,15 @@
12#define PRELOAD 1 12#define PRELOAD 1
13#define REORDER_EFFECT_TIME 0.5 13#define REORDER_EFFECT_TIME 0.5
14 14
15#define ELM_GEN_SETUP(wd) \
16 (wd)->calc_cb = (Ecore_Cb)_calc_job
17
18#define ELM_GEN_ITEM_SETUP(it) \
19 (it)->del_cb = (Ecore_Cb)_item_del; \
20 (it)->highlight_cb = (Ecore_Cb)_item_highlight; \
21 (it)->unsel_cb = (Ecore_Cb)_item_unselect; \
22 (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
23
15struct Elm_Gen_Item_Type 24struct Elm_Gen_Item_Type
16{ 25{
17 Elm_Gen_Item *it; 26 Elm_Gen_Item *it;
@@ -40,6 +49,8 @@ struct _Widget_Data
40 int walking; 49 int walking;
41 int item_width, item_height; 50 int item_width, item_height;
42 int group_item_width, group_item_height; 51 int group_item_width, group_item_height;
52 int minw, minh;
53 long count;
43 Evas_Coord pan_x, pan_y; 54 Evas_Coord pan_x, pan_y;
44 Eina_Bool reorder_mode : 1; 55 Eina_Bool reorder_mode : 1;
45 Eina_Bool on_hold : 1; 56 Eina_Bool on_hold : 1;
@@ -47,32 +58,28 @@ struct _Widget_Data
47 Eina_Bool no_select : 1; 58 Eina_Bool no_select : 1;
48 Eina_Bool wasselected : 1; 59 Eina_Bool wasselected : 1;
49 Eina_Bool always_select : 1; 60 Eina_Bool always_select : 1;
61 Eina_Bool clear_me : 1;
62 Ecore_Cb del_cb, calc_cb, sizing_cb;
63 Ecore_Cb clear_cb;
50 //////////////////////////////////// 64 ////////////////////////////////////
51 double align_x, align_y; 65 double align_x, align_y;
52 66
53 Evas_Coord old_pan_x, old_pan_y; 67 Evas_Coord old_pan_x, old_pan_y;
54 Evas_Coord minw, minh; /* Total obj size */
55 Evas_Coord reorder_item_x, reorder_item_y; 68 Evas_Coord reorder_item_x, reorder_item_y;
56 unsigned int nmax; 69 unsigned int nmax;
57 long count;
58 long items_lost; 70 long items_lost;
59 71
60 Eina_Bool horizontal : 1; 72 Eina_Bool horizontal : 1;
61 Eina_Bool longpressed : 1; 73 Eina_Bool longpressed : 1;
62 Eina_Bool clear_me : 1;
63 Eina_Bool h_bounce : 1; 74 Eina_Bool h_bounce : 1;
64 Eina_Bool v_bounce : 1; 75 Eina_Bool v_bounce : 1;
65 Eina_Bool reorder_item_changed : 1; 76 Eina_Bool reorder_item_changed : 1;
66 Eina_Bool move_effect_enabled : 1; 77 Eina_Bool move_effect_enabled : 1;
67}; 78};
68 79
69#define ELM_GENGRID_ITEM_FROM_INLIST(it) \
70 ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
71
72static const char *widtype = NULL; 80static const char *widtype = NULL;
73static void _item_highlight(Elm_Gen_Item *it); 81static void _item_highlight(Elm_Gen_Item *it);
74static void _item_unrealize_cb(Elm_Gen_Item *it); 82static void _item_unrealize_cb(Elm_Gen_Item *it);
75static void _item_select(Elm_Gen_Item *it);
76static void _item_unselect(Elm_Gen_Item *it); 83static void _item_unselect(Elm_Gen_Item *it);
77static void _calc_job(void *data); 84static void _calc_job(void *data);
78static void _on_focus_hook(void *data, 85static void _on_focus_hook(void *data,
@@ -430,9 +437,9 @@ _item_single_select_up(Widget_Data *wd)
430 437
431 if (!wd->selected) 438 if (!wd->selected)
432 { 439 {
433 prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last); 440 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
434 while ((prev) && (prev->delete_me)) 441 while ((prev) && (prev->delete_me))
435 prev = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev); 442 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
436 elm_gengrid_item_selected_set(prev, EINA_TRUE); 443 elm_gengrid_item_selected_set(prev, EINA_TRUE);
437 elm_gengrid_item_show(prev); 444 elm_gengrid_item_show(prev);
438 return EINA_TRUE; 445 return EINA_TRUE;
@@ -464,9 +471,9 @@ _item_single_select_down(Widget_Data *wd)
464 471
465 if (!wd->selected) 472 if (!wd->selected)
466 { 473 {
467 next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items); 474 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
468 while ((next) && (next->delete_me)) 475 while ((next) && (next->delete_me))
469 next = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); 476 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
470 elm_gengrid_item_selected_set(next, EINA_TRUE); 477 elm_gengrid_item_selected_set(next, EINA_TRUE);
471 elm_gengrid_item_show(next); 478 elm_gengrid_item_show(next);
472 return EINA_TRUE; 479 return EINA_TRUE;
@@ -495,9 +502,9 @@ _item_single_select_left(Widget_Data *wd)
495 Elm_Gen_Item *prev; 502 Elm_Gen_Item *prev;
496 if (!wd->selected) 503 if (!wd->selected)
497 { 504 {
498 prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last); 505 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
499 while ((prev) && (prev->delete_me)) 506 while ((prev) && (prev->delete_me))
500 prev = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev); 507 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
501 } 508 }
502 else prev = elm_gengrid_item_prev_get(wd->last_selected_item); 509 else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
503 510
@@ -516,9 +523,9 @@ _item_single_select_right(Widget_Data *wd)
516 Elm_Gen_Item *next; 523 Elm_Gen_Item *next;
517 if (!wd->selected) 524 if (!wd->selected)
518 { 525 {
519 next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items); 526 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
520 while ((next) && (next->delete_me)) 527 while ((next) && (next->delete_me))
521 next = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); 528 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
522 } 529 }
523 else next = elm_gengrid_item_next_get(wd->last_selected_item); 530 else next = elm_gengrid_item_next_get(wd->last_selected_item);
524 531
@@ -559,13 +566,13 @@ _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
559 if (!wd) return; 566 if (!wd) return;
560 elm_smart_scroller_mirrored_set(wd->scr, rtl); 567 elm_smart_scroller_mirrored_set(wd->scr, rtl);
561 if (!wd->items) return; 568 if (!wd->items) return;
562 it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items); 569 it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
563 570
564 while (it) 571 while (it)
565 { 572 {
566 edje_object_mirrored_set(VIEW(it), rtl); 573 edje_object_mirrored_set(VIEW(it), rtl);
567 elm_gengrid_item_update(it); 574 elm_gengrid_item_update(it);
568 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 575 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
569 } 576 }
570} 577}
571 578
@@ -866,7 +873,7 @@ _mouse_up(void *data,
866 if (dragged) 873 if (dragged)
867 { 874 {
868 if (it->want_unrealize) 875 if (it->want_unrealize)
869 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 876 elm_gen_item_unrealize(it, EINA_FALSE);
870 } 877 }
871 if ((it->disabled) || (dragged)) return; 878 if ((it->disabled) || (dragged)) return;
872 if (it->wd->multi) 879 if (it->wd->multi)
@@ -874,7 +881,7 @@ _mouse_up(void *data,
874 if (!it->selected) 881 if (!it->selected)
875 { 882 {
876 _item_highlight(it); 883 _item_highlight(it);
877 _item_select(it); 884 it->sel_cb(it);
878 } 885 }
879 else _item_unselect(it); 886 else _item_unselect(it);
880 } 887 }
@@ -894,7 +901,7 @@ _mouse_up(void *data,
894 if (item2 != it) _item_unselect(item2); 901 if (item2 != it) _item_unselect(item2);
895 } 902 }
896 _item_highlight(it); 903 _item_highlight(it);
897 _item_select(it); 904 it->sel_cb(it);
898 } 905 }
899} 906}
900 907
@@ -1145,7 +1152,7 @@ _group_item_place(Pan *sd)
1145 evas_object_raise(VIEW(it)); 1152 evas_object_raise(VIEW(it));
1146 } 1153 }
1147 else 1154 else
1148 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 1155 elm_gen_item_unrealize(it, EINA_FALSE);
1149 } 1156 }
1150} 1157}
1151 1158
@@ -1408,30 +1415,12 @@ _item_place(Elm_Gen_Item *it,
1408 else 1415 else
1409 { 1416 {
1410 if (!it->group) 1417 if (!it->group)
1411 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 1418 elm_gen_item_unrealize(it, EINA_FALSE);
1412 else 1419 else
1413 it->item->group_realized = EINA_FALSE; 1420 it->item->group_realized = EINA_FALSE;
1414 } 1421 }
1415} 1422}
1416 1423
1417static Elm_Gen_Item *
1418_item_new(Widget_Data *wd,
1419 const Elm_Gengrid_Item_Class *itc,
1420 const void *data,
1421 Evas_Smart_Cb func,
1422 const void *func_data)
1423{
1424 Elm_Gen_Item *it;
1425
1426 it = elm_gen_item_new(wd, itc, data, NULL, func, func_data);
1427 if (!it) return NULL;
1428 it->item = ELM_NEW(Elm_Gen_Item_Type);
1429 wd->count++;
1430 it->group = !strcmp(it->itc->item_style, "group_index");
1431
1432 return it;
1433}
1434
1435static void 1424static void
1436_item_del(Elm_Gen_Item *it) 1425_item_del(Elm_Gen_Item *it)
1437{ 1426{
@@ -1439,44 +1428,14 @@ _item_del(Elm_Gen_Item *it)
1439 1428
1440 evas_event_freeze(evas_object_evas_get(obj)); 1429 evas_event_freeze(evas_object_evas_get(obj));
1441 it->wd->selected = eina_list_remove(it->wd->selected, it); 1430 it->wd->selected = eina_list_remove(it->wd->selected, it);
1442 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 1431 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
1443 it->wd->count--; 1432 it->wd->count--;
1444 elm_gen_item_del_serious(it, (Ecore_Cb)_calc_job); 1433 elm_gen_item_del_serious(it);
1445 evas_event_thaw(evas_object_evas_get(obj)); 1434 evas_event_thaw(evas_object_evas_get(obj));
1446 evas_event_thaw_eval(evas_object_evas_get(obj)); 1435 evas_event_thaw_eval(evas_object_evas_get(obj));
1447} 1436}
1448 1437
1449static void 1438static void
1450_item_select(Elm_Gen_Item *it)
1451{
1452 if ((it->wd->no_select) || (it->delete_me)) return;
1453 if (it->selected)
1454 {
1455 if (it->wd->always_select) goto call;
1456 return;
1457 }
1458 it->selected = EINA_TRUE;
1459 it->wd->selected = eina_list_append(it->wd->selected, it);
1460call:
1461 it->walking++;
1462 it->wd->walking++;
1463 if (it->func.func)
1464 it->func.func((void *)it->func.data, WIDGET(it), it);
1465 if (!it->delete_me)
1466 evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
1467 it->walking--;
1468 it->wd->walking--;
1469 it->wd->last_selected_item = it;
1470 if ((it->wd->clear_me) && (!it->wd->walking))
1471 elm_gengrid_clear(WIDGET(it));
1472 else
1473 {
1474 if ((!it->walking) && (it->delete_me))
1475 if (!it->relcount) _item_del(it);
1476 }
1477}
1478
1479static void
1480_item_unselect(Elm_Gen_Item *it) 1439_item_unselect(Elm_Gen_Item *it)
1481{ 1440{
1482 if ((it->delete_me) || (!it->highlighted)) return; 1441 if ((it->delete_me) || (!it->highlighted)) return;
@@ -1876,11 +1835,30 @@ static int
1876_elm_gengrid_item_compare(const void *data, const void *data1) 1835_elm_gengrid_item_compare(const void *data, const void *data1)
1877{ 1836{
1878 Elm_Gen_Item *it, *item1; 1837 Elm_Gen_Item *it, *item1;
1879 it = ELM_GENGRID_ITEM_FROM_INLIST(data); 1838 it = ELM_GEN_ITEM_FROM_INLIST(data);
1880 item1 = ELM_GENGRID_ITEM_FROM_INLIST(data1); 1839 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
1881 return _elm_gengrid_item_compare_cb(it, item1); 1840 return _elm_gengrid_item_compare_cb(it, item1);
1882} 1841}
1883 1842
1843static Elm_Gen_Item *
1844_item_new(Widget_Data *wd,
1845 const Elm_Gengrid_Item_Class *itc,
1846 const void *data,
1847 Evas_Smart_Cb func,
1848 const void *func_data)
1849{
1850 Elm_Gen_Item *it;
1851
1852 it = elm_gen_item_new(wd, itc, data, NULL, func, func_data);
1853 if (!it) return NULL;
1854 it->item = ELM_NEW(Elm_Gen_Item_Type);
1855 wd->count++;
1856 it->group = !strcmp(it->itc->item_style, "group_index");
1857 ELM_GEN_ITEM_SETUP(it);
1858
1859 return it;
1860}
1861
1884EAPI Evas_Object * 1862EAPI Evas_Object *
1885elm_gengrid_add(Evas_Object *parent) 1863elm_gengrid_add(Evas_Object *parent)
1886{ 1864{
@@ -1909,6 +1887,7 @@ elm_gengrid_add(Evas_Object *parent)
1909 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); 1887 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1910 1888
1911 ELM_SET_WIDTYPE(widtype, "gengrid"); 1889 ELM_SET_WIDTYPE(widtype, "gengrid");
1890 ELM_GEN_SETUP(wd);
1912 elm_widget_type_set(obj, "gengrid"); 1891 elm_widget_type_set(obj, "gengrid");
1913 elm_widget_sub_object_add(parent, obj); 1892 elm_widget_sub_object_add(parent, obj);
1914 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); 1893 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
@@ -2240,57 +2219,7 @@ elm_gengrid_horizontal_get(const Evas_Object *obj)
2240EAPI void 2219EAPI void
2241elm_gengrid_clear(Evas_Object *obj) 2220elm_gengrid_clear(Evas_Object *obj)
2242{ 2221{
2243 ELM_CHECK_WIDTYPE(obj, widtype); 2222 elm_gen_clear(obj);
2244 Widget_Data *wd = elm_widget_data_get(obj);
2245 if (!wd) return;
2246
2247 if (wd->state)
2248 {
2249 eina_inlist_sorted_state_free(wd->state);
2250 wd->state = NULL;
2251 }
2252 if (wd->calc_job)
2253 {
2254 ecore_job_del(wd->calc_job);
2255 wd->calc_job = NULL;
2256 }
2257
2258 if (wd->walking > 0)
2259 {
2260 Elm_Gen_Item *it;
2261 wd->clear_me = 1;
2262 EINA_INLIST_FOREACH(wd->items, it)
2263 it->delete_me = 1;
2264 return;
2265 }
2266 wd->clear_me = 0;
2267 while (wd->items)
2268 {
2269 Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
2270
2271 wd->items = eina_inlist_remove(wd->items, wd->items);
2272 elm_widget_item_pre_notify_del(it);
2273 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
2274 if (it->itc->func.del)
2275 it->itc->func.del((void *)it->base.data, wd->obj);
2276 if (it->long_timer) ecore_timer_del(it->long_timer);
2277 free(it->item);
2278 elm_widget_item_del(it);
2279 }
2280
2281 if (wd->selected)
2282 {
2283 eina_list_free(wd->selected);
2284 wd->selected = NULL;
2285 }
2286
2287 wd->pan_x = 0;
2288 wd->pan_y = 0;
2289 wd->minw = 0;
2290 wd->minh = 0;
2291 wd->count = 0;
2292 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
2293 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2294} 2223}
2295 2224
2296EAPI const Evas_Object * 2225EAPI const Evas_Object *
@@ -2306,7 +2235,7 @@ elm_gengrid_item_update(Elm_Gen_Item *it)
2306 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2235 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2307 if (!it->realized) return; 2236 if (!it->realized) return;
2308 if (it->want_unrealize) return; 2237 if (it->want_unrealize) return;
2309 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 2238 elm_gen_item_unrealize(it, EINA_FALSE);
2310 _item_realize(it); 2239 _item_realize(it);
2311 _item_place(it, it->x, it->y); 2240 _item_place(it, it->x, it->y);
2312} 2241}
@@ -2397,25 +2326,7 @@ EAPI void
2397elm_gengrid_item_selected_set(Elm_Gen_Item *it, 2326elm_gengrid_item_selected_set(Elm_Gen_Item *it,
2398 Eina_Bool selected) 2327 Eina_Bool selected)
2399{ 2328{
2400 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2329 elm_gen_item_selected_set(it, selected);
2401 Widget_Data *wd = it->wd;
2402 if (!wd) return;
2403 if (it->delete_me) return;
2404 selected = !!selected;
2405 if (it->selected == selected) return;
2406
2407 if (selected)
2408 {
2409 if (!wd->multi)
2410 {
2411 while (wd->selected)
2412 _item_unselect(wd->selected->data);
2413 }
2414 _item_highlight(it);
2415 _item_select(it);
2416 }
2417 else
2418 _item_unselect(it);
2419} 2330}
2420 2331
2421EAPI Eina_Bool 2332EAPI Eina_Bool
@@ -2796,9 +2707,9 @@ elm_gengrid_first_item_get(const Evas_Object *obj)
2796 Widget_Data *wd = elm_widget_data_get(obj); 2707 Widget_Data *wd = elm_widget_data_get(obj);
2797 if (!wd) return NULL; 2708 if (!wd) return NULL;
2798 if (!wd->items) return NULL; 2709 if (!wd->items) return NULL;
2799 Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items); 2710 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
2800 while ((it) && (it->delete_me)) 2711 while ((it) && (it->delete_me))
2801 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 2712 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
2802 return it; 2713 return it;
2803} 2714}
2804 2715
@@ -2809,9 +2720,9 @@ elm_gengrid_last_item_get(const Evas_Object *obj)
2809 Widget_Data *wd = elm_widget_data_get(obj); 2720 Widget_Data *wd = elm_widget_data_get(obj);
2810 if (!wd) return NULL; 2721 if (!wd) return NULL;
2811 if (!wd->items) return NULL; 2722 if (!wd->items) return NULL;
2812 Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last); 2723 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
2813 while ((it) && (it->delete_me)) 2724 while ((it) && (it->delete_me))
2814 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 2725 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
2815 return it; 2726 return it;
2816} 2727}
2817 2728
@@ -2821,7 +2732,7 @@ elm_gengrid_item_next_get(const Elm_Gen_Item *it)
2821 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2732 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2822 while (it) 2733 while (it)
2823 { 2734 {
2824 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 2735 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
2825 if ((it) && (!it->delete_me)) break; 2736 if ((it) && (!it->delete_me)) break;
2826 } 2737 }
2827 return (Elm_Gen_Item *)it; 2738 return (Elm_Gen_Item *)it;
@@ -2833,7 +2744,7 @@ elm_gengrid_item_prev_get(const Elm_Gen_Item *it)
2833 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2744 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2834 while (it) 2745 while (it)
2835 { 2746 {
2836 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 2747 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
2837 if ((it) && (!it->delete_me)) break; 2748 if ((it) && (!it->delete_me)) break;
2838 } 2749 }
2839 return (Elm_Gen_Item *)it; 2750 return (Elm_Gen_Item *)it;
diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c
index 942250c0a6..73cada9a69 100644
--- a/legacy/elementary/src/lib/elm_genlist.c
+++ b/legacy/elementary/src/lib/elm_genlist.c
@@ -10,6 +10,19 @@
10#define MAX_ITEMS_PER_BLOCK 32 10#define MAX_ITEMS_PER_BLOCK 32
11#define REORDER_EFFECT_TIME 0.5 11#define REORDER_EFFECT_TIME 0.5
12 12
13#define ELM_GEN_SETUP(wd) \
14 (wd)->calc_cb = (Ecore_Cb)_calc_job; \
15 (wd)->clear_cb = (Ecore_Cb)_clear_cb; \
16 (wd)->sizing_cb = (Ecore_Cb)_sizing_eval
17
18
19#define ELM_GEN_ITEM_SETUP(it) \
20 (it)->del_cb = (Ecore_Cb)_item_del; \
21 (it)->highlight_cb = (Ecore_Cb)_item_highlight; \
22 (it)->unsel_cb = (Ecore_Cb)_item_unselect; \
23 (it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \
24 (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
25
13typedef struct _Item_Block Item_Block; 26typedef struct _Item_Block Item_Block;
14typedef struct _Item_Cache Item_Cache; 27typedef struct _Item_Cache Item_Cache;
15 28
@@ -60,6 +73,8 @@ struct _Widget_Data
60 int walking; 73 int walking;
61 int item_width, item_height; 74 int item_width, item_height;
62 int group_item_width, group_item_height; 75 int group_item_width, group_item_height;
76 int minw, minh;
77 long count;
63 Evas_Coord pan_x, pan_y; 78 Evas_Coord pan_x, pan_y;
64 Eina_Bool reorder_mode : 1; 79 Eina_Bool reorder_mode : 1;
65 Eina_Bool on_hold : 1; 80 Eina_Bool on_hold : 1;
@@ -67,9 +82,12 @@ struct _Widget_Data
67 Eina_Bool no_select : 1; 82 Eina_Bool no_select : 1;
68 Eina_Bool wasselected : 1; 83 Eina_Bool wasselected : 1;
69 Eina_Bool always_select : 1; 84 Eina_Bool always_select : 1;
85 Eina_Bool clear_me : 1;
86 Ecore_Cb del_cb, calc_cb, sizing_cb;
87 Ecore_Cb clear_cb;
70 //////////////////////////////////// 88 ////////////////////////////////////
71 Eina_Inlist *blocks; /* inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */ 89 Eina_Inlist *blocks; /* inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */
72 Evas_Coord reorder_old_pan_y, w, h, minw, minh, realminw, prev_viewport_w; 90 Evas_Coord reorder_old_pan_y, w, h, realminw, prev_viewport_w;
73 Ecore_Job *update_job; 91 Ecore_Job *update_job;
74 Ecore_Idle_Enterer *queue_idle_enterer; 92 Ecore_Idle_Enterer *queue_idle_enterer;
75 Ecore_Idler *must_recalc_idler; 93 Ecore_Idler *must_recalc_idler;
@@ -95,7 +113,6 @@ struct _Widget_Data
95 Eina_Bool compress : 1; 113 Eina_Bool compress : 1;
96 Eina_Bool height_for_width : 1; 114 Eina_Bool height_for_width : 1;
97 Eina_Bool homogeneous : 1; 115 Eina_Bool homogeneous : 1;
98 Eina_Bool clear_me : 1;
99 Eina_Bool swipe : 1; 116 Eina_Bool swipe : 1;
100 Eina_Bool reorder_pan_move : 1; 117 Eina_Bool reorder_pan_move : 1;
101 Eina_Bool auto_scroll_enabled : 1; 118 Eina_Bool auto_scroll_enabled : 1;
@@ -144,9 +161,6 @@ struct _Item_Cache
144 Eina_Bool expanded : 1; // it->item->expanded 161 Eina_Bool expanded : 1; // it->item->expanded
145}; 162};
146 163
147#define ELM_GENLIST_ITEM_FROM_INLIST(it) \
148 ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
149
150static const char *widtype = NULL; 164static const char *widtype = NULL;
151static void _item_cache_zero(Widget_Data *wd); 165static void _item_cache_zero(Widget_Data *wd);
152static void _del_hook(Evas_Object *obj); 166static void _del_hook(Evas_Object *obj);
@@ -459,9 +473,9 @@ _item_single_select_up(Widget_Data *wd)
459 Elm_Gen_Item *prev; 473 Elm_Gen_Item *prev;
460 if (!wd->selected) 474 if (!wd->selected)
461 { 475 {
462 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last); 476 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
463 while ((prev) && (prev->delete_me)) 477 while ((prev) && (prev->delete_me))
464 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev); 478 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
465 } 479 }
466 else prev = elm_genlist_item_prev_get(wd->last_selected_item); 480 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
467 481
@@ -480,9 +494,9 @@ _item_single_select_down(Widget_Data *wd)
480 Elm_Gen_Item *next; 494 Elm_Gen_Item *next;
481 if (!wd->selected) 495 if (!wd->selected)
482 { 496 {
483 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items); 497 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
484 while ((next) && (next->delete_me)) 498 while ((next) && (next->delete_me))
485 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); 499 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
486 } 500 }
487 else next = elm_genlist_item_next_get(wd->last_selected_item); 501 else next = elm_genlist_item_next_get(wd->last_selected_item);
488 502
@@ -776,63 +790,54 @@ _item_del(Elm_Gen_Item *it)
776 evas_event_freeze(evas_object_evas_get(obj)); 790 evas_event_freeze(evas_object_evas_get(obj));
777 elm_genlist_item_subitems_clear(it); 791 elm_genlist_item_subitems_clear(it);
778 if (it->wd->show_item == it) it->wd->show_item = NULL; 792 if (it->wd->show_item == it) it->wd->show_item = NULL;
779 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 793 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
780 if (it->item->block) _item_block_del(it); 794 if (it->item->block) _item_block_del(it);
781 if (it->item->queued) 795 if (it->item->queued)
782 it->wd->queue = eina_list_remove(it->wd->queue, it); 796 it->wd->queue = eina_list_remove(it->wd->queue, it);
783 if (it->wd->anchor_item == it) 797 if (it->wd->anchor_item == it)
784 { 798 {
785 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 799 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
786 if (!it->wd->anchor_item) 800 if (!it->wd->anchor_item)
787 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 801 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
788 } 802 }
789 if (it->parent) 803 if (it->parent)
790 it->parent->item->items = eina_list_remove(it->parent->item->items, it); 804 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
791 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer); 805 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
792 elm_gen_item_del_serious(it, (Ecore_Cb)_calc_job); 806 elm_gen_item_del_serious(it);
793 evas_event_thaw(evas_object_evas_get(obj)); 807 evas_event_thaw(evas_object_evas_get(obj));
794 evas_event_thaw_eval(evas_object_evas_get(obj)); 808 evas_event_thaw_eval(evas_object_evas_get(obj));
795} 809}
796 810
797static void 811static void
798_item_select(Elm_Gen_Item *it) 812_clear_cb(Widget_Data *wd)
799{ 813{
800 Evas_Object *parent = WIDGET(it); 814 wd->anchor_item = NULL;
815 while (wd->blocks)
816 {
817 Item_Block *itb = (Item_Block *)(wd->blocks);
801 818
802 if ((it->wd->no_select) || (it->delete_me) || (it->item->mode_view)) return; 819 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
803 if (it->selected) 820 if (itb->items) eina_list_free(itb->items);
821 free(itb);
822 }
823 if (wd->queue_idle_enterer)
804 { 824 {
805 if (it->wd->always_select) goto call; 825 ecore_idle_enterer_del(wd->queue_idle_enterer);
806 return; 826 wd->queue_idle_enterer = NULL;
807 } 827 }
808 it->selected = EINA_TRUE; 828 if (wd->must_recalc_idler)
809 it->wd->selected = eina_list_append(it->wd->selected, it); 829 {
810call: 830 ecore_idler_del(wd->must_recalc_idler);
811 evas_object_ref(parent); 831 wd->must_recalc_idler = NULL;
812 it->walking++;
813 it->wd->walking++;
814 if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), it);
815 if (!it->delete_me)
816 evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
817 it->walking--;
818 it->wd->walking--;
819 if ((it->wd->clear_me) && (!it->wd->walking))
820 {
821 elm_genlist_clear(WIDGET(it));
822 goto end;
823 } 832 }
824 else 833 if (wd->queue) wd->queue = eina_list_free(wd->queue);
834 if (wd->reorder_move_animator)
825 { 835 {
826 if ((!it->walking) && (it->delete_me)) 836 ecore_animator_del(wd->reorder_move_animator);
827 { 837 wd->reorder_move_animator = NULL;
828 if (!it->relcount) _item_del(it);
829 goto end;
830 }
831 } 838 }
832 it->wd->last_selected_item = it; 839 wd->show_item = NULL;
833 840 wd->reorder_old_pan_y = 0;
834end:
835 evas_object_unref(parent);
836} 841}
837 842
838static void 843static void
@@ -1335,7 +1340,7 @@ _mouse_up(void *data,
1335 { 1340 {
1336 if (it->want_unrealize) 1341 if (it->want_unrealize)
1337 { 1342 {
1338 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 1343 elm_gen_item_unrealize(it, EINA_FALSE);
1339 if (it->item->block->want_unrealize) 1344 if (it->item->block->want_unrealize)
1340 _item_block_unrealize(it->item->block); 1345 _item_block_unrealize(it->item->block);
1341 } 1346 }
@@ -1347,7 +1352,7 @@ _mouse_up(void *data,
1347 if (!it->selected) 1352 if (!it->selected)
1348 { 1353 {
1349 _item_highlight(it); 1354 _item_highlight(it);
1350 _item_select(it); 1355 it->sel_cb(it);
1351 } 1356 }
1352 else 1357 else
1353 { 1358 {
@@ -1384,7 +1389,7 @@ _mouse_up(void *data,
1384 //_item_select(it); 1389 //_item_select(it);
1385 } 1390 }
1386 _item_highlight(it); 1391 _item_highlight(it);
1387 _item_select(it); 1392 it->sel_cb(it);
1388 } 1393 }
1389} 1394}
1390 1395
@@ -1997,13 +2002,13 @@ _item_block_recalc(Item_Block *itb,
1997 if (changed) 2002 if (changed)
1998 { 2003 {
1999 _item_realize(it, in, EINA_TRUE); 2004 _item_realize(it, in, EINA_TRUE);
2000 elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb); 2005 elm_gen_item_unrealize(it, EINA_TRUE);
2001 } 2006 }
2002 } 2007 }
2003 else 2008 else
2004 { 2009 {
2005 _item_realize(it, in, EINA_TRUE); 2010 _item_realize(it, in, EINA_TRUE);
2006 elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb); 2011 elm_gen_item_unrealize(it, EINA_TRUE);
2007 } 2012 }
2008 } 2013 }
2009 else 2014 else
@@ -2050,7 +2055,7 @@ _item_block_unrealize(Item_Block *itb)
2050 it->want_unrealize = EINA_TRUE; 2055 it->want_unrealize = EINA_TRUE;
2051 } 2056 }
2052 else 2057 else
2053 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 2058 elm_gen_item_unrealize(it, EINA_FALSE);
2054 } 2059 }
2055 } 2060 }
2056 if (!dragging) 2061 if (!dragging)
@@ -2232,7 +2237,7 @@ _item_block_position(Item_Block *itb,
2232 } 2237 }
2233 else 2238 else
2234 { 2239 {
2235 if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 2240 if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE);
2236 } 2241 }
2237 } 2242 }
2238 in++; 2243 in++;
@@ -2269,7 +2274,7 @@ _group_items_recalc(void *data)
2269 else if (!git->item->want_realize && git->realized) 2274 else if (!git->item->want_realize && git->realized)
2270 { 2275 {
2271 if (!git->dragging) 2276 if (!git->dragging)
2272 elm_gen_item_unrealize(git, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 2277 elm_gen_item_unrealize(git, EINA_FALSE);
2273 } 2278 }
2274 } 2279 }
2275 evas_event_thaw(evas_object_evas_get(wd->obj)); 2280 evas_event_thaw(evas_object_evas_get(wd->obj));
@@ -2451,14 +2456,14 @@ _update_job(void *data)
2451 it->item->updateme = EINA_FALSE; 2456 it->item->updateme = EINA_FALSE;
2452 if (it->realized) 2457 if (it->realized)
2453 { 2458 {
2454 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 2459 elm_gen_item_unrealize(it, EINA_FALSE);
2455 _item_realize(it, num, EINA_FALSE); 2460 _item_realize(it, num, EINA_FALSE);
2456 position = EINA_TRUE; 2461 position = EINA_TRUE;
2457 } 2462 }
2458 else 2463 else
2459 { 2464 {
2460 _item_realize(it, num, EINA_TRUE); 2465 _item_realize(it, num, EINA_TRUE);
2461 elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb); 2466 elm_gen_item_unrealize(it, EINA_TRUE);
2462 } 2467 }
2463 if ((it->item->minw != itminw) || (it->item->minh != itminh)) 2468 if ((it->item->minw != itminw) || (it->item->minh != itminh))
2464 recalc = EINA_TRUE; 2469 recalc = EINA_TRUE;
@@ -3010,6 +3015,7 @@ elm_genlist_add(Evas_Object *parent)
3010 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); 3015 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3011 3016
3012 ELM_SET_WIDTYPE(widtype, "genlist"); 3017 ELM_SET_WIDTYPE(widtype, "genlist");
3018 ELM_GEN_SETUP(wd);
3013 elm_widget_type_set(obj, "genlist"); 3019 elm_widget_type_set(obj, "genlist");
3014 elm_widget_sub_object_add(parent, obj); 3020 elm_widget_sub_object_add(parent, obj);
3015 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL); 3021 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
@@ -3088,6 +3094,7 @@ _item_new(Widget_Data *wd,
3088 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++; 3094 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3089 it->item->expanded_depth = 0; 3095 it->item->expanded_depth = 0;
3090 elm_widget_item_del_cb_set(it, _item_del_hook); 3096 elm_widget_item_del_cb_set(it, _item_del_hook);
3097 ELM_GEN_ITEM_SETUP(it);
3091 if (it->parent) 3098 if (it->parent)
3092 { 3099 {
3093 if (it->parent->group) 3100 if (it->parent->group)
@@ -3352,8 +3359,8 @@ static int
3352_elm_genlist_item_compare(const void *data, const void *data1) 3359_elm_genlist_item_compare(const void *data, const void *data1)
3353{ 3360{
3354 const Elm_Gen_Item *it, *item1; 3361 const Elm_Gen_Item *it, *item1;
3355 it = ELM_GENLIST_ITEM_FROM_INLIST(data); 3362 it = ELM_GEN_ITEM_FROM_INLIST(data);
3356 item1 = ELM_GENLIST_ITEM_FROM_INLIST(data1); 3363 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
3357 return _elm_genlist_item_compare_cb(it, item1); 3364 return _elm_genlist_item_compare_cb(it, item1);
3358} 3365}
3359 3366
@@ -3625,12 +3632,12 @@ elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3625 3632
3626 if (EINA_INLIST_GET(it)->next) 3633 if (EINA_INLIST_GET(it)->next)
3627 { 3634 {
3628 rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 3635 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3629 it->item->before = EINA_TRUE; 3636 it->item->before = EINA_TRUE;
3630 } 3637 }
3631 else if (EINA_INLIST_GET(it)->prev) 3638 else if (EINA_INLIST_GET(it)->prev)
3632 { 3639 {
3633 rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 3640 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3634 it->item->before = EINA_FALSE; 3641 it->item->before = EINA_FALSE;
3635 } 3642 }
3636 } 3643 }
@@ -3665,104 +3672,7 @@ elm_genlist_item_sorted_insert(Evas_Object *obj,
3665EAPI void 3672EAPI void
3666elm_genlist_clear(Evas_Object *obj) 3673elm_genlist_clear(Evas_Object *obj)
3667{ 3674{
3668 ELM_CHECK_WIDTYPE(obj, widtype); 3675 elm_gen_clear(obj);
3669 Widget_Data *wd = elm_widget_data_get(obj);
3670 if (!wd) return;
3671 if (wd->state)
3672 {
3673 eina_inlist_sorted_state_free(wd->state);
3674 wd->state = NULL;
3675 }
3676 if (wd->walking > 0)
3677 {
3678 Elm_Gen_Item *it;
3679
3680 wd->clear_me = EINA_TRUE;
3681 EINA_INLIST_FOREACH(wd->items, it)
3682 {
3683 it->delete_me = EINA_TRUE;
3684 }
3685 return;
3686 }
3687 evas_event_freeze(evas_object_evas_get(wd->obj));
3688 while (wd->items)
3689 {
3690 Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3691
3692 if (wd->anchor_item == it)
3693 {
3694 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3695 if (!wd->anchor_item)
3696 wd->anchor_item =
3697 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3698 }
3699 wd->items = eina_inlist_remove(wd->items, wd->items);
3700 if (it->item->flags & ELM_GENLIST_ITEM_GROUP)
3701 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3702 elm_widget_item_pre_notify_del(it);
3703 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
3704 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
3705 it->itc->func.del((void *)it->base.data, WIDGET(it));
3706 if (it->long_timer) ecore_timer_del(it->long_timer);
3707 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
3708 free(it->item);
3709 elm_widget_item_del(it);
3710 }
3711 wd->clear_me = EINA_FALSE;
3712 wd->anchor_item = NULL;
3713 while (wd->blocks)
3714 {
3715 Item_Block *itb = (Item_Block *)(wd->blocks);
3716
3717 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3718 if (itb->items) eina_list_free(itb->items);
3719 free(itb);
3720 }
3721 if (wd->calc_job)
3722 {
3723 ecore_job_del(wd->calc_job);
3724 wd->calc_job = NULL;
3725 }
3726 if (wd->queue_idle_enterer)
3727 {
3728 ecore_idle_enterer_del(wd->queue_idle_enterer);
3729 wd->queue_idle_enterer = NULL;
3730 }
3731 if (wd->must_recalc_idler)
3732 {
3733 ecore_idler_del(wd->must_recalc_idler);
3734 wd->must_recalc_idler = NULL;
3735 }
3736 if (wd->queue)
3737 {
3738 eina_list_free(wd->queue);
3739 wd->queue = NULL;
3740 }
3741 if (wd->selected)
3742 {
3743 eina_list_free(wd->selected);
3744 wd->selected = NULL;
3745 }
3746 if (wd->reorder_move_animator)
3747 {
3748 ecore_animator_del(wd->reorder_move_animator);
3749 wd->reorder_move_animator = NULL;
3750 }
3751 wd->show_item = NULL;
3752 wd->pan_x = 0;
3753 wd->pan_y = 0;
3754 wd->reorder_old_pan_y = 0;
3755 wd->minw = 0;
3756 wd->minh = 0;
3757 if (wd->pan_smart)
3758 {
3759 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3760 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3761 }
3762 _sizing_eval(obj);
3763 elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
3764 evas_event_thaw(evas_object_evas_get(wd->obj));
3765 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3766} 3676}
3767 3677
3768EAPI void 3678EAPI void
@@ -3891,9 +3801,9 @@ elm_genlist_first_item_get(const Evas_Object *obj)
3891 Widget_Data *wd = elm_widget_data_get(obj); 3801 Widget_Data *wd = elm_widget_data_get(obj);
3892 if (!wd) return NULL; 3802 if (!wd) return NULL;
3893 if (!wd->items) return NULL; 3803 if (!wd->items) return NULL;
3894 Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items); 3804 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
3895 while ((it) && (it->delete_me)) 3805 while ((it) && (it->delete_me))
3896 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 3806 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3897 return it; 3807 return it;
3898} 3808}
3899 3809
@@ -3904,9 +3814,9 @@ elm_genlist_last_item_get(const Evas_Object *obj)
3904 Widget_Data *wd = elm_widget_data_get(obj); 3814 Widget_Data *wd = elm_widget_data_get(obj);
3905 if (!wd) return NULL; 3815 if (!wd) return NULL;
3906 if (!wd->items) return NULL; 3816 if (!wd->items) return NULL;
3907 Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last); 3817 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
3908 while ((it) && (it->delete_me)) 3818 while ((it) && (it->delete_me))
3909 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 3819 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3910 return it; 3820 return it;
3911} 3821}
3912 3822
@@ -3916,7 +3826,7 @@ elm_genlist_item_next_get(const Elm_Gen_Item *it)
3916 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 3826 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3917 while (it) 3827 while (it)
3918 { 3828 {
3919 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 3829 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3920 if ((it) && (!it->delete_me)) break; 3830 if ((it) && (!it->delete_me)) break;
3921 } 3831 }
3922 return (Elm_Gen_Item *)it; 3832 return (Elm_Gen_Item *)it;
@@ -3928,7 +3838,7 @@ elm_genlist_item_prev_get(const Elm_Gen_Item *it)
3928 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 3838 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3929 while (it) 3839 while (it)
3930 { 3840 {
3931 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 3841 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3932 if ((it) && (!it->delete_me)) break; 3842 if ((it) && (!it->delete_me)) break;
3933 } 3843 }
3934 return (Elm_Gen_Item *)it; 3844 return (Elm_Gen_Item *)it;
@@ -3965,31 +3875,7 @@ EAPI void
3965elm_genlist_item_selected_set(Elm_Gen_Item *it, 3875elm_genlist_item_selected_set(Elm_Gen_Item *it,
3966 Eina_Bool selected) 3876 Eina_Bool selected)
3967{ 3877{
3968 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 3878 elm_gen_item_selected_set(it, selected);
3969 Widget_Data *wd = it->wd;
3970 if (!wd) return;
3971 if ((it->delete_me) || (it->disabled)) return;
3972 selected = !!selected;
3973 if (it->selected == selected) return;
3974
3975 if (selected)
3976 {
3977 if (!wd->multi)
3978 {
3979 while (wd->selected)
3980 {
3981 _item_unhighlight(wd->selected->data);
3982 _item_unselect(wd->selected->data);
3983 }
3984 }
3985 _item_highlight(it);
3986 _item_select(it);
3987 }
3988 else
3989 {
3990 _item_unhighlight(it);
3991 _item_unselect(it);
3992 }
3993} 3879}
3994 3880
3995EAPI Eina_Bool 3881EAPI Eina_Bool
@@ -4262,7 +4148,7 @@ elm_genlist_item_del(Elm_Gen_Item *it)
4262 elm_gen_item_del_notserious(it); 4148 elm_gen_item_del_notserious(it);
4263 if (it->item->block) 4149 if (it->item->block)
4264 { 4150 {
4265 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb); 4151 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
4266 it->item->block->changed = EINA_TRUE; 4152 it->item->block->changed = EINA_TRUE;
4267 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); 4153 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4268 it->wd->calc_job = ecore_job_add(_calc_job, it->wd); 4154 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
@@ -4775,6 +4661,7 @@ elm_genlist_item_mode_set(Elm_Gen_Item *it,
4775 (mode_set)) 4661 (mode_set))
4776 return; 4662 return;
4777 if (!wd->mode_item_style) return; 4663 if (!wd->mode_item_style) return;
4664 it->mode_set = mode_set;
4778 4665
4779 if (wd->multi) 4666 if (wd->multi)
4780 { 4667 {