2009-02-27 23:32:50 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
2009-05-19 02:29:20 -07:00
|
|
|
/**
|
|
|
|
* @defgroup Pager Pager
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* The pager is an object that allows flipping (with animation) between 1 or
|
2009-07-06 23:46:51 -07:00
|
|
|
* more “pages” of objects, much like a stack of windows within the window.
|
|
|
|
*
|
2010-09-20 10:09:13 -07:00
|
|
|
* Objects can be pushed or popped from the stack or deleted as normal.
|
2009-05-22 14:01:46 -07:00
|
|
|
* Pushes and pops will animate (and a pop will delete the object once the
|
|
|
|
* animation is finished). Any object in the pager can be promoted to the top
|
|
|
|
* (from its current stacking position) as well. Objects are pushed to the
|
|
|
|
* top with elm_pager_content_push() and when the top item is no longer
|
|
|
|
* wanted, simply pop it with elm_pager_content_pop() and it will also be
|
|
|
|
* deleted. Any object you wish to promote to the top that is already in the
|
|
|
|
* pager, simply use elm_pager_content_promote(). If an object is no longer
|
|
|
|
* needed and is not the top item, just delete it as normal. You can query
|
|
|
|
* which objects are the top and bottom with elm_pager_content_bottom_get()
|
|
|
|
* and elm_pager_content_top_get().
|
2009-05-19 02:29:20 -07:00
|
|
|
*/
|
|
|
|
|
2009-02-27 23:32:50 -08:00
|
|
|
typedef struct _Widget_Data Widget_Data;
|
2009-03-02 00:59:00 -08:00
|
|
|
typedef struct _Item Item;
|
2009-02-27 23:32:50 -08:00
|
|
|
|
|
|
|
struct _Widget_Data
|
|
|
|
{
|
|
|
|
Eina_List *stack;
|
2009-03-02 00:59:00 -08:00
|
|
|
Item *top, *oldtop;
|
2009-10-31 04:28:33 -07:00
|
|
|
Evas_Object *rect, *clip;
|
2009-03-02 00:59:00 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Item
|
|
|
|
{
|
|
|
|
Evas_Object *obj, *base, *content;
|
|
|
|
Evas_Coord minw, minh;
|
2009-06-17 08:35:19 -07:00
|
|
|
Eina_Bool popme : 1;
|
2009-02-27 23:32:50 -08:00
|
|
|
};
|
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
static const char *widtype = NULL;
|
2009-02-27 23:32:50 -08:00
|
|
|
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
|
|
|
|
_del_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-02-27 23:32:50 -08:00
|
|
|
free(wd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_theme_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-03-02 00:59:00 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-03-02 00:59:00 -08:00
|
|
|
EINA_LIST_FOREACH(wd->stack, l, it)
|
2009-11-09 04:54:44 -08:00
|
|
|
edje_object_scale_set(it->base, elm_widget_scale_get(obj) *
|
|
|
|
_elm_config->scale);
|
2009-02-27 23:32:50 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2010-10-01 12:03:02 -07:00
|
|
|
static Eina_Bool
|
2010-10-06 13:24:13 -07:00
|
|
|
_elm_pager_focus_next_hook(Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
|
2010-10-01 12:03:02 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *cur;
|
|
|
|
|
|
|
|
if ((!wd) || (!wd->top))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
cur = wd->top->content;
|
|
|
|
|
|
|
|
/* Try Focus cycle in subitem */
|
2010-10-06 13:24:13 -07:00
|
|
|
return elm_widget_focus_next_get(cur, dir, next);
|
2010-10-01 12:03:02 -07:00
|
|
|
}
|
|
|
|
|
2009-02-27 23:32:50 -08:00
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-11-09 04:54:44 -08:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2009-03-02 00:59:00 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-03-02 00:59:00 -08:00
|
|
|
EINA_LIST_FOREACH(wd->stack, l, it)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
if (it->minw > minw) minw = it->minw;
|
|
|
|
if (it->minh > minh) minh = it->minh;
|
2009-03-02 00:59:00 -08:00
|
|
|
}
|
2009-02-27 23:32:50 -08:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2009-11-09 04:54:44 -08:00
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2009-02-27 23:32:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-02-27 23:32:50 -08:00
|
|
|
{
|
2009-03-02 01:42:58 -08:00
|
|
|
Item *it = data;
|
2009-10-26 01:27:08 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
|
|
|
evas_object_size_hint_min_get(it->content, &minw, &minh);
|
|
|
|
// FIXME: why is this needed? how does edje get this unswallowed or
|
|
|
|
// lose its callbacks to edje
|
|
|
|
edje_object_part_swallow(it->base, "elm.swallow.content", it->content);
|
2009-03-12 22:50:38 -07:00
|
|
|
edje_object_size_min_calc(it->base, &it->minw, &it->minh);
|
2009-03-02 01:42:58 -08:00
|
|
|
_sizing_eval(it->obj);
|
2009-02-27 23:32:50 -08:00
|
|
|
}
|
|
|
|
|
2009-03-01 15:52:13 -08:00
|
|
|
static void
|
|
|
|
_eval_top(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 06:42:41 -08:00
|
|
|
Item *ittop;
|
|
|
|
if (!wd) return;
|
2009-03-02 00:59:00 -08:00
|
|
|
if (!wd->stack) return;
|
|
|
|
ittop = eina_list_last(wd->stack)->data;
|
|
|
|
if (ittop != wd->top)
|
2009-03-01 15:52:13 -08:00
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
Evas_Object *o;
|
|
|
|
const char *onshow, *onhide;
|
2009-03-02 00:59:00 -08:00
|
|
|
|
2009-07-06 23:46:51 -07:00
|
|
|
if (wd->top)
|
|
|
|
{
|
|
|
|
o = wd->top->base;
|
2010-07-27 16:43:12 -07:00
|
|
|
if (wd->top->popme)
|
|
|
|
edje_object_signal_emit(o, "elm,action,pop", "elm");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(o, "elm,action,hide", "elm");
|
2009-07-06 23:46:51 -07:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2010-07-27 16:43:12 -07:00
|
|
|
wd->oldtop = wd->top;
|
2009-07-06 23:46:51 -07:00
|
|
|
wd->top = ittop;
|
|
|
|
o = wd->top->base;
|
|
|
|
evas_object_show(o);
|
2010-07-27 16:43:12 -07:00
|
|
|
if (wd->oldtop && wd->oldtop->popme)
|
|
|
|
edje_object_signal_emit(o, "elm,action,show", "elm");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(o, "elm,action,push", "elm");
|
2009-07-06 23:46:51 -07:00
|
|
|
onshow = edje_object_data_get(o, "onshow");
|
|
|
|
if (onshow)
|
|
|
|
{
|
|
|
|
if (!strcmp(onshow, "raise")) evas_object_raise(o);
|
|
|
|
else if (!strcmp(onshow, "lower")) evas_object_lower(o);
|
|
|
|
}
|
2009-03-01 15:52:13 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 00:59:00 -08:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2009-03-02 00:59:00 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
|
|
|
Evas_Coord x, y;
|
|
|
|
Eina_List *l;
|
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-03-02 00:59:00 -08:00
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
|
|
|
EINA_LIST_FOREACH(wd->stack, l, it)
|
|
|
|
evas_object_move(it->base, x, y);
|
|
|
|
}
|
|
|
|
|
2009-03-01 21:48:14 -08:00
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_sub_del(void *data, Evas_Object *obj __UNUSED__, void *event_info)
|
2009-03-01 21:48:14 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
2009-03-02 01:42:58 -08:00
|
|
|
Evas_Object *sub = event_info;
|
2009-03-02 00:59:00 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-03-02 00:59:00 -08:00
|
|
|
EINA_LIST_FOREACH(wd->stack, l, it)
|
2009-03-02 01:42:58 -08:00
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
if (it->content == sub)
|
|
|
|
{
|
|
|
|
wd->stack = eina_list_remove_list(wd->stack, l);
|
2009-10-22 15:10:23 -07:00
|
|
|
evas_object_event_callback_del_full
|
2009-11-09 04:54:44 -08:00
|
|
|
(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
|
2009-07-06 23:46:51 -07:00
|
|
|
evas_object_del(it->base);
|
|
|
|
_eval_top(it->obj);
|
|
|
|
free(it);
|
|
|
|
return;
|
|
|
|
}
|
2009-03-02 01:42:58 -08:00
|
|
|
}
|
2009-07-06 23:46:51 -07:00
|
|
|
}
|
2009-03-02 00:59:00 -08:00
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2010-03-09 06:42:41 -08:00
|
|
|
{
|
2009-03-02 00:59:00 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
2009-03-02 01:42:58 -08:00
|
|
|
Evas_Coord w, h;
|
|
|
|
Eina_List *l;
|
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-03-02 01:42:58 -08:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
2010-03-09 06:42:41 -08:00
|
|
|
EINA_LIST_FOREACH(wd->stack, l, it) evas_object_resize(it->base, w, h);
|
2009-03-02 00:59:00 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_signal_hide_finished(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
2009-03-02 00:59:00 -08:00
|
|
|
{
|
|
|
|
Item *it = data;
|
2009-03-02 01:42:58 -08:00
|
|
|
Evas_Object *obj2 = it->obj;
|
2009-03-02 00:59:00 -08:00
|
|
|
evas_object_hide(it->base);
|
2009-03-02 01:42:58 -08:00
|
|
|
edje_object_signal_emit(it->base, "elm,action,reset", "elm");
|
2009-10-30 11:25:57 -07:00
|
|
|
evas_object_smart_callback_call(obj2, "hide,finished", it->content);
|
2009-03-02 01:42:58 -08:00
|
|
|
edje_object_message_signal_process(it->base);
|
2009-11-09 04:54:44 -08:00
|
|
|
if (it->popme) evas_object_del(it->content);
|
2009-03-02 01:42:58 -08:00
|
|
|
_sizing_eval(obj2);
|
2009-03-01 21:48:14 -08:00
|
|
|
}
|
|
|
|
|
2009-05-19 02:29:20 -07:00
|
|
|
/**
|
2009-05-22 14:01:46 -07:00
|
|
|
* Add a new pager to the parent
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* @param parent The parent object
|
|
|
|
* @return The new object or NULL if it cannot be created
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
|
|
|
* @ingroup Pager
|
|
|
|
*/
|
2009-02-27 23:32:50 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_pager_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
Evas *e;
|
|
|
|
Widget_Data *wd;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-27 23:32:50 -08:00
|
|
|
wd = ELM_NEW(Widget_Data);
|
|
|
|
e = evas_object_evas_get(parent);
|
|
|
|
obj = elm_widget_add(e);
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_SET_WIDTYPE(widtype, "pager");
|
2009-05-13 05:21:52 -07:00
|
|
|
elm_widget_type_set(obj, "pager");
|
|
|
|
elm_widget_sub_object_add(parent, obj);
|
2009-02-27 23:32:50 -08:00
|
|
|
elm_widget_data_set(obj, wd);
|
|
|
|
elm_widget_del_hook_set(obj, _del_hook);
|
|
|
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
2010-10-06 13:24:13 -07:00
|
|
|
elm_widget_focus_next_hook_set(obj, _elm_pager_focus_next_hook);
|
2010-09-29 05:22:30 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-10-31 04:28:33 -07:00
|
|
|
wd->clip = evas_object_rectangle_add(e);
|
|
|
|
elm_widget_resize_object_set(obj, wd->clip);
|
|
|
|
elm_widget_sub_object_add(obj, wd->clip);
|
|
|
|
|
2009-10-30 11:25:57 -07:00
|
|
|
wd->rect = evas_object_rectangle_add(e);
|
|
|
|
elm_widget_sub_object_add(obj, wd->rect);
|
2009-10-31 04:28:33 -07:00
|
|
|
evas_object_color_set(wd->rect, 255, 255, 255, 0);
|
|
|
|
evas_object_clip_set(wd->rect, wd->clip);
|
|
|
|
|
2009-03-02 00:59:00 -08:00
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-27 23:32:50 -08:00
|
|
|
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2009-02-27 23:32:50 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2009-05-19 02:29:20 -07:00
|
|
|
/**
|
2009-05-22 14:01:46 -07:00
|
|
|
* Push an object to the top of the pager stack (and show it)
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* The object pushed becomes a child of the pager and will be controlled
|
|
|
|
* it and deleted when the pager is deleted.
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* @param obj The pager object
|
|
|
|
* @param content The object to push
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
|
|
|
* @ingroup Pager
|
|
|
|
*/
|
2009-02-27 23:32:50 -08:00
|
|
|
EAPI void
|
|
|
|
elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-02-27 23:32:50 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-11-09 04:54:44 -08:00
|
|
|
Item *it = ELM_NEW(Item);
|
2009-03-02 00:59:00 -08:00
|
|
|
Evas_Coord x, y, w, h;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-03-02 00:59:00 -08:00
|
|
|
if (!it) return;
|
|
|
|
it->obj = obj;
|
|
|
|
it->content = content;
|
|
|
|
it->base = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_smart_member_add(it->base, obj);
|
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
|
|
|
evas_object_move(it->base, x, y);
|
|
|
|
evas_object_resize(it->base, w, h);
|
2009-10-31 04:28:33 -07:00
|
|
|
evas_object_clip_set(it->base, wd->clip);
|
2009-07-06 23:46:51 -07:00
|
|
|
elm_widget_sub_object_add(obj, it->base);
|
2009-03-02 01:42:58 -08:00
|
|
|
elm_widget_sub_object_add(obj, it->content);
|
2010-05-11 18:03:46 -07:00
|
|
|
_elm_theme_object_set(obj, it->base, "pager", "base", elm_widget_style_get(obj));
|
2009-11-09 04:54:44 -08:00
|
|
|
edje_object_signal_callback_add(it->base, "elm,action,hide,finished", "",
|
|
|
|
_signal_hide_finished, it);
|
2009-10-26 01:27:08 -07:00
|
|
|
evas_object_event_callback_add(it->content,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2010-07-27 16:43:12 -07:00
|
|
|
_changed_size_hints, it);
|
2009-12-07 06:19:20 -08:00
|
|
|
edje_object_part_swallow(it->base, "elm.swallow.content", it->content);
|
2009-03-02 00:59:00 -08:00
|
|
|
edje_object_size_min_calc(it->base, &it->minw, &it->minh);
|
2010-09-08 12:26:58 -07:00
|
|
|
evas_object_data_set(it->base, "_elm_leaveme", obj);
|
2009-03-02 01:42:58 -08:00
|
|
|
evas_object_show(it->content);
|
2009-03-02 00:59:00 -08:00
|
|
|
wd->stack = eina_list_append(wd->stack, it);
|
|
|
|
_eval_top(obj);
|
|
|
|
_sizing_eval(obj);
|
2009-02-27 23:32:50 -08:00
|
|
|
}
|
|
|
|
|
2009-05-19 02:29:20 -07:00
|
|
|
/**
|
2009-05-22 14:01:46 -07:00
|
|
|
* Pop the object that is on top of the stack
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* This pops the object that is on top (visible) in the pager, makes it
|
|
|
|
* disappear, then deletes the object. The object that was underneath it
|
|
|
|
* on the stack will become visible.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* @param obj The pager object
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
|
|
|
* @ingroup Pager
|
|
|
|
*/
|
2009-02-27 23:32:50 -08:00
|
|
|
EAPI void
|
|
|
|
elm_pager_content_pop(Evas_Object *obj)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-02-27 23:32:50 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-03-02 01:42:58 -08:00
|
|
|
Eina_List *ll;
|
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-03-02 01:42:58 -08:00
|
|
|
if (!wd->stack) return;
|
|
|
|
it = eina_list_last(wd->stack)->data;
|
2009-06-17 08:35:19 -07:00
|
|
|
it->popme = EINA_TRUE;
|
2009-03-02 01:42:58 -08:00
|
|
|
ll = eina_list_last(wd->stack);
|
|
|
|
if (ll)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
ll = ll->prev;
|
|
|
|
if (!ll)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
const char *onhide;
|
|
|
|
|
|
|
|
wd->top = it;
|
|
|
|
o = wd->top->base;
|
2010-07-27 16:43:12 -07:00
|
|
|
edje_object_signal_emit(o, "elm,action,pop", "elm");
|
2009-07-06 23:46:51 -07:00
|
|
|
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);
|
|
|
|
}
|
2009-03-02 01:42:58 -08:00
|
|
|
}
|
2009-02-27 23:32:50 -08:00
|
|
|
}
|
|
|
|
|
2009-05-19 02:29:20 -07:00
|
|
|
/**
|
2009-05-22 14:01:46 -07:00
|
|
|
* Promote an object already in the pager stack to the top of the stack
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* This will take the indicated object and promote it to the top of the stack
|
|
|
|
* as if it had been pushed there. The object must already be inside the
|
|
|
|
* pager stack to work.
|
2009-07-06 23:46:51 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* @param obj The pager object
|
|
|
|
* @param content The object to promote
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
|
|
|
* @ingroup Pager
|
|
|
|
*/
|
2009-02-27 23:32:50 -08:00
|
|
|
EAPI void
|
|
|
|
elm_pager_content_promote(Evas_Object *obj, Evas_Object *content)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-02-27 23:32:50 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-03-02 00:59:00 -08:00
|
|
|
Eina_List *l;
|
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return;
|
2009-03-02 00:59:00 -08:00
|
|
|
EINA_LIST_FOREACH(wd->stack, l, it)
|
|
|
|
{
|
2009-07-06 23:46:51 -07:00
|
|
|
if (it->content == content)
|
|
|
|
{
|
|
|
|
wd->stack = eina_list_remove_list(wd->stack, l);
|
|
|
|
wd->stack = eina_list_append(wd->stack, it);
|
|
|
|
_eval_top(obj);
|
|
|
|
return;
|
|
|
|
}
|
2009-03-02 00:59:00 -08:00
|
|
|
}
|
2009-02-27 23:32:50 -08:00
|
|
|
}
|
|
|
|
|
2009-05-19 02:29:20 -07:00
|
|
|
/**
|
2009-05-22 14:01:46 -07:00
|
|
|
* Return the object at the bottom of the pager stack
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* @param obj The pager object
|
|
|
|
* @return The bottom object or NULL if none
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
|
|
|
* @ingroup Pager
|
|
|
|
*/
|
2009-02-27 23:32:50 -08:00
|
|
|
EAPI Evas_Object *
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_pager_content_bottom_get(const Evas_Object *obj)
|
2009-02-27 23:32:50 -08:00
|
|
|
{
|
2010-03-09 06:42:41 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-02-27 23:32:50 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-03-02 01:42:58 -08:00
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return NULL;
|
2009-03-02 01:42:58 -08:00
|
|
|
if (!wd->stack) return NULL;
|
|
|
|
it = wd->stack->data;
|
|
|
|
return it->content;
|
2009-02-27 23:32:50 -08:00
|
|
|
}
|
|
|
|
|
2009-05-19 02:29:20 -07:00
|
|
|
/**
|
2009-05-22 14:01:46 -07:00
|
|
|
* Return the object at the top of the pager stack
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
2009-05-22 14:01:46 -07:00
|
|
|
* @param obj The pager object
|
|
|
|
* @return The top object or NULL if none
|
2009-05-19 02:29:20 -07:00
|
|
|
*
|
|
|
|
* @ingroup Pager
|
|
|
|
*/
|
2009-02-27 23:32:50 -08:00
|
|
|
EAPI Evas_Object *
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_pager_content_top_get(const Evas_Object *obj)
|
2009-02-27 23:32:50 -08:00
|
|
|
{
|
2010-03-09 06:42:41 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-02-27 23:32:50 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2009-03-02 01:42:58 -08:00
|
|
|
Item *it;
|
2010-03-09 06:42:41 -08:00
|
|
|
if (!wd) return NULL;
|
2009-03-02 01:42:58 -08:00
|
|
|
if (!wd->stack) return NULL;
|
|
|
|
it = eina_list_last(wd->stack)->data;
|
|
|
|
return it->content;
|
2009-02-27 23:32:50 -08:00
|
|
|
}
|
2009-10-15 04:16:05 -07:00
|
|
|
|