forked from enlightenment/efl
* edje: Add alias for part too. This should help designer to
provide the right part name and still use GROUP and BOX. SVN revision: 50001
This commit is contained in:
parent
f424ca1e1e
commit
9560d51241
|
@ -114,6 +114,8 @@ static void st_collections_group_data_item(void);
|
|||
static void ob_collections_group_script(void);
|
||||
static void ob_collections_group_lua_script(void);
|
||||
|
||||
static void st_collections_group_parts_alias(void);
|
||||
|
||||
static void ob_collections_group_parts_part(void);
|
||||
static void st_collections_group_parts_part_name(void);
|
||||
static void st_collections_group_parts_part_type(void);
|
||||
|
@ -325,6 +327,7 @@ New_Statement_Handler statement_handlers[] =
|
|||
{"collections.group.color_classes.color_class.color", st_color_class_color}, /* dup */
|
||||
{"collections.group.color_classes.color_class.color2", st_color_class_color2}, /* dup */
|
||||
{"collections.group.color_classes.color_class.color3", st_color_class_color3}, /* dup */
|
||||
{"collections.group.parts.alias", st_collections_group_parts_alias },
|
||||
{"collections.group.parts.image", st_images_image}, /* dup */
|
||||
{"collections.group.parts.set.name", st_images_set_name},
|
||||
{"collections.group.parts.set.image.image", st_images_set_image_image},
|
||||
|
@ -1991,6 +1994,36 @@ st_collections_group_data_item(void)
|
|||
pc->data = eina_list_append(pc->data, di);
|
||||
}
|
||||
|
||||
/**
|
||||
@page edcref
|
||||
@block
|
||||
parts
|
||||
@context
|
||||
group {
|
||||
parts {
|
||||
alias: "theme_part_path" "real_part_path";
|
||||
..
|
||||
}
|
||||
}
|
||||
@description
|
||||
Alias of part give a chance to let the designer put the real one
|
||||
in a box or reuse one from a GROUP or inside a BOX.
|
||||
@endblock
|
||||
*/
|
||||
static void
|
||||
st_collections_group_parts_alias(void)
|
||||
{
|
||||
Edje_Part_Collection *pc;
|
||||
|
||||
check_arg_count(2);
|
||||
|
||||
pc = eina_list_data_get(eina_list_last(edje_collections));
|
||||
|
||||
if (!pc->alias) pc->alias = eina_hash_string_small_new(NULL);
|
||||
eina_hash_add(pc->alias, parse_str(0), parse_str(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@page edcref
|
||||
@block
|
||||
|
|
|
@ -476,4 +476,13 @@ _edje_edd_init(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "id", id, EET_T_INT);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "script_only", script_only, EET_T_UCHAR);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR);
|
||||
|
||||
{
|
||||
Edje_Part_Collection epc;
|
||||
|
||||
eet_data_descriptor_element_add(_edje_edd_edje_part_collection,
|
||||
"alias", EET_T_STRING, EET_G_HASH,
|
||||
(char *)(&(epc.alias)) - (char *)(&(epc)),
|
||||
0, /* 0, */NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -567,6 +567,8 @@ struct _Edje_Part_Collection
|
|||
|
||||
int id; /* the collection id */
|
||||
|
||||
Eina_Hash *alias; /* aliasing part*/
|
||||
|
||||
struct {
|
||||
Edje_Size min, max;
|
||||
} prop;
|
||||
|
|
|
@ -4280,6 +4280,7 @@ _edje_real_part_recursive_get_helper(Edje *ed, char **path)
|
|||
{
|
||||
Edje_Real_Part *rp;
|
||||
Evas_Object *child;
|
||||
const char *alias = NULL;
|
||||
char *idx = NULL;
|
||||
|
||||
//printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
|
||||
|
@ -4298,9 +4299,20 @@ _edje_real_part_recursive_get_helper(Edje *ed, char **path)
|
|||
}
|
||||
}
|
||||
|
||||
if (ed->file->collection)
|
||||
alias = eina_hash_find(ed->file->collection, path[0]);
|
||||
if (alias)
|
||||
{
|
||||
rp = _edje_real_part_recursive_get(ed, alias);
|
||||
if (path[1] == NULL) return rp;
|
||||
if (!rp) return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rp = _edje_real_part_get(ed, path[0]);
|
||||
if (path[1] == NULL) return rp;
|
||||
if (!rp) return NULL;
|
||||
}
|
||||
|
||||
switch (rp->part->type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue