summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-10-21 08:52:03 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-10-21 08:52:03 +0000
commit35c8f40547d32ba4b2cb6cb72be2ccdf7457a1c9 (patch)
tree2e250e681106f269f23ec6d61641985442cb8366 /legacy
parent0766bdaf33d4f0ae7df968913c0c563133c6d01b (diff)
this commit marks step one of The Gengrid & Genlist Unification Project. these poor widget brothers were separated at birth, never knowing that they were almost exactly the same.
from here, it should be trivial to continually move more and more code into elm_gen.c and reduce duplication. ideally we should be aiming for an elm_gen_* api where you differentiate between list/grid with style or something since the apis are almost identical SVN revision: 64245
Diffstat (limited to 'legacy')
-rw-r--r--legacy/elementary/src/lib/Elementary.h.in38
-rw-r--r--legacy/elementary/src/lib/Makefile.am2
-rw-r--r--legacy/elementary/src/lib/elm_gen.c310
-rw-r--r--legacy/elementary/src/lib/elm_gen.h71
-rw-r--r--legacy/elementary/src/lib/elm_gengrid.c508
-rw-r--r--legacy/elementary/src/lib/elm_genlist.c1191
6 files changed, 1179 insertions, 941 deletions
diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in
index 8f764a4654..efe11c640f 100644
--- a/legacy/elementary/src/lib/Elementary.h.in
+++ b/legacy/elementary/src/lib/Elementary.h.in
@@ -7901,6 +7901,32 @@ extern "C" {
7901 * @} 7901 * @}
7902 */ 7902 */
7903 7903
7904 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_Func Elm_Gen_Item_Class_Func; /**< Class functions for gen item classes. */
7907 typedef char *(*Elm_Gen_Item_Label_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Label fetching class function for gen item classes. */
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 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
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
7919 {
7920 const char *item_style;
7921 struct _Elm_Gen_Item_Class_Func
7922 {
7923 Elm_Gen_Item_Label_Get_Cb label_get;
7924 Elm_Gen_Item_Icon_Get_Cb icon_get;
7925 Elm_Gen_Item_State_Get_Cb state_get;
7926 Elm_Gen_Item_Del_Cb del;
7927 } func;
7928 }; /**< #Elm_Gen_Item_Class member definitions */
7929
7904 /** 7930 /**
7905 * @defgroup Gengrid Gengrid (Generic grid) 7931 * @defgroup Gengrid Gengrid (Generic grid)
7906 * 7932 *
@@ -8112,8 +8138,10 @@ extern "C" {
8112 */ 8138 */
8113 8139
8114 typedef struct _Elm_Gengrid_Item_Class Elm_Gengrid_Item_Class; /**< Gengrid item class definition structs */ 8140 typedef struct _Elm_Gengrid_Item_Class Elm_Gengrid_Item_Class; /**< Gengrid item class definition structs */
8115 typedef struct _Elm_Gengrid_Item_Class_Func Elm_Gengrid_Item_Class_Func; /**< Class functions for gengrid item classes. */ 8141 #define Elm_Gengrid_Item_Class Elm_Gen_Item_Class
8116 typedef struct _Elm_Gengrid_Item Elm_Gengrid_Item; /**< Gengrid item handles */ 8142 typedef struct _Elm_Gengrid_Item Elm_Gengrid_Item; /**< Gengrid item handles */
8143 #define Elm_Gengrid_Item Elm_Gen_Item /**< Item of Elm_Genlist. Sub-type of Elm_Widget_Item */
8144 typedef struct _Elm_Gengrid_Item_Class_Func Elm_Gengrid_Item_Class_Func; /**< Class functions for gengrid item classes. */
8117 typedef char *(*Elm_Gengrid_Item_Label_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Label fetching class function for gengrid item classes. */ 8145 typedef char *(*Elm_Gengrid_Item_Label_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Label fetching class function for gengrid item classes. */
8118 typedef Evas_Object *(*Elm_Gengrid_Item_Icon_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Icon fetching class function for gengrid item classes. */ 8146 typedef Evas_Object *(*Elm_Gengrid_Item_Icon_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Icon fetching class function for gengrid item classes. */
8119 typedef Eina_Bool (*Elm_Gengrid_Item_State_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< State fetching class function for gengrid item classes. */ 8147 typedef Eina_Bool (*Elm_Gengrid_Item_State_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< State fetching class function for gengrid item classes. */
@@ -8136,7 +8164,7 @@ extern "C" {
8136 Elm_Gengrid_Item_Del_Cb del; 8164 Elm_Gengrid_Item_Del_Cb del;
8137 } func; 8165 } func;
8138 }; /**< #Elm_Gengrid_Item_Class member definitions */ 8166 }; /**< #Elm_Gengrid_Item_Class member definitions */
8139 8167 #define Elm_Gengrid_Item_Class_Func Elm_Gen_Item_Class_Func
8140 /** 8168 /**
8141 * Add a new gengrid widget to the given parent Elementary 8169 * Add a new gengrid widget to the given parent Elementary
8142 * (container) object 8170 * (container) object
@@ -18109,7 +18137,9 @@ extern "C" {
18109 ELM_GENLIST_ITEM_GROUP = (1 << 1) /**< index of a group of items */ 18137 ELM_GENLIST_ITEM_GROUP = (1 << 1) /**< index of a group of items */
18110 } Elm_Genlist_Item_Flags; 18138 } Elm_Genlist_Item_Flags;
18111 typedef struct _Elm_Genlist_Item_Class Elm_Genlist_Item_Class; /**< Genlist item class definition structs */ 18139 typedef struct _Elm_Genlist_Item_Class Elm_Genlist_Item_Class; /**< Genlist item class definition structs */
18140 #define Elm_Genlist_Item_Class Elm_Gen_Item_Class
18112 typedef struct _Elm_Genlist_Item Elm_Genlist_Item; /**< Item of Elm_Genlist. Sub-type of Elm_Widget_Item */ 18141 typedef struct _Elm_Genlist_Item Elm_Genlist_Item; /**< Item of Elm_Genlist. Sub-type of Elm_Widget_Item */
18142 #define Elm_Genlist_Item Elm_Gen_Item /**< Item of Elm_Genlist. Sub-type of Elm_Widget_Item */
18113 typedef struct _Elm_Genlist_Item_Class_Func Elm_Genlist_Item_Class_Func; /**< Class functions for genlist item class */ 18143 typedef struct _Elm_Genlist_Item_Class_Func Elm_Genlist_Item_Class_Func; /**< Class functions for genlist item class */
18114 typedef char *(*Elm_Genlist_Item_Label_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Label fetching class function for genlist item classes. */ 18144 typedef char *(*Elm_Genlist_Item_Label_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Label fetching class function for genlist item classes. */
18115 typedef Evas_Object *(*Elm_Genlist_Item_Icon_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Icon fetching class function for genlist item classes. */ 18145 typedef Evas_Object *(*Elm_Genlist_Item_Icon_Get_Cb) (void *data, Evas_Object *obj, const char *part); /**< Icon fetching class function for genlist item classes. */
@@ -18129,7 +18159,7 @@ extern "C" {
18129 struct _Elm_Genlist_Item_Class 18159 struct _Elm_Genlist_Item_Class
18130 { 18160 {
18131 const char *item_style; /**< style of this class. */ 18161 const char *item_style; /**< style of this class. */
18132 struct 18162 struct Elm_Genlist_Item_Class_Func
18133 { 18163 {
18134 Elm_Genlist_Item_Label_Get_Cb label_get; /**< Label fetching class function for genlist item classes.*/ 18164 Elm_Genlist_Item_Label_Get_Cb label_get; /**< Label fetching class function for genlist item classes.*/
18135 Elm_Genlist_Item_Icon_Get_Cb icon_get; /**< Icon fetching class function for genlist item classes. */ 18165 Elm_Genlist_Item_Icon_Get_Cb icon_get; /**< Icon fetching class function for genlist item classes. */
@@ -18137,7 +18167,7 @@ extern "C" {
18137 Elm_Genlist_Item_Del_Cb del; /**< Deletion class function for genlist item classes. */ 18167 Elm_Genlist_Item_Del_Cb del; /**< Deletion class function for genlist item classes. */
18138 } func; 18168 } func;
18139 }; 18169 };
18140 18170 #define Elm_Genlist_Item_Class_Func Elm_Gen_Item_Class_Func
18141 /** 18171 /**
18142 * Add a new genlist widget to the given parent Elementary 18172 * Add a new genlist widget to the given parent Elementary
18143 * (container) object 18173 * (container) object
diff --git a/legacy/elementary/src/lib/Makefile.am b/legacy/elementary/src/lib/Makefile.am
index c6b02dd34d..c6b898ad16 100644
--- a/legacy/elementary/src/lib/Makefile.am
+++ b/legacy/elementary/src/lib/Makefile.am
@@ -72,6 +72,8 @@ elm_flip.c \
72elm_flipselector.c \ 72elm_flipselector.c \
73elm_font.c \ 73elm_font.c \
74elm_frame.c \ 74elm_frame.c \
75elm_gen.c \
76elm_gen.h \
75elm_gengrid.c \ 77elm_gengrid.c \
76elm_genlist.c \ 78elm_genlist.c \
77elm_gesture_layer.c \ 79elm_gesture_layer.c \
diff --git a/legacy/elementary/src/lib/elm_gen.c b/legacy/elementary/src/lib/elm_gen.c
new file mode 100644
index 0000000000..6026a2d623
--- /dev/null
+++ b/legacy/elementary/src/lib/elm_gen.c
@@ -0,0 +1,310 @@
1#include <Elementary.h>
2#include <Elementary_Cursor.h>
3#include "elm_priv.h"
4#include "elm_gen.h"
5
6struct _Widget_Data
7{
8 Eina_Inlist_Sorted_State *state;
9 Evas_Object *obj;
10 Eina_List *selected;
11 Eina_List *group_items;
12 Eina_Inlist *items; /* inlist of all items */
13 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
14 Ecore_Job *calc_job;
15 int walking;
16};
17
18static const char *
19_item_label_hook(Elm_Gen_Item *it, const char *part)
20{
21 if (!it->itc->func.label_get) return NULL;
22 return edje_object_part_text_get(VIEW(it), part);
23}
24
25#if 0
26static Eina_Bool
27_deselect_all_items(Widget_Data *wd)
28{
29 if (!wd->selected) return EINA_FALSE;
30 while (wd->selected)
31 elm_gengrid_item_selected_set(wd->selected->data, EINA_FALSE);
32
33 return EINA_TRUE;
34}
35
36static Eina_Bool
37_item_multi_select_left(Widget_Data *wd)
38{
39 if (!wd->selected) return EINA_FALSE;
40
41 Elm_Gengrid_Item *prev = elm_gengrid_item_prev_get(wd->last_selected_item);
42 if (!prev) return EINA_TRUE;
43 if (elm_gengrid_item_selected_get(prev))
44 {
45 elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE);
46 wd->last_selected_item = prev;
47 elm_gengrid_item_show(wd->last_selected_item);
48 }
49 else
50 {
51 elm_gengrid_item_selected_set(prev, EINA_TRUE);
52 elm_gengrid_item_show(prev);
53 }
54
55 return EINA_TRUE;
56}
57
58static Eina_Bool
59_item_multi_select_right(Widget_Data *wd)
60{
61 if (!wd->selected) return EINA_FALSE;
62
63 Elm_Gengrid_Item *next = elm_gengrid_item_next_get(wd->last_selected_item);
64 if (!next) return EINA_TRUE;
65 if (elm_gengrid_item_selected_get(next))
66 {
67 elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE);
68 wd->last_selected_item = next;
69 elm_gengrid_item_show(wd->last_selected_item);
70 }
71 else
72 {
73 elm_gengrid_item_selected_set(next, EINA_TRUE);
74 elm_gengrid_item_show(next);
75 }
76
77 return EINA_TRUE;
78}
79
80static Eina_Bool
81_item_multi_select_up(Widget_Data *wd)
82{
83 unsigned int i;
84 Eina_Bool r = EINA_TRUE;
85
86 if (!wd->selected) return EINA_FALSE;
87
88 for (i = 0; (r) && (i < wd->nmax); i++)
89 r &= _item_multi_select_left(wd);
90
91 return r;
92}
93
94static Eina_Bool
95_item_multi_select_down(Widget_Data *wd)
96{
97 unsigned int i;
98 Eina_Bool r = EINA_TRUE;
99
100 if (!wd->selected) return EINA_FALSE;
101
102 for (i = 0; (r) && (i < wd->nmax); i++)
103 r &= _item_multi_select_right(wd);
104
105 return r;
106}
107
108static Eina_Bool
109_item_single_select_up(Widget_Data *wd)
110{
111 unsigned int i;
112
113 Elm_Gengrid_Item *prev;
114
115 if (!wd->selected)
116 {
117 prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
118 while ((prev) && (prev->delete_me))
119 prev = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
120 elm_gengrid_item_selected_set(prev, EINA_TRUE);
121 elm_gengrid_item_show(prev);
122 return EINA_TRUE;
123 }
124 else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
125
126 if (!prev) return EINA_FALSE;
127
128 for (i = 1; i < wd->nmax; i++)
129 {
130 Elm_Gengrid_Item *tmp = elm_gengrid_item_prev_get(prev);
131 if (!tmp) return EINA_FALSE;
132 prev = tmp;
133 }
134
135 _deselect_all_items(wd);
136
137 elm_gengrid_item_selected_set(prev, EINA_TRUE);
138 elm_gengrid_item_show(prev);
139 return EINA_TRUE;
140}
141
142static Eina_Bool
143_item_single_select_down(Widget_Data *wd)
144{
145 unsigned int i;
146
147 Elm_Gengrid_Item *next;
148
149 if (!wd->selected)
150 {
151 next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
152 while ((next) && (next->delete_me))
153 next = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
154 elm_gengrid_item_selected_set(next, EINA_TRUE);
155 elm_gengrid_item_show(next);
156 return EINA_TRUE;
157 }
158 else next = elm_gengrid_item_next_get(wd->last_selected_item);
159
160 if (!next) return EINA_FALSE;
161
162 for (i = 1; i < wd->nmax; i++)
163 {
164 Elm_Gengrid_Item *tmp = elm_gengrid_item_next_get(next);
165 if (!tmp) return EINA_FALSE;
166 next = tmp;
167 }
168
169 _deselect_all_items(wd);
170
171 elm_gengrid_item_selected_set(next, EINA_TRUE);
172 elm_gengrid_item_show(next);
173 return EINA_TRUE;
174}
175
176static Eina_Bool
177_item_single_select_left(Widget_Data *wd)
178{
179 Elm_Gengrid_Item *prev;
180 if (!wd->selected)
181 {
182 prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
183 while ((prev) && (prev->delete_me))
184 prev = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
185 }
186 else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
187
188 if (!prev) return EINA_FALSE;
189
190 _deselect_all_items(wd);
191
192 elm_gengrid_item_selected_set(prev, EINA_TRUE);
193 elm_gengrid_item_show(prev);
194 return EINA_TRUE;
195}
196
197static Eina_Bool
198_item_single_select_right(Widget_Data *wd)
199{
200 Elm_Gengrid_Item *next;
201 if (!wd->selected)
202 {
203 next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
204 while ((next) && (next->delete_me))
205 next = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
206 }
207 else next = elm_gengrid_item_next_get(wd->last_selected_item);
208
209 if (!next) return EINA_FALSE;
210
211 _deselect_all_items(wd);
212
213 elm_gengrid_item_selected_set(next, EINA_TRUE);
214 elm_gengrid_item_show(next);
215 return EINA_TRUE;
216}
217#endif
218
219void
220elm_gen_item_unrealize(Elm_Gen_Item *it,
221 Eina_Bool calc,
222 Ecore_Cb extra_cb)
223{
224 Evas_Object *icon;
225
226 if (!it->realized) return;
227 if (it->wd->reorder_it == it) return;
228 evas_event_freeze(evas_object_evas_get(WIDGET(it)));
229 if (!calc)
230 evas_object_smart_callback_call(WIDGET(it), "unrealized", it);
231 if (it->long_timer)
232 {
233 ecore_timer_del(it->long_timer);
234 it->long_timer = NULL;
235 }
236
237 elm_widget_stringlist_free(it->labels);
238 it->labels = NULL;
239 elm_widget_stringlist_free(it->icons);
240 it->icons = NULL;
241 elm_widget_stringlist_free(it->states);
242 it->states = NULL;
243
244 EINA_LIST_FREE(it->icon_objs, icon)
245 evas_object_del(icon);
246
247 if (extra_cb) extra_cb(it);
248
249 it->realized = EINA_FALSE;
250 it->want_unrealize = EINA_FALSE;
251 evas_event_thaw(evas_object_evas_get(WIDGET(it)));
252 evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
253}
254
255void
256elm_gen_item_del_notserious(Elm_Gen_Item *it)
257{
258 elm_widget_item_pre_notify_del(it);
259 it->delete_me = EINA_TRUE;
260 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
261
262 if (it->itc->func.del)
263 it->itc->func.del((void *)it->base.data, WIDGET(it));
264}
265
266void
267elm_gen_item_del_serious(Elm_Gen_Item *it, Ecore_Cb job)
268{
269 elm_widget_item_pre_notify_del(it);
270 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
271 it->delete_me = EINA_TRUE;
272 if ((!it->delete_me) && (it->itc->func.del))
273 it->itc->func.del((void *)it->base.data, WIDGET(it));
274 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
275 if (it->tooltip.del_cb)
276 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
277 it->wd->walking -= it->walking;
278 if (it->long_timer) ecore_timer_del(it->long_timer);
279 if (it->group)
280 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
281
282 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
283 it->wd->calc_job = ecore_job_add(job, it->wd);
284 free(it->item);
285 it->item = NULL;
286 elm_widget_item_del(it);
287}
288
289Elm_Gen_Item *
290elm_gen_item_new(Widget_Data *wd,
291 const Elm_Gen_Item_Class *itc,
292 const void *data,
293 Elm_Gen_Item *parent,
294 Evas_Smart_Cb func,
295 const void *func_data)
296{
297 Elm_Gen_Item *it;
298
299 it = elm_widget_item_new(wd->obj, Elm_Gen_Item);
300 if (!it) return NULL;
301 it->wd = wd;
302 it->itc = itc;
303 it->base.data = data;
304 it->parent = parent;
305 it->func.func = func;
306 it->func.data = func_data;
307
308 elm_widget_item_text_get_hook_set(it, _item_label_hook);
309 return it;
310}
diff --git a/legacy/elementary/src/lib/elm_gen.h b/legacy/elementary/src/lib/elm_gen.h
new file mode 100644
index 0000000000..b16113b96a
--- /dev/null
+++ b/legacy/elementary/src/lib/elm_gen.h
@@ -0,0 +1,71 @@
1#include <Elementary.h>
2#include <Elementary_Cursor.h>
3#include "elm_priv.h"
4
5typedef struct Elm_Gen_Item_Type Elm_Gen_Item_Type;
6typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip;
7typedef struct _Widget_Data Widget_Data;
8
9struct Elm_Gen_Item_Tooltip
10{
11 const void *data;
12 Elm_Tooltip_Item_Content_Cb content_cb;
13 Evas_Smart_Cb del_cb;
14 const char *style;
15 Eina_Bool free_size : 1;
16};
17
18struct Elm_Gen_Item
19{
20 ELM_WIDGET_ITEM;
21 EINA_INLIST;
22 Widget_Data *wd;
23 Elm_Gen_Item_Type *item;
24 const Elm_Gen_Item_Class *itc;
25 Evas_Coord x, y, dx, dy;
26 Evas_Object *spacer;
27 Elm_Gen_Item *parent;
28 Eina_List *labels, *icons, *states, *icon_objs;
29 Ecore_Timer *long_timer;
30 int relcount;
31 int walking;
32 const char *mouse_cursor;
33
34 struct
35 {
36 Evas_Smart_Cb func;
37 const void *data;
38 } func;
39
40 Elm_Gen_Item_Tooltip tooltip;
41
42 Eina_Bool want_unrealize : 1;
43 Eina_Bool display_only : 1;
44 Eina_Bool realized : 1;
45 Eina_Bool selected : 1;
46 Eina_Bool highlighted : 1;
47 Eina_Bool disabled : 1;
48 Eina_Bool dragging : 1;
49 Eina_Bool delete_me : 1;
50 Eina_Bool down : 1;
51 Eina_Bool group : 1;
52 Eina_Bool reorder : 1;
53};
54
55Elm_Gen_Item *
56elm_gen_item_new(Widget_Data *wd,
57 const Elm_Gen_Item_Class *itc,
58 const void *data,
59 Elm_Gen_Item *parent,
60 Evas_Smart_Cb func,
61 const void *func_data);
62
63void
64elm_gen_item_unrealize(Elm_Gen_Item *it,
65 Eina_Bool calc,
66 Ecore_Cb extra_cb);
67void
68elm_gen_item_del_serious(Elm_Gen_Item *it, Ecore_Cb job);
69
70void
71elm_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 e1d724d1cc..5735299d07 100644
--- a/legacy/elementary/src/lib/elm_gengrid.c
+++ b/legacy/elementary/src/lib/elm_gengrid.c
@@ -2,77 +2,45 @@
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 "els_scroller.h"
5#include "elm_gen.h"
5 6
6/* -- 7/* --
7 * TODO: 8 * TODO:
8 * Handle non-homogeneous objects too. 9 * Handle non-homogeneous objects too.
9 */ 10 */
10 11
11 typedef struct _Widget_Data Widget_Data;
12 typedef struct _Pan Pan; 12 typedef struct _Pan Pan;
13 13
14#define PRELOAD 1 14#define PRELOAD 1
15#define REORDER_EFFECT_TIME 0.5 15#define REORDER_EFFECT_TIME 0.5
16 16
17 struct _Elm_Gengrid_Item 17struct Elm_Gen_Item_Type
18{ 18{
19 ELM_WIDGET_ITEM; 19 Elm_Gen_Item *it;
20 EINA_INLIST; 20 Ecore_Animator *item_moving_effect_timer;
21 Evas_Object *spacer; 21 Evas_Coord gx, gy, ox, oy, tx, ty, rx, ry;
22 const Elm_Gengrid_Item_Class *itc;
23 Elm_Gengrid_Item *parent;
24 Ecore_Timer *long_timer;
25 Ecore_Animator *item_moving_effect_timer;
26 Widget_Data *wd;
27 Eina_List *labels, *icons, *states, *icon_objs;
28 struct
29 {
30 Evas_Smart_Cb func;
31 const void *data;
32 } func;
33
34 Evas_Coord x, y, gx, gy, dx, dy, ox, oy, tx, ty, rx, ry;
35 unsigned int moving_effect_start_time; 22 unsigned int moving_effect_start_time;
36 int relcount;
37 int walking;
38 int prev_group; 23 int prev_group;
39 24
40 struct
41 {
42 const void *data;
43 Elm_Tooltip_Item_Content_Cb content_cb;
44 Evas_Smart_Cb del_cb;
45 const char *style;
46 Eina_Bool free_size : 1;
47 } tooltip;
48
49 const char *mouse_cursor;
50
51 Eina_Bool is_group : 1;
52 Eina_Bool want_unrealize : 1;
53 Eina_Bool group_realized : 1; 25 Eina_Bool group_realized : 1;
54 Eina_Bool realized : 1;
55 Eina_Bool dragging : 1;
56 Eina_Bool down : 1;
57 Eina_Bool delete_me : 1;
58 Eina_Bool display_only : 1;
59 Eina_Bool disabled : 1;
60 Eina_Bool selected : 1;
61 Eina_Bool highlighted : 1;
62 Eina_Bool moving : 1; 26 Eina_Bool moving : 1;
63}; 27};
64 28
65struct _Widget_Data 29struct _Widget_Data
66{ 30{
67 Eina_Inlist_Sorted_State *state; 31 Eina_Inlist_Sorted_State *state;
68 Evas_Object *self, *scr; 32 Evas_Object *self;
33 Eina_List *selected;
34 Eina_List *group_items; /* list of groups index items */
35 Eina_Inlist *items; /* inlist of all items */
36 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
37 Ecore_Job *calc_job;
38 int walking;
39 ////////////////////////////////////
40 Evas_Object *scr;
69 Evas_Object *pan_smart; 41 Evas_Object *pan_smart;
70 Pan *pan; 42 Pan *pan;
71 Eina_Inlist *items; 43 Elm_Gen_Item *last_selected_item;
72 Eina_List *group_items;
73 Ecore_Job *calc_job;
74 Eina_List *selected;
75 Elm_Gengrid_Item *last_selected_item, *reorder_item;
76 double align_x, align_y; 44 double align_x, align_y;
77 45
78 Evas_Coord pan_x, pan_y, old_pan_x, old_pan_y; 46 Evas_Coord pan_x, pan_y, old_pan_x, old_pan_y;
@@ -83,8 +51,7 @@ struct _Widget_Data
83 unsigned int nmax; 51 unsigned int nmax;
84 long count; 52 long count;
85 long items_lost; 53 long items_lost;
86 int walking; 54
87
88 Eina_Bool horizontal : 1; 55 Eina_Bool horizontal : 1;
89 Eina_Bool on_hold : 1; 56 Eina_Bool on_hold : 1;
90 Eina_Bool longpressed : 1; 57 Eina_Bool longpressed : 1;
@@ -101,7 +68,7 @@ struct _Widget_Data
101}; 68};
102 69
103#define ELM_GENGRID_ITEM_FROM_INLIST(it) \ 70#define ELM_GENGRID_ITEM_FROM_INLIST(it) \
104 ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gengrid_Item) : NULL) 71 ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
105 72
106struct _Pan 73struct _Pan
107{ 74{
@@ -110,10 +77,10 @@ struct _Pan
110}; 77};
111 78
112static const char *widtype = NULL; 79static const char *widtype = NULL;
113static void _item_highlight(Elm_Gengrid_Item *it); 80static void _item_highlight(Elm_Gen_Item *it);
114static void _item_unrealize(Elm_Gengrid_Item *it); 81static void _item_unrealize_cb(Elm_Gen_Item *it);
115static void _item_select(Elm_Gengrid_Item *it); 82static void _item_select(Elm_Gen_Item *it);
116static void _item_unselect(Elm_Gengrid_Item *it); 83static void _item_unselect(Elm_Gen_Item *it);
117static void _calc_job(void *data); 84static void _calc_job(void *data);
118static void _on_focus_hook(void *data, 85static void _on_focus_hook(void *data,
119 Evas_Object *obj); 86 Evas_Object *obj);
@@ -212,7 +179,7 @@ _event_hook(Evas_Object *obj,
212 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; 179 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
213 if (elm_widget_disabled_get(obj)) return EINA_FALSE; 180 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
214 181
215 Elm_Gengrid_Item *it = NULL; 182 Elm_Gen_Item *it = NULL;
216 Evas_Coord x = 0; 183 Evas_Coord x = 0;
217 Evas_Coord y = 0; 184 Evas_Coord y = 0;
218 Evas_Coord step_x = 0; 185 Evas_Coord step_x = 0;
@@ -394,7 +361,7 @@ _item_multi_select_left(Widget_Data *wd)
394{ 361{
395 if (!wd->selected) return EINA_FALSE; 362 if (!wd->selected) return EINA_FALSE;
396 363
397 Elm_Gengrid_Item *prev = elm_gengrid_item_prev_get(wd->last_selected_item); 364 Elm_Gen_Item *prev = elm_gengrid_item_prev_get(wd->last_selected_item);
398 if (!prev) return EINA_TRUE; 365 if (!prev) return EINA_TRUE;
399 if (elm_gengrid_item_selected_get(prev)) 366 if (elm_gengrid_item_selected_get(prev))
400 { 367 {
@@ -416,7 +383,7 @@ _item_multi_select_right(Widget_Data *wd)
416{ 383{
417 if (!wd->selected) return EINA_FALSE; 384 if (!wd->selected) return EINA_FALSE;
418 385
419 Elm_Gengrid_Item *next = elm_gengrid_item_next_get(wd->last_selected_item); 386 Elm_Gen_Item *next = elm_gengrid_item_next_get(wd->last_selected_item);
420 if (!next) return EINA_TRUE; 387 if (!next) return EINA_TRUE;
421 if (elm_gengrid_item_selected_get(next)) 388 if (elm_gengrid_item_selected_get(next))
422 { 389 {
@@ -466,7 +433,7 @@ _item_single_select_up(Widget_Data *wd)
466{ 433{
467 unsigned int i; 434 unsigned int i;
468 435
469 Elm_Gengrid_Item *prev; 436 Elm_Gen_Item *prev;
470 437
471 if (!wd->selected) 438 if (!wd->selected)
472 { 439 {
@@ -483,7 +450,7 @@ _item_single_select_up(Widget_Data *wd)
483 450
484 for (i = 1; i < wd->nmax; i++) 451 for (i = 1; i < wd->nmax; i++)
485 { 452 {
486 Elm_Gengrid_Item *tmp = elm_gengrid_item_prev_get(prev); 453 Elm_Gen_Item *tmp = elm_gengrid_item_prev_get(prev);
487 if (!tmp) return EINA_FALSE; 454 if (!tmp) return EINA_FALSE;
488 prev = tmp; 455 prev = tmp;
489 } 456 }
@@ -500,7 +467,7 @@ _item_single_select_down(Widget_Data *wd)
500{ 467{
501 unsigned int i; 468 unsigned int i;
502 469
503 Elm_Gengrid_Item *next; 470 Elm_Gen_Item *next;
504 471
505 if (!wd->selected) 472 if (!wd->selected)
506 { 473 {
@@ -517,7 +484,7 @@ _item_single_select_down(Widget_Data *wd)
517 484
518 for (i = 1; i < wd->nmax; i++) 485 for (i = 1; i < wd->nmax; i++)
519 { 486 {
520 Elm_Gengrid_Item *tmp = elm_gengrid_item_next_get(next); 487 Elm_Gen_Item *tmp = elm_gengrid_item_next_get(next);
521 if (!tmp) return EINA_FALSE; 488 if (!tmp) return EINA_FALSE;
522 next = tmp; 489 next = tmp;
523 } 490 }
@@ -532,7 +499,7 @@ _item_single_select_down(Widget_Data *wd)
532static Eina_Bool 499static Eina_Bool
533_item_single_select_left(Widget_Data *wd) 500_item_single_select_left(Widget_Data *wd)
534{ 501{
535 Elm_Gengrid_Item *prev; 502 Elm_Gen_Item *prev;
536 if (!wd->selected) 503 if (!wd->selected)
537 { 504 {
538 prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last); 505 prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
@@ -553,7 +520,7 @@ _item_single_select_left(Widget_Data *wd)
553static Eina_Bool 520static Eina_Bool
554_item_single_select_right(Widget_Data *wd) 521_item_single_select_right(Widget_Data *wd)
555{ 522{
556 Elm_Gengrid_Item *next; 523 Elm_Gen_Item *next;
557 if (!wd->selected) 524 if (!wd->selected)
558 { 525 {
559 next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items); 526 next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
@@ -595,7 +562,7 @@ static void
595_mirrored_set(Evas_Object *obj, Eina_Bool rtl) 562_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
596{ 563{
597 Widget_Data *wd = elm_widget_data_get(obj); 564 Widget_Data *wd = elm_widget_data_get(obj);
598 Elm_Gengrid_Item *it; 565 Elm_Gen_Item *it;
599 if (!wd) return; 566 if (!wd) return;
600 elm_smart_scroller_mirrored_set(wd->scr, rtl); 567 elm_smart_scroller_mirrored_set(wd->scr, rtl);
601 if (!wd->items) return; 568 if (!wd->items) return;
@@ -634,6 +601,7 @@ static void
634_del_hook(Evas_Object *obj) 601_del_hook(Evas_Object *obj)
635{ 602{
636 Widget_Data *wd = elm_widget_data_get(obj); 603 Widget_Data *wd = elm_widget_data_get(obj);
604 if (wd->calc_job) ecore_job_del(wd->calc_job);
637 free(wd); 605 free(wd);
638} 606}
639 607
@@ -680,7 +648,7 @@ _mouse_move(void *data,
680 Evas_Object *obj, 648 Evas_Object *obj,
681 void *event_info) 649 void *event_info)
682{ 650{
683 Elm_Gengrid_Item *it = data; 651 Elm_Gen_Item *it = data;
684 Evas_Event_Mouse_Move *ev = event_info; 652 Evas_Event_Mouse_Move *ev = event_info;
685 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady; 653 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
686 Evas_Coord ox, oy, ow, oh, it_scrl_x, it_scrl_y; 654 Evas_Coord ox, oy, ow, oh, it_scrl_x, it_scrl_y;
@@ -711,12 +679,12 @@ _mouse_move(void *data,
711 ecore_timer_del(it->long_timer); 679 ecore_timer_del(it->long_timer);
712 it->long_timer = NULL; 680 it->long_timer = NULL;
713 } 681 }
714 if ((it->wd->reorder_mode) && (it->wd->reorder_item)) 682 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
715 { 683 {
716 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh); 684 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
717 685
718 it_scrl_x = ev->cur.canvas.x - it->wd->reorder_item->dx; 686 it_scrl_x = ev->cur.canvas.x - it->wd->reorder_it->dx;
719 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_item->dy; 687 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
720 688
721 if (it_scrl_x < ox) it->wd->reorder_item_x = ox; 689 if (it_scrl_x < ox) it->wd->reorder_item_x = ox;
722 else if (it_scrl_x + it->wd->item_width > ox + ow) 690 else if (it_scrl_x + it->wd->item_width > ox + ow)
@@ -801,7 +769,7 @@ _mouse_move(void *data,
801static Eina_Bool 769static Eina_Bool
802_long_press(void *data) 770_long_press(void *data)
803{ 771{
804 Elm_Gengrid_Item *it = data; 772 Elm_Gen_Item *it = data;
805 773
806 it->long_timer = NULL; 774 it->long_timer = NULL;
807 if ((it->disabled) || (it->dragging)) return ECORE_CALLBACK_CANCEL; 775 if ((it->disabled) || (it->dragging)) return ECORE_CALLBACK_CANCEL;
@@ -809,7 +777,7 @@ _long_press(void *data)
809 evas_object_smart_callback_call(it->wd->self, SIG_LONGPRESSED, it); 777 evas_object_smart_callback_call(it->wd->self, SIG_LONGPRESSED, it);
810 if (it->wd->reorder_mode) 778 if (it->wd->reorder_mode)
811 { 779 {
812 it->wd->reorder_item = it; 780 it->wd->reorder_it = it;
813 evas_object_raise(VIEW(it)); 781 evas_object_raise(VIEW(it));
814 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE); 782 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
815 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE); 783 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
@@ -824,7 +792,7 @@ _mouse_down(void *data,
824 Evas_Object *obj, 792 Evas_Object *obj,
825 void *event_info) 793 void *event_info)
826{ 794{
827 Elm_Gengrid_Item *it = data; 795 Elm_Gen_Item *it = data;
828 Evas_Event_Mouse_Down *ev = event_info; 796 Evas_Event_Mouse_Down *ev = event_info;
829 Evas_Coord x, y; 797 Evas_Coord x, y;
830 798
@@ -858,7 +826,7 @@ _mouse_up(void *data,
858 Evas_Object *obj __UNUSED__, 826 Evas_Object *obj __UNUSED__,
859 void *event_info) 827 void *event_info)
860{ 828{
861 Elm_Gengrid_Item *it = data; 829 Elm_Gen_Item *it = data;
862 Evas_Event_Mouse_Up *ev = event_info; 830 Evas_Event_Mouse_Up *ev = event_info;
863 Eina_Bool dragged = EINA_FALSE; 831 Eina_Bool dragged = EINA_FALSE;
864 832
@@ -883,10 +851,10 @@ _mouse_up(void *data,
883 it->wd->on_hold = EINA_FALSE; 851 it->wd->on_hold = EINA_FALSE;
884 return; 852 return;
885 } 853 }
886 if ((it->wd->reorder_mode) && (it->wd->reorder_item)) 854 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
887 { 855 {
888 evas_object_smart_callback_call(it->wd->self, SIG_MOVED, it->wd->reorder_item); 856 evas_object_smart_callback_call(it->wd->self, SIG_MOVED, it->wd->reorder_it);
889 it->wd->reorder_item = NULL; 857 it->wd->reorder_it = NULL;
890 it->wd->move_effect_enabled = EINA_FALSE; 858 it->wd->move_effect_enabled = EINA_FALSE;
891 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); 859 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
892 it->wd->calc_job = ecore_job_add(_calc_job, it->wd); 860 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
@@ -904,7 +872,8 @@ _mouse_up(void *data,
904 } 872 }
905 if (dragged) 873 if (dragged)
906 { 874 {
907 if (it->want_unrealize) _item_unrealize(it); 875 if (it->want_unrealize)
876 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
908 } 877 }
909 if ((it->disabled) || (dragged)) return; 878 if ((it->disabled) || (dragged)) return;
910 if (it->wd->multi) 879 if (it->wd->multi)
@@ -926,7 +895,7 @@ _mouse_up(void *data,
926 else 895 else
927 { 896 {
928 const Eina_List *l, *l_next; 897 const Eina_List *l, *l_next;
929 Elm_Gengrid_Item *item2; 898 Elm_Gen_Item *item2;
930 899
931 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, item2) 900 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, item2)
932 if (item2 != it) _item_unselect(item2); 901 if (item2 != it) _item_unselect(item2);
@@ -937,7 +906,7 @@ _mouse_up(void *data,
937} 906}
938 907
939static void 908static void
940_item_highlight(Elm_Gengrid_Item *it) 909_item_highlight(Elm_Gen_Item *it)
941{ 910{
942 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted)) return; 911 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted)) return;
943 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); 912 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
@@ -945,7 +914,7 @@ _item_highlight(Elm_Gengrid_Item *it)
945} 914}
946 915
947static void 916static void
948_item_realize(Elm_Gengrid_Item *it) 917_item_realize(Elm_Gen_Item *it)
949{ 918{
950 char buf[1024]; 919 char buf[1024];
951 char style[1024]; 920 char style[1024];
@@ -1030,7 +999,7 @@ _item_realize(Elm_Gengrid_Item *it)
1030 } 999 }
1031 } 1000 }
1032 1001
1033 if (it->is_group) 1002 if (it->group)
1034 { 1003 {
1035 if ((!it->wd->group_item_width) && (!it->wd->group_item_height)) 1004 if ((!it->wd->group_item_width) && (!it->wd->group_item_height))
1036 { 1005 {
@@ -1085,63 +1054,42 @@ _item_realize(Elm_Gengrid_Item *it)
1085} 1054}
1086 1055
1087static void 1056static void
1088_item_unrealize(Elm_Gengrid_Item *it) 1057_item_unrealize_cb(Elm_Gen_Item *it)
1089{ 1058{
1090 Evas_Object *icon;
1091
1092 if (!it->realized) return;
1093 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
1094 if (it->long_timer)
1095 {
1096 ecore_timer_del(it->long_timer);
1097 it->long_timer = NULL;
1098 }
1099 evas_object_del(VIEW(it)); 1059 evas_object_del(VIEW(it));
1100 VIEW(it) = NULL; 1060 VIEW(it) = NULL;
1101 evas_object_del(it->spacer); 1061 evas_object_del(it->spacer);
1102 it->spacer = NULL; 1062 it->spacer = NULL;
1103 elm_widget_stringlist_free(it->labels);
1104 it->labels = NULL;
1105 elm_widget_stringlist_free(it->icons);
1106 it->icons = NULL;
1107 elm_widget_stringlist_free(it->states);
1108 it->states = NULL;
1109
1110 EINA_LIST_FREE(it->icon_objs, icon)
1111 evas_object_del(icon);
1112
1113 it->realized = EINA_FALSE;
1114 it->want_unrealize = EINA_FALSE;
1115} 1063}
1116 1064
1117static Eina_Bool 1065static Eina_Bool
1118_reorder_item_moving_effect_timer_cb(void *data) 1066_reorder_item_moving_effect_timer_cb(void *data)
1119{ 1067{
1120 Elm_Gengrid_Item *it = data; 1068 Elm_Gen_Item *it = data;
1121 double time, t; 1069 double time, t;
1122 Evas_Coord dx, dy; 1070 Evas_Coord dx, dy;
1123 1071
1124 time = REORDER_EFFECT_TIME; 1072 time = REORDER_EFFECT_TIME;
1125 t = ((0.0 > (t = ecore_loop_time_get()-it->moving_effect_start_time)) ? 0.0 : t); 1073 t = ((0.0 > (t = ecore_loop_time_get()-it->item->moving_effect_start_time)) ? 0.0 : t);
1126 dx = ((it->tx - it->ox) / 10) * _elm_config->scale; 1074 dx = ((it->item->tx - it->item->ox) / 10) * _elm_config->scale;
1127 dy = ((it->ty - it->oy) / 10) * _elm_config->scale; 1075 dy = ((it->item->ty - it->item->oy) / 10) * _elm_config->scale;
1128 1076
1129 if (t <= time) 1077 if (t <= time)
1130 { 1078 {
1131 it->rx += (1 * sin((t / time) * (M_PI / 2)) * dx); 1079 it->item->rx += (1 * sin((t / time) * (M_PI / 2)) * dx);
1132 it->ry += (1 * sin((t / time) * (M_PI / 2)) * dy); 1080 it->item->ry += (1 * sin((t / time) * (M_PI / 2)) * dy);
1133 } 1081 }
1134 else 1082 else
1135 { 1083 {
1136 it->rx += dx; 1084 it->item->rx += dx;
1137 it->ry += dy; 1085 it->item->ry += dy;
1138 } 1086 }
1139 1087
1140 if ((((dx > 0) && (it->rx >= it->tx)) || ((dx <= 0) && (it->rx <= it->tx))) && 1088 if ((((dx > 0) && (it->item->rx >= it->item->tx)) || ((dx <= 0) && (it->item->rx <= it->item->tx))) &&
1141 (((dy > 0) && (it->ry >= it->ty)) || ((dy <= 0) && (it->ry <= it->ty)))) 1089 (((dy > 0) && (it->item->ry >= it->item->ty)) || ((dy <= 0) && (it->item->ry <= it->item->ty))))
1142 { 1090 {
1143 evas_object_move(VIEW(it), it->tx, it->ty); 1091 evas_object_move(VIEW(it), it->item->tx, it->item->ty);
1144 if (it->is_group) 1092 if (it->group)
1145 { 1093 {
1146 Evas_Coord vw, vh; 1094 Evas_Coord vw, vh;
1147 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &vw, &vh); 1095 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &vw, &vh);
@@ -1152,13 +1100,13 @@ _reorder_item_moving_effect_timer_cb(void *data)
1152 } 1100 }
1153 else 1101 else
1154 evas_object_resize(VIEW(it), it->wd->item_width, it->wd->item_height); 1102 evas_object_resize(VIEW(it), it->wd->item_width, it->wd->item_height);
1155 it->moving = EINA_FALSE; 1103 it->item->moving = EINA_FALSE;
1156 it->item_moving_effect_timer = NULL; 1104 it->item->item_moving_effect_timer = NULL;
1157 return ECORE_CALLBACK_CANCEL; 1105 return ECORE_CALLBACK_CANCEL;
1158 } 1106 }
1159 1107
1160 evas_object_move(VIEW(it), it->rx, it->ry); 1108 evas_object_move(VIEW(it), it->item->rx, it->item->ry);
1161 if (it->is_group) 1109 if (it->group)
1162 { 1110 {
1163 Evas_Coord vw, vh; 1111 Evas_Coord vw, vh;
1164 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &vw, &vh); 1112 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &vw, &vh);
@@ -1179,7 +1127,7 @@ _group_item_place(Pan *sd)
1179 Evas_Coord iw, ih, vw, vh; 1127 Evas_Coord iw, ih, vw, vh;
1180 Eina_List *l; 1128 Eina_List *l;
1181 Eina_Bool was_realized; 1129 Eina_Bool was_realized;
1182 Elm_Gengrid_Item *it; 1130 Elm_Gen_Item *it;
1183 evas_object_geometry_get(sd->wd->pan_smart, NULL, NULL, &vw, &vh); 1131 evas_object_geometry_get(sd->wd->pan_smart, NULL, NULL, &vw, &vh);
1184 if (sd->wd->horizontal) 1132 if (sd->wd->horizontal)
1185 { 1133 {
@@ -1194,23 +1142,23 @@ _group_item_place(Pan *sd)
1194 EINA_LIST_FOREACH(sd->wd->group_items, l, it) 1142 EINA_LIST_FOREACH(sd->wd->group_items, l, it)
1195 { 1143 {
1196 was_realized = it->realized; 1144 was_realized = it->realized;
1197 if (it->group_realized) 1145 if (it->item->group_realized)
1198 { 1146 {
1199 _item_realize(it); 1147 _item_realize(it);
1200 if (!was_realized) 1148 if (!was_realized)
1201 evas_object_smart_callback_call(it->wd->self, SIG_REALIZED, it); 1149 evas_object_smart_callback_call(it->wd->self, SIG_REALIZED, it);
1202 evas_object_move(VIEW(it), it->gx, it->gy); 1150 evas_object_move(VIEW(it), it->item->gx, it->item->gy);
1203 evas_object_resize(VIEW(it), iw, ih); 1151 evas_object_resize(VIEW(it), iw, ih);
1204 evas_object_raise(VIEW(it)); 1152 evas_object_raise(VIEW(it));
1205 } 1153 }
1206 else 1154 else
1207 _item_unrealize(it); 1155 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
1208 } 1156 }
1209} 1157}
1210 1158
1211 1159
1212static void 1160static void
1213_item_place(Elm_Gengrid_Item *it, 1161_item_place(Elm_Gen_Item *it,
1214 Evas_Coord cx, 1162 Evas_Coord cx,
1215 Evas_Coord cy) 1163 Evas_Coord cy)
1216{ 1164{
@@ -1277,11 +1225,11 @@ _item_place(Elm_Gengrid_Item *it,
1277 alignw = (vw - tcw) * it->wd->align_x; 1225 alignw = (vw - tcw) * it->wd->align_x;
1278 } 1226 }
1279 1227
1280 if (it->is_group) 1228 if (it->group)
1281 { 1229 {
1282 if (it->wd->horizontal) 1230 if (it->wd->horizontal)
1283 { 1231 {
1284 x = (((cx - it->prev_group) * it->wd->item_width) + (it->prev_group * it->wd->group_item_width)) - it->wd->pan_x + ox + alignw; 1232 x = (((cx - it->item->prev_group) * it->wd->item_width) + (it->item->prev_group * it->wd->group_item_width)) - it->wd->pan_x + ox + alignw;
1285 y = 0; 1233 y = 0;
1286 iw = it->wd->group_item_width; 1234 iw = it->wd->group_item_width;
1287 ih = vh; 1235 ih = vh;
@@ -1289,24 +1237,24 @@ _item_place(Elm_Gengrid_Item *it,
1289 else 1237 else
1290 { 1238 {
1291 x = 0; 1239 x = 0;
1292 y = (((cy - it->prev_group) * it->wd->item_height) + (it->prev_group * it->wd->group_item_height)) - it->wd->pan_y + oy + alignh; 1240 y = (((cy - it->item->prev_group) * it->wd->item_height) + (it->item->prev_group * it->wd->group_item_height)) - it->wd->pan_y + oy + alignh;
1293 iw = vw; 1241 iw = vw;
1294 ih = it->wd->group_item_height; 1242 ih = it->wd->group_item_height;
1295 } 1243 }
1296 it->gx = x; 1244 it->item->gx = x;
1297 it->gy = y; 1245 it->item->gy = y;
1298 } 1246 }
1299 else 1247 else
1300 { 1248 {
1301 if (it->wd->horizontal) 1249 if (it->wd->horizontal)
1302 { 1250 {
1303 x = (((cx - it->prev_group) * it->wd->item_width) + (it->prev_group * it->wd->group_item_width)) - it->wd->pan_x + ox + alignw; 1251 x = (((cx - it->item->prev_group) * it->wd->item_width) + (it->item->prev_group * it->wd->group_item_width)) - it->wd->pan_x + ox + alignw;
1304 y = (cy * it->wd->item_height) - it->wd->pan_y + oy + alignh; 1252 y = (cy * it->wd->item_height) - it->wd->pan_y + oy + alignh;
1305 } 1253 }
1306 else 1254 else
1307 { 1255 {
1308 x = (cx * it->wd->item_width) - it->wd->pan_x + ox + alignw; 1256 x = (cx * it->wd->item_width) - it->wd->pan_x + ox + alignw;
1309 y = (((cy - it->prev_group) * it->wd->item_height) + (it->prev_group * it->wd->group_item_height)) - it->wd->pan_y + oy + alignh; 1257 y = (((cy - it->item->prev_group) * it->wd->item_height) + (it->item->prev_group * it->wd->group_item_height)) - it->wd->pan_y + oy + alignh;
1310 } 1258 }
1311 if (elm_widget_mirrored_get(it->wd->self)) 1259 if (elm_widget_mirrored_get(it->wd->self))
1312 { /* Switch items side and componsate for pan_x when in RTL mode */ 1260 { /* Switch items side and componsate for pan_x when in RTL mode */
@@ -1327,36 +1275,36 @@ _item_place(Elm_Gengrid_Item *it,
1327 { 1275 {
1328 if (it->wd->horizontal) 1276 if (it->wd->horizontal)
1329 { 1277 {
1330 if (it->parent->gx < 0) 1278 if (it->parent->item->gx < 0)
1331 { 1279 {
1332 it->parent->gx = x + it->wd->item_width - it->wd->group_item_width; 1280 it->parent->item->gx = x + it->wd->item_width - it->wd->group_item_width;
1333 if (it->parent->gx > 0) 1281 if (it->parent->item->gx > 0)
1334 it->parent->gx = 0; 1282 it->parent->item->gx = 0;
1335 } 1283 }
1336 } 1284 }
1337 else 1285 else
1338 { 1286 {
1339 if (it->parent->gy < 0) 1287 if (it->parent->item->gy < 0)
1340 { 1288 {
1341 it->parent->gy = y + it->wd->item_height - it->wd->group_item_height; 1289 it->parent->item->gy = y + it->wd->item_height - it->wd->group_item_height;
1342 if (it->parent->gy > 0) 1290 if (it->parent->item->gy > 0)
1343 it->parent->gy = 0; 1291 it->parent->item->gy = 0;
1344 } 1292 }
1345 it->parent->group_realized = EINA_TRUE; 1293 it->parent->item->group_realized = EINA_TRUE;
1346 } 1294 }
1347 } 1295 }
1348 if (it->wd->reorder_mode) 1296 if (it->wd->reorder_mode)
1349 { 1297 {
1350 if (it->wd->reorder_item) 1298 if (it->wd->reorder_it)
1351 { 1299 {
1352 if (it->moving) return; 1300 if (it->item->moving) return;
1353 1301
1354 if (!it->wd->move_effect_enabled) 1302 if (!it->wd->move_effect_enabled)
1355 { 1303 {
1356 it->ox = x; 1304 it->item->ox = x;
1357 it->oy = y; 1305 it->item->oy = y;
1358 } 1306 }
1359 if (it->wd->reorder_item == it) 1307 if (it->wd->reorder_it == it)
1360 { 1308 {
1361 evas_object_move(VIEW(it), 1309 evas_object_move(VIEW(it),
1362 it->wd->reorder_item_x, it->wd->reorder_item_y); 1310 it->wd->reorder_item_x, it->wd->reorder_item_y);
@@ -1367,19 +1315,19 @@ _item_place(Elm_Gengrid_Item *it,
1367 { 1315 {
1368 if (it->wd->move_effect_enabled) 1316 if (it->wd->move_effect_enabled)
1369 { 1317 {
1370 if ((it->ox != x) || (it->oy != y)) 1318 if ((it->item->ox != x) || (it->item->oy != y))
1371 { 1319 {
1372 if (((it->wd->old_pan_x == it->wd->pan_x) && (it->wd->old_pan_y == it->wd->pan_y)) || 1320 if (((it->wd->old_pan_x == it->wd->pan_x) && (it->wd->old_pan_y == it->wd->pan_y)) ||
1373 ((it->wd->old_pan_x != it->wd->pan_x) && !(it->ox - it->wd->pan_x + it->wd->old_pan_x == x)) || 1321 ((it->wd->old_pan_x != it->wd->pan_x) && !(it->item->ox - it->wd->pan_x + it->wd->old_pan_x == x)) ||
1374 ((it->wd->old_pan_y != it->wd->pan_y) && !(it->oy - it->wd->pan_y + it->wd->old_pan_y == y))) 1322 ((it->wd->old_pan_y != it->wd->pan_y) && !(it->item->oy - it->wd->pan_y + it->wd->old_pan_y == y)))
1375 { 1323 {
1376 it->tx = x; 1324 it->item->tx = x;
1377 it->ty = y; 1325 it->item->ty = y;
1378 it->rx = it->ox; 1326 it->item->rx = it->item->ox;
1379 it->ry = it->oy; 1327 it->item->ry = it->item->oy;
1380 it->moving = EINA_TRUE; 1328 it->item->moving = EINA_TRUE;
1381 it->moving_effect_start_time = ecore_loop_time_get(); 1329 it->item->moving_effect_start_time = ecore_loop_time_get();
1382 it->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it); 1330 it->item->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
1383 return; 1331 return;
1384 } 1332 }
1385 } 1333 }
@@ -1387,7 +1335,7 @@ _item_place(Elm_Gengrid_Item *it,
1387 1335
1388 /* need fix here */ 1336 /* need fix here */
1389 Evas_Coord nx, ny, nw, nh; 1337 Evas_Coord nx, ny, nw, nh;
1390 if (it->is_group) 1338 if (it->group)
1391 { 1339 {
1392 if (it->wd->horizontal) 1340 if (it->wd->horizontal)
1393 { 1341 {
@@ -1418,26 +1366,26 @@ _item_place(Elm_Gengrid_Item *it,
1418 { 1366 {
1419 if (it->wd->horizontal) 1367 if (it->wd->horizontal)
1420 { 1368 {
1421 if ((it->wd->nmax * it->wd->reorder_item->x + it->wd->reorder_item->y) > 1369 if ((it->wd->nmax * it->wd->reorder_it->x + it->wd->reorder_it->y) >
1422 (it->wd->nmax * it->x + it->y)) 1370 (it->wd->nmax * it->x + it->y))
1423 reorder_item_move_forward = EINA_TRUE; 1371 reorder_item_move_forward = EINA_TRUE;
1424 } 1372 }
1425 else 1373 else
1426 { 1374 {
1427 if ((it->wd->nmax * it->wd->reorder_item->y + it->wd->reorder_item->x) > 1375 if ((it->wd->nmax * it->wd->reorder_it->y + it->wd->reorder_it->x) >
1428 (it->wd->nmax * it->y + it->x)) 1376 (it->wd->nmax * it->y + it->x))
1429 reorder_item_move_forward = EINA_TRUE; 1377 reorder_item_move_forward = EINA_TRUE;
1430 } 1378 }
1431 1379
1432 it->wd->items = eina_inlist_remove(it->wd->items, 1380 it->wd->items = eina_inlist_remove(it->wd->items,
1433 EINA_INLIST_GET(it->wd->reorder_item)); 1381 EINA_INLIST_GET(it->wd->reorder_it));
1434 if (reorder_item_move_forward) 1382 if (reorder_item_move_forward)
1435 it->wd->items = eina_inlist_prepend_relative(it->wd->items, 1383 it->wd->items = eina_inlist_prepend_relative(it->wd->items,
1436 EINA_INLIST_GET(it->wd->reorder_item), 1384 EINA_INLIST_GET(it->wd->reorder_it),
1437 EINA_INLIST_GET(it)); 1385 EINA_INLIST_GET(it));
1438 else 1386 else
1439 it->wd->items = eina_inlist_append_relative(it->wd->items, 1387 it->wd->items = eina_inlist_append_relative(it->wd->items,
1440 EINA_INLIST_GET(it->wd->reorder_item), 1388 EINA_INLIST_GET(it->wd->reorder_it),
1441 EINA_INLIST_GET(it)); 1389 EINA_INLIST_GET(it));
1442 1390
1443 it->wd->reorder_item_changed = EINA_TRUE; 1391 it->wd->reorder_item_changed = EINA_TRUE;
@@ -1449,86 +1397,64 @@ _item_place(Elm_Gengrid_Item *it,
1449 } 1397 }
1450 } 1398 }
1451 } 1399 }
1452 else if (it->item_moving_effect_timer) 1400 else if (it->item->item_moving_effect_timer)
1453 { 1401 {
1454 ecore_animator_del(it->item_moving_effect_timer); 1402 ecore_animator_del(it->item->item_moving_effect_timer);
1455 it->item_moving_effect_timer = NULL; 1403 it->item->item_moving_effect_timer = NULL;
1456 it->moving = EINA_FALSE; 1404 it->item->moving = EINA_FALSE;
1457 } 1405 }
1458 } 1406 }
1459 if (!it->is_group) 1407 if (!it->group)
1460 { 1408 {
1461 evas_object_move(VIEW(it), x, y); 1409 evas_object_move(VIEW(it), x, y);
1462 evas_object_resize(VIEW(it), iw, ih); 1410 evas_object_resize(VIEW(it), iw, ih);
1463 } 1411 }
1464 else 1412 else
1465 it->group_realized = EINA_TRUE; 1413 it->item->group_realized = EINA_TRUE;
1466 } 1414 }
1467 else 1415 else
1468 { 1416 {
1469 if (!it->is_group) 1417 if (!it->group)
1470 _item_unrealize(it); 1418 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
1471 else 1419 else
1472 it->group_realized = EINA_FALSE; 1420 it->item->group_realized = EINA_FALSE;
1473 } 1421 }
1474} 1422}
1475 1423
1476static const char * 1424static Elm_Gen_Item *
1477_item_label_hook(Elm_Gengrid_Item *it, const char *part)
1478{
1479 if (!it->itc->func.label_get) return NULL;
1480 return edje_object_part_text_get(VIEW(it), part);
1481}
1482
1483static Elm_Gengrid_Item *
1484_item_new(Widget_Data *wd, 1425_item_new(Widget_Data *wd,
1485 const Elm_Gengrid_Item_Class *itc, 1426 const Elm_Gengrid_Item_Class *itc,
1486 const void *data, 1427 const void *data,
1487 Evas_Smart_Cb func, 1428 Evas_Smart_Cb func,
1488 const void *func_data) 1429 const void *func_data)
1489{ 1430{
1490 Elm_Gengrid_Item *it; 1431 Elm_Gen_Item *it;
1491 1432
1492 it = elm_widget_item_new(wd->self, Elm_Gengrid_Item); 1433 it = elm_gen_item_new(wd, itc, data, NULL, func, func_data);
1493 if (!it) return NULL; 1434 if (!it) return NULL;
1435 it->item = ELM_NEW(Elm_Gen_Item_Type);
1494 wd->count++; 1436 wd->count++;
1495 it->wd = wd; 1437 it->group = !strcmp(it->itc->item_style, "group_index");
1496 it->itc = itc;
1497 it->base.data = data;
1498 it->func.func = func;
1499 it->func.data = func_data;
1500 it->mouse_cursor = NULL;
1501 it->is_group = !strcmp(it->itc->item_style, "group_index");
1502 elm_widget_item_text_get_hook_set(it, _item_label_hook);
1503 1438
1504 return it; 1439 return it;
1505} 1440}
1506 1441
1507static void 1442static void
1508_item_del(Elm_Gengrid_Item *it) 1443_item_del(Elm_Gen_Item *it)
1509{ 1444{
1510 elm_widget_item_pre_notify_del(it); 1445 Evas_Object *obj = WIDGET(it);
1511 if (it->selected) 1446
1512 it->wd->selected = eina_list_remove(it->wd->selected, it); 1447 evas_event_freeze(evas_object_evas_get(obj));
1513 if (it->realized) _item_unrealize(it); 1448 it->wd->selected = eina_list_remove(it->wd->selected, it);
1514 if ((!it->delete_me) && (it->itc->func.del)) 1449 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
1515 it->itc->func.del((void *)it->base.data, it->wd->self);
1516 it->delete_me = EINA_TRUE;
1517 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
1518 if (it->long_timer) ecore_timer_del(it->long_timer);
1519 if (it->tooltip.del_cb)
1520 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
1521 it->wd->walking -= it->walking;
1522 it->wd->count--; 1450 it->wd->count--;
1523 if (it->is_group) 1451 elm_gen_item_del_serious(it, (Ecore_Cb)_calc_job);
1524 it->wd->group_items = eina_list_remove(it->wd->group_items, it); 1452 evas_event_thaw(evas_object_evas_get(obj));
1525 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); 1453 evas_event_thaw_eval(evas_object_evas_get(obj));
1526 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1527 elm_widget_item_del(it);
1528} 1454}
1529 1455
1530static void 1456static void
1531_item_select(Elm_Gengrid_Item *it) 1457_item_select(Elm_Gen_Item *it)
1532{ 1458{
1533 if ((it->wd->no_select) || (it->delete_me)) return; 1459 if ((it->wd->no_select) || (it->delete_me)) return;
1534 if (it->selected) 1460 if (it->selected)
@@ -1558,7 +1484,7 @@ call:
1558} 1484}
1559 1485
1560static void 1486static void
1561_item_unselect(Elm_Gengrid_Item *it) 1487_item_unselect(Elm_Gen_Item *it)
1562{ 1488{
1563 if ((it->delete_me) || (!it->highlighted)) return; 1489 if ((it->delete_me) || (!it->highlighted)) return;
1564 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm"); 1490 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
@@ -1576,7 +1502,7 @@ _calc_job(void *data)
1576{ 1502{
1577 Widget_Data *wd = data; 1503 Widget_Data *wd = data;
1578 Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh; 1504 Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh;
1579 Elm_Gengrid_Item *it, *group_item = NULL; 1505 Elm_Gen_Item *it, *group_item = NULL;
1580 int count_group = 0; 1506 int count_group = 0;
1581 long count = 0; 1507 long count = 0;
1582 wd->items_lost = 0; 1508 wd->items_lost = 0;
@@ -1594,9 +1520,9 @@ _calc_job(void *data)
1594 1520
1595 EINA_INLIST_FOREACH(wd->items, it) 1521 EINA_INLIST_FOREACH(wd->items, it)
1596 { 1522 {
1597 if (it->prev_group != count_group) 1523 if (it->item->prev_group != count_group)
1598 it->prev_group = count_group; 1524 it->item->prev_group = count_group;
1599 if (it->is_group) 1525 if (it->group)
1600 { 1526 {
1601 count = count % nmax; 1527 count = count % nmax;
1602 if (count) 1528 if (count)
@@ -1745,7 +1671,7 @@ _pan_calculate(Evas_Object *obj)
1745{ 1671{
1746 Pan *sd = evas_object_smart_data_get(obj); 1672 Pan *sd = evas_object_smart_data_get(obj);
1747 Evas_Coord cx = 0, cy = 0; 1673 Evas_Coord cx = 0, cy = 0;
1748 Elm_Gengrid_Item *it; 1674 Elm_Gen_Item *it;
1749 1675
1750 if (!sd) return; 1676 if (!sd) return;
1751 if (!sd->wd->nmax) return; 1677 if (!sd->wd->nmax) return;
@@ -1754,7 +1680,7 @@ _pan_calculate(Evas_Object *obj)
1754 1680
1755 EINA_INLIST_FOREACH(sd->wd->items, it) 1681 EINA_INLIST_FOREACH(sd->wd->items, it)
1756 { 1682 {
1757 if (it->is_group) 1683 if (it->group)
1758 { 1684 {
1759 if (sd->wd->horizontal) 1685 if (sd->wd->horizontal)
1760 { 1686 {
@@ -1775,7 +1701,7 @@ _pan_calculate(Evas_Object *obj)
1775 } 1701 }
1776 _item_place(it, cx, cy); 1702 _item_place(it, cx, cy);
1777 if (sd->wd->reorder_item_changed) return; 1703 if (sd->wd->reorder_item_changed) return;
1778 if (it->is_group) 1704 if (it->group)
1779 { 1705 {
1780 if (sd->wd->horizontal) 1706 if (sd->wd->horizontal)
1781 { 1707 {
@@ -1805,7 +1731,7 @@ _pan_calculate(Evas_Object *obj)
1805 _group_item_place(sd); 1731 _group_item_place(sd);
1806 1732
1807 1733
1808 if ((sd->wd->reorder_mode) && (sd->wd->reorder_item)) 1734 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
1809 { 1735 {
1810 if (!sd->wd->reorder_item_changed) 1736 if (!sd->wd->reorder_item_changed)
1811 { 1737 {
@@ -1947,8 +1873,8 @@ _scr_scroll(void *data,
1947static int 1873static int
1948_elm_gengrid_item_compare_data(const void *data, const void *data1) 1874_elm_gengrid_item_compare_data(const void *data, const void *data1)
1949{ 1875{
1950 const Elm_Gengrid_Item *it = data; 1876 const Elm_Gen_Item *it = data;
1951 const Elm_Gengrid_Item *item1 = data1; 1877 const Elm_Gen_Item *item1 = data1;
1952 1878
1953 return _elm_gengrid_item_compare_data_cb(it->base.data, item1->base.data); 1879 return _elm_gengrid_item_compare_data_cb(it->base.data, item1->base.data);
1954} 1880}
@@ -1956,7 +1882,7 @@ _elm_gengrid_item_compare_data(const void *data, const void *data1)
1956static int 1882static int
1957_elm_gengrid_item_compare(const void *data, const void *data1) 1883_elm_gengrid_item_compare(const void *data, const void *data1)
1958{ 1884{
1959 Elm_Gengrid_Item *it, *item1; 1885 Elm_Gen_Item *it, *item1;
1960 it = ELM_GENGRID_ITEM_FROM_INLIST(data); 1886 it = ELM_GENGRID_ITEM_FROM_INLIST(data);
1961 item1 = ELM_GENGRID_ITEM_FROM_INLIST(data1); 1887 item1 = ELM_GENGRID_ITEM_FROM_INLIST(data1);
1962 return _elm_gengrid_item_compare_cb(it, item1); 1888 return _elm_gengrid_item_compare_cb(it, item1);
@@ -2141,14 +2067,14 @@ elm_gengrid_align_get(const Evas_Object *obj,
2141 if (align_y) *align_y = wd->align_y; 2067 if (align_y) *align_y = wd->align_y;
2142} 2068}
2143 2069
2144EAPI Elm_Gengrid_Item * 2070EAPI Elm_Gen_Item *
2145elm_gengrid_item_append(Evas_Object *obj, 2071elm_gengrid_item_append(Evas_Object *obj,
2146 const Elm_Gengrid_Item_Class *itc, 2072 const Elm_Gengrid_Item_Class *itc,
2147 const void *data, 2073 const void *data,
2148 Evas_Smart_Cb func, 2074 Evas_Smart_Cb func,
2149 const void *func_data) 2075 const void *func_data)
2150{ 2076{
2151 Elm_Gengrid_Item *it; 2077 Elm_Gen_Item *it;
2152 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 2078 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2153 Widget_Data *wd = elm_widget_data_get(obj); 2079 Widget_Data *wd = elm_widget_data_get(obj);
2154 if (!wd) return NULL; 2080 if (!wd) return NULL;
@@ -2157,7 +2083,7 @@ elm_gengrid_item_append(Evas_Object *obj,
2157 if (!it) return NULL; 2083 if (!it) return NULL;
2158 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it)); 2084 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
2159 2085
2160 if (it->is_group) 2086 if (it->group)
2161 wd->group_items = eina_list_prepend(wd->group_items, it); 2087 wd->group_items = eina_list_prepend(wd->group_items, it);
2162 2088
2163 if (wd->calc_job) ecore_job_del(wd->calc_job); 2089 if (wd->calc_job) ecore_job_del(wd->calc_job);
@@ -2166,14 +2092,14 @@ elm_gengrid_item_append(Evas_Object *obj,
2166 return it; 2092 return it;
2167} 2093}
2168 2094
2169EAPI Elm_Gengrid_Item * 2095EAPI Elm_Gen_Item *
2170elm_gengrid_item_prepend(Evas_Object *obj, 2096elm_gengrid_item_prepend(Evas_Object *obj,
2171 const Elm_Gengrid_Item_Class *itc, 2097 const Elm_Gengrid_Item_Class *itc,
2172 const void *data, 2098 const void *data,
2173 Evas_Smart_Cb func, 2099 Evas_Smart_Cb func,
2174 const void *func_data) 2100 const void *func_data)
2175{ 2101{
2176 Elm_Gengrid_Item *it; 2102 Elm_Gen_Item *it;
2177 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 2103 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2178 Widget_Data *wd = elm_widget_data_get(obj); 2104 Widget_Data *wd = elm_widget_data_get(obj);
2179 if (!wd) return NULL; 2105 if (!wd) return NULL;
@@ -2181,7 +2107,7 @@ elm_gengrid_item_prepend(Evas_Object *obj,
2181 it = _item_new(wd, itc, data, func, func_data); 2107 it = _item_new(wd, itc, data, func, func_data);
2182 if (!it) return NULL; 2108 if (!it) return NULL;
2183 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it)); 2109 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
2184 if (it->is_group) 2110 if (it->group)
2185 wd->group_items = eina_list_append(wd->group_items, it); 2111 wd->group_items = eina_list_append(wd->group_items, it);
2186 2112
2187 if (wd->calc_job) ecore_job_del(wd->calc_job); 2113 if (wd->calc_job) ecore_job_del(wd->calc_job);
@@ -2190,15 +2116,15 @@ elm_gengrid_item_prepend(Evas_Object *obj,
2190 return it; 2116 return it;
2191} 2117}
2192 2118
2193EAPI Elm_Gengrid_Item * 2119EAPI Elm_Gen_Item *
2194elm_gengrid_item_insert_before(Evas_Object *obj, 2120elm_gengrid_item_insert_before(Evas_Object *obj,
2195 const Elm_Gengrid_Item_Class *itc, 2121 const Elm_Gengrid_Item_Class *itc,
2196 const void *data, 2122 const void *data,
2197 Elm_Gengrid_Item *relative, 2123 Elm_Gen_Item *relative,
2198 Evas_Smart_Cb func, 2124 Evas_Smart_Cb func,
2199 const void *func_data) 2125 const void *func_data)
2200{ 2126{
2201 Elm_Gengrid_Item *it; 2127 Elm_Gen_Item *it;
2202 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 2128 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2203 EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL); 2129 EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL);
2204 Widget_Data *wd = elm_widget_data_get(obj); 2130 Widget_Data *wd = elm_widget_data_get(obj);
@@ -2208,7 +2134,7 @@ elm_gengrid_item_insert_before(Evas_Object *obj,
2208 if (!it) return NULL; 2134 if (!it) return NULL;
2209 wd->items = eina_inlist_prepend_relative 2135 wd->items = eina_inlist_prepend_relative
2210 (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(relative)); 2136 (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(relative));
2211 if (it->is_group) 2137 if (it->group)
2212 wd->group_items = eina_list_append_relative(wd->group_items, it, relative->parent); 2138 wd->group_items = eina_list_append_relative(wd->group_items, it, relative->parent);
2213 2139
2214 if (wd->calc_job) ecore_job_del(wd->calc_job); 2140 if (wd->calc_job) ecore_job_del(wd->calc_job);
@@ -2217,15 +2143,15 @@ elm_gengrid_item_insert_before(Evas_Object *obj,
2217 return it; 2143 return it;
2218} 2144}
2219 2145
2220EAPI Elm_Gengrid_Item * 2146EAPI Elm_Gen_Item *
2221elm_gengrid_item_insert_after(Evas_Object *obj, 2147elm_gengrid_item_insert_after(Evas_Object *obj,
2222 const Elm_Gengrid_Item_Class *itc, 2148 const Elm_Gengrid_Item_Class *itc,
2223 const void *data, 2149 const void *data,
2224 Elm_Gengrid_Item *relative, 2150 Elm_Gen_Item *relative,
2225 Evas_Smart_Cb func, 2151 Evas_Smart_Cb func,
2226 const void *func_data) 2152 const void *func_data)
2227{ 2153{
2228 Elm_Gengrid_Item *it; 2154 Elm_Gen_Item *it;
2229 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 2155 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2230 EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL); 2156 EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL);
2231 Widget_Data *wd = elm_widget_data_get(obj); 2157 Widget_Data *wd = elm_widget_data_get(obj);
@@ -2235,7 +2161,7 @@ elm_gengrid_item_insert_after(Evas_Object *obj,
2235 if (!it) return NULL; 2161 if (!it) return NULL;
2236 wd->items = eina_inlist_append_relative 2162 wd->items = eina_inlist_append_relative
2237 (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(relative)); 2163 (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(relative));
2238 if (it->is_group) 2164 if (it->group)
2239 wd->group_items = eina_list_prepend_relative(wd->group_items, it, relative->parent); 2165 wd->group_items = eina_list_prepend_relative(wd->group_items, it, relative->parent);
2240 2166
2241 if (wd->calc_job) ecore_job_del(wd->calc_job); 2167 if (wd->calc_job) ecore_job_del(wd->calc_job);
@@ -2244,7 +2170,7 @@ elm_gengrid_item_insert_after(Evas_Object *obj,
2244 return it; 2170 return it;
2245} 2171}
2246 2172
2247EAPI Elm_Gengrid_Item * 2173EAPI Elm_Gen_Item *
2248elm_gengrid_item_direct_sorted_insert(Evas_Object *obj, 2174elm_gengrid_item_direct_sorted_insert(Evas_Object *obj,
2249 const Elm_Gengrid_Item_Class *itc, 2175 const Elm_Gengrid_Item_Class *itc,
2250 const void *data, 2176 const void *data,
@@ -2252,7 +2178,7 @@ elm_gengrid_item_direct_sorted_insert(Evas_Object *obj,
2252 Evas_Smart_Cb func, 2178 Evas_Smart_Cb func,
2253 const void *func_data) 2179 const void *func_data)
2254{ 2180{
2255 Elm_Gengrid_Item *it; 2181 Elm_Gen_Item *it;
2256 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 2182 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2257 Widget_Data *wd = elm_widget_data_get(obj); 2183 Widget_Data *wd = elm_widget_data_get(obj);
2258 if (!wd) return NULL; 2184 if (!wd) return NULL;
@@ -2272,7 +2198,7 @@ elm_gengrid_item_direct_sorted_insert(Evas_Object *obj,
2272 return it; 2198 return it;
2273} 2199}
2274 2200
2275EAPI Elm_Gengrid_Item * 2201EAPI Elm_Gen_Item *
2276elm_gengrid_item_sorted_insert(Evas_Object *obj, 2202elm_gengrid_item_sorted_insert(Evas_Object *obj,
2277 const Elm_Gengrid_Item_Class *itc, 2203 const Elm_Gengrid_Item_Class *itc,
2278 const void *data, 2204 const void *data,
@@ -2286,17 +2212,12 @@ elm_gengrid_item_sorted_insert(Evas_Object *obj,
2286} 2212}
2287 2213
2288EAPI void 2214EAPI void
2289elm_gengrid_item_del(Elm_Gengrid_Item *it) 2215elm_gengrid_item_del(Elm_Gen_Item *it)
2290{ 2216{
2291 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2217 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2292 if ((it->relcount > 0) || (it->walking > 0)) 2218 if ((it->relcount > 0) || (it->walking > 0))
2293 { 2219 {
2294 it->delete_me = EINA_TRUE; 2220 elm_gen_item_del_notserious(it);
2295 elm_widget_item_pre_notify_del(it);
2296 if (it->selected)
2297 it->wd->selected = eina_list_remove(it->wd->selected, it);
2298 if (it->itc->func.del)
2299 it->itc->func.del((void *)it->base.data, it->wd->self);
2300 return; 2221 return;
2301 } 2222 }
2302 2223
@@ -2347,7 +2268,7 @@ elm_gengrid_clear(Evas_Object *obj)
2347 2268
2348 if (wd->walking > 0) 2269 if (wd->walking > 0)
2349 { 2270 {
2350 Elm_Gengrid_Item *it; 2271 Elm_Gen_Item *it;
2351 wd->clear_me = 1; 2272 wd->clear_me = 1;
2352 EINA_INLIST_FOREACH(wd->items, it) 2273 EINA_INLIST_FOREACH(wd->items, it)
2353 it->delete_me = 1; 2274 it->delete_me = 1;
@@ -2356,14 +2277,15 @@ elm_gengrid_clear(Evas_Object *obj)
2356 wd->clear_me = 0; 2277 wd->clear_me = 0;
2357 while (wd->items) 2278 while (wd->items)
2358 { 2279 {
2359 Elm_Gengrid_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items); 2280 Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
2360 2281
2361 wd->items = eina_inlist_remove(wd->items, wd->items); 2282 wd->items = eina_inlist_remove(wd->items, wd->items);
2362 elm_widget_item_pre_notify_del(it); 2283 elm_widget_item_pre_notify_del(it);
2363 if (it->realized) _item_unrealize(it); 2284 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
2364 if (it->itc->func.del) 2285 if (it->itc->func.del)
2365 it->itc->func.del((void *)it->base.data, wd->self); 2286 it->itc->func.del((void *)it->base.data, wd->self);
2366 if (it->long_timer) ecore_timer_del(it->long_timer); 2287 if (it->long_timer) ecore_timer_del(it->long_timer);
2288 free(it->item);
2367 elm_widget_item_del(it); 2289 elm_widget_item_del(it);
2368 } 2290 }
2369 2291
@@ -2383,32 +2305,32 @@ elm_gengrid_clear(Evas_Object *obj)
2383} 2305}
2384 2306
2385EAPI const Evas_Object * 2307EAPI const Evas_Object *
2386elm_gengrid_item_object_get(const Elm_Gengrid_Item *it) 2308elm_gengrid_item_object_get(const Elm_Gen_Item *it)
2387{ 2309{
2388 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2310 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2389 return VIEW(it); 2311 return VIEW(it);
2390} 2312}
2391 2313
2392EAPI void 2314EAPI void
2393elm_gengrid_item_update(Elm_Gengrid_Item *it) 2315elm_gengrid_item_update(Elm_Gen_Item *it)
2394{ 2316{
2395 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2317 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2396 if (!it->realized) return; 2318 if (!it->realized) return;
2397 if (it->want_unrealize) return; 2319 if (it->want_unrealize) return;
2398 _item_unrealize(it); 2320 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
2399 _item_realize(it); 2321 _item_realize(it);
2400 _item_place(it, it->x, it->y); 2322 _item_place(it, it->x, it->y);
2401} 2323}
2402 2324
2403EAPI void * 2325EAPI void *
2404elm_gengrid_item_data_get(const Elm_Gengrid_Item *it) 2326elm_gengrid_item_data_get(const Elm_Gen_Item *it)
2405{ 2327{
2406 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2328 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2407 return elm_widget_item_data_get(it); 2329 return elm_widget_item_data_get(it);
2408} 2330}
2409 2331
2410EAPI void 2332EAPI void
2411elm_gengrid_item_data_set(Elm_Gengrid_Item *it, 2333elm_gengrid_item_data_set(Elm_Gen_Item *it,
2412 const void *data) 2334 const void *data)
2413{ 2335{
2414 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2336 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2416,7 +2338,7 @@ elm_gengrid_item_data_set(Elm_Gengrid_Item *it,
2416} 2338}
2417 2339
2418EAPI const Elm_Gengrid_Item_Class * 2340EAPI const Elm_Gengrid_Item_Class *
2419elm_gengrid_item_item_class_get(const Elm_Gengrid_Item *it) 2341elm_gengrid_item_item_class_get(const Elm_Gen_Item *it)
2420{ 2342{
2421 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2343 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2422 if (it->delete_me) return NULL; 2344 if (it->delete_me) return NULL;
@@ -2424,7 +2346,7 @@ elm_gengrid_item_item_class_get(const Elm_Gengrid_Item *it)
2424} 2346}
2425 2347
2426EAPI void 2348EAPI void
2427elm_gengrid_item_item_class_set(Elm_Gengrid_Item *it, 2349elm_gengrid_item_item_class_set(Elm_Gen_Item *it,
2428 const Elm_Gengrid_Item_Class *itc) 2350 const Elm_Gengrid_Item_Class *itc)
2429{ 2351{
2430 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2352 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2435,7 +2357,7 @@ elm_gengrid_item_item_class_set(Elm_Gengrid_Item *it,
2435} 2357}
2436 2358
2437EAPI void 2359EAPI void
2438elm_gengrid_item_pos_get(const Elm_Gengrid_Item *it, 2360elm_gengrid_item_pos_get(const Elm_Gen_Item *it,
2439 unsigned int *x, 2361 unsigned int *x,
2440 unsigned int *y) 2362 unsigned int *y)
2441{ 2363{
@@ -2463,7 +2385,7 @@ elm_gengrid_multi_select_get(const Evas_Object *obj)
2463 return wd->multi; 2385 return wd->multi;
2464} 2386}
2465 2387
2466EAPI Elm_Gengrid_Item * 2388EAPI Elm_Gen_Item *
2467elm_gengrid_selected_item_get(const Evas_Object *obj) 2389elm_gengrid_selected_item_get(const Evas_Object *obj)
2468{ 2390{
2469 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 2391 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
@@ -2483,7 +2405,7 @@ elm_gengrid_selected_items_get(const Evas_Object *obj)
2483} 2405}
2484 2406
2485EAPI void 2407EAPI void
2486elm_gengrid_item_selected_set(Elm_Gengrid_Item *it, 2408elm_gengrid_item_selected_set(Elm_Gen_Item *it,
2487 Eina_Bool selected) 2409 Eina_Bool selected)
2488{ 2410{
2489 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2411 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2508,14 +2430,14 @@ elm_gengrid_item_selected_set(Elm_Gengrid_Item *it,
2508} 2430}
2509 2431
2510EAPI Eina_Bool 2432EAPI Eina_Bool
2511elm_gengrid_item_selected_get(const Elm_Gengrid_Item *it) 2433elm_gengrid_item_selected_get(const Elm_Gen_Item *it)
2512{ 2434{
2513 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE); 2435 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2514 return it->selected; 2436 return it->selected;
2515} 2437}
2516 2438
2517EAPI void 2439EAPI void
2518elm_gengrid_item_disabled_set(Elm_Gengrid_Item *it, 2440elm_gengrid_item_disabled_set(Elm_Gen_Item *it,
2519 Eina_Bool disabled) 2441 Eina_Bool disabled)
2520{ 2442{
2521 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2443 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2532,7 +2454,7 @@ elm_gengrid_item_disabled_set(Elm_Gengrid_Item *it,
2532} 2454}
2533 2455
2534EAPI Eina_Bool 2456EAPI Eina_Bool
2535elm_gengrid_item_disabled_get(const Elm_Gengrid_Item *it) 2457elm_gengrid_item_disabled_get(const Elm_Gen_Item *it)
2536{ 2458{
2537 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE); 2459 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2538 if (it->delete_me) return EINA_FALSE; 2460 if (it->delete_me) return EINA_FALSE;
@@ -2562,7 +2484,7 @@ _elm_gengrid_item_label_del_cb(void *data,
2562} 2484}
2563 2485
2564EAPI void 2486EAPI void
2565elm_gengrid_item_tooltip_text_set(Elm_Gengrid_Item *it, 2487elm_gengrid_item_tooltip_text_set(Elm_Gen_Item *it,
2566 const char *text) 2488 const char *text)
2567{ 2489{
2568 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2490 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2573,7 +2495,7 @@ elm_gengrid_item_tooltip_text_set(Elm_Gengrid_Item *it,
2573} 2495}
2574 2496
2575EAPI void 2497EAPI void
2576elm_gengrid_item_tooltip_content_cb_set(Elm_Gengrid_Item *it, 2498elm_gengrid_item_tooltip_content_cb_set(Elm_Gen_Item *it,
2577 Elm_Tooltip_Item_Content_Cb func, 2499 Elm_Tooltip_Item_Content_Cb func,
2578 const void *data, 2500 const void *data,
2579 Evas_Smart_Cb del_cb) 2501 Evas_Smart_Cb del_cb)
@@ -2605,7 +2527,7 @@ error:
2605} 2527}
2606 2528
2607EAPI void 2529EAPI void
2608elm_gengrid_item_tooltip_unset(Elm_Gengrid_Item *it) 2530elm_gengrid_item_tooltip_unset(Elm_Gen_Item *it)
2609{ 2531{
2610 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2532 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2611 if ((VIEW(it)) && (it->tooltip.content_cb)) 2533 if ((VIEW(it)) && (it->tooltip.content_cb))
@@ -2622,7 +2544,7 @@ elm_gengrid_item_tooltip_unset(Elm_Gengrid_Item *it)
2622} 2544}
2623 2545
2624EAPI void 2546EAPI void
2625elm_gengrid_item_tooltip_style_set(Elm_Gengrid_Item *it, 2547elm_gengrid_item_tooltip_style_set(Elm_Gen_Item *it,
2626 const char *style) 2548 const char *style)
2627{ 2549{
2628 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2550 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2631,14 +2553,14 @@ elm_gengrid_item_tooltip_style_set(Elm_Gengrid_Item *it,
2631} 2553}
2632 2554
2633EAPI const char * 2555EAPI const char *
2634elm_gengrid_item_tooltip_style_get(const Elm_Gengrid_Item *it) 2556elm_gengrid_item_tooltip_style_get(const Elm_Gen_Item *it)
2635{ 2557{
2636 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2558 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2637 return it->tooltip.style; 2559 return it->tooltip.style;
2638} 2560}
2639 2561
2640EAPI Eina_Bool 2562EAPI Eina_Bool
2641elm_gengrid_item_tooltip_size_restrict_disable(Elm_Gengrid_Item *it, Eina_Bool disable) 2563elm_gengrid_item_tooltip_size_restrict_disable(Elm_Gen_Item *it, Eina_Bool disable)
2642{ 2564{
2643 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE); 2565 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2644 it->tooltip.free_size = disable; 2566 it->tooltip.free_size = disable;
@@ -2647,14 +2569,14 @@ elm_gengrid_item_tooltip_size_restrict_disable(Elm_Gengrid_Item *it, Eina_Bool d
2647} 2569}
2648 2570
2649EAPI Eina_Bool 2571EAPI Eina_Bool
2650elm_gengrid_item_tooltip_size_restrict_disabled_get(const Elm_Gengrid_Item *it) 2572elm_gengrid_item_tooltip_size_restrict_disabled_get(const Elm_Gen_Item *it)
2651{ 2573{
2652 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE); 2574 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2653 return it->tooltip.free_size; 2575 return it->tooltip.free_size;
2654} 2576}
2655 2577
2656EAPI void 2578EAPI void
2657elm_gengrid_item_cursor_set(Elm_Gengrid_Item *it, 2579elm_gengrid_item_cursor_set(Elm_Gen_Item *it,
2658 const char *cursor) 2580 const char *cursor)
2659{ 2581{
2660 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2582 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2663,14 +2585,14 @@ elm_gengrid_item_cursor_set(Elm_Gengrid_Item *it,
2663} 2585}
2664 2586
2665EAPI const char * 2587EAPI const char *
2666elm_gengrid_item_cursor_get(const Elm_Gengrid_Item *it) 2588elm_gengrid_item_cursor_get(const Elm_Gen_Item *it)
2667{ 2589{
2668 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2590 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2669 return elm_widget_item_cursor_get(it); 2591 return elm_widget_item_cursor_get(it);
2670} 2592}
2671 2593
2672EAPI void 2594EAPI void
2673elm_gengrid_item_cursor_unset(Elm_Gengrid_Item *it) 2595elm_gengrid_item_cursor_unset(Elm_Gen_Item *it)
2674{ 2596{
2675 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2597 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2676 if (!it->mouse_cursor) 2598 if (!it->mouse_cursor)
@@ -2684,7 +2606,7 @@ elm_gengrid_item_cursor_unset(Elm_Gengrid_Item *it)
2684} 2606}
2685 2607
2686EAPI void 2608EAPI void
2687elm_gengrid_item_cursor_style_set(Elm_Gengrid_Item *it, 2609elm_gengrid_item_cursor_style_set(Elm_Gen_Item *it,
2688 const char *style) 2610 const char *style)
2689{ 2611{
2690 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2612 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2692,14 +2614,14 @@ elm_gengrid_item_cursor_style_set(Elm_Gengrid_Item *it,
2692} 2614}
2693 2615
2694EAPI const char * 2616EAPI const char *
2695elm_gengrid_item_cursor_style_get(const Elm_Gengrid_Item *it) 2617elm_gengrid_item_cursor_style_get(const Elm_Gen_Item *it)
2696{ 2618{
2697 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2619 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2698 return elm_widget_item_cursor_style_get(it); 2620 return elm_widget_item_cursor_style_get(it);
2699} 2621}
2700 2622
2701EAPI void 2623EAPI void
2702elm_gengrid_item_cursor_engine_only_set(Elm_Gengrid_Item *it, 2624elm_gengrid_item_cursor_engine_only_set(Elm_Gen_Item *it,
2703 Eina_Bool engine_only) 2625 Eina_Bool engine_only)
2704{ 2626{
2705 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2627 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
@@ -2707,7 +2629,7 @@ elm_gengrid_item_cursor_engine_only_set(Elm_Gengrid_Item *it,
2707} 2629}
2708 2630
2709EAPI Eina_Bool 2631EAPI Eina_Bool
2710elm_gengrid_item_cursor_engine_only_get(const Elm_Gengrid_Item *it) 2632elm_gengrid_item_cursor_engine_only_get(const Elm_Gen_Item *it)
2711{ 2633{
2712 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE); 2634 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2713 return elm_widget_item_cursor_engine_only_get(it); 2635 return elm_widget_item_cursor_engine_only_get(it);
@@ -2878,34 +2800,34 @@ elm_gengrid_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenu
2878 elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber); 2800 elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber);
2879} 2801}
2880 2802
2881EAPI Elm_Gengrid_Item * 2803EAPI Elm_Gen_Item *
2882elm_gengrid_first_item_get(const Evas_Object *obj) 2804elm_gengrid_first_item_get(const Evas_Object *obj)
2883{ 2805{
2884 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 2806 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2885 Widget_Data *wd = elm_widget_data_get(obj); 2807 Widget_Data *wd = elm_widget_data_get(obj);
2886 if (!wd) return NULL; 2808 if (!wd) return NULL;
2887 if (!wd->items) return NULL; 2809 if (!wd->items) return NULL;
2888 Elm_Gengrid_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items); 2810 Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
2889 while ((it) && (it->delete_me)) 2811 while ((it) && (it->delete_me))
2890 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 2812 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
2891 return it; 2813 return it;
2892} 2814}
2893 2815
2894EAPI Elm_Gengrid_Item * 2816EAPI Elm_Gen_Item *
2895elm_gengrid_last_item_get(const Evas_Object *obj) 2817elm_gengrid_last_item_get(const Evas_Object *obj)
2896{ 2818{
2897 ELM_CHECK_WIDTYPE(obj, widtype) NULL; 2819 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2898 Widget_Data *wd = elm_widget_data_get(obj); 2820 Widget_Data *wd = elm_widget_data_get(obj);
2899 if (!wd) return NULL; 2821 if (!wd) return NULL;
2900 if (!wd->items) return NULL; 2822 if (!wd->items) return NULL;
2901 Elm_Gengrid_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last); 2823 Elm_Gen_Item *it = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
2902 while ((it) && (it->delete_me)) 2824 while ((it) && (it->delete_me))
2903 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 2825 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
2904 return it; 2826 return it;
2905} 2827}
2906 2828
2907EAPI Elm_Gengrid_Item * 2829EAPI Elm_Gen_Item *
2908elm_gengrid_item_next_get(const Elm_Gengrid_Item *it) 2830elm_gengrid_item_next_get(const Elm_Gen_Item *it)
2909{ 2831{
2910 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2832 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2911 while (it) 2833 while (it)
@@ -2913,11 +2835,11 @@ elm_gengrid_item_next_get(const Elm_Gengrid_Item *it)
2913 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); 2835 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
2914 if ((it) && (!it->delete_me)) break; 2836 if ((it) && (!it->delete_me)) break;
2915 } 2837 }
2916 return (Elm_Gengrid_Item *)it; 2838 return (Elm_Gen_Item *)it;
2917} 2839}
2918 2840
2919EAPI Elm_Gengrid_Item * 2841EAPI Elm_Gen_Item *
2920elm_gengrid_item_prev_get(const Elm_Gengrid_Item *it) 2842elm_gengrid_item_prev_get(const Elm_Gen_Item *it)
2921{ 2843{
2922 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2844 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2923 while (it) 2845 while (it)
@@ -2925,18 +2847,18 @@ elm_gengrid_item_prev_get(const Elm_Gengrid_Item *it)
2925 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 2847 it = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
2926 if ((it) && (!it->delete_me)) break; 2848 if ((it) && (!it->delete_me)) break;
2927 } 2849 }
2928 return (Elm_Gengrid_Item *)it; 2850 return (Elm_Gen_Item *)it;
2929} 2851}
2930 2852
2931EAPI Evas_Object * 2853EAPI Evas_Object *
2932elm_gengrid_item_gengrid_get(const Elm_Gengrid_Item *it) 2854elm_gengrid_item_gengrid_get(const Elm_Gen_Item *it)
2933{ 2855{
2934 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL); 2856 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2935 return WIDGET(it); 2857 return WIDGET(it);
2936} 2858}
2937 2859
2938EAPI void 2860EAPI void
2939elm_gengrid_item_show(Elm_Gengrid_Item *it) 2861elm_gengrid_item_show(Elm_Gen_Item *it)
2940{ 2862{
2941 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2863 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2942 Widget_Data *wd = elm_widget_data_get(it->wd->self); 2864 Widget_Data *wd = elm_widget_data_get(it->wd->self);
@@ -2948,20 +2870,20 @@ elm_gengrid_item_show(Elm_Gengrid_Item *it)
2948 2870
2949 if (wd->horizontal) 2871 if (wd->horizontal)
2950 elm_smart_scroller_region_bring_in(it->wd->scr, 2872 elm_smart_scroller_region_bring_in(it->wd->scr,
2951 ((it->x - it->prev_group) * wd->item_width) + (it->prev_group * it->wd->group_item_width) + minx, 2873 ((it->x - it->item->prev_group) * wd->item_width) + (it->item->prev_group * it->wd->group_item_width) + minx,
2952 it->y * wd->item_height + miny, 2874 it->y * wd->item_height + miny,
2953 it->wd->item_width, 2875 it->wd->item_width,
2954 it->wd->item_height); 2876 it->wd->item_height);
2955 else 2877 else
2956 elm_smart_scroller_region_bring_in(it->wd->scr, 2878 elm_smart_scroller_region_bring_in(it->wd->scr,
2957 it->x * wd->item_width + minx, 2879 it->x * wd->item_width + minx,
2958 ((it->y - it->prev_group)* wd->item_height) + (it->prev_group * it->wd->group_item_height) + miny, 2880 ((it->y - it->item->prev_group)* wd->item_height) + (it->item->prev_group * it->wd->group_item_height) + miny,
2959 it->wd->item_width, 2881 it->wd->item_width,
2960 it->wd->item_height); 2882 it->wd->item_height);
2961} 2883}
2962 2884
2963EAPI void 2885EAPI void
2964elm_gengrid_item_bring_in(Elm_Gengrid_Item *it) 2886elm_gengrid_item_bring_in(Elm_Gen_Item *it)
2965{ 2887{
2966 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it); 2888 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2967 if (it->delete_me) return; 2889 if (it->delete_me) return;
@@ -2973,14 +2895,14 @@ elm_gengrid_item_bring_in(Elm_Gengrid_Item *it)
2973 2895
2974 if (wd->horizontal) 2896 if (wd->horizontal)
2975 elm_smart_scroller_region_bring_in(it->wd->scr, 2897 elm_smart_scroller_region_bring_in(it->wd->scr,
2976 ((it->x - it->prev_group) * wd->item_width) + (it->prev_group * it->wd->group_item_width) + minx, 2898 ((it->x - it->item->prev_group) * wd->item_width) + (it->item->prev_group * it->wd->group_item_width) + minx,
2977 it->y * wd->item_height + miny, 2899 it->y * wd->item_height + miny,
2978 it->wd->item_width, 2900 it->wd->item_width,
2979 it->wd->item_height); 2901 it->wd->item_height);
2980 else 2902 else
2981 elm_smart_scroller_region_bring_in(it->wd->scr, 2903 elm_smart_scroller_region_bring_in(it->wd->scr,
2982 it->x * wd->item_width + minx, 2904 it->x * wd->item_width + minx,
2983 ((it->y - it->prev_group)* wd->item_height) + (it->prev_group * it->wd->group_item_height) + miny, 2905 ((it->y - it->item->prev_group)* wd->item_height) + (it->item->prev_group * it->wd->group_item_height) + miny,
2984 it->wd->item_width, 2906 it->wd->item_width,
2985 it->wd->item_height); 2907 it->wd->item_height);
2986} 2908}
diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c
index 53720f1370..6942f5cdaf 100644
--- a/legacy/elementary/src/lib/elm_genlist.c
+++ b/legacy/elementary/src/lib/elm_genlist.c
@@ -4,77 +4,40 @@
4#include <Elementary_Cursor.h> 4#include <Elementary_Cursor.h>
5#include "elm_priv.h" 5#include "elm_priv.h"
6#include "els_scroller.h" 6#include "els_scroller.h"
7#include "elm_gen.h"
7 8
8#define SWIPE_MOVES 12 9#define SWIPE_MOVES 12
9#define MAX_ITEMS_PER_BLOCK 32 10#define MAX_ITEMS_PER_BLOCK 32
10#define REORDER_EFFECT_TIME 0.5 11#define REORDER_EFFECT_TIME 0.5
11 12
12typedef struct _Widget_Data Widget_Data;
13typedef struct _Item_Block Item_Block; 13typedef struct _Item_Block Item_Block;
14typedef struct _Pan Pan; 14typedef struct _Pan Pan;
15typedef struct _Item_Cache Item_Cache; 15typedef struct _Item_Cache Item_Cache;
16 16
17struct _Elm_Genlist_Item 17struct Elm_Gen_Item_Type
18{ 18{
19 ELM_WIDGET_ITEM; 19 Elm_Gen_Item *it;
20 EINA_INLIST;
21 Widget_Data *wd;
22 const Elm_Genlist_Item_Class *itc;
23 Elm_Genlist_Item *parent;
24 Item_Block *block; 20 Item_Block *block;
25 Eina_List *items; 21 Eina_List *items;
26 Evas_Coord x, y, w, h, minw, minh; 22 Evas_Coord w, h, minw, minh;
27 Elm_Genlist_Item *group_item; 23 Elm_Gen_Item *group_item;
28 Elm_Genlist_Item_Flags flags; 24 Elm_Genlist_Item_Flags flags;
29 struct
30 {
31 Evas_Smart_Cb func;
32 const void *data;
33 } func;
34
35 Evas_Object *spacer;
36 Eina_List *labels, *icons, *states, *icon_objs;
37 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs; 25 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
38 Ecore_Timer *long_timer;
39 Ecore_Timer *swipe_timer; 26 Ecore_Timer *swipe_timer;
40 Evas_Coord dx, dy;
41 Evas_Coord scrl_x, scrl_y, old_scrl_y; 27 Evas_Coord scrl_x, scrl_y, old_scrl_y;
42 28
43 Elm_Genlist_Item *rel; 29 Elm_Gen_Item *rel;
44 Evas_Object *mode_view; 30 Evas_Object *mode_view;
45
46 struct
47 {
48 const void *data;
49 Elm_Tooltip_Item_Content_Cb content_cb;
50 Evas_Smart_Cb del_cb;
51 const char *style;
52 Eina_Bool free_size : 1;
53 } tooltip;
54
55 const char *mouse_cursor;
56
57 int relcount;
58 int walking;
59 int expanded_depth; 31 int expanded_depth;
60 int order_num_in; 32 int order_num_in;
61 33
62 Eina_Bool before : 1; 34 Eina_Bool before : 1;
63 35
64 Eina_Bool want_unrealize : 1;
65 Eina_Bool want_realize : 1; 36 Eina_Bool want_realize : 1;
66 Eina_Bool realized : 1;
67 Eina_Bool selected : 1;
68 Eina_Bool highlighted : 1;
69 Eina_Bool expanded : 1; 37 Eina_Bool expanded : 1;
70 Eina_Bool disabled : 1;
71 Eina_Bool display_only : 1;
72 Eina_Bool mincalcd : 1; 38 Eina_Bool mincalcd : 1;
73 Eina_Bool queued : 1; 39 Eina_Bool queued : 1;
74 Eina_Bool showme : 1; 40 Eina_Bool showme : 1;
75 Eina_Bool delete_me : 1;
76 Eina_Bool down : 1;
77 Eina_Bool dragging : 1;
78 Eina_Bool updateme : 1; 41 Eina_Bool updateme : 1;
79 Eina_Bool nocache : 1; 42 Eina_Bool nocache : 1;
80 Eina_Bool stacking_even : 1; 43 Eina_Bool stacking_even : 1;
@@ -86,20 +49,24 @@ struct _Widget_Data
86{ 49{
87 Eina_Inlist_Sorted_State *state; 50 Eina_Inlist_Sorted_State *state;
88 Evas_Object *obj; /* the genlist object */ 51 Evas_Object *obj; /* the genlist object */
52 Eina_List *selected;
53 Eina_List *group_items; /* list of groups index items */
54 Eina_Inlist *items; /* inlist of all items */
55 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
56 Ecore_Job *calc_job;
57 int walking;
58 ////////////////////////////////////
89 Evas_Object *scr; /* a smart scroller object which is used internally in genlist */ 59 Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
90 Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */ 60 Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
91 Eina_Inlist *items; /* inlist of all items */
92 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'. */ 61 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'. */
93 Eina_List *group_items; /* list of groups index items */
94 Pan *pan; /* pan_smart object's smart data */ 62 Pan *pan; /* pan_smart object's smart data */
95 Evas_Coord pan_x, pan_y, reorder_old_pan_y, w, h, minw, minh, realminw, prev_viewport_w; 63 Evas_Coord pan_x, pan_y, reorder_old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
96 Ecore_Job *calc_job, *update_job; 64 Ecore_Job *update_job;
97 Ecore_Idle_Enterer *queue_idle_enterer; 65 Ecore_Idle_Enterer *queue_idle_enterer;
98 Ecore_Idler *must_recalc_idler; 66 Ecore_Idler *must_recalc_idler;
99 Eina_List *queue, *selected; 67 Eina_List *queue;
100 Elm_Genlist_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item; 68 Elm_Gen_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item;
101 Elm_Genlist_Item *last_selected_item; /* the last selected it. */ 69 Elm_Gen_Item *last_selected_item; /* the last selected it. */
102 Elm_Genlist_Item *reorder_it; /* an it which is longpressed and in the moving state. */
103 Eina_Inlist *item_cache; /* an inlist of edje object it cache. */ 70 Eina_Inlist *item_cache; /* an inlist of edje object it cache. */
104 Evas_Coord anchor_y; 71 Evas_Coord anchor_y;
105 Evas_Coord reorder_start_y; /* reorder it's initial y coordinate in the pan. */ 72 Evas_Coord reorder_start_y; /* reorder it's initial y coordinate in the pan. */
@@ -139,7 +106,6 @@ struct _Widget_Data
139 int item_cache_count; 106 int item_cache_count;
140 int item_cache_max; /* maximum number of cached items */ 107 int item_cache_max; /* maximum number of cached items */
141 int movements; 108 int movements;
142 int walking;
143 int item_width; 109 int item_width;
144 int item_height; 110 int item_height;
145 int group_item_width; 111 int group_item_width;
@@ -172,16 +138,16 @@ struct _Item_Cache
172 Evas_Object *base_view, *spacer; 138 Evas_Object *base_view, *spacer;
173 139
174 const char *item_style; // it->itc->item_style 140 const char *item_style; // it->itc->item_style
175 Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS 141 Eina_Bool tree : 1; // it->group
176 Eina_Bool compress : 1; // it->wd->compress 142 Eina_Bool compress : 1; // it->wd->compress
177 143
178 Eina_Bool selected : 1; // it->selected 144 Eina_Bool selected : 1; // it->selected
179 Eina_Bool disabled : 1; // it->disabled 145 Eina_Bool disabled : 1; // it->disabled
180 Eina_Bool expanded : 1; // it->expanded 146 Eina_Bool expanded : 1; // it->item->expanded
181}; 147};
182 148
183#define ELM_GENLIST_ITEM_FROM_INLIST(it) \ 149#define ELM_GENLIST_ITEM_FROM_INLIST(it) \
184 ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Genlist_Item) : NULL) 150 ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
185 151
186struct _Pan 152struct _Pan
187{ 153{
@@ -199,11 +165,10 @@ static void _theme_hook(Evas_Object *obj);
199static void _show_region_hook(void *data, 165static void _show_region_hook(void *data,
200 Evas_Object *obj); 166 Evas_Object *obj);
201static void _sizing_eval(Evas_Object *obj); 167static void _sizing_eval(Evas_Object *obj);
202static void _item_realize(Elm_Genlist_Item *it, 168static void _item_realize(Elm_Gen_Item *it,
203 int in, 169 int in,
204 Eina_Bool calc); 170 Eina_Bool calc);
205static void _item_unrealize(Elm_Genlist_Item *it, 171static void _item_unrealize_cb(Elm_Gen_Item *it);
206 Eina_Bool calc);
207static void _item_block_unrealize(Item_Block *itb); 172static void _item_block_unrealize(Item_Block *itb);
208static void _calc_job(void *data); 173static void _calc_job(void *data);
209static void _on_focus_hook(void *data, 174static void _on_focus_hook(void *data,
@@ -224,19 +189,19 @@ static void _pan_calculate(Evas_Object *obj);
224static void _pan_max_get(Evas_Object *obj, 189static void _pan_max_get(Evas_Object *obj,
225 Evas_Coord *x, 190 Evas_Coord *x,
226 Evas_Coord *y); 191 Evas_Coord *y);
227static void _item_position(Elm_Genlist_Item *it, 192static void _item_position(Elm_Gen_Item *it,
228 Evas_Object *obj, 193 Evas_Object *obj,
229 Evas_Coord it_x, 194 Evas_Coord it_x,
230 Evas_Coord it_y); 195 Evas_Coord it_y);
231static void _mode_item_realize(Elm_Genlist_Item *it); 196static void _mode_item_realize(Elm_Gen_Item *it);
232static void _mode_item_unrealize(Elm_Genlist_Item *it); 197static void _mode_item_unrealize(Elm_Gen_Item *it);
233static void _item_mode_set(Elm_Genlist_Item *it); 198static void _item_mode_set(Elm_Gen_Item *it);
234static void _item_mode_unset(Widget_Data *wd); 199static void _item_mode_unset(Widget_Data *wd);
235static void _group_items_recalc(void *data); 200static void _group_items_recalc(void *data);
236static void _item_move_after(Elm_Genlist_Item *it, 201static void _item_move_after(Elm_Gen_Item *it,
237 Elm_Genlist_Item *after); 202 Elm_Gen_Item *after);
238static void _item_move_before(Elm_Genlist_Item *it, 203static void _item_move_before(Elm_Gen_Item *it,
239 Elm_Genlist_Item *before); 204 Elm_Gen_Item *before);
240static void _item_auto_scroll(Widget_Data *wd); 205static void _item_auto_scroll(Widget_Data *wd);
241 206
242static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION; 207static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
@@ -262,10 +227,10 @@ static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
262static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop"; 227static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
263static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start"; 228static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
264static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop"; 229static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
265static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this 230static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this
266static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this 231static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this
267static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this 232static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this
268static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this 233static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this
269static const char SIG_EDGE_TOP[] = "edge,top"; 234static const char SIG_EDGE_TOP[] = "edge,top";
270static const char SIG_EDGE_BOTTOM[] = "edge,bottom"; 235static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
271static const char SIG_EDGE_LEFT[] = "edge,left"; 236static const char SIG_EDGE_LEFT[] = "edge,left";
@@ -338,7 +303,7 @@ _event_hook(Evas_Object *obj,
338 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; 303 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
339 if (elm_widget_disabled_get(obj)) return EINA_FALSE; 304 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
340 305
341 Elm_Genlist_Item *it = NULL; 306 Elm_Gen_Item *it = NULL;
342 Evas_Coord x = 0; 307 Evas_Coord x = 0;
343 Evas_Coord y = 0; 308 Evas_Coord y = 0;
344 Evas_Coord step_x = 0; 309 Evas_Coord step_x = 0;
@@ -457,7 +422,7 @@ _item_multi_select_up(Widget_Data *wd)
457 if (!wd->selected) return EINA_FALSE; 422 if (!wd->selected) return EINA_FALSE;
458 if (!wd->multi) return EINA_FALSE; 423 if (!wd->multi) return EINA_FALSE;
459 424
460 Elm_Genlist_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item); 425 Elm_Gen_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
461 if (!prev) return EINA_TRUE; 426 if (!prev) return EINA_TRUE;
462 427
463 if (elm_genlist_item_selected_get(prev)) 428 if (elm_genlist_item_selected_get(prev))
@@ -480,7 +445,7 @@ _item_multi_select_down(Widget_Data *wd)
480 if (!wd->selected) return EINA_FALSE; 445 if (!wd->selected) return EINA_FALSE;
481 if (!wd->multi) return EINA_FALSE; 446 if (!wd->multi) return EINA_FALSE;
482 447
483 Elm_Genlist_Item *next = elm_genlist_item_next_get(wd->last_selected_item); 448 Elm_Gen_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
484 if (!next) return EINA_TRUE; 449 if (!next) return EINA_TRUE;
485 450
486 if (elm_genlist_item_selected_get(next)) 451 if (elm_genlist_item_selected_get(next))
@@ -500,7 +465,7 @@ _item_multi_select_down(Widget_Data *wd)
500static Eina_Bool 465static Eina_Bool
501_item_single_select_up(Widget_Data *wd) 466_item_single_select_up(Widget_Data *wd)
502{ 467{
503 Elm_Genlist_Item *prev; 468 Elm_Gen_Item *prev;
504 if (!wd->selected) 469 if (!wd->selected)
505 { 470 {
506 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last); 471 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
@@ -521,7 +486,7 @@ _item_single_select_up(Widget_Data *wd)
521static Eina_Bool 486static Eina_Bool
522_item_single_select_down(Widget_Data *wd) 487_item_single_select_down(Widget_Data *wd)
523{ 488{
524 Elm_Genlist_Item *next; 489 Elm_Gen_Item *next;
525 if (!wd->selected) 490 if (!wd->selected)
526 { 491 {
527 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items); 492 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
@@ -614,11 +579,11 @@ _theme_hook(Evas_Object *obj)
614 EINA_INLIST_FOREACH(wd->blocks, itb) 579 EINA_INLIST_FOREACH(wd->blocks, itb)
615 { 580 {
616 Eina_List *l; 581 Eina_List *l;
617 Elm_Genlist_Item *it; 582 Elm_Gen_Item *it;
618 583
619 if (itb->realized) _item_block_unrealize(itb); 584 if (itb->realized) _item_block_unrealize(itb);
620 EINA_LIST_FOREACH(itb->items, l, it) 585 EINA_LIST_FOREACH(itb->items, l, it)
621 it->mincalcd = EINA_FALSE; 586 it->item->mincalcd = EINA_FALSE;
622 587
623 itb->changed = EINA_TRUE; 588 itb->changed = EINA_TRUE;
624 } 589 }
@@ -714,44 +679,44 @@ _signal_emit_hook(Evas_Object *obj,
714} 679}
715 680
716static void 681static void
717_item_highlight(Elm_Genlist_Item *it) 682_item_highlight(Elm_Gen_Item *it)
718{ 683{
719 const char *selectraise; 684 const char *selectraise;
720 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) || 685 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
721 (it->disabled) || (it->display_only) || (it->mode_view)) 686 (it->disabled) || (it->display_only) || (it->item->mode_view))
722 return; 687 return;
723 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm"); 688 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
724 selectraise = edje_object_data_get(VIEW(it), "selectraise"); 689 selectraise = edje_object_data_get(VIEW(it), "selectraise");
725 if ((selectraise) && (!strcmp(selectraise, "on"))) 690 if ((selectraise) && (!strcmp(selectraise, "on")))
726 { 691 {
727 evas_object_raise(VIEW(it)); 692 evas_object_raise(VIEW(it));
728 if ((it->group_item) && (it->group_item->realized)) 693 if ((it->item->group_item) && (it->item->group_item->realized))
729 evas_object_raise(it->VIEW(group_item)); 694 evas_object_raise(it->item->VIEW(group_item));
730 } 695 }
731 it->highlighted = EINA_TRUE; 696 it->highlighted = EINA_TRUE;
732} 697}
733 698
734static void 699static void
735_item_unhighlight(Elm_Genlist_Item *it) 700_item_unhighlight(Elm_Gen_Item *it)
736{ 701{
737 const char *stacking, *selectraise; 702 const char *stacking, *selectraise;
738 if ((it->delete_me) || (!it->highlighted)) return; 703 if ((it->delete_me) || (!it->highlighted)) return;
739 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm"); 704 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
740 stacking = edje_object_data_get(VIEW(it), "stacking"); 705 stacking = edje_object_data_get(VIEW(it), "stacking");
741 selectraise = edje_object_data_get(VIEW(it), "selectraise"); 706 selectraise = edje_object_data_get(VIEW(it), "selectraise");
742 if (!it->nostacking) 707 if (!it->item->nostacking)
743 { 708 {
744 if ((it->order_num_in & 0x1) ^ it->stacking_even) evas_object_lower(VIEW(it)); 709 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) evas_object_lower(VIEW(it));
745 else evas_object_raise(VIEW(it)); 710 else evas_object_raise(VIEW(it));
746 } 711 }
747 it->highlighted = EINA_FALSE; 712 it->highlighted = EINA_FALSE;
748} 713}
749 714
750static void 715static void
751_item_block_del(Elm_Genlist_Item *it) 716_item_block_del(Elm_Gen_Item *it)
752{ 717{
753 Eina_Inlist *il; 718 Eina_Inlist *il;
754 Item_Block *itb = it->block; 719 Item_Block *itb = it->item->block;
755 720
756 itb->items = eina_list_remove(itb->items, it); 721 itb->items = eina_list_remove(itb->items, it);
757 itb->count--; 722 itb->count--;
@@ -763,7 +728,7 @@ _item_block_del(Elm_Genlist_Item *it)
763 il = EINA_INLIST_GET(itb); 728 il = EINA_INLIST_GET(itb);
764 Item_Block *itbn = (Item_Block *)(il->next); 729 Item_Block *itbn = (Item_Block *)(il->next);
765 if (it->parent) 730 if (it->parent)
766 it->parent->items = eina_list_remove(it->parent->items, it); 731 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
767 else 732 else
768 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il); 733 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
769 free(itb); 734 free(itb);
@@ -778,11 +743,11 @@ _item_block_del(Elm_Genlist_Item *it)
778 Item_Block *itbn = (Item_Block *)(il->next); 743 Item_Block *itbn = (Item_Block *)(il->next);
779 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2)) 744 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
780 { 745 {
781 Elm_Genlist_Item *it2; 746 Elm_Gen_Item *it2;
782 747
783 EINA_LIST_FREE(itb->items, it2) 748 EINA_LIST_FREE(itb->items, it2)
784 { 749 {
785 it2->block = itbp; 750 it2->item->block = itbp;
786 itbp->items = eina_list_append(itbp->items, it2); 751 itbp->items = eina_list_append(itbp->items, it2);
787 itbp->count++; 752 itbp->count++;
788 itbp->changed = EINA_TRUE; 753 itbp->changed = EINA_TRUE;
@@ -796,9 +761,9 @@ _item_block_del(Elm_Genlist_Item *it)
796 while (itb->items) 761 while (itb->items)
797 { 762 {
798 Eina_List *last = eina_list_last(itb->items); 763 Eina_List *last = eina_list_last(itb->items);
799 Elm_Genlist_Item *it2 = last->data; 764 Elm_Gen_Item *it2 = last->data;
800 765
801 it2->block = itbn; 766 it2->item->block = itbn;
802 itb->items = eina_list_remove_list(itb->items, last); 767 itb->items = eina_list_remove_list(itb->items, last);
803 itbn->items = eina_list_prepend(itbn->items, it2); 768 itbn->items = eina_list_prepend(itbn->items, it2);
804 itbn->count++; 769 itbn->count++;
@@ -813,22 +778,16 @@ _item_block_del(Elm_Genlist_Item *it)
813} 778}
814 779
815static void 780static void
816_item_del(Elm_Genlist_Item *it) 781_item_del(Elm_Gen_Item *it)
817{ 782{
818 Evas_Object *tob = it->wd->obj; 783 Evas_Object *obj = WIDGET(it);
819 784
820 evas_event_freeze(evas_object_evas_get(tob)); 785 evas_event_freeze(evas_object_evas_get(obj));
821 elm_widget_item_pre_notify_del(it);
822 elm_genlist_item_subitems_clear(it); 786 elm_genlist_item_subitems_clear(it);
823 it->wd->walking -= it->walking;
824 if (it->wd->show_item == it) it->wd->show_item = NULL; 787 if (it->wd->show_item == it) it->wd->show_item = NULL;
825 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it); 788 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
826 if (it->realized) _item_unrealize(it, EINA_FALSE); 789 if (it->item->block) _item_block_del(it);
827 if (it->block) _item_block_del(it); 790 if (it->item->queued)
828 if ((!it->delete_me) && (it->itc->func.del))
829 it->itc->func.del((void *)it->base.data, WIDGET(it));
830 it->delete_me = EINA_TRUE;
831 if (it->queued)
832 it->wd->queue = eina_list_remove(it->wd->queue, it); 791 it->wd->queue = eina_list_remove(it->wd->queue, it);
833 if (it->wd->anchor_item == it) 792 if (it->wd->anchor_item == it)
834 { 793 {
@@ -836,29 +795,20 @@ _item_del(Elm_Genlist_Item *it)
836 if (!it->wd->anchor_item) 795 if (!it->wd->anchor_item)
837 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); 796 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
838 } 797 }
839 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
840 if (it->parent) 798 if (it->parent)
841 it->parent->items = eina_list_remove(it->parent->items, it); 799 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
842 if (it->flags & ELM_GENLIST_ITEM_GROUP) 800 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
843 it->wd->group_items = eina_list_remove(it->wd->group_items, it); 801 elm_gen_item_del_serious(it, (Ecore_Cb)_calc_job);
844 if (it->long_timer) ecore_timer_del(it->long_timer); 802 evas_event_thaw(evas_object_evas_get(obj));
845 if (it->swipe_timer) ecore_timer_del(it->swipe_timer); 803 evas_event_thaw_eval(evas_object_evas_get(obj));
846
847 if (it->tooltip.del_cb)
848 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
849
850 evas_event_thaw(evas_object_evas_get(tob));
851 evas_event_thaw_eval(evas_object_evas_get(tob));
852
853 elm_widget_item_del(it);
854} 804}
855 805
856static void 806static void
857_item_select(Elm_Genlist_Item *it) 807_item_select(Elm_Gen_Item *it)
858{ 808{
859 Evas_Object *parent = WIDGET(it); 809 Evas_Object *parent = WIDGET(it);
860 810
861 if ((it->wd->no_select) || (it->delete_me) || (it->mode_view)) return; 811 if ((it->wd->no_select) || (it->delete_me) || (it->item->mode_view)) return;
862 if (it->selected) 812 if (it->selected)
863 { 813 {
864 if (it->wd->always_select) goto call; 814 if (it->wd->always_select) goto call;
@@ -895,7 +845,7 @@ end:
895} 845}
896 846
897static void 847static void
898_item_unselect(Elm_Genlist_Item *it) 848_item_unselect(Elm_Gen_Item *it)
899{ 849{
900 if ((it->delete_me) || (!it->selected)) return; 850 if ((it->delete_me) || (!it->selected)) return;
901 it->selected = EINA_FALSE; 851 it->selected = EINA_FALSE;
@@ -909,7 +859,7 @@ _mouse_move(void *data,
909 Evas_Object *obj, 859 Evas_Object *obj,
910 void *event_info) 860 void *event_info)
911{ 861{
912 Elm_Genlist_Item *it = data; 862 Elm_Gen_Item *it = data;
913 Evas_Event_Mouse_Move *ev = event_info; 863 Evas_Event_Mouse_Move *ev = event_info;
914 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady; 864 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
915 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos; 865 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
@@ -966,16 +916,16 @@ _mouse_move(void *data,
966 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy; 916 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
967 917
968 if (!it->wd->reorder_start_y) 918 if (!it->wd->reorder_start_y)
969 it->wd->reorder_start_y = it->block->y + it->y; 919 it->wd->reorder_start_y = it->item->block->y + it->y;
970 920
971 if (it_scrl_y < oy) 921 if (it_scrl_y < oy)
972 y_pos = oy; 922 y_pos = oy;
973 else if (it_scrl_y + it->wd->reorder_it->h > oy + oh) 923 else if (it_scrl_y + it->wd->reorder_it->item->h > oy + oh)
974 y_pos = oy + oh - it->wd->reorder_it->h; 924 y_pos = oy + oh - it->wd->reorder_it->item->h;
975 else 925 else
976 y_pos = it_scrl_y; 926 y_pos = it_scrl_y;
977 927
978 _item_position(it, VIEW(it), it->scrl_x, y_pos); 928 _item_position(it, VIEW(it), it->item->scrl_x, y_pos);
979 929
980 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job); 930 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
981 it->wd->calc_job = ecore_job_add(_calc_job, it->wd); 931 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
@@ -1044,7 +994,7 @@ _mouse_move(void *data,
1044static Eina_Bool 994static Eina_Bool
1045_long_press(void *data) 995_long_press(void *data)
1046{ 996{
1047 Elm_Genlist_Item *it = data, *it_tmp; 997 Elm_Gen_Item *it = data, *it_tmp;
1048 Eina_List *list, *l; 998 Eina_List *list, *l;
1049 999
1050 it->long_timer = NULL; 1000 it->long_timer = NULL;
@@ -1052,7 +1002,7 @@ _long_press(void *data)
1052 return ECORE_CALLBACK_CANCEL; 1002 return ECORE_CALLBACK_CANCEL;
1053 it->wd->longpressed = EINA_TRUE; 1003 it->wd->longpressed = EINA_TRUE;
1054 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it); 1004 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
1055 if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP)) 1005 if ((it->wd->reorder_mode) && (it->item->flags != ELM_GENLIST_ITEM_GROUP))
1056 { 1006 {
1057 it->wd->reorder_it = it; 1007 it->wd->reorder_it = it;
1058 it->wd->reorder_start_y = 0; 1008 it->wd->reorder_start_y = 0;
@@ -1077,7 +1027,7 @@ _long_press(void *data)
1077} 1027}
1078 1028
1079static void 1029static void
1080_swipe(Elm_Genlist_Item *it) 1030_swipe(Elm_Gen_Item *it)
1081{ 1031{
1082 int i, sum = 0; 1032 int i, sum = 0;
1083 1033
@@ -1098,7 +1048,7 @@ _swipe(Elm_Genlist_Item *it)
1098static Eina_Bool 1048static Eina_Bool
1099_swipe_cancel(void *data) 1049_swipe_cancel(void *data)
1100{ 1050{
1101 Elm_Genlist_Item *it = data; 1051 Elm_Gen_Item *it = data;
1102 1052
1103 if (!it) return ECORE_CALLBACK_CANCEL; 1053 if (!it) return ECORE_CALLBACK_CANCEL;
1104 it->wd->swipe = EINA_FALSE; 1054 it->wd->swipe = EINA_FALSE;
@@ -1119,7 +1069,7 @@ _multi_cancel(void *data)
1119static void 1069static void
1120_multi_touch_gesture_eval(void *data) 1070_multi_touch_gesture_eval(void *data)
1121{ 1071{
1122 Elm_Genlist_Item *it = data; 1072 Elm_Gen_Item *it = data;
1123 1073
1124 it->wd->multitouched = EINA_FALSE; 1074 it->wd->multitouched = EINA_FALSE;
1125 if (it->wd->multi_timer) 1075 if (it->wd->multi_timer)
@@ -1184,7 +1134,7 @@ _multi_down(void *data,
1184 Evas_Object *obj __UNUSED__, 1134 Evas_Object *obj __UNUSED__,
1185 void *event_info) 1135 void *event_info)
1186{ 1136{
1187 Elm_Genlist_Item *it = data; 1137 Elm_Gen_Item *it = data;
1188 Evas_Event_Multi_Down *ev = event_info; 1138 Evas_Event_Multi_Down *ev = event_info;
1189 1139
1190 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return; 1140 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
@@ -1210,10 +1160,10 @@ _multi_down(void *data,
1210 it->dragging = EINA_FALSE; 1160 it->dragging = EINA_FALSE;
1211 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it); 1161 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1212 } 1162 }
1213 if (it->swipe_timer) 1163 if (it->item->swipe_timer)
1214 { 1164 {
1215 ecore_timer_del(it->swipe_timer); 1165 ecore_timer_del(it->item->swipe_timer);
1216 it->swipe_timer = NULL; 1166 it->item->swipe_timer = NULL;
1217 } 1167 }
1218 if (it->wd->on_hold) 1168 if (it->wd->on_hold)
1219 { 1169 {
@@ -1229,7 +1179,7 @@ _multi_up(void *data,
1229 Evas_Object *obj __UNUSED__, 1179 Evas_Object *obj __UNUSED__,
1230 void *event_info) 1180 void *event_info)
1231{ 1181{
1232 Elm_Genlist_Item *it = data; 1182 Elm_Gen_Item *it = data;
1233 Evas_Event_Multi_Up *ev = event_info; 1183 Evas_Event_Multi_Up *ev = event_info;
1234 1184
1235 if (it->wd->multi_device != ev->device) return; 1185 if (it->wd->multi_device != ev->device) return;
@@ -1245,7 +1195,7 @@ _multi_move(void *data,
1245 Evas_Object *obj __UNUSED__, 1195 Evas_Object *obj __UNUSED__,
1246 void *event_info) 1196 void *event_info)
1247{ 1197{
1248 Elm_Genlist_Item *it = data; 1198 Elm_Gen_Item *it = data;
1249 Evas_Event_Multi_Move *ev = event_info; 1199 Evas_Event_Multi_Move *ev = event_info;
1250 1200
1251 if (it->wd->multi_device != ev->device) return; 1201 if (it->wd->multi_device != ev->device) return;
@@ -1259,7 +1209,7 @@ _mouse_down(void *data,
1259 Evas_Object *obj, 1209 Evas_Object *obj,
1260 void *event_info) 1210 void *event_info)
1261{ 1211{
1262 Elm_Genlist_Item *it = data; 1212 Elm_Gen_Item *it = data;
1263 Evas_Event_Mouse_Down *ev = event_info; 1213 Evas_Event_Mouse_Down *ev = event_info;
1264 Evas_Coord x, y; 1214 Evas_Coord x, y;
1265 1215
@@ -1296,8 +1246,8 @@ _mouse_down(void *data,
1296 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); 1246 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1297 } 1247 }
1298 if (it->long_timer) ecore_timer_del(it->long_timer); 1248 if (it->long_timer) ecore_timer_del(it->long_timer);
1299 if (it->swipe_timer) ecore_timer_del(it->swipe_timer); 1249 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
1300 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it); 1250 it->item->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1301 if (it->realized) 1251 if (it->realized)
1302 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press, 1252 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1303 it); 1253 it);
@@ -1313,7 +1263,7 @@ _mouse_up(void *data,
1313 Evas_Object *obj __UNUSED__, 1263 Evas_Object *obj __UNUSED__,
1314 void *event_info) 1264 void *event_info)
1315{ 1265{
1316 Elm_Genlist_Item *it = data; 1266 Elm_Gen_Item *it = data;
1317 Evas_Event_Mouse_Up *ev = event_info; 1267 Evas_Event_Mouse_Up *ev = event_info;
1318 Eina_Bool dragged = EINA_FALSE; 1268 Eina_Bool dragged = EINA_FALSE;
1319 1269
@@ -1340,10 +1290,10 @@ _mouse_up(void *data,
1340 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it); 1290 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1341 dragged = 1; 1291 dragged = 1;
1342 } 1292 }
1343 if (it->swipe_timer) 1293 if (it->item->swipe_timer)
1344 { 1294 {
1345 ecore_timer_del(it->swipe_timer); 1295 ecore_timer_del(it->item->swipe_timer);
1346 it->swipe_timer = NULL; 1296 it->item->swipe_timer = NULL;
1347 } 1297 }
1348 if (it->wd->multi_timer) 1298 if (it->wd->multi_timer)
1349 { 1299 {
@@ -1364,7 +1314,7 @@ _mouse_up(void *data,
1364 1314
1365 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent)) 1315 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1366 { 1316 {
1367 if (it_scrl_y <= it->wd->reorder_rel->scrl_y) 1317 if (it_scrl_y <= it->wd->reorder_rel->item->scrl_y)
1368 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel); 1318 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1369 else 1319 else
1370 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel); 1320 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
@@ -1394,9 +1344,9 @@ _mouse_up(void *data,
1394 { 1344 {
1395 if (it->want_unrealize) 1345 if (it->want_unrealize)
1396 { 1346 {
1397 _item_unrealize(it, EINA_FALSE); 1347 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
1398 if (it->block->want_unrealize) 1348 if (it->item->block->want_unrealize)
1399 _item_block_unrealize(it->block); 1349 _item_block_unrealize(it->item->block);
1400 } 1350 }
1401 } 1351 }
1402 if ((it->disabled) || (dragged) || (it->display_only)) return; 1352 if ((it->disabled) || (dragged) || (it->display_only)) return;
@@ -1431,7 +1381,7 @@ _mouse_up(void *data,
1431 else 1381 else
1432 { 1382 {
1433 const Eina_List *l, *l_next; 1383 const Eina_List *l, *l_next;
1434 Elm_Genlist_Item *it2; 1384 Elm_Gen_Item *it2;
1435 1385
1436 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2) 1386 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1437 if (it2 != it) 1387 if (it2 != it)
@@ -1453,9 +1403,9 @@ _signal_expand_toggle(void *data,
1453 const char *emission __UNUSED__, 1403 const char *emission __UNUSED__,
1454 const char *source __UNUSED__) 1404 const char *source __UNUSED__)
1455{ 1405{
1456 Elm_Genlist_Item *it = data; 1406 Elm_Gen_Item *it = data;
1457 1407
1458 if (it->expanded) 1408 if (it->item->expanded)
1459 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it); 1409 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1460 else 1410 else
1461 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it); 1411 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
@@ -1467,9 +1417,9 @@ _signal_expand(void *data,
1467 const char *emission __UNUSED__, 1417 const char *emission __UNUSED__,
1468 const char *source __UNUSED__) 1418 const char *source __UNUSED__)
1469{ 1419{
1470 Elm_Genlist_Item *it = data; 1420 Elm_Gen_Item *it = data;
1471 1421
1472 if (!it->expanded) 1422 if (!it->item->expanded)
1473 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it); 1423 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1474} 1424}
1475 1425
@@ -1479,9 +1429,9 @@ _signal_contract(void *data,
1479 const char *emission __UNUSED__, 1429 const char *emission __UNUSED__,
1480 const char *source __UNUSED__) 1430 const char *source __UNUSED__)
1481{ 1431{
1482 Elm_Genlist_Item *it = data; 1432 Elm_Gen_Item *it = data;
1483 1433
1484 if (it->expanded) 1434 if (it->item->expanded)
1485 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it); 1435 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1486} 1436}
1487 1437
@@ -1503,16 +1453,16 @@ _mode_finished_signal_cb(void *data,
1503{ 1453{
1504 if (!data) return; 1454 if (!data) return;
1505 if (!obj) return; 1455 if (!obj) return;
1506 Elm_Genlist_Item *it = data; 1456 Elm_Gen_Item *it = data;
1507 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return; 1457 if ((it->delete_me) || (!it->realized) || (!it->item->mode_view)) return;
1508 char buf[1024]; 1458 char buf[1024];
1509 Evas *te = evas_object_evas_get(obj); 1459 Evas *te = evas_object_evas_get(obj);
1510 1460
1511 evas_event_freeze(te); 1461 evas_event_freeze(te);
1512 it->nocache = EINA_FALSE; 1462 it->item->nocache = EINA_FALSE;
1513 _mode_item_unrealize(it); 1463 _mode_item_unrealize(it);
1514 if (it->group_item) 1464 if (it->item->group_item)
1515 evas_object_raise(it->VIEW(group_item)); 1465 evas_object_raise(it->item->VIEW(group_item));
1516 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type); 1466 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1517 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it); 1467 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1518 evas_event_thaw(te); 1468 evas_event_thaw(te);
@@ -1550,7 +1500,7 @@ _item_cache_zero(Widget_Data *wd)
1550} 1500}
1551 1501
1552static void 1502static void
1553_item_cache_add(Elm_Genlist_Item *it) 1503_item_cache_add(Elm_Gen_Item *it)
1554{ 1504{
1555 Item_Cache *itc; 1505 Item_Cache *itc;
1556 1506
@@ -1577,20 +1527,20 @@ _item_cache_add(Elm_Genlist_Item *it)
1577 evas_object_hide(itc->base_view); 1527 evas_object_hide(itc->base_view);
1578 evas_object_move(itc->base_view, -9999, -9999); 1528 evas_object_move(itc->base_view, -9999, -9999);
1579 itc->item_style = eina_stringshare_add(it->itc->item_style); 1529 itc->item_style = eina_stringshare_add(it->itc->item_style);
1580 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1; 1530 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1581 itc->compress = (it->wd->compress); 1531 itc->compress = (it->wd->compress);
1582 itc->selected = it->selected; 1532 itc->selected = it->selected;
1583 itc->disabled = it->disabled; 1533 itc->disabled = it->disabled;
1584 itc->expanded = it->expanded; 1534 itc->expanded = it->item->expanded;
1585 if (it->long_timer) 1535 if (it->long_timer)
1586 { 1536 {
1587 ecore_timer_del(it->long_timer); 1537 ecore_timer_del(it->long_timer);
1588 it->long_timer = NULL; 1538 it->long_timer = NULL;
1589 } 1539 }
1590 if (it->swipe_timer) 1540 if (it->item->swipe_timer)
1591 { 1541 {
1592 ecore_timer_del(it->swipe_timer); 1542 ecore_timer_del(it->item->swipe_timer);
1593 it->swipe_timer = NULL; 1543 it->item->swipe_timer = NULL;
1594 } 1544 }
1595 // FIXME: other callbacks? 1545 // FIXME: other callbacks?
1596 edje_object_signal_callback_del_full(itc->base_view, 1546 edje_object_signal_callback_del_full(itc->base_view,
@@ -1619,12 +1569,12 @@ _item_cache_add(Elm_Genlist_Item *it)
1619} 1569}
1620 1570
1621static Item_Cache * 1571static Item_Cache *
1622_item_cache_find(Elm_Genlist_Item *it) 1572_item_cache_find(Elm_Gen_Item *it)
1623{ 1573{
1624 Item_Cache *itc; 1574 Item_Cache *itc;
1625 Eina_Bool tree = 0; 1575 Eina_Bool tree = 0;
1626 1576
1627 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1; 1577 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1628 EINA_INLIST_FOREACH(it->wd->item_cache, itc) 1578 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1629 { 1579 {
1630 if ((itc->selected) || (itc->disabled) || (itc->expanded)) 1580 if ((itc->selected) || (itc->disabled) || (itc->expanded))
@@ -1643,24 +1593,24 @@ _item_cache_find(Elm_Genlist_Item *it)
1643} 1593}
1644 1594
1645static void 1595static void
1646_elm_genlist_item_odd_even_update(Elm_Genlist_Item *it) 1596_elm_genlist_item_odd_even_update(Elm_Gen_Item *it)
1647{ 1597{
1648 if (!it->nostacking) 1598 if (!it->item->nostacking)
1649 { 1599 {
1650 if ((it->order_num_in & 0x1) ^ it->stacking_even) 1600 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
1651 evas_object_lower(VIEW(it)); 1601 evas_object_lower(VIEW(it));
1652 else 1602 else
1653 evas_object_raise(VIEW(it)); 1603 evas_object_raise(VIEW(it));
1654 } 1604 }
1655 1605
1656 if (it->order_num_in & 0x1) 1606 if (it->item->order_num_in & 0x1)
1657 edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm"); 1607 edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
1658 else 1608 else
1659 edje_object_signal_emit(VIEW(it), "elm,state,even", "elm"); 1609 edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
1660} 1610}
1661 1611
1662static void 1612static void
1663_elm_genlist_item_state_update(Elm_Genlist_Item *it, Item_Cache *itc) 1613_elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *itc)
1664{ 1614{
1665 if (itc) 1615 if (itc)
1666 { 1616 {
@@ -1676,9 +1626,9 @@ _elm_genlist_item_state_update(Elm_Genlist_Item *it, Item_Cache *itc)
1676 edje_object_signal_emit(VIEW(it), 1626 edje_object_signal_emit(VIEW(it),
1677 "elm,state,disabled", "elm"); 1627 "elm,state,disabled", "elm");
1678 } 1628 }
1679 if (it->expanded != itc->expanded) 1629 if (it->item->expanded != itc->expanded)
1680 { 1630 {
1681 if (it->expanded) 1631 if (it->item->expanded)
1682 edje_object_signal_emit(VIEW(it), 1632 edje_object_signal_emit(VIEW(it),
1683 "elm,state,expanded", "elm"); 1633 "elm,state,expanded", "elm");
1684 } 1634 }
@@ -1691,7 +1641,7 @@ _elm_genlist_item_state_update(Elm_Genlist_Item *it, Item_Cache *itc)
1691 if (it->disabled) 1641 if (it->disabled)
1692 edje_object_signal_emit(VIEW(it), 1642 edje_object_signal_emit(VIEW(it),
1693 "elm,state,disabled", "elm"); 1643 "elm,state,disabled", "elm");
1694 if (it->expanded) 1644 if (it->item->expanded)
1695 edje_object_signal_emit(VIEW(it), 1645 edje_object_signal_emit(VIEW(it),
1696 "elm,state,expanded", "elm"); 1646 "elm,state,expanded", "elm");
1697 } 1647 }
@@ -1706,24 +1656,17 @@ _item_cache_free(Item_Cache *itc)
1706 free(itc); 1656 free(itc);
1707} 1657}
1708 1658
1709static const char *
1710_item_label_hook(Elm_Genlist_Item *it, const char *part)
1711{
1712 if (!it->itc->func.label_get) return NULL;
1713 return edje_object_part_text_get(VIEW(it), part);
1714}
1715
1716static void 1659static void
1717_item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) 1660_item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1718{ 1661{
1719 Elm_Genlist_Item *it = event_info; 1662 Elm_Gen_Item *it = event_info;
1720 if (!it) return; 1663 if (!it) return;
1721 if (it->wd->last_selected_item == it) 1664 if (it->wd->last_selected_item == it)
1722 it->wd->last_selected_item = NULL; 1665 it->wd->last_selected_item = NULL;
1723} 1666}
1724 1667
1725static void 1668static void
1726_item_label_realize(Elm_Genlist_Item *it, 1669_item_label_realize(Elm_Gen_Item *it,
1727 Evas_Object *target, 1670 Evas_Object *target,
1728 Eina_List **source) 1671 Eina_List **source)
1729{ 1672{
@@ -1752,7 +1695,7 @@ _item_label_realize(Elm_Genlist_Item *it,
1752} 1695}
1753 1696
1754static Eina_List * 1697static Eina_List *
1755_item_icon_realize(Elm_Genlist_Item *it, 1698_item_icon_realize(Elm_Gen_Item *it,
1756 Evas_Object *target, 1699 Evas_Object *target,
1757 Eina_List **source) 1700 Eina_List **source)
1758{ 1701{
@@ -1785,7 +1728,7 @@ _item_icon_realize(Elm_Genlist_Item *it,
1785} 1728}
1786 1729
1787static void 1730static void
1788_item_state_realize(Elm_Genlist_Item *it, 1731_item_state_realize(Elm_Gen_Item *it,
1789 Evas_Object *target, 1732 Evas_Object *target,
1790 Eina_List **source) 1733 Eina_List **source)
1791{ 1734{
@@ -1816,11 +1759,11 @@ _item_state_realize(Elm_Genlist_Item *it,
1816} 1759}
1817 1760
1818static void 1761static void
1819_item_realize(Elm_Genlist_Item *it, 1762_item_realize(Elm_Gen_Item *it,
1820 int in, 1763 int in,
1821 Eina_Bool calc) 1764 Eina_Bool calc)
1822{ 1765{
1823 Elm_Genlist_Item *it2; 1766 Elm_Gen_Item *it2;
1824 const char *treesize; 1767 const char *treesize;
1825 char buf[1024]; 1768 char buf[1024];
1826 int depth, tsize = 20; 1769 int depth, tsize = 20;
@@ -1830,9 +1773,9 @@ _item_realize(Elm_Genlist_Item *it,
1830 //evas_event_freeze(evas_object_evas_get(it->wd->obj)); 1773 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1831 if (it->realized) 1774 if (it->realized)
1832 { 1775 {
1833 if (it->order_num_in != in) 1776 if (it->item->order_num_in != in)
1834 { 1777 {
1835 it->order_num_in = in; 1778 it->item->order_num_in = in;
1836 _elm_genlist_item_odd_even_update(it); 1779 _elm_genlist_item_odd_even_update(it);
1837 _elm_genlist_item_state_update(it, NULL); 1780 _elm_genlist_item_state_update(it, NULL);
1838 } 1781 }
@@ -1840,10 +1783,10 @@ _item_realize(Elm_Genlist_Item *it,
1840 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj)); 1783 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1841 return; 1784 return;
1842 } 1785 }
1843 it->order_num_in = in; 1786 it->item->order_num_in = in;
1844 1787
1845 if (it->nocache) 1788 if (it->item->nocache)
1846 it->nocache = EINA_FALSE; 1789 it->item->nocache = EINA_FALSE;
1847 else 1790 else
1848 itc = _item_cache_find(it); 1791 itc = _item_cache_find(it);
1849 if (itc) 1792 if (itc)
@@ -1865,7 +1808,7 @@ _item_realize(Elm_Genlist_Item *it,
1865 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart); 1808 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1866 elm_widget_sub_object_add(WIDGET(it), VIEW(it)); 1809 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1867 1810
1868 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) 1811 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
1869 strncpy(buf, "tree", sizeof(buf)); 1812 strncpy(buf, "tree", sizeof(buf));
1870 else strncpy(buf, "item", sizeof(buf)); 1813 else strncpy(buf, "item", sizeof(buf));
1871 if (it->wd->compress) 1814 if (it->wd->compress)
@@ -1879,11 +1822,11 @@ _item_realize(Elm_Genlist_Item *it,
1879 1822
1880 stacking_even = edje_object_data_get(VIEW(it), "stacking_even"); 1823 stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
1881 if (!stacking_even) stacking_even = "above"; 1824 if (!stacking_even) stacking_even = "above";
1882 it->stacking_even = !!strcmp("above", stacking_even); 1825 it->item->stacking_even = !!strcmp("above", stacking_even);
1883 1826
1884 stacking = edje_object_data_get(VIEW(it), "stacking"); 1827 stacking = edje_object_data_get(VIEW(it), "stacking");
1885 if (!stacking) stacking = "yes"; 1828 if (!stacking) stacking = "yes";
1886 it->nostacking = !!strcmp("yes", stacking); 1829 it->item->nostacking = !!strcmp("yes", stacking);
1887 1830
1888 edje_object_mirrored_set(VIEW(it), 1831 edje_object_mirrored_set(VIEW(it),
1889 elm_widget_mirrored_get(WIDGET(it))); 1832 elm_widget_mirrored_get(WIDGET(it)));
@@ -1897,9 +1840,9 @@ _item_realize(Elm_Genlist_Item *it,
1897 1840
1898 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent) 1841 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1899 { 1842 {
1900 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1; 1843 if (it2->parent->item->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1901 } 1844 }
1902 it->expanded_depth = depth; 1845 it->item->expanded_depth = depth;
1903 treesize = edje_object_data_get(VIEW(it), "treesize"); 1846 treesize = edje_object_data_get(VIEW(it), "treesize");
1904 if (treesize) tsize = atoi(treesize); 1847 if (treesize) tsize = atoi(treesize);
1905 evas_object_size_hint_min_set(it->spacer, 1848 evas_object_size_hint_min_set(it->spacer,
@@ -1935,19 +1878,19 @@ _item_realize(Elm_Genlist_Item *it,
1935 ((it->wd->item_width) && (it->wd->group_item_width)))) 1878 ((it->wd->item_width) && (it->wd->group_item_width))))
1936 { 1879 {
1937 /* homogenous genlist shortcut */ 1880 /* homogenous genlist shortcut */
1938 if (!it->mincalcd) 1881 if (!it->item->mincalcd)
1939 { 1882 {
1940 if (it->flags & ELM_GENLIST_ITEM_GROUP) 1883 if (it->item->flags & ELM_GENLIST_ITEM_GROUP)
1941 { 1884 {
1942 it->w = it->minw = it->wd->group_item_width; 1885 it->item->w = it->item->minw = it->wd->group_item_width;
1943 it->h = it->minh = it->wd->group_item_height; 1886 it->item->h = it->item->minh = it->wd->group_item_height;
1944 } 1887 }
1945 else 1888 else
1946 { 1889 {
1947 it->w = it->minw = it->wd->item_width; 1890 it->item->w = it->item->minw = it->wd->item_width;
1948 it->h = it->minh = it->wd->item_height; 1891 it->item->h = it->item->minh = it->wd->item_height;
1949 } 1892 }
1950 it->mincalcd = EINA_TRUE; 1893 it->item->mincalcd = EINA_TRUE;
1951 } 1894 }
1952 } 1895 }
1953 else 1896 else
@@ -1960,7 +1903,7 @@ _item_realize(Elm_Genlist_Item *it,
1960 it->icon_objs = _item_icon_realize(it, VIEW(it), &it->icons); 1903 it->icon_objs = _item_icon_realize(it, VIEW(it), &it->icons);
1961 _item_state_realize(it, VIEW(it), &it->states); 1904 _item_state_realize(it, VIEW(it), &it->states);
1962 1905
1963 if (!it->mincalcd) 1906 if (!it->item->mincalcd)
1964 { 1907 {
1965 Evas_Coord mw = -1, mh = -1; 1908 Evas_Coord mw = -1, mh = -1;
1966 1909
@@ -1971,16 +1914,16 @@ _item_realize(Elm_Genlist_Item *it,
1971 mh); 1914 mh);
1972 if (!it->display_only) 1915 if (!it->display_only)
1973 elm_coords_finger_size_adjust(1, &mw, 1, &mh); 1916 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1974 it->w = it->minw = mw; 1917 it->item->w = it->item->minw = mw;
1975 it->h = it->minh = mh; 1918 it->item->h = it->item->minh = mh;
1976 it->mincalcd = EINA_TRUE; 1919 it->item->mincalcd = EINA_TRUE;
1977 1920
1978 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP)) 1921 if ((!it->wd->group_item_width) && (it->item->flags == ELM_GENLIST_ITEM_GROUP))
1979 { 1922 {
1980 it->wd->group_item_width = mw; 1923 it->wd->group_item_width = mw;
1981 it->wd->group_item_height = mh; 1924 it->wd->group_item_height = mh;
1982 } 1925 }
1983 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE)) 1926 else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
1984 { 1927 {
1985 it->wd->item_width = mw; 1928 it->wd->item_width = mw;
1986 it->wd->item_height = mh; 1929 it->wd->item_height = mh;
@@ -2013,22 +1956,9 @@ _item_realize(Elm_Genlist_Item *it,
2013} 1956}
2014 1957
2015static void 1958static void
2016_item_unrealize(Elm_Genlist_Item *it, 1959_item_unrealize_cb(Elm_Gen_Item *it)
2017 Eina_Bool calc)
2018{ 1960{
2019 Evas_Object *icon; 1961 if (it->item->nocache)
2020
2021 if (!it->realized) return;
2022 if (it->wd->reorder_it == it) return;
2023 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2024 if (!calc)
2025 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
2026 if (it->long_timer)
2027 {
2028 ecore_timer_del(it->long_timer);
2029 it->long_timer = NULL;
2030 }
2031 if (it->nocache)
2032 { 1962 {
2033 evas_object_del(VIEW(it)); 1963 evas_object_del(VIEW(it));
2034 VIEW(it) = NULL; 1964 VIEW(it) = NULL;
@@ -2044,21 +1974,11 @@ _item_unrealize(Elm_Genlist_Item *it,
2044 * _elm_config->scale); 1974 * _elm_config->scale);
2045 _item_cache_add(it); 1975 _item_cache_add(it);
2046 } 1976 }
2047 elm_widget_stringlist_free(it->labels);
2048 it->labels = NULL;
2049 elm_widget_stringlist_free(it->icons);
2050 it->icons = NULL;
2051 elm_widget_stringlist_free(it->states);
2052
2053 EINA_LIST_FREE(it->icon_objs, icon)
2054 evas_object_del(icon);
2055 1977
2056 _mode_item_unrealize(it); 1978 _mode_item_unrealize(it);
2057 it->states = NULL; 1979 it->states = NULL;
2058 it->realized = EINA_FALSE; 1980 it->realized = EINA_FALSE;
2059 it->want_unrealize = EINA_FALSE; 1981 it->want_unrealize = EINA_FALSE;
2060 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2061 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2062} 1982}
2063 1983
2064static Eina_Bool 1984static Eina_Bool
@@ -2067,7 +1987,7 @@ _item_block_recalc(Item_Block *itb,
2067 Eina_Bool qadd) 1987 Eina_Bool qadd)
2068{ 1988{
2069 const Eina_List *l; 1989 const Eina_List *l;
2070 Elm_Genlist_Item *it; 1990 Elm_Gen_Item *it;
2071 Evas_Coord minw = 0, minh = 0; 1991 Evas_Coord minw = 0, minh = 0;
2072 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE; 1992 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2073 Evas_Coord y = 0; 1993 Evas_Coord y = 0;
@@ -2077,32 +1997,32 @@ _item_block_recalc(Item_Block *itb,
2077 EINA_LIST_FOREACH(itb->items, l, it) 1997 EINA_LIST_FOREACH(itb->items, l, it)
2078 { 1998 {
2079 if (it->delete_me) continue; 1999 if (it->delete_me) continue;
2080 showme |= it->showme; 2000 showme |= it->item->showme;
2081 if (!itb->realized) 2001 if (!itb->realized)
2082 { 2002 {
2083 if (qadd) 2003 if (qadd)
2084 { 2004 {
2085 if (!it->mincalcd) changed = EINA_TRUE; 2005 if (!it->item->mincalcd) changed = EINA_TRUE;
2086 if (changed) 2006 if (changed)
2087 { 2007 {
2088 _item_realize(it, in, EINA_TRUE); 2008 _item_realize(it, in, EINA_TRUE);
2089 _item_unrealize(it, EINA_TRUE); 2009 elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb);
2090 } 2010 }
2091 } 2011 }
2092 else 2012 else
2093 { 2013 {
2094 _item_realize(it, in, EINA_TRUE); 2014 _item_realize(it, in, EINA_TRUE);
2095 _item_unrealize(it, EINA_TRUE); 2015 elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb);
2096 } 2016 }
2097 } 2017 }
2098 else 2018 else
2099 _item_realize(it, in, EINA_FALSE); 2019 _item_realize(it, in, EINA_FALSE);
2100 minh += it->minh; 2020 minh += it->item->minh;
2101 if (minw < it->minw) minw = it->minw; 2021 if (minw < it->item->minw) minw = it->item->minw;
2102 in++; 2022 in++;
2103 it->x = 0; 2023 it->x = 0;
2104 it->y = y; 2024 it->y = y;
2105 y += it->h; 2025 y += it->item->h;
2106 } 2026 }
2107 itb->minw = minw; 2027 itb->minw = minw;
2108 itb->minh = minh; 2028 itb->minh = minh;
@@ -2124,14 +2044,14 @@ static void
2124_item_block_unrealize(Item_Block *itb) 2044_item_block_unrealize(Item_Block *itb)
2125{ 2045{
2126 const Eina_List *l; 2046 const Eina_List *l;
2127 Elm_Genlist_Item *it; 2047 Elm_Gen_Item *it;
2128 Eina_Bool dragging = EINA_FALSE; 2048 Eina_Bool dragging = EINA_FALSE;
2129 2049
2130 if (!itb->realized) return; 2050 if (!itb->realized) return;
2131 evas_event_freeze(evas_object_evas_get(itb->wd->obj)); 2051 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2132 EINA_LIST_FOREACH(itb->items, l, it) 2052 EINA_LIST_FOREACH(itb->items, l, it)
2133 { 2053 {
2134 if (it->flags != ELM_GENLIST_ITEM_GROUP) 2054 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2135 { 2055 {
2136 if (it->dragging) 2056 if (it->dragging)
2137 { 2057 {
@@ -2139,7 +2059,7 @@ _item_block_unrealize(Item_Block *itb)
2139 it->want_unrealize = EINA_TRUE; 2059 it->want_unrealize = EINA_TRUE;
2140 } 2060 }
2141 else 2061 else
2142 _item_unrealize(it, EINA_FALSE); 2062 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
2143 } 2063 }
2144 } 2064 }
2145 if (!dragging) 2065 if (!dragging)
@@ -2154,40 +2074,40 @@ _item_block_unrealize(Item_Block *itb)
2154} 2074}
2155 2075
2156static int 2076static int
2157_get_space_for_reorder_item(Elm_Genlist_Item *it) 2077_get_space_for_reorder_item(Elm_Gen_Item *it)
2158{ 2078{
2159 Evas_Coord rox, roy, row, roh, oy, oh; 2079 Evas_Coord rox, roy, row, roh, oy, oh;
2160 Eina_Bool top = EINA_FALSE; 2080 Eina_Bool top = EINA_FALSE;
2161 Elm_Genlist_Item *reorder_it = it->wd->reorder_it; 2081 Elm_Gen_Item *reorder_it = it->wd->reorder_it;
2162 if (!reorder_it) return 0; 2082 if (!reorder_it) return 0;
2163 2083
2164 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh); 2084 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2165 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh); 2085 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2166 2086
2167 if ((it->wd->reorder_start_y < it->block->y) && 2087 if ((it->wd->reorder_start_y < it->item->block->y) &&
2168 (roy - oy + (roh / 2) >= it->block->y - it->wd->pan_y)) 2088 (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y))
2169 { 2089 {
2170 it->block->reorder_offset = it->wd->reorder_it->h * -1; 2090 it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1;
2171 if (it->block->count == 1) 2091 if (it->item->block->count == 1)
2172 it->wd->reorder_rel = it; 2092 it->wd->reorder_rel = it;
2173 } 2093 }
2174 else if ((it->wd->reorder_start_y >= it->block->y) && 2094 else if ((it->wd->reorder_start_y >= it->item->block->y) &&
2175 (roy - oy + (roh / 2) <= it->block->y - it->wd->pan_y)) 2095 (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y))
2176 { 2096 {
2177 it->block->reorder_offset = it->wd->reorder_it->h; 2097 it->item->block->reorder_offset = it->wd->reorder_it->item->h;
2178 } 2098 }
2179 else 2099 else
2180 it->block->reorder_offset = 0; 2100 it->item->block->reorder_offset = 0;
2181