forked from enlightenment/efl
parent
998ffa4094
commit
45652e5da5
|
@ -1493,8 +1493,9 @@ const char * _edje_text_class_font_get(Edje *ed,
|
|||
int *size, char **free_later);
|
||||
|
||||
|
||||
Edje_Real_Part *_edje_real_part_get(Edje *ed, const char *part);
|
||||
Edje_Real_Part *_edje_real_part_recursive_get(Edje *ed, const char *part);
|
||||
Edje_Real_Part *_edje_real_part_get(const Edje *ed, const char *part);
|
||||
Edje_Real_Part *_edje_real_part_recursive_get(const Edje *ed, const char *part);
|
||||
Edje *_edje_recursive_get(Edje *ed, const char *part, Edje_Real_Part **orp);
|
||||
Edje_Color_Class *_edje_color_class_find(Edje *ed, const char *color_class);
|
||||
void _edje_color_class_member_add(Edje *ed, const char *color_class);
|
||||
void _edje_color_class_member_del(Edje *ed, const char *color_class);
|
||||
|
|
|
@ -1008,7 +1008,8 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
|
|||
*/
|
||||
if (sep)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
Edje_Real_Part *rp = NULL;
|
||||
Edje *ed2;
|
||||
char *newsig;
|
||||
size_t length;
|
||||
char *part;
|
||||
|
@ -1025,24 +1026,20 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
|
|||
*newsig = '\0';
|
||||
newsig++;
|
||||
|
||||
rp = _edje_real_part_recursive_get(ed, part);
|
||||
if (rp && rp->part)
|
||||
ed2 = _edje_recursive_get(ed, part, &rp);
|
||||
if (ed2 && ed2 != ed)
|
||||
{
|
||||
_edje_emit(ed2, newsig, src);
|
||||
return; /* stop processing.
|
||||
* XXX maybe let signal be processed anyway?
|
||||
* XXX in this case, just comment this line
|
||||
*/
|
||||
}
|
||||
|
||||
if (rp)
|
||||
{
|
||||
switch (rp->part->type)
|
||||
{
|
||||
case EDJE_PART_TYPE_GROUP:
|
||||
{
|
||||
Edje *ed2;
|
||||
|
||||
if (!rp->swallowed_object) break ;
|
||||
|
||||
ed2 = _edje_fetch(rp->swallowed_object);
|
||||
if (ed2) _edje_emit(ed2, newsig, src);
|
||||
return; /* stop processing.
|
||||
* XXX maybe let signal be processed anyway?
|
||||
* XXX in this case, just comment this line
|
||||
*/
|
||||
}
|
||||
case EDJE_PART_TYPE_EXTERNAL:
|
||||
{
|
||||
if (!rp->swallowed_object) break ;
|
||||
|
@ -1056,6 +1053,17 @@ _edje_emit(Edje *ed, const char *sig, const char *src)
|
|||
_edje_emit(rp->edje, newsig, src);
|
||||
return;
|
||||
}
|
||||
case EDJE_PART_TYPE_GROUP:
|
||||
if (!rp->swallowed_object) break;
|
||||
|
||||
ed2 = _edje_fetch(rp->swallowed_object);
|
||||
if (!ed2) break;
|
||||
|
||||
_edje_emit(ed2, newsig, src);
|
||||
return;
|
||||
default:
|
||||
fprintf(stderr, "SPANK SPANK SPANK !!!\nYou should never be here !\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,8 @@ static Eina_Bool _edje_text_class_list_foreach(const Eina_Hash *hash, const void
|
|||
static void _edje_object_image_preload_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _edje_object_signal_preload_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
|
||||
Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje *ed, char **path);
|
||||
Edje_Real_Part *_edje_real_part_recursive_get_helper(const Edje *ed, char **path);
|
||||
static Edje *_edje_recursive_get_helper(Edje *ed, char **path, Edje_Real_Part **orp);
|
||||
|
||||
/************************** API Routines **************************/
|
||||
|
||||
|
@ -4357,7 +4358,7 @@ _edje_real_part_table_clear(Edje_Real_Part *rp, Eina_Bool clear)
|
|||
}
|
||||
|
||||
Edje_Real_Part *
|
||||
_edje_real_part_recursive_get(Edje *ed, const char *part)
|
||||
_edje_real_part_recursive_get(const Edje *ed, const char *part)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
char **path;
|
||||
|
@ -4373,6 +4374,23 @@ _edje_real_part_recursive_get(Edje *ed, const char *part)
|
|||
return rp;
|
||||
}
|
||||
|
||||
Edje *
|
||||
_edje_recursive_get(Edje *ed, const char *part, Edje_Real_Part **orp)
|
||||
{
|
||||
Edje *oed;
|
||||
char **path;
|
||||
|
||||
path = eina_str_split(part, EDJE_PART_PATH_SEPARATOR_STRING, 0);
|
||||
if (!path) return NULL;
|
||||
|
||||
//printf("recursive get: %s\n", part);
|
||||
oed = _edje_recursive_get_helper(ed, path, orp);
|
||||
|
||||
free(*path);
|
||||
free(path);
|
||||
return oed;
|
||||
}
|
||||
|
||||
Evas_Object *
|
||||
_edje_children_get(Edje_Real_Part *rp, const char *partid)
|
||||
{
|
||||
|
@ -4422,16 +4440,22 @@ _edje_children_get(Edje_Real_Part *rp, const char *partid)
|
|||
}
|
||||
|
||||
Edje_Real_Part *
|
||||
_edje_real_part_recursive_get_helper(Edje *ed, char **path)
|
||||
_edje_real_part_recursive_get_helper(const Edje *ed, char **path)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
Evas_Object *child;
|
||||
const char *alias = NULL;
|
||||
char *idx = NULL;
|
||||
|
||||
if (ed->collection && ed->collection->alias)
|
||||
alias = eina_hash_find(ed->collection->alias, path[0]);
|
||||
|
||||
if (!alias)
|
||||
alias = path[0];
|
||||
|
||||
//printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
|
||||
if (path[0])
|
||||
idx = strchr(path[0], EDJE_PART_PATH_SEPARATOR_INDEXL);
|
||||
if (alias)
|
||||
idx = strchr(alias, EDJE_PART_PATH_SEPARATOR_INDEXL);
|
||||
if (idx)
|
||||
{
|
||||
char *end;
|
||||
|
@ -4445,18 +4469,16 @@ _edje_real_part_recursive_get_helper(Edje *ed, char **path)
|
|||
}
|
||||
}
|
||||
|
||||
if (ed->collection && ed->collection->alias)
|
||||
alias = eina_hash_find(ed->collection->alias, path[0]);
|
||||
if (alias)
|
||||
if (alias != path[0])
|
||||
{
|
||||
rp = _edje_real_part_recursive_get(ed, alias);
|
||||
if (!path[1]) return rp;
|
||||
if (!path[1] && !idx) return rp;
|
||||
if (!rp) return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rp = _edje_real_part_get(ed, path[0]);
|
||||
if (!path[1]) return rp;
|
||||
if (!path[1] && !idx) return rp;
|
||||
if (!rp) return NULL;
|
||||
}
|
||||
|
||||
|
@ -4478,20 +4500,88 @@ _edje_real_part_recursive_get_helper(Edje *ed, char **path)
|
|||
|
||||
ed = _edje_fetch(child);
|
||||
if (!ed) return NULL;
|
||||
if ((rp = _edje_real_part_recursive_get_helper(ed, path)))
|
||||
return rp;
|
||||
|
||||
return NULL;
|
||||
return _edje_real_part_recursive_get_helper(ed, path);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Private Routines */
|
||||
static Edje *
|
||||
_edje_recursive_get_helper(Edje *ed, char **path, Edje_Real_Part **orp)
|
||||
{
|
||||
Evas_Object *child;
|
||||
Edje_Real_Part *rp;
|
||||
const char *alias = NULL;
|
||||
char *idx = NULL;
|
||||
|
||||
if (ed->collection && ed->collection->alias)
|
||||
alias = eina_hash_find(ed->collection->alias, path[0]);
|
||||
|
||||
if (!alias)
|
||||
alias = path[0];
|
||||
|
||||
//printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
|
||||
if (alias)
|
||||
idx = strchr(alias, EDJE_PART_PATH_SEPARATOR_INDEXL);
|
||||
if (idx)
|
||||
{
|
||||
char *end;
|
||||
|
||||
end = strchr(idx + 1, EDJE_PART_PATH_SEPARATOR_INDEXR);
|
||||
if (end)
|
||||
{
|
||||
*end = '\0';
|
||||
*idx = '\0';
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
if (alias != path[0])
|
||||
rp = _edje_real_part_recursive_get(ed, alias);
|
||||
else
|
||||
rp = _edje_real_part_get(ed, path[0]);
|
||||
|
||||
if (!rp) return NULL;
|
||||
if (!path[1] && !idx)
|
||||
{
|
||||
*orp = rp;
|
||||
return rp->edje;
|
||||
}
|
||||
|
||||
switch (rp->part->type)
|
||||
{
|
||||
case EDJE_PART_TYPE_GROUP:
|
||||
if (!rp->swallowed_object) return NULL;
|
||||
ed = _edje_fetch(rp->swallowed_object);
|
||||
if (!ed) return NULL;
|
||||
path++;
|
||||
|
||||
if (!path[0]) return ed;
|
||||
return _edje_recursive_get_helper(ed, path, orp);
|
||||
case EDJE_PART_TYPE_BOX:
|
||||
case EDJE_PART_TYPE_TABLE:
|
||||
case EDJE_PART_TYPE_EXTERNAL:
|
||||
if (!idx)
|
||||
{
|
||||
*orp = rp;
|
||||
return NULL;
|
||||
}
|
||||
path++;
|
||||
|
||||
child = _edje_children_get(rp, idx);
|
||||
|
||||
ed = _edje_fetch(child);
|
||||
if (!ed) return NULL;
|
||||
if (!path[0]) return ed;
|
||||
return _edje_recursive_get_helper(ed, path, orp);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Edje_Real_Part *
|
||||
_edje_real_part_get(Edje *ed, const char *part)
|
||||
_edje_real_part_get(const Edje *ed, const char *part)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
|
Loading…
Reference in New Issue