elemenatry/hoversel - updated doc. deprecated APIs
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 20 Dec 2011 02:44:46 +0000 (02:44 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 20 Dec 2011 02:44:46 +0000 (02:44 +0000)
elm_hoversel_icon_set
elm_hoversel_icon_get
elm_hoversel_icon_unset
elm_hoversel_item_data_get
elm_hoversel_item_label_get

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@66350 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test_hoversel.c
src/bin/test_weather.c
src/bin/test_web.c
src/edje_externals/elm_hoversel.c
src/examples/hoversel_example_01.c
src/lib/Elementary.h.in
src/lib/elc_hoversel.c

index e91121d..c55ab3c 100644 (file)
@@ -92,7 +92,7 @@ test_hoversel(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    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);
index 4729a7d..9d86b7c 100644 (file)
@@ -44,10 +44,10 @@ static void
 _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
index 209e35a..613402f 100644 (file)
@@ -295,7 +295,7 @@ _zoom_mode_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info)
 {
    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);
index 9ee6585..d345316 100644 (file)
@@ -21,7 +21,7 @@ external_hoversel_state_set(void *data __UNUSED__, Evas_Object *obj, const void
    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);
 }
@@ -43,7 +43,7 @@ external_hoversel_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_
          {
             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;
          }
      }
index d1c11de..769f878 100644 (file)
@@ -35,7 +35,7 @@ elm_main(int argc, char **argv)
    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,
@@ -66,21 +66,21 @@ _print_items(void *data, Evas_Object *obj, void *event_info)
    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
index 87f52f8..9adc573 100644 (file)
@@ -15031,6 +15031,27 @@ extern "C" {
     * "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.
     * @{
     */
@@ -15123,8 +15144,9 @@ extern "C" {
     * 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
@@ -15136,8 +15158,9 @@ extern "C" {
     * 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
@@ -15150,8 +15173,9 @@ extern "C" {
     *
     * @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
@@ -15260,8 +15284,9 @@ extern "C" {
     * @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.
@@ -15270,8 +15295,9 @@ extern "C" {
     * @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.
@@ -27749,10 +27775,10 @@ extern "C" {
     * 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.
index be4d127..5757312 100644 (file)
@@ -275,6 +275,41 @@ _elm_hoversel_label_get(const Evas_Object *obj, const char *item)
    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)
 {
@@ -297,6 +332,9 @@ 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);
@@ -372,28 +410,19 @@ elm_hoversel_horizontal_get(const Evas_Object *obj)
 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
@@ -456,6 +485,7 @@ elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file
    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);
@@ -492,15 +522,13 @@ elm_hoversel_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb func)
 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