Merge "[Password]: New design based changes, a new style removed password mode contro...
[framework/uifw/elementary.git] / src / edje_externals / elm_anchorblock.c
1 #include "private.h"
2
3 typedef struct _Elm_Params_Anchorblock
4 {
5    Elm_Params base;
6    const char *text;
7 } Elm_Params_Anchorblock;
8
9 static void
10 external_anchorblock_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
11 {
12    const Elm_Params_Anchorblock *p;
13
14    if (to_params) p = to_params;
15    else if (from_params) p = from_params;
16    else return;
17
18    if (p->text)
19      {
20         elm_anchorblock_text_set(obj, p->text);
21      }
22 }
23
24 static Eina_Bool
25 external_anchorblock_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
26 {
27    if (!strcmp(param->name, "text"))
28      {
29         if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
30           {
31              elm_anchorblock_text_set(obj, param->s);
32              return EINA_TRUE;
33           }
34      }
35
36    ERR("unknown parameter '%s' of type '%s'",
37        param->name, edje_external_param_type_str(param->type));
38
39    return EINA_FALSE;
40 }
41
42 static Eina_Bool
43 external_anchorblock_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
44 {
45    if (!strcmp(param->name, "text"))
46      {
47         if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
48           {
49              param->s = elm_anchorblock_text_get(obj);
50              return EINA_TRUE;
51           }
52      }
53
54    ERR("unknown parameter '%s' of type '%s'",
55        param->name, edje_external_param_type_str(param->type));
56
57    return EINA_FALSE;
58 }
59
60 static void *
61 external_anchorblock_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
62 {
63    Elm_Params_Anchorblock *mem;
64    Edje_External_Param *param;
65    const Eina_List *l;
66
67    mem = ELM_NEW(Elm_Params_Anchorblock);
68    if (!mem)
69      return NULL;
70
71    EINA_LIST_FOREACH(params, l, param)
72      {
73         if (!strcmp(param->name, "text"))
74           mem->text = eina_stringshare_add(param->s);
75      }
76
77    return mem;
78 }
79
80 static Evas_Object *external_anchorblock_content_get(void *data __UNUSED__,
81                 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
82 {
83         ERR("No content.");
84         return NULL;
85 }
86
87 static void
88 external_anchorblock_params_free(void *params)
89 {
90    Elm_Params_Anchorblock *mem = params;
91
92    if (mem->text)
93      eina_stringshare_del(mem->text);
94    free(mem);
95 }
96
97 static Edje_External_Param_Info external_anchorblock_params[] = {
98    DEFINE_EXTERNAL_COMMON_PARAMS,
99    EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("text", "some text"),
100    EDJE_EXTERNAL_PARAM_INFO_SENTINEL
101 };
102
103 DEFINE_EXTERNAL_ICON_ADD(anchorblock, "anchorblock")
104 DEFINE_EXTERNAL_TYPE_SIMPLE(anchorblock, "Anchorblock");