forked from enlightenment/efl
edje_external: add combobox external
The combobox widget can now be used from edje externals. It accepts the "guide" parameter, which is of type string.
This commit is contained in:
parent
bc8f87c3ac
commit
fd5f07300f
|
@ -1207,6 +1207,7 @@ edje_external_elementary_module_la_SOURCES = \
|
|||
edje_external/elementary/elm_calendar.c \
|
||||
edje_external/elementary/elm_check.c \
|
||||
edje_external/elementary/elm_clock.c \
|
||||
edje_external/elementary/elm_combobox.c \
|
||||
edje_external/elementary/elm_entry.c \
|
||||
edje_external/elementary/elm_fileselector.c \
|
||||
edje_external/elementary/elm_fileselector_button.c \
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
#include "private.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elm_Params base;
|
||||
Eina_Stringshare *guide;
|
||||
} Elm_Params_Combobox;
|
||||
|
||||
|
||||
static void
|
||||
external_combobox_state_set(void *data EINA_UNUSED,
|
||||
Evas_Object *obj,
|
||||
const void *from_params,
|
||||
const void *to_params,
|
||||
float pos EINA_UNUSED)
|
||||
{
|
||||
const Elm_Params_Combobox *p;
|
||||
|
||||
if (to_params) p = to_params;
|
||||
else if (from_params) p = from_params;
|
||||
else return;
|
||||
|
||||
if (p->guide) elm_object_part_text_set(obj, "guide", p->guide);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
external_combobox_param_set(void *data EINA_UNUSED,
|
||||
Evas_Object *obj,
|
||||
const Edje_External_Param *param)
|
||||
{
|
||||
if (!strcmp(param->name, "guide"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
|
||||
{
|
||||
elm_object_part_text_set(obj, "guide", param->s);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
ERR("unknown parameter '%s' of type '%s'", param->name,
|
||||
edje_external_param_type_str(param->type));
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
external_combobox_param_get(void *data EINA_UNUSED,
|
||||
const Evas_Object *obj,
|
||||
Edje_External_Param *param)
|
||||
{
|
||||
if (!strcmp(param->name, "guide"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
|
||||
{
|
||||
param->s = elm_object_part_text_get(obj, "guide");
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
ERR("Unknown parameter '%s' f type %s", param->name,
|
||||
edje_external_param_type_str(param->type));
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void *
|
||||
external_combobox_params_parse(void *data EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const Eina_List *params)
|
||||
{
|
||||
Elm_Params_Combobox *mem;
|
||||
Edje_External_Param *param;
|
||||
const Eina_List *l;
|
||||
|
||||
mem = calloc(1, sizeof(*mem));
|
||||
if (EINA_UNLIKELY(!mem))
|
||||
return NULL;
|
||||
|
||||
EINA_LIST_FOREACH(params, l, param)
|
||||
{
|
||||
if (!strcmp(param->name, "guide"))
|
||||
{
|
||||
mem->guide = eina_stringshare_add(param->s);
|
||||
}
|
||||
}
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
external_combobox_content_get(void *data EINA_UNUSED,
|
||||
const Evas_Object *obj EINA_UNUSED,
|
||||
const char *content EINA_UNUSED)
|
||||
{
|
||||
ERR("No content for combobox");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
external_combobox_params_free(void *params)
|
||||
{
|
||||
Elm_Params_Combobox *const mem = params;
|
||||
|
||||
if (mem->guide) eina_stringshare_del(mem->guide);
|
||||
free(mem);
|
||||
}
|
||||
|
||||
static Edje_External_Param_Info external_combobox_params[] = {
|
||||
DEFINE_EXTERNAL_COMMON_PARAMS,
|
||||
EDJE_EXTERNAL_PARAM_INFO_STRING("guide"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_SENTINEL
|
||||
};
|
||||
|
||||
DEFINE_EXTERNAL_ICON_ADD(combobox, "combobox");
|
||||
DEFINE_EXTERNAL_TYPE_SIMPLE(combobox, "Combobox");
|
|
@ -5,6 +5,7 @@ DEFINE_TYPE(button)
|
|||
DEFINE_TYPE(calendar)
|
||||
DEFINE_TYPE(check)
|
||||
DEFINE_TYPE(clock)
|
||||
DEFINE_TYPE(combobox)
|
||||
DEFINE_TYPE(entry)
|
||||
DEFINE_TYPE(fileselector)
|
||||
DEFINE_TYPE(fileselector_button)
|
||||
|
|
Loading…
Reference in New Issue