forked from enlightenment/efl
Elm layout: add the elm_object_text_set/get hooks.
deprecate: elm_layout_label_set/get SVN revision: 60807
This commit is contained in:
parent
8df2bb821d
commit
43c18d35b5
|
@ -2831,8 +2831,8 @@ extern "C" {
|
||||||
EAPI void elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content) EINA_ARG_NONNULL(1);
|
EAPI void elm_layout_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content) EINA_ARG_NONNULL(1);
|
||||||
EAPI Evas_Object *elm_layout_content_get(const Evas_Object *obj, const char *swallow) EINA_ARG_NONNULL(1);
|
EAPI Evas_Object *elm_layout_content_get(const Evas_Object *obj, const char *swallow) EINA_ARG_NONNULL(1);
|
||||||
EAPI Evas_Object *elm_layout_content_unset(Evas_Object *obj, const char *swallow) EINA_ARG_NONNULL(1);
|
EAPI Evas_Object *elm_layout_content_unset(Evas_Object *obj, const char *swallow) EINA_ARG_NONNULL(1);
|
||||||
EAPI void elm_layout_text_set(Evas_Object *obj, const char *part, const char *text) EINA_ARG_NONNULL(1);
|
EINA_DEPRECATED EAPI void elm_layout_text_set(Evas_Object *obj, const char *part, const char *text) EINA_ARG_NONNULL(1);
|
||||||
EAPI const char *elm_layout_text_get(const Evas_Object *obj, const char *part) EINA_ARG_NONNULL(1);
|
EINA_DEPRECATED EAPI const char *elm_layout_text_get(const Evas_Object *obj, const char *part) EINA_ARG_NONNULL(1);
|
||||||
EAPI void elm_layout_box_append(Evas_Object *obj, const char *part, Evas_Object *child) EINA_ARG_NONNULL(1);
|
EAPI void elm_layout_box_append(Evas_Object *obj, const char *part, Evas_Object *child) EINA_ARG_NONNULL(1);
|
||||||
EAPI void elm_layout_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child) EINA_ARG_NONNULL(1);
|
EAPI void elm_layout_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child) EINA_ARG_NONNULL(1);
|
||||||
EAPI void elm_layout_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference) EINA_ARG_NONNULL(1);
|
EAPI void elm_layout_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference) EINA_ARG_NONNULL(1);
|
||||||
|
@ -2910,6 +2910,7 @@ extern "C" {
|
||||||
* Elementary naming convention for its parts.
|
* Elementary naming convention for its parts.
|
||||||
*
|
*
|
||||||
* @ingroup Layout
|
* @ingroup Layout
|
||||||
|
* @deprecate use elm_object_text_* instead.
|
||||||
*/
|
*/
|
||||||
#define elm_layout_label_set(_ly, _txt) \
|
#define elm_layout_label_set(_ly, _txt) \
|
||||||
elm_layout_text_set((_ly), "elm.text", (_txt))
|
elm_layout_text_set((_ly), "elm.text", (_txt))
|
||||||
|
@ -2920,6 +2921,7 @@ extern "C" {
|
||||||
* Elementary naming convention for its parts.
|
* Elementary naming convention for its parts.
|
||||||
*
|
*
|
||||||
* @ingroup Layout
|
* @ingroup Layout
|
||||||
|
* @deprecate use elm_object_text_* instead.
|
||||||
*/
|
*/
|
||||||
#define elm_layout_label_get(_ly) \
|
#define elm_layout_label_get(_ly) \
|
||||||
elm_layout_text_get((_ly), "elm.text")
|
elm_layout_text_get((_ly), "elm.text")
|
||||||
|
|
|
@ -306,6 +306,57 @@ _parts_text_fix(Widget_Data *wd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_elm_layout_label_set(Evas_Object *obj, const char *part, const char *text)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
Subinfo *si = NULL;
|
||||||
|
Eina_List *l;
|
||||||
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||||
|
if (!part) part = "elm.text";
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(wd->subs, l, si)
|
||||||
|
{
|
||||||
|
if ((si->type == TEXT) && (!strcmp(part, si->part)))
|
||||||
|
{
|
||||||
|
if (!text)
|
||||||
|
{
|
||||||
|
eina_stringshare_del(si->part);
|
||||||
|
eina_stringshare_del(si->p.text.text);
|
||||||
|
free(si);
|
||||||
|
edje_object_part_text_set(wd->lay, part, NULL);
|
||||||
|
wd->subs = eina_list_remove_list(wd->subs, l);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
si = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!si)
|
||||||
|
{
|
||||||
|
si = ELM_NEW(Subinfo);
|
||||||
|
if (!si) return;
|
||||||
|
si->type = TEXT;
|
||||||
|
si->part = eina_stringshare_add(part);
|
||||||
|
wd->subs = eina_list_append(wd->subs, si);
|
||||||
|
}
|
||||||
|
|
||||||
|
eina_stringshare_replace(&si->p.text.text, text);
|
||||||
|
edje_object_part_text_set(wd->lay, part, text);
|
||||||
|
_request_sizing_eval(wd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
_elm_layout_label_get(const Evas_Object *obj, const char *part)
|
||||||
|
{
|
||||||
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (!part) part = "elm.text";
|
||||||
|
return edje_object_part_text_get(wd->lay, part);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new layout to the parent
|
* Add a new layout to the parent
|
||||||
*
|
*
|
||||||
|
@ -335,6 +386,8 @@ elm_layout_add(Evas_Object *parent)
|
||||||
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
|
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
|
||||||
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
|
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
|
||||||
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
|
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
|
||||||
|
elm_widget_label_set_hook_set(obj, _elm_layout_label_set);
|
||||||
|
elm_widget_label_get_hook_set(obj, _elm_layout_label_get);
|
||||||
|
|
||||||
wd->obj = obj;
|
wd->obj = obj;
|
||||||
wd->lay = edje_object_add(e);
|
wd->lay = edje_object_add(e);
|
||||||
|
@ -522,46 +575,12 @@ elm_layout_content_unset(Evas_Object *obj, const char *swallow)
|
||||||
* @param text The text to set
|
* @param text The text to set
|
||||||
*
|
*
|
||||||
* @ingroup Layout
|
* @ingroup Layout
|
||||||
|
* @deprecate use elm_object_text_* instead.
|
||||||
*/
|
*/
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_layout_text_set(Evas_Object *obj, const char *part, const char *text)
|
elm_layout_text_set(Evas_Object *obj, const char *part, const char *text)
|
||||||
{
|
{
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
_elm_layout_label_set(obj, part, text);
|
||||||
Subinfo *si = NULL;
|
|
||||||
Eina_List *l;
|
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(wd->subs, l, si)
|
|
||||||
{
|
|
||||||
if ((si->type == TEXT) && (!strcmp(part, si->part)))
|
|
||||||
{
|
|
||||||
if (!text)
|
|
||||||
{
|
|
||||||
eina_stringshare_del(si->part);
|
|
||||||
eina_stringshare_del(si->p.text.text);
|
|
||||||
free(si);
|
|
||||||
edje_object_part_text_set(wd->lay, part, NULL);
|
|
||||||
wd->subs = eina_list_remove_list(wd->subs, l);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
si = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!si)
|
|
||||||
{
|
|
||||||
si = ELM_NEW(Subinfo);
|
|
||||||
if (!si) return;
|
|
||||||
si->type = TEXT;
|
|
||||||
si->part = eina_stringshare_add(part);
|
|
||||||
wd->subs = eina_list_append(wd->subs, si);
|
|
||||||
}
|
|
||||||
|
|
||||||
eina_stringshare_replace(&si->p.text.text, text);
|
|
||||||
edje_object_part_text_set(wd->lay, part, text);
|
|
||||||
_request_sizing_eval(wd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -573,13 +592,12 @@ elm_layout_text_set(Evas_Object *obj, const char *part, const char *text)
|
||||||
* @return The text set in @p part
|
* @return The text set in @p part
|
||||||
*
|
*
|
||||||
* @ingroup Layout
|
* @ingroup Layout
|
||||||
|
* @deprecate use elm_object_text_* instead.
|
||||||
*/
|
*/
|
||||||
EAPI const char *
|
EAPI const char *
|
||||||
elm_layout_text_get(const Evas_Object *obj, const char *part)
|
elm_layout_text_get(const Evas_Object *obj, const char *part)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
return _elm_layout_label_get(obj, part);
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
|
||||||
return edje_object_part_text_get(wd->lay, part);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue