9a1c796c08ff3e1f4cd7f194dc0bab840894c9f0
[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          if (!item)
386             return NULL;
387          elm_box_pack_after(wd->box, item->bg_layout, after_item->bg_layout);
388          if (style == ELM_DIALOGUEGROUP_ITEM_STYLE_SUB) 
389            edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "flip_item", "");
390          wd->items = eina_list_append_relative(wd->items, item, after_item);
391          //     _set_line_show(after, item);
392       }         
393    }
394    
395    wd->num++;
396    _sizing_eval(obj);
397    return item;
398 }
399
400 /**
401  * Insert an item to the dialogue group just before the specified item.
402  *
403  * @param obj dialoguegroup object 
404  * @param subobj item
405  * @param before specified item existing in the dialogue group
406  * @param style sytle of the item
407  * @return Dialogue_Item pointer, just made by this function
408  *
409  * @ingroup DialogueGroup
410  */
411 EAPI Dialogue_Item *
412 elm_dialoguegroup_insert_before(Evas_Object *obj, Evas_Object *subobj, Dialogue_Item *before, Elm_Dialoguegroup_Item_Style style)
413 {
414    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
415    Widget_Data *wd = elm_widget_data_get(obj);
416    Dialogue_Item *before_item = NULL, *item = NULL;
417    Eina_List *l;
418    Eina_List *prev;
419    
420    if (!wd || !subobj || !before || !wd->items) return NULL;
421    
422    EINA_LIST_FOREACH(wd->items, l, before_item) {
423       if (before == before_item) {
424          if ( !strcmp(before_item->location, "default") ) {
425             _change_item_bg(before_item, "bottom");
426             item = _create_item(obj, subobj, style, "top");
427          }
428          
429          else if ( !strcmp(before_item->location, "top") ) {
430             _change_item_bg(before_item, "middle");
431             item = _create_item(obj, subobj, style, "top");                     
432          }
433          
434          else if ( !strcmp(before_item->location, "middle") || !strcmp(before_item->location, "bottom") ) {
435             item = _create_item(obj, subobj, style, "middle");
436             prev = eina_list_prev(l);
437             //  _set_line_show(prev->data, item);
438          }
439          if (!item)
440             return NULL;
441          elm_box_pack_before(wd->box, item->bg_layout, before_item->bg_layout);
442          if (style == ELM_DIALOGUEGROUP_ITEM_STYLE_SUB) 
443            edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "flip_item", "");
444          wd->items = eina_list_prepend_relative(wd->items, item, before_item);
445       }         
446    }
447    
448    wd->num++;
449    _sizing_eval(obj);   
450    return item;
451 }
452
453 /**
454  * Remove an item from the dialogue group.
455  *
456  * @param obj dialoguegroup object 
457  * @param subobj item
458  *
459  * @ingroup DialogueGroup
460  */
461 EAPI void
462 elm_dialoguegroup_remove(Dialogue_Item *item)
463 {
464    if (!item) return;
465    ELM_CHECK_WIDTYPE(item->obj, widtype) ;
466    Dialogue_Item *current_item;
467    Widget_Data *wd = elm_widget_data_get(item->obj);
468    Eina_List *l;
469    
470    if (!wd || !wd->items || !item) return ;
471    
472    EINA_LIST_FOREACH(wd->items, l, current_item) {
473       if (current_item == item) {
474          if (current_item->content){
475             evas_object_del(current_item->content);
476             current_item->content = NULL;
477          }
478          if (current_item->bg_layout){
479             evas_object_del(current_item->bg_layout);
480             current_item->bg_layout = NULL;
481          }
482          elm_box_unpack(wd->box, current_item->bg_layout);                      
483          wd->items = eina_list_remove(wd->items, current_item);
484       }
485    }
486    
487    wd->num--;
488    
489    if (wd->num == 0) return;
490    
491    if (wd->num == 1) {
492       current_item = eina_list_data_get(wd->items);
493       _change_item_bg(current_item, "default");
494    }
495    
496    else {               
497       current_item = eina_list_data_get(wd->items);
498       _change_item_bg(current_item, "top");
499       current_item = eina_list_data_get( eina_list_last(wd->items) );
500       _change_item_bg(current_item, "bottom");          
501    }
502    
503    _sizing_eval(item->obj);  
504 }
505
506 /**
507  * Remove all items from the dialogue group.
508  *
509  * @param obj dialoguegroup object 
510  *
511  * @ingroup DialogueGroup
512  */
513 EAPI void
514 elm_dialoguegroup_remove_all(Evas_Object *obj)
515 {
516    ELM_CHECK_WIDTYPE(obj, widtype);
517    _remove_all(obj);    
518    _sizing_eval(obj);   
519 }
520
521
522 /**
523  * Set the title text of the  dialogue group.
524  *
525  * @param obj dialoguegroup object 
526  * @param title title text, if NULL title space will be disappeared 
527  * 
528  * @ingroup DialogueGroup
529  */
530 EAPI void 
531 elm_dialoguegroup_title_set(Evas_Object *obj, const char *title)
532 {
533    ELM_CHECK_WIDTYPE(obj, widtype);
534    Widget_Data *wd = elm_widget_data_get(obj);
535    
536    if (!wd) return ;
537    eina_stringshare_replace(&wd->title, title);
538    if (!title) {
539       wd->title = NULL;         
540       elm_box_unpack(wd->box, wd->title_layout);                
541    }    
542    if (!wd->title_layout) {
543       wd->title_layout = elm_layout_add(wd->box);
544       elm_layout_theme_set(wd->title_layout, "dialoguegroup", "title", elm_widget_style_get(obj));
545       evas_object_size_hint_weight_set(wd->title_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
546       evas_object_size_hint_align_set(wd->title_layout, EVAS_HINT_FILL, 0.0);
547       evas_object_show(wd->title_layout);       
548       edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", title);
549       elm_box_pack_start(wd->box, wd->title_layout);
550    }
551    edje_object_part_text_set(elm_layout_edje_get(wd->title_layout), "text", title);
552 }
553
554 /**
555  * Get the title text of the dialogue group
556  *
557  * @param obj The dialoguegroup object
558  * @return The text title string in UTF-8
559  *
560  * @ingroup DialogueGroup
561  */
562 EAPI const char *
563 elm_dialoguegroup_title_get(Evas_Object *obj)
564 {
565    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
566    Widget_Data *wd = elm_widget_data_get(obj);
567    if (!wd) return NULL;
568    return wd->title;
569 }
570
571 /**
572  * Set whether the press effect will be shown or not
573  *
574  * @param obj The dialoguegroup object
575  * @param item Dialogue_Item pointer
576  * @param press If set as 1, press effect will be shown 
577  *
578  * @ingroup DialogueGroup 
579  */
580 EAPI void 
581 elm_dialoguegroup_press_effect_set(Dialogue_Item *item, Eina_Bool press)
582 {
583    if (!item) return;
584    ELM_CHECK_WIDTYPE(item->obj, widtype) ;
585    
586    item->press = press;
587    if ((press == EINA_TRUE) && (item->disabled == EINA_FALSE))
588      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
589    else
590      edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");       
591 }
592
593 /**
594  * Get the press effect state
595  *
596  * @param obj The dialoguegroup object
597  * @param item Dialogue_Item pointer
598  * @return 1 if press effect on, 0 if press effect off 
599  *
600  * @ingroup DialogueGroup 
601  */
602 EAPI Eina_Bool
603 elm_dialoguegroup_press_effect_get(Dialogue_Item *item)
604 {
605    if (!item) return EINA_FALSE;
606    ELM_CHECK_WIDTYPE(item->obj, widtype) EINA_FALSE;
607    
608    return item->press;
609 }
610
611 /**
612  * Get the conetent object from the specified dialogue item
613  *
614  * @param obj The dialoguegroup object
615  * @param item Dialogue_Item pointer
616  * @return content object 
617  *
618  * @ingroup DialogueGroup 
619  */
620 EAPI Evas_Object *
621 elm_dialoguegroup_item_content_get(Dialogue_Item *item)
622 {
623    if (!item) return NULL;
624    ELM_CHECK_WIDTYPE(item->obj, widtype) EINA_FALSE;
625    
626    return item->content;
627 }
628
629 /**
630  * Set the style of the item.
631  *
632  * @param item dialoguegroup item
633  * @param style sytle of the item
634  * 
635  * @ingroup DialogueGroup
636  */
637 EAPI void 
638 elm_dialoguegroup_item_style_set(Dialogue_Item *item, Elm_Dialoguegroup_Item_Style style)
639 {
640    if (!item) return;
641    ELM_CHECK_WIDTYPE(item->obj, widtype);
642    Widget_Data *wd = elm_widget_data_get(item->obj);
643    
644    item->style = style;
645    _change_item_bg(item, item->location);
646    
647    if (!wd) return ;
648 }
649
650 /**
651  * Get the style of the item.
652  *
653  * @param item dialoguegroup item
654  * @return dialoguegroup item style
655  * 
656  * @ingroup DialogueGroup
657  */
658
659 EAPI Elm_Dialoguegroup_Item_Style
660 elm_dialoguegroup_item_style_get(Dialogue_Item *item)
661 {
662    if (!item) return ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
663    ELM_CHECK_WIDTYPE(item->obj, widtype) ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
664    Widget_Data *wd = elm_widget_data_get(item->obj);
665    
666    if (!wd) return ELM_DIALOGUEGROUP_ITEM_STYLE_LAST;
667    
668    return item->style;
669 }
670
671 /**
672  * Set item state as disable or not.
673  *
674  * @param item dialoguegroup item.
675  * @param disabled if EINA_TRUE disabled, else abled. 
676  * 
677  * @ingroup DialogueGroup
678  */
679 EAPI void 
680 elm_dialoguegroup_item_disabled_set(Dialogue_Item *item, Eina_Bool disabled)
681 {
682    if (!item) return;
683    ELM_CHECK_WIDTYPE(item->obj, widtype);
684    
685    item->disabled = disabled;
686    
687    if (disabled == EINA_TRUE)
688      {
689         edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,disabled", "elm");
690         edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,off", "elm");    
691      }
692    else
693      {
694         edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,enabled", "elm");
695         if (item->press == EINA_TRUE)
696           edje_object_signal_emit(elm_layout_edje_get(item->bg_layout), "elm,state,press,on", "elm");
697      }
698 }
699
700 /**
701  * Get item state whether disabled or not.
702  *
703  * @param item dialoguegroup item.
704  * @return if EINA_TRUE, then disabled else abled.
705  * 
706  * @ingroup DialogueGroup
707  */
708
709 EAPI Eina_Bool
710 elm_dialoguegroup_item_disabled_get(Dialogue_Item *item)
711 {
712    if (!item) return EINA_FALSE;
713    ELM_CHECK_WIDTYPE(item->obj, widtype) EINA_FALSE;
714    
715    return item->disabled;
716 }
717
718 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
719