summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/edje_externals/elm_icon.c
diff options
context:
space:
mode:
authorJonathan Atton <jonathan.atton@gmail.com>2010-11-10 22:48:36 +0000
committerJonathan Atton <jonathan.atton@gmail.com>2010-11-10 22:48:36 +0000
commit46d571bd6896053d98c8a7683efc4ef2adb5c274 (patch)
treeff6c40de19e3c7006e7b492000b169c5bf4aa9d3 /legacy/elementary/src/edje_externals/elm_icon.c
parent9c29a3ea1d4ff0222273c950d9d86429a0653ef4 (diff)
elm : add edje external icon, label and scroller
SVN revision: 54446
Diffstat (limited to 'legacy/elementary/src/edje_externals/elm_icon.c')
-rw-r--r--legacy/elementary/src/edje_externals/elm_icon.c116
1 files changed, 116 insertions, 0 deletions
diff --git a/legacy/elementary/src/edje_externals/elm_icon.c b/legacy/elementary/src/edje_externals/elm_icon.c
new file mode 100644
index 0000000..c0a0130
--- /dev/null
+++ b/legacy/elementary/src/edje_externals/elm_icon.c
@@ -0,0 +1,116 @@
1#include "private.h"
2
3typedef struct _Elm_Params_Icon
4{
5 Elm_Params base;
6 const char *icon;
7} Elm_Params_Icon;
8
9static void
10external_icon_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
11{
12 const Elm_Params_Icon *p;
13 Evas_Object *edje;
14 const char *file;
15
16 if (to_params) p = to_params;
17 else if (from_params) p = from_params;
18 else return;
19
20 if (p->icon)
21 {
22 edje = evas_object_smart_parent_get(obj);
23 edje_object_file_get(edje, &file, NULL);
24
25 if (!elm_icon_file_set(obj, file, p->icon))
26 elm_icon_standard_set(obj, p->icon);
27 }
28}
29
30static Eina_Bool
31external_icon_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
32{
33 Evas_Object *edje;
34 const char *file;
35
36 if (!strcmp(param->name, "icon"))
37 {
38 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
39 {
40 edje = evas_object_smart_parent_get(obj);
41 edje_object_file_get(edje, &file, NULL);
42
43 if (!elm_icon_file_set(obj, file, param->s))
44 elm_icon_standard_set(obj, param->s);
45 return EINA_TRUE;
46 }
47 }
48
49 ERR("unknown parameter '%s' of type '%s'",
50 param->name, edje_external_param_type_str(param->type));
51
52 return EINA_FALSE;
53}
54
55static Eina_Bool
56external_icon_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
57{
58 if (!strcmp(param->name, "icon"))
59 {
60 /* not easy to get icon name back from live object */
61 return EINA_FALSE;
62 }
63
64 ERR("unknown parameter '%s' of type '%s'",
65 param->name, edje_external_param_type_str(param->type));
66
67 return EINA_FALSE;
68}
69
70static void *
71external_icon_params_parse(void *data, Evas_Object *obj, const Eina_List *params)
72{
73 Elm_Params_Icon *mem;
74 Edje_External_Param *param;
75 const Eina_List *l;
76
77 //mem = external_common_params_parse(Elm_Params_Icon, data, obj, params);
78 if (!mem)
79 return NULL;
80
81 EINA_LIST_FOREACH(params, l, param)
82 {
83 if (!strcmp(param->name, "icon"))
84 {
85 mem->icon = eina_stringshare_add(param->s);
86 }
87 }
88
89 return mem;
90}
91
92static Evas_Object *external_icon_content_get(void *data __UNUSED__,
93 const Evas_Object *obj, const char *content)
94{
95 ERR("no content");
96 return NULL;
97}
98
99static void
100external_icon_params_free(void *params)
101{
102 Elm_Params_Icon *mem = params;
103
104 if (mem->icon)
105 eina_stringshare_del(mem->icon);
106 external_common_params_free(params);
107}
108
109static Edje_External_Param_Info external_icon_params[] = {
110 DEFINE_EXTERNAL_COMMON_PARAMS,
111 EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
112 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
113};
114
115DEFINE_EXTERNAL_ICON_ADD(icon, "icon");
116DEFINE_EXTERNAL_TYPE_SIMPLE(icon, "Icon");