ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
- elm_hoversel_icon_set(bt, ic);
+ elm_object_part_content_set(bt, "icon", ic);
evas_object_show(ic);
elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL);
_hover_select_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{
EWeather *eweather = eweather_object_eweather_get(weather[0]);
- module[0] = eweather_plugin_search(eweather, elm_hoversel_item_label_get(event_info));
+ module[0] = eweather_plugin_search(eweather, elm_object_item_text_get(event_info));
eweather = eweather_object_eweather_get(weather[1]);
- module[1] = eweather_plugin_search(eweather, elm_hoversel_item_label_get(event_info));
+ module[1] = eweather_plugin_search(eweather, elm_object_item_text_get(event_info));
printf("%p %p\n", module[0], module[1]);
}
#endif
{
Web_Test *wt = data;
Elm_Object_Item *hoversel_it = event_info;
- const char *lbl = elm_hoversel_item_label_get(hoversel_it);
+ const char *lbl = elm_object_item_text_get(hoversel_it);
if (!strcmp(lbl, "Manual"))
elm_web_zoom_mode_set(wt->web, ELM_WEB_ZOOM_MODE_MANUAL);
if (p->label)
elm_object_text_set(obj, p->label);
if (p->icon)
- elm_hoversel_icon_set(obj, p->icon);
+ elm_object_part_content_set(obj, "icon", p->icon);
if (p->horizontal_exists)
elm_hoversel_horizontal_set(obj, p->horizontal);
}
{
Evas_Object *icon = external_common_param_icon_get(obj, param);
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
- elm_hoversel_icon_set(obj, icon);
+ elm_object_part_content_set(obj, "icon", icon);
return EINA_TRUE;
}
}
elm_hoversel_hover_parent_set(hoversel, win);
elm_hoversel_horizontal_set(hoversel, EINA_FALSE);
elm_object_text_set(hoversel, "Hoversel");
- elm_hoversel_icon_set(hoversel, rect);
+ elm_object_part_content_set(hoversel, "icon", rect);
elm_hoversel_item_add(hoversel, "Print items", NULL, ELM_ICON_NONE,
_print_items, NULL);
elm_hoversel_item_add(hoversel, "Option 2", "home", ELM_ICON_STANDARD, NULL,
Elm_Object_Item *hoversel_it;
EINA_LIST_FOREACH(items, l, hoversel_it)
- printf("%s\n", elm_hoversel_item_label_get(hoversel_it));
+ printf("%s\n", elm_object_item_text_get(hoversel_it));
}
static void
_rm_items(void *data, Evas_Object *obj, void *event_info)
{
if(!elm_hoversel_expanded_get(obj))
- elm_hoversel_clear(obj);
+ elm_hoversel_clear(obj);
}
static void
_sel(void *data, Evas_Object *obj, void *event_info)
{
if(!elm_hoversel_expanded_get(obj) && event_info != data)
- elm_hoversel_item_del(event_info);
+ elm_hoversel_item_del(event_info);
}
static void
* "selected" - an item in the hoversel list is selected. event_info is the item
* "dismissed" - the hover is dismissed
*
+ * Default contents parts of the hoversel widget that you can use for are:
+ * @li "icon" - An icon of the hoversel
+ *
+ * Default text parts of the hoversel widget that you can use for are:
+ * @li "default" - Label of the hoversel
+ *
+ * Supported elm_object common APIs.
+ * @li elm_object_disabled_set
+ * @li elm_object_text_set
+ * @li elm_object_part_text_set
+ * @li elm_object_text_get
+ * @li elm_object_part_text_get
+ * @li elm_object_content_set
+ * @li elm_object_part_content_set
+ * @li elm_object_content_unset
+ * @li elm_object_part_content_unset
+ *
+ * Supported elm_object_item common APIs.
+ * @li elm_object_item_text_get
+ * @li elm_object_item_part_text_get
+ *
* See @ref tutorial_hoversel for an example.
* @{
*/
* elm_hoversel_icon_unset() function.
*
* @see elm_object_content_set() for the button widget
+ * @deprecated Use elm_object_item_part_content_set() instead
*/
- EAPI void elm_hoversel_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI void elm_hoversel_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
/**
* @brief Get the icon of the hoversel button
* and expanded). Also see elm_object_content_get() for the button widget.
*
* @see elm_hoversel_icon_set()
+ * @deprecated Use elm_object_item_part_content_get() instead
*/
- EAPI Evas_Object *elm_hoversel_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_hoversel_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief Get and unparent the icon of the hoversel button
*
* @see elm_hoversel_icon_set()
* @see elm_object_content_unset() for the button widget
+ * @deprecated Use elm_object_item_part_content_unset() instead
*/
- EAPI Evas_Object *elm_hoversel_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED EAPI Evas_Object *elm_hoversel_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/**
* @brief This triggers the hoversel popup from code, the same as if the user
* @return The data pointer set with elm_hoversel_item_add()
*
* @see elm_hoversel_item_add()
+ * @deprecated Use elm_object_item_data_get() instead
*/
- EAPI void *elm_hoversel_item_data_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED 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.
* @return The label text of the hoversel item
*
* @see elm_hoversel_item_add()
+ * @deprecated Use elm_object_item_text_get() instead
*/
- EAPI const char *elm_hoversel_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
+ EINA_DEPRECATED 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.
* Default contents parts of the ctxpopup widget that you can use for are:
* @li "default" - A content of the ctxpopup
*
- * Default contents parts of the naviframe items that you can use for are:
+ * Default contents parts of the ctxpopup items that you can use for are:
* @li "icon" - An icon in the title area
*
- * Default text parts of the naviframe items that you can use for are:
+ * Default text parts of the ctxpopup items that you can use for are:
* @li "default" - Title label in the title area
*
* @ref tutorial_ctxpopup shows the usage of a good deal of the API.
return elm_object_text_get(wd->btn);
}
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ elm_object_part_content_set(wd->btn, part, content);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if ((!wd) || (!wd->btn)) return NULL;
+ return elm_object_part_content_get(wd->btn, part);
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if ((!wd) || (!wd->btn)) return NULL;
+ return elm_object_part_content_unset(wd->btn, part);
+}
+
+static const char *
+_item_text_get_hook(const Elm_Object_Item *it, const char *part)
+{
+ ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+ if (part && strcmp(part, "default")) return NULL;
+ return ((Elm_Hoversel_Item *) it)->label;
+}
+
EAPI Evas_Object *
elm_hoversel_add(Evas_Object *parent)
{
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_widget_text_set_hook_set(obj, _elm_hoversel_label_set);
elm_widget_text_get_hook_set(obj, _elm_hoversel_label_get);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
wd->btn = elm_button_add(parent);
elm_widget_mirrored_automatic_set(wd->btn, EINA_FALSE);
EAPI void
elm_hoversel_icon_set(Evas_Object *obj, Evas_Object *icon)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_object_part_content_set(wd->btn, "icon", icon);
+ _content_set_hook(obj, "icon", icon);
}
EAPI Evas_Object *
elm_hoversel_icon_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if ((!wd) || (!wd->btn)) return NULL;
- return elm_object_part_content_get(wd->btn, "icon");
+ _content_get_hook(obj, "icon");
}
EAPI Evas_Object *
elm_hoversel_icon_unset(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if ((!wd) || (!wd->btn)) return NULL;
- return elm_object_part_content_unset(wd->btn, "icon");
+ _content_unset_hook(obj, "icon");
}
EAPI void
if (!wd) return NULL;
Elm_Hoversel_Item *item = elm_widget_item_new(obj, Elm_Hoversel_Item);
if (!item) return NULL;
+ elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
wd->items = eina_list_append(wd->items, item);
item->label = eina_stringshare_add(label);
item->icon_file = eina_stringshare_add(icon_file);
EAPI void *
elm_hoversel_item_data_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- return elm_widget_item_data_get(it);
+ return elm_object_item_data_get(it);
}
EAPI const char *
elm_hoversel_item_label_get(const Elm_Object_Item *it)
{
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- return ((Elm_Hoversel_Item *) it)->label;
+ return _item_text_get_hook(it, NULL);
}
EAPI void