forked from enlightenment/efl
pager now is all happy. after fiddling ... and some thought.
SVN revision: 39327
This commit is contained in:
parent
0290e9d631
commit
fd86051c05
|
@ -7833,8 +7833,26 @@ collections {
|
|||
image: "dia_grad.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "clip";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "base";
|
||||
rel2.to: "base";
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
description { state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
}
|
||||
description { state: "hidden" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 255 255 255 0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
part { name: "base0";
|
||||
mouse_events: 0;
|
||||
clip_to: "clip";
|
||||
description { state: "default" 0.0;
|
||||
image.normal: "dia_grad.png";
|
||||
rel1.to: "over";
|
||||
|
@ -7850,6 +7868,7 @@ collections {
|
|||
}
|
||||
part { name: "base";
|
||||
mouse_events: 0;
|
||||
clip_to: "clip";
|
||||
description { state: "default" 0.0;
|
||||
image {
|
||||
normal: "frame_2.png";
|
||||
|
@ -7871,6 +7890,7 @@ collections {
|
|||
}
|
||||
part { name: "elm.swallow.content";
|
||||
type: SWALLOW;
|
||||
clip_to: "clip";
|
||||
description { state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "base";
|
||||
|
@ -7884,6 +7904,7 @@ collections {
|
|||
}
|
||||
part { name: "over";
|
||||
mouse_events: 0;
|
||||
clip_to: "clip";
|
||||
description { state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "base";
|
||||
|
@ -7908,12 +7929,14 @@ collections {
|
|||
source: "elm";
|
||||
action: STATE_SET "hidden" 0.0;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
after: "show_start2";
|
||||
}
|
||||
program { name: "show_start2";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
transition: DECELERATE 0.5;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
after: "show_end";
|
||||
}
|
||||
program { name: "show_end";
|
||||
|
@ -7924,17 +7947,26 @@ collections {
|
|||
source: "elm";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
after: "hide_start2";
|
||||
}
|
||||
program { name: "hide_start2";
|
||||
action: STATE_SET "hidden" 0.0;
|
||||
transition: DECELERATE 0.5;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
after: "hide_end";
|
||||
}
|
||||
program { name: "hide_end";
|
||||
action: SIGNAL_EMIT "elm,action,hide,finished" "";
|
||||
}
|
||||
program { name: "reset";
|
||||
signal: "elm,action,reset";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2794,6 +2794,13 @@ my_pager_3(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_pager_content_promote(info->pager, info->pg1);
|
||||
}
|
||||
|
||||
static void
|
||||
my_pager_pop(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Pginfo *info = data;
|
||||
elm_pager_content_pop(info->pager);
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_35(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -2842,6 +2849,11 @@ my_bt_35(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_smart_callback_add(bt, "clicked", my_pager_1, &info);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Popme");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
elm_pager_content_push(pg, bx);
|
||||
info.pg1 = bx;
|
||||
|
||||
|
@ -2862,6 +2874,11 @@ my_bt_35(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_smart_callback_add(bt, "clicked", my_pager_2, &info);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Popme");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
elm_pager_content_push(pg, bx);
|
||||
info.pg2 = bx;
|
||||
|
||||
|
@ -2882,10 +2899,14 @@ my_bt_35(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_smart_callback_add(bt, "clicked", my_pager_3, &info);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Popme");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
elm_pager_content_push(pg, bx);
|
||||
info.pg3 = bx;
|
||||
|
||||
evas_object_resize(win, 320, 320);
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
|
|
|
@ -607,9 +607,9 @@ extern "C" {
|
|||
*/
|
||||
|
||||
EAPI Evas_Object *elm_pager_add(Evas_Object *parent);
|
||||
EAPI void elm_pager_content_push(Evas_Object *obj, Evas_Object *content);
|
||||
EAPI void elm_pager_content_pop(Evas_Object *obj);
|
||||
EAPI void elm_pager_content_promote(Evas_Object *obj, Evas_Object *content);
|
||||
EAPI void elm_pager_content_push(Evas_Object *obj, Evas_Object *content);
|
||||
EAPI void elm_pager_content_pop(Evas_Object *obj);
|
||||
EAPI void elm_pager_content_promote(Evas_Object *obj, Evas_Object *content);
|
||||
EAPI Evas_Object *elm_pager_content_bottom_get(Evas_Object *obj);
|
||||
EAPI Evas_Object *elm_pager_content_top_get(Evas_Object *obj);
|
||||
/* smart callbacks called:
|
||||
|
|
|
@ -14,6 +14,7 @@ struct _Item
|
|||
{
|
||||
Evas_Object *obj, *base, *content;
|
||||
Evas_Coord minw, minh;
|
||||
Evas_Bool popme : 1;
|
||||
};
|
||||
|
||||
static void _del_hook(Evas_Object *obj);
|
||||
|
@ -59,18 +60,11 @@ _sizing_eval(Evas_Object *obj)
|
|||
static void
|
||||
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
// FIXME: is a child changed size hints
|
||||
Item *it = data;
|
||||
edje_object_part_swallow(it->base, "elm.swallow.content", it->content);
|
||||
_sizing_eval(it->obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_sub_del(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Object *sub = event_info;
|
||||
// FIXME: handle del
|
||||
}
|
||||
|
||||
static void
|
||||
_eval_top(Evas_Object *obj)
|
||||
{
|
||||
|
@ -104,60 +98,6 @@ _eval_top(Evas_Object *obj)
|
|||
if (!strcmp(onshow, "raise")) evas_object_raise(o);
|
||||
else if (!strcmp(onshow, "lower")) evas_object_lower(o);
|
||||
}
|
||||
#if 0
|
||||
if (wd->oldtop)
|
||||
{
|
||||
evas_object_hide(wd->oldtop);
|
||||
wd->oldtop = NULL;
|
||||
}
|
||||
printf("old top %p\n", wd->top);
|
||||
wd->oldtop = wd->top;
|
||||
wd->top = stacktop;
|
||||
// FIXME: transition from oldtop to top
|
||||
|
||||
printf("hide %i\n", wd->swap);
|
||||
o = wd->base[wd->swap];
|
||||
edje_object_signal_emit(o, "elm,action,hide", "elm");
|
||||
onhide = edje_object_data_get(o, "onhide");
|
||||
if (onhide)
|
||||
{
|
||||
printf("onhide = %s\n", onhide);
|
||||
if (!strcmp(onhide, "raise"))
|
||||
{
|
||||
printf("raise!\n");
|
||||
evas_object_raise(o);
|
||||
}
|
||||
else if (!strcmp(onhide, "lower"))
|
||||
{
|
||||
printf("lower!\n");
|
||||
evas_object_lower(o);
|
||||
}
|
||||
}
|
||||
|
||||
printf("show %i\n", 1 - wd->swap);
|
||||
o = wd->base[1 - wd->swap];
|
||||
printf("swallow %p into base %i\n", wd->top, 1 - wd->swap);
|
||||
edje_object_part_swallow(o, "elm.swallow.content", wd->top);
|
||||
evas_object_show(wd->top);
|
||||
edje_object_signal_emit(o, "elm,action,show", "elm");
|
||||
onshow = edje_object_data_get(o, "onshow");
|
||||
if (onshow)
|
||||
{
|
||||
printf("onshow = %s\n", onshow);
|
||||
if (!strcmp(onshow, "raise"))
|
||||
{
|
||||
printf("raise2!\n");
|
||||
evas_object_raise(o);
|
||||
}
|
||||
else if (!strcmp(onshow, "lower"))
|
||||
{
|
||||
printf("lower2!\n");
|
||||
evas_object_lower(o);
|
||||
}
|
||||
}
|
||||
wd->swap = 1 - wd->swap;
|
||||
printf("swap = %i\n", wd->swap);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,6 +113,28 @@ _move(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
evas_object_move(it->base, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
_sub_del(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
Evas_Object *sub = event_info;
|
||||
Eina_List *l;
|
||||
Item *it;
|
||||
EINA_LIST_FOREACH(wd->stack, l, it)
|
||||
{
|
||||
if (it->content == sub)
|
||||
{
|
||||
wd->stack = eina_list_remove_list(wd->stack, l);
|
||||
evas_object_event_callback_del
|
||||
(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints);
|
||||
evas_object_del(it->base);
|
||||
_eval_top(it->obj);
|
||||
free(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -185,18 +147,19 @@ _resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
evas_object_resize(it->base, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_signal_show_finished(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
// finished show - don't really care
|
||||
}
|
||||
|
||||
static void
|
||||
_signal_hide_finished(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Item *it = data;
|
||||
Evas_Object *obj2 = it->obj;
|
||||
evas_object_hide(it->base);
|
||||
edje_object_signal_emit(it->base, "elm,action,reset", "elm");
|
||||
edje_object_message_signal_process(it->base);
|
||||
if (it->popme)
|
||||
{
|
||||
evas_object_del(it->content);
|
||||
}
|
||||
_sizing_eval(obj2);
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
|
@ -229,7 +192,6 @@ elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
|
|||
Item *it = calloc(1, sizeof(Item));
|
||||
Evas_Coord x, y, w, h;
|
||||
if (!it) return;
|
||||
printf("#####------ push %p\n", content);
|
||||
it->obj = obj;
|
||||
it->content = content;
|
||||
it->base = edje_object_add(evas_object_evas_get(obj));
|
||||
|
@ -238,14 +200,14 @@ elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
|
|||
evas_object_move(it->base, x, y);
|
||||
evas_object_resize(it->base, w, h);
|
||||
elm_widget_sub_object_add(obj, it->base);
|
||||
elm_widget_sub_object_add(obj, content);
|
||||
elm_widget_sub_object_add(obj, it->content);
|
||||
_elm_theme_set(it->base, "pager", "base", "default");
|
||||
edje_object_signal_callback_add(it->base, "elm,action,show,finished", "", _signal_show_finished, it);
|
||||
edje_object_signal_callback_add(it->base, "elm,action,hide,finished", "", _signal_hide_finished, it);
|
||||
edje_object_part_swallow(it->base, "elm.swallow.content", content);
|
||||
evas_object_show(content);
|
||||
edje_object_part_swallow(it->base, "elm.swallow.content", it->content);
|
||||
edje_object_size_min_calc(it->base, &it->minw, &it->minh);
|
||||
// FIXME: if child changes size hints...
|
||||
evas_object_show(it->content);
|
||||
evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
||||
_changed_size_hints, it);
|
||||
wd->stack = eina_list_append(wd->stack, it);
|
||||
_eval_top(obj);
|
||||
_sizing_eval(obj);
|
||||
|
@ -255,10 +217,37 @@ EAPI void
|
|||
elm_pager_content_pop(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
// FIXME: actually make pop animated - promote 2nd last in stack then
|
||||
// when anim finished delete 2nd last (which was top).
|
||||
Evas_Object *top = elm_pager_content_top_get(obj);
|
||||
// if (wd->top) evas_object_del(wd->top);
|
||||
Eina_List *ll;
|
||||
Item *it;
|
||||
if (!wd->stack) return;
|
||||
it = eina_list_last(wd->stack)->data;
|
||||
it->popme = 1;
|
||||
ll = eina_list_last(wd->stack);
|
||||
if (ll)
|
||||
{
|
||||
ll = ll->prev;
|
||||
if (!ll)
|
||||
{
|
||||
Evas_Object *o;
|
||||
const char *onhide;
|
||||
|
||||
wd->top = it;
|
||||
o = wd->top->base;
|
||||
edje_object_signal_emit(o, "elm,action,hide", "elm");
|
||||
onhide = edje_object_data_get(o, "onhide");
|
||||
if (onhide)
|
||||
{
|
||||
if (!strcmp(onhide, "raise")) evas_object_raise(o);
|
||||
else if (!strcmp(onhide, "lower")) evas_object_lower(o);
|
||||
}
|
||||
wd->top = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
it = ll->data;
|
||||
elm_pager_content_promote(obj, it->content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -283,17 +272,19 @@ EAPI Evas_Object *
|
|||
elm_pager_content_bottom_get(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
// FIXME: wrong
|
||||
if (wd->stack) return wd->stack->data;
|
||||
return NULL;
|
||||
Item *it;
|
||||
if (!wd->stack) return NULL;
|
||||
it = wd->stack->data;
|
||||
return it->content;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_pager_content_top_get(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
// FIXME: wrong
|
||||
if (wd->stack) return eina_list_last(wd->stack)->data;
|
||||
return NULL;
|
||||
Item *it;
|
||||
if (!wd->stack) return NULL;
|
||||
it = eina_list_last(wd->stack)->data;
|
||||
return it->content;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue