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