elm anchorview: add the elm_object_text_set/get hooks.

deprecate: elm_anchorview_text_set/get.

SVN revision: 60997
This commit is contained in:
Tom Hacohen 2011-07-04 10:39:58 +00:00
parent bafb5ce6b8
commit e918eeae55
2 changed files with 33 additions and 15 deletions

View File

@ -3211,8 +3211,9 @@ extern "C" {
*
* Other markup can be used to style the text in different ways, but it's
* up to the style defined in the theme which tags do what.
* @deprecated use elm_object_text_set() instead.
*/
EAPI void elm_anchorview_text_set(Evas_Object *obj, const char *text) EINA_ARG_NONNULL(1);
EINA_DEPRECATED EAPI void elm_anchorview_text_set(Evas_Object *obj, const char *text) EINA_ARG_NONNULL(1);
/**
* Get the markup text set for the anchorview
*
@ -3221,8 +3222,9 @@ extern "C" {
* @param obj The anchorview object
* @return The markup text set or @c NULL if nothing was set or an error
* occurred
* @deprecated use elm_object_text_set() instead.
*/
EAPI const char *elm_anchorview_text_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EINA_DEPRECATED EAPI const char *elm_anchorview_text_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* Set the parent of the hover popup
*

View File

@ -175,6 +175,31 @@ _item_provider(void *data, Evas_Object *entry __UNUSED__, const char *item)
return NULL;
}
static void
_elm_anchorview_text_set(Evas_Object *obj, const char *item, const char *text)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (item) return;
if (!wd) return;
elm_entry_entry_set(wd->entry, text);
if (wd->hover) evas_object_del(wd->hover);
if (wd->pop) evas_object_del(wd->pop);
wd->hover = NULL;
wd->pop = NULL;
_sizing_eval(obj);
}
static const char*
_elm_anchorview_text_get(const Evas_Object *obj, const char *item)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (item) return NULL;
if (!wd) return NULL;
return elm_entry_entry_get(wd->entry);
}
EAPI Evas_Object *
elm_anchorview_add(Evas_Object *parent)
{
@ -192,6 +217,8 @@ elm_anchorview_add(Evas_Object *parent)
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_widget_text_set_hook_set(obj, _elm_anchorview_text_set);
elm_widget_text_get_hook_set(obj, _elm_anchorview_text_get);
wd->scroller = elm_scroller_add(parent);
elm_widget_resize_object_set(obj, wd->scroller);
@ -223,24 +250,13 @@ elm_anchorview_add(Evas_Object *parent)
EAPI void
elm_anchorview_text_set(Evas_Object *obj, const char *text)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_entry_entry_set(wd->entry, text);
if (wd->hover) evas_object_del(wd->hover);
if (wd->pop) evas_object_del(wd->pop);
wd->hover = NULL;
wd->pop = NULL;
_sizing_eval(obj);
_elm_anchorview_text_set(obj, NULL, text);
}
EAPI const char*
elm_anchorview_text_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return elm_entry_entry_get(wd->entry);
return _elm_anchorview_text_get(obj, NULL);
}
EAPI void