* @defgroup Pager Pager
*
* The pager is an object that allows flipping (with animation) between 1 or
- * more “pages” of objects, much like a stack of windows within the window.
+ * more ?\9cpages??of objects, much like a stack of windows within the window.
*
* Objects can be pushed or popped from he stack or deleted as normal.
* Pushes and pops will animate (and a pop will delete the object once the
Eina_Bool popme : 1;
};
+static Eina_Bool ani = EINA_TRUE;
static const char *widtype = NULL;
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
+static void _signal_hide_finished(void *data, Evas_Object *obj, const char *emission, const char *source);
static void
_del_hook(Evas_Object *obj)
_sizing_eval(it->obj);
}
+static void
+_complete_cb( void* data )
+{
+ Item *it = data;
+ Evas_Object *obj = it->obj;
+
+ evas_object_hide(it->base);
+ edje_object_signal_emit(it->base, "elm,action,reset", "elm");
+ evas_object_smart_callback_call(obj, "hide,finished", it->content);
+ edje_object_message_signal_process(it->base);
+ if (it->popme) evas_object_del(it->content);
+ _sizing_eval(obj);
+}
+
static void
_eval_top(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Item *ittop;
+ Item *it, *ittop;
+
if (!wd) return;
if (!wd->stack) return;
ittop = eina_list_last(wd->stack)->data;
if (ittop != wd->top)
{
- Evas_Object *o;
+ Evas_Object *o= NULL, *prev_o = NULL;
const char *onshow, *onhide;
+ Eina_Bool pop = EINA_FALSE;
+ Evas_Coord w, y;
+ Elm_Transit *transit;
+
+ transit = elm_transit_add(obj);
+ evas_object_geometry_get( obj, NULL, &y, &w, NULL );
if (wd->top)
{
+ it = wd->top;
o = wd->top->base;
- edje_object_signal_emit(o, "elm,action,hide", "elm");
+
+ if (wd->top->popme) pop = EINA_TRUE;
+ if (ani)
+ {
+ if (pop) elm_transit_fx_insert( transit, elm_fx_transfer_add(o , 0, y, w, y));
+ else elm_transit_fx_insert( transit, elm_fx_transfer_add(o , 0, y, -w, y));
+ elm_transit_completion_set( transit, _complete_cb, it);
+ }
+ else
+ {
+ _signal_hide_finished(wd->top, o, "elm,action,hide,finished", "");
+ }
+
onhide = edje_object_data_get(o, "onhide");
if (onhide)
{
}
}
wd->top = ittop;
- o = wd->top->base;
- evas_object_show(o);
- edje_object_signal_emit(o, "elm,action,show", "elm");
- onshow = edje_object_data_get(o, "onshow");
+ prev_o = wd->top->base;
+ evas_object_show(prev_o);
+
+ //add show/hide transition direction & animation on/off. 10.04.14 sohyun
+ if (ani && o)
+ {
+ if (pop) elm_transit_fx_insert( transit, elm_fx_transfer_add(prev_o, -w, y, 0, y));
+ else elm_transit_fx_insert( transit, elm_fx_transfer_add(prev_o, w, y, 0, y));
+ elm_transit_run( transit, 0.3 );
+ }
+ elm_transit_del( transit );
+
+ onshow = edje_object_data_get(prev_o, "onshow");
if (onshow)
{
- if (!strcmp(onshow, "raise")) evas_object_raise(o);
- else if (!strcmp(onshow, "lower")) evas_object_lower(o);
+ if (!strcmp(onshow, "raise")) evas_object_raise(prev_o);
+ else if (!strcmp(onshow, "lower")) evas_object_lower(prev_o);
}
}
}
evas_object_resize(it->base, w, h);
evas_object_clip_set(it->base, wd->clip);
elm_widget_sub_object_add(obj, it->base);
- elm_widget_sub_object_add(obj, it->content);
+ if (it->content) elm_widget_sub_object_add(obj, it->content);
_elm_theme_object_set(obj, it->base, "pager", "base", elm_widget_style_get(obj));
edje_object_signal_callback_add(it->base, "elm,action,hide,finished", "",
_signal_hide_finished, it);
wd->top = it;
o = wd->top->base;
- edje_object_signal_emit(o, "elm,action,hide", "elm");
+ if (ani)
+ {
+ Elm_Effect *transit;
+ Evas_Coord w, y;
+
+ transit = elm_transit_add(obj);
+ evas_object_geometry_get(obj, NULL, &y, &w, NULL);
+ elm_transit_fx_insert(transit, elm_fx_transfer_add(o , 0, y, w, y));
+ elm_transit_completion_set(transit, _complete_cb, it);
+ elm_transit_run(transit, 0.3 );
+ elm_transit_del(transit);
+ }
+ else _signal_hide_finished(wd->top, o, "elm,action,hide,finished", "");
+
onhide = edje_object_data_get(o, "onhide");
if (onhide)
{
return it->content;
}
+/**
+ * set animation on/off for content transition effect
+ *
+ * @param obj The pager object
+ * @param animation transition when contents are changed (default value : TRUE)
+ *
+ * @ingroup Pager
+ */
+EAPI void
+elm_pager_animation_set(Evas_Object *obj, Eina_Bool animation)
+{
+ ani = animation;
+}
+