[navigationbar]: active sync app, text overlapping issue.
[framework/uifw/elementary.git] / src / lib / elm_dialoguegroup.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3 #include <Ecore.h>
4
5 /**
6  * @defgroup DialogueGroup DialogueGroup 
7  * @ingroup Elementary
8  *
9  * Using dialoguegroup, you can make a dialogue group.
10  */
11
12 struct _Dialogue_Item
13 {
14    Evas_Object *obj;
15    Evas_Object *bg_layout;
16    Evas_Object *content;
17    Elm_Dialoguegroup_Item_Style style;
18    const char *location;
19    Eina_Bool press;
20    Eina_Bool disabled;
21    //   Eina_Bool line_show;
22 };
23
24
25 typedef struct _Widget_Data Widget_Data;
26 struct _Widget_Data
27 {
28    Evas_Object *box;
29    Evas_Object *title_layout;
30    const char *title;
31    unsigned int num;
32    Eina_List *items;
33 };
34
35 static const char*widtype = NULL;
36
37 static void _del_hook(Evas_Object *obj);
38 static void _theme_hook(Evas_Object *obj);
39 static void _sizing_eval(Evas_Object *obj);
40
41 static void _remove_all(Evas_Object *obj);
42 static void _set_item_theme(Dialogue_Item *item, const char *location);
43 static void _change_item_bg(Dialogue_Item *item, const char *location);
44 static Dialogue_Item* _create_item(Evas_Object *obj, Evas_Object *subobj, Elm_Dialoguegroup_Item_Style style, const char *location);
45
46
47 static void
48 _del_hook(Evas_Object *obj)
49 {
50    Widget_Data *wd = elm_widget_data_get(obj);
51    
52    if (!wd) return;
53    if (wd->title) eina_stringshare_del(wd->title);
54    
55    _remove_all(obj);
56    
57    if (wd->box){
58       evas_object_del(wd->box);
59       wd->box = NULL;
60    }
61    
62    free(wd);
63 }
64
65
66 static void
67 _theme_hook(Evas_Object *obj)
68 {
69    Widget_Data *wd = elm_widget_data_get(obj);
70    Eina_List *l;
71    Dialogue_Item *item; 
72    
73    if (!wd) return;     
74    if (wd->title) {
75       elm_layout_theme_set(wd->title_layout, "dialoguegroup", "title", elm_widget_style_get(obj));
76       edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", wd->title);
77    }
78    EINA_LIST_FOREACH(wd->items, l, item) 
79      _change_item_bg( item, item->location );   
80    _sizing_eval(obj);
81 }
82
83 static void
84 _sizing_eval(Evas_Object *obj)
85 {
86    Widget_Data *wd = elm_widget_data_get(obj);
87    Evas_Coord minw, minh, maxw, maxh;
88    
89    if (!wd) return;
90    evas_object_size_hint_min_get(wd->box, &minw, &minh);
91    evas_object_size_hint_max_get(wd->box, &maxw, &maxh);
92    evas_object_size_hint_min_set(obj, minw, minh);
93    evas_object_size_hint_max_set(obj, maxw, maxh);
94 }
95
96 static void 
97 _remove_all(Evas_Object *obj)
98 {
99    Widget_Data *wd = elm_widget_data_get(obj);
100    Dialogue_Item *item; 
101    
102    if (!wd) return;
103    
104    wd->num = 0;
105    
106    if (wd->items) {
107       EINA_LIST_FREE(wd->items, item) {
108          if (item->content){
109             evas_object_del(item->content);
110             item->content = NULL;
111          }
112          if (item->bg_layout){
113             evas_object_del(item->bg_layout);
114             item->bg_layout = NULL;
115          }
116          if (item->location)
117            eina_stringshare_del(item->location);
118          free(item);
119       }
120    }
121 }
122
123 static void 
124 _set_item_theme(Dialogue_Item *item, const char *location)
125 {
126    if (!item) return;
127    char buf[30];
128    
129    if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT) 
130      snprintf(buf, sizeof(buf), "bg_%s", location);
131    else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD) 
132      snprintf(buf, sizeof(buf), "editfield_%s", location);
133    else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD_WITH_TITLE) 
134      snprintf(buf, sizeof(buf), "editfield_with_title_%s", location);
135    else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDIT_TITLE) 
136      snprintf(buf, sizeof(buf), "edit_title_%s", location);
137    else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_HIDDEN) 
138      snprintf(buf, sizeof(buf), "hidden_%s", location);
139    else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DATAVIEW) 
140      snprintf(buf, sizeof(buf), "dataview_%s", location);
141    else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_NO_BG) 
142      snprintf(buf, sizeof(buf), "no_bg_%s", location);
143    else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_SUB) 
144      snprintf(buf, sizeof(buf), "sub_%s", location);
145    elm_layout_theme_set(item->bg_layout, "dialoguegroup", buf, elm_widget_style_get(item->obj));
146 }
147
148 /*
149    static void _set_line_show(Dialogue_Item *item, Dialogue_Item *after)
150    {
151    if(!item || !after) return;
152
153    if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT) {
154    if (after->style == ELM_DIALOGUEGROUP_ITEM_STYLE_DEFAULT) {
155    item->line_show = EINA_TRUE;
156    edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,show", "elm"); 
157    }
158    else if (after->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD) {
159    item->line_show = EINA_FALSE;
160    edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,hide", "elm"); 
161    }    
162    }
163    else if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_EDITFIELD) 
164    item->line_show = EINA_TRUE; 
165    }
166 */
167
168 static void 
169 _change_item_bg(Dialogue_Item *item, const char *location)
170 {
171    if (!item) return;
172    
173    eina_stringshare_replace(&item->location, location);
174    _set_item_theme(item, location);
175    elm_layout_content_set(item->bg_layout, "swallow", item->content);
176    if ((item->press == EINA_TRUE) && (item->disabled == EINA_FALSE))
177      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
178    else
179      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");   
180    if (item->disabled == EINA_TRUE)
181      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,disabled", "elm");
182    else
183      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,enabled", "elm");
184    
185    if (item->style == ELM_DIALOGUEGROUP_ITEM_STYLE_SUB)
186      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "flip_item", "");
187
188    /*   if(item->line_show == EINA_FALSE)
189     edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,line,hide", "elm");*/
190    
191 }
192
193 static Dialogue_Item* 
194 _create_item(Evas_Object *obj, Evas_Object *subobj, Elm_Dialoguegroup_Item_Style style, const char *location)
195 {
196    Widget_Data *wd = elm_widget_data_get(obj);
197    Dialogue_Item *item;
198    
199    if (!wd) return NULL;
200    
201    item = ELM_NEW(Dialogue_Item);
202    item->obj = obj;
203    item->content = subobj;
204    item->press = EINA_TRUE;
205    item->disabled = EINA_FALSE;
206    item->style = style;
207    //   item->line_show = EINA_TRUE;
208    eina_stringshare_replace(&item->location, location);
209    
210    item->bg_layout = elm_layout_add(wd->box);
211    _set_item_theme(item, location);
212    evas_object_size_hint_weight_set(item->bg_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
213    evas_object_size_hint_align_set(item->bg_layout, EVAS_HINT_FILL, 0.0);
214    evas_object_show(item->bg_layout);   
215    
216    elm_layout_content_set(item->bg_layout, "swallow", item->content);
217    
218    return item;
219 }
220
221 static void 
222 _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
223 {
224    _sizing_eval(data);
225 }
226
227 /**
228  * Add a new dialoguegroup to the parent.
229  *
230  * @param parent The parent object
231  * @return The new object or NULL if it cannot be created
232  *
233  * @ingroup DialogueGroup
234  */
235 EAPI Evas_Object *
236 elm_dialoguegroup_add(Evas_Object *parent)
237 {
238    Evas_Object *obj = NULL;
239    Widget_Data *wd = NULL;
240    Evas *e = NULL;
241    
242    e = evas_object_evas_get(parent);
243    if (e == NULL) return NULL;
244    wd = ELM_NEW(Widget_Data);
245    obj = elm_widget_add(e);
246    ELM_SET_WIDTYPE(widtype, "dialoguegroup");
247    elm_widget_type_set(obj, "dialoguegroup");
248    elm_widget_sub_object_add(parent, obj);
249    elm_widget_data_set(obj, wd);
250    elm_widget_del_hook_set(obj, _del_hook);
251    elm_widget_theme_hook_set(obj, _theme_hook);
252    
253    wd->num = 0;
254    
255    wd->box = elm_box_add(obj);
256    evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
257    evas_object_show(wd->box);
258    elm_widget_resize_object_set(obj, wd->box);
259    
260    _sizing_eval(obj);
261    return obj;
262 }
263
264 /**
265  * Append an item to the dialogue group.
266  *
267  * @param obj dialoguegroup object 
268  * @param subobj item
269  * @param style sytle of the item
270  * @return Dialogue_Item pointer, just made by this function
271  * 
272  * @ingroup DialogueGroup
273  */
274 EAPI Dialogue_Item *
275 elm_dialoguegroup_append(Evas_Object *obj, Evas_Object *subobj, Elm_Dialoguegroup_Item_Style style)
276 {
277    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
278    Widget_Data *wd = elm_widget_data_get(obj);
279    Dialogue_Item *item = NULL, *new_item = NULL;        
280    
281    if (!wd || !subobj) return NULL;
282    
283    if (!wd->items) 
284      new_item = _create_item(obj, subobj, style, "default");
285    else {
286       if (wd->num == 1) {       
287          item = eina_list_data_get(wd->items);
288          _change_item_bg(item, "top");          
289       }         
290       else {
291          item = eina_list_data_get( eina_list_last(wd->items) );
292          _change_item_bg(item, "middle");               
293       }
294       new_item = _create_item(obj, subobj, style, "bottom");
295       //                _set_line_show(item, new_item);
296    }
297    elm_box_pack_end(wd->box, new_item->bg_layout);
298    if (style == ELM_DIALOGUEGROUP_ITEM_STYLE_SUB)
299      edje_object_signal_emit(elm_layout_edje_get(new_item->bg_layout), "flip_item", "");
300    wd->items = eina_list_append(wd->items, new_item);                   
301    wd->num++;
302    _sizing_eval(obj);
303    return new_item;
304 }
305
306
307 /**
308  * Prepend an item to the dialogue group.
309  *
310  * @param obj dialoguegroup object 
311  * @param subobj item
312  * @param style sytle of the item
313  * @return Dialogue_Item pointer, just made by this function
314  *
315  * @ingroup DialogueGroup
316  */
317 EAPI Dialogue_Item *
318 elm_dialoguegroup_prepend(Evas_Object *obj, Evas_Object *subobj, Elm_Dialoguegroup_Item_Style style)
319 {
320    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
321    Widget_Data *wd = elm_widget_data_get(obj);
322    Dialogue_Item *item = NULL, *new_item = NULL;
323    
324    if (!wd || !subobj) return NULL;
325    
326    if (!wd->items)
327      new_item = _create_item(obj, subobj, style, "default");    
328    else {
329       if (wd->num == 1) {       
330          item = eina_list_data_get(wd->items);
331          _change_item_bg(item, "bottom");
332       }         
333       else {
334          item = eina_list_data_get(wd->items);
335          _change_item_bg(item, "middle");               
336       }
337       new_item = _create_item(obj, subobj, style, "top");
338       //                _set_line_show(new_item, item);
339    }
340    if (wd->title_layout)
341      elm_box_pack_after(wd->box, new_item->bg_layout, wd->title_layout);        
342    else                 
343      elm_box_pack_start(wd->box, new_item->bg_layout);          
344    if (style == ELM_DIALOGUEGROUP_ITEM_STYLE_SUB) 
345      edje_object_signal_emit(elm_layout_edje_get(new_item->bg_layout), "flip_item", "");
346    wd->items = eina_list_prepend(wd->items, new_item);          
347    wd->num++;
348    _sizing_eval(obj);
349    return new_item;
350 }
351
352 /**
353  * Insert an item to the dialogue group just after the specified item.
354  *
355  * @param obj dialoguegroup object 
356  * @param subobj item
357  * @param after specified item existing in the dialogue group
358  * @param style sytle of the item
359  * @return Dialogue_Item pointer, just made by this function
360  *
361  * @ingroup DialogueGroup
362  */
363 EAPI Dialogue_Item * 
364 elm_dialoguegroup_insert_after(Evas_Object *obj, Evas_Object *subobj, Dialogue_Item *after, Elm_Dialoguegroup_Item_Style style)
365 {
366    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
367    Widget_Data *wd = elm_widget_data_get(obj);
368    Dialogue_Item *after_item = NULL, *item = NULL;
369    Eina_List *l;
370    
371    if (!wd || !subobj || !after || !wd->items) return NULL;
372    
373    EINA_LIST_FOREACH(wd->items, l, after_item) {
374       if (after == after_item) {
375          if ( !strcmp(after_item->location, "default") ) {
376             _change_item_bg(after_item, "top");
377             item = _create_item(obj, subobj, style, "bottom");
378          }                      
379          else if ( !strcmp(after_item->location, "top") || !strcmp(after_item->location, "middle") )    
380            item = _create_item(obj, subobj, style, "middle");           
381          else if ( !strcmp(after_item->location, "bottom") ) {
382             _change_item_bg(after_item, "middle");
383             item = _create_item(obj, subobj, style, "bottom");          
384          }
385          elm_box_pack_after(wd->box, item->bg_layout, after_item->bg_layout);
386          if (style == ELM_DIALOGUEGROUP_ITEM_STYLE_SUB) 
387            edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "flip_item", "");
388          wd->items = eina_list_append_relative(wd->items, item, after_item);
389          //     _set_line_show(after, item);
390       }         
391    }
392    
393    wd->num++;
394    _sizing_eval(obj);
395    return item;
396 }
397
398 /**
399  * Insert an item to the dialogue group just before the specified item.
400  *
401  * @param obj dialoguegroup object 
402  * @param subobj item
403  * @param before specified item existing in the dialogue group
404  * @param style sytle of the item
405  * @return Dialogue_Item pointer, just made by this function
406  *
407  * @ingroup DialogueGroup
408  */
409 EAPI Dialogue_Item *
410 elm_dialoguegroup_insert_before(Evas_Object *obj, Evas_Object *subobj, Dialogue_Item *before, Elm_Dialoguegroup_Item_Style style)
411 {
412    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
413    Widget_Data *wd = elm_widget_data_get(obj);
414    Dialogue_Item *before_item = NULL, *item = NULL;
415    Eina_List *l;
416    Eina_List *prev;
417    
418    if (!wd || !subobj || !before || !wd->items) return NULL;
419    
420    EINA_LIST_FOREACH(wd->items, l, before_item) {
421       if (before == before_item) {
422          if ( !strcmp(before_item->location, "default") ) {
423             _change_item_bg(before_item, "bottom");
424             item = _create_item(obj, subobj, style, "top");
425          }
426          
427          else if ( !strcmp(before_item->location, "top") ) {
428             _change_item_bg(before_item, "middle");
429             item = _create_item(obj, subobj, style, "top");                     
430          }
431          
432          else if ( !strcmp(before_item->location, "middle") || !strcmp(before_item->location, "bottom") ) {
433             item = _create_item(obj, subobj, style, "middle");
434             prev = eina_list_prev(l);
435             //  _set_line_show(prev->data, item);
436          }
437          elm_box_pack_before(wd->box, item->bg_layout, before_item->bg_layout);
438          if (style == ELM_DIALOGUEGROUP_ITEM_STYLE_SUB) 
439            edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "flip_item", "");
440          wd->items = eina_list_prepend_relative(wd->items, item, before_item);
441       }         
442    }
443    
444    wd->num++;
445    _sizing_eval(obj);   
446    return item;
447 }
448
449 /**
450  * Remove an item from the dialogue group.
451  *
452  * @param obj dialoguegroup object 
453  * @param subobj item
454  *
455  * @ingroup DialogueGroup
456  */
457 EAPI void
458 elm_dialoguegroup_remove(Dialogue_Item *item)
459 {
460    if (!item) return;
461    ELM_CHECK_WIDTYPE(item->obj, widtype) ;
462    Dialogue_Item *current_item;
463    Widget_Data *wd = elm_widget_data_get(item->obj);
464    Eina_List *l;
465    
466    if (!wd || !wd->items || !item) return ;
467    
468    EINA_LIST_FOREACH(wd->items, l, current_item) {
469       if (current_item == item) {
470          if (current_item->content){
471             evas_object_del(current_item->content);
472             current_item->content = NULL;
473          }
474          if (current_item->bg_layout){
475             evas_object_del(current_item->bg_layout);
476             current_item->bg_layout = NULL;
477          }
478          elm_box_unpack(wd->box, current_item->bg_layout);                      
479          wd->items = eina_list_remove(wd->items, current_item);
480       }
481    }
482    
483    wd->num--;
484    
485    if (wd->num == 0) return;
486    
487    if (wd->num == 1) {
488       current_item = eina_list_data_get(wd->items);
489       _change_item_bg(current_item, "default");
490    }
491    
492    else {               
493       current_item = eina_list_data_get(wd->items);
494       _change_item_bg(current_item, "top");
495       current_item = eina_list_data_get( eina_list_last(wd->items) );
496       _change_item_bg(current_item, "bottom");          
497    }
498    
499    _sizing_eval(item->obj);  
500 }
501
502 /**
503  * Remove all items from the dialogue group.
504  *
505  * @param obj dialoguegroup object 
506  *
507  * @ingroup DialogueGroup
508  */
509 EAPI void
510 elm_dialoguegroup_remove_all(Evas_Object *obj)
511 {
512    ELM_CHECK_WIDTYPE(obj, widtype);
513    _remove_all(obj);    
514    _sizing_eval(obj);   
515 }
516
517
518 /**
519  * Set the title text of the  dialogue group.
520  *
521  * @param obj dialoguegroup object 
522  * @param title title text, if NULL title space will be disappeared 
523  * 
524  * @ingroup DialogueGroup
525  */
526 EAPI void 
527 elm_dialoguegroup_title_set(Evas_Object *obj, const char *title)
528 {
529    ELM_CHECK_WIDTYPE(obj, widtype);
530    Widget_Data *wd = elm_widget_data_get(obj);
531    
532    if (!wd) return ;
533    eina_stringshare_replace(&wd->title, title);
534    if (!title) {
535       wd->title = NULL;         
536       elm_box_unpack(wd->box, wd->title_layout);                
537    }    
538    if (!wd->title_layout) {
539       wd->title_layout = elm_layout_add(wd->box);
540       elm_layout_theme_set(wd->title_layout, "dialoguegroup", "title", elm_widget_style_get(obj));
541       evas_object_size_hint_weight_set(wd->title_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
542       evas_object_size_hint_align_set(wd->title_layout, EVAS_HINT_FILL, 0.0);
543       evas_object_show(wd->title_layout);       
544       edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", title);
545       elm_box_pack_start(wd->box, wd->title_layout);
546    }
547    edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", title);
548 }
549
550 /**
551  * Get the title text of the dialogue group
552  *
553  * @param obj The dialoguegroup object
554  * @return The text title string in UTF-8
555  *
556  * @ingroup DialogueGroup
557  */
558 EAPI const char *
559 elm_dialoguegroup_title_get(Evas_Object *obj)
560 {
561    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
562    Widget_Data *wd = elm_widget_data_get(obj);
563    if (!wd) return NULL;
564    return wd->title;
565 }
566
567 /**
568  * Set whether the press effect will be shown or not
569  *
570  * @param obj The dialoguegroup object
571  * @param item Dialogue_Item pointer
572  * @param press If set as 1, press effect will be shown 
573  *
574  * @ingroup DialogueGroup 
575  */
576 EAPI void 
577 elm_dialoguegroup_press_effect_set(Dialogue_Item *item, Eina_Bool press)
578 {
579    if (!item) return;
580    ELM_CHECK_WIDTYPE(item->obj, widtype) ;
581    
582    item->press = press;
583    if ((press == EINA_TRUE) && (item->disabled == EINA_FALSE))
584      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
585    else
586      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");       
587 }
588
589 /**
590  * Get the press effect state
591  *
592  * @param obj The dialoguegroup object
593  * @param item Dialogue_Item pointer
594  * @return 1 if press effect on, 0 if press effect off 
595  *
596  * @ingroup DialogueGroup 
597  */
598 EAPI Eina_Bool
599 elm_dialoguegroup_press_effect_get(Dialogue_Item *item)
600 {
601    if (!item) return EINA_FALSE;
602    ELM_CHECK_WIDTYPE(item->obj, widtype) EINA_FALSE;
603    
604    return item->press;
605 }
606
607 /**
608  * Get the conetent object from the specified dialogue item
609  *
610  * @param obj The dialoguegroup object
611  * @param item Dialogue_Item pointer
612  * @return content object 
613  *
614  * @ingroup DialogueGroup 
615  */
616 EAPI Evas_Object *
617 elm_dialoguegroup_item_content_get(Dialogue_Item *item)
618 {
619    if (!item) return NULL;
620    ELM_CHECK_WIDTYPE(item->obj, widtype) EINA_FALSE;
621    
622    return item->content;
623 }
624
625 /**
626  * Set the style of the item.
627  *
628  * @param item dialoguegroup item
629  * @param style sytle of the item
630  * 
631  * @ingroup DialogueGroup
632  */
633 EAPI void 
634 elm_dialoguegroup_item_style_set(Dialogue_Item *item, Elm_Dialoguegroup_Item_Style style)
635 {
636    if (!item) return;
637    ELM_CHECK_WIDTYPE(item->obj, widtype);
638    Widget_Data *wd = elm_widget_data_get(item->obj);
639    
640    item->style = style;
641    _change_item_bg(item, item->location);
642    
643    if (!wd) return ;
644 }
645
646 /**
647  * Get the style of the item.
648  *
649  * @param item dialoguegroup item
650  * @return dialoguegroup item style
651  * 
652  * @ingroup DialogueGroup
653  */
654
655 EAPI Elm_Dialoguegroup_Item_Style
656 elm_dialoguegroup_item_style_get(Dialogue_Item *item)
657 {
658    if (!item) return ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
659    ELM_CHECK_WIDTYPE(item->obj, widtype) ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
660    Widget_Data *wd = elm_widget_data_get(item->obj);
661    
662    if (!wd) return ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
663    
664    return item->style;
665 }
666
667 /**
668  * Set item state as disable or not.
669  *
670  * @param item dialoguegroup item.
671  * @param disabled if EINA_TRUE disabled, else abled. 
672  * 
673  * @ingroup DialogueGroup
674  */
675 EAPI void 
676 elm_dialoguegroup_item_disabled_set(Dialogue_Item *item, Eina_Bool disabled)
677 {
678    if (!item) return;
679    ELM_CHECK_WIDTYPE(item->obj, widtype);
680    
681    item->disabled = disabled;
682    
683    if (disabled == EINA_TRUE)
684      {
685         edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,disabled", "elm");
686         edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");    
687      }
688    else
689      {
690         edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,enabled", "elm");
691         if (item->press == EINA_TRUE)
692           edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
693      }
694 }
695
696 /**
697  * Get item state whether disabled or not.
698  *
699  * @param item dialoguegroup item.
700  * @return if EINA_TRUE, then disabled else abled.
701  * 
702  * @ingroup DialogueGroup
703  */
704
705 EAPI Eina_Bool
706 elm_dialoguegroup_item_disabled_get(Dialogue_Item *item)
707 {
708    if (!item) return EINA_FALSE;
709    ELM_CHECK_WIDTYPE(item->obj, widtype) EINA_FALSE;
710    
711    return item->disabled;
712 }
713
714 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
715