efl/src/lib/edje/edje_box_layout.c

256 lines
8.9 KiB
C
Raw Normal View History

Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
#include "edje_private.h"
#include <Eo.h>
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
typedef struct _Edje_Transition_Animation_Data Edje_Transition_Animation_Data;
struct _Edje_Transition_Animation_Data
{
Evas_Object *obj;
struct
{
Evas_Coord x, y, w, h;
} start, end;
};
struct _Edje_Part_Box_Animation
{
struct
{
Evas_Object_Box_Layout layout;
void *data;
void(*free_data)(void *data);
Edje_Alignment align;
Evas_Point padding;
} start, end;
Eina_List *objs;
Eina_Bool recalculate:1;
Evas_Object *box;
double progress;
double start_progress;
int box_start_w, box_start_h;
};
static void
_edje_box_layout_find_all(const char *name, const char *name_alt, Evas_Object_Box_Layout *cb, void **data, void (**free_data)(void *data))
{
if (!_edje_box_layout_find(name, cb, data, free_data))
{
if ((!name_alt) ||
(!_edje_box_layout_find(name_alt, cb, data, free_data)))
{
ERR("box layout '%s' (fallback '%s') not available, using horizontal.",
name, name_alt);
*cb = evas_object_box_layout_horizontal;
*free_data = NULL;
*data = NULL;
}
}
}
static void
_edje_box_layout_calculate_coords(Evas_Object *obj, Evas_Object_Box_Data *priv, Edje_Part_Box_Animation *anim)
{
Eina_List *l;
Edje_Transition_Animation_Data *tad;
Evas_Coord x, y;
evas_object_geometry_get(obj, &x, &y, &anim->box_start_w, &anim->box_start_h);
EINA_LIST_FOREACH(anim->objs, l, tad)
{
evas_object_geometry_get(tad->obj, &tad->start.x, &tad->start.y,
&tad->start.w, &tad->start.h);
tad->start.x = tad->start.x - x;
tad->start.y = tad->start.y - y;
}
evas_object_box_padding_set(obj, anim->end.padding.x, anim->end.padding.y);
evas_object_box_align_set(obj, TO_DOUBLE(anim->end.align.x), TO_DOUBLE(anim->end.align.y));
edje: Fix edje box crash When a signal change a state of a edje box to a state that was already active and we add/del a item of edje box a crash happen. Example: test.edc: collections { group { name: "box_text"; parts { part { name: "elm.box.buttons"; type: BOX; description { state: "default" 0.0; min: 0 100; max: 9999 100; align: 0 0; box { layout: "horizontal"; min: 1 1; } visible: 0; } description { state: "show" 0.0; inherit: "default" 0.0; visible: 1; } } } programs { program { signal: "show,buttons"; source: "gui"; action: STATE_SET "show" 0.0; transition: ACCELERATE 1; target: "elm.box.buttons"; } program { signal: "hide,buttons"; source: "gui"; action: STATE_SET "default" 0.0; transition: ACCELERATE 1; target: "elm.box.buttons"; } } } } test.c: //Compile with: //gcc -g test.c -o test `pkg-config --cflags --libs elementary edje ecore` static int count = 0; static Eina_Bool _fill(void *data) { int i; Evas_Object *layout = data; Evas_Object *edje = elm_layout_edje_get(layout); edje_object_part_box_remove_all(edje, "elm.box.buttons", EINA_TRUE); elm_layout_signal_emit(layout, "show,buttons", "gui"); printf("_fill()\n"); for (i = 0; i < 5; i++, count++) { Evas_Object *btn; char buf[50]; btn = elm_button_add(layout); snprintf(buf, sizeof(buf), "button %d", count); elm_object_text_set(btn, buf); edje_object_part_box_append(edje, "elm.box.buttons", btn); evas_object_show(btn); } return EINA_TRUE; } EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *layout; win = elm_win_add(NULL, "test", ELM_WIN_BASIC); elm_win_title_set(win, "Test"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); bg = elm_bg_add(win); elm_bg_color_set(bg, 255, 255, 255); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); evas_object_show(bg); layout = elm_layout_add(win); elm_layout_file_set(layout, "test.edj", "box_text"); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(layout); _fill(layout); ecore_timer_add(5, _fill, layout); evas_object_resize(win, 800, 320); evas_object_show(win); elm_run(); elm_shutdown(); return 0; } ELM_MAIN() (gdb) bt 0x00000000 in ?? () 0xb7add287 in _edje_box_layout_calculate_coords () from /usr/lib/libedje.so.1 0xb7add5cd in _edje_box_layout () from /usr/lib/libedje.so.1 0xb7c98ff7 in _evas_object_box_smart_calculate () from /usr/lib/libevas.so.1 0xb7c97a36 in evas_object_smart_calculate () from /usr/lib/libevas.so.1 0xb7ae1b12 in _edje_part_recalc_single () from /usr/lib/libedje.so.1 0xb7ae3380 in _edje_part_recalc () from /usr/lib/libedje.so.1 0xb7ae59ff in _edje_recalc_do () from /usr/lib/libedje.so.1 0xb7b3603a in _edje_smart_calculate () from /usr/lib/libedje.so.1 0xb7c97be2 in evas_call_smarts_calculate () from /usr/lib/libevas.so.1 0xb7cc7d88 in evas_render_updates_internal () from /usr/lib/libevas.so.1 0xb7ba7c97 in _ecore_evas_x_render () from /usr/lib/libecore_evas.so.1 0xb7ba27c6 in _ecore_evas_idle_enter () from /usr/lib/libecore_evas.so.1 0xb7c27212 in _ecore_idle_enterer_call () from /usr/lib/libecore.so.1 0xb7c28d3d in _ecore_main_loop_iterate_internal () from /usr/lib/libecore.so.1 0xb7c2941f in ecore_main_loop_begin () from /usr/lib/libecore.so.1 0xb7e8def8 in elm_run () from /usr/lib/libelementary.so.1 0xb7f6f8ee in appcore_efl_main () from /usr/lib/libappcore-efl.so.1 0xb7644bb5 in app_efl_main () from /usr/lib/libcapi-appfw-application.so.0 0x08074c5a in main (argc=1, argv=0xbffffb64) at src/main_tizen.c:155 ==2036== Jump to the invalid address stated on the next line ==2036== at 0x0: ??? ==2036== by 0x44C35CC: _edje_box_layout (in /usr/lib/libedje.so.1.7.99) ==2036== by 0x42E8FF6: _evas_object_box_smart_calculate (in /usr/lib/libevas.so.1.7.99) ==2036== by 0x42E7A35: evas_object_smart_calculate (in /usr/lib/libevas.so.1.7.99) ==2036== by 0x44C7B11: _edje_part_recalc_single (in /usr/lib/libedje.so.1.7.99) ==2036== by 0x44C937F: _edje_part_recalc (in /usr/lib/libedje.so.1.7.99) ==2036== by 0x44CB9FE: _edje_recalc_do (in /usr/lib/libedje.so.1.7.99) ==2036== by 0x451C039: _edje_smart_calculate (in /usr/lib/libedje.so.1.7.99) ==2036== by 0x42E7BE1: evas_call_smarts_calculate (in /usr/lib/libevas.so.1.7.99) ==2036== by 0x4317D87: evas_render_updates_internal (in /usr/lib/libevas.so.1.7.99) ==2036== by 0x4465C96: _ecore_evas_x_render (in /usr/lib/libecore_evas.so.1.7.99) ==2036== by 0x44607C5: _ecore_evas_idle_enter (in /usr/lib/libecore_evas.so.1.7.99) ==2036== Address 0x0 is not stack'd, malloc'd or (recently) free'd We called anim->start aftwards just to be sure to stick to something if all fail.
2013-05-17 14:44:24 -07:00
if (anim->end.layout)
anim->end.layout(obj, priv, anim->end.data);
else if (anim->start.layout)
anim->start.layout(obj, priv, anim->start.data);
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
EINA_LIST_FOREACH(anim->objs, l, tad)
{
evas_object_geometry_get(tad->obj, &tad->end.x, &tad->end.y,
&tad->end.w, &tad->end.h);
tad->end.x = tad->end.x - x;
tad->end.y = tad->end.y - y;
}
}
static void
_edje_box_layout_exec(Evas_Object *obj, Edje_Part_Box_Animation *anim)
{
Eina_List *l;
Edje_Transition_Animation_Data *tad;
Evas_Coord x, y, w, h;
Evas_Coord cur_x, cur_y, cur_w, cur_h;
double progress;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
evas_object_geometry_get(obj, &x, &y, &w, &h);
progress = (anim->progress - anim->start_progress) / (1 - anim->start_progress);
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
EINA_LIST_FOREACH(anim->objs, l, tad)
{
cur_x = x + (tad->start.x + ((tad->end.x - tad->start.x) * progress)) * (w / (double)anim->box_start_w);
cur_y = y + (tad->start.y + ((tad->end.y - tad->start.y) * progress)) * (h / (double)anim->box_start_h);
cur_w = (w / (double)anim->box_start_w) * (tad->start.w + ((tad->end.w - tad->start.w) * progress));
cur_h = (h / (double)anim->box_start_h) * (tad->start.h + ((tad->end.h - tad->start.h) * progress));
evas_object_move(tad->obj, cur_x, cur_y);
evas_object_resize(tad->obj, cur_w, cur_h);
}
}
static void
_edje_box_layout(Evas_Object *obj, Evas_Object_Box_Data *priv, void *data)
{
Edje_Part_Box_Animation *anim = data;
if (anim->progress < 0.01)
{
if (anim->start.layout)
{
evas_object_box_padding_set(obj, anim->start.padding.x, anim->start.padding.y);
evas_object_box_align_set(obj, TO_DOUBLE(anim->start.align.x), TO_DOUBLE(anim->start.align.y));
anim->start.layout(obj, priv, anim->start.data);
}
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
return;
}
if (anim->recalculate)
{
_edje_box_layout_calculate_coords(obj, priv, anim);
anim->start_progress = anim->progress;
anim->recalculate = EINA_FALSE;
}
if ((anim->progress > 0) && (anim->start_progress < 1))
_edje_box_layout_exec(obj, anim);
}
void
_edje_box_layout_free_data(void *data)
{
Edje_Transition_Animation_Data *tad;
Edje_Part_Box_Animation *anim = data;
if (anim->start.free_data && anim->start.data)
anim->start.free_data(anim->start.data);
if (anim->end.free_data && anim->end.data)
anim->end.free_data(anim->end.data);
EINA_LIST_FREE(anim->objs, tad)
free(tad);
free(data);
}
Edje_Part_Box_Animation *
_edje_box_layout_anim_new(Evas_Object *box)
{
Edje_Part_Box_Animation *anim = calloc(1, sizeof(Edje_Part_Box_Animation));
if (!anim)
return NULL;
anim->box = box;
evas_object_box_layout_set(box, _edje_box_layout, anim, NULL);
return anim;
}
void
_edje_box_recalc_apply(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_UNUSED, Edje_Part_Description_Box *chosen_desc)
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
{
Evas_Object_Box_Data *priv;
#if 0
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
int min_w, min_h;
#endif
if ((ep->type != EDJE_RP_TYPE_CONTAINER) ||
(!ep->typedata.container)) return;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
if ((ep->param2) && (ep->description_pos != ZERO))
{
Edje_Part_Description_Box *param2_desc = (Edje_Part_Description_Box *)ep->param2->description;
if (ep->typedata.container->anim->end.layout == NULL)
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
{
_edje_box_layout_find_all(param2_desc->box.layout, param2_desc->box.alt_layout, &ep->typedata.container->anim->end.layout, &ep->typedata.container->anim->end.data, &ep->typedata.container->anim->end.free_data);
ep->typedata.container->anim->end.padding.x = param2_desc->box.padding.x;
ep->typedata.container->anim->end.padding.y = param2_desc->box.padding.y;
ep->typedata.container->anim->end.align.x = param2_desc->box.align.x;
ep->typedata.container->anim->end.align.y = param2_desc->box.align.y;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
priv = eo_data_scope_get(ep->object, EVAS_BOX_CLASS);
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
if (priv == NULL)
return;
evas_object_box_padding_set(ep->object, ep->typedata.container->anim->start.padding.x, ep->typedata.container->anim->start.padding.y);
evas_object_box_align_set(ep->object, TO_DOUBLE(ep->typedata.container->anim->start.align.x), TO_DOUBLE(ep->typedata.container->anim->start.align.y));
ep->typedata.container->anim->start.layout(ep->object, priv, ep->typedata.container->anim->start.data);
_edje_box_layout_calculate_coords(ep->object, priv, ep->typedata.container->anim);
ep->typedata.container->anim->start_progress = 0.0;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
}
evas_object_smart_changed(ep->object);
}
else
{
ep->typedata.container->anim->end.layout = NULL;
}
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
if (ep->description_pos < 0.01 || !ep->typedata.container->anim->start.layout)
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
{
_edje_box_layout_find_all(chosen_desc->box.layout, chosen_desc->box.alt_layout, &ep->typedata.container->anim->start.layout, &ep->typedata.container->anim->start.data, &ep->typedata.container->anim->start.free_data);
ep->typedata.container->anim->start.padding.x = chosen_desc->box.padding.x;
ep->typedata.container->anim->start.padding.y = chosen_desc->box.padding.y;
ep->typedata.container->anim->start.align.x = chosen_desc->box.align.x;
ep->typedata.container->anim->start.align.y = chosen_desc->box.align.y;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
evas_object_smart_changed(ep->object);
}
ep->typedata.container->anim->progress = ep->description_pos;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
if (evas_object_smart_need_recalculate_get(ep->object))
{
evas_object_smart_need_recalculate_set(ep->object, 0);
evas_object_smart_calculate(ep->object);
}
#if 0 /* Why the hell do we affect part size after resize ??? */
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
evas_object_size_hint_min_get(ep->object, &min_w, &min_h);
if (chosen_desc->box.min.h && (p3->w < min_w))
p3->w = min_w;
if (chosen_desc->box.min.v && (p3->h < min_h))
p3->h = min_h;
#endif
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
}
Eina_Bool
_edje_box_layout_add_child(Edje_Real_Part *rp, Evas_Object *child_obj)
{
Edje_Transition_Animation_Data *tad;
if ((rp->type != EDJE_RP_TYPE_CONTAINER) ||
(!rp->typedata.container)) return EINA_FALSE;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
tad = calloc(1, sizeof(Edje_Transition_Animation_Data));
if (!tad) return EINA_FALSE;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
tad->obj = child_obj;
rp->typedata.container->anim->objs = eina_list_append(rp->typedata.container->anim->objs, tad);
rp->typedata.container->anim->recalculate = EINA_TRUE;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
return EINA_TRUE;
}
void
_edje_box_layout_remove_child(Edje_Real_Part *rp, Evas_Object *child_obj)
{
Eina_List *l;
Edje_Transition_Animation_Data *tad;
if ((rp->type != EDJE_RP_TYPE_CONTAINER) ||
(!rp->typedata.container)) return;
EINA_LIST_FOREACH(rp->typedata.container->anim->objs, l, tad)
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
{
if (tad->obj == child_obj)
{
free(eina_list_data_get(l));
rp->typedata.container->anim->objs = eina_list_remove_list(rp->typedata.container->anim->objs, l);
rp->typedata.container->anim->recalculate = EINA_TRUE;
break;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
}
}
rp->typedata.container->anim->recalculate = EINA_TRUE;
Adding a transition layout animation for edje box. Perform an animation when changing the layout from an edje box. By: Otavio Pontes <otavio@profusion.mobi> ------- Sample EDC: {{{ collections { group { name: "main"; min: 500 500; max: 500 500; parts { part { name: "bg"; type: RECT; description { color: 255 255 255 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } } part { name: "box1"; type: BOX; description { state: "default" 0.0; box { layout: vertical; padding: 0 0; } rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; box { padding: 10 10; layout: horizontal; } } description { state: "default" 0.2; inherit: "default" 0.0; box { layout: vertical; } rel1 { relative: 0.0 0.0; offset: 100 100; } rel2 { relative: 1.0 1.0; } } box { items { item { name: "rect1"; type: GROUP; source: "grp_rect1"; weight: 1.0 1.0; align: -1 -1; } item { name: "rect2"; type: GROUP; source: "grp_rect2"; weight: 1.0 1.0; align: -1 -1; } } } } } programs { program { name: "change_layout"; signal: "mouse,clicked,1"; source: "box1"; action: STATE_SET "default" 0.1; target: "box1"; transition: LINEAR 5.0; after: "change_back"; } program { name: "change_back"; action: STATE_SET "default" 0.2; target: "box1"; transition: LINEAR 5.0; } } } group { name: "grp_rect1"; parts { part { name: "r1"; type: RECT; description { state: "default" 0.0; color: 255 0 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; inherit: "default" 0.0; color: 255 0 0 255; } } } } group { name: "grp_rect2"; parts { part { name: "r2"; type: RECT; description { state: "default" 0.0; color: 0 255 0 255; rel1 { relative: 0.0 0.0; } rel2 { relative: 1.0 1.0; } } description { state: "default" 0.1; color: 0 0 255 255; } } } } } }}} SVN revision: 52871
2010-09-28 17:28:54 -07:00
}