67830f5e92618aabd9a2fcd700b239a91ff06199
[framework/uifw/elementary.git] / src / lib / elm_softkey.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 /**
5  * @defgroup Softkey Softkey
6  * @ingroup Elementary
7  *
8  * This is a softkey
9  */
10
11 /**
12  * internal data structure of softkey object
13  */
14 #define BTN_ANIMATOR_MAX        4
15 #define PANEL_ANIMATOR_MAX      1
16 typedef struct _Widget_Data Widget_Data;
17
18 struct _Widget_Data
19 {
20    Evas_Object *lay;
21    Evas_Object *button[2];
22    Evas_Object *bg_rect;
23    Evas_Object *panel;
24    Evas_Object *glow_obj;
25
26    Evas_Coord x, y, w, h;
27    Evas_Coord glow_w, glow_h;
28    Evas_Coord win_h;
29    Evas_Coord panel_height;
30    Ecore_Animator *animator;
31    Eina_List *items;
32    unsigned int panel_btn_idx;
33    Eina_Bool button_show[2];
34    Eina_Bool show_panel :1;
35    Eina_Bool animating :1;
36    Eina_Bool is_horizontal;
37    double scale_factor;
38    int max_button;
39    Eina_Bool panel_suppported;
40 };
41
42 struct _Elm_Softkey_Item
43 {
44    Evas_Object *obj;
45    Evas_Object *base;
46    Evas_Object *icon;
47    const char *label;
48    void
49    (*func)(void *data, Evas_Object *obj, void *event_info);
50    const void *data;
51    Eina_Bool disabled :1;
52 };
53
54 static void
55 _item_disable(Elm_Softkey_Item *it, Eina_Bool disabled);
56 static void
57 _del_hook(Evas_Object *obj);
58 static void
59 _theme_hook(Evas_Object *obj);
60 static void
61 _sizing_eval(Evas_Object *obj);
62 static void
63 _sub_del(void *data, Evas_Object *obj, void *event_info);
64
65 /*
66  * callback functions
67  */
68 static void
69 _softkey_down_cb(void *data, Evas_Object *obj, const char *emission,
70                  const char *source);
71 static void
72 _softkey_up_cb(void *data, Evas_Object *obj, const char *emission,
73                const char *source);
74
75 static void
76 _panel_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
77 static void
78 _panel_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
79
80 static void
81 _more_btn_click_cb(void *data, Evas_Object *obj, const char *emission,
82                    const char *source);
83 static void
84 _close_btn_click_cb(void *data, Evas_Object *obj, const char *emission,
85                     const char *source);
86 static void
87 _bg_click_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
88
89 static int
90 _show_button_animator_cb(void *data);
91 static int
92 _hide_button_animator_cb(void *data);
93 static int
94 _panel_up_animator_cb(void *data);
95 static int
96 _panel_down_animator_cb(void *data);
97
98 /*
99  * internal function
100  */
101 static int
102 _show_button(Evas_Object *obj, Elm_Softkey_Type type, Eina_Bool show);
103 static int
104 _delete_button(Evas_Object *obj);
105
106 static void
107 _softkey_object_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
108 static void
109 _softkey_object_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
110 static void
111 _softkey_object_show(void *data, Evas *e, Evas_Object *obj, void *event_info);
112 static void
113 _softkey_object_hide(void *data, Evas *e, Evas_Object *obj, void *event_info);
114 static void
115 _softkey_horizontal_set(Evas_Object *obj, Eina_Bool horizontal_mode);
116 static void
117 _icon_disable(Evas_Object *icon, Eina_Bool disabled)
118 {
119    Evas_Object *edj;
120
121    if (!icon) return;
122    edj = elm_layout_edje_get(icon);
123
124    if (disabled)
125    {
126       if (!edj)
127       {
128          edje_object_signal_emit(icon, "elm,state,disabled", "elm");
129       }
130       else
131       {
132          edje_object_signal_emit(edj, "elm,state,disabled", "elm");
133       }
134    }
135    else
136    {
137       if (!edj)
138       {
139          edje_object_signal_emit(icon, "elm,state,enabled", "elm");
140       }
141       else
142       {
143          edje_object_signal_emit(edj, "elm,state,enabled", "elm");
144       }
145    }
146 }
147
148 static void
149 _item_disable(Elm_Softkey_Item *it, Eina_Bool disabled)
150 {
151    Widget_Data *wd = elm_widget_data_get(it->obj);
152    if (!wd) return;
153    if (it->disabled == disabled) return;
154    it->disabled = disabled;
155    if (it->disabled)
156    {
157       edje_object_signal_emit(it->base, "elm,state,disabled", "elm");
158    }
159    else
160    {
161       edje_object_signal_emit(it->base, "elm,state,enabled", "elm");
162    }
163
164    _icon_disable(it->icon, disabled);
165 }
166
167 static void
168 _del_hook(Evas_Object *obj)
169 {
170    int i;
171    Evas_Object *btn;
172    Widget_Data *wd = elm_widget_data_get(obj);
173
174    if (!wd) return;
175    evas_object_event_callback_del(obj, EVAS_CALLBACK_RESIZE,
176                                   _softkey_object_resize);
177    evas_object_event_callback_del(obj, EVAS_CALLBACK_MOVE, _softkey_object_move);
178    evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, _softkey_object_show);
179    evas_object_event_callback_del(obj, EVAS_CALLBACK_HIDE, _softkey_object_hide);
180
181    /* delete button */
182    for (i = 0; i < 2; i++)
183    {
184       btn = wd->button[i];
185       if (btn != NULL)
186       {
187          //_delete_button(btn);
188          evas_object_del(wd->button[i]);
189          wd->button[i] = NULL;
190       }
191    }
192
193    //evas_object_smart_callback_del(obj, "sub-object-del", _sub_del);
194
195
196    /* delete panel */
197    if (wd->panel)
198    {
199       elm_softkey_panel_del(obj);
200    }
201
202    /* delete glow effect image */
203    if (wd->glow_obj)
204    {
205       evas_object_del(wd->glow_obj);
206       wd->glow_obj = NULL;
207    }
208    if (wd->lay)
209    {
210       evas_object_del(wd->lay);
211       wd->lay = NULL;
212    }
213
214    free(wd);
215 }
216
217 static void
218 _theme_hook(Evas_Object *obj)
219 {
220    Elm_Softkey_Item* item;
221    Widget_Data *wd = elm_widget_data_get(obj);
222    Elm_Softkey_Item *it;
223    const Eina_List *l;
224
225    if (!wd)
226    {
227       return;
228    }
229    _elm_theme_object_set(obj, wd->lay, "softkey", "bg",
230                          elm_widget_style_get(obj));
231    _elm_theme_object_set(obj, wd->glow_obj, "softkey", "glow", "default");
232
233    if (wd->button[ELM_SK_LEFT_BTN])
234    {
235
236       item = evas_object_data_get(wd->button[ELM_SK_LEFT_BTN], "item_data");
237       _elm_theme_object_set(obj, wd->button[ELM_SK_LEFT_BTN], "softkey",
238                             "button_left", elm_widget_style_get(obj));
239
240       elm_softkey_item_label_set(item, item->label);
241
242    }
243
244    if (wd->button[ELM_SK_RIGHT_BTN])
245    {
246
247       item = evas_object_data_get(wd->button[ELM_SK_RIGHT_BTN], "item_data");
248
249       _elm_theme_object_set(obj, wd->button[ELM_SK_RIGHT_BTN], "softkey",
250                             "button_right", elm_widget_style_get(obj));
251
252       elm_softkey_item_label_set(item, item->label);
253
254    }
255
256    if (wd->panel)
257    {
258       _elm_theme_object_set(obj, wd->panel, "softkey", "panel",
259                             elm_widget_style_get(obj));
260       if (wd->panel_btn_idx > 0)
261       {
262          //show more button
263          edje_object_signal_emit(wd->lay, "more_btn_show", "");
264          EINA_LIST_FOREACH (wd->items, l, it)
265          {
266             _elm_theme_object_set(obj, it->base, "softkey", "panel_button",
267                                   elm_widget_style_get(obj));
268             if (it->label)
269             {
270                edje_object_part_text_set(it->base, "elm.text", it->label); // set text
271             }
272          }
273       }
274    }
275
276    _sizing_eval(obj);
277 }
278
279 static void
280 _sub_del(void *data, Evas_Object *obj, void *event_info)
281 {
282    Widget_Data *wd = elm_widget_data_get(obj);
283    Evas_Object *sub = event_info;
284    const Eina_List *l;
285    Elm_Softkey_Item *it;
286    if (!wd) return;
287
288    EINA_LIST_FOREACH(wd->items, l, it)
289    {
290       if (sub == it->icon)
291       {
292          it->icon = NULL;
293       }
294       break;
295    }
296 }
297
298 static void
299 _sizing_eval(Evas_Object *obj)
300 {
301    Widget_Data *wd = elm_widget_data_get(obj);
302
303    if (!wd) return;
304
305    _softkey_object_move(obj, NULL, obj, NULL);
306    _softkey_object_resize(obj, NULL, obj, NULL);
307 }
308
309 static int
310 _panel_up_animator_cb(void *data)
311 {
312    int max = PANEL_ANIMATOR_MAX;
313    static int progress = 0;
314    Widget_Data *wd;
315    Evas_Coord ypos;
316
317    wd = elm_widget_data_get(data);
318    if (!wd) return 0;
319
320    progress++;
321    wd->animating = EINA_TRUE;
322
323    if (progress > max)
324    {
325       if (!wd->animator) return 0;
326       ecore_animator_del(wd->animator);
327       wd->animator = NULL;
328       wd->animating = EINA_FALSE;
329       wd->show_panel = EINA_TRUE;
330       progress = 0;
331       return 0;
332    }
333
334    /* move up panel */
335    if (wd->panel)
336    {
337       ypos = wd->win_h - (wd->panel_height * progress / max);
338       evas_object_move(wd->panel, wd->x, ypos);
339    }
340
341    return 1;
342 }
343
344 static int
345 _panel_down_animator_cb(void *data)
346 {
347    int max = PANEL_ANIMATOR_MAX;
348    static int progress = 0;
349    Widget_Data *wd;
350    Evas_Coord ypos;
351
352    wd = elm_widget_data_get(data);
353    if (!wd) return 0;
354
355    progress++;
356    wd->animating = EINA_TRUE;
357
358    if (progress > max)
359    {
360       if (!wd->animator) return 0;
361       ecore_animator_del(wd->animator);
362       wd->animator = NULL;
363       wd->animating = EINA_FALSE;
364       //wd->animator = ecore_animator_add(_show_button_animator_cb, data);
365       wd->show_panel = EINA_FALSE;
366       progress = 0;
367
368       evas_object_smart_callback_call(data, "panel,hide", NULL);
369
370       return 0;
371    }
372
373    /* move down panel */
374    if (wd->panel)
375    {
376       ypos = wd->win_h - wd->panel_height + (wd->panel_height * progress / max);
377       evas_object_move(wd->panel, wd->x, ypos);
378    }
379
380    return 1;
381 }
382
383 static int
384 _hide_button_animator_cb(void *data)
385 {
386    int max = BTN_ANIMATOR_MAX;
387    static int progress = 0;
388    Widget_Data *wd;
389    Evas_Coord btn_w, xpos;
390
391    wd = elm_widget_data_get(data);
392    if (!wd) return 0;
393
394    progress++;
395    wd->animating = EINA_TRUE;
396
397    if (progress > max)
398    {
399       if (!wd->animator) return 0;
400       ecore_animator_del(wd->animator);
401       wd->animating = EINA_FALSE;
402       wd->animator = ecore_animator_add(_panel_up_animator_cb, data);
403       progress = 0;
404       return 0;
405    }
406
407    /* move left button */
408    if (wd->button[ELM_SK_LEFT_BTN])
409    {
410       edje_object_part_geometry_get(wd->button[ELM_SK_LEFT_BTN], "button_rect",
411                                     NULL, NULL, &btn_w, NULL);
412       //evas_object_geometry_get(wd->button[ELM_SK_LEFT_BTN], NULL, NULL, &btn_w, NULL);
413       xpos = wd->x + -1 * btn_w * progress / max;
414       evas_object_move(wd->button[ELM_SK_LEFT_BTN], xpos, wd->y);
415    }
416
417    /* move right button */
418    if (wd->button[ELM_SK_RIGHT_BTN])
419    {
420       edje_object_part_geometry_get(wd->button[ELM_SK_RIGHT_BTN],
421                                     "button_rect", NULL, NULL, &btn_w, NULL);
422       //evas_object_geometry_get(wd->button[ELM_SK_RIGHT_BTN], NULL, NULL, &btn_w, NULL);
423       xpos = (wd->x + wd->w - btn_w) + (btn_w * progress / max);
424       evas_object_move(wd->button[ELM_SK_RIGHT_BTN], xpos, wd->y);
425    }
426
427    return 1;
428 }
429
430 static int
431 _show_button_animator_cb(void *data)
432 {
433    int max = BTN_ANIMATOR_MAX;
434    static int progress = 0;
435    Widget_Data *wd;
436    Evas_Coord btn_w, xpos;
437
438    wd = elm_widget_data_get(data);
439    if (!wd) return 0;
440
441    progress++;
442
443    wd->animating = EINA_TRUE;
444
445    if (progress > max)
446    {
447       if (!wd->animator) return 0;
448       ecore_animator_del(wd->animator);
449       wd->animating = EINA_FALSE;
450       progress = 0;
451       return 0;
452    }
453
454    /* move left button */
455    if (wd->button[ELM_SK_LEFT_BTN])
456    {
457       edje_object_part_geometry_get(wd->button[ELM_SK_LEFT_BTN], "button_rect",
458                                     NULL, NULL, &btn_w, NULL);
459       //evas_object_geometry_get(wd->button[ELM_SK_LEFT_BTN], NULL, NULL, &btn_w, NULL);
460       xpos = wd->x + (-1 * btn_w) + (btn_w * progress / max);
461       evas_object_move(wd->button[ELM_SK_LEFT_BTN], xpos, wd->y);
462    }
463
464    /* move right button */
465    if (wd->button[ELM_SK_RIGHT_BTN])
466    {
467       edje_object_part_geometry_get(wd->button[ELM_SK_RIGHT_BTN],
468                                     "button_rect", NULL, NULL, &btn_w, NULL);
469       //evas_object_geometry_get(wd->button[ELM_SK_RIGHT_BTN], NULL, NULL, &btn_w, NULL);
470       xpos = wd->x + wd->w - (btn_w * progress / max);
471       evas_object_move(wd->button[ELM_SK_RIGHT_BTN], xpos, wd->y);
472    }
473
474    return 1;
475 }
476
477 static void
478 _more_btn_click_cb(void *data, Evas_Object *obj, const char *emission,
479                    const char *source)
480 {
481    Widget_Data *wd;
482    wd = elm_widget_data_get(data);
483    if (!wd) return;
484
485    evas_object_smart_callback_call(data, "panel,show", NULL);
486
487    if (!wd->panel) return;
488    evas_object_show(wd->panel);
489
490    if (wd->bg_rect)
491    {
492       evas_object_show(wd->bg_rect);
493    }
494
495    /*if (wd->animating == EINA_FALSE) {
496     wd->animator = ecore_animator_add(_hide_button_animator_cb, data);
497     }*/
498    if (wd->animating == EINA_FALSE)
499    {
500       wd->animator = ecore_animator_add(_panel_up_animator_cb, data);
501    }
502 }
503
504 static void
505 _close_panel(Evas_Object *obj)
506 {
507    Widget_Data *wd;
508    wd = elm_widget_data_get(obj);
509    if (!wd) return;
510
511    if (wd->bg_rect)
512    {
513       evas_object_hide(wd->bg_rect);
514    }
515
516    if (!wd->panel) return;
517
518    if (wd->animating == EINA_FALSE)
519    {
520       wd->animator = ecore_animator_add(_panel_down_animator_cb, obj);
521    }
522 }
523
524 static void
525 _bg_click_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
526 {
527    _close_panel(data);
528 }
529
530 static void
531 _close_btn_click_cb(void *data, Evas_Object *obj, const char *emission,
532                     const char *source)
533 {
534    _close_panel(data);
535 }
536
537 static int
538 _show_button(Evas_Object *obj, Elm_Softkey_Type type, Eina_Bool show)
539 {
540    if (!obj) return -1;
541
542    Widget_Data *wd = elm_widget_data_get(obj);
543    Evas_Object *btn = wd->button[type];
544    if (!btn) return -1;
545
546    /* Make visible button */
547    if (show)
548    {
549       wd->button_show[type] = EINA_TRUE;
550       evas_object_show(btn);
551    }
552    else
553    {
554       wd->button_show[type] = EINA_FALSE;
555       evas_object_hide(btn);
556    }
557
558    return 0;
559 }
560
561 static int
562 _arrange_button(Evas_Object *obj, Elm_Softkey_Type type)
563 {
564    Widget_Data *wd;
565    Evas_Coord btn_w = 0;
566    Evas_Object *btn;
567
568    if (!obj) return -1;
569    wd = elm_widget_data_get(obj);
570    if (!wd) return -1;
571
572    btn = wd->button[type];
573    if (!btn) return -1;
574
575    switch (type)
576    {
577    case ELM_SK_LEFT_BTN:
578       evas_object_move(btn, wd->x, wd->y);
579       break;
580    case ELM_SK_RIGHT_BTN:
581       edje_object_part_geometry_get(btn, "button_rect", NULL, NULL, &btn_w,
582                                     NULL);
583       //evas_object_geometry_get(btn, NULL, NULL, &btn_w, NULL);
584       evas_object_move(btn, wd->x + wd->w - btn_w, wd->y);
585       break;
586    default:
587       break;
588    }
589
590    return 0;
591 }
592
593 static void
594 _softkey_up_cb(void *data, Evas_Object *obj, const char *emission,
595                const char *source)
596 {
597    Evas_Object *edj;
598
599    Elm_Softkey_Item *it = (Elm_Softkey_Item *) data;
600    elm_softkey_panel_close(it->obj);
601    if (it->icon)
602    {
603       edj = elm_layout_edje_get(it->icon);
604       if (!edj) return;
605       edje_object_signal_emit(edj, "elm,state,unselected", "elm");
606    }
607    if (it->func) it->func((void *) (it->data), it->obj, it);
608    evas_object_smart_callback_call(it->obj, "clicked", it);
609 }
610
611 static void
612 _softkey_down_cb(void *data, Evas_Object *obj, const char *emission,
613                  const char *source)
614 {
615    Evas_Object *edj;
616
617    Elm_Softkey_Item *it = (Elm_Softkey_Item *) data;
618    evas_object_smart_callback_call(it->obj, "press", it);
619
620    if (!it->icon) return;
621    edj = elm_layout_edje_get(it->icon);
622    if (!edj) return;
623
624    edje_object_signal_emit(edj, "elm,state,selected", "elm");
625 }
626
627 static void
628 _panel_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
629 {
630    Elm_Softkey_Item *it = (Elm_Softkey_Item *) data;
631
632    Widget_Data *wd;
633    wd = elm_widget_data_get(it->obj);
634    if (wd == NULL) return;
635
636    /* hide glow effect */
637    if (wd->glow_obj)
638    {
639       evas_object_hide(wd->glow_obj);
640    }
641
642    elm_softkey_panel_close(it->obj);
643    if (it->func) it->func((void *) (it->data), it->obj, it);
644    evas_object_smart_callback_call(it->obj, "clicked", it);
645 }
646
647 static void
648 _panel_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
649 {
650    Evas_Coord glow_x, glow_y;
651    Widget_Data *wd;
652
653    Elm_Softkey_Item *it = (Elm_Softkey_Item *) data;
654    wd = elm_widget_data_get(it->obj);
655    if (wd == NULL) return;
656
657    /* show glow effect */
658    if (wd->glow_obj)
659    {
660       Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *) event_info;
661       glow_x = ev->canvas.x - (wd->glow_w / 2);
662       glow_y = ev->canvas.y - (wd->glow_h / 2);
663
664       evas_object_move(wd->glow_obj, glow_x, glow_y);
665       evas_object_show(wd->glow_obj);
666    }
667
668    evas_object_smart_callback_call(it->obj, "press", it);
669 }
670
671 static int
672 _delete_button(Evas_Object *obj)
673 {
674    if (!obj) return -1;
675
676    if (obj)
677    {
678       evas_object_del(obj);
679       obj = NULL;
680    }
681
682    return 0;
683 }
684
685 static void
686 _calc_win_height(Widget_Data *wd)
687 {
688    wd->win_h = wd->y + wd->h;
689
690    if (wd->bg_rect)
691    {
692       evas_object_resize(wd->bg_rect, wd->w, wd->win_h);
693       evas_object_move(wd->bg_rect, wd->x, 0);
694    }
695
696    if (wd->panel)
697    {
698       if (wd->show_panel)
699       {
700          evas_object_move(wd->panel, wd->x, (wd->win_h - wd->panel_height));
701       }
702       else
703       {
704          evas_object_move(wd->panel, wd->x, wd->win_h);
705       }
706    }
707 }
708
709 static void
710 _softkey_object_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
711 {
712    Widget_Data *wd;
713    int i;
714    Evas_Coord x, y;
715
716    if (!data) return;
717    wd = elm_widget_data_get((Evas_Object *) data);
718    if (!wd) return;
719
720    evas_object_geometry_get(wd->lay, &x, &y, NULL, NULL);
721
722    wd->x = x;
723    wd->y = y;
724
725    evas_object_move(wd->lay, x, y);
726
727    for (i = 0; i < 2; i++)
728    {
729       _arrange_button((Evas_Object *) data, i);
730    }
731
732    _calc_win_height(wd);
733 }
734
735 static void
736 _softkey_object_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
737 {
738    Widget_Data *wd;
739    Evas_Object *btn;
740    int i;
741    Evas_Coord btn_w;
742    Evas_Coord w, h;
743
744    if (!data) return;
745    wd = elm_widget_data_get((Evas_Object *) data);
746    if (!wd) return;
747
748    evas_object_geometry_get(wd->lay, NULL, NULL, &w, &h);
749
750    wd->w = w;
751    wd->h = h;
752
753    if (!wd->lay) return;
754    evas_object_resize(wd->lay, w, h);
755
756    /* resize button */
757    for (i = 0; i < 2; i++)
758    {
759       btn = wd->button[i];
760       if (btn != NULL)
761       {
762          edje_object_part_geometry_get(btn, "button_rect", NULL, NULL, &btn_w,
763                                        NULL);
764          evas_object_resize(btn, btn_w, h);
765          _arrange_button((Evas_Object *) data, i);
766       }
767    }
768
769    if (wd->w >= wd->win_h)
770    {
771       _softkey_horizontal_set(data, EINA_TRUE);
772    }
773    else
774    {
775       _softkey_horizontal_set(data, EINA_FALSE);
776    }
777    _calc_win_height(wd);
778 }
779
780 static void
781 _softkey_object_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
782 {
783    Widget_Data *wd = NULL;
784    Evas_Object *btn;
785    int i;
786    if (data == NULL) return;
787    wd = elm_widget_data_get((Evas_Object *) data);
788    if (wd == NULL) return;
789
790    if (wd->lay)
791    {
792       evas_object_show(wd->lay);
793    }
794
795    /* show button */
796    for (i = 0; i < 2; i++)
797    {
798       btn = wd->button[i];
799       if (btn != NULL && wd->button_show[i] == EINA_TRUE)
800       {
801          evas_object_show(btn);
802          //evas_object_clip_set(btn, evas_object_clip_get((Evas_Object *)data));
803       }
804    }
805    if (wd->panel_btn_idx > 0)
806    {
807       /* show more button */
808       edje_object_signal_emit(wd->lay, "more_btn_show", "");
809    }
810 }
811
812 static void
813 _softkey_object_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
814 {
815    Widget_Data *wd = NULL;
816    Evas_Object *btn;
817    int i;
818
819    if (data == NULL) return;
820    wd = elm_widget_data_get((Evas_Object *) data);
821    if (wd == NULL) return;
822
823    if (wd->lay)
824    {
825       evas_object_hide(wd->lay);
826    }
827
828    /* hide button */
829    for (i = 0; i < 2; i++)
830    {
831       btn = wd->button[i];
832       if (btn != NULL)
833       {
834          evas_object_hide(btn);
835       }
836    }
837
838    if (wd->panel_btn_idx > 0)
839    {
840       /* hide more button */
841       edje_object_signal_emit(wd->lay, "more_btn_hide", "");
842    }
843 }
844
845 /**
846  * Add a new softkey to the parent
847
848  * @param parent the parent of the smart object
849  * @return              Evas_Object* pointer of softkey(evas object) or NULL
850  * @ingroup             Softkey 
851  */
852 EAPI Evas_Object *
853 elm_softkey_add(Evas_Object *parent)
854 {
855    Evas_Object *obj = NULL;
856    Widget_Data *wd = NULL;
857    Evas *e;
858
859    wd = ELM_NEW(Widget_Data);
860    e = evas_object_evas_get(parent);
861    if (e == NULL) return NULL;
862    obj = elm_widget_add(e);
863    elm_widget_type_set(obj, "softkey");
864    elm_widget_sub_object_add(parent, obj);
865    elm_widget_data_set(obj, wd);
866    elm_widget_del_hook_set(obj, _del_hook);
867    elm_widget_theme_hook_set(obj, _theme_hook);
868
869    /* load background edj */
870    wd->lay = edje_object_add(e);
871    _elm_theme_object_set(obj, wd->lay, "softkey", "bg", "default");
872    if (wd->lay == NULL)
873    {
874       printf("Cannot load bg edj\n");
875       return NULL;
876    }
877    elm_widget_resize_object_set(obj, wd->lay);
878    edje_object_signal_callback_add(wd->lay, "clicked", "more_btn",
879                                    _more_btn_click_cb, obj);
880
881    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
882                                   _softkey_object_resize, obj);
883    evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
884                                   _softkey_object_move, obj);
885    evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW,
886                                   _softkey_object_show, obj);
887    evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE,
888                                   _softkey_object_hide, obj);
889    wd->is_horizontal = EINA_FALSE;
890    wd->panel_suppported = EINA_TRUE;
891    wd->scale_factor = elm_scale_get();
892    if (wd->scale_factor == 0.0)
893    {
894       wd->scale_factor = 1.0;
895    }
896
897    /* load glow effect */
898    wd->glow_obj = edje_object_add(e);
899    _elm_theme_object_set(obj, wd->glow_obj, "softkey", "glow", "default");
900    evas_object_geometry_get(wd->glow_obj, NULL, NULL, &wd->glow_w, &wd->glow_h);
901    evas_object_resize(wd->glow_obj, wd->glow_w, wd->glow_h);
902
903    // FIXME
904    //evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
905
906    wd->button[ELM_SK_LEFT_BTN] = wd->button[ELM_SK_RIGHT_BTN] = NULL;
907    wd->panel = NULL;
908    //_sizing_eval(obj);
909    wd->show_panel = EINA_FALSE;
910    wd->bg_rect = NULL;
911
912    return obj;
913 }
914
915 static void
916 _softkey_horizontal_set(Evas_Object *obj, Eina_Bool horizontal_mode)
917 {
918    Widget_Data *wd;
919    char buff[32];
920    if (!obj) return;
921    wd = elm_widget_data_get(obj);
922    if (!wd) return;
923    wd->is_horizontal = horizontal_mode;
924    if (wd->panel)
925    {
926       if ((edje_object_data_get(wd->panel, "max_item_count") == NULL)
927                || (edje_object_data_get(wd->panel, "panel_height") == NULL)
928                || (edje_object_data_get(wd->panel, "panel_height_horizontal")
929                         == NULL))
930       {
931          wd->panel_suppported = EINA_FALSE;
932       }
933       else
934          wd->panel_suppported = EINA_TRUE;
935       if (wd->panel_suppported == EINA_TRUE)
936       {
937          if (wd->is_horizontal == EINA_TRUE)
938          {
939             snprintf(buff, sizeof(buff), "button_%d", (wd->panel_btn_idx
940                      + wd->max_button));
941             edje_object_signal_emit(wd->panel, buff, "panel_rect");
942             wd->panel_height
943                      = (int) (atoi(edje_object_data_get(wd->panel, buff))
944                               * wd->scale_factor);
945             evas_object_resize(
946                                wd->panel,
947                                wd->w,
948                                ((int) (atoi(
949                                             edje_object_data_get(wd->panel,
950                                                                  "panel_height_horizontal"))
951                                         * wd->scale_factor)));
952          }
953          else
954          {
955             snprintf(buff, sizeof(buff), "button_%d", (wd->panel_btn_idx));
956             edje_object_signal_emit(wd->panel, buff, "panel_rect");
957             wd->panel_height
958                      = (int) (atoi(edje_object_data_get(wd->panel, buff))
959                               * wd->scale_factor);
960             evas_object_resize(
961                                wd->panel,
962                                wd->w,
963                                ((int) (atoi(
964                                             edje_object_data_get(wd->panel,
965                                                                  "panel_height"))
966                                         * wd->scale_factor)));
967          }
968       }
969       _calc_win_height(wd);
970    }
971
972 }
973
974 /**
975  * add side button of softkey
976  * @param       obj     softkey object 
977  * @param       type softkey button type
978  * @param       icon The icon object to use for the item
979  * @param       label The text label to use for the item
980  * @param       func Convenience function to call when this item is selected
981  * @param       data Data to pass to convenience function
982  * @return      A handle to the item added
983  * 
984  * @ingroup     Softkey  
985  */
986 EAPI Elm_Softkey_Item *
987 elm_softkey_button_add(Evas_Object *obj, Elm_Softkey_Type type,
988                        Evas_Object *icon, const char *label, void
989                        (*func)(void *data, Evas_Object *obj, void *event_info),
990                        const void *data)
991 {
992    Widget_Data *wd;
993    Evas* evas;
994    char button_type[64];
995    Elm_Softkey_Item *it;
996
997    if (!obj) return NULL;
998    wd = elm_widget_data_get(obj);
999    if (!wd) return NULL;
1000
1001    if (wd->button[type])
1002    {
1003       printf("already created.\n");
1004       return NULL;
1005    }
1006
1007    /* get evas */
1008    evas = evas_object_evas_get(obj);
1009    if (!evas) return NULL;
1010
1011    /* set item data */
1012    it = ELM_NEW(Elm_Softkey_Item);
1013    it->obj = obj;
1014    it->func = func;
1015    it->data = data;
1016    it->label = NULL;
1017    it->icon = NULL;
1018    /* load button edj */
1019    if (wd->button[type] == NULL)
1020    {
1021       if (type == ELM_SK_LEFT_BTN)
1022       {
1023          strcpy(button_type, "button_left");
1024       }
1025       else
1026       {
1027          strcpy(button_type, "button_right");
1028       }
1029
1030       it->base = wd->button[type] = edje_object_add(evas);
1031       if (!wd->button[type])
1032       {
1033          free(it);
1034          return NULL;
1035       }
1036       _elm_theme_object_set(obj, wd->button[type], "softkey", button_type,
1037                             elm_widget_style_get(obj));
1038
1039       wd->button_show[type] = EINA_TRUE;
1040       if (evas_object_visible_get(obj))
1041       {
1042          evas_object_show(wd->button[type]);
1043       }
1044       evas_object_smart_member_add(wd->button[type], obj);
1045
1046       edje_object_signal_callback_add(wd->button[type], "elm,action,down", "",
1047                                       _softkey_down_cb, it);
1048       edje_object_signal_callback_add(wd->button[type], "elm,action,click", "",
1049                                       _softkey_up_cb, it);
1050
1051       evas_object_clip_set(wd->button[type], evas_object_clip_get(obj));
1052       if (wd->panel) evas_object_raise(wd->panel);
1053    }
1054
1055    _sizing_eval(obj);
1056
1057    elm_softkey_item_label_set(it, label);
1058    elm_softkey_item_icon_set(it, icon);
1059    if (wd->button[type])
1060       evas_object_data_set(wd->button[type], "item_data", it);
1061    else
1062    {
1063       if (it->label) eina_stringshare_del(it->label);
1064       it->label = NULL;
1065       free(it);
1066       return NULL;
1067    }
1068
1069    return it;
1070 }
1071
1072 /**
1073  * delete side button of softkey
1074  * @param       obj     softkey object 
1075  * @param       type softkey button type
1076  * 
1077  * @ingroup     Softkey  
1078  */
1079 EAPI void
1080 elm_softkey_button_del(Evas_Object *obj, Elm_Softkey_Type type)
1081 {
1082    Widget_Data *wd;
1083    Elm_Softkey_Item *it;
1084    Evas_Object *btn;
1085
1086    if (!obj)
1087    {
1088       printf("Invalid argument: softkey object is NULL\n");
1089       return;
1090    }
1091
1092    wd = elm_widget_data_get(obj);
1093    if (!wd) return;
1094
1095    btn = wd->button[type];
1096    if (!btn) return;
1097
1098    it = evas_object_data_get(btn, "item_data");
1099    //_delete_button(btn);
1100    edje_object_signal_callback_del(wd->button[type], "elm,action,down", "",
1101                                    _softkey_down_cb);
1102    edje_object_signal_callback_del(wd->button[type], "elm,action,click", "",
1103                                    _softkey_up_cb);
1104    evas_object_del(wd->button[type]);
1105    if (it->label) eina_stringshare_del(it->label);
1106    if (it->icon) evas_object_del(it->icon);
1107    free(it);
1108    wd->button[type] = NULL;
1109 }
1110
1111 /**
1112  * show button of softkey
1113  * @param       obj     softkey object 
1114  * @param       type    softkey button type
1115  *
1116  * @ingroup     Softkey  
1117  */
1118 EAPI void
1119 elm_softkey_button_show(Evas_Object *obj, Elm_Softkey_Type type)
1120 {
1121    _show_button(obj, type, EINA_TRUE);
1122 }
1123
1124 /**
1125  * hide button of softkey
1126  * @param       obj     softkey object 
1127  * @param       type    softkey button type
1128  *
1129  * @ingroup     Softkey  
1130  */
1131 EAPI void
1132 elm_softkey_button_hide(Evas_Object *obj, Elm_Softkey_Type type)
1133 {
1134    _show_button(obj, type, EINA_FALSE);
1135 }
1136
1137 /**
1138  * add item in panel
1139  * @param       obj     softkey object 
1140  * @param       icon The icon object
1141  * @param       label The text label to use for the item
1142  * @param       func Convenience function to call when this item is selected
1143  * @param       data Data to pass to convenience function
1144  * @return      A handle to the item added
1145  * 
1146  * @ingroup     Softkey  
1147  */
1148 EAPI Elm_Softkey_Item *
1149 elm_softkey_panel_item_add(Evas_Object *obj, Evas_Object *icon,
1150                            const char *label, void
1151                            (*func)(void *data, Evas_Object *obj,
1152                                    void *event_info), const void *data)
1153 {
1154    Widget_Data *wd;
1155    Evas *evas;
1156    char button_name[32];
1157    Evas_Object *btn;
1158    Elm_Softkey_Item *it;
1159    char buff[PATH_MAX];
1160
1161    wd = elm_widget_data_get(obj);
1162    if (!wd)
1163    {
1164       printf("Cannot get smart data\n");
1165       return NULL;
1166    }
1167
1168    /* get evas */
1169    evas = evas_object_evas_get(obj);
1170    if (!evas) return NULL;
1171
1172    if (wd->panel == NULL)
1173    {
1174       /* create panel */
1175       wd->bg_rect = evas_object_rectangle_add(evas);
1176       if (!wd->bg_rect) return NULL;
1177       evas_object_color_set(wd->bg_rect, 10, 10, 10, 150);
1178       evas_object_pass_events_set(wd->bg_rect, 0);
1179
1180       if (wd->bg_rect)
1181       {
1182          evas_object_resize(wd->bg_rect, wd->w, wd->win_h);
1183          evas_object_event_callback_add(wd->bg_rect, EVAS_CALLBACK_MOUSE_UP,
1184                                         _bg_click_cb, obj);
1185          evas_object_smart_member_add(wd->bg_rect, obj);
1186       }
1187
1188       wd->panel = edje_object_add(evas);
1189       if (!wd->panel) return NULL;
1190       _elm_theme_object_set(obj, wd->panel, "softkey", "panel",
1191                             elm_widget_style_get(obj));
1192
1193       evas_object_move(wd->panel, 0, wd->win_h);
1194       edje_object_signal_callback_add(wd->panel, "clicked", "close_btn",
1195                                       _close_btn_click_cb, obj);
1196       evas_object_smart_member_add(wd->panel, obj);
1197       if (evas_object_visible_get(obj))
1198       {
1199          evas_object_show(wd->panel);
1200       }
1201       wd->panel_height = 0;
1202       if ((edje_object_data_get(wd->panel, "max_item_count") == NULL)
1203                || (edje_object_data_get(wd->panel, "panel_height") == NULL)
1204                || (edje_object_data_get(wd->panel, "panel_height_horizontal")
1205                         == NULL))
1206       {
1207          //If this key is not found in data section, then it means the panel won't come.
1208          wd->max_button = 0;
1209          // delete panel
1210          if (wd->panel)
1211          {
1212             elm_softkey_panel_del(obj);
1213          }
1214          wd->panel_suppported = EINA_FALSE;
1215          return NULL;
1216       }
1217       else
1218       {
1219          wd->max_button = (int) (atoi(edje_object_data_get(wd->panel,
1220                                                            "max_item_count")));
1221          if (wd->is_horizontal)
1222          {
1223             evas_object_resize(
1224                                wd->panel,
1225                                wd->w,
1226                                ((int) (atoi(
1227                                             edje_object_data_get(wd->panel,
1228                                                                  "panel_height_horizontal"))
1229                                         * wd->scale_factor)));
1230          }
1231          else
1232          {
1233             evas_object_resize(
1234                                wd->panel,
1235                                wd->w,
1236                                ((int) (atoi(
1237                                             edje_object_data_get(wd->panel,
1238                                                                  "panel_height"))
1239                                         * wd->scale_factor)));
1240          }
1241       }
1242
1243       evas_object_clip_set(wd->panel, evas_object_clip_get(obj));
1244    }
1245
1246    wd->panel_btn_idx++;
1247    if (wd->panel_btn_idx >= wd->max_button) return NULL;
1248
1249    /* set item data */
1250    it = ELM_NEW(Elm_Softkey_Item);
1251    it->obj = obj;
1252    if (label) it->label = eina_stringshare_add(label);
1253    it->icon = icon;
1254    it->func = func;
1255    it->data = data;
1256    /* load panel button */
1257    it->base = btn = edje_object_add(evas);
1258    if (!btn)
1259    {
1260       if (it->label) eina_stringshare_del(it->label);
1261       free(it);
1262       wd->panel_btn_idx--;
1263       return NULL;
1264    }
1265    _elm_theme_object_set(obj, btn, "softkey", "panel_button",
1266                          elm_widget_style_get(obj));
1267
1268    edje_object_part_text_set(btn, "elm.text", label); /* set text */
1269    //edje_object_message_signal_process(btn);
1270
1271    if (wd->panel)
1272    {
1273       /* swallow button */
1274       snprintf(button_name, sizeof(button_name), "panel_button_area_%d",
1275                wd->panel_btn_idx);
1276       edje_object_part_swallow(wd->panel, button_name, btn);
1277
1278       if (wd->is_horizontal)
1279       {
1280          snprintf(buff, sizeof(buff), "button_%d", wd->max_button
1281                   + wd->panel_btn_idx);
1282          edje_object_signal_emit(wd->panel, buff, "panel_rect");
1283          const char* val = edje_object_data_get(wd->panel, buff);
1284          if (val)
1285             wd->panel_height = (int) (atoi(val) * wd->scale_factor);
1286          else
1287          {
1288             if (it->label) eina_stringshare_del(it->label);
1289             evas_object_del(it->base);
1290             free(it);
1291             wd->panel_btn_idx--;
1292             return NULL;
1293          }
1294       }
1295       else
1296       {
1297          snprintf(buff, sizeof(buff), "button_%d", wd->panel_btn_idx);
1298          edje_object_signal_emit(wd->panel, buff, "panel_rect");
1299          const char* val = edje_object_data_get(wd->panel, buff);
1300          if (val)
1301             wd->panel_height = (int) (atoi(val) * wd->scale_factor);
1302          else
1303          {
1304             if (it->label) eina_stringshare_del(it->label);
1305             evas_object_del(it->base);
1306             free(it);
1307             wd->panel_btn_idx--;
1308             return NULL;
1309          }
1310       }
1311    }
1312    else
1313    {
1314       wd->panel_btn_idx--;
1315       return NULL;
1316    }
1317    evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN,
1318                                   _panel_down_cb, it);
1319    evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, _panel_up_cb, it);
1320    wd->items = eina_list_append(wd->items, it);
1321    if (evas_object_visible_get(obj))
1322    {
1323       /* show more button */
1324       edje_object_signal_emit(wd->lay, "more_btn_show", "");
1325    }
1326    return it;
1327 }
1328
1329 /**
1330  * delete panel
1331
1332  * @param obj softkey object
1333  * @return int 0 (SUCCESS) or -1 (FAIL)
1334  *
1335  * @ingroup Softkey
1336  */
1337 EAPI int
1338 elm_softkey_panel_del(Evas_Object *obj)
1339 {
1340    Widget_Data *wd;
1341    char button_name[32];
1342    Evas_Object *btn;
1343    int i;
1344    Elm_Softkey_Item *it;
1345
1346    wd = elm_widget_data_get(obj);
1347    if (!wd) return -1;
1348    if (wd->panel == NULL) return -1;
1349    if (wd->animator)
1350    {
1351       ecore_animator_del(wd->animator);
1352       wd->animator = NULL;
1353       wd->animating = EINA_FALSE;
1354    }
1355    /* delete background */
1356    if (wd->bg_rect)
1357    {
1358       //evas_object_event_callback_del(wd->bg_rect, EVAS_CALLBACK_MOUSE_UP, _bg_click_cb);
1359       evas_object_del(wd->bg_rect);
1360       wd->bg_rect = NULL;
1361    }
1362
1363    for (i = 1; i <= wd->panel_btn_idx; i++)
1364    {
1365       snprintf(button_name, sizeof(button_name), "panel_button_area_%d", i);
1366       btn = edje_object_part_swallow_get(wd->panel, button_name);
1367       //_delete_button(btn);
1368       if (btn)
1369       {
1370          //edje_object_part_unswallow(wd->panel, btn);
1371          //evas_object_event_callback_del(btn, EVAS_CALLBACK_MOUSE_DOWN, _panel_down_cb);
1372          //evas_object_event_callback_del(btn, EVAS_CALLBACK_MOUSE_UP, _panel_up_cb);
1373          evas_object_del(btn);
1374       }
1375    }
1376
1377    EINA_LIST_FREE(wd->items, it)
1378    {
1379       if (it->label) eina_stringshare_del(it->label);
1380       it->base = NULL;
1381       if (it->icon) it->icon = NULL;
1382       free(it);
1383    }
1384
1385    wd->panel_btn_idx = 0;
1386    wd->panel_height = 0;
1387
1388    //hide more button
1389    edje_object_signal_emit(wd->lay, "more_btn_hide", "");
1390
1391    if (wd->panel)
1392    {
1393       //evas_object_move(wd->panel, 0, wd->win_h);
1394       evas_object_clip_unset(wd->panel);
1395       evas_object_del(wd->panel);
1396       wd->show_panel = EINA_FALSE;
1397       wd->panel = NULL;
1398    }
1399
1400    return 0;
1401 }
1402
1403 /**
1404  * sliding up panel if it is closed
1405
1406  * @param obj softkey object
1407  * @return int 0 (SUCCESS) or -1 (FAIL)
1408  *
1409  * @ingroup Softkey
1410  */
1411 EAPI int
1412 elm_softkey_panel_open(Evas_Object *obj)
1413 {
1414    Widget_Data *wd;
1415    wd = elm_widget_data_get(obj);
1416
1417    if (!wd) return -1;
1418    if (!wd->panel) return -1;
1419
1420    if (wd->show_panel == EINA_FALSE)
1421    {
1422       _more_btn_click_cb(obj, NULL, NULL, NULL);
1423    }
1424
1425    return 0;
1426 }
1427
1428 /**
1429  * sliding down panel if it is opened
1430
1431  * @param obj softkey object
1432  * @return int 0 (SUCCESS) or -1 (FAIL)
1433  *
1434  * @ingroup Softkey
1435  */
1436 EAPI int
1437 elm_softkey_panel_close(Evas_Object *obj)
1438 {
1439    Widget_Data *wd;
1440    wd = elm_widget_data_get(obj);
1441    if (!wd) return -1;
1442
1443    if (wd->panel == NULL) return -1;
1444
1445    if (wd->show_panel == EINA_TRUE)
1446    {
1447       _close_btn_click_cb(obj, obj, NULL, NULL);
1448    }
1449
1450    return 0;
1451 }
1452
1453 /**
1454  * Set the icon of an softkey item
1455  *
1456  * @param it The item to set the icon
1457  * @param icon The icon object
1458  *
1459  * @ingroup Softkey
1460  */
1461 EAPI void
1462 elm_softkey_item_icon_set(Elm_Softkey_Item *it, Evas_Object *icon)
1463 {
1464    if (!it) return;
1465
1466    if ((it->icon != icon) && (it->icon))
1467    {
1468       //elm_widget_sub_object_del(it->obj, it->icon);
1469       evas_object_del(it->icon);
1470       it->icon = NULL;
1471    }
1472
1473    if ((icon) && (it->icon != icon))
1474    {
1475       it->icon = icon;
1476       //elm_widget_sub_object_add(it->obj, icon);
1477       edje_object_part_swallow(it->base, "elm.swallow.icon", icon);
1478       edje_object_signal_emit(it->base, "elm,state,icon,visible", "elm");
1479       //edje_object_message_signal_process(it->base);
1480       _sizing_eval(it->obj);
1481    }
1482    else
1483       it->icon = icon;
1484 }
1485
1486 /**
1487  * Get the icon of an softkey item
1488  *
1489  * @param it The item to get the icon
1490  * @return The icon object
1491  *
1492  * @ingroup Softkey
1493  */
1494 EAPI Evas_Object *
1495 elm_softkey_item_icon_get(Elm_Softkey_Item *it)
1496 {
1497    if (!it) return NULL;
1498    return it->icon;
1499 }
1500
1501 /**
1502  * Get the text label of an softkey item
1503  *
1504  * @param it The item to set the label
1505  * @param label label
1506  *
1507  * @ingroup Softkey
1508  */
1509 EAPI void
1510 elm_softkey_item_label_set(Elm_Softkey_Item *it, const char *label)
1511 {
1512    if (!it) return;
1513    if (it->label) eina_stringshare_del(it->label);
1514
1515    if (label)
1516    {
1517       it->label = eina_stringshare_add(label);
1518       edje_object_signal_emit(it->base, "elm,state,text,visible", "elm");
1519
1520       /* set text */
1521       edje_object_part_text_set(it->base, "elm.text", label == NULL ? ""
1522                                                                     : label);
1523    }
1524    else
1525    {
1526       it->label = NULL;
1527       edje_object_signal_emit(it->base, "elm,state,text,hidden", "elm");
1528    }
1529    //edje_object_message_signal_process(it->base);
1530 }
1531
1532 /**
1533  * Set the item callback function 
1534  *
1535  * @param it Item to set callback function.
1536  * @param func callback function pointer.
1537  * @param data callback function argument data.
1538  *
1539  * @ingroup Softkey
1540  */
1541 EAPI void
1542 elm_softkey_item_callback_set(Elm_Softkey_Item* item, void
1543 (*func)(void *data, Evas_Object *obj, void *event_info), const void *data)
1544 {
1545    if (!item) return;
1546
1547    item->func = func;
1548    item->data = data;
1549
1550 }
1551
1552 /**
1553  * Get the text label of an softkey item
1554  *
1555  * @param it The item to get the label
1556  * @return The text label of the softkey item
1557  *
1558  * @ingroup Softkey
1559  */
1560 EAPI const char *
1561 elm_softkey_item_label_get(Elm_Softkey_Item *it)
1562 {
1563    if (!it) return NULL;
1564    return it->label;
1565 }
1566
1567 EAPI Eina_Bool
1568 elm_softkey_item_disabled_get(Elm_Softkey_Item *it)
1569 {
1570    if (!it) return EINA_FALSE;
1571    return it->disabled;
1572 }
1573
1574 EAPI void
1575 elm_softkey_item_disabled_set(Elm_Softkey_Item *it, Eina_Bool disabled)
1576 {
1577    if (!it) return;
1578    _item_disable(it, disabled);
1579 }