free(it);
}
+/* scrolling animation stopped callback */
+static void
+_grid_scroll_stopped_cb(void *data __UNUSED__,
+ Evas_Object *obj,
+ void *event_info __UNUSED__)
+{
+ int h_pagenumber = 0, v_pagenumber = 0;
+ elm_gengrid_current_page_get(obj, &h_pagenumber, &v_pagenumber);
+ fprintf(stdout, "Grid current horiz page is %d, vert page is %d\n",
+ h_pagenumber, v_pagenumber);
+}
+
/* items grid horizontal alignment change */
static void
_h_align_change_cb(void *data,
evas_object_show(hbx_3);
elm_gengrid_align_get(grid, &h, &v);
+ evas_object_smart_callback_add(grid, "scroll,anim,stop", _grid_scroll_stopped_cb, NULL);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Horiz. alignment");
elm_box_pack_end(hbx_3, sl);
evas_object_show(sl);
+ _page_change_cb(grid, sl, NULL);
evas_object_smart_callback_add(sl, "changed", _page_change_cb, grid);
gic.item_style = "default";
EAPI void elm_gengrid_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize) EINA_ARG_NONNULL(1);
/**
+ * @brief Get gengrid current page number.
+ *
+ * @param obj The gengrid object
+ * @param h_pagenumber The horizontal page number
+ * @param v_pagenumber The vertical page number
+ *
+ * The page number starts from 0. 0 is the first page.
+ * Current page means the page which meet the top-left of the viewport.
+ * If there are two or more pages in the viewport, it returns the number of page
+ * which meet the top-left of the viewport.
+ *
+ * @see elm_gengrid_last_page_get()
+ * @see elm_gengrid_page_show()
+ * @see elm_gengrid_page_brint_in()
+ */
+ EAPI void elm_gengrid_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber) EINA_ARG_NONNULL(1);
+
+ /**
+ * @brief Get scroll last page number.
+ *
+ * @param obj The gengrid object
+ * @param h_pagenumber The horizoptal page number
+ * @param v_pagenumber The vertical page number
+ *
+ * The page number starts from 0. 0 is the first page.
+ * This returns the last page number among the pages.
+ *
+ * @see elm_gengrid_current_page_get()
+ * @see elm_gengrid_page_show()
+ * @see elm_gengrid_page_brint_in()
+ */
+ EAPI void elm_gengrid_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber) EINA_ARG_NONNULL(1);
+
+ /**
+ * Show a specific virtual region within the gengrid content object by page number.
+ *
+ * @param obj The gengrid object
+ * @param h_pagenumber The horizoptal page number
+ * @param v_pagenumber The vertical page number
+ *
+ * 0, 0 of the indicated page is located at the top-left of the viewport.
+ * This will jump to the page directly without animation.
+ *
+ * Example of usage:
+ *
+ * @code
+ * sc = elm_gengrid_add(win);
+ * elm_gengrid_content_set(sc, content);
+ * elm_gengrid_page_relative_set(sc, 1, 0);
+ * elm_gengrid_current_page_get(sc, &h_page, &v_page);
+ * elm_gengrid_page_show(sc, h_page + 1, v_page);
+ * @endcode
+ *
+ * @see elm_gengrid_page_bring_in()
+ */
+ EAPI void elm_gengrid_page_show(const Evas_Object *obj, int h_pagenumber, int v_pagenumber) EINA_ARG_NONNULL(1);
+
+ /**
+ * Show a specific virtual region within the gengrid content object by page number.
+ *
+ * @param obj The gengrid object
+ * @param h_pagenumber The horizoptal page number
+ * @param v_pagenumber The vertical page number
+ *
+ * 0, 0 of the indicated page is located at the top-left of the viewport.
+ * This will slide to the page with animation.
+ *
+ * Example of usage:
+ *
+ * @code
+ * sc = elm_gengrid_add(win);
+ * elm_gengrid_content_set(sc, content);
+ * elm_gengrid_page_relative_set(sc, 1, 0);
+ * elm_gengrid_last_page_get(sc, &h_page, &v_page);
+ * elm_gengrid_page_bring_in(sc, h_page, v_page);
+ * @endcode
+ *
+ * @see elm_gengrid_page_show()
+ */
+ EAPI void elm_gengrid_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenumber) EINA_ARG_NONNULL(1);
+
+ /**
* Set for what direction a given gengrid widget will expand while
* placing its items.
*
v_pagesize);
}
+EAPI void
+elm_gengrid_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->scr)
+ elm_smart_scroller_current_page_get(wd->scr, h_pagenumber, v_pagenumber);
+}
+
+EAPI void
+elm_gengrid_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->scr)
+ elm_smart_scroller_last_page_get(wd->scr, h_pagenumber, v_pagenumber);
+}
+
+EAPI void
+elm_gengrid_page_show(const Evas_Object *obj, int h_pagenumber, int v_pagenumber)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->scr)
+ elm_smart_scroller_page_show(wd->scr, h_pagenumber, v_pagenumber);
+}
+
+EAPI void
+elm_gengrid_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenumber)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->scr)
+ elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber);
+}
+
EAPI Elm_Gengrid_Item *
elm_gengrid_first_item_get(const Evas_Object *obj)
{