forked from enlightenment/efl
elementary: add edje_external gengrid
SVN revision: 56843
This commit is contained in:
parent
22fb070ad7
commit
863cd6e598
|
@ -38,6 +38,7 @@ elm_fileselector.c \
|
|||
elm_fileselector_button.c \
|
||||
elm_fileselector_entry.c \
|
||||
elm_genlist.c \
|
||||
elm_gengrid.c \
|
||||
elm_hoversel.c \
|
||||
elm_list.c \
|
||||
elm_map.c \
|
||||
|
|
|
@ -0,0 +1,225 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "private.h"
|
||||
|
||||
typedef struct _Elm_Params_Gengrid
|
||||
{
|
||||
Elm_Params base;
|
||||
Eina_Bool multi : 1;
|
||||
Eina_Bool multi_exists : 1;
|
||||
Eina_Bool no_select : 1;
|
||||
Eina_Bool no_select_exists : 1;
|
||||
Eina_Bool always_select : 1;
|
||||
Eina_Bool always_select_exists : 1;
|
||||
Eina_Bool h_bounce:1;
|
||||
Eina_Bool h_bounce_exists:1;
|
||||
Eina_Bool v_bounce:1;
|
||||
Eina_Bool v_bounce_exists:1;
|
||||
} Elm_Params_Gengrid;
|
||||
|
||||
static void
|
||||
external_gengrid_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
|
||||
{
|
||||
const Elm_Params_Gengrid *p;
|
||||
|
||||
if (to_params) p = to_params;
|
||||
else if (from_params) p = from_params;
|
||||
else return;
|
||||
|
||||
if (p->multi_exists)
|
||||
elm_gengrid_multi_select_set(obj, p->multi);
|
||||
if (p->no_select_exists)
|
||||
elm_gengrid_no_select_mode_set (obj, p->no_select);
|
||||
if (p->always_select_exists)
|
||||
elm_gengrid_always_select_mode_set (obj, p->always_select);
|
||||
if (p->h_bounce_exists)
|
||||
{
|
||||
Eina_Bool h_bounce, v_bounce;
|
||||
elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
|
||||
elm_gengrid_bounce_set(obj, p->h_bounce, v_bounce);
|
||||
}
|
||||
if (p->v_bounce_exists)
|
||||
{
|
||||
Eina_Bool h_bounce, v_bounce;
|
||||
elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
|
||||
elm_gengrid_bounce_set(obj, h_bounce, p->v_bounce);
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
external_gengrid_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
|
||||
{
|
||||
if (!strcmp(param->name, "multi select"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
elm_gengrid_multi_select_set(obj, param->i);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "no selected"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
elm_gengrid_no_select_mode_set(obj, param->i);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "always select"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
elm_gengrid_always_select_mode_set(obj, param->i);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "height bounce"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
Eina_Bool h_bounce, v_bounce;
|
||||
elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
|
||||
elm_gengrid_bounce_set(obj, param->i, v_bounce);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "width bounce"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
Eina_Bool h_bounce, v_bounce;
|
||||
elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
|
||||
elm_gengrid_bounce_set(obj, h_bounce, 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_gengrid_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
|
||||
{
|
||||
if (!strcmp(param->name, "multi select"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
param->i = elm_gengrid_multi_select_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "no selected"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
param->i = elm_gengrid_no_select_mode_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "always select"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
param->i = elm_gengrid_always_select_mode_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "height bounce"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
Eina_Bool h_bounce, v_bounce;
|
||||
elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
|
||||
param->i = h_bounce;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "width bounce"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
Eina_Bool h_bounce, v_bounce;
|
||||
elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
|
||||
param->i = v_bounce;
|
||||
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_gengrid_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
|
||||
{
|
||||
Elm_Params_Gengrid *mem;
|
||||
Edje_External_Param *param;
|
||||
const Eina_List *l;
|
||||
|
||||
mem = ELM_NEW(Elm_Params_Gengrid);
|
||||
if (!mem)
|
||||
return NULL;
|
||||
|
||||
EINA_LIST_FOREACH(params, l, param)
|
||||
{
|
||||
if (!strcmp(param->name, "multi select"))
|
||||
{
|
||||
mem->multi = !!param->i;
|
||||
mem->multi_exists = EINA_TRUE;
|
||||
}
|
||||
else if (!strcmp(param->name, "no selected"))
|
||||
{
|
||||
mem->no_select = !!param->i;
|
||||
mem->no_select_exists = EINA_TRUE;
|
||||
}
|
||||
else if (!strcmp(param->name, "always select"))
|
||||
{
|
||||
mem->always_select = !!param->i;
|
||||
mem->always_select_exists = EINA_TRUE;
|
||||
}
|
||||
else if (!strcmp(param->name, "height bounce"))
|
||||
{
|
||||
mem->h_bounce = !!param->i;
|
||||
mem->h_bounce_exists = EINA_TRUE;
|
||||
}
|
||||
else if (!strcmp(param->name, "width bounce"))
|
||||
{
|
||||
mem->v_bounce = !!param->i;
|
||||
mem->v_bounce_exists = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
external_gengrid_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
|
||||
{
|
||||
ERR("No content.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
external_gengrid_params_free(void *params)
|
||||
{
|
||||
Elm_Params_Gengrid *mem = params;
|
||||
free(mem);
|
||||
}
|
||||
|
||||
static Edje_External_Param_Info external_gengrid_params[] = {
|
||||
DEFINE_EXTERNAL_COMMON_PARAMS,
|
||||
EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_SENTINEL
|
||||
};
|
||||
|
||||
DEFINE_EXTERNAL_ICON_ADD(gengrid, "gengrid");
|
||||
DEFINE_EXTERNAL_TYPE_SIMPLE(gengrid, "Generic Grid");
|
|
@ -8,6 +8,7 @@ DEFINE_TYPE(fileselector)
|
|||
DEFINE_TYPE(fileselector_button)
|
||||
DEFINE_TYPE(fileselector_entry)
|
||||
DEFINE_TYPE(genlist)
|
||||
DEFINE_TYPE(gengrid)
|
||||
DEFINE_TYPE(hoversel)
|
||||
DEFINE_TYPE(list)
|
||||
DEFINE_TYPE(map)
|
||||
|
|
Loading…
Reference in New Issue