fixed plugin image size problem
[framework/uifw/elementary.git] / src / edje_externals / elm_multibuttonentry.c
1 #include "private.h"
2
3 typedef struct _Elm_Params_Multibuttonentry
4 {
5    const char *label;
6    const char *guide_text;
7 } Elm_Params_Multibuttonentry;
8
9 static void
10 external_multibuttonentry_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
11 {
12    const Elm_Params_Multibuttonentry *p;
13
14    if (to_params) p = to_params;
15    else if (from_params) p = from_params;
16    else return;
17
18    if (p->label)
19      elm_object_text_set(obj, p->label);
20    if (p->guide_text)
21      elm_object_part_text_set(obj, "guide", p->guide_text);
22 }
23
24 static Eina_Bool
25 external_multibuttonentry_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
26 {
27    if (!strcmp(param->name, "label"))
28      {
29         if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
30           {
31              elm_object_text_set(obj, param->s);
32              return EINA_TRUE;
33           }
34      }
35    else if (!strcmp(param->name, "guide text"))
36      {
37         if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
38           {
39              elm_object_part_text_set(obj, "guide", param->s);
40              return EINA_TRUE;
41           }
42      }
43
44    ERR("unknown parameter '%s' of type '%s'",
45        param->name, edje_external_param_type_str(param->type));
46
47    return EINA_FALSE;
48 }
49
50 static Eina_Bool
51 external_multibuttonentry_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
52 {
53    if (!strcmp(param->name, "label"))
54      {
55         if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
56           {
57              param->s = elm_object_text_get(obj);
58              return EINA_TRUE;
59           }
60      }
61    else if (!strcmp(param->name, "guide text"))
62      {
63         if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
64           {
65              param->s = elm_object_part_text_get(obj, "guide");
66              return EINA_TRUE;
67           }
68      }
69
70    ERR("unknown parameter '%s' of type '%s'",
71        param->name, edje_external_param_type_str(param->type));
72
73    return EINA_FALSE;
74 }
75
76 static void *
77 external_multibuttonentry_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
78 {
79    Elm_Params_Multibuttonentry *mem = NULL;
80    Edje_External_Param *param;
81    const Eina_List *l;
82
83    //mem = external_common_params_parse(Elm_Params_Multibuttonentry, data, obj, params);
84    if (!mem)
85      return NULL;
86
87    EINA_LIST_FOREACH(params, l, param)
88      {
89         if (!strcmp(param->name, "label"))
90           mem->label = eina_stringshare_add(param->s);
91         else if (!strcmp(param->name, "guide text"))
92           mem->guide_text = eina_stringshare_add(param->s);
93      }
94
95    return mem;
96 }
97
98 static Evas_Object *external_multibuttonentry_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
99 {
100    ERR("so content");
101    return NULL;
102 }
103
104 static void
105 external_multibuttonentry_params_free(void *params)
106 {
107    Elm_Params_Multibuttonentry *mem = params;
108
109    if (mem->label)
110      eina_stringshare_del(mem->label);
111    if (mem->guide_text)
112      eina_stringshare_del(mem->guide_text);
113    external_common_params_free(params);
114 }
115
116 static Edje_External_Param_Info external_multibuttonentry_params[] = {
117    DEFINE_EXTERNAL_COMMON_PARAMS,
118    EDJE_EXTERNAL_PARAM_INFO_STRING("label"),
119    EDJE_EXTERNAL_PARAM_INFO_STRING("guide text"),
120    EDJE_EXTERNAL_PARAM_INFO_SENTINEL
121 };
122
123 DEFINE_EXTERNAL_ICON_ADD(multibuttonentry, "multibuttonentry")
124 DEFINE_EXTERNAL_TYPE_SIMPLE(multibuttonentry, "Multibuttonentry")
125