forked from enlightenment/efl
edje: edje_edit - adding API to move to the specified place in the parts stack
This commit will add some API to restack part above/below target part. There are two functions will be added: 1. edje_edit_part_restack_part_below 2. edje_edit_part_restack_part_above Reviewers: cedric, seoz, raster Reviewed By: cedric CC: cedric Differential Revision: https://phab.enlightenment.org/D390 Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
This commit is contained in:
parent
287d63c016
commit
8bff25fadc
|
@ -841,6 +841,17 @@ EAPI const char * edje_edit_part_below_get(Evas_Object *obj, const char *part);
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool edje_edit_part_restack_below(Evas_Object *obj, const char *part);
|
EAPI Eina_Bool edje_edit_part_restack_below(Evas_Object *obj, const char *part);
|
||||||
|
|
||||||
|
/** Move the given part below the part named below.
|
||||||
|
*
|
||||||
|
* @param obj Object being edited.
|
||||||
|
* @param part Name of part which will be moved.
|
||||||
|
* @param below Name of part for which will be moved 'part'.
|
||||||
|
*
|
||||||
|
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_part_restack_part_below(Evas_Object *obj, const char* part, const char *below);
|
||||||
|
|
||||||
/** Move the given part above the next one.
|
/** Move the given part above the next one.
|
||||||
*
|
*
|
||||||
* @param obj Object being edited.
|
* @param obj Object being edited.
|
||||||
|
@ -850,6 +861,17 @@ EAPI Eina_Bool edje_edit_part_restack_below(Evas_Object *obj, const char *part);
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool edje_edit_part_restack_above(Evas_Object *obj, const char *part);
|
EAPI Eina_Bool edje_edit_part_restack_above(Evas_Object *obj, const char *part);
|
||||||
|
|
||||||
|
/** Move the given part above the part named above.
|
||||||
|
*
|
||||||
|
* @param obj Object being edited.
|
||||||
|
* @param part Name of part which will be moved.
|
||||||
|
* @param above Name of part for which will be moved 'part'.
|
||||||
|
*
|
||||||
|
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_part_restack_part_above(Evas_Object *obj, const char* part, const char *below);
|
||||||
|
|
||||||
/** Set a new name for part.
|
/** Set a new name for part.
|
||||||
*
|
*
|
||||||
* Note that the relative getter function don't exist as it don't make sense ;)
|
* Note that the relative getter function don't exist as it don't make sense ;)
|
||||||
|
|
|
@ -2501,6 +2501,45 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_part_restack_part_below(Evas_Object *obj, const char* part, const char *below)
|
||||||
|
{
|
||||||
|
Edje_Part_Collection *group;
|
||||||
|
Edje_Real_Part *rp, *rp_below, *prev;
|
||||||
|
Edje_Part *swap;
|
||||||
|
|
||||||
|
GET_EED_OR_RETURN(EINA_FALSE);
|
||||||
|
GET_ED_OR_RETURN(EINA_FALSE);
|
||||||
|
rp = _edje_real_part_get(ed, part);
|
||||||
|
if (!rp) return EINA_FALSE;
|
||||||
|
rp_below = _edje_real_part_get(ed, below);
|
||||||
|
if (!rp_below) return EINA_FALSE;
|
||||||
|
|
||||||
|
if (rp->part->id < 1) return EINA_FALSE;
|
||||||
|
if (rp_below->part->id < 1) return EINA_FALSE;
|
||||||
|
group = ed->collection;
|
||||||
|
|
||||||
|
while (rp->part->id != (rp_below->part->id - 1))
|
||||||
|
{
|
||||||
|
if (rp->part->id > rp_below->part->id)
|
||||||
|
prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
|
||||||
|
else
|
||||||
|
prev = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
|
||||||
|
swap = group->parts[rp->part->id];
|
||||||
|
group->parts[rp->part->id] = group->parts[prev->part->id];
|
||||||
|
group->parts[prev->part->id] = swap;
|
||||||
|
_edje_parts_id_switch(ed, rp, prev);
|
||||||
|
}
|
||||||
|
|
||||||
|
evas_object_stack_below(rp->object, rp_below->object);
|
||||||
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
||||||
|
evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
|
||||||
|
|
||||||
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
edje_edit_part_restack_above(Evas_Object *obj, const char* part)
|
edje_edit_part_restack_above(Evas_Object *obj, const char* part)
|
||||||
{
|
{
|
||||||
|
@ -2536,6 +2575,45 @@ edje_edit_part_restack_above(Evas_Object *obj, const char* part)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_part_restack_part_above(Evas_Object *obj, const char* part, const char *above)
|
||||||
|
{
|
||||||
|
Edje_Part_Collection *group;
|
||||||
|
Edje_Real_Part *rp, *rp_above, *next;
|
||||||
|
Edje_Part *swap;
|
||||||
|
|
||||||
|
GET_EED_OR_RETURN(EINA_FALSE);
|
||||||
|
GET_ED_OR_RETURN(EINA_FALSE);
|
||||||
|
rp = _edje_real_part_get(ed, part);
|
||||||
|
if (!rp) return EINA_FALSE;
|
||||||
|
rp_above = _edje_real_part_get(ed, above);
|
||||||
|
if (!rp_above) return EINA_FALSE;
|
||||||
|
|
||||||
|
if (rp->part->id < 1) return EINA_FALSE;
|
||||||
|
if (rp_above->part->id < 1) return EINA_FALSE;
|
||||||
|
group = ed->collection;
|
||||||
|
|
||||||
|
while (rp->part->id != rp_above->part->id + 1)
|
||||||
|
{
|
||||||
|
if (rp->part->id > rp_above->part->id)
|
||||||
|
next = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
|
||||||
|
else
|
||||||
|
next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
|
||||||
|
swap = group->parts[rp->part->id];
|
||||||
|
group->parts[rp->part->id] = group->parts[next->part->id];
|
||||||
|
group->parts[next->part->id] = swap;
|
||||||
|
_edje_parts_id_switch(ed, rp, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
evas_object_stack_above(rp->object, rp_above->object);
|
||||||
|
if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
|
||||||
|
evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
|
||||||
|
|
||||||
|
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI Edje_Part_Type
|
EAPI Edje_Part_Type
|
||||||
edje_edit_part_type_get(Evas_Object *obj, const char *part)
|
edje_edit_part_type_get(Evas_Object *obj, const char *part)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue