elementary/list - deprecated tooltip APIs & updated doc

SVN revision: 67124
This commit is contained in:
ChunEon Park 2012-01-12 07:51:15 +00:00
parent e6b37886a8
commit 3d44aa9d9b
4 changed files with 196 additions and 156 deletions

View File

@ -487,18 +487,18 @@ test_tooltip(void *data __UNUSED__,
lst = elm_list_add(win);
lit = elm_list_item_append(lst, "Hello", NULL, NULL, NULL, NULL);
elm_list_item_tooltip_content_cb_set(lit, _tt_item_label, NULL, NULL);
elm_list_item_tooltip_window_mode_set(lit, EINA_TRUE);
elm_object_item_tooltip_content_cb_set(lit, _tt_item_label, NULL, NULL);
elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE);
lit = elm_list_item_append(lst, "Icon Tooltip", NULL, NULL, NULL, NULL);
elm_list_item_tooltip_content_cb_set(lit, _tt_item_icon, NULL, NULL);
elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon, NULL, NULL);
lit = elm_list_item_append(lst, "Big Icon Tooltip", NULL, NULL, NULL, NULL);
elm_list_item_tooltip_content_cb_set(lit, _tt_item_icon2, NULL, NULL);
elm_list_item_tooltip_style_set(lit, "transparent");
elm_list_item_tooltip_window_mode_set(lit, EINA_TRUE);
elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon2, NULL, NULL);
elm_object_item_tooltip_style_set(lit, "transparent");
elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE);
lit = elm_list_item_append(lst, "Insanely Big Icon Tooltip", NULL, NULL, NULL, NULL);
elm_list_item_tooltip_content_cb_set(lit, _tt_item_icon3, NULL, NULL);
elm_list_item_tooltip_style_set(lit, "transparent");
elm_list_item_tooltip_window_mode_set(lit, EINA_TRUE);
elm_object_item_tooltip_content_cb_set(lit, _tt_item_icon3, NULL, NULL);
elm_object_item_tooltip_style_set(lit, "transparent");
elm_object_item_tooltip_window_mode_set(lit, EINA_TRUE);
evas_object_size_hint_weight_set(lst, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(lst, EVAS_HINT_FILL, EVAS_HINT_FILL);

View File

@ -3134,6 +3134,129 @@ EINA_DEPRECATED EAPI const char *elm_list_item_label_get(const
*/
EINA_DEPRECATED EAPI void elm_list_item_label_set(Elm_Object_Item *it, const char *text);
/**
* Set the text to be shown in a given list item's tooltips.
*
* @param it Target item.
* @param text The text to set in the content.
*
* Setup the text as tooltip to object. The item can have only one tooltip,
* so any previous tooltip data - set with this function or
* elm_list_item_tooltip_content_cb_set() - is removed.
*
* @deprecated Use elm_object_item_tooltip_text_set() instead
* @see elm_object_tooltip_text_set() for more details.
*
* @ingroup List
*/
EINA_DEPRECATED EAPI void elm_list_item_tooltip_text_set(Elm_Object_Item *it, const char *text);
/**
* @brief Disable size restrictions on an object's tooltip
* @param it The tooltip's anchor object
* @param disable If EINA_TRUE, size restrictions are disabled
* @return EINA_FALSE on failure, EINA_TRUE on success
*
* This function allows a tooltip to expand beyond its parant window's canvas.
* It will instead be limited only by the size of the display.
*
* @deprecated Use elm_object_item_tooltip_window_mode_set() instead
*
*/
EINA_DEPRECATED EAPI Eina_Bool elm_list_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable);
/**
* @brief Retrieve size restriction state of an object's tooltip
* @param obj The tooltip's anchor object
* @return If EINA_TRUE, size restrictions are disabled
*
* This function returns whether a tooltip is allowed to expand beyond
* its parant window's canvas.
* It will instead be limited only by the size of the display.
*
* @deprecated Use elm_object_item_tooltip_window_mode_get() instead
*
*/
EINA_DEPRECATED EAPI Eina_Bool elm_list_item_tooltip_window_mode_get(const Elm_Object_Item *it);
/**
* Set the content to be shown in the tooltip item.
*
* Setup the tooltip to item. The item can have only one tooltip,
* so any previous tooltip data is removed. @p func(with @p data) will
* be called every time that need show the tooltip and it should
* return a valid Evas_Object. This object is then managed fully by
* tooltip system and is deleted when the tooltip is gone.
*
* @param it the list item being attached a tooltip.
* @param func the function used to create the tooltip contents.
* @param data what to provide to @a func as callback data/context.
* @param del_cb called when data is not needed anymore, either when
* another callback replaces @a func, the tooltip is unset with
* elm_list_item_tooltip_unset() or the owner @a item
* dies. This callback receives as the first parameter the
* given @a data, and @c event_info is the item.
*
* @deprecated Use elm_object_item_tooltip_content_cb_set() instead
*
* @see elm_object_tooltip_content_cb_set() for more details.
*
* @ingroup List
*/
EINA_DEPRECATED EAPI void elm_list_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
/**
* Unset tooltip from item.
*
* @param it list item to remove previously set tooltip.
*
* Remove tooltip from item. The callback provided as del_cb to
* elm_list_item_tooltip_content_cb_set() will be called to notify
* it is not used anymore.
*
* @deprecated Use elm_object_item_tooltip_unset() instead
* @see elm_object_tooltip_unset() for more details.
* @see elm_list_item_tooltip_content_cb_set()
*
* @ingroup List
*/
EINA_DEPRECATED EAPI void elm_list_item_tooltip_unset(Elm_Object_Item *it);
/**
* Sets a different style for this item tooltip.
*
* @note before you set a style you should define a tooltip with
* elm_list_item_tooltip_content_cb_set() or
* elm_list_item_tooltip_text_set()
*
* @param it list item with tooltip already set.
* @param style the theme style to use (default, transparent, ...)
*
*
* @deprecated Use elm_object_item_tooltip_style_set() instead
* @see elm_object_tooltip_style_set() for more details.
*
* @ingroup List
*/
EINA_DEPRECATED EAPI void elm_list_item_tooltip_style_set(Elm_Object_Item *it, const char *style);
/**
* Get the style for this item tooltip.
*
* @param item list item with tooltip already set.
* @return style the theme style in use, defaults to "default". If the
* object does not have a tooltip set, then NULL is returned.
*
* @deprecated Use elm_object_item_tooltip_style_get() instead
*
* @see elm_object_tooltip_style_get() for more details.
* @see elm_list_item_tooltip_style_set()
*
* @ingroup List
*/
EINA_DEPRECATED EAPI const char *elm_list_item_tooltip_style_get(const Elm_Object_Item *it);
/**
* Set the shrink state of toolbar @p obj.
*

View File

@ -1030,35 +1030,36 @@ _item_disable(void *data)
}
static void
_item_content_set(void *data, const char *part, Evas_Object *content)
_item_content_set(Elm_Object_Item *it, const char *part, Evas_Object *content)
{
Elm_List_Item *it = data;
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Elm_List_Item *item = (Elm_List_Item *) it;
Evas_Object **icon_p = NULL;
Eina_Bool dummy = EINA_FALSE;
if ((!part) || (!strcmp(part, "start")))
{
icon_p = &(it->icon);
dummy = it->dummy_icon;
if (!content) it->dummy_icon = EINA_FALSE;
else it->dummy_icon = EINA_TRUE;
icon_p = &(item->icon);
dummy = item->dummy_icon;
if (!content) item->dummy_icon = EINA_FALSE;
else item->dummy_icon = EINA_TRUE;
}
else if (!strcmp(part, "end"))
{
icon_p = &(it->end);
dummy = it->dummy_end;
if (!content) it->dummy_end = EINA_FALSE;
else it->dummy_end = EINA_TRUE;
icon_p = &(item->end);
dummy = item->dummy_end;
if (!content) item->dummy_end = EINA_FALSE;
else item->dummy_end = EINA_TRUE;
}
else
return;
if (content == *icon_p) return;
if ((dummy) && (!content)) return;
if (dummy) evas_object_del(*icon_p);
if (!content)
{
content = evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
content = evas_object_rectangle_add(evas_object_evas_get(WIDGET(item)));
evas_object_color_set(content, 0, 0, 0, 0);
}
if (*icon_p)
@ -1067,24 +1068,25 @@ _item_content_set(void *data, const char *part, Evas_Object *content)
*icon_p = NULL;
}
*icon_p = content;
if (VIEW(it))
edje_object_part_swallow(VIEW(it), "elm.swallow.icon", content);
if (VIEW(item))
edje_object_part_swallow(VIEW(item), "elm.swallow.icon", content);
}
static Evas_Object *
_item_content_get(const void *data, const char *part)
_item_content_get(const Elm_Object_Item *it, const char *part)
{
Elm_List_Item *it = (Elm_List_Item *)data;
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Elm_List_Item *item = (Elm_List_Item *) it;
if ((!part) || (!strcmp(part, "start")))
{
if (it->dummy_icon) return NULL;
return it->icon;
if (item->dummy_icon) return NULL;
return item->icon;
}
else if (!strcmp(part, "end"))
{
if (it->dummy_end) return NULL;
return it->end;
if (item->dummy_end) return NULL;
return item->end;
}
return NULL;
}
@ -1110,21 +1112,21 @@ _item_content_unset(const void *data, const char *part)
}
static void
_item_text_set(void *data, const char *part __UNUSED__, const char *text)
_item_text_set(Elm_Object_Item *it, const char *part, const char *text)
{
Elm_List_Item *it = data;
if (!eina_stringshare_replace(&it->label, text)) return;
if (VIEW(it))
edje_object_part_text_set(VIEW(it), "elm.text", it->label);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Elm_List_Item *list_it = (Elm_List_Item *) it;
if (part && strcmp(part, "default")) return NULL;
if (!eina_stringshare_replace(&list_it->label, text)) return;
if (VIEW(list_it))
edje_object_part_text_set(VIEW(list_it), "elm.text", text);
}
static const char *
_item_text_get(const void *data, const char *part __UNUSED__)
_item_text_get(const Elm_Object_Item *it, const char *part)
{
Elm_List_Item *it = (Elm_List_Item *)data;
return it->label;
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
return ((Elm_List_Item *) it)->label;
}
static Elm_List_Item *
@ -2022,57 +2024,56 @@ elm_list_item_label_set(Elm_Object_Item *it, const char *text)
_item_text_set(it, NULL, text);
}
// XXX: all the below - make elm_object_item*() calls to do these
EAPI void
EINA_DEPRECATED EAPI void
elm_list_item_tooltip_text_set(Elm_Object_Item *it, const char *text)
{
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
elm_widget_item_tooltip_text_set(it, text);
}
EAPI void
EINA_DEPRECATED EAPI void
elm_list_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
{
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
elm_widget_item_tooltip_content_cb_set(it, func, data, del_cb);
}
EAPI void
EINA_DEPRECATED EAPI void
elm_list_item_tooltip_unset(Elm_Object_Item *it)
{
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
elm_widget_item_tooltip_unset(it);
}
EAPI Eina_Bool
EINA_DEPRECATED EAPI Eina_Bool
elm_list_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable)
{
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
return elm_widget_item_tooltip_window_mode_set(it, disable);
}
EAPI Eina_Bool
EINA_DEPRECATED EAPI Eina_Bool
elm_list_item_tooltip_window_mode_get(const Elm_Object_Item *it)
{
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
return elm_widget_item_tooltip_window_mode_get(it);
}
EAPI void
EINA_DEPRECATED EAPI void
elm_list_item_tooltip_style_set(Elm_Object_Item *it, const char *style)
{
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
elm_widget_item_tooltip_style_set(it, style);
}
EAPI const char *
EINA_DEPRECATED EAPI const char *
elm_list_item_tooltip_style_get(const Elm_Object_Item *it)
{
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
return elm_widget_item_tooltip_style_get(it);
}
EAPI void
EINA_DEPRECATED EAPI void
elm_list_item_cursor_set(Elm_Object_Item *it, const char *cursor)
{
ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);

View File

@ -34,6 +34,29 @@
* Available styles for it:
* - @c "default"
*
* Default content parts of the list items that you can use for are:
* @li "start" - A start position object in the list item
* @li "end" - A end position object in the list item
*
* Default text parts of the list items that you can use for are:
* @li "default" - label in the list item
*
* Supported elm_object_item common APIs.
* @li elm_object_item_disabled_set
* @li elm_object_item_disabled_get
* @li elm_object_item_part_text_set
* @li elm_object_item_part_text_get
* @li elm_object_item_part_content_set
* @li elm_object_item_part_content_get
* @li elm_object_item_part_content_unset
* @li elm_object_item_tooltip_text_set
* @li elm_object_item_tooltip_window_mode_set
* @li elm_object_item_tooltip_window_mode_get
* @li elm_object_item_tooltip_content_cb_set
* @li elm_object_item_tooltip_unset
* @li elm_object_item_tooltip_style_set
* @li elm_object_item_tooltip_style_get
*
* List of examples:
* @li @ref list_example_01
* @li @ref list_example_02
@ -759,113 +782,6 @@ EAPI Elm_Object_Item *elm_list_item_prev(const Elm_Object_Item *it
*/
EAPI Elm_Object_Item *elm_list_item_next(const Elm_Object_Item *it);
/**
* Set the text to be shown in a given list item's tooltips.
*
* @param it Target item.
* @param text The text to set in the content.
*
* Setup the text as tooltip to object. The item can have only one tooltip,
* so any previous tooltip data - set with this function or
* elm_list_item_tooltip_content_cb_set() - is removed.
*
* @see elm_object_tooltip_text_set() for more details.
*
* @ingroup List
*/
EAPI void elm_list_item_tooltip_text_set(Elm_Object_Item *it, const char *text);
/**
* @brief Disable size restrictions on an object's tooltip
* @param it The tooltip's anchor object
* @param disable If EINA_TRUE, size restrictions are disabled
* @return EINA_FALSE on failure, EINA_TRUE on success
*
* This function allows a tooltip to expand beyond its parant window's canvas.
* It will instead be limited only by the size of the display.
*/
EAPI Eina_Bool elm_list_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable);
/**
* @brief Retrieve size restriction state of an object's tooltip
* @param obj The tooltip's anchor object
* @return If EINA_TRUE, size restrictions are disabled
*
* This function returns whether a tooltip is allowed to expand beyond
* its parant window's canvas.
* It will instead be limited only by the size of the display.
*/
EAPI Eina_Bool elm_list_item_tooltip_window_mode_get(const Elm_Object_Item *it);
/**
* Set the content to be shown in the tooltip item.
*
* Setup the tooltip to item. The item can have only one tooltip,
* so any previous tooltip data is removed. @p func(with @p data) will
* be called every time that need show the tooltip and it should
* return a valid Evas_Object. This object is then managed fully by
* tooltip system and is deleted when the tooltip is gone.
*
* @param it the list item being attached a tooltip.
* @param func the function used to create the tooltip contents.
* @param data what to provide to @a func as callback data/context.
* @param del_cb called when data is not needed anymore, either when
* another callback replaces @a func, the tooltip is unset with
* elm_list_item_tooltip_unset() or the owner @a item
* dies. This callback receives as the first parameter the
* given @a data, and @c event_info is the item.
*
* @see elm_object_tooltip_content_cb_set() for more details.
*
* @ingroup List
*/
EAPI void elm_list_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
/**
* Unset tooltip from item.
*
* @param it list item to remove previously set tooltip.
*
* Remove tooltip from item. The callback provided as del_cb to
* elm_list_item_tooltip_content_cb_set() will be called to notify
* it is not used anymore.
*
* @see elm_object_tooltip_unset() for more details.
* @see elm_list_item_tooltip_content_cb_set()
*
* @ingroup List
*/
EAPI void elm_list_item_tooltip_unset(Elm_Object_Item *it);
/**
* Sets a different style for this item tooltip.
*
* @note before you set a style you should define a tooltip with
* elm_list_item_tooltip_content_cb_set() or
* elm_list_item_tooltip_text_set()
*
* @param it list item with tooltip already set.
* @param style the theme style to use (default, transparent, ...)
*
* @see elm_object_tooltip_style_set() for more details.
*
* @ingroup List
*/
EAPI void elm_list_item_tooltip_style_set(Elm_Object_Item *it, const char *style);
/**
* Get the style for this item tooltip.
*
* @param item list item with tooltip already set.
* @return style the theme style in use, defaults to "default". If the
* object does not have a tooltip set, then NULL is returned.
*
* @see elm_object_tooltip_style_get() for more details.
* @see elm_list_item_tooltip_style_set()
*
* @ingroup List
*/
EAPI const char *elm_list_item_tooltip_style_get(const Elm_Object_Item *it);
/**
* Set the type of mouse pointer/cursor decoration to be shown,