a802243b2a98acb1cc756a8e2739e084061942c0
[framework/uifw/elementary.git] / src / lib / elm_toggle.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 EAPI Evas_Object *
5 elm_toggle_add(Evas_Object *parent)
6 {
7    Evas_Object *obj;
8
9    obj = elm_check_add(parent);
10    elm_object_style_set(obj, "toggle");
11    elm_object_part_text_set(obj, "on", E_("ON"));
12    elm_object_part_text_set(obj, "off", E_("OFF"));
13    return obj;
14 }
15
16 EAPI void
17 elm_toggle_label_set(Evas_Object *obj, const char *label)
18 {
19    elm_object_text_set(obj, label);
20 }
21
22 EAPI const char *
23 elm_toggle_label_get(const Evas_Object *obj)
24 {
25    return elm_object_text_get(obj);
26 }
27
28 EAPI void
29 elm_toggle_icon_set(Evas_Object *obj, Evas_Object *icon)
30 {
31    elm_object_content_part_set(obj, "icon", icon);
32 }
33
34 EAPI Evas_Object *
35 elm_toggle_icon_get(const Evas_Object *obj)
36 {
37    return elm_object_content_part_get(obj, "icon");
38 }
39
40 EAPI Evas_Object *
41 elm_toggle_icon_unset(Evas_Object *obj)
42 {
43    return elm_object_content_part_unset(obj, "icon");
44 }
45
46 EAPI void
47 elm_toggle_states_labels_set(Evas_Object *obj, const char *onlabel, const char *offlabel)
48 {
49    elm_object_part_text_set(obj, "on", onlabel);
50    elm_object_part_text_set(obj, "off", offlabel);
51 }
52
53
54 EAPI void
55 elm_toggle_states_labels_get(const Evas_Object *obj, const char **onlabel, const char **offlabel)
56 {
57    if (onlabel) *onlabel = elm_object_part_text_get(obj, "on");
58    if (offlabel) *offlabel = elm_object_part_text_get(obj, "off");
59 }
60
61 EAPI void
62 elm_toggle_state_set(Evas_Object *obj, Eina_Bool state)
63 {
64    elm_check_state_set(obj, state);
65 }
66
67 EAPI Eina_Bool
68 elm_toggle_state_get(const Evas_Object *obj)
69 {
70    return elm_check_state_get(obj);
71 }
72
73 EAPI void
74 elm_toggle_state_pointer_set(Evas_Object *obj, Eina_Bool *statep)
75 {
76    elm_check_state_pointer_set(obj, statep);
77 }