2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
2014-09-27 22:15:18 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2011-07-12 21:21:50 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:06:26 -07:00
|
|
|
#include "elm_widget_naviframe.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_container.h"
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
#include "elm_naviframe_internal_part.eo.h"
|
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_NAVIFRAME_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Naviframe"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_naviframe"
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2012-07-25 07:39:03 -07:00
|
|
|
static const char CONTENT_PART[] = "elm.swallow.content";
|
|
|
|
static const char PREV_BTN_PART[] = "elm.swallow.prev_btn";
|
|
|
|
static const char NEXT_BTN_PART[] = "elm.swallow.next_btn";
|
|
|
|
static const char ICON_PART[] = "elm.swallow.icon";
|
2013-01-04 20:24:22 -08:00
|
|
|
static const char TITLE_PART[] = "elm.text.title";
|
|
|
|
static const char SUBTITLE_PART[] = "elm.text.subtitle";
|
2013-01-15 22:34:49 -08:00
|
|
|
static const char TITLE_ACCESS_PART[] = "access.title";
|
2012-07-25 07:39:03 -07:00
|
|
|
|
2011-07-12 21:21:50 -07:00
|
|
|
static const char SIG_TRANSITION_FINISHED[] = "transition,finished";
|
2014-01-14 21:29:05 -08:00
|
|
|
static const char SIG_TITLE_TRANSITION_FINISHED[] = "title,transition,finished";
|
2011-07-12 21:21:50 -07:00
|
|
|
static const char SIG_TITLE_CLICKED[] = "title,clicked";
|
2013-06-09 02:54:43 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|
|
|
{SIG_TRANSITION_FINISHED, ""},
|
2014-01-14 21:29:05 -08:00
|
|
|
{SIG_TITLE_TRANSITION_FINISHED, ""},
|
2012-06-01 14:56:09 -07:00
|
|
|
{SIG_TITLE_CLICKED, ""},
|
2014-01-23 03:07:20 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2012-06-01 14:56:09 -07:00
|
|
|
{NULL, NULL}
|
2011-07-12 21:21:50 -07:00
|
|
|
};
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void _on_item_back_btn_clicked(void *data, const Eo_Event *event);
|
2013-03-08 04:15:29 -08:00
|
|
|
|
2014-04-09 19:14:59 -07:00
|
|
|
static Eina_Bool _key_action_top_item_get(Evas_Object *obj, const char *params);
|
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"top_item_get", _key_action_top_item_get},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2013-06-11 02:08:10 -07:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_resize_object_reset(Evas_Object *obj, Elm_Naviframe_Item_Data *it)
|
2013-06-11 02:08:10 -07:00
|
|
|
{
|
2013-07-29 03:51:44 -07:00
|
|
|
if (it)
|
|
|
|
{
|
2013-10-18 03:53:16 -07:00
|
|
|
elm_widget_resize_object_set(obj, VIEW(it), EINA_FALSE);
|
2013-07-29 03:51:44 -07:00
|
|
|
evas_object_raise(VIEW(it));
|
|
|
|
}
|
2013-06-11 02:08:10 -07:00
|
|
|
}
|
|
|
|
|
2013-06-05 00:31:49 -07:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_prev_page_focus_recover(Elm_Naviframe_Item_Data *it)
|
2013-06-05 00:31:49 -07:00
|
|
|
{
|
|
|
|
Evas_Object *newest;
|
2013-10-17 06:17:02 -07:00
|
|
|
unsigned int order = 0;
|
2013-06-05 00:31:49 -07:00
|
|
|
|
|
|
|
newest = elm_widget_newest_focus_order_get(VIEW(it), &order, EINA_TRUE);
|
|
|
|
if (newest)
|
|
|
|
elm_object_focus_set(newest, EINA_TRUE);
|
|
|
|
else
|
2013-09-29 18:09:23 -07:00
|
|
|
{
|
|
|
|
if (elm_object_focus_allow_get(VIEW(it)))
|
|
|
|
elm_object_focus_set(VIEW(it), EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_focus_set(WIDGET(it), EINA_TRUE);
|
|
|
|
}
|
2013-06-05 00:31:49 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_elm_widget_translate(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd)
|
2013-04-23 04:30:15 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it;
|
2013-04-23 04:30:15 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->stack, it)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_translate(EO_OBJ(it));
|
2013-04-23 04:30:15 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_widget_translate(eo_super(obj, MY_CLASS));
|
2014-01-23 03:20:43 -08:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
return EINA_TRUE;
|
2013-04-23 04:30:15 -07:00
|
|
|
}
|
|
|
|
|
2011-07-12 21:21:50 -07:00
|
|
|
static void
|
2012-06-01 14:56:09 -07:00
|
|
|
_item_content_del_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
it->content = NULL;
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_title_prev_btn_del_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
it->title_prev_btn = NULL;
|
2015-07-05 01:00:06 -07:00
|
|
|
if (it->auto_pushed_btn) it->auto_pushed_btn = NULL;
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_title_next_btn_del_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
it->title_next_btn = NULL;
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_item_title_icon_del_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
it->title_icon = NULL;
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
2012-11-22 07:15:26 -08:00
|
|
|
static void
|
|
|
|
_title_content_del(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-11-22 07:15:26 -08:00
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
Elm_Naviframe_Content_Item_Pair *pair = data;
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = pair->it;
|
2012-11-22 07:15:26 -08:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hide", pair->part);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), buf, "elm");
|
2012-11-22 07:15:26 -08:00
|
|
|
it->content_list = eina_inlist_remove(it->content_list,
|
|
|
|
EINA_INLIST_GET(pair));
|
|
|
|
eina_stringshare_del(pair->part);
|
|
|
|
free(pair);
|
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_free(Elm_Naviframe_Item_Data *it)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2012-11-22 07:15:26 -08:00
|
|
|
Eina_Inlist *l;
|
|
|
|
Elm_Naviframe_Content_Item_Pair *content_pair;
|
2012-11-24 04:43:31 -08:00
|
|
|
Elm_Naviframe_Text_Item_Pair *text_pair;
|
2012-11-22 07:15:26 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd);
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
eina_stringshare_del(it->style);
|
2012-07-25 10:38:48 -07:00
|
|
|
eina_stringshare_del(it->title_label);
|
2012-08-30 08:43:14 -07:00
|
|
|
eina_stringshare_del(it->subtitle_label);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2012-11-22 07:15:26 -08:00
|
|
|
EINA_INLIST_FOREACH_SAFE(it->content_list, l, content_pair)
|
|
|
|
{
|
2012-12-03 02:10:17 -08:00
|
|
|
if (content_pair->content)
|
2012-11-22 07:15:26 -08:00
|
|
|
{
|
2012-12-03 02:10:17 -08:00
|
|
|
evas_object_event_callback_del(content_pair->content,
|
2012-11-22 07:15:26 -08:00
|
|
|
EVAS_CALLBACK_DEL,
|
|
|
|
_title_content_del);
|
2012-12-03 02:10:17 -08:00
|
|
|
evas_object_del(content_pair->content);
|
2012-11-22 07:15:26 -08:00
|
|
|
}
|
|
|
|
eina_stringshare_del(content_pair->part);
|
|
|
|
free(content_pair);
|
|
|
|
}
|
2012-11-24 04:43:31 -08:00
|
|
|
EINA_INLIST_FOREACH_SAFE(it->text_list, l, text_pair)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(text_pair->part);
|
|
|
|
free(text_pair);
|
|
|
|
}
|
2012-11-22 07:15:26 -08:00
|
|
|
|
2012-11-22 06:47:08 -08:00
|
|
|
if (it->content)
|
2011-10-23 23:35:48 -07:00
|
|
|
{
|
2012-11-22 06:47:08 -08:00
|
|
|
if ((sd->preserve) && (!sd->on_deletion))
|
|
|
|
{
|
|
|
|
/* so that elm does not delete the contents with the item's
|
2014-09-17 06:44:05 -07:00
|
|
|
* view after the destructor */
|
2013-02-16 06:16:50 -08:00
|
|
|
elm_object_part_content_unset(VIEW(it), CONTENT_PART);
|
2012-11-22 06:47:08 -08:00
|
|
|
evas_object_event_callback_del
|
|
|
|
(it->content, EVAS_CALLBACK_DEL, _item_content_del_cb);
|
2016-05-29 21:53:40 -07:00
|
|
|
evas_object_hide(it->content);
|
2012-11-22 06:47:08 -08:00
|
|
|
}
|
2011-10-23 23:35:48 -07:00
|
|
|
}
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_content_signals_emit(Elm_Naviframe_Item_Data *it)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-08-28 17:34:13 -07:00
|
|
|
Elm_Naviframe_Content_Item_Pair *content_pair;
|
|
|
|
char buf[1024];
|
2012-06-01 14:56:09 -07:00
|
|
|
//content
|
|
|
|
if (it->content)
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,content,show", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
else
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm");
|
2011-10-14 22:16:53 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
//prev button
|
|
|
|
if (it->title_prev_btn)
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
else
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm");
|
2011-10-14 22:16:53 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
//next button
|
|
|
|
if (it->title_next_btn)
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
else
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm");
|
2011-10-14 22:16:53 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (it->title_icon)
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
else
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm");
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
|
2012-08-28 17:34:13 -07:00
|
|
|
EINA_INLIST_FOREACH(it->content_list, content_pair)
|
|
|
|
{
|
2012-12-03 02:10:17 -08:00
|
|
|
if (content_pair->content)
|
2012-11-30 05:27:56 -08:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,show", content_pair->part);
|
2012-08-28 17:34:13 -07:00
|
|
|
else
|
2012-11-30 05:27:56 -08:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hide", content_pair->part);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), buf, "elm");
|
2012-08-28 17:34:13 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_text_signals_emit(Elm_Naviframe_Item_Data *it)
|
2012-08-28 17:34:13 -07:00
|
|
|
{
|
|
|
|
Elm_Naviframe_Text_Item_Pair *text_pair;
|
|
|
|
char buf[1024];
|
|
|
|
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
if ((it->title_label) && (it->title_label[0]))
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,title_label,show", "elm");
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
else
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,title_label,hide", "elm");
|
2012-08-28 17:34:13 -07:00
|
|
|
|
|
|
|
if ((it->subtitle_label) && (it->subtitle_label[0]))
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,subtitle,show", "elm");
|
2012-08-28 17:34:13 -07:00
|
|
|
else
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,subtitle,hide", "elm");
|
2012-08-28 17:34:13 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(it->text_list, text_pair)
|
|
|
|
{
|
2013-01-03 03:26:57 -08:00
|
|
|
if (elm_object_part_text_get(VIEW(it), text_pair->part))
|
2012-11-30 05:27:56 -08:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,show", text_pair->part);
|
2012-08-28 17:34:13 -07:00
|
|
|
else
|
2012-11-30 05:27:56 -08:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hide", text_pair->part);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), buf, "elm");
|
2012-08-28 17:34:13 -07:00
|
|
|
}
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
2012-11-21 05:41:03 -08:00
|
|
|
static Evas_Object *
|
2014-09-27 22:15:18 -07:00
|
|
|
_access_object_get(Elm_Naviframe_Item_Data *it, const char* part)
|
2012-11-21 05:41:03 -08:00
|
|
|
{
|
|
|
|
Evas_Object *po, *ao;
|
|
|
|
|
2013-01-11 22:41:21 -08:00
|
|
|
po = (Evas_Object *)edje_object_part_object_get
|
|
|
|
(elm_layout_edje_get(VIEW(it)), part);
|
2012-11-21 05:41:03 -08:00
|
|
|
ao = evas_object_data_get(po, "_part_access_obj");
|
|
|
|
|
|
|
|
return ao;
|
|
|
|
}
|
|
|
|
|
2014-07-31 05:26:14 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_access_info_has(Evas_Object *obj, int type)
|
|
|
|
{
|
|
|
|
Elm_Access_Info *ac;
|
|
|
|
Elm_Access_Item *ai;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
ac = _elm_access_info_get(obj);
|
|
|
|
if (!ac) return EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(ac->items, l, ai)
|
|
|
|
{
|
|
|
|
if (ai->type == type)
|
|
|
|
{
|
|
|
|
if (ai->func || ai->data) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-12-04 20:01:55 -08:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_signals_emit(Elm_Naviframe_Item_Data *it)
|
2012-12-04 20:01:55 -08:00
|
|
|
{
|
|
|
|
_item_text_signals_emit(it);
|
|
|
|
_item_content_signals_emit(it);
|
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
/* FIXME: we need to handle the case when this function is called
|
|
|
|
* during a transition */
|
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_style_set(Elm_Naviframe_Item_Data *it,
|
2012-06-01 14:56:09 -07:00
|
|
|
const char *item_style)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd);
|
|
|
|
|
|
|
|
if (!item_style)
|
2012-02-26 21:37:57 -08:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
strcpy(buf, "item/basic");
|
|
|
|
eina_stringshare_replace(&it->style, "basic");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "item/%s", item_style);
|
|
|
|
eina_stringshare_replace(&it->style, item_style);
|
2012-02-26 21:37:57 -08:00
|
|
|
}
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(VIEW(it), "naviframe", buf,
|
|
|
|
elm_widget_style_get(WIDGET(it))))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
if (sd->freeze_events)
|
|
|
|
evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
static void
|
2014-01-14 21:29:05 -08:00
|
|
|
_on_item_title_transition_finished(void *data,
|
2014-01-14 21:36:55 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-09-15 18:05:15 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2014-01-14 21:29:05 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call
|
|
|
|
(WIDGET(it), ELM_NAVIFRAME_EVENT_TITLE_TRANSITION_FINISHED, EO_OBJ(it));
|
2014-01-14 21:29:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_title_enabled_update(Elm_Naviframe_Item_Data *nit, Eina_Bool transition)
|
2014-01-14 21:29:05 -08:00
|
|
|
{
|
|
|
|
transition = !!transition;
|
|
|
|
if (transition)
|
|
|
|
{
|
|
|
|
if (nit->title_enabled)
|
|
|
|
elm_object_signal_emit(VIEW(nit), "elm,action,title,show", "elm");
|
|
|
|
else
|
|
|
|
elm_object_signal_emit(VIEW(nit), "elm,action,title,hide", "elm");
|
|
|
|
}
|
2012-06-01 14:56:09 -07:00
|
|
|
else
|
2014-01-14 21:29:05 -08:00
|
|
|
{
|
|
|
|
if (nit->title_enabled)
|
|
|
|
elm_object_signal_emit(VIEW(nit), "elm,state,title,show", "elm");
|
|
|
|
else
|
|
|
|
elm_object_signal_emit(VIEW(nit), "elm,state,title,hide", "elm");
|
|
|
|
}
|
2011-09-15 18:05:15 -07:00
|
|
|
}
|
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
EOLIAN static Elm_Theme_Apply
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_elm_widget_theme_apply(Eo *obj, Elm_Naviframe_Data *sd)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it;
|
2014-04-03 06:04:32 -07:00
|
|
|
const char *style = NULL, *sstyle = NULL;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
style = elm_obj_widget_style_get(obj);
|
2013-02-16 04:08:42 -08:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->stack, it)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
sstyle = elm_obj_widget_style_get(VIEW(it));
|
2013-02-16 04:08:42 -08:00
|
|
|
if ((style && sstyle) && strcmp(style, sstyle))
|
2013-08-20 19:43:39 -07:00
|
|
|
_item_style_set(it, it->style);
|
|
|
|
_item_signals_emit(it);
|
2014-01-14 21:29:05 -08:00
|
|
|
_item_title_enabled_update(it, EINA_FALSE);
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return ELM_THEME_APPLY_SUCCESS;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2013-01-11 22:41:21 -08:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
2013-01-11 22:41:21 -08:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *nit;
|
2013-01-11 22:41:21 -08:00
|
|
|
Evas_Object *layout;
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
const char *info;
|
|
|
|
char *ret;
|
|
|
|
|
2013-06-08 02:10:17 -07:00
|
|
|
nit = data;
|
2014-01-14 21:29:05 -08:00
|
|
|
if (!nit->title_enabled) return NULL;
|
2013-06-08 02:10:17 -07:00
|
|
|
|
|
|
|
layout = VIEW(nit);
|
2013-01-11 22:41:21 -08:00
|
|
|
info = elm_object_part_text_get(layout, TITLE_PART);
|
|
|
|
if (!info) return NULL;
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
|
|
|
eina_strbuf_append(buf, info);
|
|
|
|
|
|
|
|
info = elm_object_part_text_get(layout, SUBTITLE_PART);
|
|
|
|
if (!info) goto end;
|
|
|
|
|
|
|
|
eina_strbuf_append_printf(buf, ", %s", info);
|
|
|
|
|
|
|
|
end:
|
|
|
|
ret = eina_strbuf_string_steal(buf);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-11-21 05:41:03 -08:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_access_obj_process(Elm_Naviframe_Item_Data *it, Eina_Bool is_access)
|
2012-11-21 05:41:03 -08:00
|
|
|
{
|
2013-01-11 22:41:21 -08:00
|
|
|
Evas_Object *ao, *eo;
|
2012-11-21 05:41:03 -08:00
|
|
|
|
2013-06-08 02:10:17 -07:00
|
|
|
if (is_access && (it->title_label || it->subtitle_label))
|
2012-11-21 05:41:03 -08:00
|
|
|
{
|
2013-01-11 22:41:21 -08:00
|
|
|
if (!_access_object_get(it, TITLE_ACCESS_PART))
|
2012-11-21 05:41:03 -08:00
|
|
|
{
|
2013-01-11 22:41:21 -08:00
|
|
|
eo = elm_layout_edje_get(VIEW(it));
|
|
|
|
ao =_elm_access_edje_object_part_object_register(WIDGET(it), eo,
|
|
|
|
TITLE_ACCESS_PART);
|
2013-07-30 20:53:04 -07:00
|
|
|
_elm_access_text_set(_elm_access_info_get(ao),
|
2013-01-11 22:41:21 -08:00
|
|
|
ELM_ACCESS_TYPE, E_("Title"));
|
2013-07-30 20:53:04 -07:00
|
|
|
_elm_access_callback_set(_elm_access_info_get(ao),
|
2013-06-08 02:10:17 -07:00
|
|
|
ELM_ACCESS_INFO, _access_info_cb, it);
|
2013-01-31 03:35:26 -08:00
|
|
|
/* to access title access object, any idea? */
|
2014-09-27 22:15:18 -07:00
|
|
|
it->base->access_obj = ao;
|
2012-11-21 05:41:03 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-31 03:35:26 -08:00
|
|
|
/* to access title access object, any idea? */
|
2014-09-27 22:15:18 -07:00
|
|
|
ao = it->base->access_obj;
|
2013-01-31 03:35:26 -08:00
|
|
|
if (!ao) return;
|
2013-06-08 02:11:09 -07:00
|
|
|
|
2013-06-08 02:13:26 -07:00
|
|
|
if (it->title_label || it->subtitle_label)
|
2013-06-08 02:11:09 -07:00
|
|
|
_elm_access_edje_object_part_object_unregister
|
|
|
|
(WIDGET(it), elm_layout_edje_get(VIEW(it)), TITLE_ACCESS_PART);
|
2013-01-31 03:35:26 -08:00
|
|
|
evas_object_del(ao);
|
2012-11-21 05:41:03 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_elm_widget_item_part_text_set(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *it,
|
|
|
|
const char *part,
|
|
|
|
const char *label)
|
2011-08-04 09:37:36 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *nit = it;
|
2012-08-28 17:34:13 -07:00
|
|
|
Elm_Naviframe_Text_Item_Pair *pair = NULL;
|
2011-09-13 23:23:08 -07:00
|
|
|
char buf[1024];
|
2011-08-04 09:37:36 -07:00
|
|
|
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
if ((!part) || (!strcmp(part, "default")) ||
|
2013-01-04 20:24:22 -08:00
|
|
|
(!strcmp(part, TITLE_PART)))
|
2012-07-25 10:38:48 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_replace(&nit->title_label, label);
|
2012-11-30 05:16:11 -08:00
|
|
|
if (label)
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,title_label,show", "elm");
|
2012-11-30 05:16:11 -08:00
|
|
|
else
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,title_label,hide", "elm");
|
2013-01-04 20:24:22 -08:00
|
|
|
elm_object_part_text_set(VIEW(it), TITLE_PART, label);
|
2012-07-25 10:38:48 -07:00
|
|
|
}
|
2015-11-09 14:34:37 -08:00
|
|
|
else if ((!strcmp(part, "subtitle")) || (!strcmp(part, SUBTITLE_PART)))
|
2012-07-31 04:12:00 -07:00
|
|
|
{
|
2012-08-28 17:34:13 -07:00
|
|
|
eina_stringshare_replace(&nit->subtitle_label, label);
|
2012-11-30 05:16:11 -08:00
|
|
|
if (label)
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,subtitle,show", "elm");
|
2012-11-30 05:16:11 -08:00
|
|
|
else
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,subtitle,hide", "elm");
|
2013-01-04 20:24:22 -08:00
|
|
|
elm_object_part_text_set(VIEW(it), SUBTITLE_PART, label);
|
2012-07-31 04:12:00 -07:00
|
|
|
}
|
2011-09-14 05:37:17 -07:00
|
|
|
else
|
2012-08-28 17:34:13 -07:00
|
|
|
{
|
|
|
|
EINA_INLIST_FOREACH(nit->text_list, pair)
|
2013-01-02 20:20:11 -08:00
|
|
|
if (!strcmp(part, pair->part)) break;
|
2012-08-28 17:34:13 -07:00
|
|
|
|
|
|
|
if (!pair)
|
|
|
|
{
|
|
|
|
pair = ELM_NEW(Elm_Naviframe_Text_Item_Pair);
|
|
|
|
if (!pair)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate new text part of the item! : naviframe=%p",
|
|
|
|
WIDGET(it));
|
|
|
|
return;
|
|
|
|
}
|
2013-01-02 20:20:11 -08:00
|
|
|
eina_stringshare_replace(&pair->part, part);
|
2012-08-28 17:34:13 -07:00
|
|
|
nit->text_list = eina_inlist_append(nit->text_list,
|
|
|
|
EINA_INLIST_GET(pair));
|
|
|
|
}
|
2013-01-06 06:15:52 -08:00
|
|
|
if (label)
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
|
|
|
|
elm_object_signal_emit(VIEW(it), buf, "elm");
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_part_text_set(VIEW(it), part, label);
|
2012-08-28 17:34:13 -07:00
|
|
|
}
|
2011-09-13 23:23:08 -07:00
|
|
|
|
2012-11-21 05:41:03 -08:00
|
|
|
/* access */
|
|
|
|
if (_elm_config->access_mode)
|
|
|
|
_access_obj_process(nit, EINA_TRUE);
|
|
|
|
|
2015-12-16 07:18:17 -08:00
|
|
|
memset(buf, 0x0, sizeof(buf));
|
|
|
|
if (nit->title_label)
|
|
|
|
strncat(buf, nit->title_label, sizeof(buf) - 1);
|
|
|
|
if (nit->subtitle_label)
|
|
|
|
{
|
|
|
|
if (nit->title_label) strncat(buf, " ", 1);
|
|
|
|
strncat(buf, nit->subtitle_label, sizeof(buf) - strlen(buf) - 2);
|
|
|
|
}
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_name_set(VIEW(it), buf);
|
2015-12-16 07:18:17 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
elm_layout_sizing_eval(WIDGET(nit));
|
2011-08-04 09:37:36 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static const char *
|
|
|
|
_elm_naviframe_item_elm_widget_item_part_text_get(Eo *nit EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *it,
|
|
|
|
const char *part)
|
2011-08-04 09:37:36 -07:00
|
|
|
{
|
2011-09-14 05:37:17 -07:00
|
|
|
char buf[1024];
|
2011-08-04 09:37:36 -07:00
|
|
|
|
2011-11-16 04:51:53 -08:00
|
|
|
if (!part || !strcmp(part, "default"))
|
2013-01-04 20:24:22 -08:00
|
|
|
snprintf(buf, sizeof(buf), TITLE_PART);
|
2012-03-29 04:09:45 -07:00
|
|
|
else if (!strcmp("subtitle", part))
|
2013-01-04 20:24:22 -08:00
|
|
|
snprintf(buf, sizeof(buf), SUBTITLE_PART);
|
2011-09-14 05:37:17 -07:00
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "%s", part);
|
2011-09-13 23:23:08 -07:00
|
|
|
|
2013-01-03 03:26:57 -08:00
|
|
|
return elm_object_part_text_get(VIEW(it), buf);
|
2011-08-04 09:37:36 -07:00
|
|
|
}
|
|
|
|
|
2014-09-17 06:44:05 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_eo_base_destructor(Eo *eo_item, Elm_Naviframe_Item_Data *it)
|
2011-08-04 09:37:36 -07:00
|
|
|
{
|
2015-05-06 05:25:15 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Elm_Naviframe_Op *nfo;
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *nit = it, *prev_it = NULL;
|
2012-06-01 14:56:09 -07:00
|
|
|
Eina_Bool top;
|
2011-08-04 09:37:36 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
ELM_NAVIFRAME_DATA_GET(WIDGET(nit), sd);
|
|
|
|
|
2014-01-22 05:13:51 -08:00
|
|
|
nit->delete_me = EINA_TRUE;
|
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
top = (eo_item == elm_naviframe_top_item_get(WIDGET(nit)));
|
2012-06-01 14:56:09 -07:00
|
|
|
if (evas_object_data_get(VIEW(nit), "out_of_list"))
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
sd->stack = eina_inlist_remove(sd->stack, EINA_INLIST_GET(nit));
|
2011-08-04 09:37:36 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (top && !sd->on_deletion) /* must raise another one */
|
|
|
|
{
|
2013-04-25 03:26:09 -07:00
|
|
|
if (sd->stack && sd->stack->last)
|
|
|
|
prev_it = EINA_INLIST_CONTAINER_GET(sd->stack->last,
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data);
|
2015-08-31 00:15:55 -07:00
|
|
|
if (!prev_it)
|
|
|
|
{
|
|
|
|
elm_widget_tree_unfocusable_set(VIEW(nit), EINA_TRUE);
|
|
|
|
goto end;
|
|
|
|
}
|
2011-09-13 23:49:23 -07:00
|
|
|
|
2014-02-17 04:03:01 -08:00
|
|
|
elm_widget_tree_unfocusable_set(VIEW(prev_it), EINA_FALSE);
|
|
|
|
elm_widget_tree_unfocusable_set(VIEW(nit), EINA_TRUE);
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (sd->freeze_events)
|
2013-06-11 02:08:10 -07:00
|
|
|
evas_object_freeze_events_set(VIEW(prev_it), EINA_FALSE);
|
2013-10-18 03:53:16 -07:00
|
|
|
_resize_object_reset(WIDGET(prev_it), prev_it);
|
2014-01-24 09:35:37 -08:00
|
|
|
evas_object_show(VIEW(prev_it));
|
2011-09-13 23:49:23 -07:00
|
|
|
|
2013-06-05 00:31:49 -07:00
|
|
|
_prev_page_focus_recover(prev_it);
|
|
|
|
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(prev_it), "elm,state,visible", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
2011-09-13 23:49:23 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
end:
|
2015-05-06 05:25:15 -07:00
|
|
|
// This should not happen, but just in case and by security
|
|
|
|
// make sure there is no more reference to this item.
|
|
|
|
EINA_LIST_FOREACH(sd->ops, l, nfo)
|
|
|
|
{
|
|
|
|
if (nfo->related == nit) nfo->related = NULL;
|
|
|
|
if (nfo->self == nit) nfo->self = NULL;
|
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
_item_free(nit);
|
2011-09-15 19:20:02 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_destructor(eo_super(eo_item, ELM_NAVIFRAME_ITEM_CLASS));
|
2011-10-14 22:16:53 -07:00
|
|
|
}
|
|
|
|
|
2011-07-12 21:21:50 -07:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_content_set(Elm_Naviframe_Item_Data *it,
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Object *content)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
if (it->content == content) return;
|
2011-11-21 08:14:52 -08:00
|
|
|
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(it->content);
|
2012-06-01 14:56:09 -07:00
|
|
|
it->content = content;
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (!content) return;
|
2012-01-10 22:42:15 -08:00
|
|
|
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_part_content_set(VIEW(it), CONTENT_PART, content);
|
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,content,show", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(content, EVAS_CALLBACK_DEL, _item_content_del_cb, it);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_title_prev_btn_set(Elm_Naviframe_Item_Data *it,
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Object *btn)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
if (it->title_prev_btn == btn) return;
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(it->title_prev_btn);
|
2012-06-01 14:56:09 -07:00
|
|
|
it->title_prev_btn = btn;
|
2015-07-05 01:00:06 -07:00
|
|
|
if (it->auto_pushed_btn && (it->auto_pushed_btn != btn))
|
|
|
|
it->auto_pushed_btn = NULL;
|
2012-06-01 14:56:09 -07:00
|
|
|
if (!btn) return;
|
|
|
|
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_part_content_set(VIEW(it), PREV_BTN_PART, btn);
|
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(btn, EVAS_CALLBACK_DEL, _item_title_prev_btn_del_cb, it);
|
2013-03-08 04:47:07 -08:00
|
|
|
|
|
|
|
//FIXME: set back button callback here after elm 2.0
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_title_next_btn_set(Elm_Naviframe_Item_Data *it,
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Object *btn)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
if (it->title_next_btn == btn) return;
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(it->title_next_btn);
|
2012-06-01 14:56:09 -07:00
|
|
|
it->title_next_btn = btn;
|
|
|
|
if (!btn) return;
|
|
|
|
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_part_content_set(VIEW(it), NEXT_BTN_PART, btn);
|
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(btn, EVAS_CALLBACK_DEL, _item_title_next_btn_del_cb, it);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_title_icon_set(Elm_Naviframe_Item_Data *it,
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Object *icon)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
if (it->title_icon == icon) return;
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(it->title_icon);
|
2012-06-01 14:56:09 -07:00
|
|
|
it->title_icon = icon;
|
|
|
|
if (!icon) return;
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_part_content_set(VIEW(it), ICON_PART, icon);
|
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(icon, EVAS_CALLBACK_DEL, _item_title_icon_del_cb, it);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_content_unset(Elm_Naviframe_Item_Data *it)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Object *content = it->content;
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (!content) return NULL;
|
2012-02-16 21:00:22 -08:00
|
|
|
|
2013-02-16 06:16:50 -08:00
|
|
|
elm_object_part_content_unset(VIEW(it), CONTENT_PART);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm");
|
2012-02-16 21:00:22 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
evas_object_event_callback_del
|
|
|
|
(content, EVAS_CALLBACK_DEL, _item_content_del_cb);
|
2012-02-16 21:00:22 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
it->content = NULL;
|
|
|
|
return content;
|
2012-02-16 21:00:22 -08:00
|
|
|
}
|
|
|
|
|
2012-02-16 13:14:32 -08:00
|
|
|
static Evas_Object *
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_title_prev_btn_unset(Elm_Naviframe_Item_Data *it)
|
2012-02-16 13:14:32 -08:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Object *content = it->title_prev_btn;
|
2012-02-16 13:14:32 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (!content) return NULL;
|
|
|
|
|
2013-02-16 06:16:50 -08:00
|
|
|
elm_object_part_content_unset(VIEW(it), PREV_BTN_PART);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_del
|
|
|
|
(content, EVAS_CALLBACK_DEL, _item_title_prev_btn_del_cb);
|
2016-03-02 04:10:48 -08:00
|
|
|
Eo* parent = eo_parent_get(content);
|
2016-06-10 01:29:40 -07:00
|
|
|
eo_event_callback_del(content, EFL_UI_EVENT_CLICKED, _on_item_back_btn_clicked, parent);
|
2011-07-12 21:21:50 -07:00
|
|
|
it->title_prev_btn = NULL;
|
2015-07-05 01:00:06 -07:00
|
|
|
if (it->auto_pushed_btn) it->auto_pushed_btn = NULL;
|
2012-06-01 14:56:09 -07:00
|
|
|
return content;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
static Evas_Object *
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_title_next_btn_unset(Elm_Naviframe_Item_Data *it)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Object *content = it->title_next_btn;
|
|
|
|
|
|
|
|
if (!content) return NULL;
|
|
|
|
|
2013-02-16 06:16:50 -08:00
|
|
|
elm_object_part_content_unset(VIEW(it), NEXT_BTN_PART);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_del
|
|
|
|
(content, EVAS_CALLBACK_DEL, _item_title_next_btn_del_cb);
|
|
|
|
|
2011-07-12 21:21:50 -07:00
|
|
|
it->title_next_btn = NULL;
|
2012-06-01 14:56:09 -07:00
|
|
|
return content;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
static Evas_Object *
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_title_icon_unset(Elm_Naviframe_Item_Data *it)
|
2011-11-16 04:51:53 -08:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Object *content = it->title_icon;
|
|
|
|
|
|
|
|
if (!content) return NULL;
|
|
|
|
|
2013-02-16 06:16:50 -08:00
|
|
|
elm_object_part_content_unset(VIEW(it), ICON_PART);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_del
|
|
|
|
(content, EVAS_CALLBACK_DEL, _item_title_icon_del_cb);
|
|
|
|
|
2011-11-28 00:28:34 -08:00
|
|
|
it->title_icon = NULL;
|
2012-06-01 14:56:09 -07:00
|
|
|
return content;
|
2011-11-16 04:51:53 -08:00
|
|
|
}
|
|
|
|
|
2012-07-25 07:39:03 -07:00
|
|
|
/* since we have each item as layout, we can't reusing the layout's
|
|
|
|
* aliasing, so let's do it ourselves */
|
|
|
|
static void
|
|
|
|
_part_aliasing_eval(const char **part)
|
|
|
|
{
|
2015-11-09 14:34:37 -08:00
|
|
|
if (!*part || !strcmp(*part, "default"))
|
2012-07-25 07:39:03 -07:00
|
|
|
*part = CONTENT_PART;
|
|
|
|
else if (!strcmp(*part, "prev_btn"))
|
|
|
|
*part = PREV_BTN_PART;
|
|
|
|
else if (!strcmp(*part, "next_btn"))
|
|
|
|
*part = NEXT_BTN_PART;
|
|
|
|
else if (!strcmp(*part, "icon"))
|
|
|
|
*part = ICON_PART;
|
|
|
|
}
|
|
|
|
|
2012-08-28 17:34:13 -07:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_title_content_set(Elm_Naviframe_Item_Data *it,
|
2012-08-28 17:34:13 -07:00
|
|
|
const char *part,
|
|
|
|
Evas_Object *content)
|
|
|
|
{
|
|
|
|
Elm_Naviframe_Content_Item_Pair *pair = NULL;
|
|
|
|
char buf[1024];
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(it->content_list, pair)
|
|
|
|
if (!strcmp(part, pair->part)) break;
|
|
|
|
if (pair)
|
|
|
|
{
|
2012-12-03 02:10:17 -08:00
|
|
|
if (pair->content == content) return;
|
|
|
|
if (pair->content)
|
2013-02-20 18:55:02 -08:00
|
|
|
evas_object_event_callback_del(pair->content,
|
|
|
|
EVAS_CALLBACK_DEL,
|
|
|
|
_title_content_del);
|
|
|
|
if (content) elm_object_part_content_set(VIEW(it), part, content);
|
2012-08-28 17:34:13 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!content) return;
|
2012-12-03 02:21:09 -08:00
|
|
|
|
|
|
|
//Remove the pair if new content was swallowed into other part.
|
|
|
|
EINA_INLIST_FOREACH(it->content_list, pair)
|
|
|
|
{
|
|
|
|
if (pair->content == content)
|
|
|
|
{
|
|
|
|
eina_stringshare_del(pair->part);
|
|
|
|
it->content_list = eina_inlist_remove(it->content_list,
|
|
|
|
EINA_INLIST_GET(pair));
|
|
|
|
evas_object_event_callback_del(pair->content,
|
|
|
|
EVAS_CALLBACK_DEL,
|
|
|
|
_title_content_del);
|
2012-12-13 06:17:29 -08:00
|
|
|
free(pair);
|
2012-12-03 02:21:09 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//New pair
|
2012-08-28 17:34:13 -07:00
|
|
|
pair = ELM_NEW(Elm_Naviframe_Content_Item_Pair);
|
|
|
|
if (!pair)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate new content part of the item! : naviframe=%p",
|
|
|
|
WIDGET(it));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pair->it = it;
|
|
|
|
eina_stringshare_replace(&pair->part, part);
|
|
|
|
it->content_list = eina_inlist_append(it->content_list,
|
|
|
|
EINA_INLIST_GET(pair));
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_part_content_set(VIEW(it), part, content);
|
2012-11-30 05:16:11 -08:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,show", part);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), buf, "elm");
|
2012-11-30 05:16:11 -08:00
|
|
|
}
|
2012-12-03 20:16:48 -08:00
|
|
|
pair->content = content;
|
2012-12-03 02:10:17 -08:00
|
|
|
evas_object_event_callback_add(content,
|
|
|
|
EVAS_CALLBACK_DEL,
|
|
|
|
_title_content_del,
|
|
|
|
pair);
|
2012-08-28 17:34:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_elm_widget_item_part_content_set(Eo *eo_nit EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *nit,
|
|
|
|
const char *part,
|
|
|
|
Evas_Object *content)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-07-25 07:39:03 -07:00
|
|
|
_part_aliasing_eval(&part);
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
//specified parts
|
2015-11-09 14:34:37 -08:00
|
|
|
if (!strcmp(part, CONTENT_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
_item_content_set(nit, content);
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, PREV_BTN_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
_item_title_prev_btn_set(nit, content);
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, NEXT_BTN_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
_item_title_next_btn_set(nit, content);
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, ICON_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
_item_title_icon_set(nit, content);
|
|
|
|
else
|
2012-08-28 17:34:13 -07:00
|
|
|
_title_content_set(nit, part, content);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
elm_layout_sizing_eval(WIDGET(nit));
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static Evas_Object *
|
|
|
|
_elm_naviframe_item_elm_widget_item_part_content_get(Eo *eo_nit EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *nit,
|
|
|
|
const char *part)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-07-25 07:39:03 -07:00
|
|
|
_part_aliasing_eval(&part);
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
//specified parts
|
2015-11-09 14:34:37 -08:00
|
|
|
if (!strcmp(part, CONTENT_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
return nit->content;
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, PREV_BTN_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
return nit->title_prev_btn;
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, NEXT_BTN_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
return nit->title_next_btn;
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, ICON_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
return nit->title_icon;
|
2011-09-13 23:23:08 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
//common parts
|
2013-01-03 03:26:57 -08:00
|
|
|
return elm_object_part_content_get(VIEW(nit), part);
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
2012-08-28 17:34:13 -07:00
|
|
|
static Evas_Object *
|
2014-09-27 22:15:18 -07:00
|
|
|
_title_content_unset(Elm_Naviframe_Item_Data *it, const char *part)
|
2012-08-28 17:34:13 -07:00
|
|
|
{
|
|
|
|
Elm_Naviframe_Content_Item_Pair *pair = NULL;
|
|
|
|
char buf[1028];
|
|
|
|
Evas_Object *content = NULL;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(it->content_list, pair)
|
|
|
|
{
|
|
|
|
if (!strcmp(part, pair->part))
|
|
|
|
{
|
2012-12-03 02:10:17 -08:00
|
|
|
content = pair->content;
|
2012-08-28 17:34:13 -07:00
|
|
|
eina_stringshare_del(pair->part);
|
|
|
|
it->content_list = eina_inlist_remove(it->content_list,
|
|
|
|
EINA_INLIST_GET(pair));
|
|
|
|
free(pair);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!content) return NULL;
|
|
|
|
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_part_content_unset(VIEW(it), part);
|
2012-08-28 17:34:13 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,%s,hide", part);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), buf, "elm");
|
2012-08-28 17:34:13 -07:00
|
|
|
evas_object_event_callback_del(content,
|
|
|
|
EVAS_CALLBACK_DEL,
|
|
|
|
_title_content_del);
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static Evas_Object *
|
|
|
|
_elm_naviframe_item_elm_widget_item_part_content_unset(Eo *eo_nit EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *nit,
|
|
|
|
const char *part)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
|
|
|
Evas_Object *o = NULL;
|
|
|
|
|
2012-07-25 07:39:03 -07:00
|
|
|
_part_aliasing_eval(&part);
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
//specified parts
|
2015-11-09 14:34:37 -08:00
|
|
|
if (!strcmp(part, CONTENT_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
o = _item_content_unset(nit);
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, PREV_BTN_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
o = _item_title_prev_btn_unset(nit);
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, NEXT_BTN_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
o = _item_title_next_btn_unset(nit);
|
2012-07-25 07:39:03 -07:00
|
|
|
else if (!strcmp(part, ICON_PART))
|
2012-06-01 14:56:09 -07:00
|
|
|
o = _item_title_icon_unset(nit);
|
2011-12-16 01:07:41 -08:00
|
|
|
else
|
2012-08-28 17:34:13 -07:00
|
|
|
o = _title_content_unset(nit, part);
|
2011-12-01 03:41:47 -08:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
elm_layout_sizing_eval(WIDGET(nit));
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_elm_widget_item_signal_emit(Eo *eo_it EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *it,
|
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), emission, source);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_elm_layout_sizing_eval(Eo *obj, Elm_Naviframe_Data *sd)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2015-12-23 20:46:17 -08:00
|
|
|
Evas_Coord minw = 0, minh = 0;
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it, *top;
|
2012-06-01 14:56:09 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
2014-01-22 05:09:16 -08:00
|
|
|
if (sd->on_deletion) return;
|
2013-09-05 10:32:08 -07:00
|
|
|
if (!sd->stack) return;
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
top = (EINA_INLIST_CONTAINER_GET(sd->stack->last, Elm_Naviframe_Item_Data));
|
2012-09-04 05:46:02 -07:00
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->stack, it)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2012-09-05 00:42:57 -07:00
|
|
|
evas_object_move(VIEW(it), x, y);
|
2012-06-01 14:56:09 -07:00
|
|
|
evas_object_resize(VIEW(it), w, h);
|
2013-09-05 10:32:08 -07:00
|
|
|
|
|
|
|
if (it == top)
|
|
|
|
{
|
|
|
|
edje_object_size_min_calc(elm_layout_edje_get(VIEW(it)),
|
|
|
|
&it->minw, &it->minh);
|
|
|
|
minw = it->minw;
|
|
|
|
minh = it->minh;
|
|
|
|
}
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
2011-08-04 09:52:39 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-02-29 03:32:52 -08:00
|
|
|
_on_item_back_btn_clicked(void *data, const Eo_Event *event)
|
2011-11-16 04:51:53 -08:00
|
|
|
{
|
2015-10-28 10:06:29 -07:00
|
|
|
/* Since edje has the event queue, clicked event could be happened
|
2012-06-01 14:56:09 -07:00
|
|
|
multiple times on some heavy environment. This callback del will
|
|
|
|
prevent those scenario and guarantee only one clicked for it's own
|
|
|
|
page. */
|
2016-06-10 01:29:40 -07:00
|
|
|
eo_event_callback_del(event->object, EFL_UI_EVENT_CLICKED, _on_item_back_btn_clicked, data);
|
2012-11-20 21:55:25 -08:00
|
|
|
elm_naviframe_item_pop(data);
|
2011-11-16 04:51:53 -08:00
|
|
|
}
|
|
|
|
|
2011-11-28 00:28:34 -08:00
|
|
|
static Evas_Object *
|
2012-07-25 10:38:48 -07:00
|
|
|
_back_btn_new(Evas_Object *obj, const char *title_label)
|
2011-11-28 00:28:34 -08:00
|
|
|
{
|
2012-07-26 12:39:10 -07:00
|
|
|
Evas_Object *btn, *ed;
|
2012-06-01 14:56:09 -07:00
|
|
|
char buf[1024];
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
btn = elm_button_add(obj);
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (!btn) return NULL;
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_add
|
2016-06-10 01:29:40 -07:00
|
|
|
(btn, EFL_UI_EVENT_CLICKED, _on_item_back_btn_clicked, obj);
|
2012-06-01 14:56:09 -07:00
|
|
|
snprintf
|
|
|
|
(buf, sizeof(buf), "naviframe/back_btn/%s", elm_widget_style_get(obj));
|
|
|
|
elm_object_style_set(btn, buf);
|
2012-07-25 10:38:48 -07:00
|
|
|
if (title_label)
|
|
|
|
elm_layout_text_set(btn, NULL, title_label);
|
|
|
|
else
|
|
|
|
elm_object_domain_translatable_text_set(btn, PACKAGE, N_("Back"));
|
2012-07-25 10:20:34 -07:00
|
|
|
|
2012-07-26 12:39:10 -07:00
|
|
|
/* HACK NOTE: this explicit check only exists to avoid an ERR()
|
|
|
|
* message from elm_layout_content_set().
|
|
|
|
*
|
|
|
|
* The button was ALWAYS supposed to support an elm.swallow.content, but
|
|
|
|
* default naviframe/back_btn/default theme did not provide such, then
|
|
|
|
* old themes would emit such error message.
|
|
|
|
*
|
|
|
|
* Once we can break the theme API, remove this check and always
|
|
|
|
* set an icon.
|
|
|
|
*/
|
|
|
|
ed = elm_layout_edje_get(btn);
|
2013-02-16 06:16:50 -08:00
|
|
|
if (edje_object_part_exists(ed, CONTENT_PART))
|
2012-07-26 12:39:10 -07:00
|
|
|
{
|
|
|
|
Evas_Object *ico = elm_icon_add(btn);
|
2016-05-16 01:12:21 -07:00
|
|
|
elm_icon_standard_set(ico, "go-previous");
|
2013-02-16 06:16:50 -08:00
|
|
|
elm_layout_content_set(btn, CONTENT_PART, ico);
|
2012-07-26 12:39:10 -07:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
return btn;
|
2011-11-28 00:28:34 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2016-06-27 11:18:02 -07:00
|
|
|
_elm_naviframe_edje_object_signal_emit(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *emission, const char *source)
|
2011-11-28 00:28:34 -08:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_top_it;
|
2014-07-31 06:06:20 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
eo_top_it = elm_naviframe_top_item_get(obj);
|
|
|
|
if (!eo_top_it) return;
|
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_top_it, top_it);
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2016-06-27 11:18:02 -07:00
|
|
|
edje_obj_signal_emit(VIEW(top_it), emission, source);
|
2011-11-28 00:28:34 -08:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
/* content/text smart functions proxying things to the top item, which
|
|
|
|
* is the resize object of the layout */
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_elm_layout_text_set(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *part, const char *label)
|
2011-11-28 00:28:34 -08:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
Elm_Object_Item *it;
|
2015-10-04 06:26:08 -07:00
|
|
|
const char *text = NULL;
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
it = elm_naviframe_top_item_get(obj);
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!it) return EINA_FALSE;
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
elm_object_item_part_text_set(it, part, label);
|
2015-10-04 06:26:08 -07:00
|
|
|
text = elm_object_item_part_text_get(it, part);
|
|
|
|
if ((text) && !strcmp(text, label))
|
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
2011-11-28 00:28:34 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static const char*
|
2014-12-09 10:41:16 -08:00
|
|
|
_elm_naviframe_elm_layout_text_get(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *part)
|
2011-11-28 00:28:34 -08:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!it) return NULL;
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
return elm_object_item_part_text_get(it, part);
|
2011-11-28 00:28:34 -08:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
/* we have to keep a "manual" set here because of the callbacks on the
|
|
|
|
* children */
|
2016-05-24 04:40:18 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_elm_naviframe_content_set(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *part, Evas_Object *content)
|
2011-11-28 00:28:34 -08:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
Elm_Object_Item *it;
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
it = elm_naviframe_top_item_get(obj);
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!it) return EINA_FALSE;
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
elm_object_item_part_content_set(it, part, content);
|
2011-11-28 00:28:34 -08:00
|
|
|
|
2014-05-10 07:15:54 -07:00
|
|
|
if (content == elm_object_item_part_content_get(it, part))
|
|
|
|
return EINA_TRUE;
|
2014-03-30 01:51:39 -07:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
2011-11-28 00:28:34 -08:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Evas_Object*
|
|
|
|
_elm_naviframe_content_get(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *part)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!it) return NULL;
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
return elm_object_item_part_content_get(it, part);
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
2011-09-13 23:23:08 -07:00
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Evas_Object*
|
|
|
|
_elm_naviframe_content_unset(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *part)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
|
|
|
Elm_Object_Item *it = elm_naviframe_top_item_get(obj);
|
2011-09-13 23:23:08 -07:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!it) return NULL;
|
2012-03-12 19:22:57 -07:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
return elm_object_item_part_content_unset(it, part);
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
static void
|
|
|
|
_on_item_title_clicked(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2012-01-27 03:56:14 -08:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), ELM_NAVIFRAME_EVENT_TITLE_CLICKED, EO_OBJ(it));
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
/* "elm,state,cur,pushed"
|
|
|
|
*/
|
2011-07-12 21:21:50 -07:00
|
|
|
static void
|
2012-06-01 14:56:09 -07:00
|
|
|
_on_item_push_finished(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2011-07-12 21:21:50 -07:00
|
|
|
if (!it) return;
|
2011-10-28 01:31:42 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd);
|
2011-10-28 01:31:42 -07:00
|
|
|
|
2014-01-24 09:35:37 -08:00
|
|
|
evas_object_hide(VIEW(it));
|
|
|
|
|
2014-04-23 22:22:26 -07:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,invisible", "elm");
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (sd->freeze_events)
|
2011-10-28 01:31:42 -07:00
|
|
|
evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
/* "elm,state,cur,popped"
|
|
|
|
*/
|
2011-07-12 21:21:50 -07:00
|
|
|
static void
|
2012-06-01 14:56:09 -07:00
|
|
|
_on_item_pop_finished(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd);
|
2012-03-26 22:48:41 -07:00
|
|
|
|
2013-03-11 04:08:52 -07:00
|
|
|
if (sd->preserve)
|
2014-02-17 04:03:01 -08:00
|
|
|
elm_widget_tree_unfocusable_set(VIEW(it), EINA_FALSE);
|
2012-12-07 04:31:07 -08:00
|
|
|
sd->popping = eina_list_remove(sd->popping, it);
|
2012-03-26 22:48:41 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(EO_OBJ(it));
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
/* "elm,state,new,pushed",
|
|
|
|
* "elm,state,prev,popped
|
|
|
|
*/
|
2011-07-12 21:21:50 -07:00
|
|
|
static void
|
2012-06-01 14:56:09 -07:00
|
|
|
_on_item_show_finished(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it = data;
|
2012-03-14 22:37:17 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd);
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2013-02-16 06:33:16 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,visible", "elm");
|
|
|
|
|
2013-06-05 00:31:49 -07:00
|
|
|
_prev_page_focus_recover(it);
|
2012-01-11 03:25:04 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (sd->freeze_events)
|
|
|
|
evas_object_freeze_events_set(VIEW(it), EINA_FALSE);
|
2012-12-17 06:05:13 -08:00
|
|
|
|
2015-08-28 02:28:19 -07:00
|
|
|
it->pushing = EINA_FALSE;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_call(WIDGET(it), ELM_NAVIFRAME_EVENT_TRANSITION_FINISHED, EO_OBJ(it));
|
2011-08-04 09:37:36 -07:00
|
|
|
}
|
|
|
|
|
2011-10-19 01:49:24 -07:00
|
|
|
static void
|
2012-06-01 14:56:09 -07:00
|
|
|
_on_item_size_hints_changed(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2011-10-19 01:49:24 -07:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
2011-10-19 01:49:24 -07:00
|
|
|
}
|
|
|
|
|
2013-01-21 21:28:31 -08:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_dispmode_set(Elm_Naviframe_Item_Data *it, Evas_Display_Mode dispmode)
|
2013-01-21 21:28:31 -08:00
|
|
|
{
|
|
|
|
if (it->dispmode == dispmode) return;
|
|
|
|
switch (dispmode)
|
|
|
|
{
|
|
|
|
case EVAS_DISPLAY_MODE_COMPRESS:
|
2013-04-04 23:56:35 -07:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,display,compress", "elm");
|
2013-01-21 21:28:31 -08:00
|
|
|
break;
|
|
|
|
default:
|
2013-04-04 23:56:35 -07:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,display,default", "elm");
|
2013-01-21 21:28:31 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
it->dispmode = dispmode;
|
|
|
|
}
|
|
|
|
|
2013-05-08 02:01:30 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_prev_btn_info_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED)
|
2013-05-08 02:01:30 -07:00
|
|
|
{
|
2013-06-08 01:40:39 -07:00
|
|
|
return strdup(E_("Back"));
|
2013-05-08 02:01:30 -07:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2014-09-27 22:15:18 -07:00
|
|
|
_elm_naviframe_item_eo_base_constructor(Eo *eo_item, Elm_Naviframe_Item_Data *it)
|
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_item = eo_constructor(eo_super(eo_item, ELM_NAVIFRAME_ITEM_CLASS));
|
2014-09-27 22:15:18 -07:00
|
|
|
it->base = eo_data_scope_get(eo_item, ELM_WIDGET_ITEM_CLASS);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return eo_item;
|
2014-09-27 22:15:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_Object_Item *
|
2011-11-03 00:15:18 -07:00
|
|
|
_item_new(Evas_Object *obj,
|
2014-09-27 22:15:18 -07:00
|
|
|
const Elm_Object_Item *eo_prev_it,
|
2011-11-03 00:15:18 -07:00
|
|
|
const char *title_label,
|
|
|
|
Evas_Object *prev_btn,
|
|
|
|
Evas_Object *next_btn,
|
|
|
|
Evas_Object *content,
|
|
|
|
const char *item_style)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Eo *eo_item;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
ELM_NAVIFRAME_DATA_GET(obj, sd);
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2016-03-11 04:34:16 -08:00
|
|
|
eo_item = eo_add(ELM_NAVIFRAME_ITEM_CLASS, obj);
|
2014-09-27 22:15:18 -07:00
|
|
|
|
|
|
|
if (!eo_item)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
|
|
|
ERR("Failed to allocate new item! : naviframe=%p", obj);
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-08-04 09:37:36 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_item, it);
|
2011-08-04 09:37:36 -07:00
|
|
|
|
2011-07-12 21:21:50 -07:00
|
|
|
//item base layout
|
2013-01-03 03:26:57 -08:00
|
|
|
VIEW(it) = elm_layout_add(obj);
|
2012-03-28 03:04:55 -07:00
|
|
|
evas_object_smart_member_add(VIEW(it), obj);
|
2012-01-11 03:25:04 -08:00
|
|
|
|
2013-10-18 03:53:16 -07:00
|
|
|
if (!elm_widget_sub_object_add(obj, VIEW(it)))
|
|
|
|
ERR("could not add %p as sub object of %p", VIEW(it), obj);
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(VIEW(it), ELM_ATSPI_ROLE_PAGE_TAB);
|
|
|
|
elm_interface_atspi_accessible_name_set(VIEW(it), (char*)title_label);
|
2015-12-16 07:18:17 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(VIEW(it), EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_on_item_size_hints_changed, obj);
|
2013-01-03 03:26:57 -08:00
|
|
|
|
|
|
|
elm_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(VIEW(it), "elm,action,show,finished", "*", _on_item_show_finished, it);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(VIEW(it), "elm,action,pushed,finished", "*", _on_item_push_finished, it);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(VIEW(it), "elm,action,popped,finished", "*", _on_item_pop_finished, it);
|
2014-01-14 21:29:05 -08:00
|
|
|
elm_object_signal_callback_add
|
|
|
|
(VIEW(it), "elm,action,title,transition,finished", "*", _on_item_title_transition_finished, it);
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(VIEW(it), "elm,action,title,clicked", "*", _on_item_title_clicked, it);
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2011-10-19 01:49:24 -07:00
|
|
|
_item_style_set(it, item_style);
|
2012-11-21 05:41:03 -08:00
|
|
|
|
|
|
|
if (title_label)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_part_text_set(eo_item, TITLE_PART, title_label);
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2011-07-25 01:48:47 -07:00
|
|
|
//title buttons
|
2014-09-27 22:15:18 -07:00
|
|
|
if ((!prev_btn) && sd->auto_pushed && eo_prev_it)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_prev_it, prev_it);
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
const char *prev_title = prev_it->title_label;
|
2012-07-25 10:38:48 -07:00
|
|
|
prev_btn = _back_btn_new(obj, prev_title);
|
2015-07-05 01:00:06 -07:00
|
|
|
it->auto_pushed_btn = prev_btn;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
if (prev_btn)
|
2013-01-17 01:03:23 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_part_content_set(eo_item, PREV_BTN_PART, prev_btn);
|
2013-01-17 01:03:23 -08:00
|
|
|
if (!elm_layout_text_get(prev_btn, NULL))
|
2014-07-31 05:26:14 -07:00
|
|
|
{
|
|
|
|
if (!_access_info_has(prev_btn, ELM_ACCESS_INFO))
|
|
|
|
{
|
|
|
|
/* set access info */
|
|
|
|
_elm_access_callback_set
|
|
|
|
(_elm_access_info_get(prev_btn), ELM_ACCESS_INFO,
|
|
|
|
_access_prev_btn_info_cb, it);
|
|
|
|
}
|
|
|
|
}
|
2013-01-17 01:03:23 -08:00
|
|
|
}
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
|
|
|
|
if (next_btn)
|
2013-01-17 01:03:23 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_part_content_set(eo_item, NEXT_BTN_PART, next_btn);
|
2013-01-17 01:03:23 -08:00
|
|
|
|
|
|
|
if (!elm_layout_text_get(next_btn, NULL))
|
2014-07-31 05:26:14 -07:00
|
|
|
{
|
|
|
|
if (!_access_info_has(next_btn, ELM_ACCESS_INFO))
|
|
|
|
{
|
|
|
|
/* set access info */
|
|
|
|
_elm_access_text_set
|
|
|
|
(_elm_access_info_get(next_btn), ELM_ACCESS_INFO, E_("Next"));
|
|
|
|
}
|
|
|
|
}
|
2013-01-17 01:03:23 -08:00
|
|
|
}
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
|
2011-08-04 09:37:36 -07:00
|
|
|
_item_content_set(it, content);
|
2013-01-21 21:28:31 -08:00
|
|
|
_item_dispmode_set(it, sd->dispmode);
|
|
|
|
|
2014-01-14 21:29:05 -08:00
|
|
|
it->title_enabled = EINA_TRUE;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
return EO_OBJ(it);
|
2011-11-03 00:15:18 -07:00
|
|
|
}
|
|
|
|
|
2012-10-14 07:48:02 -07:00
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_on_obj_size_hints_changed(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj, void *event_info EINA_UNUSED)
|
2012-10-14 07:48:02 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it;
|
2012-10-14 07:48:02 -07:00
|
|
|
Evas_Display_Mode dispmode;
|
|
|
|
|
|
|
|
ELM_NAVIFRAME_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
dispmode = evas_object_size_hint_display_mode_get(obj);
|
2013-01-21 20:46:28 -08:00
|
|
|
if (sd->dispmode == dispmode) return;
|
|
|
|
|
2012-10-14 07:48:02 -07:00
|
|
|
sd->dispmode = dispmode;
|
|
|
|
|
2013-01-21 21:28:31 -08:00
|
|
|
EINA_INLIST_FOREACH(sd->stack, it)
|
|
|
|
_item_dispmode_set(it, dispmode);
|
2012-10-14 07:48:02 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-09-15 03:41:51 -07:00
|
|
|
_elm_naviframe_elm_widget_focus_next(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, Elm_Focus_Direction dir, Evas_Object **next, Elm_Object_Item **next_item)
|
2012-01-11 03:48:45 -08:00
|
|
|
{
|
2012-11-21 05:41:03 -08:00
|
|
|
Evas_Object *ao;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2012-03-12 02:14:14 -07:00
|
|
|
Eina_List *l = NULL;
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_top_it;
|
2012-03-12 02:14:14 -07:00
|
|
|
void *(*list_data_get)(const Eina_List *list);
|
|
|
|
|
2014-04-03 02:06:39 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
eo_top_it = elm_naviframe_top_item_get(obj);
|
|
|
|
if (!eo_top_it) goto end;
|
2012-03-12 02:14:14 -07:00
|
|
|
|
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_top_it, top_it);
|
2013-03-11 00:38:45 -07:00
|
|
|
l = eina_list_append(l, VIEW(top_it));
|
|
|
|
|
2012-11-21 05:41:03 -08:00
|
|
|
/* access */
|
|
|
|
if (_elm_config->access_mode)
|
2012-07-31 04:12:00 -07:00
|
|
|
{
|
2013-01-11 22:41:21 -08:00
|
|
|
ao = _access_object_get(top_it, TITLE_ACCESS_PART);
|
2012-11-21 05:41:03 -08:00
|
|
|
if (ao) l = eina_list_append(l, ao);
|
2012-07-31 04:12:00 -07:00
|
|
|
}
|
|
|
|
|
2015-09-15 03:41:51 -07:00
|
|
|
int_ret = elm_widget_focus_list_next_get(obj, l, list_data_get, dir, next, next_item);
|
2012-03-12 02:14:14 -07:00
|
|
|
eina_list_free(l);
|
2013-09-29 18:09:23 -07:00
|
|
|
|
|
|
|
end:
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!int_ret)
|
2013-09-29 18:09:23 -07:00
|
|
|
{
|
|
|
|
*next = obj;
|
2014-03-30 01:51:39 -07:00
|
|
|
int_ret = !elm_widget_focus_get(obj);
|
2013-09-29 18:09:23 -07:00
|
|
|
}
|
2014-03-30 01:51:39 -07:00
|
|
|
|
|
|
|
return int_ret;
|
2012-01-11 03:48:45 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd EINA_UNUSED)
|
2013-03-11 01:03:21 -07:00
|
|
|
{
|
2014-03-30 01:51:39 -07:00
|
|
|
return EINA_TRUE;
|
2013-03-11 01:03:21 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-09-24 23:24:53 -07:00
|
|
|
_elm_naviframe_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd EINA_UNUSED, const Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
|
2014-03-30 01:51:39 -07:00
|
|
|
{
|
2013-03-11 01:03:21 -07:00
|
|
|
Eina_Bool int_ret;
|
|
|
|
|
|
|
|
Eina_List *l = NULL;
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_top_it;
|
2013-03-11 01:03:21 -07:00
|
|
|
void *(*list_data_get)(const Eina_List *list);
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
eo_top_it = elm_naviframe_top_item_get(obj);
|
|
|
|
if (!eo_top_it) return EINA_FALSE;
|
2013-03-11 01:03:21 -07:00
|
|
|
|
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_top_it, top_it);
|
2013-03-11 01:03:21 -07:00
|
|
|
l = eina_list_append(l, VIEW(top_it));
|
|
|
|
|
|
|
|
int_ret = elm_widget_focus_list_direction_get
|
2015-09-24 23:24:53 -07:00
|
|
|
(obj, base, l, list_data_get, degree, direction, direction_item, weight);
|
2013-03-11 01:03:21 -07:00
|
|
|
|
|
|
|
eina_list_free(l);
|
2014-03-30 01:51:39 -07:00
|
|
|
|
|
|
|
return int_ret;
|
2013-03-11 01:03:21 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_naviframe_efl_canvas_group_group_add(Eo *obj, Elm_Naviframe_Data *priv)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2013-10-05 01:12:56 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2016-06-17 01:26:08 -07:00
|
|
|
efl_canvas_group_add(eo_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2012-12-12 00:58:03 -08:00
|
|
|
priv->dummy_edje = wd->resize_obj;
|
2013-01-03 03:41:10 -08:00
|
|
|
evas_object_smart_member_add(priv->dummy_edje, obj);
|
|
|
|
|
2015-08-05 22:59:06 -07:00
|
|
|
priv->auto_pushed = _elm_config->naviframe_prev_btn_auto_pushed;
|
2012-06-01 14:56:09 -07:00
|
|
|
priv->freeze_events = EINA_TRUE;
|
|
|
|
|
2012-10-15 16:44:39 -07:00
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_on_obj_size_hints_changed, obj);
|
2013-03-07 04:28:03 -08:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
2015-05-06 05:25:15 -07:00
|
|
|
static void
|
2015-06-08 08:43:19 -07:00
|
|
|
_send_signal(Elm_Naviframe_Item_Data *it, const char *sig)
|
2012-12-03 05:27:57 -08:00
|
|
|
{
|
2015-05-06 05:25:15 -07:00
|
|
|
if (!it) return ;
|
2015-06-08 08:43:19 -07:00
|
|
|
elm_object_signal_emit(VIEW(it), sig, "elm");
|
2015-05-06 05:25:15 -07:00
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
|
|
|
|
}
|
2012-12-03 05:27:57 -08:00
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-02-29 03:32:52 -08:00
|
|
|
_deferred(void *data, const Eo_Event *event EINA_UNUSED)
|
2015-05-06 05:25:15 -07:00
|
|
|
{
|
|
|
|
Elm_Naviframe_Data *nfd = data;
|
|
|
|
Elm_Naviframe_Op *nfo;
|
2012-12-03 05:27:57 -08:00
|
|
|
|
2015-05-06 05:25:15 -07:00
|
|
|
EINA_LIST_FREE(nfd->ops, nfo)
|
2012-12-03 05:27:57 -08:00
|
|
|
{
|
2015-05-06 05:25:15 -07:00
|
|
|
const char *signals_cur[] = {
|
|
|
|
"elm,state,cur,popped,deferred",
|
|
|
|
"elm,state,cur,pushed,deferred"
|
|
|
|
};
|
|
|
|
const char *signals_prev = "elm,state,prev,popped,deferred";
|
|
|
|
const char *signals_new = "elm,state,new,pushed,deferred";
|
|
|
|
Elm_Naviframe_Item_Data *cur;
|
|
|
|
Elm_Naviframe_Item_Data *other;
|
|
|
|
|
|
|
|
cur = nfo->push ? nfo->related : nfo->self;
|
|
|
|
other = nfo->push ? nfo->self : nfo->related;
|
|
|
|
|
|
|
|
_send_signal(cur, signals_cur[nfo->push]);
|
|
|
|
_send_signal(other, nfo->push ? signals_new : signals_prev);
|
|
|
|
|
|
|
|
free(nfo);
|
2012-12-03 05:27:57 -08:00
|
|
|
}
|
|
|
|
|
2016-05-18 01:56:21 -07:00
|
|
|
eo_event_callback_del(nfd->obj, EFL_EVENT_ANIMATOR_TICK, _deferred, nfd);
|
2012-12-03 05:27:57 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_naviframe_efl_canvas_group_group_del(Eo *obj, Elm_Naviframe_Data *sd)
|
2012-06-01 14:56:09 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it;
|
2015-05-06 05:25:15 -07:00
|
|
|
Elm_Naviframe_Op *nfo;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
sd->on_deletion = EINA_TRUE;
|
|
|
|
|
|
|
|
while (sd->stack)
|
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
it = EINA_INLIST_CONTAINER_GET(sd->stack, Elm_Naviframe_Item_Data);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(EO_OBJ(it));
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
2016-01-29 15:47:38 -08:00
|
|
|
// No need to cleanup animator as it is an event on myself
|
2015-05-06 05:25:15 -07:00
|
|
|
EINA_LIST_FREE(sd->ops, nfo)
|
|
|
|
free(nfo);
|
2012-12-08 10:39:24 -08:00
|
|
|
EINA_LIST_FREE(sd->popping, it)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(EO_OBJ(it));
|
2012-12-03 05:27:57 -08:00
|
|
|
|
2013-06-11 02:08:10 -07:00
|
|
|
evas_object_del(sd->dummy_edje);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2016-06-17 01:26:08 -07:00
|
|
|
efl_canvas_group_del(eo_super(obj, MY_CLASS));
|
2012-06-01 14:56:09 -07:00
|
|
|
}
|
|
|
|
|
2014-03-06 18:12:06 -08:00
|
|
|
//Show only the top item view
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_naviframe_efl_canvas_group_group_show(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED)
|
2014-03-06 18:12:06 -08:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_top;
|
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
eo_top = elm_naviframe_top_item_get(obj);
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_top, top);
|
2014-03-06 18:12:06 -08:00
|
|
|
|
|
|
|
if (top && !top->delete_me)
|
|
|
|
evas_object_show(VIEW(top));
|
|
|
|
}
|
|
|
|
|
2014-04-09 19:14:59 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_top_item_get(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_item = NULL;
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_item = elm_obj_naviframe_top_item_get(obj);
|
2014-09-27 22:15:18 -07:00
|
|
|
if (!eo_item) return EINA_FALSE;
|
2014-04-09 19:14:59 -07:00
|
|
|
|
|
|
|
//FIXME: Replace this below code to elm_naviframe_item_pop() at elm 2.0.
|
|
|
|
///Leave for compatibility.
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_item, it);
|
2014-04-09 19:14:59 -07:00
|
|
|
if (it->title_prev_btn)
|
2016-06-10 01:29:40 -07:00
|
|
|
eo_event_callback_call(it->title_prev_btn, EFL_UI_EVENT_CLICKED, NULL);
|
2014-04-09 19:14:59 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_elm_widget_event(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
2013-03-07 04:28:03 -08:00
|
|
|
{
|
2013-10-28 07:06:14 -07:00
|
|
|
(void)src;
|
2014-03-30 01:51:39 -07:00
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
2013-10-28 07:06:14 -07:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
2015-12-21 04:55:23 -08:00
|
|
|
if (!_elm_config_key_binding_call(obj, MY_CLASS_NAME, ev, key_actions)) return EINA_FALSE;
|
2013-03-07 04:28:03 -08:00
|
|
|
|
2013-05-20 04:42:38 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2014-03-30 01:51:39 -07:00
|
|
|
return EINA_TRUE;
|
2013-03-07 04:28:03 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_elm_widget_access(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd, Eina_Bool is_access)
|
2012-11-21 05:41:03 -08:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *it;
|
2012-11-21 05:41:03 -08:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(sd->stack, it)
|
|
|
|
_access_obj_process(it, is_access);
|
|
|
|
}
|
|
|
|
|
2016-01-29 15:47:38 -08:00
|
|
|
static void
|
|
|
|
_schedule_deferred(Elm_Naviframe_Op *nfo, Elm_Naviframe_Data *sd)
|
|
|
|
{
|
|
|
|
if (!sd->ops)
|
2016-05-18 01:56:21 -07:00
|
|
|
eo_event_callback_add(sd->obj, EFL_EVENT_ANIMATOR_TICK, _deferred, sd);
|
2016-01-29 15:47:38 -08:00
|
|
|
|
|
|
|
sd->ops = eina_list_append(sd->ops, nfo);
|
|
|
|
}
|
|
|
|
|
2014-03-12 03:13:26 -07:00
|
|
|
static void
|
2014-09-27 22:15:18 -07:00
|
|
|
_item_push_helper(Elm_Naviframe_Item_Data *item)
|
2014-03-12 03:13:26 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_top_item;
|
2014-03-12 03:13:26 -07:00
|
|
|
Evas_Object *obj = WIDGET(item);
|
|
|
|
ELM_NAVIFRAME_DATA_GET(obj, sd);
|
2014-09-27 22:15:18 -07:00
|
|
|
eo_top_item = elm_naviframe_top_item_get(obj);
|
2014-03-12 03:13:26 -07:00
|
|
|
evas_object_show(VIEW(item));
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_top_item, top_item);
|
2014-03-12 03:13:26 -07:00
|
|
|
if (top_item) elm_widget_focused_object_clear(VIEW(top_item));
|
|
|
|
_resize_object_reset(obj, item);
|
|
|
|
if (top_item)
|
|
|
|
{
|
2015-05-06 05:25:15 -07:00
|
|
|
Elm_Naviframe_Op *nfo = calloc(1, sizeof (Elm_Naviframe_Op));
|
|
|
|
|
2014-03-13 18:32:23 -07:00
|
|
|
elm_widget_tree_unfocusable_set(VIEW(item), EINA_FALSE);
|
|
|
|
elm_widget_tree_unfocusable_set(VIEW(top_item), EINA_TRUE);
|
|
|
|
|
2014-03-12 03:13:26 -07:00
|
|
|
if (sd->freeze_events)
|
|
|
|
{
|
|
|
|
evas_object_freeze_events_set(VIEW(item), EINA_TRUE);
|
|
|
|
evas_object_freeze_events_set(VIEW(top_item), EINA_TRUE);
|
|
|
|
}
|
|
|
|
elm_object_signal_emit(VIEW(top_item), "elm,state,cur,pushed", "elm");
|
|
|
|
elm_object_signal_emit(VIEW(item), "elm,state,new,pushed", "elm");
|
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(VIEW(top_item)));
|
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(VIEW(item)));
|
|
|
|
|
2015-05-06 05:25:15 -07:00
|
|
|
nfo->self = item;
|
|
|
|
nfo->related = top_item;
|
|
|
|
nfo->push = EINA_TRUE;
|
|
|
|
|
2016-01-29 15:47:38 -08:00
|
|
|
_schedule_deferred(nfo, sd);
|
2015-08-28 02:28:19 -07:00
|
|
|
item->pushing = EINA_TRUE;
|
2014-03-12 03:13:26 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (elm_object_focus_allow_get(VIEW(item)))
|
|
|
|
elm_object_focus_set(VIEW(item), EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_focus_set(WIDGET(item), EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
sd->stack = eina_inlist_append(sd->stack, EINA_INLIST_GET(item));
|
|
|
|
|
|
|
|
if (!top_item)
|
|
|
|
elm_object_signal_emit(VIEW(item), "elm,state,visible", "elm");
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2011-11-03 00:15:18 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_naviframe_add(Evas_Object *parent)
|
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2016-03-11 04:34:16 -08:00
|
|
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
return obj;
|
|
|
|
}
|
2011-11-03 00:15:18 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-01-29 15:47:38 -08:00
|
|
|
_elm_naviframe_eo_base_constructor(Eo *obj, Elm_Naviframe_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-03-02 04:10:48 -08:00
|
|
|
obj = eo_constructor(eo_super(obj, MY_CLASS));
|
2016-01-29 15:47:38 -08:00
|
|
|
sd->obj = obj;
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_PAGE_TAB_LIST);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2011-11-03 00:15:18 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_item_push(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style)
|
2011-11-03 00:15:18 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *top_item, *eo_item;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
top_item = elm_naviframe_top_item_get(obj);
|
|
|
|
eo_item = _item_new(obj, top_item,
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
title_label, prev_btn, next_btn, content, item_style);
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_item, item);
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!item) return NULL;
|
2014-03-12 03:13:26 -07:00
|
|
|
_item_push_helper(item);
|
2014-09-27 22:15:18 -07:00
|
|
|
return eo_item;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:18 -07:00
|
|
|
_elm_naviframe_item_insert_before(Eo *obj, Elm_Naviframe_Data *sd, Elm_Object_Item *eo_before, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style)
|
2011-11-03 00:15:18 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_it;
|
|
|
|
Elm_Naviframe_Item_Data *prev_it = NULL;
|
2015-04-20 22:30:41 -07:00
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_before, NULL);
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_before, before);
|
2011-11-03 00:15:18 -07:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(before, NULL);
|
2011-11-03 00:15:18 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
eo_it = eo_before;
|
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_it, it);
|
2012-10-15 09:26:11 -07:00
|
|
|
if (EINA_INLIST_GET(it)->prev)
|
|
|
|
prev_it = EINA_INLIST_CONTAINER_GET(EINA_INLIST_GET(it)->prev,
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data);
|
|
|
|
eo_it = _item_new(obj, EO_OBJ(prev_it),
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
title_label, prev_btn, next_btn, content, item_style);
|
2014-09-27 22:15:18 -07:00
|
|
|
if (!eo_it) return NULL;
|
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
it = eo_data_scope_get(eo_it, ELM_NAVIFRAME_ITEM_CLASS);
|
2011-11-03 00:15:18 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
sd->stack = eina_inlist_prepend_relative
|
|
|
|
(sd->stack, EINA_INLIST_GET(it),
|
2014-09-27 22:15:18 -07:00
|
|
|
EINA_INLIST_GET(before));
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2014-02-17 04:03:01 -08:00
|
|
|
elm_widget_tree_unfocusable_set(VIEW(it), EINA_TRUE);
|
2014-09-23 02:46:26 -07:00
|
|
|
evas_object_hide(VIEW(it));
|
2014-04-23 22:22:26 -07:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,invisible", "elm");
|
2014-02-17 04:03:01 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
return eo_it;
|
2011-11-03 00:15:18 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-09-27 22:15:18 -07:00
|
|
|
_elm_naviframe_item_insert_after(Eo *obj, Elm_Naviframe_Data *sd, Elm_Object_Item *eo_after, const char *title_label, Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style)
|
2011-11-03 00:15:18 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
2012-09-10 18:48:00 -07:00
|
|
|
Eina_Bool top_inserted = EINA_FALSE;
|
2011-11-03 00:15:18 -07:00
|
|
|
|
2015-04-20 22:30:41 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_after, NULL);
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_after, after);
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(after, NULL);
|
2011-11-03 00:15:18 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
eo_item = _item_new(obj, eo_after,
|
naviframe improvements:
- fixed theme to look less like an arse:
- overlap theme is translucent
- naviframe title visibility toggle is now animated
- item pop/push animation now applies to title area as well
- icon without title label is now centered (see Naviframe 2 test)
- title label and subtitle are now centered among the free space, should not overlap buttons anymore.
- title will use a font-size range, trying to not overlap buttons anymore.
- title will use ellipsis, trying to not overlap buttons anymore.
- prev/next buttons do not have a fixed min/max size anymore
- emit signals elm,state,title_label,show and elm,state,title_label,hide
- by default the previous button label is the title of the previous page
however by using a regular elm_button with an icon and long label
exposes a bug with button theme. And there is a conceptual issue: if
the previous button label is too big, it will look horrible. We should
have a maximum size that, if reached, should have ellipsis. This
should be a different elm_button style, with
elm/button/base/naviframe/back_btn/default being an alias to it.
SVN revision: 74403
2012-07-25 14:08:53 -07:00
|
|
|
title_label, prev_btn, next_btn, content, item_style);
|
2014-09-27 22:15:18 -07:00
|
|
|
if (!eo_item) return NULL;
|
2011-11-03 00:15:18 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_item, it);
|
|
|
|
|
|
|
|
if (elm_naviframe_top_item_get(obj) == eo_after) top_inserted = EINA_TRUE;
|
2012-03-26 23:06:50 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
sd->stack = eina_inlist_append_relative
|
|
|
|
(sd->stack, EINA_INLIST_GET(it),
|
2014-08-19 00:52:24 -07:00
|
|
|
EINA_INLIST_GET(after));
|
2014-09-27 22:15:18 -07:00
|
|
|
|
2012-03-26 23:06:50 -07:00
|
|
|
|
2012-09-10 18:48:00 -07:00
|
|
|
if (top_inserted)
|
|
|
|
{
|
2013-05-02 03:55:22 -07:00
|
|
|
elm_widget_focused_object_clear(VIEW(after));
|
2014-02-17 04:03:01 -08:00
|
|
|
elm_widget_tree_unfocusable_set(VIEW(after), EINA_TRUE);
|
2013-10-18 03:53:16 -07:00
|
|
|
_resize_object_reset(obj, it);
|
2014-01-24 09:35:37 -08:00
|
|
|
evas_object_show(VIEW(it));
|
|
|
|
evas_object_hide(VIEW(after));
|
2013-09-29 18:09:23 -07:00
|
|
|
if (elm_object_focus_allow_get(VIEW(it)))
|
|
|
|
elm_object_focus_set(VIEW(it), EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_object_focus_set(WIDGET(it), EINA_TRUE);
|
2014-04-23 22:22:26 -07:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,visible", "elm");
|
|
|
|
elm_object_signal_emit(VIEW(after), "elm,state,invisible", "elm");
|
2012-09-10 18:48:00 -07:00
|
|
|
}
|
2014-02-07 06:21:31 -08:00
|
|
|
else
|
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,invisible", "elm");
|
2012-09-10 18:48:00 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-03-26 23:06:50 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
return eo_item;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_item_pop(Eo *obj, Elm_Naviframe_Data *sd)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Object_Item *eo_item;
|
|
|
|
Elm_Naviframe_Item_Data *prev_it = NULL;
|
2011-07-12 21:21:50 -07:00
|
|
|
Evas_Object *content = NULL;
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
eo_item = elm_naviframe_top_item_get(obj);
|
|
|
|
if (!eo_item) return NULL;
|
|
|
|
|
|
|
|
ELM_NAVIFRAME_ITEM_DATA_GET(eo_item, it);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2015-08-28 02:28:19 -07:00
|
|
|
if (it->pushing || it->popping) return NULL;
|
2013-04-17 06:08:41 -07:00
|
|
|
it->popping = EINA_TRUE;
|
|
|
|
|
2014-01-22 05:13:51 -08:00
|
|
|
evas_object_ref(obj);
|
2013-03-22 03:04:12 -07:00
|
|
|
if (it->pop_cb)
|
|
|
|
{
|
2014-09-17 06:44:05 -07:00
|
|
|
eo_ref(eo_item);
|
2014-09-27 22:15:18 -07:00
|
|
|
if (!it->pop_cb(it->pop_data, eo_item))
|
2013-04-17 06:08:41 -07:00
|
|
|
{
|
2014-09-17 06:44:05 -07:00
|
|
|
eo_unref(eo_item);
|
2014-01-22 05:13:51 -08:00
|
|
|
if (it->delete_me)
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(eo_item);
|
2014-01-22 18:59:07 -08:00
|
|
|
else
|
2015-07-05 01:00:06 -07:00
|
|
|
{
|
|
|
|
/* To avoid multiple item pops, the auto pushed button deletes
|
|
|
|
its clicked callback once it is called.
|
|
|
|
Since the item is not popped or deleted here, the deleted
|
|
|
|
callback of the auto pushed button should be restored. */
|
|
|
|
if (it->auto_pushed_btn)
|
2016-03-02 04:10:48 -08:00
|
|
|
eo_event_callback_add
|
2016-06-10 01:29:40 -07:00
|
|
|
(it->auto_pushed_btn, EFL_UI_EVENT_CLICKED, _on_item_back_btn_clicked, obj);
|
2015-07-05 01:00:06 -07:00
|
|
|
it->popping = EINA_FALSE;
|
|
|
|
}
|
2014-01-22 05:13:51 -08:00
|
|
|
evas_object_unref(obj);
|
2014-03-30 01:51:39 -07:00
|
|
|
return NULL;
|
2013-04-17 06:08:41 -07:00
|
|
|
}
|
2014-09-17 06:44:05 -07:00
|
|
|
eo_unref(eo_item);
|
2013-03-22 03:04:12 -07:00
|
|
|
}
|
2014-01-22 05:13:51 -08:00
|
|
|
evas_object_unref(obj);
|
2013-03-07 04:28:03 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (sd->preserve)
|
2011-07-12 21:21:50 -07:00
|
|
|
content = it->content;
|
2012-03-26 22:48:41 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
evas_object_data_set(VIEW(it), "out_of_list", (void *)1);
|
|
|
|
|
|
|
|
if (sd->stack->last->prev)
|
|
|
|
prev_it = EINA_INLIST_CONTAINER_GET
|
2014-09-27 22:15:18 -07:00
|
|
|
(sd->stack->last->prev, Elm_Naviframe_Item_Data);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
sd->stack = eina_inlist_remove(sd->stack, EINA_INLIST_GET(it));
|
|
|
|
|
2011-07-12 21:21:50 -07:00
|
|
|
if (prev_it)
|
|
|
|
{
|
2015-05-06 05:25:15 -07:00
|
|
|
Elm_Naviframe_Op *nfo = calloc(1, sizeof (Elm_Naviframe_Op));
|
|
|
|
|
2014-02-17 04:03:01 -08:00
|
|
|
elm_widget_tree_unfocusable_set(VIEW(it), EINA_TRUE);
|
2014-06-22 23:27:14 -07:00
|
|
|
elm_widget_tree_unfocusable_set(VIEW(prev_it), EINA_FALSE);
|
2014-02-17 04:03:01 -08:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
if (sd->freeze_events)
|
2011-10-28 01:31:42 -07:00
|
|
|
{
|
|
|
|
evas_object_freeze_events_set(VIEW(it), EINA_TRUE);
|
|
|
|
evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE);
|
|
|
|
}
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2013-10-18 03:53:16 -07:00
|
|
|
_resize_object_reset(obj, prev_it);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
/* these 2 signals MUST take place simultaneously */
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(it), "elm,state,cur,popped", "elm");
|
2014-01-24 09:35:37 -08:00
|
|
|
evas_object_show(VIEW(prev_it));
|
2013-01-03 03:26:57 -08:00
|
|
|
elm_object_signal_emit(VIEW(prev_it), "elm,state,prev,popped", "elm");
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2013-01-03 03:26:57 -08:00
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(VIEW(it)));
|
|
|
|
edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it)));
|
2012-09-20 22:28:55 -07:00
|
|
|
|
2015-05-06 05:25:15 -07:00
|
|
|
if (!nfo) goto on_error;
|
|
|
|
|
|
|
|
nfo->self = it;
|
|
|
|
nfo->related = prev_it;
|
|
|
|
nfo->push = EINA_FALSE;
|
|
|
|
|
2012-12-03 05:27:57 -08:00
|
|
|
sd->popping = eina_list_append(sd->popping, it);
|
2016-01-29 15:47:38 -08:00
|
|
|
|
|
|
|
_schedule_deferred(nfo, sd);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
else
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(eo_item);
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2015-05-06 05:25:15 -07:00
|
|
|
on_error:
|
2014-03-30 01:51:39 -07:00
|
|
|
return content;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_pop_to(Eo *eo_it, Elm_Naviframe_Item_Data *it)
|
|
|
|
{
|
|
|
|
Eina_Inlist *l;
|
2011-10-28 01:31:42 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd);
|
2011-09-18 22:23:35 -07:00
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
if (eo_it == elm_naviframe_top_item_get(WIDGET(it))) return;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
l = sd->stack->last->prev;
|
|
|
|
|
|
|
|
sd->on_deletion = EINA_TRUE;
|
2011-09-18 22:23:35 -07:00
|
|
|
|
2012-03-29 04:09:45 -07:00
|
|
|
while (l)
|
2011-09-18 22:23:35 -07:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *iit = EINA_INLIST_CONTAINER_GET
|
|
|
|
(l, Elm_Naviframe_Item_Data);
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
if (iit == it) break;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2014-02-17 04:09:53 -08:00
|
|
|
l = l->prev;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_wdg_item_del(EO_OBJ(iit));
|
2011-09-18 22:23:35 -07:00
|
|
|
}
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
sd->on_deletion = EINA_FALSE;
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
elm_naviframe_item_pop(WIDGET(it));
|
2011-09-18 22:23:35 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_promote(Eo *eo_it, Elm_Naviframe_Item_Data *it)
|
|
|
|
{
|
|
|
|
Elm_Object_Item *eo_prev_top;
|
|
|
|
Elm_Naviframe_Item_Data *nit = it;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
|
|
|
ELM_NAVIFRAME_DATA_GET(WIDGET(nit), sd);
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
eo_prev_top = elm_naviframe_top_item_get(WIDGET(nit));
|
2014-08-19 00:52:24 -07:00
|
|
|
if (eo_it == eo_prev_top) return;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2014-03-12 03:13:26 -07:00
|
|
|
sd->stack = eina_inlist_remove(sd->stack, EINA_INLIST_GET(nit));
|
|
|
|
_item_push_helper(nit);
|
2011-10-23 23:35:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_item_simple_promote(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd, Evas_Object *content)
|
2012-02-16 01:26:30 -08:00
|
|
|
{
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *itr;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->stack, itr)
|
2012-02-16 01:26:30 -08:00
|
|
|
{
|
2014-08-19 00:52:24 -07:00
|
|
|
if (elm_object_item_content_get(EO_OBJ(itr)) == content)
|
2012-02-16 01:26:30 -08:00
|
|
|
{
|
2014-08-19 00:52:24 -07:00
|
|
|
elm_naviframe_item_promote(EO_OBJ(itr));
|
2012-02-16 01:26:30 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_content_preserve_on_pop_set(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd, Eina_Bool preserve)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
sd->preserve = !!preserve;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_content_preserve_on_pop_get(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 01:51:39 -07:00
|
|
|
return sd->preserve;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_top_item_get(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!sd->stack) return NULL;
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *ret_it = EINA_INLIST_CONTAINER_GET
|
|
|
|
(sd->stack->last, Elm_Naviframe_Item_Data);
|
|
|
|
return EO_OBJ(ret_it);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_bottom_item_get(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd)
|
2011-07-12 21:21:50 -07:00
|
|
|
{
|
2014-03-30 01:51:39 -07:00
|
|
|
if (!sd->stack) return NULL;
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *ret_it = EINA_INLIST_CONTAINER_GET
|
|
|
|
(sd->stack, Elm_Naviframe_Item_Data);
|
|
|
|
return EO_OBJ(ret_it);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_style_set(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *nit,
|
|
|
|
const char *item_style)
|
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
if (item_style && !strcmp(item_style, nit->style)) return;
|
2011-10-03 23:50:18 -07:00
|
|
|
|
2012-03-07 08:15:17 -08:00
|
|
|
if (!item_style)
|
2012-06-01 14:56:09 -07:00
|
|
|
if (!strcmp("basic", nit->style)) return;
|
2011-10-03 23:50:18 -07:00
|
|
|
|
2012-06-01 14:56:09 -07:00
|
|
|
_item_style_set(nit, item_style);
|
2012-12-04 20:01:55 -08:00
|
|
|
_item_signals_emit(nit);
|
2014-01-14 21:29:05 -08:00
|
|
|
_item_title_enabled_update(nit, EINA_FALSE);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static const char *
|
|
|
|
_elm_naviframe_item_style_get(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *nit)
|
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
return nit->style;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-01-14 21:29:05 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-06-01 14:56:09 -07:00
|
|
|
elm_naviframe_item_title_visible_set(Elm_Object_Item *it,
|
|
|
|
Eina_Bool visible)
|
2014-01-14 21:29:05 -08:00
|
|
|
{
|
|
|
|
elm_naviframe_item_title_enabled_set(it, visible, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_DEPRECATED EAPI Eina_Bool
|
|
|
|
elm_naviframe_item_title_visible_get(const Elm_Object_Item *it)
|
|
|
|
{
|
|
|
|
return elm_naviframe_item_title_enabled_get(it);
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_title_enabled_set(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *nit,
|
|
|
|
Eina_Bool enabled,
|
|
|
|
Eina_Bool transition)
|
|
|
|
{
|
2014-01-14 21:29:05 -08:00
|
|
|
enabled = !!enabled;
|
|
|
|
if (nit->title_enabled == enabled) return;
|
|
|
|
|
|
|
|
nit->title_enabled = enabled;
|
2011-07-12 21:21:50 -07:00
|
|
|
|
2014-01-14 21:29:05 -08:00
|
|
|
transition = !!transition;
|
|
|
|
_item_title_enabled_update(nit, transition);
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_naviframe_item_title_enabled_get(const Eo *eo_item EINA_UNUSED, Elm_Naviframe_Item_Data *nit)
|
2014-09-27 22:15:18 -07:00
|
|
|
{
|
2014-01-14 21:29:05 -08:00
|
|
|
return nit->title_enabled;
|
2011-07-12 21:21:50 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_naviframe_item_pop_cb_set(Eo *eo_item EINA_UNUSED,
|
|
|
|
Elm_Naviframe_Item_Data *nit,
|
|
|
|
Elm_Naviframe_Item_Pop_Cb func,
|
|
|
|
void *data)
|
|
|
|
{
|
2013-03-07 04:28:03 -08:00
|
|
|
nit->pop_cb = func;
|
|
|
|
nit->pop_data = data;
|
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_prev_btn_auto_pushed_set(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd, Eina_Bool auto_pushed)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-06-01 14:56:09 -07:00
|
|
|
sd->auto_pushed = !!auto_pushed;
|
2011-10-12 03:31:13 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_prev_btn_auto_pushed_get(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 01:51:39 -07:00
|
|
|
return sd->auto_pushed;
|
2011-10-12 03:31:13 -07:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_List*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_items_get(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd)
|
2011-11-03 00:15:18 -07:00
|
|
|
{
|
2014-03-30 01:51:39 -07:00
|
|
|
Eina_List *ret = NULL;
|
2014-09-27 22:15:18 -07:00
|
|
|
Elm_Naviframe_Item_Data *itr;
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_INLIST_FOREACH(sd->stack, itr)
|
2014-09-27 22:15:18 -07:00
|
|
|
ret = eina_list_append(ret, EO_OBJ(itr));
|
2011-11-03 00:15:18 -07:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
return ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_event_enabled_set(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd, Eina_Bool enabled)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2011-12-11 20:54:15 -08:00
|
|
|
enabled = !!enabled;
|
2012-06-01 14:56:09 -07:00
|
|
|
if (sd->freeze_events == !enabled) return;
|
|
|
|
sd->freeze_events = !enabled;
|
2011-12-11 20:54:15 -08:00
|
|
|
}
|
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_event_enabled_get(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd)
|
2011-12-11 20:54:15 -08:00
|
|
|
{
|
2014-03-30 01:51:39 -07:00
|
|
|
return !sd->freeze_events;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-06-01 14:56:09 -07:00
|
|
|
|
2014-03-30 01:51:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *sd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-30 01:51:39 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_naviframe_class_constructor(Eo_Class *klass)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-07-25 01:33:19 -07:00
|
|
|
EOLIAN const Elm_Atspi_Action *
|
2014-07-11 02:11:31 -07:00
|
|
|
_elm_naviframe_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Naviframe_Data *pd EINA_UNUSED)
|
|
|
|
{
|
2014-07-25 01:33:19 -07:00
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
|
|
|
{ "top_item_get", "top_item_get", NULL, _key_action_top_item_get },
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
2014-07-11 02:11:31 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
/* Efl.Part begin */
|
|
|
|
|
|
|
|
ELM_PART_OVERRIDE(elm_naviframe, ELM_NAVIFRAME, ELM_LAYOUT, Elm_Naviframe_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET(elm_naviframe, ELM_NAVIFRAME, ELM_LAYOUT, Elm_Naviframe_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_GET(elm_naviframe, ELM_NAVIFRAME, ELM_LAYOUT, Elm_Naviframe_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_UNSET(elm_naviframe, ELM_NAVIFRAME, ELM_LAYOUT, Elm_Naviframe_Data, Elm_Part_Data)
|
|
|
|
#include "elm_naviframe_internal_part.eo.c"
|
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2014-09-27 22:15:18 -07:00
|
|
|
#include "elm_naviframe_item.eo.c"
|
2014-08-11 07:46:11 -07:00
|
|
|
#include "elm_naviframe.eo.c"
|