elementary/hoversel - Elm_Hoversel_Item -> Elm_Object_Item

**This may break your application compilation**



SVN revision: 66343
This commit is contained in:
ChunEon Park 2011-12-20 01:03:17 +00:00
parent 95a91ebfca
commit 49fa96affe
4 changed files with 52 additions and 47 deletions

View File

@ -294,8 +294,8 @@ static void
_zoom_mode_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info)
{
Web_Test *wt = data;
Elm_Hoversel_Item *it = event_info;
const char *lbl = elm_hoversel_item_label_get(it);
Elm_Object_Item *hoversel_it = event_info;
const char *lbl = elm_hoversel_item_label_get(hoversel_it);
if (!strcmp(lbl, "Manual"))
elm_web_zoom_mode_set(wt->web, ELM_WEB_ZOOM_MODE_MANUAL);

View File

@ -16,7 +16,7 @@ EAPI_MAIN int
elm_main(int argc, char **argv)
{
Evas_Object *win, *bg, *rect, *hoversel;
Elm_Hoversel_Item *it;
Elm_Object_Item *hoversel_it;
win = elm_win_add(NULL, "hoversel", ELM_WIN_BASIC);
elm_win_title_set(win, "Hoversel");
@ -40,9 +40,9 @@ elm_main(int argc, char **argv)
_print_items, NULL);
elm_hoversel_item_add(hoversel, "Option 2", "home", ELM_ICON_STANDARD, NULL,
NULL);
it = elm_hoversel_item_add(hoversel, "Clear all items", "close",
ELM_ICON_STANDARD, _rm_items, NULL);
evas_object_smart_callback_add(hoversel, "selected", _sel, it);
hoversel_it = elm_hoversel_item_add(hoversel, "Clear all items", "close",
ELM_ICON_STANDARD, _rm_items, NULL);
evas_object_smart_callback_add(hoversel, "selected", _sel, hoversel_it);
evas_object_smart_callback_add(hoversel, "clicked", _add_item, NULL);
evas_object_resize(hoversel, 180, 30);
@ -63,10 +63,10 @@ _print_items(void *data, Evas_Object *obj, void *event_info)
{
const Eina_List *items = elm_hoversel_items_get(obj);
const Eina_List *l;
Elm_Hoversel_Item *it;
Elm_Object_Item *hoversel_it;
EINA_LIST_FOREACH(items, l, it)
printf("%s\n", elm_hoversel_item_label_get(it));
EINA_LIST_FOREACH(items, l, hoversel_it)
printf("%s\n", elm_hoversel_item_label_get(hoversel_it));
}
static void
@ -88,12 +88,13 @@ _add_item(void *data, Evas_Object *obj, void *event_info)
{
static int num = 0;
char *str = malloc(sizeof(char) * 10);
Elm_Hoversel_Item *it;
Elm_Object_Item *hoversel_it;
snprintf(str, 10, "item %d", ++num);
it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL, str);
elm_hoversel_item_del_cb_set(it, _free);
hoversel_it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL,
str);
elm_hoversel_item_del_cb_set(hoversel_it, _free);
}
static void

View File

@ -15034,7 +15034,6 @@ extern "C" {
* See @ref tutorial_hoversel for an example.
* @{
*/
typedef struct _Elm_Hoversel_Item Elm_Hoversel_Item; /**< Item of Elm_Hoversel. Sub-type of Elm_Widget_Item */
/**
* @brief Add a new Hoversel object
@ -15196,7 +15195,7 @@ extern "C" {
* @brief Get the list of items within the given hoversel.
*
* @param obj The hoversel object
* @return Returns a list of Elm_Hoversel_Item*
* @return Returns a list of Elm_Object_Item*
*
* @see elm_hoversel_item_add()
*/
@ -15222,12 +15221,12 @@ extern "C" {
* For more information on what @p icon_file and @p icon_type are see the
* @ref Icon "icon documentation".
*/
EAPI Elm_Hoversel_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
EAPI Elm_Object_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data) EINA_ARG_NONNULL(1);
/**
* @brief Delete an item from the hoversel
*
* @param item The item to delete
* @param it The item to delete
*
* This deletes the item from the hoversel (should not be called while the
* hoversel is active; use elm_hoversel_expanded_get() to check first).
@ -15235,7 +15234,7 @@ extern "C" {
* @see elm_hoversel_item_add()
* @see elm_hoversel_item_del_cb_set()
*/
EAPI void elm_hoversel_item_del(Elm_Hoversel_Item *item) EINA_ARG_NONNULL(1);
EAPI void elm_hoversel_item_del(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* @brief Set the function to be called when an item from the hoversel is
@ -15245,34 +15244,34 @@ extern "C" {
* @param func The function called
*
* That function will receive these parameters:
* @li void *item_data
* @li Evas_Object *the_item_object
* @li Elm_Hoversel_Item *the_object_struct
* @li void * item data
* @li Evas_Object * hoversel object
* @li Elm_Object_Item * hoversel item
*
* @see elm_hoversel_item_add()
*/
EAPI void elm_hoversel_item_del_cb_set(Elm_Hoversel_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
EAPI void elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func) EINA_ARG_NONNULL(1);
/**
* @brief This returns the data pointer supplied with elm_hoversel_item_add()
* that will be passed to associated function callbacks.
*
* @param item The item to get the data from
* @param it The item to get the data from
* @return The data pointer set with elm_hoversel_item_add()
*
* @see elm_hoversel_item_add()
*/
EAPI void *elm_hoversel_item_data_get(const Elm_Hoversel_Item *it) EINA_ARG_NONNULL(1);
EAPI void *elm_hoversel_item_data_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* @brief This returns the label text of the given hoversel item.
*
* @param item The item to get the label
* @param it The item to get the label
* @return The label text of the hoversel item
*
* @see elm_hoversel_item_add()
*/
EAPI const char *elm_hoversel_item_label_get(const Elm_Hoversel_Item *it) EINA_ARG_NONNULL(1);
EAPI const char *elm_hoversel_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
/**
* @brief This sets the icon for the given hoversel item.
@ -15289,7 +15288,7 @@ extern "C" {
*
* @see elm_hoversel_item_add()
*/
EAPI void elm_hoversel_item_icon_set(Elm_Hoversel_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type) EINA_ARG_NONNULL(1);
EAPI void elm_hoversel_item_icon_set(Elm_Object_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type) EINA_ARG_NONNULL(1);
/**
* @brief Get the icon object of the hoversel item
@ -15304,7 +15303,7 @@ extern "C" {
* @see elm_hoversel_item_icon_set()
* @see elm_hoversel_item_add()
*/
EAPI void elm_hoversel_item_icon_get(const Elm_Hoversel_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type) EINA_ARG_NONNULL(1);
EAPI void elm_hoversel_item_icon_get(const Elm_Object_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type) EINA_ARG_NONNULL(1);
/**
* @}

View File

@ -2,6 +2,7 @@
#include "elm_priv.h"
typedef struct _Widget_Data Widget_Data;
typedef struct _Elm_Hoversel_Item Elm_Hoversel_Item;
struct _Widget_Data
{
@ -430,12 +431,12 @@ elm_hoversel_expanded_get(const Evas_Object *obj)
EAPI void
elm_hoversel_clear(Evas_Object *obj)
{
Elm_Hoversel_Item *item;
Elm_Object_Item *it;
Eina_List *l, *ll;
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
EINA_LIST_FOREACH_SAFE(wd->items, l, ll, item) elm_hoversel_item_del(item);
EINA_LIST_FOREACH_SAFE(wd->items, l, ll, it) elm_hoversel_item_del(it);
}
EAPI const Eina_List *
@ -447,7 +448,7 @@ elm_hoversel_items_get(const Evas_Object *obj)
return wd->items;
}
EAPI Elm_Hoversel_Item *
EAPI Elm_Object_Item *
elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
@ -461,14 +462,16 @@ elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file
item->icon_type = icon_type;
item->func = func;
item->base.data = data;
return item;
return (Elm_Object_Item *) item;
}
EAPI void
elm_hoversel_item_del(Elm_Hoversel_Item *item)
elm_hoversel_item_del(Elm_Object_Item *it)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
Widget_Data *wd = elm_widget_data_get(WIDGET(item));
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Widget_Data *wd;
Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it;
wd = elm_widget_data_get(WIDGET(item));
if (!wd) return;
elm_hoversel_hover_end(WIDGET(item));
wd->items = eina_list_remove(wd->items, item);
@ -480,39 +483,41 @@ elm_hoversel_item_del(Elm_Hoversel_Item *item)
}
EAPI void
elm_hoversel_item_del_cb_set(Elm_Hoversel_Item *item, Evas_Smart_Cb func)
elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
elm_widget_item_del_cb_set(item, func);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
elm_widget_item_del_cb_set(it, func);
}
EAPI void *
elm_hoversel_item_data_get(const Elm_Hoversel_Item *item)
elm_hoversel_item_data_get(const Elm_Object_Item *it)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
return elm_widget_item_data_get(item);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
return elm_widget_item_data_get(it);
}
EAPI const char *
elm_hoversel_item_label_get(const Elm_Hoversel_Item *item)
elm_hoversel_item_label_get(const Elm_Object_Item *it)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
return item->label;
ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
return ((Elm_Hoversel_Item *) it)->label;
}
EAPI void
elm_hoversel_item_icon_set(Elm_Hoversel_Item *item, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type)
elm_hoversel_item_icon_set(Elm_Object_Item *it, const char *icon_file, const char *icon_group, Elm_Icon_Type icon_type)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it;
eina_stringshare_replace(&item->icon_file, icon_file);
eina_stringshare_replace(&item->icon_group, icon_group);
item->icon_type = icon_type;
}
EAPI void
elm_hoversel_item_icon_get(const Elm_Hoversel_Item *item, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type)
elm_hoversel_item_icon_get(const Elm_Object_Item *it, const char **icon_file, const char **icon_group, Elm_Icon_Type *icon_type)
{
ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Elm_Hoversel_Item *item = (Elm_Hoversel_Item *) it;
if (icon_file) *icon_file = item->icon_file;
if (icon_group) *icon_group = item->icon_group;
if (icon_type) *icon_type = item->icon_type;