forked from enlightenment/efl
[naviframe] Replace naviframe title visible APIs to naviframe title enabled APIs
Summary: To support naviframe title transition effect, naviframe title enabled APIs are applied. To remove the duplicate functionalities, naviframe title visible APIs are deprecated. Reviewers: Hermet Reviewed By: Hermet CC: seoz, raster Differential Revision: https://phab.enlightenment.org/D426
This commit is contained in:
parent
788118afeb
commit
afef2271fd
|
@ -463,6 +463,14 @@ group { name: "elm/naviframe/item/basic/default";
|
|||
program {
|
||||
signal: "elm,state,title,show"; source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "top";
|
||||
target: "shadow";
|
||||
target: "elm.swallow.content";
|
||||
target: "buttons_clip";
|
||||
}
|
||||
program {
|
||||
signal: "elm,action,title,show"; source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: DECELERATE 0.5;
|
||||
target: "top";
|
||||
target: "shadow";
|
||||
|
@ -472,11 +480,20 @@ group { name: "elm/naviframe/item/basic/default";
|
|||
program { name: "titleshow2";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "buttons_clip";
|
||||
after: "title_transition_finished";
|
||||
}
|
||||
program {
|
||||
signal: "elm,state,title,hide"; source: "elm";
|
||||
action: STATE_SET "title-hidden" 0.0;
|
||||
target: "buttons_clip";
|
||||
target: "top";
|
||||
target: "shadow";
|
||||
target: "elm.swallow.content";
|
||||
}
|
||||
program {
|
||||
signal: "elm,action,title,hide"; source: "elm";
|
||||
action: STATE_SET "title-hidden" 0.0;
|
||||
target: "buttons_clip";
|
||||
after: "titlehide2";
|
||||
}
|
||||
program { name: "titlehide2";
|
||||
|
@ -485,6 +502,10 @@ group { name: "elm/naviframe/item/basic/default";
|
|||
target: "top";
|
||||
target: "shadow";
|
||||
target: "elm.swallow.content";
|
||||
after: "title_transition_finished";
|
||||
}
|
||||
program { name: "title_transition_finished";
|
||||
action: SIGNAL_EMIT "elm,action,title,transition,finished" "elm";
|
||||
}
|
||||
program {
|
||||
signal: "elm,state,prev_btn,show"; source: "elm";
|
||||
|
|
|
@ -47,8 +47,9 @@ _title_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
|
|||
void
|
||||
_title_visible(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
elm_naviframe_item_title_visible_set(data,
|
||||
!elm_naviframe_item_title_visible_get(data));
|
||||
elm_naviframe_item_title_enabled_set(data,
|
||||
!elm_naviframe_item_title_enabled_get(data),
|
||||
EINA_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -159,7 +160,7 @@ _page4(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|||
elm_image_file_set(ic, buf, NULL);
|
||||
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
||||
elm_object_item_part_content_set(it, "icon", ic);
|
||||
elm_naviframe_item_title_visible_set(it, EINA_FALSE);
|
||||
elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_FALSE);
|
||||
evas_object_smart_callback_add(content, "clicked", _title_visible, it);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,8 +127,9 @@ _navi_it_del(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNU
|
|||
static void
|
||||
_title_visible(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
elm_naviframe_item_title_visible_set(data,
|
||||
!elm_naviframe_item_title_visible_get(data));
|
||||
elm_naviframe_item_title_enabled_set(data,
|
||||
!elm_naviframe_item_title_enabled_get(data),
|
||||
EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -242,7 +243,7 @@ _page4(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|||
elm_image_file_set(ic, buf, NULL);
|
||||
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
||||
elm_object_item_part_content_set(it, "icon", ic);
|
||||
elm_naviframe_item_title_visible_set(it, EINA_FALSE);
|
||||
elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_FALSE);
|
||||
evas_object_smart_callback_add(content, "clicked", _title_visible, it);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,12 @@ static const char SUBTITLE_PART[] = "elm.text.subtitle";
|
|||
static const char TITLE_ACCESS_PART[] = "access.title";
|
||||
|
||||
static const char SIG_TRANSITION_FINISHED[] = "transition,finished";
|
||||
static const char SIG_TITLE_TRANSITION_FINISHED[] = "title,transition,finished";
|
||||
static const char SIG_TITLE_CLICKED[] = "title,clicked";
|
||||
|
||||
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||
{SIG_TRANSITION_FINISHED, ""},
|
||||
{SIG_TITLE_TRANSITION_FINISHED, ""},
|
||||
{SIG_TITLE_CLICKED, ""},
|
||||
{"focused", ""}, /**< handled by elm_widget */
|
||||
{"unfocused", ""}, /**< handled by elm_widget */
|
||||
|
@ -300,13 +302,35 @@ _item_style_set(Elm_Naviframe_Item *it,
|
|||
}
|
||||
|
||||
static void
|
||||
_item_title_visible_update(Elm_Naviframe_Item *nit)
|
||||
_on_item_title_transition_finished(void *data,
|
||||
Evas_Object *obj __UNUSED__,
|
||||
const char *emission __UNUSED__,
|
||||
const char *source __UNUSED__)
|
||||
{
|
||||
if (nit->title_visible)
|
||||
Elm_Naviframe_Item *it = data;
|
||||
|
||||
evas_object_smart_callback_call(WIDGET(it), SIG_TITLE_TRANSITION_FINISHED, data);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_title_enabled_update(Elm_Naviframe_Item *nit, Eina_Bool transition)
|
||||
{
|
||||
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");
|
||||
}
|
||||
else
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_naviframe_smart_theme(Eo *obj, void *_pd, va_list *list)
|
||||
|
@ -324,7 +348,7 @@ _elm_naviframe_smart_theme(Eo *obj, void *_pd, va_list *list)
|
|||
if ((style && sstyle) && strcmp(style, sstyle))
|
||||
_item_style_set(it, it->style);
|
||||
_item_signals_emit(it);
|
||||
_item_title_visible_update(it);
|
||||
_item_title_enabled_update(it, EINA_FALSE);
|
||||
}
|
||||
|
||||
elm_layout_sizing_eval(obj);
|
||||
|
@ -341,7 +365,7 @@ _access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
|||
char *ret;
|
||||
|
||||
nit = data;
|
||||
if (!nit->title_visible) return NULL;
|
||||
if (!nit->title_enabled) return NULL;
|
||||
|
||||
layout = VIEW(nit);
|
||||
info = elm_object_part_text_get(layout, TITLE_PART);
|
||||
|
@ -1175,6 +1199,8 @@ _item_new(Evas_Object *obj,
|
|||
(VIEW(it), "elm,action,pushed,finished", "*", _on_item_push_finished, it);
|
||||
elm_object_signal_callback_add
|
||||
(VIEW(it), "elm,action,popped,finished", "*", _on_item_pop_finished, it);
|
||||
elm_object_signal_callback_add
|
||||
(VIEW(it), "elm,action,title,transition,finished", "*", _on_item_title_transition_finished, it);
|
||||
elm_object_signal_callback_add
|
||||
(VIEW(it), "elm,action,title,clicked", "*", _on_item_title_clicked, it);
|
||||
|
||||
|
@ -1212,7 +1238,7 @@ _item_new(Evas_Object *obj,
|
|||
_item_content_set(it, content);
|
||||
_item_dispmode_set(it, sd->dispmode);
|
||||
|
||||
it->title_visible = EINA_TRUE;
|
||||
it->title_enabled = EINA_TRUE;
|
||||
|
||||
return it;
|
||||
}
|
||||
|
@ -1921,7 +1947,7 @@ elm_naviframe_item_style_set(Elm_Object_Item *it,
|
|||
|
||||
_item_style_set(nit, item_style);
|
||||
_item_signals_emit(nit);
|
||||
_item_title_visible_update(nit);
|
||||
_item_title_enabled_update(nit, EINA_FALSE);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
|
@ -1934,29 +1960,45 @@ elm_naviframe_item_style_get(const Elm_Object_Item *it)
|
|||
return nit->style;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EINA_DEPRECATED EAPI void
|
||||
elm_naviframe_item_title_visible_set(Elm_Object_Item *it,
|
||||
Eina_Bool visible)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_naviframe_item_title_enabled_set(Elm_Object_Item *it,
|
||||
Eina_Bool enabled,
|
||||
Eina_Bool transition)
|
||||
{
|
||||
Elm_Naviframe_Item *nit = (Elm_Naviframe_Item *)it;
|
||||
|
||||
ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(it);
|
||||
|
||||
visible = !!visible;
|
||||
if (nit->title_visible == visible) return;
|
||||
enabled = !!enabled;
|
||||
if (nit->title_enabled == enabled) return;
|
||||
|
||||
nit->title_visible = visible;
|
||||
_item_title_visible_update(nit);
|
||||
nit->title_enabled = enabled;
|
||||
|
||||
transition = !!transition;
|
||||
_item_title_enabled_update(nit, transition);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_naviframe_item_title_visible_get(const Elm_Object_Item *it)
|
||||
elm_naviframe_item_title_enabled_get(const Elm_Object_Item *it)
|
||||
{
|
||||
Elm_Naviframe_Item *nit = (Elm_Naviframe_Item *)it;
|
||||
|
||||
ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
|
||||
return nit->title_visible;
|
||||
return nit->title_enabled;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -59,6 +59,9 @@
|
|||
* @ref Layout:
|
||||
* @li @c "transition,finished" - When the transition is finished in
|
||||
* changing the item
|
||||
* @li @c "title,transition,finished" - When the title area's transition
|
||||
* is finished in changing the state
|
||||
* of the title
|
||||
* @li @c "title,clicked" - User clicked title area
|
||||
* @li @c "focused" - When the naviframe has received focus. (since 1.8)
|
||||
* @li @c "unfocused" - When the naviframe has lost focus. (since 1.8)
|
||||
|
|
|
@ -73,31 +73,35 @@ EAPI void elm_naviframe_item_style_set(Elm_Object_Item *it, const ch
|
|||
EAPI const char *elm_naviframe_item_style_get(const Elm_Object_Item *it);
|
||||
|
||||
/**
|
||||
* @brief Show/Hide the title area
|
||||
* @brief Enable/Disable the title area with transition effect
|
||||
*
|
||||
* @param it The naviframe item
|
||||
* @param visible If @c EINA_TRUE, title area will be visible, hidden
|
||||
* @param enabled If @c EINA_TRUE, title area will be enabled, disabled
|
||||
* otherwise
|
||||
* @param transition If @c EINA_TRUE, transition effect of the title will be
|
||||
* visible, invisible otherwise
|
||||
*
|
||||
* When the title area is invisible, then the controls would be hidden so as * to expand the content area to full-size.
|
||||
*
|
||||
* @see also elm_naviframe_item_title_visible_get()
|
||||
*
|
||||
* @ingroup Naviframe
|
||||
*/
|
||||
EAPI void elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible);
|
||||
|
||||
/**
|
||||
* @brief Get a value whether title area is visible or not.
|
||||
*
|
||||
* @param it The naviframe item
|
||||
* @return If @c EINA_TRUE, title area is visible
|
||||
* When the title area is disabled, then the controls would be hidden so as
|
||||
* to expand the content area to full-size.
|
||||
*
|
||||
* @see also elm_naviframe_item_title_enabled_get()
|
||||
* @see also elm_naviframe_item_title_visible_set()
|
||||
*
|
||||
* @ingroup Naviframe
|
||||
*/
|
||||
EAPI Eina_Bool elm_naviframe_item_title_visible_get(const Elm_Object_Item *it);
|
||||
EAPI void elm_naviframe_item_title_enabled_set(Elm_Object_Item *it, Eina_Bool enabled, Eina_Bool transition);
|
||||
|
||||
/**
|
||||
* @brief Get a value whether title area is enabled or not.
|
||||
*
|
||||
* @param it The naviframe item
|
||||
* @return If @c EINA_TRUE, title area is enabled
|
||||
*
|
||||
* @see also elm_naviframe_item_title_enabled_set()
|
||||
*
|
||||
* @ingroup Naviframe
|
||||
*/
|
||||
EAPI Eina_Bool elm_naviframe_item_title_enabled_get(const Elm_Object_Item *it);
|
||||
|
||||
/**
|
||||
* @brief Set a function to be called when @c it of the naviframe is going to be
|
||||
|
@ -126,6 +130,6 @@ elm_naviframe_item_simple_push(Evas_Object *obj, Evas_Object *content)
|
|||
{
|
||||
Elm_Object_Item *it;
|
||||
it = elm_naviframe_item_push(obj, NULL, NULL, NULL, content, NULL);
|
||||
elm_naviframe_item_title_visible_set(it, EINA_FALSE);
|
||||
elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_FALSE);
|
||||
return it;
|
||||
}
|
||||
|
|
|
@ -533,6 +533,39 @@ EINA_DEPRECATED EAPI void elm_object_domain_translatable_text_part_set(Evas
|
|||
*/
|
||||
EINA_DEPRECATED EAPI const char *elm_object_translatable_text_part_get(const Evas_Object *obj, const char *part);
|
||||
|
||||
/**
|
||||
* @brief Show/Hide the title area
|
||||
*
|
||||
* @param it The naviframe item
|
||||
* @param visible If @c EINA_TRUE, title area will be visible, hidden
|
||||
* otherwise
|
||||
*
|
||||
* When the title area is invisible, then the controls would be hidden so as
|
||||
* to expand the content area to full-size.
|
||||
*
|
||||
* @deprecated Use elm_naviframe_item_title_enabled_set() instead.
|
||||
*
|
||||
* @see also elm_naviframe_item_title_visible_get()
|
||||
* @see also elm_naviframe_item_title_enabled_get()
|
||||
*
|
||||
* @ingroup Naviframe
|
||||
*/
|
||||
EINA_DEPRECATED EAPI void elm_naviframe_item_title_visible_set(Elm_Object_Item *it, Eina_Bool visible);
|
||||
|
||||
/**
|
||||
* @brief Get a value whether title area is visible or not.
|
||||
*
|
||||
* @param it The naviframe item
|
||||
* @return If @c EINA_TRUE, title area is visible
|
||||
*
|
||||
* @deprecated Use elm_naviframe_item_title_enabled_get() instead.
|
||||
*
|
||||
* @see also elm_naviframe_item_title_visible_set()
|
||||
*
|
||||
* @ingroup Naviframe
|
||||
*/
|
||||
EINA_DEPRECATED EAPI Eina_Bool elm_naviframe_item_title_visible_get(const Elm_Object_Item *it);
|
||||
|
||||
/**
|
||||
* Enable/disable horizontal and vertical bouncing effect.
|
||||
*
|
||||
|
|
|
@ -54,7 +54,7 @@ struct _Elm_Naviframe_Item
|
|||
Evas_Coord minw;
|
||||
Evas_Coord minh;
|
||||
|
||||
Eina_Bool title_visible : 1;
|
||||
Eina_Bool title_enabled : 1;
|
||||
Eina_Bool unfocusable : 1;
|
||||
Eina_Bool popping : 1;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue