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