From: Hyoyoung Chang <hyoyoung@gmail.com>
[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_part_content_set(obj, "icon", icon);
32 }
33
34 EAPI Evas_Object *
35 elm_toggle_icon_get(const Evas_Object *obj)
36 {
37    return elm_object_part_content_get(obj, "icon");
38 }
39
40 EAPI Evas_Object *
41 elm_toggle_icon_unset(Evas_Object *obj)
42 {
43    return elm_object_part_content_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 EAPI void
54 elm_toggle_states_labels_get(const Evas_Object *obj, const char **onlabel, const char **offlabel)
55 {
56    if (onlabel) *onlabel = elm_object_part_text_get(obj, "on");
57    if (offlabel) *offlabel = elm_object_part_text_get(obj, "off");
58 }
59
60 EAPI void
61 elm_toggle_state_set(Evas_Object *obj, Eina_Bool state)
62 {
63    elm_check_state_set(obj, state);
64 }
65
66 EAPI Eina_Bool
67 elm_toggle_state_get(const Evas_Object *obj)
68 {
69    return elm_check_state_get(obj);
70 }
71
72 EAPI void
73 elm_toggle_state_pointer_set(Evas_Object *obj, Eina_Bool *statep)
74 {
75    elm_check_state_pointer_set(obj, statep);
76 }