elementary/flipseletor - applied elm_object_item,
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 16 Nov 2011 01:39:39 +0000 (01:39 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 16 Nov 2011 01:39:39 +0000 (01:39 +0000)
applied elm_object_item_text_set/get APIs and deprecated elm_flipselector_item_label/set/get APIs.

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

src/bin/test_flipselector.c
src/examples/flipselector_example.c
src/lib/Elementary.h.in
src/lib/elm_flipselector.c

index a216beb..65a6f26 100644 (file)
@@ -7,16 +7,16 @@
 void
 _sel_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
 {
-   Elm_Flipselector_Item *it;
+   Elm_Object_Item *it;
 
    it = event_info;
-   printf("label of selected item is: %s\n", elm_flipselector_item_label_get(it));
+   printf("label of selected item is: %s\n", elm_object_item_text_get(it));
 }
 
 void
 _unsel_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Elm_Flipselector_Item *it;
+   Elm_Object_Item *it;
    Evas_Object *fp = data;
    it = elm_flipselector_selected_item_get(fp);
    elm_flipselector_item_selected_set(it, EINA_FALSE);
@@ -25,7 +25,7 @@ _unsel_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 void
 _third_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Elm_Flipselector_Item *it;
+   Elm_Object_Item *it;
    Evas_Object *fp = data;
    it = elm_flipselector_first_item_get(fp);
    it = elm_flipselector_item_next_get(it);
index cdea766..a6a8bc9 100644 (file)
@@ -38,7 +38,7 @@ _unsel_cb(void        *data,
           Evas_Object *obj __UNUSED__,
           void        *event_info __UNUSED__)
 {
-   Elm_Flipselector_Item *it;
+   Elm_Object_Item *it;
    Evas_Object *fp = data;
 
    it = elm_flipselector_selected_item_get(fp);
@@ -50,7 +50,7 @@ _del_cb(void        *data,
           Evas_Object *obj __UNUSED__,
           void        *event_info __UNUSED__)
 {
-   Elm_Flipselector_Item *it;
+   Elm_Object_Item *it;
    Evas_Object *fp = data;
 
    it = elm_flipselector_selected_item_get(fp);
@@ -111,36 +111,36 @@ _on_keydown(void              *data,
 
    if (strcmp(ev->keyname, "f") == 0) /* print first item's label */
      {
-         Elm_Flipselector_Item *it;
+         Elm_Object_Item *it;
 
          it = elm_flipselector_first_item_get(fs);
 
          fprintf(stdout, "Flip selector's first item is: %s\n", it ?
-                 elm_flipselector_item_label_get(it) : "none");
+                 elm_object_item_text_get(it) : "none");
 
         return;
      }
 
    if (strcmp(ev->keyname, "l") == 0) /* print last item's label */
      {
-         Elm_Flipselector_Item *it;
+         Elm_Object_Item *it;
 
          it = elm_flipselector_last_item_get(fs);
 
          fprintf(stdout, "Flip selector's last item is: %s\n", it ?
-                 elm_flipselector_item_label_get(it) : "none");
+                 elm_object_item_text_get(it) : "none");
 
         return;
      }
 
    if (strcmp(ev->keyname, "s") == 0) /* print selected item's label */
      {
-         Elm_Flipselector_Item *it;
+         Elm_Object_Item *it;
 
          it = elm_flipselector_selected_item_get(fs);
 
          fprintf(stdout, "Flip selector's selected item is: %s\n", it ?
-                 elm_flipselector_item_label_get(it) : "none");
+                 elm_object_item_text_get(it) : "none");
 
         return;
      }
index d95507a..8916eed 100644 (file)
@@ -24839,6 +24839,10 @@ extern "C" {
     * Available styles for it:
     * - @c "default"
     *
+        * To set/get the label of the flipselector item, you can use
+        * elm_object_item_text_set/get APIs.
+        * Once the text is set, a previously set one will be deleted.
+        * 
     * Here is an example on its usage:
     * @li @ref flipselector_example
     */
@@ -24848,8 +24852,6 @@ extern "C" {
     * @{
     */
 
-   typedef struct _Elm_Flipselector_Item Elm_Flipselector_Item; /**< Item handle for a flip selector widget. */
-
    /**
     * Add a new flip selector widget to the given parent Elementary
     * (container) widget
@@ -24914,7 +24916,7 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI Elm_Flipselector_Item     *elm_flipselector_item_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) EINA_ARG_NONNULL(1);
+   EAPI Elm_Object_Item     *elm_flipselector_item_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) EINA_ARG_NONNULL(1);
 
    /**
     * Prepend a (text) item to a flip selector widget
@@ -24940,19 +24942,19 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI Elm_Flipselector_Item     *elm_flipselector_item_prepend(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) EINA_ARG_NONNULL(1);
+   EAPI Elm_Object_Item     *elm_flipselector_item_prepend(Evas_Object *obj, const char *label, Evas_Smart_Cb func, void *data) EINA_ARG_NONNULL(1);
 
    /**
     * Get the internal list of items in a given flip selector widget.
     *
     * @param obj The flipselector object
-    * @return The list of items (#Elm_Flipselector_Item as data) or
+    * @return The list of items (#Elm_Object_Item as data) or
     * @c NULL on errors.
     *
     * This list is @b not to be modified in any way and must not be
     * freed. Use the list members with functions like
-    * elm_flipselector_item_label_set(),
-    * elm_flipselector_item_label_get(),
+    * elm_object_item_text_set(),
+    * elm_object_item_text_get(),
     * elm_flipselector_item_del(),
     * elm_flipselector_item_selected_get(),
     * elm_flipselector_item_selected_set().
@@ -24978,7 +24980,7 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI Elm_Flipselector_Item     *elm_flipselector_first_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EAPI Elm_Object_Item     *elm_flipselector_first_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
 
    /**
     * Get the last item in the given flip selector widget's list of
@@ -24993,7 +24995,7 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI Elm_Flipselector_Item     *elm_flipselector_last_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EAPI Elm_Object_Item     *elm_flipselector_last_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
 
    /**
     * Get the currently selected item in a flip selector widget.
@@ -25004,13 +25006,13 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI Elm_Flipselector_Item     *elm_flipselector_selected_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EAPI Elm_Object_Item     *elm_flipselector_selected_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
 
    /**
     * Set whether a given flip selector widget's item should be the
     * currently selected one.
     *
-    * @param item The flip selector item
+    * @param it The flip selector item
     * @param selected @c EINA_TRUE to select it, @c EINA_FALSE to unselect.
     *
     * This sets whether @p item is or not the selected (thus, under
@@ -25023,13 +25025,13 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI void                       elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool selected) EINA_ARG_NONNULL(1);
+   EAPI void                       elm_flipselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) EINA_ARG_NONNULL(1);
 
    /**
     * Get whether a given flip selector widget's item is the currently
     * selected one.
     *
-    * @param item The flip selector item
+    * @param it The flip selector item
     * @return @c EINA_TRUE, if it's selected, @c EINA_FALSE otherwise
     * (or on errors).
     *
@@ -25037,46 +25039,48 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI Eina_Bool                  elm_flipselector_item_selected_get(const Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
+   EAPI Eina_Bool                  elm_flipselector_item_selected_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
 
    /**
     * Delete a given item from a flip selector widget.
     *
-    * @param item The item to delete
+    * @param it The item to delete
     *
     * @ingroup Flipselector
     */
-   EAPI void                       elm_flipselector_item_del(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
+   EAPI void                       elm_flipselector_item_del(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
 
    /**
     * Get the label of a given flip selector widget's item.
     *
-    * @param item The item to get label from
+    * @param it The item to get label from
     * @return The text label of @p item or @c NULL, on errors
     *
-    * @see elm_flipselector_item_label_set()
+    * @see elm_object_item_text_set()
     *
+    * @deprecated see elm_object_item_text_get() instead
     * @ingroup Flipselector
     */
-   EAPI const char                *elm_flipselector_item_label_get(const Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI const char                *elm_flipselector_item_label_get(const Elm_Object_Item *it) EINA_ARG_NONNULL(1);
 
    /**
     * Set the label of a given flip selector widget's item.
     *
-    * @param item The item to set label on
+    * @param it The item to set label on
     * @param label The text label string, in UTF-8 encoding
     *
-    * @see elm_flipselector_item_label_get()
+    * @see elm_object_item_text_get()
     *
+        * @deprecated see elm_object_item_text_set() instead
     * @ingroup Flipselector
     */
-   EAPI void                       elm_flipselector_item_label_set(Elm_Flipselector_Item *item, const char *label) EINA_ARG_NONNULL(1);
+   EINA_DEPRECATED EAPI void                       elm_flipselector_item_label_set(Elm_Object_Item *it, const char *label) EINA_ARG_NONNULL(1);
 
    /**
     * Gets the item before @p item in a flip selector widget's
     * internal list of items.
     *
-    * @param item The item to fetch previous from
+    * @param it The item to fetch previous from
     * @return The item before the @p item, in its parent's list. If
     *         there is no previous item for @p item or there's an
     *         error, @c NULL is returned.
@@ -25085,13 +25089,13 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI Elm_Flipselector_Item     *elm_flipselector_item_prev_get(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
+   EAPI Elm_Object_Item     *elm_flipselector_item_prev_get(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
 
    /**
     * Gets the item after @p item in a flip selector widget's
     * internal list of items.
     *
-    * @param item The item to fetch next from
+    * @param it The item to fetch next from
     * @return The item after the @p item, in its parent's list. If
     *         there is no next item for @p item or there's an
     *         error, @c NULL is returned.
@@ -25100,7 +25104,7 @@ extern "C" {
     *
     * @ingroup Flipselector
     */
-   EAPI Elm_Flipselector_Item     *elm_flipselector_item_next_get(Elm_Flipselector_Item *item) EINA_ARG_NONNULL(1);
+   EAPI Elm_Object_Item     *elm_flipselector_item_next_get(Elm_Object_Item *it) EINA_ARG_NONNULL(1);
 
    /**
     * Set the interval on time updates for an user mouse button hold
index ced08bb..3eee668 100644 (file)
@@ -34,6 +34,7 @@ struct _Elm_Flipselector_Item
 };
 
 typedef struct _Widget_Data Widget_Data;
+typedef struct _Elm_Flipselector_Item Elm_Flipselector_Item;
 
 struct _Widget_Data
 {
@@ -67,13 +68,66 @@ static const Evas_Smart_Cb_Description _signals[] = {
   {NULL, NULL}
 };
 
-#define ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(it, ...)             \
-   ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, __VA_ARGS__);            \
-  if (it->deleted)                                                      \
-    {                                                                   \
-       ERR(""#it" has been DELETED.\n");                                \
-       return __VA_ARGS__;                                              \
-    }                                                                   \
+static void
+_item_text_set_hook(Elm_Object_Item *it,
+                    const char *part __UNUSED__,
+                    const char *label)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+
+   Widget_Data *wd;
+   Eina_List *l;
+   Elm_Flipselector_Item *item;
+
+   if (!label) return;
+
+   item = (Elm_Flipselector_Item *) it;
+   wd = elm_widget_data_get(WIDGET(item));
+   if ((!wd) || (!wd->items)) return;
+
+   l = eina_list_data_find_list(wd->items, item);
+   if (!l) return;
+
+   eina_stringshare_del(item->label);
+   item->label = eina_stringshare_add_length(label, wd->max_len);
+
+   if (strlen(label) > strlen(elm_object_item_text_get(DATA_GET(wd->sentinel))))
+     wd->sentinel = l;
+
+   if (wd->current == l)
+     {
+        _update_view(WIDGET(item));
+        _sizing_eval(wd->self);
+     }
+}
+
+static const char *
+_item_text_get_hook(const Elm_Object_Item *it, const char *part __UNUSED__)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
+
+   Elm_Flipselector_Item *item, *_item;
+   Widget_Data *wd;
+   Eina_List *l;
+
+   item = (Elm_Flipselector_Item *) it;
+   wd = elm_widget_data_get(WIDGET(item));
+   if ((!wd) || (!wd->items)) return NULL;
+
+   EINA_LIST_FOREACH(wd->items, l, _item)
+     if (_item == item) return item->label;
+   return NULL;
+}
+
+static void
+_item_signal_emit_hook(Elm_Object_Item *it,
+                       const char *emission,
+                       const char *source)
+{
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Elm_Flipselector_Item *item = (Elm_Flipselector_Item *) it;
+   edje_object_signal_emit(VIEW(item), emission, source);
+}
 
 static Elm_Flipselector_Item *
 _item_new(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *data)
@@ -83,8 +137,11 @@ _item_new(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *d
    Widget_Data *wd = elm_widget_data_get(obj);
 
    it = elm_widget_item_new(obj, Elm_Flipselector_Item);
-   if (!it)
-     return NULL;
+   if (!it) return NULL;
+
+   elm_widget_item_text_set_hook_set(it, _item_text_set_hook);
+   elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
+   elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
 
    len = strlen(label);
    if (len > wd->max_len)
@@ -112,14 +169,12 @@ _del_hook(Evas_Object *obj)
    Elm_Flipselector_Item *item;
 
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd)
-     return;
+   if (!wd) return;
 
-   if (wd->walking)
-     ERR("flipselector deleted while walking.\n");
+   if (wd->walking) ERR("flipselector deleted while walking.\n");
 
    EINA_LIST_FREE(wd->items, item)
-      _item_free(item);
+     _item_free(item);
 
    if (wd->spin) ecore_timer_del(wd->spin);
    free(wd);
@@ -132,8 +187,7 @@ _theme_hook(Evas_Object *obj)
    const char *max_len;
 
    wd = elm_widget_data_get(obj);
-   if (!wd)
-     return;
+   if (!wd) return;
 
    _elm_theme_object_set(obj, wd->base, "flipselector", "base",
                          elm_widget_style_get(obj));
@@ -170,8 +224,8 @@ _sentinel_eval(Widget_Data *wd)
 
    EINA_LIST_FOREACH(wd->items, l, it)
      {
-        if (strlen(elm_flipselector_item_label_get(it)) >
-            strlen(elm_flipselector_item_label_get(DATA_GET(wd->sentinel))))
+        if (strlen(elm_object_item_text_get((Elm_Object_Item *) it)) >
+            strlen(elm_object_item_text_get(DATA_GET(wd->sentinel))))
           wd->sentinel = l;
      }
 }
@@ -189,14 +243,12 @@ _flipselector_process_deletions(Widget_Data *wd)
 
    EINA_LIST_FOREACH(wd->items, l, it)
      {
-        if (!it->deleted)
-          continue;
+        if (!it->deleted) continue;
 
         if (wd->current == l)
           {
              if (wd->current == wd->sentinel)
                sentinel_eval = EINA_TRUE;
-
              wd->current = eina_list_prev(wd->current);
           }
         wd->items = eina_list_remove(wd->items, it);
@@ -242,9 +294,7 @@ _flipselector_unwalk(Widget_Data *wd)
         ERR("walking became negative. fixed!\n");
         wd->walking = 0;
      }
-
-   if (wd->walking)
-     return;
+   if (wd->walking) return;
 
    _flipselector_process_deletions(wd);
 }
@@ -256,19 +306,15 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
    Widget_Data *wd;
    Eina_Bool is_up = EINA_TRUE;
 
-   if (type != EVAS_CALLBACK_KEY_DOWN)
-     return EINA_FALSE;
+   if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
 
    wd = elm_widget_data_get(obj);
-   if (!wd)
-     return EINA_FALSE;
+   if (!wd) return EINA_FALSE;
 
    ev = event_info;
-   if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
-     return EINA_FALSE;
+   if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
 
-   if (elm_widget_disabled_get(obj))
-     return EINA_FALSE;
+   if (elm_widget_disabled_get(obj)) return EINA_FALSE;
 
    if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
      is_up = EINA_FALSE;
@@ -280,10 +326,8 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty
    /* TODO: if direction setting via API is not coming in, replace
       these calls by flip_{next,prev} */
    _flipselector_walk(wd);
-   if (is_up)
-     _flip_up(wd);
-   else
-     _flip_down(wd);
+   if (is_up) _flip_up(wd);
+   else _flip_down(wd);
    _flipselector_unwalk(wd);
 
    ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
@@ -294,8 +338,7 @@ static void
 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd)
-     return;
+   if (!wd) return;
 
    /* FIXME: no treatment of this signal so far */
    if (elm_widget_focus_get(obj))
@@ -318,16 +361,13 @@ _sizing_eval(Evas_Object *obj)
    Evas_Coord minw = -1, minh = -1, w, h;
 
    wd = elm_widget_data_get(obj);
-   if (!wd)
-     return;
+   if (!wd) return;
 
    elm_coords_finger_size_adjust(1, &minw, 2, &minh);
 
    if (wd->sentinel)
      {
-        const char *label = \
-                            elm_flipselector_item_label_get(DATA_GET(wd->sentinel));
-
+        const char *label = elm_object_item_text_get(DATA_GET(wd->sentinel));
         tmp = edje_object_part_text_get(wd->base, "top");
         edje_object_part_text_set(wd->base, "top", label);
      }
@@ -336,8 +376,7 @@ _sizing_eval(Evas_Object *obj)
    elm_coords_finger_size_adjust(1, &minw, 2, &minh);
    evas_object_size_hint_min_get(obj, &w, &h);
 
-   if (wd->sentinel)
-     edje_object_part_text_set(wd->base, "top", tmp);
+   if (wd->sentinel) edje_object_part_text_set(wd->base, "top", tmp);
 
    if (w > minw) minw = w;
    if (h > minh) minh = h;
@@ -353,17 +392,14 @@ _update_view(Evas_Object *obj)
    Elm_Flipselector_Item *item;
 
    wd = elm_widget_data_get(obj);
-   if (!wd)
-     return;
+   if (!wd) return;
 
    label = NULL;
    item = DATA_GET(wd->current);
-   if (item)
-     label = item->label;
+   if (item) label = item->label;
 
    edje_object_part_text_set(wd->base, "top", label ? label : "");
    edje_object_part_text_set(wd->base, "bottom", label ? label : "");
-
    edje_object_message_signal_process(wd->base);
 }
 
@@ -373,8 +409,7 @@ _changed(Widget_Data *wd)
    Elm_Flipselector_Item *item;
 
    item = DATA_GET(wd->current);
-   if (!item)
-     return;
+   if (!item) return;
 
    if (item->func)
      item->func((void *)item->base.data, WIDGET(item), item);
@@ -399,8 +434,7 @@ _flip_up(Widget_Data *wd)
 {
    Elm_Flipselector_Item *item;
 
-   if (!wd->current)
-     return;
+   if (!wd->current) return;
 
    if (wd->current == wd->items)
      {
@@ -411,8 +445,7 @@ _flip_up(Widget_Data *wd)
      wd->current = eina_list_prev(wd->current);
 
    item = DATA_GET(wd->current);
-   if (!item)
-     return;
+   if (!item) return;
 
    _send_msg(wd, MSG_FLIP_UP, (char *)item->label);
 }
@@ -422,8 +455,7 @@ _signal_val_up(void *data)
 {
    Widget_Data *wd = elm_widget_data_get(data);
 
-   if (!wd)
-     goto val_up_exit_on_error;
+   if (!wd) goto val_up_exit_on_error;
 
    _flipselector_walk(wd);
 
@@ -446,13 +478,11 @@ static void
 _signal_val_up_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
 {
    Widget_Data *wd = elm_widget_data_get(data);
-   if (!wd)
-     return;
+   if (!wd) return;
 
    wd->interval = wd->first_interval;
 
-   if (wd->spin)
-     ecore_timer_del(wd->spin);
+   if (wd->spin) ecore_timer_del(wd->spin);
    wd->spin = ecore_timer_add(wd->interval, _signal_val_up, data);
 
    _signal_val_up(data);
@@ -463,8 +493,7 @@ _flip_down(Widget_Data *wd)
 {
    Elm_Flipselector_Item *item;
 
-   if (!wd->current)
-     return;
+   if (!wd->current) return;
 
    wd->current = eina_list_next(wd->current);
    if (!wd->current)
@@ -474,8 +503,7 @@ _flip_down(Widget_Data *wd)
      }
 
    item = DATA_GET(wd->current);
-   if (!item)
-     return;
+   if (!item) return;
 
    _send_msg(wd, MSG_FLIP_DOWN, (char *)item->label);
 }
@@ -485,8 +513,7 @@ _signal_val_down(void *data)
 {
    Widget_Data *wd = elm_widget_data_get(data);
 
-   if (!wd)
-     goto val_down_exit_on_error;
+   if (!wd) goto val_down_exit_on_error;
 
    _flipselector_walk(wd);
 
@@ -508,13 +535,11 @@ static void
 _signal_val_down_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
 {
    Widget_Data *wd = elm_widget_data_get(data);
-   if (!wd)
-     return;
+   if (!wd) return;
 
    wd->interval = wd->first_interval;
 
-   if (wd->spin)
-     ecore_timer_del(wd->spin);
+   if (wd->spin) ecore_timer_del(wd->spin);
    wd->spin = ecore_timer_add(wd->interval, _signal_val_down, data);
 
    _signal_val_down(data);
@@ -524,11 +549,9 @@ static void
 _signal_val_change_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
 {
    Widget_Data *wd = elm_widget_data_get(data);
-   if (!wd)
-     return;
+   if (!wd) return;
 
-   if (wd->spin)
-     ecore_timer_del(wd->spin);
+   if (wd->spin) ecore_timer_del(wd->spin);
    wd->spin = NULL;
 }
 
@@ -589,8 +612,7 @@ elm_flipselector_flip_next(Evas_Object *obj)
    ELM_CHECK_WIDTYPE(obj, widtype);
 
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd)
-     return;
+   if (!wd) return;
 
    if (wd->spin) ecore_timer_del(wd->spin);
 
@@ -605,8 +627,7 @@ elm_flipselector_flip_prev(Evas_Object *obj)
    ELM_CHECK_WIDTYPE(obj, widtype);
 
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd)
-     return;
+   if (!wd) return;
 
    if (wd->spin) ecore_timer_del(wd->spin);
 
@@ -615,7 +636,7 @@ elm_flipselector_flip_prev(Evas_Object *obj)
    _flipselector_unwalk(wd);
 }
 
-EAPI Elm_Flipselector_Item *
+EAPI Elm_Object_Item *
 elm_flipselector_item_append(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
@@ -624,22 +645,21 @@ elm_flipselector_item_append(Evas_Object *obj, const char *label, void (*func)(v
    Widget_Data *wd;
 
    wd = elm_widget_data_get(obj);
-   if (!wd)
-     return NULL;
+   if (!wd) return NULL;
 
    item = _item_new(obj, label, func, data);
-   if (!item)
-     return NULL;
+   if (!item) return NULL;
 
    wd->items = eina_list_append(wd->items, item);
-   if (!wd->current) {
+   if (!wd->current)
+     {
         wd->current = wd->items;
         _update_view(obj);
-   }
+     }
 
    if (!wd->sentinel ||
-       (strlen(elm_flipselector_item_label_get(item)) >
-        strlen(elm_flipselector_item_label_get(DATA_GET(wd->sentinel)))))
+       (strlen(elm_object_item_text_get((Elm_Object_Item *) item)) >
+        strlen(elm_object_item_text_get(DATA_GET(wd->sentinel)))))
      {
         wd->sentinel = eina_list_last(wd->items);
         _sizing_eval(obj);
@@ -648,10 +668,10 @@ elm_flipselector_item_append(Evas_Object *obj, const char *label, void (*func)(v
    if (eina_list_count(wd->items) >= 2)
      edje_object_signal_emit(wd->base, "elm,state,button,visible", "elm");
 
-   return item;
+   return (Elm_Object_Item *) item;
 }
 
-EAPI Elm_Flipselector_Item *
+EAPI Elm_Object_Item *
 elm_flipselector_item_prepend(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
@@ -660,22 +680,21 @@ elm_flipselector_item_prepend(Evas_Object *obj, const char *label, void (*func)(
    Widget_Data *wd;
 
    wd = elm_widget_data_get(obj);
-   if (!wd)
-     return NULL;
+   if (!wd) return NULL;
 
    item = _item_new(obj, label, func, data);
-   if (!item)
-     return NULL;
+   if (!item) return NULL;
 
    wd->items = eina_list_prepend(wd->items, item);
-   if (!wd->current) {
+   if (!wd->current)
+     {
         wd->current = wd->items;
         _update_view(obj);
-   }
+     }
 
    if (!wd->sentinel ||
-       (strlen(elm_flipselector_item_label_get(item)) >
-        strlen(elm_flipselector_item_label_get(DATA_GET(wd->sentinel)))))
+       (strlen(elm_object_item_text_get((Elm_Object_Item *) item)) >
+        strlen(elm_object_item_text_get(DATA_GET(wd->sentinel)))))
      {
         wd->sentinel = wd->items;
         _sizing_eval(obj);
@@ -684,7 +703,7 @@ elm_flipselector_item_prepend(Evas_Object *obj, const char *label, void (*func)(
    if (eina_list_count(wd->items) >= 2)
      edje_object_signal_emit(wd->base, "elm,state,button,visible", "elm");
 
-   return item;
+   return (Elm_Object_Item *) item;
 }
 
 /* TODO: account for deleted items?  */
@@ -694,13 +713,11 @@ elm_flipselector_items_get(const Evas_Object *obj)
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
 
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd)
-     return NULL;
-
+   if (!wd) return NULL;
    return wd->items;
 }
 
-EAPI Elm_Flipselector_Item *
+EAPI Elm_Object_Item *
 elm_flipselector_first_item_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
@@ -710,21 +727,17 @@ elm_flipselector_first_item_get(const Evas_Object *obj)
    Eina_List *l;
 
    wd = elm_widget_data_get(obj);
-   if (!wd || !wd->items)
-     return NULL;
+   if (!wd || !wd->items) return NULL;
 
    EINA_LIST_FOREACH(wd->items, l, it)
      {
-        if (it->deleted)
-          continue;
-
-        return it;
+        if (it->deleted) continue;
+        return (Elm_Object_Item *) it;
      }
-
    return NULL;
 }
 
-EAPI Elm_Flipselector_Item *
+EAPI Elm_Object_Item *
 elm_flipselector_last_item_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
@@ -734,49 +747,42 @@ elm_flipselector_last_item_get(const Evas_Object *obj)
    Eina_List *l;
 
    wd = elm_widget_data_get(obj);
-   if (!wd || !wd->items)
-     return NULL;
+   if (!wd || !wd->items) return NULL;
 
    EINA_LIST_REVERSE_FOREACH(wd->items, l, it)
      {
-        if (it->deleted)
-          continue;
-
-        return it;
+        if (it->deleted) continue;
+        return (Elm_Object_Item *) it;
      }
-
    return NULL;
 }
 
-EAPI Elm_Flipselector_Item *
+EAPI Elm_Object_Item *
 elm_flipselector_selected_item_get(const Evas_Object *obj)
 {
    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
 
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd || !wd->current)
-     return NULL;
-
+   if (!wd || !wd->current) return NULL;
    return DATA_GET(wd->current);
 }
 
 EAPI void
-elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool selected)
+elm_flipselector_item_selected_set(Elm_Object_Item *it, Eina_Bool selected)
 {
-   ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item);
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
 
-   Elm_Flipselector_Item *_item, *cur;
+   Elm_Flipselector_Item *item, *_item, *cur;
    int flipside = MSG_FLIP_UP;
    Widget_Data *wd;
    Eina_List *l;
 
+   item = (Elm_Flipselector_Item *) it;
    wd = elm_widget_data_get(WIDGET(item));
-   if (!wd)
-     return;
+   if (!wd) return;
 
    cur = DATA_GET(wd->current);
-   if ((selected) && (cur == item))
-     return;
+   if ((selected) && (cur == item)) return;
 
    _flipselector_walk(wd);
 
@@ -797,8 +803,7 @@ elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool select
 
    EINA_LIST_FOREACH(wd->items, l, _item)
      {
-        if (_item == cur)
-          flipside = MSG_FLIP_DOWN;
+        if (_item == cur) flipside = MSG_FLIP_DOWN;
 
         if (_item == item)
           {
@@ -812,27 +817,29 @@ elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool select
 }
 
 EAPI Eina_Bool
-elm_flipselector_item_selected_get(const Elm_Flipselector_Item *item)
+elm_flipselector_item_selected_get(const Elm_Object_Item *it)
 {
-   ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item, EINA_FALSE);
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
    Widget_Data *wd;
+   Elm_Flipselector_Item *item;
 
+   item = (Elm_Flipselector_Item *) it;
    wd = elm_widget_data_get(WIDGET(item));
    if (!wd) return EINA_FALSE;
    return (eina_list_data_get(wd->current) == item);
 }
 
 EAPI void
-elm_flipselector_item_del(Elm_Flipselector_Item *item)
+elm_flipselector_item_del(Elm_Object_Item *it)
 {
-   ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item);
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
    Widget_Data *wd;
-   Elm_Flipselector_Item *item2;
+   Elm_Flipselector_Item *item, *item2;
    Eina_List *l;
 
+   item = (Elm_Flipselector_Item *) it;
    wd = elm_widget_data_get(WIDGET(item));
-   if (!wd)
-     return;
+   if (!wd) return;
 
    if (wd->walking > 0)
      {
@@ -864,112 +871,64 @@ elm_flipselector_item_del(Elm_Flipselector_Item *item)
      }
    _item_free(item);
    _sentinel_eval(wd);
-
    _flipselector_unwalk(wd);
 }
 
 EAPI const char *
-elm_flipselector_item_label_get(const Elm_Flipselector_Item *item)
+elm_flipselector_item_label_get(const Elm_Object_Item *it)
 {
-   ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item, NULL);
-
-   Elm_Flipselector_Item *_item;
-   Widget_Data *wd;
-   Eina_List *l;
-
-   wd = elm_widget_data_get(WIDGET(item));
-   if ((!wd) || (!wd->items))
-     return NULL;
-
-   EINA_LIST_FOREACH(wd->items, l, _item)
-      if (_item == item)
-        return item->label;
-
-   return NULL;
+   return _item_text_get_hook(it, NULL);
 }
 
 EAPI void
-elm_flipselector_item_label_set(Elm_Flipselector_Item *item, const char *label)
+elm_flipselector_item_label_set(Elm_Object_Item *it, const char *label)
 {
-   ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item);
-
-   Widget_Data *wd;
-   Eina_List *l;
-
-   if ((!item) || (!label))
-     return;
-
-   wd = elm_widget_data_get(WIDGET(item));
-   if ((!wd) || (!wd->items))
-     return;
-
-   l = eina_list_data_find_list(wd->items, item);
-   if (!l)
-     return;
-
-   eina_stringshare_del(item->label);
-   item->label = eina_stringshare_add_length(label, wd->max_len);
-
-   if (strlen(label) >
-       strlen(elm_flipselector_item_label_get(DATA_GET(wd->sentinel))))
-     wd->sentinel = l;
-
-   if (wd->current == l)
-     {
-        _update_view(WIDGET(item));
-        _sizing_eval(wd->self);
-     }
-
-   return;
+   _item_text_set_hook(it, NULL, label);
 }
 
-EAPI Elm_Flipselector_Item *
-elm_flipselector_item_prev_get(Elm_Flipselector_Item *item)
+EAPI Elm_Object_Item *
+elm_flipselector_item_prev_get(Elm_Object_Item *it)
 {
-   ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item, NULL);
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
 
-   Elm_Flipselector_Item *_item;
+   Elm_Flipselector_Item *item, *_item;
    Widget_Data *wd;
    Eina_List *l;
 
+   item = (Elm_Flipselector_Item *) it;
    wd = elm_widget_data_get(WIDGET(item));
-   if ((!wd) || (!wd->items))
-     return NULL;
+   if ((!wd) || (!wd->items)) return NULL;
 
    EINA_LIST_FOREACH(wd->items, l, _item)
-      if (_item == item)
-        {
-           l = eina_list_prev(l);
-           if (!l)
-             return NULL;
-           return DATA_GET(l);
-        }
-
+     if (_item == item)
+       {
+          l = eina_list_prev(l);
+          if (!l) return NULL;
+          return DATA_GET(l);
+       }
    return NULL;
 }
 
-EAPI Elm_Flipselector_Item *
-elm_flipselector_item_next_get(Elm_Flipselector_Item *item)
+EAPI Elm_Object_Item *
+elm_flipselector_item_next_get(Elm_Object_Item *it)
 {
-   ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item, NULL);
+   ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
 
-   Elm_Flipselector_Item *_item;
+   Elm_Flipselector_Item *item, *_item;
    Widget_Data *wd;
    Eina_List *l;
 
+   item = (Elm_Flipselector_Item *) it;
    wd = elm_widget_data_get(WIDGET(item));
-   if ((!wd) || (!wd->items))
-     return NULL;
+   if ((!wd) || (!wd->items)) return NULL;
 
    EINA_LIST_FOREACH(wd->items, l, _item)
-      if (_item == item)
-        {
-           l = eina_list_next(l);
-           if (!l)
-             return NULL;
-           return DATA_GET(l);
-        }
-
+     if (_item == item)
+       {
+          l = eina_list_next(l);
+          if (!l) return NULL;
+          return DATA_GET(l);
+       }
    return NULL;
 }
 
@@ -979,9 +938,7 @@ elm_flipselector_interval_set(Evas_Object *obj, double interval)
    ELM_CHECK_WIDTYPE(obj, widtype);
 
    Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd)
-     return;
-
+   if (!wd) return;
    wd->first_interval = interval;
 }
 
@@ -991,8 +948,6 @@ elm_flipselector_interval_get(const Evas_Object *obj)
    ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
 
    Widget_Data *wd = elm_widget_data_get(obj);
-
-   if (!wd)
-     return 0.0;
+   if (!wd) return 0;
    return wd->first_interval;
 }