Merge remote-tracking branch 'remotes/origin/upstream'
[framework/uifw/elementary.git] / src / lib / elm_check.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 typedef struct _Widget_Data Widget_Data;
5
6 struct _Widget_Data
7 {
8    Evas_Object *chk, *icon;
9    Eina_Bool state;
10    Eina_Bool *statep;
11    const char *label;
12    const char *ontext, *offtext;
13 };
14
15 static const char *widtype = NULL;
16 <<<<<<< HEAD
17 =======
18 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
19                              Evas_Callback_Type type, void *event_info);
20 >>>>>>> remotes/origin/upstream
21 static void _del_hook(Evas_Object *obj);
22 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
23 static void _theme_hook(Evas_Object *obj);
24 static void _disable_hook(Evas_Object *obj);
25 static void _sizing_eval(Evas_Object *obj);
26 <<<<<<< HEAD
27 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
28 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
29 static void _signal_check_off(void *data, Evas_Object *obj, const char *emission, const char *source);
30 static void _signal_check_on(void *data, Evas_Object *obj, const char *emission, const char *source);
31 static void _signal_check_toggle(void *data, Evas_Object *obj, const char *emission, const char *source);
32 static void _on_focus_hook(void *data, Evas_Object *obj);
33 static void _activate_hook(Evas_Object *obj);
34 static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content);
35 static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
36 static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
37
38 static void _activate(Evas_Object *obj);
39 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
40                              Evas_Callback_Type type, void *event_info);
41
42 =======
43 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj,
44                                 void *event_info);
45 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
46 static void _signal_check_off(void *data, Evas_Object *obj,
47                               const char *emission, const char *source);
48 static void _signal_check_on(void *data, Evas_Object *obj,
49                              const char *emission, const char *source);
50 static void _signal_check_toggle(void *data, Evas_Object *obj,
51                                  const char *emission, const char *source);
52 static void _on_focus_hook(void *data, Evas_Object *obj);
53 static void _activate_hook(Evas_Object *obj);
54 static void _content_set_hook(Evas_Object *obj, const char *part,
55                               Evas_Object *content);
56 static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
57 static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
58 static void _activate(Evas_Object *obj);
59 >>>>>>> remotes/origin/upstream
60 static const char SIG_CHANGED[] = "changed";
61 static const Evas_Smart_Cb_Description _signals[] = {
62        {SIG_CHANGED, ""},
63        {NULL, NULL}
64 };
65
66 static Eina_Bool
67 <<<<<<< HEAD
68 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
69 =======
70 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__,
71             Evas_Callback_Type type, void *event_info)
72 >>>>>>> remotes/origin/upstream
73 {
74    if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
75    Evas_Event_Key_Down *ev = event_info;
76    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
77    if (elm_widget_disabled_get(obj)) return EINA_FALSE;
78    if ((strcmp(ev->keyname, "Return")) &&
79        (strcmp(ev->keyname, "KP_Enter")) &&
80        (strcmp(ev->keyname, "space")))
81      return EINA_FALSE;
82    _activate(obj);
83    ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
84    return EINA_TRUE;
85 }
86
87 <<<<<<< HEAD
88
89 =======
90 >>>>>>> remotes/origin/upstream
91 static void
92 _del_hook(Evas_Object *obj)
93 {
94    Widget_Data *wd = elm_widget_data_get(obj);
95    if (!wd) return;
96    if (wd->label) eina_stringshare_del(wd->label);
97    if (wd->ontext) eina_stringshare_del(wd->ontext);
98    if (wd->offtext) eina_stringshare_del(wd->offtext);
99    free(wd);
100 }
101
102 static void
103 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
104 {
105    Widget_Data *wd = elm_widget_data_get(obj);
106    if (!wd) return;
107    if (elm_widget_focus_get(obj))
108      {
109         edje_object_signal_emit(wd->chk, "elm,action,focus", "elm");
110         evas_object_focus_set(wd->chk, EINA_TRUE);
111      }
112    else
113      {
114         edje_object_signal_emit(wd->chk, "elm,action,unfocus", "elm");
115         evas_object_focus_set(wd->chk, EINA_FALSE);
116      }
117 }
118
119 static void
120 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
121 {
122    Widget_Data *wd = elm_widget_data_get(obj);
123    if (!wd) return;
124    edje_object_mirrored_set(wd->chk, rtl);
125 }
126
127 static void
128 _theme_hook(Evas_Object *obj)
129 {
130 <<<<<<< HEAD
131    unsigned int counter = 0;
132    unsigned int i = 1;
133    unsigned int length = 0;
134    const char *str = NULL;
135    char labels[128] ;
136    char buffer[PATH_MAX]={'\0',};
137    char s1[PATH_MAX] = {'\0',};
138    Widget_Data *wd = elm_widget_data_get(obj);
139    if (!wd) return;
140
141 =======
142    Widget_Data *wd = elm_widget_data_get(obj);
143    if (!wd) return;
144 >>>>>>> remotes/origin/upstream
145    _elm_widget_mirrored_reload(obj);
146    _mirrored_set(obj, elm_widget_mirrored_get(obj));
147    _elm_theme_object_set(obj, wd->chk, "check", "base", elm_widget_style_get(obj));
148    if (wd->icon)
149      edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
150    else
151      edje_object_signal_emit(wd->chk, "elm,state,icon,hidden", "elm");
152    if (wd->state)
153      edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
154    else
155      edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
156    if (wd->label)
157      edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm");
158    else
159      edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
160    edje_object_part_text_set(wd->chk, "elm.text", wd->label);
161    edje_object_part_text_set(wd->chk, "elm.ontext", wd->ontext);
162    edje_object_part_text_set(wd->chk, "elm.offtext", wd->offtext);
163    if (elm_widget_disabled_get(obj))
164      edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm");
165    edje_object_message_signal_process(wd->chk);
166    edje_object_scale_set(wd->chk, elm_widget_scale_get(obj) * _elm_config->scale);
167 <<<<<<< HEAD
168
169    //introduced internationalization of additional text parts used in style
170    while (1)
171      {
172         // s1 is  used  to store part name while buffer is used to store the part's value string
173         snprintf(labels,sizeof(labels),"label_%d",i++);
174         str = edje_object_data_get(wd->chk,labels);
175         if (!str) break;
176         length = strlen(str);
177         while ((str[counter]!= ' ') && (counter < length))
178           counter++;
179         if (counter == length)
180           continue;
181         strncpy(s1, str, counter);
182         s1[counter] = '\0';
183         strncpy(buffer, str + counter, sizeof(buffer));
184         edje_object_part_text_set(wd->chk, s1, E_(buffer));
185      }
186 =======
187 >>>>>>> remotes/origin/upstream
188    _sizing_eval(obj);
189 }
190
191 static void
192 _disable_hook(Evas_Object *obj)
193 {
194    Widget_Data *wd = elm_widget_data_get(obj);
195    if (!wd) return;
196    if (elm_widget_disabled_get(obj))
197      edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm");
198    else
199      edje_object_signal_emit(wd->chk, "elm,state,enabled", "elm");
200 }
201
202 static void
203 _sizing_eval(Evas_Object *obj)
204 {
205    Widget_Data *wd = elm_widget_data_get(obj);
206    Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
207    if (!wd) return;
208    elm_coords_finger_size_adjust(1, &minw, 1, &minh);
209    edje_object_size_min_restricted_calc(wd->chk, &minw, &minh, minw, minh);
210    elm_coords_finger_size_adjust(1, &minw, 1, &minh);
211    evas_object_size_hint_min_set(obj, minw, minh);
212    evas_object_size_hint_max_set(obj, maxw, maxh);
213 }
214
215 static void
216 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
217 {
218    Widget_Data *wd = elm_widget_data_get(data);
219    if (!wd) return;
220    if (obj != wd->icon) return;
221    _sizing_eval(data);
222 }
223
224 static void
225 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
226 {
227    Widget_Data *wd = elm_widget_data_get(obj);
228    Evas_Object *sub = event_info;
229    if (!wd) return;
230    if (sub == wd->icon)
231      {
232         edje_object_signal_emit(wd->chk, "elm,state,icon,hidden", "elm");
233         evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
234                                             _changed_size_hints, obj);
235         wd->icon = NULL;
236         _sizing_eval(obj);
237         edje_object_message_signal_process(wd->chk);
238      }
239 }
240
241 static void
242 _signal_check_off(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
243 {
244    Widget_Data *wd = elm_widget_data_get(data);
245    if (!wd) return;
246    wd->state = EINA_FALSE;
247    if (wd->statep) *wd->statep = wd->state;
248    edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
249    evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
250 }
251
252 static void
253 _signal_check_on(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
254 {
255    Widget_Data *wd = elm_widget_data_get(data);
256    if (!wd) return;
257    wd->state = EINA_TRUE;
258    if (wd->statep) *wd->statep = wd->state;
259    edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
260    evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
261 }
262
263 static void
264 _signal_check_toggle(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
265 {
266    _activate(data);
267 }
268
269 static void
270 _activate_hook(Evas_Object *obj)
271 {
272    _activate(obj);
273 }
274
275 static void
276 <<<<<<< HEAD
277 =======
278 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
279 {
280    Widget_Data *wd = elm_widget_data_get(obj);
281    if (!wd) return;
282
283    edje_object_signal_emit(wd->chk, emission, source);
284 }
285
286 static void
287 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
288 {
289    Widget_Data *wd = elm_widget_data_get(obj);
290    if (!wd) return;
291    edje_object_signal_callback_add(wd->chk, emission, source, func_cb, data);
292 }
293
294 static void
295 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
296 {
297    Widget_Data *wd = elm_widget_data_get(obj);
298    edje_object_signal_callback_del_full(wd->chk, emission, source, func_cb,
299                                         data);
300 }
301
302 static void
303 >>>>>>> remotes/origin/upstream
304 _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
305 {
306    ELM_CHECK_WIDTYPE(obj, widtype);
307    Widget_Data *wd;
308
309    if (part && strcmp(part, "icon")) return;
310    wd = elm_widget_data_get(obj);
311    if (!wd) return;
312    if (wd->icon == content) return;
313    if (wd->icon) evas_object_del(wd->icon);
314    wd->icon = content;
315    if (content)
316      {
317         elm_widget_sub_object_add(obj, content);
318         evas_object_event_callback_add(content,
319                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
320                                        _changed_size_hints, obj);
321         edje_object_part_swallow(wd->chk, "elm.swallow.content", content);
322         edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
323         edje_object_message_signal_process(wd->chk);
324      }
325    _sizing_eval(obj);
326 }
327
328 static Evas_Object *
329 _content_get_hook(const Evas_Object *obj, const char *part)
330 {
331    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
332    Widget_Data *wd;
333
334    if (part && strcmp(part, "icon")) return NULL;
335    wd = elm_widget_data_get(obj);
336    if (!wd) return NULL;
337    return wd->icon;
338 }
339
340 static Evas_Object *
341 _content_unset_hook(Evas_Object *obj, const char *part)
342 {
343    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
344    Widget_Data *wd;
345
346    if (part && strcmp(part, "icon")) return NULL;
347    wd = elm_widget_data_get(obj);
348    if (!wd) return NULL;
349    if (!wd->icon) return NULL;
350    Evas_Object *icon = wd->icon;
351    elm_widget_sub_object_del(obj, wd->icon);
352    evas_object_event_callback_del_full(wd->icon,
353                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
354                                        _changed_size_hints, obj);
355    edje_object_part_unswallow(wd->chk, wd->icon);
356    wd->icon = NULL;
357    return icon;
358 }
359
360 static void
361 _activate(Evas_Object *obj)
362 {
363    Widget_Data *wd = elm_widget_data_get(obj);
364    if (!wd) return;
365    if ((_elm_config->access_mode == ELM_ACCESS_MODE_OFF) ||
366        (_elm_access_2nd_click_timeout(obj)))
367      {
368         wd->state = !wd->state;
369         if (wd->statep) *wd->statep = wd->state;
370         if (wd->state)
371           {
372              edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
373              if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
374                {
375                   if (!wd->ontext)
376                     {
377                        _elm_access_say(E_("State: On"));
378                     }
379                   else
380                      _elm_access_say(E_("State: On"));
381                }
382           }
383         else
384           {
385              edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
386              if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
387                {
388                   if (!wd->offtext)
389                     {
390                        _elm_access_say(E_("State: Off"));
391                     }
392                   else
393                      _elm_access_say(E_("State: Off"));
394                }
395           }
396         evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
397      }
398 }
399
400 static void
401 _elm_check_label_set(Evas_Object *obj, const char *item, const char *label)
402 {
403    ELM_CHECK_WIDTYPE(obj, widtype);
404    Widget_Data *wd = elm_widget_data_get(obj);
405    if (!wd) return;
406    if ((!item) || (!strcmp(item, "default")))
407      {
408         eina_stringshare_replace(&wd->label, label);
409         if (label)
410            edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm");
411         else
412            edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
413         edje_object_message_signal_process(wd->chk);
414         edje_object_part_text_set(wd->chk, "elm.text", label);
415      }
416    else if ((item) && (!strcmp(item, "on")))
417      {
418         eina_stringshare_replace(&wd->ontext, label);
419         edje_object_part_text_set(wd->chk, "elm.ontext", wd->ontext);
420      }
421    else if ((item) && (!strcmp(item, "off")))
422      {
423         eina_stringshare_replace(&wd->offtext, label);
424         edje_object_part_text_set(wd->chk, "elm.offtext", wd->offtext);
425      }
426    _sizing_eval(obj);
427 }
428
429 static const char *
430 _elm_check_label_get(const Evas_Object *obj, const char *item)
431 {
432    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
433    Widget_Data *wd = elm_widget_data_get(obj);
434    if (!wd) return NULL;
435    if ((!item) || (!strcmp(item, "default")))
436       return wd->label;
437    else if ((item) && (!strcmp(item, "on")))
438       return wd->ontext;
439    else if ((item) && (!strcmp(item, "off")))
440       return wd->offtext;
441    return NULL;
442 }
443
444 static char *
445 _access_info_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__)
446 {
447    const char *txt = elm_widget_access_info_get(obj);
448    if (!txt) txt = _elm_check_label_get(obj, NULL);
449    if (txt) return strdup(txt);
450    return NULL;
451 }
452
453 static char *
454 _access_state_cb(void *data, Evas_Object *obj, Elm_Widget_Item *item __UNUSED__)
455 {
456    Evas_Object *o = data;
457    Widget_Data *wd = elm_widget_data_get(o);
458    if (!wd) return NULL;
459    if (elm_widget_disabled_get(obj))
460      return strdup(E_("State: Disabled"));
461    if (wd->state)
462      {
463         if (wd->ontext)
464           {
465              char buf[1024];
466
467              snprintf(buf, sizeof(buf), "%s: %s", E_("State"), wd->ontext);
468              return strdup(buf);
469           }
470         else
471            return strdup(E_("State: On"));
472      }
473    if (wd->offtext)
474      {
475         char buf[1024];
476
477         snprintf(buf, sizeof(buf), "%s: %s", E_("State"), wd->offtext);
478         return strdup(buf);
479      }
480    return strdup(E_("State: Off"));
481 }
482
483 EAPI Evas_Object *
484 elm_check_add(Evas_Object *parent)
485 {
486    Evas_Object *obj;
487    Evas *e;
488    Widget_Data *wd;
489
490    ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
491
492    ELM_SET_WIDTYPE(widtype, "check");
493    elm_widget_type_set(obj, "check");
494    elm_widget_sub_object_add(parent, obj);
495    elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
496    elm_widget_data_set(obj, wd);
497    elm_widget_del_hook_set(obj, _del_hook);
498    elm_widget_theme_hook_set(obj, _theme_hook);
499    elm_widget_disable_hook_set(obj, _disable_hook);
500    elm_widget_can_focus_set(obj, EINA_TRUE);
501    elm_widget_activate_hook_set(obj, _activate_hook);
502    elm_widget_event_hook_set(obj, _event_hook);
503 <<<<<<< HEAD
504 =======
505    elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
506    elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
507    elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
508 >>>>>>> remotes/origin/upstream
509    elm_widget_text_set_hook_set(obj, _elm_check_label_set);
510    elm_widget_text_get_hook_set(obj, _elm_check_label_get);
511    elm_widget_content_set_hook_set(obj, _content_set_hook);
512    elm_widget_content_get_hook_set(obj, _content_get_hook);
513    elm_widget_content_unset_hook_set(obj, _content_unset_hook);
514
515    wd->chk = edje_object_add(e);
516    _elm_theme_object_set(obj, wd->chk, "check", "base", "default");
517    edje_object_signal_callback_add(wd->chk, "elm,action,check,on", "",
518                                    _signal_check_on, obj);
519    edje_object_signal_callback_add(wd->chk, "elm,action,check,off", "",
520                                    _signal_check_off, obj);
521    edje_object_signal_callback_add(wd->chk, "elm,action,check,toggle", "",
522                                    _signal_check_toggle, obj);
523    elm_widget_resize_object_set(obj, wd->chk);
524
525    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
526
527    _mirrored_set(obj, elm_widget_mirrored_get(obj));
528    _sizing_eval(obj);
529
530    // TODO: convert Elementary to subclassing of Evas_Smart_Class
531    // TODO: and save some bytes, making descriptions per-class and not instance!
532    evas_object_smart_callbacks_descriptions_set(obj, _signals);
533
534    _elm_access_object_register(obj, wd->chk);
535    _elm_access_text_set(_elm_access_object_get(obj),
536                         ELM_ACCESS_TYPE, E_("Check"));
537    _elm_access_callback_set(_elm_access_object_get(obj),
538                             ELM_ACCESS_INFO, _access_info_cb, obj);
539    _elm_access_callback_set(_elm_access_object_get(obj),
540                             ELM_ACCESS_STATE, _access_state_cb, obj);
541    return obj;
542 }
543
544 EAPI void
545 <<<<<<< HEAD
546 elm_check_label_set(Evas_Object *obj, const char *label)
547 {
548    _elm_check_label_set(obj, NULL, label);
549 }
550
551 EAPI const char *
552 elm_check_label_get(const Evas_Object *obj)
553 {
554    return _elm_check_label_get(obj, NULL);
555 }
556
557 EAPI void
558 elm_check_states_labels_set(Evas_Object *obj, const char *ontext, const char *offtext)
559 {
560    _elm_check_label_set(obj, "on", ontext);
561    _elm_check_label_set(obj, "off", offtext);
562 }
563
564 EAPI void
565 elm_check_states_labels_get(const Evas_Object *obj, const char **ontext, const char **offtext)
566 {
567    if (ontext) *ontext = _elm_check_label_get(obj, "on");
568    if (offtext) *offtext = _elm_check_label_get(obj, "off");
569 }
570
571 EAPI void
572 elm_check_icon_set(Evas_Object *obj, Evas_Object *icon)
573 {
574    _content_set_hook(obj, "icon", icon);
575 }
576
577 EAPI Evas_Object *
578 elm_check_icon_get(const Evas_Object *obj)
579 {
580    return _content_get_hook(obj, "icon");
581 }
582
583 EAPI Evas_Object *
584 elm_check_icon_unset(Evas_Object *obj)
585 {
586    return _content_unset_hook(obj, "icon");
587 }
588
589 EAPI void
590 =======
591 >>>>>>> remotes/origin/upstream
592 elm_check_state_set(Evas_Object *obj, Eina_Bool state)
593 {
594    ELM_CHECK_WIDTYPE(obj, widtype);
595    Widget_Data *wd = elm_widget_data_get(obj);
596    if (!wd) return;
597    if (state != wd->state)
598      {
599         wd->state = state;
600         if (wd->statep) *wd->statep = wd->state;
601         if (wd->state)
602           edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
603         else
604           edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
605      }
606    edje_object_message_signal_process(wd->chk);
607 }
608
609 EAPI Eina_Bool
610 elm_check_state_get(const Evas_Object *obj)
611 {
612    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
613    Widget_Data *wd = elm_widget_data_get(obj);
614    if (!wd) return EINA_FALSE;
615    return wd->state;
616 }
617
618 EAPI void
619 elm_check_state_pointer_set(Evas_Object *obj, Eina_Bool *statep)
620 {
621    ELM_CHECK_WIDTYPE(obj, widtype);
622    Widget_Data *wd = elm_widget_data_get(obj);
623    if (!wd) return;
624    if (statep)
625      {
626         wd->statep = statep;
627         if (*wd->statep != wd->state)
628           {
629              wd->state = *wd->statep;
630              if (wd->state)
631                edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
632              else
633                edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
634           }
635      }
636    else
637      wd->statep = NULL;
638 }