Merge "[Copy&Paste] remove "Paste" button when CBHM has no item"
[framework/uifw/elementary.git] / src / lib / elm_diskselector.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3 #include "els_scroller.h"
4
5 #ifndef MAX
6 # define MAX(a, b) (((a) > (b)) ? (a) : (b))
7 #endif
8
9 #ifndef CEIL
10 #define CEIL(a) (((a) % 2 != 0) ? ((a) / 2 + 1) : ((a) / 2))
11 #endif
12
13 #define DISPLAY_ITEM_NUM_MIN 3
14
15 typedef struct _Widget_Data Widget_Data;
16
17 struct _Widget_Data
18 {
19    Evas_Object *self;
20    Evas_Object *scroller;
21    Evas_Object *main_box;
22    Evas_Object *left_blank;
23    Evas_Object *right_blank;
24    Elm_Diskselector_Item *selected_item;
25    Elm_Diskselector_Item *first;
26    Elm_Diskselector_Item *second;
27    Elm_Diskselector_Item *s_last;
28    Elm_Diskselector_Item *last;
29    Eina_List *items;
30    Eina_List *r_items;
31    Eina_List *over_items;
32    Eina_List *under_items;
33    int item_count, len_threshold, len_side, display_item_num;
34    Ecore_Idler *idler;
35    Ecore_Idler *check_idler;
36    Evas_Coord minw, minh;
37    Eina_Bool init:1;
38    Eina_Bool round:1;
39    Eina_Bool display_item_num_by_api:1;
40 };
41
42 struct _Elm_Diskselector_Item
43 {
44    ELM_WIDGET_ITEM;
45    Eina_List *node;
46    Evas_Object *icon;
47    const char *label;
48    Evas_Smart_Cb func;
49 };
50
51 static const char *widtype = NULL;
52
53 #define ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, ...)                  \
54    ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
55    ELM_CHECK_WIDTYPE(WIDGET(it), widtype) __VA_ARGS__;
56
57 static Eina_Bool _move_scroller(void *data);
58 static void _del_hook(Evas_Object * obj);
59 static void _del_pre_hook(Evas_Object * obj);
60 static void _sizing_eval(Evas_Object * obj);
61 static void _theme_hook(Evas_Object * obj);
62 static void _on_focus_hook(void *data, Evas_Object *obj);
63 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info);
64 static void _sub_del(void *data, Evas_Object * obj, void *event_info);
65 static void _round_items_del(Widget_Data *wd);
66 static void _scroller_move_cb(void *data, Evas_Object *obj, void *event_info);
67 static void _item_click_cb(void *data, Evas_Object *obj __UNUSED__,
68                            const char *emission __UNUSED__,
69                            const char *source __UNUSED__);
70 static void _selected_item_indicate(Elm_Diskselector_Item *it);
71
72 static const char SIG_SELECTED[] = "selected";
73 static const Evas_Smart_Cb_Description _signals[] = {
74        {SIG_SELECTED, ""},
75        {NULL, NULL}
76 };
77
78 static void
79 _diskselector_object_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
80 {
81    Widget_Data *wd;
82    Evas_Coord w, h;
83
84    wd = elm_widget_data_get(data);
85    if (!wd) return;
86
87    if (wd->minw == -1 && wd->minh == -1) elm_coords_finger_size_adjust(6, &wd->minw, 1, &wd->minh);
88    edje_object_size_min_restricted_calc(elm_smart_scroller_edje_object_get(
89          wd->scroller), &wd->minw, &wd->minh, wd->minw, wd->minh);
90    evas_object_size_hint_min_set(obj, wd->minw, wd->minh);
91    evas_object_size_hint_max_set(obj, -1, -1);
92
93    evas_object_geometry_get(wd->scroller, NULL, NULL, &w, &h);
94    if (wd->round)
95      evas_object_resize(wd->main_box, (w / wd->display_item_num) * (wd->item_count + (CEIL(wd->display_item_num) * 2)), h);
96    else
97      evas_object_resize(wd->main_box, (w / wd->display_item_num) * (wd->item_count + CEIL(wd->display_item_num)), h);
98
99    elm_smart_scroller_paging_set(wd->scroller, 0, 0,
100                                  (int)(w / wd->display_item_num), 0);
101
102    if (!wd->idler)
103      wd->idler = ecore_idler_add(_move_scroller, data);
104 }
105
106 static Elm_Diskselector_Item *
107 _item_new(Evas_Object *obj, Evas_Object *icon, const char *label, Evas_Smart_Cb func, const void *data)
108 {
109    Elm_Diskselector_Item *it;
110    const char *style = elm_widget_style_get(obj);
111
112    it = elm_widget_item_new(obj, Elm_Diskselector_Item);
113    if (!it) return NULL;
114
115    it->label = eina_stringshare_add(label);
116    it->icon = icon;
117    it->func = func;
118    it->base.data = data;
119    VIEW(it) = edje_object_add(evas_object_evas_get(obj));
120    _elm_theme_object_set(obj, VIEW(it), "diskselector", "item", style);
121    evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND,
122                                     EVAS_HINT_EXPAND);
123    evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL,
124                                    EVAS_HINT_FILL);
125    evas_object_show(VIEW(it));
126
127    if (it->label)
128      {
129         edje_object_part_text_set(VIEW(it), "elm.text", it->label);
130         edje_object_signal_callback_add(VIEW(it), "elm,action,click", "", _item_click_cb, it);
131      }
132    if (it->icon)
133      {
134         evas_object_size_hint_min_set(it->icon, 24, 24);
135         evas_object_size_hint_max_set(it->icon, 40, 40);
136         edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon);
137         evas_object_show(it->icon);
138         elm_widget_sub_object_add(obj, it->icon);
139      }
140    return it;
141 }
142
143 static void
144 _item_del(Elm_Diskselector_Item *item)
145 {
146    if (!item) return;
147    eina_stringshare_del(item->label);
148    if (item->icon)
149      evas_object_del(item->icon);
150    elm_widget_item_del(item);
151 }
152
153 static void
154 _theme_data_get(Widget_Data *wd)
155 {
156    const char* str;
157    Evas_Object *parent;
158    str = edje_object_data_get(wd->right_blank, "len_threshold");
159    if (str) wd->len_threshold = MAX(0, atoi(str));
160    else wd->len_threshold = 0;
161
162    if (!wd->display_item_num_by_api)
163      {
164         str = edje_object_data_get(wd->right_blank, "display_item_num");
165         if (str) wd->display_item_num = MAX(DISPLAY_ITEM_NUM_MIN, atoi(str));
166         else wd->display_item_num = DISPLAY_ITEM_NUM_MIN;
167      }
168
169    str = edje_object_data_get(wd->right_blank, "min_width");
170    if (str) wd->minw = MAX(-1, atoi(str));
171    else
172      {
173         parent = elm_widget_parent_widget_get(wd->self);
174         if (!parent) wd->minw = -1;
175         else evas_object_geometry_get(parent, NULL, NULL, &wd->minw, NULL);
176      }
177
178    str = edje_object_data_get(wd->right_blank, "min_height");
179    if (str) wd->minh = MAX(-1, atoi(str));
180    else wd->minh = -1;
181 }
182
183 static void
184 _del_hook(Evas_Object * obj)
185 {
186    Widget_Data *wd = elm_widget_data_get(obj);
187    if (!wd) return;
188    free(wd);
189 }
190
191 static void
192 _del_pre_hook(Evas_Object * obj)
193 {
194    Elm_Diskselector_Item *it;
195    Eina_List *l;
196
197    Widget_Data *wd = elm_widget_data_get(obj);
198    if (!wd) return;
199
200    if (wd->left_blank)
201      evas_object_del(wd->left_blank);
202    if (wd->right_blank)
203      evas_object_del(wd->right_blank);
204    if (wd->last)
205      {
206         eina_stringshare_del(wd->last->label);
207         evas_object_del(wd->VIEW(last));
208         free(wd->last);
209      }
210    if (wd->s_last)
211      {
212         eina_stringshare_del(wd->s_last->label);
213         evas_object_del(wd->VIEW(s_last));
214         free(wd->s_last);
215      }
216    if (wd->second)
217      {
218         eina_stringshare_del(wd->second->label);
219         evas_object_del(wd->VIEW(second));
220         free(wd->second);
221      }
222    if (wd->first)
223      {
224         eina_stringshare_del(wd->first->label);
225         evas_object_del(wd->VIEW(first));
226         free(wd->first);
227      }
228
229    EINA_LIST_FOREACH(wd->under_items, l, it)
230      {
231         if (it)
232           {
233              eina_stringshare_del(it->label);
234              evas_object_del(VIEW(wd->first));
235              free(it);
236           }
237      }
238
239    EINA_LIST_FOREACH(wd->over_items, l, it)
240    {
241      if (it)
242         {
243            eina_stringshare_del(it->label);
244            evas_object_del(VIEW(wd->first));
245            free(it);
246         }
247    }
248
249    EINA_LIST_FREE(wd->items, it) _item_del(it);
250    eina_list_free(wd->r_items);
251 }
252
253 static void
254 _sizing_eval(Evas_Object * obj)
255 {
256    Widget_Data *wd = elm_widget_data_get(obj);
257    if (!wd) return;
258    _diskselector_object_resize(obj, NULL, obj, NULL);
259 }
260
261 static void
262 _theme_hook(Evas_Object * obj)
263 {
264    Eina_List *l;
265    Elm_Diskselector_Item *it;
266    Widget_Data *wd = elm_widget_data_get(obj);
267    if (!wd) return;
268
269    if (wd->scroller)
270      elm_smart_scroller_object_theme_set(obj, wd->scroller, "diskselector",
271                                          "base", elm_widget_style_get(obj));
272    if (wd->round)
273      {
274         EINA_LIST_FOREACH(wd->r_items, l, it)
275           {
276              _elm_theme_object_set(obj, VIEW(it), "diskselector", "item",
277                                    elm_widget_style_get(obj));
278              edje_object_part_text_set(VIEW(it), "elm.text", it->label);
279           }
280      }
281    else
282      {
283         EINA_LIST_FOREACH(wd->items, l, it)
284           {
285              _elm_theme_object_set(obj, VIEW(it), "diskselector", "item",
286                                    elm_widget_style_get(obj));
287              edje_object_part_text_set(VIEW(it), "elm.text", it->label);
288           }
289      }
290    _elm_theme_object_set(obj, wd->right_blank, "diskselector", "item",
291                                    elm_widget_style_get(obj));
292    _theme_data_get(wd);
293    _sizing_eval(obj);
294 }
295
296 static void
297 _sub_del(void *data __UNUSED__, Evas_Object * obj, void *event_info)
298 {
299    Widget_Data *wd = elm_widget_data_get(obj);
300    Evas_Object *sub = event_info;
301    Elm_Diskselector_Item *it;
302    const Eina_List *l;
303
304    if (!wd) return;
305    if (!sub) abort();
306    if (sub == wd->scroller)
307      wd->scroller = NULL;
308    else
309      {
310         EINA_LIST_FOREACH(wd->items, l, it)
311           {
312              if (sub == it->icon)
313                {
314                   it->icon = NULL;
315                   _sizing_eval(obj);
316                   break;
317                }
318           }
319      }
320 }
321
322 static void
323 _select_item(Elm_Diskselector_Item *it)
324 {
325    if (!it) return;
326    Widget_Data *wd = elm_widget_data_get(WIDGET(it));
327    wd->selected_item = it;
328    _selected_item_indicate(wd->selected_item);
329    if (it->func) it->func((void *)it->base.data, WIDGET(it), it);
330    evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
331 }
332
333 static void
334 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
335 {
336    Widget_Data *wd = elm_widget_data_get(obj);
337    if (!wd)
338      return;
339
340    if (elm_widget_focus_get(obj))
341      {
342         edje_object_signal_emit(wd->self, "elm,action,focus", "elm");
343         evas_object_focus_set(wd->self, EINA_TRUE);
344      }
345    else
346      {
347         edje_object_signal_emit(wd->self, "elm,action,unfocus", "elm");
348         evas_object_focus_set(wd->self, EINA_FALSE);
349      }
350 }
351
352 static Eina_Bool
353 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
354 {
355    if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
356    Evas_Event_Key_Down *ev = event_info;
357    Widget_Data *wd = elm_widget_data_get(obj);
358    if (!wd) return EINA_FALSE;
359    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
360    if (elm_widget_disabled_get(obj)) return EINA_FALSE;
361
362    Elm_Diskselector_Item *it = NULL;
363    Eina_List *l;
364
365    if (!wd->selected_item) {
366         ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
367         return EINA_TRUE;
368    }
369
370    if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")) ||
371        (!strcmp(ev->keyname, "Up"))  || (!strcmp(ev->keyname, "KP_Up")))
372      {
373         l = wd->selected_item->node->prev;
374         if ((!l) && (wd->round))
375           l = eina_list_last(wd->items);
376      }
377    else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")) ||
378             (!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
379      {
380         l = wd->selected_item->node->next;
381         if ((!l) && (wd->round))
382           l = wd->items;
383      }
384    else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
385      l = wd->items;
386    else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
387      l = eina_list_last(wd->items);
388    else return EINA_FALSE;
389
390    if (l)
391      it = eina_list_data_get(l);
392
393    if (it)
394      {
395         wd->selected_item = it;
396         if (!wd->idler)
397           wd->idler = ecore_idler_add(_move_scroller, obj);
398      }
399
400    ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
401    return EINA_TRUE;
402 }
403
404 static int
405 _count_letter(const char *str)
406 {
407    int pos = 0;
408    int code = 0, chnum;
409
410    for (chnum = 0; ; chnum++)
411      {
412         pos = evas_string_char_next_get(str, pos, &code);
413         if (code == 0) break;
414      }
415    return chnum;
416 }
417
418 static int
419 _check_letter(const char *str, int length)
420 {
421    int pos = 0;
422    int code = 0, chnum;
423
424    for (chnum = 0; ; chnum++)
425      {
426         if (chnum == length) break;
427         pos = evas_string_char_next_get(str, pos, &code);
428         if (code == 0) break;
429      }
430    return pos;
431 }
432
433 static Eina_Bool
434 _check_string(void *data)
435 {
436    int mid, steps, length, diff;
437    Elm_Diskselector_Item *it;
438    Eina_List *list, *l;
439    Evas_Coord ox, ow;
440    char buf[1024];
441    Widget_Data *wd = data;
442
443    evas_object_geometry_get(wd->scroller, &ox, NULL, &ow, NULL);
444    if (ow <= 0)
445      return EINA_FALSE;
446    if (!wd->init)
447      return EINA_FALSE;
448    if (!wd->round)
449      list = wd->items;
450    else
451      list = wd->r_items;
452
453    EINA_LIST_FOREACH(list, l, it)
454      {
455         Evas_Coord x, w;
456         int len;
457         evas_object_geometry_get(VIEW(it), &x, NULL, &w, NULL);
458         /* item not visible */
459         if ((x + w <= ox) || (x >= ox + ow))
460           continue;
461
462         len = _count_letter(it->label);
463 //        // FIXME: len should be # of ut8f letters. ie count using utf8 string walk, not stringshare len
464 //        len = eina_stringshare_strlen(it->label);
465
466         if (x <= ox + 5)
467           edje_object_signal_emit(VIEW(it), "elm,state,left_side",
468                                   "elm");
469         else if (x + w >= ox + ow - 5)
470           edje_object_signal_emit(VIEW(it), "elm,state,right_side",
471                                   "elm");
472         else
473           {
474              if ((wd->len_threshold) && (len > wd->len_threshold))
475                edje_object_signal_emit(VIEW(it), "elm,state,center_small",
476                                        "elm");
477              else
478                edje_object_signal_emit(VIEW(it), "elm,state,center",
479                                        "elm");
480           }
481
482         // if len is les that the limit len, skip anyway
483         if (len <= wd->len_side)
484           continue;
485
486         steps = len - wd->len_side + 1;
487         mid = x + w / 2;
488         if (mid <= ox + ow / 2)
489           diff = (ox + ow / 2) - mid;
490         else
491           diff = mid - (ox + ow / 2);
492
493         length = len - (int)(diff * steps / (ow / 3));
494         length = MAX(length, wd->len_side);
495         // limit string len to "length" ut8f chars
496         length = _check_letter(it->label, length);
497         // cut it off at byte mark returned form _check_letter
498         strncpy(buf, it->label, length);
499         buf[length] = '\0';
500         edje_object_part_text_set(VIEW(it), "elm.text", buf);
501      }
502
503    if (wd->check_idler)
504      ecore_idler_del(wd->check_idler);
505    wd->check_idler = NULL;
506    return EINA_FALSE;
507 }
508
509 static void
510 _selected_item_indicate(Elm_Diskselector_Item *it)
511 {
512    Elm_Diskselector_Item *item;
513    Eina_List *l;
514    Widget_Data *wd;
515    wd = elm_widget_data_get(WIDGET(it));
516
517    if (!wd) return;
518
519    EINA_LIST_FOREACH(wd->r_items, l, item)
520      {
521         if (!strcmp(item->label, it->label)) edje_object_signal_emit(VIEW(item), "elm,state,selected", "elm");
522         else
523            edje_object_signal_emit(VIEW(item), "elm,state,default", "elm");
524      }
525 }
526
527 static void
528 _item_click_cb(void *data, Evas_Object *obj __UNUSED__,
529                const char *emission __UNUSED__, const char *source __UNUSED__)
530 {
531    Elm_Diskselector_Item *it = data;
532
533    if (!it) return;
534
535    Widget_Data *wd;
536    wd = elm_widget_data_get(WIDGET(it));
537
538    if (!wd) return;
539
540    if (wd->selected_item != it)
541      {
542         wd->selected_item = it;
543         _selected_item_indicate(wd->selected_item);
544      }
545
546    if (it->func) it->func((void *)it->base.data, WIDGET(it), it);
547 }
548
549 static void
550 _scroller_move_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
551 {
552    Evas_Coord x, y, w, h, bw;
553    Widget_Data *wd = data;
554
555    _check_string(wd);
556    elm_smart_scroller_child_pos_get(obj, &x, &y);
557    elm_smart_scroller_child_viewport_size_get(obj, &w, &h);
558    if (wd->round)
559      {
560         evas_object_geometry_get(wd->main_box, NULL, NULL, &bw, NULL);
561         if (x > ((w / wd->display_item_num) * (wd->item_count + (wd->display_item_num % 2))))
562            elm_smart_scroller_child_region_show(wd->scroller,
563                                                x - ((w / wd->display_item_num) * wd->item_count),
564                                                y, w, h);
565         else if (x < 0)
566            elm_smart_scroller_child_region_show(wd->scroller,
567                                                x + ((w / wd->display_item_num) * wd->item_count),
568                                                y, w, h);
569      }
570 }
571
572 static void
573 _scroller_stop_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
574 {
575    Elm_Diskselector_Item *it;
576    Widget_Data *wd = data;
577    Evas_Coord x, w, ow;
578    Eina_List *l, *list;
579
580    if (wd->idler)
581      return;
582
583    if (!wd->round)
584      list = wd->items;
585    else
586      list = wd->r_items;
587
588    evas_object_geometry_get(wd->scroller, NULL, NULL, &ow, NULL);
589    EINA_LIST_FOREACH(list, l, it)
590      {
591         evas_object_geometry_get(VIEW(it), &x, NULL, &w, NULL);
592         if (abs((int)(ow / 2 - (int)(x + w / 2))) < 10)
593           break;
594      }
595
596    if (!it)
597      return;
598
599    _select_item(it);
600 }
601
602 static Eina_Bool
603 _move_scroller(void *data)
604 {
605    Evas_Object *obj = data;
606    Widget_Data *wd;
607    Eina_List *l;
608    Elm_Diskselector_Item *dit;
609    Evas_Coord y, w, h;
610    int i;
611
612    wd = elm_widget_data_get(obj);
613    if (!wd) return EINA_FALSE;
614
615    if (wd->round)
616      i = 1;
617    else
618      i = 0;
619
620    EINA_LIST_FOREACH(wd->items, l, dit)
621      {
622         if (wd->selected_item == dit)
623           break;
624         i++;
625      }
626    if (!dit)
627      {
628         wd->selected_item =
629            (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0);
630         return EINA_FALSE;
631      }
632
633    evas_object_geometry_get(wd->scroller, NULL, &y, &w, &h);
634    //move scroller in two steps for getting smooth launching effect.
635    if (i > 2)
636      elm_smart_scroller_child_region_show(wd->scroller, w / wd->display_item_num * (i-2), y, w, h);
637    elm_smart_scroller_region_bring_in(wd->scroller, w / wd->display_item_num * i, y, w, h);
638
639    _select_item(dit);
640    if (wd->idler)
641      {
642         ecore_idler_del(wd->idler);
643         wd->idler = NULL;
644      }
645    wd->init = EINA_TRUE;
646    _check_string(wd);
647
648    return EINA_TRUE;
649 }
650
651 static void
652 _round_item_del(Widget_Data *wd, Elm_Diskselector_Item *it)
653 {
654    if (!it) return;
655    elm_box_unpack(wd->main_box, VIEW(it));
656    wd->r_items = eina_list_remove(wd->r_items, it);
657    eina_stringshare_del(it->label);
658    evas_object_del(VIEW(it));
659    free(it);
660 }
661
662 static void
663 _round_items_del(Widget_Data *wd)
664 {
665    Eina_List *l;
666    Elm_Diskselector_Item * it;
667
668    _round_item_del(wd, wd->last);
669    wd->last = NULL;
670    _round_item_del(wd, wd->s_last);
671    wd->s_last = NULL;
672    _round_item_del(wd, wd->second);
673    wd->second = NULL;
674    _round_item_del(wd, wd->first);
675    wd->first = NULL;
676
677    EINA_LIST_FOREACH(wd->under_items, l, it)
678      {
679         _round_item_del(wd, it);
680         it = NULL;
681      }
682
683    EINA_LIST_FOREACH(wd->over_items, l, it)
684      {
685         _round_item_del(wd, it);
686         it = NULL;
687      }
688 }
689
690 static void
691 _round_items_add(Widget_Data *wd)
692 {
693    Elm_Diskselector_Item *dit;
694    Elm_Diskselector_Item *it;
695    Elm_Diskselector_Item *temp_it;
696    int i = 0;
697    dit = it = eina_list_nth(wd->items, 0);
698    if (!dit) return;
699
700    if (!wd->first)
701      {
702         wd->first = _item_new(WIDGET(it), it->icon, it->label, it->func,
703                               it->base.data);
704         wd->first->node = it->node;
705         wd->r_items = eina_list_append(wd->r_items, wd->first);
706      }
707
708    it = eina_list_nth(wd->items, 1);
709    if (!it)
710      it = dit;
711    if (!wd->second)
712      {
713         wd->second = _item_new(WIDGET(it), it->icon, it->label, it->func,
714                                it->base.data);
715         wd->second->node = it->node;
716         wd->r_items = eina_list_append(wd->r_items, wd->second);
717      }
718
719    // if more than 3 itmes should be displayed
720    for (i = 2; i < CEIL(wd->display_item_num); i++)
721      {
722         it = eina_list_nth(wd->items, i);
723         if (!it) it = dit;
724         temp_it = _item_new(WIDGET(it), it->icon, it->label, it->func, it->base.data);
725         wd->over_items = eina_list_append(wd->over_items, temp_it);
726         wd->r_items = eina_list_append(wd->r_items, temp_it);
727      }
728
729    it = eina_list_nth(wd->items, wd->item_count - 1);
730    if (!it)
731      it = dit;
732    if (!wd->last)
733      {
734         wd->last = _item_new(WIDGET(it), it->icon, it->label, it->func,
735                              it->base.data);
736         wd->last->node = it->node;
737         wd->r_items = eina_list_prepend(wd->r_items, wd->last);
738      }
739
740    it = eina_list_nth(wd->items, wd->item_count - 2);
741    if (!it)
742      it = dit;
743    if (!wd->s_last)
744      {
745         wd->s_last = _item_new(WIDGET(it), it->icon, it->label, it->func,
746                                it->base.data);
747         wd->s_last->node = it->node;
748         wd->r_items = eina_list_prepend(wd->r_items, wd->s_last);
749      }
750
751    // if more than 3 itmes should be displayed
752    for (i = 3; i <= CEIL(wd->display_item_num); i++)
753      {
754         it = eina_list_nth(wd->items, wd->item_count - i);
755         if (!it) it = dit;
756         temp_it = _item_new(WIDGET(it), it->icon, it->label, it->func, it->base.data);
757         wd->under_items = eina_list_append(wd->under_items, temp_it);
758         wd->r_items = eina_list_prepend(wd->r_items, temp_it);
759      }
760 }
761
762 EAPI Evas_Object *
763 elm_diskselector_add(Evas_Object *parent)
764 {
765    Evas *e;
766    Evas_Object *obj;
767    Widget_Data *wd;
768
769    ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
770
771    ELM_SET_WIDTYPE(widtype, "diskselector");
772    elm_widget_type_set(obj, "diskselector");
773    elm_widget_sub_object_add(parent, obj);
774    elm_widget_data_set(obj, wd);
775    elm_widget_del_hook_set(obj, _del_hook);
776    elm_widget_del_pre_hook_set(obj, _del_pre_hook);
777    elm_widget_theme_hook_set(obj, _theme_hook);
778    elm_widget_can_focus_set(obj, EINA_TRUE);
779    elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
780    elm_widget_event_hook_set(obj, _event_hook);
781
782    wd->self = obj;
783    wd->item_count = 0;
784    wd->round = EINA_FALSE;
785    wd->init = EINA_FALSE;
786    wd->len_side = 3;
787    wd->display_item_num_by_api = EINA_FALSE;
788
789    wd->scroller = elm_smart_scroller_add(e);
790    elm_smart_scroller_widget_set(wd->scroller, obj);
791    _theme_hook(obj);
792    elm_widget_resize_object_set(obj, wd->scroller);
793    elm_smart_scroller_policy_set(wd->scroller, ELM_SMART_SCROLLER_POLICY_OFF,
794                                  ELM_SMART_SCROLLER_POLICY_OFF);
795    elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_TRUE, EINA_FALSE);
796    evas_object_smart_callback_add(wd->scroller, "scroll", _scroller_move_cb,
797                                   wd);
798    evas_object_smart_callback_add(wd->scroller, "animate,stop",
799                                   _scroller_stop_cb, wd);
800    _elm_theme_object_set(obj, wd->scroller, "diskselector", "base",
801                          "default");
802    evas_object_event_callback_add(wd->scroller, EVAS_CALLBACK_RESIZE,
803                                   _diskselector_object_resize, obj);
804
805    wd->main_box = elm_box_add(parent);
806    elm_box_horizontal_set(wd->main_box, EINA_TRUE);
807    elm_box_homogeneous_set(wd->main_box, EINA_TRUE);
808    evas_object_size_hint_weight_set(wd->main_box, EVAS_HINT_EXPAND,
809                                     EVAS_HINT_EXPAND);
810    evas_object_size_hint_align_set(wd->main_box, EVAS_HINT_FILL,
811                                    EVAS_HINT_FILL);
812    _elm_theme_object_set(obj, wd->main_box, "diskselector", "base",
813                          "default");
814    elm_widget_sub_object_add(obj, wd->main_box);
815
816    elm_smart_scroller_child_set(wd->scroller, wd->main_box);
817
818    wd->left_blank = edje_object_add(evas_object_evas_get(obj));
819    _elm_theme_object_set(obj, wd->left_blank, "diskselector", "item",
820                          "default");
821    evas_object_size_hint_weight_set(wd->left_blank, EVAS_HINT_EXPAND,
822                                     EVAS_HINT_EXPAND);
823    evas_object_size_hint_align_set(wd->left_blank, EVAS_HINT_FILL,
824                                    EVAS_HINT_FILL);
825    elm_box_pack_end(wd->main_box, wd->left_blank);
826    evas_object_show(wd->left_blank);
827
828    wd->right_blank = edje_object_add(evas_object_evas_get(obj));
829    _elm_theme_object_set(obj, wd->right_blank, "diskselector", "item",
830                          "default");
831    evas_object_size_hint_weight_set(wd->right_blank, EVAS_HINT_EXPAND,
832                                     EVAS_HINT_EXPAND);
833    evas_object_size_hint_align_set(wd->right_blank, EVAS_HINT_FILL,
834                                    EVAS_HINT_FILL);
835    elm_box_pack_end(wd->main_box, wd->right_blank);
836    evas_object_show(wd->right_blank);
837
838    _theme_data_get(wd);
839
840    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
841    evas_object_smart_callbacks_descriptions_set(obj, _signals);
842    _sizing_eval(obj);
843    return obj;
844 }
845
846 EAPI Eina_Bool
847 elm_diskselector_round_get(const Evas_Object *obj)
848 {
849    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
850    Widget_Data *wd = elm_widget_data_get(obj);
851    if (!wd) return EINA_FALSE;
852    return wd->round;
853 }
854
855 EAPI void
856 elm_diskselector_round_set(Evas_Object * obj, Eina_Bool round)
857 {
858    Eina_List *elist;
859    Elm_Diskselector_Item *it;
860
861    ELM_CHECK_WIDTYPE(obj, widtype);
862    Widget_Data *wd = elm_widget_data_get(obj);
863    if (!wd) return;
864
865    if (wd->round == round)
866      return;
867
868    wd->round = round;
869    if (round)
870      {
871         wd->r_items = eina_list_clone(wd->items);
872         elm_box_unpack(wd->main_box, wd->left_blank);
873         evas_object_hide(wd->left_blank);
874         elm_box_unpack(wd->main_box, wd->right_blank);
875         evas_object_hide(wd->right_blank);
876         if (!wd->items)
877           return;
878
879         _round_items_add(wd);
880
881         if (wd->last)
882           elm_box_pack_start(wd->main_box, wd->VIEW(last));
883         if (wd->s_last)
884           elm_box_pack_start(wd->main_box, wd->VIEW(s_last));
885
886         // if more than 3 items should be displayed
887         EINA_LIST_FOREACH(wd->under_items, elist, it)
888            elm_box_pack_start(wd->main_box, VIEW(it));
889
890         if (wd->first)
891           elm_box_pack_end(wd->main_box, wd->VIEW(first));
892         if (wd->second)
893           elm_box_pack_end(wd->main_box, wd->VIEW(second));
894
895         // if more than 3 items should be displayed
896         EINA_LIST_FOREACH(wd->over_items, elist, it)
897            elm_box_pack_end(wd->main_box, VIEW(it));
898      }
899    else
900      {
901         _round_items_del(wd);
902         elm_box_pack_start(wd->main_box, wd->left_blank);
903         elm_box_pack_end(wd->main_box, wd->right_blank);
904         eina_list_free(wd->r_items);
905         wd->r_items = NULL;
906      }
907
908    _sizing_eval(obj);
909 }
910
911 EAPI int
912 elm_diskselector_side_label_length_get(const Evas_Object *obj)
913 {
914    ELM_CHECK_WIDTYPE(obj, widtype) 0;
915    Widget_Data *wd = elm_widget_data_get(obj);
916    if (!wd) return 0;
917    return wd->len_side;
918 }
919
920 EAPI void
921 elm_diskselector_side_label_length_set(Evas_Object *obj, int len)
922 {
923    ELM_CHECK_WIDTYPE(obj, widtype);
924    Widget_Data *wd = elm_widget_data_get(obj);
925    if (!wd) return;
926    wd->len_side = len;
927 }
928
929 EAPI void
930 elm_diskselector_side_label_lenght_set(Evas_Object *obj, int len)
931 {
932    return elm_diskselector_side_label_length_set(obj, len);
933 }
934
935 EAPI int
936 elm_diskselector_side_label_lenght_get(const Evas_Object *obj)
937 {
938    return elm_diskselector_side_label_length_get(obj);
939 }
940
941 EAPI void
942 elm_diskselector_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
943 {
944    ELM_CHECK_WIDTYPE(obj, widtype);
945    Widget_Data *wd = elm_widget_data_get(obj);
946    if (!wd) return;
947    if (wd->scroller)
948      elm_smart_scroller_bounce_allow_set(wd->scroller, h_bounce, v_bounce);
949 }
950
951 EAPI void
952 elm_diskselector_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
953 {
954    ELM_CHECK_WIDTYPE(obj, widtype);
955    Widget_Data *wd = elm_widget_data_get(obj);
956    if (!wd) return;
957    elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
958 }
959
960 EAPI void
961 elm_diskselector_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
962 {
963    ELM_CHECK_WIDTYPE(obj, widtype);
964    Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
965    Widget_Data *wd = elm_widget_data_get(obj);
966    if ((!wd) || (!wd->scroller)) return;
967    elm_smart_scroller_policy_get(wd->scroller, &s_policy_h, &s_policy_v);
968    *policy_h = (Elm_Scroller_Policy) s_policy_h;
969    *policy_v = (Elm_Scroller_Policy) s_policy_v;
970 }
971
972 EAPI void
973 elm_diskselector_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
974 {
975    ELM_CHECK_WIDTYPE(obj, widtype);
976    Widget_Data *wd = elm_widget_data_get(obj);
977    if (!wd) return;
978    if ((policy_h >= 3) || (policy_v >= 3)) return;
979    if (wd->scroller)
980      elm_smart_scroller_policy_set(wd->scroller, policy_h, policy_v);
981 }
982
983 EAPI void
984 elm_diskselector_clear(Evas_Object *obj)
985 {
986    ELM_CHECK_WIDTYPE(obj, widtype);
987    Widget_Data *wd = elm_widget_data_get(obj);
988    Elm_Diskselector_Item *it;
989
990    if (!wd) return;
991    if (!wd->items) return;
992
993    wd->selected_item = NULL;
994    EINA_LIST_FREE(wd->items, it) _item_del(it);
995    _round_items_del(wd);
996    _sizing_eval(obj);
997 }
998
999 EAPI const Eina_List *
1000 elm_diskselector_items_get(const Evas_Object *obj)
1001 {
1002    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1003    Widget_Data *wd = elm_widget_data_get(obj);
1004    if (!wd) return NULL;
1005    return wd->items;
1006 }
1007
1008 EAPI Elm_Diskselector_Item *
1009 elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data)
1010 {
1011    Elm_Diskselector_Item *it;
1012    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1013    Widget_Data *wd = elm_widget_data_get(obj);
1014    if (!wd) return NULL;
1015
1016    it = _item_new(obj, icon, label, func, data);
1017    wd->items = eina_list_append(wd->items, it);
1018    it->node = eina_list_last(wd->items);
1019    wd->item_count++;
1020    if (wd->round)
1021      {
1022         _round_items_del(wd);
1023         wd->r_items = eina_list_append(wd->r_items, it);
1024         _round_items_add(wd);
1025         if (wd->last)
1026           elm_box_pack_start(wd->main_box, wd->VIEW(last));
1027         if (wd->s_last)
1028           elm_box_pack_start(wd->main_box, wd->VIEW(s_last));
1029         elm_box_pack_end(wd->main_box, VIEW(it));
1030         if (wd->first)
1031           elm_box_pack_end(wd->main_box, wd->VIEW(first));
1032         if (wd->second)
1033           elm_box_pack_end(wd->main_box, wd->VIEW(second));
1034      }
1035    else
1036      {
1037         elm_box_unpack(wd->main_box, wd->right_blank);
1038         elm_box_pack_end(wd->main_box, VIEW(it));
1039         elm_box_pack_end(wd->main_box, wd->right_blank);
1040      }
1041    if (!wd->selected_item)
1042      wd->selected_item = it;
1043    if (!wd->idler)
1044      wd->idler = ecore_idler_add(_move_scroller, obj);
1045    _sizing_eval(obj);
1046    return it;
1047 }
1048
1049 EAPI void
1050 elm_diskselector_item_del(Elm_Diskselector_Item * it)
1051 {
1052    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
1053    Elm_Diskselector_Item *dit;
1054    Elm_Diskselector_Item *item;
1055    Eina_List *l;
1056    int i = 0;
1057    Widget_Data *wd = elm_widget_data_get(WIDGET(it));
1058    if (!wd) return;
1059
1060    elm_box_unpack(wd->main_box, VIEW(it));
1061
1062    if (wd->round)
1063      wd->r_items = eina_list_remove(wd->r_items, it);
1064
1065    wd->items = eina_list_remove(wd->items, it);
1066
1067    if (wd->selected_item == it)
1068      {
1069         dit = (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0);
1070         if (dit != it)
1071           wd->selected_item = dit;
1072         else
1073           wd->selected_item = eina_list_nth(wd->items, 1);
1074
1075         _selected_item_indicate(wd->selected_item);
1076      }
1077
1078    _item_del(it);
1079    wd->item_count -= 1;
1080
1081    if (wd->round)
1082      {
1083         if (!wd->item_count)
1084           {
1085              evas_object_hide(wd->VIEW(first));
1086              evas_object_hide(wd->VIEW(second));
1087              evas_object_hide(wd->VIEW(last));
1088              evas_object_hide(wd->VIEW(s_last));
1089
1090              EINA_LIST_FOREACH(wd->under_items, l, item)
1091                 evas_object_hide(VIEW(item));
1092
1093              EINA_LIST_FOREACH(wd->over_items, l, item)
1094                 evas_object_hide(VIEW(item));
1095           }
1096         else
1097           {
1098              dit = eina_list_nth(wd->items, 0);
1099              if (dit)
1100                {
1101                   eina_stringshare_replace(&wd->first->label, dit->label);
1102                   edje_object_part_text_set(wd->VIEW(first), "elm.text",
1103                                             wd->first->label);
1104                }
1105              dit = eina_list_nth(wd->items, 1);
1106              if (dit)
1107                {
1108                   eina_stringshare_replace(&wd->second->label, dit->label);
1109                   edje_object_part_text_set(wd->VIEW(second), "elm.text",
1110                                             wd->second->label);
1111                }
1112              // if more than 3 itmes should be displayed
1113              for (i = 2; i < CEIL(wd->display_item_num); i++)
1114                {
1115                   dit = eina_list_nth(wd->items, i);
1116                   item = eina_list_nth(wd->over_items, i - 2);
1117                   eina_stringshare_replace(&item->label, dit->label);
1118                   edje_object_part_text_set(VIEW(item), "elm.text", item->label);
1119                }
1120
1121              dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 1);
1122              if (dit)
1123                {
1124                   eina_stringshare_replace(&wd->last->label, dit->label);
1125                   edje_object_part_text_set(wd->VIEW(last), "elm.text",
1126                                             wd->last->label);
1127                }
1128              dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 2);
1129              if (dit)
1130                {
1131                   eina_stringshare_replace(&wd->s_last->label, dit->label);
1132                   edje_object_part_text_set(wd->VIEW(s_last), "elm.text",
1133                                             wd->s_last->label);
1134                }
1135              // if more than 3 itmes should be displayed
1136              for (i = 3; i <= CEIL(wd->display_item_num); i++)
1137                {
1138                   dit = eina_list_nth(wd->items, wd->item_count - i);
1139                   item = eina_list_nth(wd->under_items, i - 3);
1140                   eina_stringshare_replace(&item->label, dit->label);
1141                   edje_object_part_text_set(VIEW(item), "elm.text", item->label);
1142                }
1143           }
1144      }
1145    wd->check_idler = ecore_idler_add(_check_string, wd);
1146    _sizing_eval(wd->self);
1147 }
1148
1149 EAPI const char *
1150 elm_diskselector_item_label_get(const Elm_Diskselector_Item * it)
1151 {
1152    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
1153    return it->label;
1154 }
1155
1156 EAPI void
1157 elm_diskselector_item_label_set(Elm_Diskselector_Item * it, const char *label)
1158 {
1159    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
1160    eina_stringshare_replace(&it->label, label);
1161    edje_object_part_text_set(VIEW(it), "elm.text", it->label);
1162 }
1163
1164 EAPI Elm_Diskselector_Item *
1165 elm_diskselector_selected_item_get(const Evas_Object *obj)
1166 {
1167    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1168    Widget_Data *wd = elm_widget_data_get(obj);
1169    if (!wd) return NULL;
1170    return wd->selected_item;
1171 }
1172
1173 EAPI void
1174 elm_diskselector_item_selected_set(Elm_Diskselector_Item *it, Eina_Bool selected)
1175 {
1176    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
1177    Widget_Data *wd;
1178    wd = elm_widget_data_get(WIDGET(it));
1179    if (!wd) return;
1180
1181    if ((wd->selected_item == it) && (selected))
1182      return;
1183
1184    if ((wd->selected_item == it) && (!selected))
1185      wd->selected_item = eina_list_data_get(wd->items);
1186    else
1187      {
1188         wd->selected_item = it;
1189         _selected_item_indicate(wd->selected_item);
1190      }
1191
1192    if (!wd->idler)
1193      ecore_idler_add(_move_scroller, WIDGET(it));
1194 }
1195
1196 EAPI Eina_Bool
1197 elm_diskselector_item_selected_get(const Elm_Diskselector_Item *it)
1198 {
1199    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
1200    Widget_Data *wd;
1201
1202    wd = elm_widget_data_get(WIDGET(it));
1203    if (!wd) return EINA_FALSE;
1204    return (wd->selected_item == it);
1205 }
1206
1207 EAPI void
1208 elm_diskselector_item_del_cb_set(Elm_Diskselector_Item *it, Evas_Smart_Cb func)
1209 {
1210    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
1211    elm_widget_item_del_cb_set(it, func);
1212 }
1213
1214 EAPI void *
1215 elm_diskselector_item_data_get(const Elm_Diskselector_Item *it)
1216 {
1217    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
1218    return elm_widget_item_data_get(it);
1219 }
1220
1221 EAPI Evas_Object *
1222 elm_diskselector_item_icon_get(const Elm_Diskselector_Item *it)
1223 {
1224    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
1225    return it->icon;
1226 }
1227
1228 EAPI void
1229 elm_diskselector_item_icon_set(Elm_Diskselector_Item *it, Evas_Object *icon)
1230 {
1231    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
1232    if (it->icon == icon) return;
1233    if (it->icon)
1234      evas_object_del(it->icon);
1235    it->icon = icon;
1236    if (it->base.view)
1237      edje_object_part_swallow(it->base.view, "elm.swallow.icon", icon);
1238 }
1239
1240 EAPI Elm_Diskselector_Item *
1241 elm_diskselector_item_prev_get(const Elm_Diskselector_Item *it)
1242 {
1243    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
1244    if (it->node->prev) return it->node->prev->data;
1245    else return NULL;
1246 }
1247
1248 EAPI Elm_Diskselector_Item *
1249 elm_diskselector_item_next_get(const Elm_Diskselector_Item *it)
1250 {
1251    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
1252    if (it->node->next) return it->node->next->data;
1253    else return NULL;
1254 }
1255
1256 EAPI Elm_Diskselector_Item *
1257 elm_diskselector_first_item_get(const Evas_Object *obj)
1258 {
1259    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1260    Widget_Data *wd;
1261
1262    wd = elm_widget_data_get(obj);
1263    if (!wd || !wd->items)
1264      return NULL;
1265
1266    return eina_list_data_get(wd->items);
1267 }
1268
1269 EAPI Elm_Diskselector_Item *
1270 elm_diskselector_last_item_get(const Evas_Object *obj)
1271 {
1272    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1273
1274    Widget_Data *wd;
1275    wd = elm_widget_data_get(obj);
1276    if (!wd || !wd->items)
1277      return NULL;
1278
1279    return eina_list_data_get(eina_list_last(wd->items));
1280 }
1281
1282 EAPI void
1283 elm_diskselector_item_tooltip_text_set(Elm_Diskselector_Item *item, const char *text)
1284 {
1285    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
1286    elm_widget_item_tooltip_text_set(item, text);
1287 }
1288
1289 EAPI void
1290 elm_diskselector_item_tooltip_content_cb_set(Elm_Diskselector_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
1291 {
1292    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
1293    elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb);
1294 }
1295
1296 EAPI void
1297 elm_diskselector_item_tooltip_unset(Elm_Diskselector_Item *item)
1298 {
1299    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
1300    elm_widget_item_tooltip_unset(item);
1301 }
1302
1303 EAPI void
1304 elm_diskselector_item_tooltip_style_set(Elm_Diskselector_Item *item, const char *style)
1305 {
1306    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
1307    elm_widget_item_tooltip_style_set(item, style);
1308 }
1309
1310 EAPI const char *
1311 elm_diskselector_item_tooltip_style_get(const Elm_Diskselector_Item *item)
1312 {
1313    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, NULL);
1314    return elm_widget_item_tooltip_style_get(item);
1315 }
1316
1317 EAPI void
1318 elm_diskselector_item_cursor_set(Elm_Diskselector_Item *item, const char *cursor)
1319 {
1320    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
1321    elm_widget_item_cursor_set(item, cursor);
1322 }
1323
1324 EAPI const char *
1325 elm_diskselector_item_cursor_get(const Elm_Diskselector_Item *item)
1326 {
1327    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, NULL);
1328    return elm_widget_item_cursor_get(item);
1329 }
1330
1331 EAPI void
1332 elm_diskselector_item_cursor_unset(Elm_Diskselector_Item *item)
1333 {
1334    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
1335    elm_widget_item_cursor_unset(item);
1336 }
1337
1338 EAPI void
1339 elm_diskselector_item_cursor_style_set(Elm_Diskselector_Item *item, const char *style)
1340 {
1341    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
1342    elm_widget_item_cursor_style_set(item, style);
1343 }
1344
1345 EAPI const char *
1346 elm_diskselector_item_cursor_style_get(const Elm_Diskselector_Item *item)
1347 {
1348    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, NULL);
1349    return elm_widget_item_cursor_style_get(item);
1350 }
1351
1352 EAPI void
1353 elm_diskselector_item_cursor_engine_only_set(Elm_Diskselector_Item *item, Eina_Bool engine_only)
1354 {
1355    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
1356    elm_widget_item_cursor_engine_only_set(item, engine_only);
1357 }
1358
1359 EAPI Eina_Bool
1360 elm_diskselector_item_cursor_engine_only_get(const Elm_Diskselector_Item *item)
1361 {
1362    ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
1363    return elm_widget_item_cursor_engine_only_get(item);
1364 }
1365
1366 EAPI void
1367 elm_diskselector_display_item_num_set(Evas_Object *obj, int num)
1368 {
1369    ELM_CHECK_WIDTYPE(obj, widtype);
1370    Widget_Data *wd = elm_widget_data_get(obj);
1371    if (!wd) return;
1372    if (num < DISPLAY_ITEM_NUM_MIN) num = DISPLAY_ITEM_NUM_MIN;
1373    wd->display_item_num = num;
1374    wd->display_item_num_by_api = EINA_TRUE;
1375 }
1376
1377 EAPI int
1378 elm_diskselector_display_item_num_get(const Evas_Object *item)
1379 {
1380    ELM_CHECK_WIDTYPE(item, widtype) (-1);
1381    Widget_Data *wd = elm_widget_data_get(item);
1382    if (!wd) return -1;
1383    return wd->display_item_num;
1384 }