summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>2013-12-19 15:40:18 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-12-19 15:53:48 +0900
commit8bff25fadc5726b7fbf0f98c6a7f2aa541a80cc5 (patch)
tree85d9391bb37a2925b4ce56a12f4f6ad361bc0afe /src/lib
parent287d63c016fbc8ef18a685cced62561dbb5d26fa (diff)
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>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/edje/Edje_Edit.h22
-rw-r--r--src/lib/edje/edje_edit.c78
2 files changed, 100 insertions, 0 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index d5c3d43f2e..72d96f1a2c 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -841,6 +841,17 @@ EAPI const char * edje_edit_part_below_get(Evas_Object *obj, const char *part);
841 */ 841 */
842EAPI Eina_Bool edje_edit_part_restack_below(Evas_Object *obj, const char *part); 842EAPI Eina_Bool edje_edit_part_restack_below(Evas_Object *obj, const char *part);
843 843
844/** Move the given part below the part named below.
845 *
846 * @param obj Object being edited.
847 * @param part Name of part which will be moved.
848 * @param below Name of part for which will be moved 'part'.
849 *
850 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
851 */
852EAPI Eina_Bool
853edje_edit_part_restack_part_below(Evas_Object *obj, const char* part, const char *below);
854
844/** Move the given part above the next one. 855/** Move the given part above the next one.
845 * 856 *
846 * @param obj Object being edited. 857 * @param obj Object being edited.
@@ -850,6 +861,17 @@ EAPI Eina_Bool edje_edit_part_restack_below(Evas_Object *obj, const char *part);
850 */ 861 */
851EAPI Eina_Bool edje_edit_part_restack_above(Evas_Object *obj, const char *part); 862EAPI Eina_Bool edje_edit_part_restack_above(Evas_Object *obj, const char *part);
852 863
864/** Move the given part above the part named above.
865 *
866 * @param obj Object being edited.
867 * @param part Name of part which will be moved.
868 * @param above Name of part for which will be moved 'part'.
869 *
870 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
871 */
872EAPI Eina_Bool
873edje_edit_part_restack_part_above(Evas_Object *obj, const char* part, const char *below);
874
853/** Set a new name for part. 875/** Set a new name for part.
854 * 876 *
855 * Note that the relative getter function don't exist as it don't make sense ;) 877 * Note that the relative getter function don't exist as it don't make sense ;)
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 214381fa1a..ea74262ed5 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -2502,6 +2502,45 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part)
2502} 2502}
2503 2503
2504EAPI Eina_Bool 2504EAPI Eina_Bool
2505edje_edit_part_restack_part_below(Evas_Object *obj, const char* part, const char *below)
2506{
2507 Edje_Part_Collection *group;
2508 Edje_Real_Part *rp, *rp_below, *prev;
2509 Edje_Part *swap;
2510
2511 GET_EED_OR_RETURN(EINA_FALSE);
2512 GET_ED_OR_RETURN(EINA_FALSE);
2513 rp = _edje_real_part_get(ed, part);
2514 if (!rp) return EINA_FALSE;
2515 rp_below = _edje_real_part_get(ed, below);
2516 if (!rp_below) return EINA_FALSE;
2517
2518 if (rp->part->id < 1) return EINA_FALSE;
2519 if (rp_below->part->id < 1) return EINA_FALSE;
2520 group = ed->collection;
2521
2522 while (rp->part->id != (rp_below->part->id - 1))
2523 {
2524 if (rp->part->id > rp_below->part->id)
2525 prev = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
2526 else
2527 prev = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
2528 swap = group->parts[rp->part->id];
2529 group->parts[rp->part->id] = group->parts[prev->part->id];
2530 group->parts[prev->part->id] = swap;
2531 _edje_parts_id_switch(ed, rp, prev);
2532 }
2533
2534 evas_object_stack_below(rp->object, rp_below->object);
2535 if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
2536 evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
2537
2538 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
2539
2540 return EINA_TRUE;
2541}
2542
2543EAPI Eina_Bool
2505edje_edit_part_restack_above(Evas_Object *obj, const char* part) 2544edje_edit_part_restack_above(Evas_Object *obj, const char* part)
2506{ 2545{
2507 Edje_Part_Collection *group; 2546 Edje_Part_Collection *group;
@@ -2536,6 +2575,45 @@ edje_edit_part_restack_above(Evas_Object *obj, const char* part)
2536 return EINA_TRUE; 2575 return EINA_TRUE;
2537} 2576}
2538 2577
2578EAPI Eina_Bool
2579edje_edit_part_restack_part_above(Evas_Object *obj, const char* part, const char *above)
2580{
2581 Edje_Part_Collection *group;
2582 Edje_Real_Part *rp, *rp_above, *next;
2583 Edje_Part *swap;
2584
2585 GET_EED_OR_RETURN(EINA_FALSE);
2586 GET_ED_OR_RETURN(EINA_FALSE);
2587 rp = _edje_real_part_get(ed, part);
2588 if (!rp) return EINA_FALSE;
2589 rp_above = _edje_real_part_get(ed, above);
2590 if (!rp_above) return EINA_FALSE;
2591
2592 if (rp->part->id < 1) return EINA_FALSE;
2593 if (rp_above->part->id < 1) return EINA_FALSE;
2594 group = ed->collection;
2595
2596 while (rp->part->id != rp_above->part->id + 1)
2597 {
2598 if (rp->part->id > rp_above->part->id)
2599 next = ed->table_parts[(rp->part->id - 1) % ed->table_parts_size];
2600 else
2601 next = ed->table_parts[(rp->part->id + 1) % ed->table_parts_size];
2602 swap = group->parts[rp->part->id];
2603 group->parts[rp->part->id] = group->parts[next->part->id];
2604 group->parts[next->part->id] = swap;
2605 _edje_parts_id_switch(ed, rp, next);
2606 }
2607
2608 evas_object_stack_above(rp->object, rp_above->object);
2609 if ((rp->typedata.swallow) && (rp->typedata.swallow->swallowed_object))
2610 evas_object_stack_above(rp->typedata.swallow->swallowed_object, rp->object);
2611
2612 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
2613
2614 return EINA_TRUE;
2615}
2616
2539EAPI Edje_Part_Type 2617EAPI Edje_Part_Type
2540edje_edit_part_type_get(Evas_Object *obj, const char *part) 2618edje_edit_part_type_get(Evas_Object *obj, const char *part)
2541{ 2619{