Hoversel External

SVN revision: 47607
This commit is contained in:
Tiago Rezende Campos Falcao 2010-03-30 20:41:56 +00:00
parent 9a8981530d
commit 5dd010bb26
8 changed files with 154 additions and 0 deletions

View File

@ -14,6 +14,7 @@ ico_anchorview.png \
ico_bubble.png \
ico_button.png \
ico_check.png \
ico_hoversel.png \
ico_notepad.png \
ico_radio.png \
ico_scrolled_entry.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -15,6 +15,7 @@ ICON("anchorview")
ICON("bubble")
ICON("button")
ICON("check")
ICON("hoversel")
ICON("notepad")
ICON("radio")
ICON("scrolled_entry")

View File

@ -31,6 +31,7 @@ elm_anchorview.c \
elm_bubble.c \
elm_button.c \
elm_check.c \
elm_hoversel.c \
elm_notepad.c \
elm_radio.c \
elm_scrolled_entry.c \

View File

@ -0,0 +1,140 @@
#include "private.h"
typedef struct _Elm_Params_Hoversel
{
Elm_Params base;
Evas_Object *icon;
Eina_Bool horizontal:1;
Eina_Bool horizontal_exists:1;
} Elm_Params_Hoversel;
static void
external_hoversel_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
{
const Elm_Params_Hoversel *p;
if (to_params) p = to_params;
else if (from_params) p = from_params;
else return;
if (p->base.label)
elm_hoversel_label_set(obj, p->base.label);
if (p->icon)
elm_hoversel_icon_set(obj, p->icon);
if (p->horizontal_exists)
elm_hoversel_horizontal_set(obj, p->horizontal);
}
static Eina_Bool
external_hoversel_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
{
if (!strcmp(param->name, "label"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
elm_hoversel_label_set(obj, param->s);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "icon"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
Evas_Object *icon = external_common_param_icon_get(obj, param);
if (icon)
{
elm_hoversel_icon_set(obj, icon);
return EINA_TRUE;
}
}
}
else if (!strcmp(param->name, "horizontal"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
elm_hoversel_horizontal_set(obj, param->i);
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_hoversel_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
{
if (!strcmp(param->name, "label"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
{
param->s = elm_hoversel_label_get(obj);
return EINA_TRUE;
}
}
else if (!strcmp(param->name, "icon"))
{
/* not easy to get icon name back from live object */
return EINA_FALSE;
}
else if (!strcmp(param->name, "horizontal"))
{
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
{
param->i = elm_hoversel_horizontal_get(obj);
return EINA_TRUE;
}
}
ERR("unknown parameter '%s' of type '%s'",
param->name, edje_external_param_type_str(param->type));
return EINA_FALSE;
}
static void *
external_hoversel_params_parse(void *data, Evas_Object *obj, const Eina_List *params)
{
Elm_Params_Hoversel *mem;
Edje_External_Param *param;
const Eina_List *l;
mem = external_common_params_parse(Elm_Params_Hoversel, data, obj, params);
if (!mem)
return NULL;
external_common_icon_param_parse(&mem->icon, obj, params);
EINA_LIST_FOREACH(params, l, param)
{
if (!strcmp(param->name, "horizontal"))
{
mem->horizontal = !!param->i;
mem->horizontal_exists = EINA_TRUE;
}
}
return mem;
}
static void
external_hoversel_params_free(void *params)
{
Elm_Params_Hoversel *mem = params;
if (mem->icon)
evas_object_del(mem->icon);
external_common_params_free(params);
}
static Edje_External_Param_Info external_hoversel_params[] = {
DEFINE_EXTERNAL_COMMON_PARAMS,
EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"),
EDJE_EXTERNAL_PARAM_INFO_SENTINEL
};
DEFINE_EXTERNAL_ICON_ADD(hoversel, "hoversel");
DEFINE_EXTERNAL_TYPE_SIMPLE(hoversel, "Hoversel");

View File

@ -3,6 +3,7 @@ DEFINE_TYPE(anchorview)
DEFINE_TYPE(bubble)
DEFINE_TYPE(button)
DEFINE_TYPE(check)
DEFINE_TYPE(hoversel)
DEFINE_TYPE(notepad)
DEFINE_TYPE(radio)
DEFINE_TYPE(scrolled_entry)

View File

@ -738,6 +738,7 @@ extern "C" {
EAPI Evas_Object *elm_hoversel_add(Evas_Object *parent);
EAPI void elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
EAPI Eina_Bool elm_hoversel_horizontal_get(const Evas_Object *obj);
EAPI void elm_hoversel_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
EAPI void elm_hoversel_label_set(Evas_Object *obj, const char *label);
EAPI const char *elm_hoversel_label_get(const Evas_Object *obj);

View File

@ -318,6 +318,15 @@ elm_hoversel_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
wd->horizontal = !!horizontal;
}
EAPI Eina_Bool
elm_hoversel_horizontal_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
return wd->horizontal;
}
/**
* Get the hoversel button label
*