X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Flib%2Felm_grid.c;h=22f1b232dd570fc1b6a6250d775774a85644607b;hb=7fe2818cc3815724be0e6957d4c862688505fd6d;hp=5303dd80c8f431dad417f1b71be39653ce357857;hpb=e791956ce78a16c3aa7c0f1c8721036d1bcb3373;p=framework%2Fuifw%2Felementary.git diff --git a/src/lib/elm_grid.c b/src/lib/elm_grid.c index 5303dd8..22f1b23 100644 --- a/src/lib/elm_grid.c +++ b/src/lib/elm_grid.c @@ -1,20 +1,6 @@ #include #include "elm_priv.h" -/** - * @defgroup Grid Grid - * - * The grid is a grid layout widget that lays out a series of children as a - * fixed "grid" of widgets using a given percentage of the grid width and - * height each using the child object. - * - * The Grid uses a "Virtual resolution" that is stretched to fill the grid - * widgets size itself. The default is 100 x 100, so that means the - * position and sizes of children will effectively be percentages (0 to 100) - * of the width or height of the grid widget - * - */ - typedef struct _Widget_Data Widget_Data; struct _Widget_Data @@ -41,10 +27,10 @@ _elm_grid_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_ const Eina_List *items; void *(*list_data_get) (const Eina_List *list); Eina_List *(*list_free) (Eina_List *list); - + if ((!wd) || (!wd->grd)) return EINA_FALSE; - + /* Focus chain */ /* TODO: Change this to use other chain */ if ((items = elm_widget_focus_custom_chain_get(obj))) @@ -54,19 +40,19 @@ _elm_grid_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_ } else { - items = evas_object_table_children_get(wd->grd); + items = evas_object_grid_children_get(wd->grd); list_data_get = eina_list_data_get; list_free = eina_list_free; - + if (!items) return EINA_FALSE; } - + Eina_Bool ret = elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next); - + if (list_free) - list_free((Eina_List *)items); - + list_free((Eina_List *)items); + return ret; } @@ -85,14 +71,6 @@ _theme_hook(Evas_Object *obj) _mirrored_set(obj, elm_widget_mirrored_get(obj)); } -/** - * Add a new grid to the parent - * - * @param parent The parent object - * @return The new object or NULL if it cannot be created - * - * @ingroup Grid - */ EAPI Evas_Object * elm_grid_add(Evas_Object *parent) { @@ -101,9 +79,7 @@ elm_grid_add(Evas_Object *parent) Widget_Data *wd; ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL); - ELM_SET_WIDTYPE(widtype, "grid"); - wd->obj = obj; elm_widget_type_set(obj, "grid"); elm_widget_sub_object_add(parent, obj); elm_widget_data_set(obj, wd); @@ -115,22 +91,13 @@ elm_grid_add(Evas_Object *parent) wd->grd = evas_object_grid_add(e); evas_object_grid_size_set(wd->grd, 100, 100); elm_widget_resize_object_set(obj, wd->grd); - + _mirrored_set(obj, elm_widget_mirrored_get(obj)); return obj; } -/** - * Set the virtual size of the grid - * - * @param obj The grid object - * @param w The virtual width of the grid - * @param h The virtual height of the grid - * - * @ingroup Grid - */ EAPI void -elm_grid_size_set(Evas_Object *obj, int w, int h) +elm_grid_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -138,17 +105,8 @@ elm_grid_size_set(Evas_Object *obj, int w, int h) evas_object_grid_size_set(wd->grd, w, h); } -/** - * Get the virtual size of the grid - * - * @param obj The grid object - * @param w Pointer to integer to store the virtual width of the grid - * @param h Pointer to integer to store the virtual height of the grid - * - * @ingroup Grid - */ EAPI void -elm_grid_size_get(Evas_Object *obj, int *w, int *h) +elm_grid_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -156,20 +114,8 @@ elm_grid_size_get(Evas_Object *obj, int *w, int *h) evas_object_grid_size_get(wd->grd, w, h); } -/** - * Pack child at given position and size - * - * @param obj The grid object - * @param subobj The child to pack - * @param x The virtual x coord at which to pack it - * @param y The virtual y coord at which to pack it - * @param w The virtual width at which to pack it - * @param h The virtual height at which to pack it - * - * @ingroup Grid - */ EAPI void -elm_grid_pack(Evas_Object *obj, Evas_Object *subobj, int x, int y, int w, int h) +elm_grid_pack(Evas_Object *obj, Evas_Object *subobj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); @@ -178,14 +124,6 @@ elm_grid_pack(Evas_Object *obj, Evas_Object *subobj, int x, int y, int w, int h) evas_object_grid_pack(wd->grd, subobj, x, y, w, h); } -/** - * Unpack a child from a grid object - * - * @param obj The grid object - * @param subobj The child to unpack - * - * @ingroup Grid - */ EAPI void elm_grid_unpack(Evas_Object *obj, Evas_Object *subobj) { @@ -196,14 +134,6 @@ elm_grid_unpack(Evas_Object *obj, Evas_Object *subobj) evas_object_grid_unpack(wd->grd, subobj); } -/** - * Faster way to remove all child objects from a grid object. - * - * @param obj The grid object - * @param clear If true, it will delete just removed children - * - * @ingroup Grid - */ EAPI void elm_grid_clear(Evas_Object *obj, Eina_Bool clear) { @@ -217,19 +147,8 @@ elm_grid_clear(Evas_Object *obj, Eina_Bool clear) evas_object_grid_clear(wd->grd, clear); } -/** - * Set packing of an existing child at to position and size - * - * @param subobj The child to set packing of - * @param x The virtual x coord at which to pack it - * @param y The virtual y coord at which to pack it - * @param w The virtual width at which to pack it - * @param h The virtual height at which to pack it - * - * @ingroup Grid - */ EAPI void -elm_grid_pack_set(Evas_Object *subobj, int x, int y, int w, int h) +elm_grid_pack_set(Evas_Object *subobj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { Evas_Object *obj = elm_widget_parent_widget_get(subobj); ELM_CHECK_WIDTYPE(obj, widtype); @@ -238,17 +157,6 @@ elm_grid_pack_set(Evas_Object *subobj, int x, int y, int w, int h) evas_object_grid_pack(wd->grd, subobj, x, y, w, h); } -/** - * get packing of a child - * - * @param subobj The child to query - * @param x Pointer to integer to store the virtual x coord - * @param y Pointer to integer to store the virtual y coord - * @param w Pointer to integer to store the virtual width - * @param h Pointer to integer to store the virtual height - * - * @ingroup Grid - */ EAPI void elm_grid_pack_get(Evas_Object *subobj, int *x, int *y, int *w, int *h) { @@ -258,3 +166,12 @@ elm_grid_pack_get(Evas_Object *subobj, int *x, int *y, int *w, int *h) if (!wd) return; evas_object_grid_pack_get(wd->grd, subobj, x, y, w, h); } + +EAPI Eina_List * +elm_grid_children_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return evas_object_grid_children_get(wd->grd); +}