summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/edje_externals/elm_radio.c
diff options
context:
space:
mode:
authorTiago Rezende Campos Falcao <developer@tiagofalcao.com>2009-12-06 01:22:54 +0000
committerTiago Rezende Campos Falcao <developer@tiagofalcao.com>2009-12-06 01:22:54 +0000
commitedf7f2e22eadd8443ba3980e71191d75c562c9fc (patch)
tree2b340c0c70deb84b12519418c6a041cec79509da /legacy/elementary/src/edje_externals/elm_radio.c
parenta053200ed2346a83be0d06fc204db4480166eeba (diff)
Elementary edje external modules
Widgets: Button, Check, Radio, Slider, Toggle SVN revision: 44207
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/edje_externals/elm_radio.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/legacy/elementary/src/edje_externals/elm_radio.c b/legacy/elementary/src/edje_externals/elm_radio.c
new file mode 100644
index 0000000..db954a9
--- /dev/null
+++ b/legacy/elementary/src/edje_externals/elm_radio.c
@@ -0,0 +1,80 @@
1#include "private.h"
2
3typedef struct _Elm_Params_Radio
4{
5 Elm_Params base;
6 Evas_Object *icon;
7 const char* group_name;
8} Elm_Params_Radio;
9
10static void
11external_radio_state_set(void *data, Evas_Object *obj, const void *from_params, const void *to_params, float pos)
12{
13 const Elm_Params_Radio *p1 = from_params, *p2 = to_params;
14
15 p1 = from_params;
16 p2 = to_params;
17
18 if (!p2)
19 {
20 elm_radio_label_set(obj, p1->base.label);
21 elm_radio_icon_set(obj, p1->icon);
22 elm_radio_state_value_set(obj, p1->base.state);
23 if (p1->group_name)
24 {
25 Evas_Object *ed = evas_object_smart_parent_get(obj);
26 Evas_Object *group = edje_object_part_swallow_get(ed, p1->group_name);
27 elm_radio_group_add(obj, group);
28 }
29 return;
30 }
31
32 elm_radio_label_set(obj, p2->base.label);
33 elm_radio_icon_set(obj, p2->icon);
34 elm_radio_state_value_set(obj, p2->base.state);
35 if (p2->group_name)
36 {
37 Evas_Object *ed = evas_object_smart_parent_get(obj);
38 Evas_Object *group = edje_object_part_swallow_get(ed, p2->group_name);
39 elm_radio_group_add(obj, group);
40 }
41}
42
43static void *
44external_radio_params_parse(void *data, Evas_Object *obj, const Eina_List *params)
45{
46 Elm_Params_Radio *mem;
47 Edje_External_Param *param;
48
49 mem = external_common_params_parse(Elm_Params_Radio, data, obj, params);
50 if (!mem)
51 return NULL;
52
53 external_common_icon_param_parse(&mem->icon, obj, params);
54
55 param = edje_external_param_find(params, "param group");
56 if (param)
57 mem->group_name = eina_stringshare_add(param->s);
58
59 return mem;
60}
61
62static void
63external_radio_params_free(void *params)
64{
65 Elm_Params_Radio *mem = params;
66
67 if (mem->icon)
68 evas_object_del(mem->icon);
69 if (mem->group_name)
70 eina_stringshare_del(mem->group_name);
71 external_common_params_free(params);
72}
73
74static Edje_External_Param_Info external_radio_params[] = {
75 DEFINE_EXTERNAL_COMMON_PARAMS,
76 EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
77 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
78};
79
80DEFINE_EXTERNAL_TYPE_SIMPLE(radio, "Radio")