elm_gengrid reorder mode added
authorJeongHyun Yun <jh0506.yun@samsung.com>
Tue, 31 May 2011 07:13:36 +0000 (16:13 +0900)
committerJeongHyun Yun <jh0506.yun@samsung.com>
Tue, 31 May 2011 07:13:36 +0000 (16:13 +0900)
src/bin/test_gengrid.c
src/lib/Elementary.h.in
src/lib/elm_gengrid.c

index a3cc18f..3bc0c00 100644 (file)
@@ -82,6 +82,12 @@ grid_longpress(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
 }
 
 static void
+grid_moved(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+   printf("moved %p\n", event_info);
+}
+
+static void
 grid_item_check_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__)
 {
    Testitem *ti = data;
@@ -162,9 +168,11 @@ test_gengrid(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_inf
    elm_gengrid_item_size_set(grid, 150, 150);
    elm_gengrid_horizontal_set(grid, EINA_FALSE);
    elm_gengrid_multi_select_set(grid, EINA_TRUE);
+   elm_gengrid_reorder_mode_set(grid, EINA_TRUE);
    evas_object_smart_callback_add(grid, "selected", grid_selected, NULL);
    evas_object_smart_callback_add(grid, "clicked", grid_clicked, NULL);
    evas_object_smart_callback_add(grid, "longpressed", grid_longpress, NULL);
+   evas_object_smart_callback_add(grid, "moved", grid_moved, NULL);
    evas_object_smart_callback_add(grid, "drag,start,up", grid_drag_up, NULL);
    evas_object_smart_callback_add(grid, "drag,start,right", grid_drag_right, NULL);
    evas_object_smart_callback_add(grid, "drag,start,down", grid_drag_down, NULL);
index 3b29723..ad48de1 100644 (file)
@@ -940,6 +940,8 @@ extern "C" {
    EAPI void               elm_gengrid_align_set(Evas_Object *obj, double align_x, double align_y) EINA_ARG_NONNULL(1);
    EAPI void               elm_gengrid_align_get(const Evas_Object *obj, double *align_x, double *align_y) EINA_ARG_NONNULL(1);
 
+   EAPI void               elm_gengrid_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode) EINA_ARG_NONNULL(1);
+   EAPI Eina_Bool          elm_gengrid_reorder_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI void               elm_gengrid_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select) EINA_ARG_NONNULL(1);
    EAPI Eina_Bool          elm_gengrid_always_select_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI void               elm_gengrid_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select) EINA_ARG_NONNULL(1);
index cca5cea..d99fc80 100644 (file)
@@ -24,7 +24,7 @@
  * application provides a structure with information about that type
  * of item (Gengrid may contain multiple different items with
  * different classes, states and styles). Gengrid will call the
- * functions in this struct (methods) when a item is "realized" (that
+ * functions in this struct (methods) when an item is "realized" (that
  * is created dynamically while scrolling). All objects will simply be
  * deleted when no longer needed with evas_object_del(). The
  * Elm_GenGrid_Item_Class structure contains the following members:
@@ -61,7 +61,7 @@
  * where XXX is the name of the part.
  *
  * func.del - This is called when elm_gengrid_item_del() is called on
- * a item or elm_gengrid_clear() is called on the Gengrid. This is
+ * an item or elm_gengrid_clear() is called on the Gengrid. This is
  * intended for use when actual Gengrid items are deleted, so any
  * backing data attached to the item (e.g. its data parameter on
  * creation) can be deleted.
  * only valid as long as no items are modified (added, deleted,
  * selected or unselected).
  *
- * If a item changes (state of boolean changes, label or icons
+ * If an item changes (state of boolean changes, label or icons
  * change), then use elm_gengrid_item_update() to have Gengrid update
  * the item with the new state. Gengrid will re-realize the item thus
  * call the functions in the _Elm_Gengrid_Item_Class for that item.
  *
- * To programmatically (un)select a item use
+ * To programmatically (un)select an item use
  * elm_gengrid_item_selected_set().  To get its selected state use
- * elm_gengrid_item_selected_get(). To make a item disabled (unable to
+ * elm_gengrid_item_selected_get(). To make an item disabled (unable to
  * be selected and appear differently) use
  * elm_gengrid_item_disabled_set() to set this and
  * elm_gengrid_item_disabled_get() to get the disabled state.
  * absolutely must have a specific style that overrides any theme the
  * user or system sets up you can use elm_theme_overlay_add() to add
  * such a file.
- * 
+ *
  * Signals that you can add callbacks for are:
  *
  * "clicked,double" - The user has double-clicked or pressed enter on
- *                    a item. The event_infoparameter is the Gengrid item
+ *                    an item. The event_infoparameter is the Gengrid item
  *                    that was double-clicked.
  * "selected" - The user has made an item selected. The event_info
  *              parameter is the Gengrid item that was selected.
  *              as a real evas object. event_info is the Gengrid item that was
  *              created. The object may be deleted at any time, so it is up to
  *              the caller to not use the object pointer from
- *              elm_gengrid_item_object_get() in a way where it may point to 
+ *              elm_gengrid_item_object_get() in a way where it may point to
  *              freed objects.
  * "unrealized" - This is called when the real evas object for this item
  *                is deleted. event_info is the Gengrid item that was created.
@@ -194,12 +194,13 @@ struct _Widget_Data
    Eina_Inlist      *items;
    Ecore_Job        *calc_job;
    Eina_List        *selected;
-   Elm_Gengrid_Item *last_selected_item;
+   Elm_Gengrid_Item *last_selected_item, *reorder_item;
    double            align_x, align_y;
 
    Evas_Coord        pan_x, pan_y;
    Evas_Coord        item_width, item_height; /* Each item size */
    Evas_Coord        minw, minh; /* Total obj size */
+   Evas_Coord        reorder_item_x, reorder_item_y;
    unsigned int      nmax;
    long              count;
    int               walking;
@@ -212,6 +213,10 @@ struct _Widget_Data
    Eina_Bool         wasselected : 1;
    Eina_Bool         always_select : 1;
    Eina_Bool         clear_me : 1;
+   Eina_Bool         h_bounce : 1;
+   Eina_Bool         v_bounce : 1;
+   Eina_Bool         reorder_mode : 1;
+   Eina_Bool         reorder_item_changed : 1;
 };
 
 #define ELM_GENGRID_ITEM_FROM_INLIST(item) \
@@ -248,6 +253,43 @@ static Eina_Bool _deselect_all_items(Widget_Data *wd);
 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
 
+static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
+static const char SIG_SELECTED[] = "selected";
+static const char SIG_UNSELECTED[] = "unselected";
+static const char SIG_REALIZED[] = "realized";
+static const char SIG_UNREALIZED[] = "unrealized";
+static const char SIG_CHANGED[] = "changed";
+static const char SIG_DRAG_START_UP[] = "drag,start,up";
+static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
+static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
+static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
+static const char SIG_DRAG_STOP[] = "drag,stop";
+static const char SIG_DRAG[] = "drag";
+static const char SIG_SCROLL[] = "scroll";
+static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
+static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
+
+static const Evas_Smart_Cb_Description _signals[] = {
+       {SIG_CLICKED_DOUBLE, ""},
+       {SIG_SELECTED, ""},
+       {SIG_UNSELECTED, ""},
+       {SIG_REALIZED, ""},
+       {SIG_UNREALIZED, ""},
+       {SIG_CHANGED, ""},
+       {SIG_DRAG_START_UP, ""},
+       {SIG_DRAG_START_DOWN, ""},
+       {SIG_DRAG_START_LEFT, ""},
+       {SIG_DRAG_START_RIGHT, ""},
+       {SIG_DRAG_STOP, ""},
+       {SIG_DRAG, ""},
+       {SIG_SCROLL, ""},
+       {SIG_SCROLL_DRAG_START, ""},
+       {SIG_SCROLL_DRAG_STOP, ""},
+       {NULL, NULL}
+};
+
+
+
 static Eina_Bool
 _event_hook(Evas_Object       *obj,
             Evas_Object *src   __UNUSED__,
@@ -421,7 +463,8 @@ _event_hook(Evas_Object       *obj,
             (!strcmp(ev->keyname, "space")))
      {
         item = elm_gengrid_selected_item_get(obj);
-        evas_object_smart_callback_call(item->wd->self, "clicked,double", item);
+        evas_object_smart_callback_call(item->wd->self, SIG_CLICKED_DOUBLE, item);
+        evas_object_smart_callback_call(item->wd->self, "clicked", item); // will be removed
      }
    else return EINA_FALSE;
 
@@ -708,6 +751,7 @@ _mouse_move(void        *data,
    Elm_Gengrid_Item *item = data;
    Evas_Event_Mouse_Move *ev = event_info;
    Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
+   Evas_Coord ox, oy, ow, oh, it_scrl_x, it_scrl_y;
 
    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
      {
@@ -725,7 +769,7 @@ _mouse_move(void        *data,
              ecore_timer_del(item->long_timer);
              item->long_timer = NULL;
           }
-        evas_object_smart_callback_call(item->wd->self, "drag", item);
+        evas_object_smart_callback_call(item->wd->self, SIG_DRAG, item);
         return;
      }
    if ((!item->down) || (item->wd->longpressed))
@@ -735,6 +779,26 @@ _mouse_move(void        *data,
              ecore_timer_del(item->long_timer);
              item->long_timer = NULL;
           }
+        if ((item->wd->reorder_mode) && (item->wd->reorder_item))
+          {
+             evas_object_geometry_get(item->wd->pan_smart, &ox, &oy, &ow, &oh);
+
+             it_scrl_x = ev->cur.canvas.x - item->wd->reorder_item->dx;
+             it_scrl_y = ev->cur.canvas.y - item->wd->reorder_item->dy;
+
+             if (it_scrl_x < ox) item->wd->reorder_item_x = ox;
+             else if (it_scrl_x + item->wd->item_width > ox + ow)
+               item->wd->reorder_item_x = ox + ow - item->wd->item_width;
+             else item->wd->reorder_item_x = it_scrl_x;
+
+             if (it_scrl_y < oy) item->wd->reorder_item_y = oy;
+             else if (it_scrl_y + item->wd->item_height > oy + oh)
+               item->wd->reorder_item_y = oy + oh - item->wd->item_height;
+             else item->wd->reorder_item_y = it_scrl_y;
+
+             if (item->wd->calc_job) ecore_job_del(item->wd->calc_job);
+             item->wd->calc_job = ecore_job_add(_calc_job, item->wd);
+          }
         return;
      }
    if (!item->display_only)
@@ -755,13 +819,13 @@ _mouse_move(void        *data,
         const char *left_drag, *right_drag;
         if (!elm_widget_mirrored_get(item->wd->self))
           {
-             left_drag = "drag,start,left";
-             right_drag = "drag,start,right";
+             left_drag = SIG_DRAG_START_LEFT;
+             right_drag = SIG_DRAG_START_RIGHT;
           }
         else
           {
-             left_drag = "drag,start,right";
-             right_drag = "drag,start,left";
+             left_drag = SIG_DRAG_START_RIGHT;
+             right_drag = SIG_DRAG_START_LEFT;
           }
 
         item->dragging = 1;
@@ -775,7 +839,7 @@ _mouse_move(void        *data,
         if (dy < 0)
           {
              if (ady > adx)
-               evas_object_smart_callback_call(item->wd->self, "drag,start,up",
+               evas_object_smart_callback_call(item->wd->self, SIG_DRAG_START_UP,
                                                item);
              else
                {
@@ -788,7 +852,7 @@ _mouse_move(void        *data,
           {
              if (ady > adx)
                evas_object_smart_callback_call(item->wd->self,
-                                               "drag,start,down", item);
+                                               SIG_DRAG_START_DOWN, item);
              else
                {
                   if (dx < 0)
@@ -811,6 +875,14 @@ _long_press(void *data)
    if ((item->disabled) || (item->dragging)) return ECORE_CALLBACK_CANCEL;
    item->wd->longpressed = EINA_TRUE;
    evas_object_smart_callback_call(item->wd->self, "longpressed", item);
+   if (item->wd->reorder_mode)
+     {
+        item->wd->reorder_item = item;
+        evas_object_raise(item->base.view);
+        elm_smart_scroller_hold_set(item->wd->scr, EINA_TRUE);
+        elm_smart_scroller_bounce_allow_set(item->wd->scr, EINA_FALSE, EINA_FALSE);
+        edje_object_signal_emit(item->base.view, "elm,state,reorder_enabled", "elm");
+     }
    return ECORE_CALLBACK_CANCEL;
 }
 
@@ -836,7 +908,10 @@ _mouse_down(void        *data,
    item->wd->wasselected = item->selected;
    _item_hilight(item);
    if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
-     evas_object_smart_callback_call(item->wd->self, "clicked,double", item);
+     {
+        evas_object_smart_callback_call(item->wd->self, SIG_CLICKED_DOUBLE, item);
+        evas_object_smart_callback_call(item->wd->self, "clicked", item); // will be removed
+     }
    if (item->long_timer) ecore_timer_del(item->long_timer);
    if (item->realized)
      item->long_timer = ecore_timer_add(_elm_config->longpress_timeout,
@@ -867,7 +942,7 @@ _mouse_up(void            *data,
    if (item->dragging)
      {
         item->dragging = EINA_FALSE;
-        evas_object_smart_callback_call(item->wd->self, "drag,stop", item);
+        evas_object_smart_callback_call(item->wd->self, SIG_DRAG_STOP, item);
         dragged = EINA_TRUE;
      }
    if (item->wd->on_hold)
@@ -876,6 +951,17 @@ _mouse_up(void            *data,
         item->wd->on_hold = EINA_FALSE;
         return;
      }
+   if ((item->wd->reorder_mode) && (item->wd->reorder_item))
+     {
+        if (item->wd->calc_job) ecore_job_del(item->wd->calc_job);
+          item->wd->calc_job = ecore_job_add(_calc_job, item->wd);
+
+        evas_object_smart_callback_call(item->wd->self, "moved", item->wd->reorder_item);
+        item->wd->reorder_item = NULL;
+        elm_smart_scroller_hold_set(item->wd->scr, EINA_FALSE);
+        elm_smart_scroller_bounce_allow_set(item->wd->scr, item->wd->h_bounce, item->wd->v_bounce);
+        edje_object_signal_emit(item->base.view, "elm,state,reorder_disabled", "elm");
+     }
    if (item->wd->longpressed)
      {
         item->wd->longpressed = EINA_FALSE;
@@ -1087,6 +1173,7 @@ _item_place(Elm_Gengrid_Item *item,
 {
    Evas_Coord x, y, ox, oy, cvx, cvy, cvw, cvh;
    Evas_Coord tch, tcw, alignw = 0, alignh = 0, vw, vh;
+   Eina_Bool reorder_item_move_forward = EINA_FALSE;
    item->x = cx;
    item->y = cy;
    evas_object_geometry_get(item->wd->pan_smart, &ox, &oy, &vw, &vh);
@@ -1161,7 +1248,57 @@ _item_place(Elm_Gengrid_Item *item,
      {
         _item_realize(item);
         if (!was_realized)
-          evas_object_smart_callback_call(item->wd->self, "realized", item);
+          evas_object_smart_callback_call(item->wd->self, SIG_REALIZED, item);
+        if ((item->wd->reorder_mode) && (item->wd->reorder_item))
+          {
+             if (item->wd->reorder_item == item)
+               {
+                  evas_object_move(item->base.view,
+                                   item->wd->reorder_item_x, item->wd->reorder_item_y);
+                  evas_object_resize(item->base.view,
+                                     item->wd->item_width, item->wd->item_height);
+                  return;
+               }
+             else
+               {
+                  if (ELM_RECTS_INTERSECT(item->wd->reorder_item_x, item->wd->reorder_item_y,
+                                          item->wd->item_width, item->wd->item_height,
+                                          x+(item->wd->item_width/2), y+(item->wd->item_height/2),
+                                          1, 1))
+                    {
+                       if (item->wd->horizontal)
+                         {
+                            if ((item->wd->nmax * item->wd->reorder_item->x + item->wd->reorder_item->y) >
+                                (item->wd->nmax * item->x + item->y))
+                              reorder_item_move_forward = EINA_TRUE;
+                         }
+                       else
+                         {
+                            if ((item->wd->nmax * item->wd->reorder_item->y + item->wd->reorder_item->x) >
+                                (item->wd->nmax * item->y + item->x))
+                              reorder_item_move_forward = EINA_TRUE;
+                         }
+
+                       item->wd->items = eina_inlist_remove(item->wd->items,
+                                                            EINA_INLIST_GET(item->wd->reorder_item));
+                       if (reorder_item_move_forward)
+                         item->wd->items = eina_inlist_prepend_relative(item->wd->items,
+                                                                        EINA_INLIST_GET(item->wd->reorder_item),
+                                                                        EINA_INLIST_GET(item));
+                       else
+                         item->wd->items = eina_inlist_append_relative(item->wd->items,
+                                                                       EINA_INLIST_GET(item->wd->reorder_item),
+                                                                       EINA_INLIST_GET(item));
+
+                       item->wd->reorder_item_changed = EINA_TRUE;
+
+                       if (item->wd->calc_job) ecore_job_del(item->wd->calc_job);
+                         item->wd->calc_job = ecore_job_add(_calc_job, item->wd);
+
+                       return;
+                    }
+               }
+          }
         evas_object_move(item->base.view, x, y);
         evas_object_resize(item->base.view, item->wd->item_width,
                            item->wd->item_height);
@@ -1170,7 +1307,7 @@ _item_place(Elm_Gengrid_Item *item,
      {
         _item_unrealize(item);
         if (was_realized)
-          evas_object_smart_callback_call(item->wd->self, "unrealized", item);
+          evas_object_smart_callback_call(item->wd->self, SIG_UNREALIZED, item);
      }
 }
 
@@ -1233,7 +1370,7 @@ call:
    if (item->func.func)
      item->func.func((void *)item->func.data, item->wd->self, item);
    if (!item->delete_me)
-     evas_object_smart_callback_call(item->wd->self, "selected", item);
+     evas_object_smart_callback_call(item->wd->self, SIG_SELECTED, item);
    item->walking--;
    item->wd->walking--;
    if ((item->wd->clear_me) && (!item->wd->walking))
@@ -1256,7 +1393,7 @@ _item_unselect(Elm_Gengrid_Item *item)
      {
         item->selected = EINA_FALSE;
         item->wd->selected = eina_list_remove(item->wd->selected, item);
-        evas_object_smart_callback_call(item->wd->self, "unselected", item);
+        evas_object_smart_callback_call(item->wd->self, SIG_UNSELECTED, item);
      }
 }
 
@@ -1415,9 +1552,12 @@ _pan_calculate(Evas_Object *obj)
    if (!sd) return;
    if (!sd->wd->nmax) return;
 
+   sd->wd->reorder_item_changed = EINA_FALSE;
+
    EINA_INLIST_FOREACH(sd->wd->items, item)
      {
         _item_place(item, cx, cy);
+        if (sd->wd->reorder_item_changed) return;
         if (sd->wd->horizontal)
           {
              cy = (cy + 1) % sd->wd->nmax;
@@ -1429,7 +1569,7 @@ _pan_calculate(Evas_Object *obj)
              if (!cx) cy++;
           }
      }
-   evas_object_smart_callback_call(sd->wd->self, "changed", NULL);
+   evas_object_smart_callback_call(sd->wd->self, SIG_CHANGED, NULL);
 }
 
 static void
@@ -1488,7 +1628,7 @@ _scr_drag_start(void            *data,
                 Evas_Object *obj __UNUSED__,
                 void *event_info __UNUSED__)
 {
-   evas_object_smart_callback_call(data, "scroll,drag,start", NULL);
+   evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
 }
 
 static void
@@ -1496,7 +1636,7 @@ _scr_drag_stop(void            *data,
                Evas_Object *obj __UNUSED__,
                void *event_info __UNUSED__)
 {
-   evas_object_smart_callback_call(data, "scroll,drag,stop", NULL);
+   evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
 }
 
 static void
@@ -1504,7 +1644,7 @@ _scr_scroll(void            *data,
             Evas_Object *obj __UNUSED__,
             void *event_info __UNUSED__)
 {
-   evas_object_smart_callback_call(data, "scroll", NULL);
+   evas_object_smart_callback_call(data, SIG_SCROLL, NULL);
 }
 
 /**
@@ -1566,6 +1706,8 @@ elm_gengrid_add(Evas_Object *parent)
    evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
    evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
 
+   evas_object_smart_callbacks_descriptions_set(obj, _signals);
+
    if (!smart)
      {
         static Evas_Smart_Class sc;
@@ -1870,7 +2012,7 @@ elm_gengrid_item_insert_after(Evas_Object                  *obj,
 }
 
 /**
- * Remove a item from the Gengrid.
+ * Remove an item from the Gengrid.
  *
  * @param item The item to be removed.
  * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
@@ -1922,6 +2064,24 @@ elm_gengrid_horizontal_set(Evas_Object *obj,
 }
 
 /**
+ * Get for what direction the Gengrid is expanded.
+ *
+ * @param obj The Gengrid object.
+ * @return If the Gengrid is expanded horizontally return @c EINA_TRUE
+ * else @c EINA_FALSE.
+ *
+ * @ingroup Gengrid
+ */
+EAPI Eina_Bool
+elm_gengrid_horizontal_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return EINA_FALSE;
+   return wd->horizontal;
+}
+
+/**
  * Clear the Gengrid
  *
  * This clears all items in the Gengrid, leaving it empty.
@@ -2030,7 +2190,7 @@ elm_gengrid_item_update(Elm_Gengrid_Item *item)
 }
 
 /**
- * Returns the data associated to a item
+ * Returns the data associated to an item
  *
  * This returns the data value passed on the elm_gengrid_item_append()
  * and related item addition calls.
@@ -2051,7 +2211,7 @@ elm_gengrid_item_data_get(const Elm_Gengrid_Item *item)
 }
 
 /**
- * Set the data item from the gengrid item
+ * Set the datan item from the gengrid item
  *
  * This set the data value passed on the elm_gengrid_item_append() and
  * related item addition calls. This function will also call
@@ -2180,9 +2340,9 @@ elm_gengrid_selected_items_get(const Evas_Object *obj)
 }
 
 /**
- * Set the selected state of a item.
+ * Set the selected state of an item.
  *
- * This sets the selected state of a item. If multi-select is not
+ * This sets the selected state of an item. If multi-select is not
  * enabled and selected is EINA_TRUE, previously selected items are
  * unselected.
  *
@@ -2217,9 +2377,9 @@ elm_gengrid_item_selected_set(Elm_Gengrid_Item *item,
 }
 
 /**
- * Get the selected state of a item.
+ * Get the selected state of an item.
  *
- * This gets the selected state of a item (1 selected, 0 not selected).
+ * This gets the selected state of an item (1 selected, 0 not selected).
  *
  * @param item The item
  * @return The selected state
@@ -2234,7 +2394,7 @@ elm_gengrid_item_selected_get(const Elm_Gengrid_Item *item)
 }
 
 /**
- * Sets the disabled state of a item.
+ * Sets the disabled state of an item.
  *
  * A disabled item cannot be selected or unselected. It will also
  * change appearance to disabled. This sets the disabled state (1
@@ -2252,7 +2412,7 @@ elm_gengrid_item_disabled_set(Elm_Gengrid_Item *item,
    ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
    if (item->disabled == disabled) return;
    if (item->delete_me) return;
-   item->disabled = disabled;
+   item->disabled = !!disabled;
    if (item->realized)
      {
         if (item->disabled)
@@ -2263,7 +2423,7 @@ elm_gengrid_item_disabled_set(Elm_Gengrid_Item *item,
 }
 
 /**
- * Get the disabled state of a item.
+ * Get the disabled state of an item.
  *
  * This gets the disabled state of the given item.
  *
@@ -2337,7 +2497,7 @@ elm_gengrid_item_tooltip_text_set(Elm_Gengrid_Item *item,
  * @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 @func, the tooltip is unset with
- *        elm_gengrid_item_tooltip_unset() or the owner @a item
+ *        elm_gengrid_item_tooltip_unset() or the owner @an item
  *        dies. This callback receives as the first parameter the
  *        given @a data, and @c event_info is the item.
  *
@@ -2572,6 +2732,43 @@ elm_gengrid_item_cursor_engine_only_get(const Elm_Gengrid_Item *item)
 }
 
 /**
+ * Set the reorder mode
+ *
+ * @param obj The Gengrid object
+ * @param reorder_mode The reorder mode
+ * (EINA_TRUE = on, EINA_FALSE = off)
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_reorder_mode_set(Evas_Object *obj,
+                             Eina_Bool    reorder_mode)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   wd->reorder_mode = reorder_mode;
+}
+
+/**
+ * Get the reorder mode
+ *
+ * @param obj The Gengrid object
+ * @return The reorder mode
+ * (EINA_TRUE = on, EINA_FALSE = off)
+ *
+ * @ingroup Gengrid
+ */
+EAPI Eina_Bool
+elm_gengrid_reorder_mode_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return EINA_FALSE;
+   return wd->reorder_mode;
+}
+
+/**
  * Set the always select mode.
  *
  * Cells will only call their selection func and callback when first
@@ -2672,6 +2869,8 @@ elm_gengrid_bounce_set(Evas_Object *obj,
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
    elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
+   wd->h_bounce = h_bounce;
+   wd->v_bounce = v_bounce;
 }
 
 /**
@@ -2691,7 +2890,8 @@ elm_gengrid_bounce_get(const Evas_Object *obj,
    ELM_CHECK_WIDTYPE(obj, widtype);
    Widget_Data *wd = elm_widget_data_get(obj);
    if (!wd) return;
-   elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
+   *h_bounce = wd->h_bounce;
+   *v_bounce = wd->v_bounce;
 }
 
 /**
@@ -2744,6 +2944,37 @@ elm_gengrid_page_relative_set(Evas_Object *obj,
                                  pagesize_v);
 }
 
+/*
+ * Get gengrid scroll page size relative to viewport size.
+ *
+ * The gengrid scroller is capable of limiting scrolling by the user
+ * to "pages" That is to jump by and only show a "whole page" at a
+ * time as if the continuous area of the scroller content is split
+ * into page sized pieces.  This sets the size of a page relative to
+ * the viewport of the scroller. 1.0 is "1 viewport" is size
+ * (horizontally or vertically). 0.0 turns it off in that axis. This
+ * is mutually exclusive with page size (see
+ * elm_gengrid_page_size_set() for more information). Likewise 0.5 is
+ * "half a viewport". Sane usable valus are normally between 0.0 and
+ * 1.0 including 1.0. If you only want 1 axis to be page "limited",
+ * use 0.0 for the other axis.
+ *
+ * @param obj The gengrid object
+ * @param h_pagerel The horizontal page relative size
+ * @param v_pagerel The vertical page relative size
+ *
+ @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   elm_smart_scroller_paging_get(wd->scr, h_pagerel, v_pagerel, NULL, NULL);
+}
+
 /**
  * Set gengrid scroll page size.
  *