[access] support elm_access_action(); with ELM_ACCESS_ACTION_UNHIGHLIGHT
[framework/uifw/elementary.git] / src / edje_externals / elm_label.c
1 #include "private.h"
2
3 typedef struct _Elm_Params_Label
4 {
5    Elm_Params base;
6    const char* label;
7 } Elm_Params_Label;
8
9 static void
10 external_label_state_set(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const void *from_params, const void *to_params, float pos __UNUSED__)
11 {
12    const Elm_Params_Label *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) elm_object_text_set(obj, p->label);
19 }
20
21 static Eina_Bool
22 external_label_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
23 {
24    if (!strcmp(param->name, "label"))
25      {
26         if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
27           {
28              elm_object_text_set(obj, param->s);
29              return EINA_TRUE;
30           }
31      }
32
33    ERR("unknown parameter '%s' of type '%s'",
34        param->name, edje_external_param_type_str(param->type));
35
36    return EINA_FALSE;
37 }
38
39 static Eina_Bool
40 external_label_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
41 {
42    if (!strcmp(param->name, "label"))
43      {
44         if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
45           {
46              param->s = elm_object_text_get(obj);
47              return EINA_TRUE;
48           }
49      }
50
51    ERR("unknown parameter '%s' of type '%s'",
52        param->name, edje_external_param_type_str(param->type));
53
54    return EINA_FALSE;
55 }
56
57 static void *
58 external_label_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params __UNUSED__)
59 {
60    Elm_Params_Label *mem;
61    Edje_External_Param *param;
62    const Eina_List *l;
63
64    mem = ELM_NEW(Elm_Params_Label);
65    if (!mem)
66      return NULL;
67
68    EINA_LIST_FOREACH(params, l, param)
69      {
70         if (!strcmp(param->name, "label"))
71            mem->label = eina_stringshare_add(param->s);
72      }
73
74    return mem;
75 }
76
77 static Evas_Object *external_label_content_get(void *data __UNUSED__,
78                 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
79 {
80         ERR("no content");
81         return NULL;
82 }
83
84 static void
85 external_label_params_free(void *params)
86 {
87    Elm_Params_Label *mem = params;
88    if (mem->label)
89       eina_stringshare_del(mem->label);
90    free(params);
91 }
92
93 static Edje_External_Param_Info external_label_params[] = {
94    DEFINE_EXTERNAL_COMMON_PARAMS,
95    EDJE_EXTERNAL_PARAM_INFO_STRING("label"),
96    EDJE_EXTERNAL_PARAM_INFO_SENTINEL
97 };
98
99 DEFINE_EXTERNAL_ICON_ADD(label, "label");
100 DEFINE_EXTERNAL_TYPE_SIMPLE(label, "label");