diff --git a/legacy/elementary/doc/examples.dox b/legacy/elementary/doc/examples.dox index eb4dcd266e..2220b5c74f 100644 --- a/legacy/elementary/doc/examples.dox +++ b/legacy/elementary/doc/examples.dox @@ -32,7 +32,7 @@ * @ref calendar_example_06 * * @ref clock_example - + * * @ref diskselector_example_01 * * @ref diskselector_example_02 @@ -48,6 +48,8 @@ * @ref index_example_01 * * @ref index_example_02 + * + * @ref gengrid_example */ /** @@ -3060,6 +3062,219 @@ * @example panel_example_01.c */ +/** + * @page gengrid_example Gengrid widget example + * + * This application is a thorough exercise on the gengrid widget's + * API. We place an Elementary gengrid widget on a window, with + * various knobs below its viewport, each one acting on it somehow. + * + * The code's relevant part begins at the grid's creation. After + * instantiating it, we set its items sizes, so that we don't end with + * items one finger size wide, only. We're setting them to fat, 150 + * pixel wide ones, for this example. We give it some size hints, not + * to be discussed in this context and, than, we register a callback + * on one of its smart events -- the one coming each time an item gets + * doubly clicked. There, we just print the item handle's value. + * @dontinclude gengrid_example.c + * @skip grid = elm_gengrid_add + * @until evas_object_sho + * @dontinclude gengrid_example.c + * @skip item double click callback + * @until } + * + * Before we actually start to deal with the items API, let's show + * some things items will be using throughout all the code. The first + * of them is a struct to be used as item data, for all of them: + * @dontinclude gengrid_example.c + * @skip typedef struct + * @until Item; + * + * That path will be used to index an image, to be swallowed into one + * of the item's icon spots. The imagens themselves are distributed + * with Elementary: + * @dontinclude gengrid_example.c + * @skip static const char *imgs + * @until ; + * + * We also have an (unique) gengrid item class we'll be using for + * items in the example: + * @dontinclude gengrid_example.c + * @skip static Elm_Gengrid_Item_Class + * @until static Elm_Gengrid_Item_Class + * @dontinclude gengrid_example.c + * @skip item_style = + * @until _grid_del + * + * As you see, our items will follow the default theme on gengrid + * items. For the label fetching code, we return a string composed of + * the item's image path: + * @dontinclude gengrid_example.c + * @skip label fetching callback + * @until } + * + * For item icons, we'll be populating the item default theme's two + * icon spots, @c "elm.swallow.icon" and @c "elm.swallow.end". The + * former will receive one of the images in our list (in the form of + * a @ref bg_02_example_page "background"), while the latter will be + * a check widget. Note that we prevent the check to propagate click + * events, so that the user can toggle its state without messing with + * the respective item's selection in the grid: + * @dontinclude gengrid_example.c + * @skip icon fetching callback + * @until return NULL + * @until } + * + * As the default gengrid item's theme does not have parts + * implementing item states, we'll be just returning false for every + * item state: + * @dontinclude gengrid_example.c + * @skip state fetching callback + * @until } + * + * Finally, the deletion callback on gengrid items takes care of + * freeing the item's label string and its data struct: + * @dontinclude gengrid_example.c + * @skip deletion callback + * @until } + * + * Let's move to item insertion/deletion knobs, them. They are four + * buttons, above the grid's viewport, namely + * - "Append" (to append an item to the grid), + * - "Prepend" (to prepend an item to the grid), + * - "Insert before" (to insert an item before the selection, on the + * grid), + * - "Insert after" (to insert an item after the selection, on the + * grid), + * - "Clear" (to delete all items in the grid), + * . + * which are displaced and declared in that order. We're not dealing + * with the buttons' creation code (see @ref button_example_01 + * "a button example", for more details on it), but with their @c + * "clicked" registered callbacks. For all of them, the grid's handle + * is passed as @c data. The ones creating new items use a common + * code, which just gives a new @c Example_Item struct, with @c path + * filled with a random image in our images list: + * @dontinclude gengrid_example.c + * @skip new item with random path + * @until } + * + * Moreover, that ones will set a common function to be issued on the + * selection of the items. There, we print the item handle's value, + * along with the callback function data. The latter will be @c NULL, + * always, because it's what we pass when adding all icons. + * + * The appending button will exercise elm_gengrid_item_append(), simply: + * @dontinclude gengrid_example.c + * @skip append an item + * @until } + * + * The prepending, naturally, is analogous, but exercising + * elm_gengrid_item_prepend(), on its turn. The "Insert before" one + * will expect an item to be selected in the grid, so that it will + * insert a new item just before it: + * @dontinclude gengrid_example.c + * @skip "insert before" callback + * @until } + * + * The "Insert after" is analogous, just using + * elm_gengrid_item_insert_after(), instead. The "Clear" button will, + * as expected, just issue elm_gengrid_clear(): + * @dontinclude gengrid_example.c + * @skip delete items + * @until } + * + * To change the grid's cell (items) size, we've placed a spinner, + * which has the following @c "changed" smart callback: + * @dontinclude gengrid_example.c + * @skip change items' size + * @until } + * + * Experiment with it and see how the items are affected. To toggle + * between horizontal and vertical layouting modes on the grid, use + * the "Horizontal mode" check, which will call the respective API + * function on the grid: + * @dontinclude gengrid_example.c + * @skip change layouting mode + * @until } + * + * If you toggle the check right after that one, "Always select", + * you'll notice all subsequent clicks on the @b same grid item will + * still issue the selection callback on it, what is different from + * when it's not checked. This is the + * elm_gengrid_always_select_mode_set() behavior: + * @dontinclude gengrid_example.c + * @skip "always select" callback + * @until } + * + * One more check follows, "Bouncing", which will turn on/off the + * bouncing animations on the grid, when one scrolls past its + * borders. Experiment with scrolling the grid to get the idea, having + * it turned on and off: + * @dontinclude gengrid_example.c + * @skip "bouncing mode" callback + * @until } + * + * The next two checks will affect items selection on the grid. The + * first, "Multi-selection", will make it possible to select more the + * one item on the grid. Because it wouldn't make sense to fetch for + * an unique selected item on this case, we also disable two of the + * buttons, which insert items relatively, if multi-selection is on: + * @dontinclude gengrid_example.c + * @skip multi-selection callback + * @until } + * + * Note that we also @b unselect all items in the grid, when returning + * from multi-selection mode, making use of + * elm_gengrid_item_selected_set(). + * + * The second check acting on selection, "No selection", is just what + * its name depicts -- no selection will be allowed anymore, on the + * grid, while it's on. Check it out for yourself, interacting with + * the program: + * @dontinclude gengrid_example.c + * @skip no selection callback + * @until } + * + * We have, finally, one more line of knobs, now sliders, to change + * the grids behavior. The two first will change the horizontal @b + * alignment of the whole actual grid of items within the gengrid's + * viewport: + * @dontinclude gengrid_example.c + * @skip items grid horizontal alignment change + * @until } + * + * Naturally, the vertical counterpart just issues + * elm_gengrid_align_set() changing the second alignment component, + * instead. + * + * The last slider will change the grid's page size, relative + * to its own one. Try to change those values and, one manner of + * observing the paging behavior, is to scroll softly and release the + * mouse button, with different page sizes, at different grid + * positions, while having lots of items in it -- you'll see it + * snapping to page boundaries differenty, for each configuration: + * @dontinclude gengrid_example.c + * @skip page relative size change + * @until } + * + * This is how the example program's window looks like: + * @image html screenshots/gengrid_example.png + * @image latex screenshots/gengrid_example.eps + * + * Note that it starts with three items which we included at will: + * @dontinclude gengrid_example.c + * @skip _clicked(grid, + * @until _clicked(grid, + * @until _clicked(grid, + * @until _clicked(grid, + * + * See the full @ref gengrid_example_c "source code" for + * this example. + * + * @example gengrid_example.c + */ + /** * @page bg_example_01_c bg_example_01.c * @include bg_example_01.c @@ -3177,4 +3392,9 @@ * * @include layout_example.edc * @example layout_example.edc + +/** + * @page gengrid_example_c Gengrid example + * @include gengrid_example.c + * @example gengrid_example.c */ diff --git a/legacy/elementary/src/examples/Makefile.am b/legacy/elementary/src/examples/Makefile.am index a25adec1e9..4033f4f2f4 100644 --- a/legacy/elementary/src/examples/Makefile.am +++ b/legacy/elementary/src/examples/Makefile.am @@ -80,7 +80,8 @@ SRCS = \ pager_example_01.c \ separator_example_01.c \ radio_example_01.c \ - panel_example_01.c + panel_example_01.c \ + gengrid_example.c pkglib_PROGRAMS = @@ -151,7 +152,8 @@ pkglib_PROGRAMS += \ separator_example_01 \ radio_example_01 \ toggle_example_01 \ - panel_example_01 + panel_example_01 \ + gengrid_example # This variable will hold the list of screenshots that will be made # by "make screenshots". Each item in the list is of the form: @@ -197,7 +199,8 @@ SCREENSHOTS = \ separator_example_01:separator_example_01.png:0.0 \ radio_example_01:radio_example_01.png:0.0 \ toggle_example_01:toggle_example_01.png:0.0 \ - panel_example_01:panel_example_01.png:0.0 + panel_example_01:panel_example_01.png:0.0 \ + gengrid_example:gengrid_example.png:0.0 HTML_SS_DIR=$(top_builddir)/doc/html/screenshots LATEX_SS_DIR=$(top_builddir)/doc/latex/screenshots diff --git a/legacy/elementary/src/examples/gengrid_example.c b/legacy/elementary/src/examples/gengrid_example.c new file mode 100644 index 0000000000..7e22e95154 --- /dev/null +++ b/legacy/elementary/src/examples/gengrid_example.c @@ -0,0 +1,536 @@ +/** + * Simple Elementary's gengrid widget example, illustrating its + * usage and API. + * + * See stdout/stderr for output. Compile with: + * + * @verbatim + * gcc -g `pkg-config --cflags --libs elementary` gengrid_example.c -o gengrid_example + * @endverbatim + */ + +#include +#ifdef HAVE_CONFIG_H +# include "elementary_config.h" +#else +# define __UNUSED__ +# define PACKAGE_DATA_DIR "../../data" +#endif + +typedef struct _Example_Item +{ + const char *path; +} Example_Item; + +static const char *imgs[9] = +{ + "panel_01.jpg", + "plant_01.jpg", + "rock_01.jpg", + "rock_02.jpg", + "sky_01.jpg", + "sky_02.jpg", + "sky_03.jpg", + "sky_04.jpg", + "wood_01.jpg", +}; + +static Elm_Gengrid_Item_Class gic; +Evas_Object *before_bt, *after_bt; + +static void +_on_done(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + elm_exit(); +} + +/* change layouting mode */ +static void +_horizontal_grid(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + + elm_gengrid_horizontal_set(grid, elm_check_state_get(obj)); +} + +/* "always select" callback */ +static void +_always_select_change(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + Eina_Bool always = elm_check_state_get(obj); + + elm_gengrid_always_select_mode_set(grid, always); + + fprintf(stdout, "\"Always select\" mode for gengrid items is now %s\n", + always ? "on" : "off"); +} + +/* "bouncing mode" callback */ +static void +_bouncing_change(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + Eina_Bool bounce = elm_check_state_get(obj); + + elm_gengrid_bounce_set(grid, bounce, bounce); + + fprintf(stdout, "Bouncing effect for gengrid is now %s\n", + bounce ? "on" : "off"); +} + +/* multi-selection callback */ +static void +_multi_change(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + Eina_Bool multi = elm_check_state_get(obj); + + elm_gengrid_multi_select_set(grid, multi); + + fprintf(stdout, "Multi-selection for gengrid is now %s\n", + multi ? "on" : "off"); + + elm_object_disabled_set(before_bt, multi); + elm_object_disabled_set(after_bt, multi); + + if (!multi) + { + Elm_Gengrid_Item *it; + const Eina_List *selected = elm_gengrid_selected_items_get(grid), *l; + EINA_LIST_FOREACH(selected, l, it) + elm_gengrid_item_selected_set(it, EINA_FALSE); + } +} + +/* no selection callback */ +static void +_no_sel_change(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + Eina_Bool no_sel = elm_check_state_get(obj); + + elm_gengrid_no_select_mode_set(grid, no_sel); + + fprintf(stdout, "Selection for gengrid items is now %s\n", + no_sel ? "disabled" : "enabled"); +} + +/* item selection callback */ +static void +_grid_sel(void *data, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + fprintf(stdout, "Item [%p], with data [%p], has been selected\n", + event_info, data); +} + +/* new item with random path */ +static Example_Item * +_item_new(void) +{ + Example_Item *it; + + it = malloc(sizeof(*it)); + it->path = eina_stringshare_add(imgs[rand() % (sizeof(imgs) / + sizeof(imgs[0]))]); + return it; +} + +/* "insert before" callback */ +static void +_before_bt_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Example_Item *it; + Evas_Object *grid = data; + Elm_Gengrid_Item *sel; + + sel = elm_gengrid_selected_item_get(grid); + if (!sel) + return; + + it = _item_new(); + elm_gengrid_item_insert_before(grid, &gic, it, sel, _grid_sel, NULL); +} + +/* "insert after" callback */ +static void +_after_bt_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Example_Item *it; + Evas_Object *grid = data; + Elm_Gengrid_Item *sel; + + sel = elm_gengrid_selected_item_get(grid); + if (!sel) + return; + + it = _item_new(); + elm_gengrid_item_insert_after(grid, &gic, it, sel, _grid_sel, NULL); +} + +/* prepend an item */ +static void +_prepend_bt_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Example_Item *it; + Evas_Object *grid = data; + + it = _item_new(); + elm_gengrid_item_prepend(grid, &gic, it, _grid_sel, NULL); +} + +/* append an item */ +static void +_append_bt_clicked(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + Example_Item *it = _item_new(); + + elm_gengrid_item_append(grid, &gic, it, _grid_sel, NULL); +} + +/* delete items */ +static void +_clear_cb(void *data, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + elm_gengrid_clear(data); + + fprintf(stdout, "Clearing the grid!\n"); +} + +/* change items' size */ +static void +_size_changed(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Evas_Object *grid = data; + int size = elm_spinner_value_get(obj); + + elm_gengrid_item_size_set(grid, size, size); +} + +/* item double click callback */ +static void +_double_click(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info) +{ + fprintf(stdout, "Double click on item with handle %p\n", event_info); +} + +/* label fetching callback */ +static char * +_grid_label_get(void *data, + Evas_Object *obj __UNUSED__, + const char *part __UNUSED__) +{ + const Example_Item *it = data; + char buf[256]; + + snprintf(buf, sizeof(buf), "Photo %s", it->path); + return strdup(buf); +} + +/* icon fetching callback */ +static Evas_Object * +_grid_icon_get(void *data, + Evas_Object *obj, + const char *part) +{ + const Example_Item *it = data; + + if (!strcmp(part, "elm.swallow.icon")) + { + Evas_Object *icon = elm_bg_add(obj); + char buf[PATH_MAX]; + + snprintf(buf, sizeof(buf), "%s/images/%s", PACKAGE_DATA_DIR, + it->path); + + elm_bg_file_set(icon, buf, NULL); + evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, + 1); + evas_object_show(icon); + return icon; + } + else if (!strcmp(part, "elm.swallow.end")) + { + Evas_Object *ck; + ck = elm_check_add(obj); + evas_object_propagate_events_set(ck, EINA_FALSE); + evas_object_show(ck); + return ck; + } + + return NULL; +} + +/* state fetching callback */ +static Eina_Bool +_grid_state_get(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + const char *part __UNUSED__) +{ + return EINA_FALSE; +} + +/* deletion callback */ +static void +_grid_del(void *data, + Evas_Object *obj __UNUSED__) +{ + Example_Item *it = data; + + eina_stringshare_del(it->path); + free(it); +} + +/* items grid horizontal alignment change */ +static void +_h_align_change_cb(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double v_align; + double val = elm_slider_value_get(obj); + + elm_gengrid_align_get(data, NULL, &v_align); + + fprintf(stdout, "Setting horizontal alignment to %f\n", val); + elm_gengrid_align_set(data, val, v_align); +} + +static void +_v_align_change_cb(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double h_align; + double val = elm_slider_value_get(obj); + + elm_gengrid_align_get(data, &h_align, NULL); + + fprintf(stdout, "Setting vertical alignment to %f\n", val); + elm_gengrid_align_set(data, h_align, val); +} + +/* page relative size change */ +static void +_page_change_cb(void *data, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + double val = elm_slider_value_get(obj); + + elm_gengrid_page_relative_set(data, val, val); + + fprintf(stdout, "Setting grid page's relative size to %f\n", val); +} + +int +elm_main(int argc __UNUSED__, + char **argv __UNUSED__) +{ + Evas_Object *win, *bg, *grid, *bx, *hbx_1, *hbx_2, *hbx_3, *bt, *ck, *sl, + *sp; + Eina_Bool bounce; + double h, v; + + srand(time(NULL)); + + win = elm_win_add(NULL, "gengrid", ELM_WIN_BASIC); + elm_win_title_set(win, "Generic Grid Example"); + evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + grid = elm_gengrid_add(win); + elm_gengrid_item_size_set(grid, 150, 150); + evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_min_set(grid, 600, 500); + elm_box_pack_end(bx, grid); + evas_object_smart_callback_add(grid, "clicked,double", _double_click, NULL); + evas_object_show(grid); + + hbx_1 = elm_box_add(win); + evas_object_size_hint_weight_set(hbx_1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(hbx_1, EINA_TRUE); + elm_box_pack_end(bx, hbx_1); + evas_object_show(hbx_1); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Append"); + evas_object_smart_callback_add(bt, "clicked", _append_bt_clicked, grid); + elm_box_pack_end(hbx_1, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Prepend"); + evas_object_smart_callback_add(bt, "clicked", _prepend_bt_clicked, grid); + elm_box_pack_end(hbx_1, bt); + evas_object_show(bt); + + before_bt = elm_button_add(win); + elm_object_text_set(before_bt, "Insert before"); + evas_object_smart_callback_add(before_bt, "clicked", _before_bt_clicked, + grid); + elm_box_pack_end(hbx_1, before_bt); + evas_object_show(before_bt); + + after_bt = elm_button_add(win); + elm_object_text_set(after_bt, "Insert after"); + evas_object_smart_callback_add(after_bt, "clicked", _after_bt_clicked, grid); + elm_box_pack_end(hbx_1, after_bt); + evas_object_show(after_bt); + + bt = elm_button_add(win); + elm_object_text_set(bt, "Clear"); + evas_object_smart_callback_add(bt, "clicked", _clear_cb, grid); + elm_box_pack_end(hbx_1, bt); + evas_object_show(bt); + + sp = elm_spinner_add(win); + elm_spinner_min_max_set(sp, 10, 1024); + elm_spinner_value_set(sp, 150); + elm_spinner_label_format_set(sp, "Item size: %.0f"); + evas_object_smart_callback_add(sp, "changed", _size_changed, grid); + evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_pack_end(hbx_1, sp); + evas_object_show(sp); + + hbx_2 = elm_box_add(win); + evas_object_size_hint_weight_set(hbx_2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(hbx_2, EINA_TRUE); + elm_box_pack_end(bx, hbx_2); + evas_object_show(hbx_2); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Horizontal mode"); + evas_object_smart_callback_add(ck, "changed", _horizontal_grid, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Always select"); + evas_object_smart_callback_add(ck, "changed", _always_select_change, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_gengrid_bounce_get(grid, &bounce, NULL); + elm_object_text_set(ck, "Bouncing"); + elm_check_state_set(ck, bounce); + evas_object_smart_callback_add(ck, "changed", _bouncing_change, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "Multi-selection"); + elm_check_state_set(ck, elm_gengrid_multi_select_get(grid)); + evas_object_smart_callback_add(ck, "changed", _multi_change, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + ck = elm_check_add(win); + elm_object_text_set(ck, "No selection"); + evas_object_smart_callback_add(ck, "changed", _no_sel_change, grid); + elm_box_pack_end(hbx_2, ck); + evas_object_show(ck); + + hbx_3 = elm_box_add(win); + evas_object_size_hint_weight_set(hbx_3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_box_horizontal_set(hbx_3, EINA_TRUE); + elm_box_pack_end(bx, hbx_3); + evas_object_show(hbx_3); + + elm_gengrid_align_get(grid, &h, &v); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Horiz. alignment"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, h); + elm_box_pack_end(hbx_3, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", _h_align_change_cb, grid); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Vert. alignment"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, v); + elm_box_pack_end(hbx_3, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", _v_align_change_cb, grid); + + elm_gengrid_align_get(grid, &h, &v); + + sl = elm_slider_add(win); + elm_object_text_set(sl, "Page rel. size"); + elm_slider_span_size_set(sl, 100); + evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_value_set(sl, h); + elm_box_pack_end(hbx_3, sl); + evas_object_show(sl); + + evas_object_smart_callback_add(sl, "changed", _page_change_cb, grid); + + gic.item_style = "default"; + gic.func.label_get = _grid_label_get; + gic.func.icon_get = _grid_icon_get; + gic.func.state_get = _grid_state_get; + gic.func.del = _grid_del; + + _append_bt_clicked(grid, NULL, NULL); + _append_bt_clicked(grid, NULL, NULL); + _append_bt_clicked(grid, NULL, NULL); + + evas_object_resize(win, 600, 600); + evas_object_show(win); + + elm_run(); + return 0; +} + +ELM_MAIN() diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 998d190279..2be3a4579b 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -4423,15 +4423,191 @@ extern "C" { EAPI void elm_table_pack_set(Evas_Object *subobj, int x, int y, int w, int h) EINA_ARG_NONNULL(1); EAPI void elm_table_pack_get(Evas_Object *subobj, int *x, int *y, int *w, int *h) EINA_ARG_NONNULL(1); - /* gengrid */ - typedef struct _Elm_Gengrid_Item_Class Elm_Gengrid_Item_Class; - typedef struct _Elm_Gengrid_Item_Class_Func Elm_Gengrid_Item_Class_Func; - typedef struct _Elm_Gengrid_Item Elm_Gengrid_Item; /**< Item of Elm_Gengrid. Sub-type of Elm_Widget_Item */ - typedef char *(*GridItemLabelGetFunc) (void *data, Evas_Object *obj, const char *part); - typedef Evas_Object *(*GridItemIconGetFunc) (void *data, Evas_Object *obj, const char *part); - typedef Eina_Bool (*GridItemStateGetFunc) (void *data, Evas_Object *obj, const char *part); - typedef void (*GridItemDelFunc) (void *data, Evas_Object *obj); + /** + * @defgroup Gengrid Gengrid (Generic grid) + * + * This widget aims to position objects in a grid layout while + * actually creating and rendering only the visible ones, using the + * same idea as the @ref Genlist "genlist": the user defines a @b + * class for each item, specifying functions that will be called at + * object creation, deletion, etc. When those items are selected by + * the user, a callback function is issued. Users may interact with + * a gengrid via the mouse (by clicking on items to select them and + * clicking on the grid's viewport and swiping to pan the whole + * view) or via the keyboard, navigating through item with the + * arrow keys. + * + * @section Gengrid_Items Gengrid items + * + * An item in a gengrid can have 0 or more text labels (they can be + * regular text or textblock Evas objects - that's up to the style + * to determine), 0 or more icons (which are simply objects + * swallowed into the gengrid item's theming Edje object) and 0 or + * more boolean states, which have the behavior left to the + * user to define. The Edje part names for each of these properties + * will be looked up, in the theme file for the gengrid, under the + * Edje (string) data items named @c "labels", @c "icons" and @c + * "states", respectively. For each of those properties, if more + * than one part is provided, they must have names listed separated + * by spaces in the data fields. For the default gengrid item + * theme, we have @b one label part (@c "elm.text"), @b two icon + * parts (@c "elm.swalllow.icon" and @c "elm.swallow.end") and @b + * no state parts. + * + * A gengrid item may be at one of several styles. Elementary + * provides one by default - "default", but this can be extended by + * system or application custom themes/overlays/extensions (see + * @ref Theme "themes" for more details). + * + * @section Gengrid_Item_Class Gengrid item classes + * + * In order to have the ability to add and delete items on the fly, + * gengrid implements a class (callback) system where the + * 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 an item is "realized" + * (i.e., created dynamically, while the user is scrolling the + * grid). All objects will simply be deleted when no longer needed + * with evas_object_del(). The #Elm_GenGrid_Item_Class structure + * contains the following members: + * - @c item_style - This is a constant string and simply defines + * the name of the item style. It @b must be specified and the + * default should be @c "default". + * - @c func.label_get - This function is called when an item + * object is actually created. The @c data parameter will point to + * the same data passed to elm_gengrid_item_append() and related + * item creation functions. The @c obj parameter is the gengrid + * object itself, while the @c part one is the name string of one + * of the existing text parts in the Edje group implementing the + * item's theme. This function @b must return a strdup'()ed string, + * as the caller will free() it when done. + * - @c func.icon_get - This function is called when an item object + * is actually created. The @c data parameter will point to the + * same data passed to elm_gengrid_item_append() and related item + * creation functions. The @c obj parameter is the gengrid object + * itself, while the @c part one is the name string of one of the + * existing (icon) swallow parts in the Edje group implementing the + * item's theme. It must return @c NULL, when no icon is desired, + * or a valid object handle, otherwise. The object will be deleted + * by the gengrid on its deletion or when the item is "unrealized". + * - @c func.state_get - This function is called when an item + * object is actually created. The @c data parameter will point to + * the same data passed to elm_gengrid_item_append() and related + * item creation functions. The @c obj parameter is the gengrid + * object itself, while the @c part one is the name string of one + * of the state parts in the Edje group implementing the item's + * theme. Return @c EINA_FALSE for false/off or @c EINA_TRUE for + * true/on. Gengrids will emit a signal to its theming Edje object + * with @c "elm,state,XXX,active" and @c "elm" as "emission" and + * "source" arguments, respectively, when the state is true (the + * default is false), where @c XXX is the name of the (state) part. + * - @c func.del - This is called when elm_gengrid_item_del() is + * called on an item or elm_gengrid_clear() is called on the + * gengrid. This is intended for use when gengrid items are + * deleted, so any data attached to the item (e.g. its data + * parameter on creation) can be deleted. + * + * @section Gengrid_Usage_Hints Usage hints + * + * If the user wants to have multiple items selected at the same + * time, elm_gengrid_multi_select_set() will permit it. If the + * gengrid is single-selection only (the default), then + * elm_gengrid_select_item_get() will return the selected item or + * @c NULL, if none is selected. If the gengrid is under + * multi-selection, then elm_gengrid_selected_items_get() will + * return a list (that is only valid as long as no items are + * modified (added, deleted, selected or unselected) of child items + * on a gengrid. + * + * If an item changes (internal (boolean) state, label or icon + * changes), then use elm_gengrid_item_update() to have gengrid + * update the item with the new state. A gengrid will re-"realize" + * the item, thus calling the functions in the + * #Elm_Gengrid_Item_Class set for that item. + * + * 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 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. + * + * Grid cells will only have their selection smart callbacks called + * when firstly getting selected. Any further clicks will do + * nothing, unless you enable the "always select mode", with + * elm_gengrid_always_select_mode_set(), thus making every click to + * issue selection callbacks. elm_gengrid_no_select_mode_set() will + * turn off the ability to select items entirely in the widget and + * they will neither appear selected nor call the selection smart + * callbacks. + * + * Remember that you can create new styles and add your own theme + * augmentation per application with elm_theme_extension_add(). If + * you 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. + * + * @section Gengrid_Smart_Events Gengrid smart events + * + * Smart events that you can add callbacks for are: + * - @c "clicked,double" - The user has double-clicked or pressed + * enter on an item. The @c event_info parameter is the gengrid + * item that was double-clicked. + * - @c "selected" - The user has made an item selected. The + * @c event_info parameter is the gengrid item that was selected. + * - @c "unselected" - The user has made an item unselected. The + * @c event_info parameter is the gengrid item that was unselected. + * - @c "realized" - This is called when the item in the gengrid + * has its implementing Evas object instantiated, de facto. @c + * event_info is the gengrid item that was created. The object + * may be deleted at any time, so it is highly advised to the + * caller @b not to use the object pointer returned from + * elm_gengrid_item_object_get(), because it may point to freed + * objects. + * - @c "unrealized" - This is called when the implementing Evas + * object for this item is deleted. @c event_info is the gengrid + * item that was deleted. + * - @c "changed" - Called when an item is added, removed, resized + * or moved and when the gengrid is resized or gets "horizontal" + * property changes. + * - @c "drag,start,up" - Called when the item in the gengrid has + * been dragged (not scrolled) up. + * - @c "drag,start,down" - Called when the item in the gengrid has + * been dragged (not scrolled) down. + * - @c "drag,start,left" - Called when the item in the gengrid has + * been dragged (not scrolled) left. + * - @c "drag,start,right" - Called when the item in the gengrid has + * been dragged (not scrolled) right. + * - @c "drag,stop" - Called when the item in the gengrid has + * stopped being dragged. + * - @c "drag" - Called when the item in the gengrid is being + * dragged. + * - @c "scroll" - called when the content has been scrolled + * (moved). + * - @c "scroll,drag,start" - called when dragging the content has + * started. + * - @c "scroll,drag,stop" - called when dragging the content has + * stopped. + * + * List of gendrid examples: + * @li @ref gengrid_example + */ + typedef struct _Elm_Gengrid_Item_Class Elm_Gengrid_Item_Class; /**< Gengrid item class definition structs */ + typedef struct _Elm_Gengrid_Item_Class_Func Elm_Gengrid_Item_Class_Func; /**< Class functions for gengrid item classes. */ + typedef struct _Elm_Gengrid_Item Elm_Gengrid_Item; /**< Gengrid item handles */ + typedef char *(*GridItemLabelGetFunc) (void *data, Evas_Object *obj, const char *part); /**< Label fetching class function for gengrid item classes. */ + typedef Evas_Object *(*GridItemIconGetFunc) (void *data, Evas_Object *obj, const char *part); /**< Icon fetching class function for gengrid item classes. */ + typedef Eina_Bool (*GridItemStateGetFunc) (void *data, Evas_Object *obj, const char *part); /**< State fetching class function for gengrid item classes. */ + typedef void (*GridItemDelFunc) (void *data, Evas_Object *obj); /**< Deletion class function for gengrid item classes. */ + + /** + * @struct _Elm_Gengrid_Item_Class + * + * Gengrid item class definition. See @ref Gengrid_Item_Class for + * field details. + */ struct _Elm_Gengrid_Item_Class { const char *item_style; @@ -4442,93 +4618,924 @@ extern "C" { GridItemStateGetFunc state_get; GridItemDelFunc del; } func; - }; + }; /**< #Elm_Gengrid_Item_Class member definitions */ + /** + * Add a new gengrid widget to the given parent Elementary + * (container) object + * + * @param parent The parent object + * @return a new gengrid widget handle or @c NULL, on errors + * + * This function inserts a new gengrid widget on the canvas. + * + * @see elm_gengrid_item_size_set() + * @see elm_gengrid_horizontal_set() + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_del() + * @see elm_gengrid_clear() + * + * @ingroup Gengrid + */ EAPI Evas_Object *elm_gengrid_add(Evas_Object *parent) EINA_ARG_NONNULL(1); + + /** + * Set the size for the items of a given gengrid widget + * + * @param obj The gengrid object. + * @param w The items' width. + * @param h The items' height; + * + * A gengrid, after creation, has still no information on the size + * to give to each of its cells. So, you most probably will end up + * with squares one @ref Fingers "finger" wide, the default + * size. Use this function to force a custom size for you items, + * making them as big as you wish. + * + * @see elm_gengrid_item_size_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) EINA_ARG_NONNULL(1); + + /** + * Get the size set for the items of a given gengrid widget + * + * @param obj The gengrid object. + * @param w Pointer to a variable where to store the items' width. + * @param h Pointer to a variable where to store the items' height. + * + * @note Use @c NULL pointers on the size values you're not + * interested in: they'll be ignored by the function. + * + * @see elm_gengrid_item_size_get() for more details + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) EINA_ARG_NONNULL(1); + + /** + * Set the items grid's alignment within a given gengrid widget + * + * @param obj The gengrid object. + * @param align_x Alignment in the horizontal axis (0 <= align_x <= 1). + * @param align_y Alignment in the vertical axis (0 <= align_y <= 1). + * + * This sets the alignment of the whole grid of items of a gengrid + * within its given viewport. By default, those values are both + * 0.5, meaning that the gengrid will have its items grid placed + * exactly in the middle of its viewport. + * + * @note If given alignment values are out of the cited ranges, + * they'll be changed to the nearest boundary values on the valid + * ranges. + * + * @see elm_gengrid_align_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_align_set(Evas_Object *obj, double align_x, double align_y) EINA_ARG_NONNULL(1); + + /** + * Get the items grid's alignment values within a given gengrid + * widget + * + * @param obj The gengrid object. + * @param align_x Pointer to a variable where to store the + * horizontal alignment. + * @param align_y Pointer to a variable where to store the vertical + * alignment. + * + * @note Use @c NULL pointers on the alignment values you're not + * interested in: they'll be ignored by the function. + * + * @see elm_gengrid_align_set() for more details + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_align_get(const Evas_Object *obj, double *align_x, double *align_y) EINA_ARG_NONNULL(1); + /** + * Set whether a given gengrid widget is or not able have items + * @b reordered + * + * @param obj The gengrid object + * @param reorder_mode Use @c EINA_TRUE to turn reoderding on, + * @c EINA_FALSE to turn it off + * + * If a gengrid is set to allow reordering, a click held for more + * than 0.5 over a given item will highlight it specially, + * signalling the gengrid has entered the reordering state. From + * that time on, the user will be able to, while still holding the + * mouse button down, move the item freely in the gengrid's + * viewport, replacing to said item to the locations it goes to. + * The replacements will be animated and, whenever the user + * releases the mouse button, the item being replaced gets a new + * definitive place in the grid. + * + * @see elm_gengrid_reorder_mode_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_reorder_mode_set(Evas_Object *obj, Eina_Bool reorder_mode) EINA_ARG_NONNULL(1); + + /** + * Get whether a given gengrid widget is or not able have items + * @b reordered + * + * @param obj The gengrid object + * @return @c EINA_TRUE, if reoderding is on, @c EINA_FALSE if it's + * off + * + * @see elm_gengrid_reorder_mode_set() for more details + * + * @ingroup Gengrid + */ EAPI Eina_Bool elm_gengrid_reorder_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + + /** + * Append a new item in a given gengrid widget. + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param func Convenience function called when the item is + * selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This adds an item to the beginning of the gengrid. + * + * @see elm_gengrid_item_prepend() + * @see elm_gengrid_item_insert_before() + * @see elm_gengrid_item_insert_after() + * @see elm_gengrid_item_del() + * + * @ingroup Gengrid + */ + EAPI Elm_Gengrid_Item *elm_gengrid_item_append(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); + + /** + * Prepend a new item in a given gengrid widget. + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param func Convenience function called when the item is + * selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This adds an item to the end of the gengrid. + * + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_insert_before() + * @see elm_gengrid_item_insert_after() + * @see elm_gengrid_item_del() + * + * @ingroup Gengrid + */ + EAPI Elm_Gengrid_Item *elm_gengrid_item_prepend(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); + + /** + * Insert an item before another in a gengrid widget + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param relative The item to place this new one before. + * @param func Convenience function called when the item is + * selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This inserts an item before another in the gengrid. + * + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_prepend() + * @see elm_gengrid_item_insert_after() + * @see elm_gengrid_item_del() + * + * @ingroup Gengrid + */ + EAPI Elm_Gengrid_Item *elm_gengrid_item_insert_before(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Elm_Gengrid_Item *relative, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); + + /** + * Insert an item after another in a gengrid widget + * + * @param obj The gengrid object. + * @param gic The item class for the item. + * @param data The item data. + * @param relative The item to place this new one after. + * @param func Convenience function called when the item is + * selected. + * @param func_data Data to be passed to @p func. + * @return A handle to the item added or @c NULL, on errors. + * + * This inserts an item after another in the gengrid. + * + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_prepend() + * @see elm_gengrid_item_insert_after() + * @see elm_gengrid_item_del() + * + * @ingroup Gengrid + */ + EAPI Elm_Gengrid_Item *elm_gengrid_item_insert_after(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Elm_Gengrid_Item *relative, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); + + EAPI Elm_Gengrid_Item *elm_gengrid_item_sorted_insert(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); + + EAPI Elm_Gengrid_Item *elm_gengrid_item_direct_sorted_insert(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data); + + /** + * Set whether items on a given gengrid widget are to get their + * selection callbacks issued for @b every subsequent selection + * click on them or just for the first click. + * + * @param obj The gengrid object + * @param always_select @c EINA_TRUE to make items "always + * selected", @c EINA_FALSE, otherwise + * + * By default, grid items will only call their selection callback + * function when firstly getting selected, any subsequent further + * clicks will do nothing. With this call, you make those + * subsequent clicks also to issue the selection callbacks. + * + * @note Double clicks will @b always be reported on items. + * + * @see elm_gengrid_always_select_mode_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select) EINA_ARG_NONNULL(1); + + /** + * Get whether items on a given gengrid widget have their selection + * callbacks issued for @b every subsequent selection click on them + * or just for the first click. + * + * @param obj The gengrid object. + * @return @c EINA_TRUE if the gengrid items are "always selected", + * @c EINA_FALSE, otherwise + * + * @see elm_gengrid_always_select_mode_set() for more details + * + * @ingroup Gengrid + */ EAPI Eina_Bool elm_gengrid_always_select_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + + /** + * Set whether items on a given gengrid widget can be selected or not. + * + * @param obj The gengrid object + * @param no_select @c EINA_TRUE to make items selectable, + * @c EINA_FALSE otherwise + * + * This will make items in @obj selectable or not. In the latter + * case, any user interacion on the gendrid items will neither make + * them appear selected nor them call their selection callback + * functions. + * + * @see elm_gengrid_no_select_mode_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select) EINA_ARG_NONNULL(1); + + /** + * Get whether items on a given gengrid widget can be selected or + * not. + * + * @param obj The gengrid object + * @return @c EINA_TRUE, if items are selectable, @c EINA_FALSE + * otherwise + * + * @see elm_gengrid_no_select_mode_set() for more details + * + * @ingroup Gengrid + */ EAPI Eina_Bool elm_gengrid_no_select_mode_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + + /** + * Enable or disable multi-selection in a given gengrid widget + * + * @param obj The gengrid object. + * @param multi @c EINA_TRUE, to enable multi-selection, + * @c EINA_FALSE to disable it. + * + * Multi-selection is the ability for one to have @b more than one + * item selected, on a given gengrid, simultaneously. When it is + * enabled, a sequence of clicks on different items will make them + * all selected, progressively. A click on an already selected item + * will unselect it. If interecting via the keyboard, + * multi-selection is enabled while holding the "Shift" key. + * + * @note By default, multi-selection is @b disabled on gengrids + * + * @see elm_gengrid_multi_select_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_multi_select_set(Evas_Object *obj, Eina_Bool multi) EINA_ARG_NONNULL(1); + + /** + * Get whether multi-selection is enabled or disabled for a given + * gengrid widget + * + * @param obj The gengrid object. + * @return @c EINA_TRUE, if multi-selection is enabled, @c + * EINA_FALSE otherwise + * + * @see elm_gengrid_multi_select_set() for more details + * + * @ingroup Gengrid + */ EAPI Eina_Bool elm_gengrid_multi_select_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + + /** + * Enable or disable bouncing effect for a given gengrid widget + * + * @param obj The gengrid object + * @param h_bounce @c EINA_TRUE, to enable @b horizontal bouncing, + * @c EINA_FALSE to disable it + * @param v_bounce @c EINA_TRUE, to enable @b vertical bouncing, + * @c EINA_FALSE to disable it + * + * The bouncing effect occurs whenever one reaches the gengrid's + * edge's while panning it -- it will scroll past its limits a + * little bit and return to the edge again, in a animated for, + * automatically. + * + * @note By default, gengrids have bouncing enabled on both axis + * + * @see elm_gengrid_bounce_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce) EINA_ARG_NONNULL(1); + + /** + * Get whether bouncing effects are enabled or disabled, for a + * given gengrid widget, on each axis + * + * @param obj The gengrid object + * @param h_bounce Pointer to a variable where to store the + * horizontal bouncing flag. + * @param v_bounce Pointer to a variable where to store the + * vertical bouncing flag. + * + * @see elm_gengrid_bounce_set() for more details + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce) EINA_ARG_NONNULL(1); + + /** + * Set a given gengrid widget's scrolling page size, relative to + * its viewport size. + * + * @param obj The gengrid object + * @param h_pagerel The horizontal page (relative) size + * @param v_pagerel The vertical page (relative) size + * + * The gengrid's scroller is capable of binding scrolling by the + * user to "pages". It means that, while scrolling and, specially + * after releasing the mouse button, the grid will @b snap to the + * nearest displaying page's area. When page sizes are set, the + * grid's continuous content area is split into (equal) page sized + * pieces. + * + * This function sets the size of a page relatively to the + * viewport dimensions of the gengrid, for each axis. A value + * @c 1.0 means "the exact viewport's size", in that axis, while @c + * 0.0 turns paging off in that axis. Likewise, @c 0.5 means "half + * a viewport". Sane usable values are, than, between @c 0.0 and @c + * 1.0. Values beyond those will make it behave behave + * inconsistently. If you only want one axis to snap to pages, use + * the value @c 0.0 for the other one. + * + * There is a function setting page size values in @b absolute + * values, too -- elm_gengrid_page_size_set(). Naturally, its use + * is mutually exclusive to this one. + * + * @see elm_gengrid_page_relative_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel) EINA_ARG_NONNULL(1); + + /** + * Get a given gengrid widget's scrolling page size, relative to + * its viewport size. + * + * @param obj The gengrid object + * @param h_pagerel Pointer to a variable where to store the + * horizontal page (relative) size + * @param v_pagerel Pointer to a variable where to store the + * vertical page (relative) size + * + * @see elm_gengrid_page_relative_set() for more details + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel) EINA_ARG_NONNULL(1); + + /** + * Set a given gengrid widget's scrolling page size + * + * @param obj The gengrid object + * @param h_pagerel The horizontal page size, in pixels + * @param v_pagerel The vertical page size, in pixels + * + * The gengrid's scroller is capable of binding scrolling by the + * user to "pages". It means that, while scrolling and, specially + * after releasing the mouse button, the grid will @b snap to the + * nearest displaying page's area. When page sizes are set, the + * grid's continuous content area is split into (equal) page sized + * pieces. + * + * This function sets the size of a page of the gengrid, in pixels, + * for each axis. Sane usable values are, between @c 0 and the + * dimensions of @p obj, for each axis. Values beyond those will + * make it behave behave inconsistently. If you only want one axis + * to snap to pages, use the value @c 0 for the other one. + * + * There is a function setting page size values in @b relative + * values, too -- elm_gengrid_page_relative_set(). Naturally, its + * use is mutually exclusive to this one. + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize) EINA_ARG_NONNULL(1); + + /** + * Set for what direction a given gengrid widget will expand while + * placing its items. + * + * @param obj The gengrid object. + * @param setting @c EINA_TRUE to make the gengrid expand + * horizontally, @c EINA_FALSE to expand vertically. + * + * When in "horizontal mode" (@c EINA_TRUE), items will be placed + * in @b columns, from top to bottom and, when the space for a + * column is filled, another one is started on the right, thus + * expanding the grid horizontally. When in "vertical mode" + * (@c EINA_FALSE), though, items will be placed in @b rows, from left + * to right and, when the space for a row is filled, another one is + * started below, thus expanding the grid vertically. + * + * @see elm_gengrid_horizontal_get() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_horizontal_set(Evas_Object *obj, Eina_Bool setting) EINA_ARG_NONNULL(1); + + /** + * Get for what direction a given gengrid widget will expand while + * placing its items. + * + * @param obj The gengrid object. + * @return @c EINA_TRUE, if @p obj is set to expand horizontally, + * @c EINA_FALSE if it's set to expand vertically. + * + * @see elm_gengrid_horizontal_set() for more detais + * + * @ingroup Gengrid + */ EAPI Eina_Bool elm_gengrid_horizontal_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + /** + * Get the first item in the gengrid + * + * This returns the first item in the list. + * + * @param obj The gengrid object + * @return The first item, or NULL if none + * + * @ingroup Gengrid + */ EAPI Elm_Gengrid_Item *elm_gengrid_first_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + + /** + * Get the last item in the gengrid + * + * This returns the last item in the list. + * + * @return The last item, or NULL if none + * + * @ingroup Gengrid + */ EAPI Elm_Gengrid_Item *elm_gengrid_last_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + /** + * Get the next item in the gengrid + * + * This returns the item after the item @p item. + * + * @param item The item + * @return The item after @p item, or NULL if none + * + * @ingroup Gengrid + */ EAPI Elm_Gengrid_Item *elm_gengrid_item_next_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Get the previous item in the gengrid + * + * This returns the item before the item @p item. + * + * @param item The item + * @return The item before @p item, or NULL if none + * + * @ingroup Gengrid + */ EAPI Elm_Gengrid_Item *elm_gengrid_item_prev_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Get the gengrid object from an item + * + * This returns the gengrid object itself that an item belongs to. + * + * @param item The item + * @return The gengrid object + * + * @ingroup Gengrid + */ EAPI Evas_Object *elm_gengrid_item_gengrid_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Remove an item from the Gengrid. + * + * @param item The item to be removed. + * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise. + * + * @see elm_gengrid_clear() to remove all items of the Gengrid. + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_del(Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Update the contents of an item + * + * This updates an item by calling all the item class functions again + * to get the icons, labels and states. Use this when the original + * item data has changed and the changes are desired to be reflected. + * + * @param item The item + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_update(Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); EAPI const Elm_Gengrid_Item_Class *elm_gengrid_item_item_class_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); EAPI void elm_gengrid_item_item_class_set(Elm_Gengrid_Item *item, const Elm_Gengrid_Item_Class *gic) EINA_ARG_NONNULL(1, 2); + + /** + * Returns the data associated to an item + * + * This returns the data value passed on the elm_gengrid_item_append() + * and related item addition calls. + * + * @param item The Gengrid item. + * @return the data associated to this item. + * + * @see elm_gengrid_item_append() + * @see elm_gengrid_item_object_get() + * + * @ingroup Gengrid + */ EAPI void *elm_gengrid_item_data_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * 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 + * elm_gengrid_item_update() so the item will be updated to reflect + * the new data. + * + * @param item The item + * @param data The new data pointer to set + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_data_set(Elm_Gengrid_Item *item, const void *data) EINA_ARG_NONNULL(1); + + /** + * Get the item's coordinates. + * + * This returns the logical position of the item whithin the Gengrid. + * + * @param item The Gengrid item. + * @param x The x-axis coordinate pointer. + * @param y The y-axis coordinate pointer. + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_pos_get(const Elm_Gengrid_Item *item, unsigned int *x, unsigned int *y) EINA_ARG_NONNULL(1); + + /** + * Set the selected state of an item. + * + * This sets the selected state of an item. If multi-select is not + * enabled and selected is EINA_TRUE, previously selected items are + * unselected. + * + * @param item The item + * @param selected The selected state. + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_selected_set(Elm_Gengrid_Item *item, Eina_Bool selected) EINA_ARG_NONNULL(1); + + /** + * Get the selected state of an item. + * + * This gets the selected state of an item (1 selected, 0 not selected). + * + * @param item The item + * @return The selected state + * + * @ingroup Gengrid + */ EAPI Eina_Bool elm_gengrid_item_selected_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Get the real evas object of the Gengrid item + * + * This returns the actual evas object used for the specified Gengrid + * item. This may be NULL as it may not be created, and may be + * deleted at any time by Gengrid. Do not modify this object (move, + * resize, show, hide etc.) as Gengrid is controlling it. This + * function is for querying, emitting custom signals or hooking lower + * level callbacks for events. Do not delete this object under any + * circumstances. + * + * @param item The Gengrid item. + * @return the evas object associated to this item. + * + * @see elm_gengrid_item_data_get() + * + * @ingroup Gengrid + */ EAPI const Evas_Object *elm_gengrid_item_object_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Show the given item + * + * This causes gengrid to jump to the given item @p item and show it + * (by scrolling), if it is not fully visible. + * + * @param item The item + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_show(Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Bring in the given item + * + * This causes gengrig to jump to the given item @p item and show it + * (by scrolling), if it is not fully visible. This may use animation + * to do so and take a period of time + * + * @param item The item + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_bring_in(Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * 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 + * disabled, 0 not disabled). + * + * @param item The item + * @param disabled The disabled state + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_disabled_set(Elm_Gengrid_Item *item, Eina_Bool disabled) EINA_ARG_NONNULL(1); + + /** + * Get the disabled state of an item. + * + * This gets the disabled state of the given item. + * + * @param item The item + * @return The disabled state + * + * @ingroup Gengrid + */ EAPI Eina_Bool elm_gengrid_item_disabled_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + /** + * Set the text to be shown in the gengrid item. + * + * @param item Target item + * @param text The text to set in the content + * + * Setup the text as tooltip to object. The item can have only one + * tooltip, so any previous tooltip data is removed. + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_tooltip_text_set(Elm_Gengrid_Item *item, const char *text) EINA_ARG_NONNULL(1); + + /** + * Set the content to be shown in the tooltip item + * + * Setup the tooltip to item. The item can have only one tooltip, so + * any previous tooltip data is removed. @p func(with @p data) will be + * called every time that need show the tooltip and it should return a + * valid Evas_Object. This object is then managed fully by tooltip + * system and is deleted when the tooltip is gone. + * + * @param item the gengrid item being attached a tooltip. + * @param func the function used to create the tooltip contents. + * @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 @an item + * dies. This callback receives as the first parameter the + * given @a data, and @c event_info is the item. + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_tooltip_content_cb_set(Elm_Gengrid_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb) EINA_ARG_NONNULL(1); + + /** + * Unset tooltip from item + * + * @param item gengrid item to remove previously set tooltip. + * + * Remove tooltip from item. The callback provided as del_cb to + * elm_gengrid_item_tooltip_content_cb_set() will be called to notify + * it is not used anymore. + * + * @see elm_gengrid_item_tooltip_content_cb_set() + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_tooltip_unset(Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Sets a different style for this item tooltip. + * + * @note before you set a style you should define a tooltip with + * elm_gengrid_item_tooltip_content_cb_set() or + * elm_gengrid_item_tooltip_text_set() + * + * @param item gengrid item with tooltip already set. + * @param style the theme style to use (default, transparent, ...) + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_tooltip_style_set(Elm_Gengrid_Item *item, const char *style) EINA_ARG_NONNULL(1); + + /** + * Get the style for this item tooltip. + * + * @param item gengrid item with tooltip already set. + * @return style the theme style in use, defaults to "default". If the + * object does not have a tooltip set, then NULL is returned. + * + * @ingroup Gengrid + */ EAPI const char *elm_gengrid_item_tooltip_style_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Set the cursor to be shown when mouse is over the gengrid item + * + * @param item Target item + * @param cursor the cursor name to be used. + * + * @see elm_object_cursor_set() + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_cursor_set(Elm_Gengrid_Item *item, const char *cursor) EINA_ARG_NONNULL(1); + + /** + * Get the cursor to be shown when mouse is over the gengrid item + * + * @param item gengrid item with cursor already set. + * @return the cursor name. + * + * @ingroup Gengrid + */ EAPI const char *elm_gengrid_item_cursor_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Unset the cursor to be shown when mouse is over the gengrid item + * + * @param item Target item + * + * @see elm_object_cursor_unset() + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_cursor_unset(Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Sets a different style for this item cursor. + * + * @note before you set a style you should define a cursor with + * elm_gengrid_item_cursor_set() + * + * @param item gengrid item with cursor already set. + * @param style the theme style to use (default, transparent, ...) + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_cursor_style_set(Elm_Gengrid_Item *item, const char *style) EINA_ARG_NONNULL(1); + + /** + * Get the style for this item cursor. + * + * @param item gengrid item with cursor already set. + * @return style the theme style in use, defaults to "default". If the + * object does not have a cursor set, then NULL is returned. + * + * @ingroup Gengrid + */ EAPI const char *elm_gengrid_item_cursor_style_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); + + /** + * Set if the cursor set should be searched on the theme or should use + * the provided by the engine, only. + * + * @note before you set if should look on theme you should define a + * cursor with elm_object_cursor_set(). By default it will only look + * for cursors provided by the engine. + * + * @param item widget item with cursor already set. + * @param engine_only boolean to define it cursors should be looked + * only between the provided by the engine or searched on widget's + * theme as well. + * + * @ingroup Gengrid + */ EAPI void elm_gengrid_item_cursor_engine_only_set(Elm_Gengrid_Item *item, Eina_Bool engine_only) EINA_ARG_NONNULL(1); + + /** + * Get the cursor engine only usage for this item cursor. + * + * @param item widget item with cursor already set. + * @return engine_only boolean to define it cursors should be looked + * only between the provided by the engine or searched on widget's + * theme as well. If the object does not have a cursor set, then + * EINA_FALSE is returned. + * + * @ingroup Gengrid + */ EAPI Eina_Bool elm_gengrid_item_cursor_engine_only_get(const Elm_Gengrid_Item *item) EINA_ARG_NONNULL(1); - EAPI void elm_gengrid_clear(Evas_Object *obj) EINA_ARG_NONNULL(1); - EAPI Elm_Gengrid_Item *elm_gengrid_selected_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); - EAPI const Eina_List *elm_gengrid_selected_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); - - EAPI Elm_Gengrid_Item *elm_gengrid_item_append(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); - EAPI Elm_Gengrid_Item *elm_gengrid_item_prepend(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); - EAPI Elm_Gengrid_Item *elm_gengrid_item_insert_before(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Elm_Gengrid_Item *relative, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); - EAPI Elm_Gengrid_Item *elm_gengrid_item_insert_after(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Elm_Gengrid_Item *relative, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); - EAPI Elm_Gengrid_Item *elm_gengrid_item_sorted_insert(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data) EINA_ARG_NONNULL(1); - EAPI Elm_Gengrid_Item *elm_gengrid_item_direct_sorted_insert(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, const void *data, Eina_Compare_Cb comp, Evas_Smart_Cb func, const void *func_data); - /* smart callbacks called: + /** + * Remove all items from a given gengrid widget * - * selected - User has selected an item. - * unselected - User has unselected an item. - * clicked,double - User has double-clicked or pressed enter on an item. - * realized - An evas object for an item was built. - * unrealized - An evas object for an item was deleted. - * changed - An item has been added, removed, resized or moved, - * or gengrid has been resized or horizontal property has been changed. - * scroll - the content has been scrolled (moved). - * "scroll,drag,start" - dragging the contents around has started. - * "scroll,drag,stop" - dragging the contents around has stopped. - * drag - Gengrid is being dragged. - * "drag,start,up" - Gengrid has been dragged (not scrolled) up. - * "drag,start,down" - Gengrid has been dragged (not scrolled) down. - * "drag,start,left" - Gengrid has been dragged (not scrolled) left. - * "drag,start,rigth" - Gengrid has been dragged (nto scrolled) right. - * "drag,stop" - Gengrid is not being dragged. + * @param obj The gengrid object. + * + * This removes (and deletes) all items in @p obj, leaving it + * empty. + * + * @see elm_gengrid_item_del(), to remove just one item. + * + * @ingroup Gengrid */ + EAPI void elm_gengrid_clear(Evas_Object *obj) EINA_ARG_NONNULL(1); + + /** + * Get the selected item in the Gengrid + * + * This gets the selected item in the Gengrid (if multi-select is + * enabled only the first item in the list is selected - which is not + * very useful, so see elm_gengrid_selected_items_get() for when + * multi-select is used). + * + * If no item is selected, NULL is returned. + * + * @param obj The Gengrid object. + * @return The selected item, or NULL if none. + * + * @ingroup Gengrid + */ + EAPI Elm_Gengrid_Item *elm_gengrid_selected_item_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + + /** + * Get a list of selected items in the Gengrid. + * + * This returns a list of the selected items. This list pointer is + * only valid so long as no items are selected or unselected (or + * unselected implictly by deletion). The list contains + * Elm_Gengrid_Item pointers. + * + * @param obj The Gengrid object. + * @return The list of selected items, or NULL if none are selected. + * + * @ingroup Gengrid + */ + EAPI const Eina_List *elm_gengrid_selected_items_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); /** * @defgroup Clock Clock diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index 702e7fb8ce..b1e8f48890 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -2,141 +2,7 @@ #include #include "elm_priv.h" -/** - * @defgroup Gengrid Gengrid - * - * This widget aims to position objects in a grid layout while - * actually building only the visible ones, using the same idea as - * genlist: the user define a class for each item, specifying - * functions that will be called at object creation and deletion. - * - * A item in the Gengrid can have 0 or more text labels (they can be - * regular text or textblock - that's up to the style to determine), 0 - * or more icons (which are simply objects swallowed into the Gengrid - * item) and 0 or more boolean states that can be used for check, - * radio or other indicators by the edje theme style. A item may be - * one of several styles (Elementary provides 1 by default - - * "default", but this can be extended by system or application custom - * themes/overlays/extensions). - * - * In order to implement the ability to add and delete items on the - * fly, Gengrid implements a class/callback system where the - * 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 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: - * - * item_style - This is a constant string and simply defines the name - * of the item style. It must be specified and the default should be - * "default". - * - * func.label_get - This function is called when an actual item object - * is created. The data parameter is the one passed to - * elm_gengrid_item_append() and related item creation functions. The - * obj parameter is the Gengrid object and the part parameter is the - * string name of the text part in the edje design that is listed as - * one of the possible labels that can be set. This function must - * return a strdup'()ed string as the caller will free() it when done. - * - * func.icon_get - This function is called when an actual item object - * is created. The data parameter is the one passed to - * elm_gengrid_item_append() and related item creation functions. The - * obj parameter is the Gengrid object and the part parameter is the - * string name of the icon part in the edje design that is listed as - * one of the possible icons that can be set. This must return NULL - * for no object or a valid object. The object will be deleted by - * Gengrid on shutdown or when the item is unrealized. - * - * func.state_get - This function is called when an actual item object - * is created. The data parameter is the one passed to - * elm_gengrid_item_append() and related item creation functions. The - * obj parameter is the Gengrid object and the part parameter is the - * string name of th state part in the edje design that is listed as - * one of the possible states that can be set. Return 0 for false and - * 1 for true. Gengrid will emit a signal to the edje object with - * "elm,state,XXX,active" "elm" when true (the default is false), - * where XXX is the name of the part. - * - * func.del - This is called when elm_gengrid_item_del() is called on - * 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. - * - * If the application wants multiple items to be able to be selected, - * elm_gengrid_multi_select_set() can enable this. If the Gengrid is - * single-selection only (the default), then - * elm_gengrid_select_item_get() will return the selected item, if - * any, or NULL if none is selected. If the Gengrid is multi-select - * then elm_gengrid_selected_items_get() will return a list (that is - * only valid as long as no items are modified (added, deleted, - * selected or unselected). - * - * 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 an item use - * elm_gengrid_item_selected_set(). To get its selected state use - * 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. - * - * Cells will only call their selection func and callback when first - * becoming selected. Any further clicks will do nothing, unless you - * enable always select with - * elm_gengrid_always_select_mode_set(). This means event if selected, - * every click will make the selected callbacks be called. - * elm_gengrid_no_select_mode_set() will turn off the ability to - * select items entirely and they will neither appear selected nor - * call selected callback function. - * - * Remember that you can create new styles and add your own theme - * augmentation per application with elm_theme_extension_add(). If you - * 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 - * 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. - * "unselected" - The user has made an item unselected. The event_info - * parameter is the Gengrid item that was unselected. - * "realized" - This is called when the item in the Gengrid is created - * 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 - * 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. - * "changed" - Called when an item is added, removed, resized or moved - * and when gengrid is resized or horizontal property changes. - * "drag,start,up" - Called when the item in the Gengrid has been - * dragged (not scrolled) up. - * "drag,start,down" - Called when the item in the Gengrid has been - * dragged (not scrolled) down. - * "drag,start,left" - Called when the item in the Gengrid has been - * dragged (not scrolled) left. - * "drag,start,right" - Called when the item in the Gengrid has been - * dragged (not scrolled) right. - * "drag,stop" - Called when the item in the Gengrid has stopped being - * dragged. - * "drag" - Called when the item in the Gengrid is being dragged. - * "scroll" - called when the content has been scrolled (moved). - * "scroll,drag,start" - called when dragging the content has started. - * "scroll,drag,stop" - called when dragging the content has stopped. - * - * -- +/* -- * TODO: * Handle non-homogeneous objects too. */ @@ -1748,20 +1614,6 @@ _elm_gengrid_item_compare(const void *data, const void *data1) return _elm_gengrid_item_compare_cb(item, item1); } -/** - * Add a new Gengrid object. - * - * @param parent The parent object. - * @return The new object or NULL if it cannot be created. - * - * @see elm_gengrid_item_size_set() - * @see elm_gengrid_horizontal_set() - * @see elm_gengrid_item_append() - * @see elm_gengrid_item_del() - * @see elm_gengrid_clear() - * - * @ingroup Gengrid - */ EAPI Evas_Object * elm_gengrid_add(Evas_Object *parent) { @@ -1841,17 +1693,6 @@ elm_gengrid_add(Evas_Object *parent) return obj; } -/** - * Set the size for the item of the Gengrid. - * - * @param obj The Gengrid object. - * @param w The item's width. - * @param h The item's height; - * - * @see elm_gengrid_item_size_get() - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_size_set(Evas_Object *obj, Evas_Coord w, @@ -1867,17 +1708,6 @@ elm_gengrid_item_size_set(Evas_Object *obj, wd->calc_job = ecore_job_add(_calc_job, wd); } -/** - * Get the size of the item of the Gengrid. - * - * @param obj The Gengrid object. - * @param w Pointer to the item's width. - * @param h Pointer to the item's height. - * - * @see elm_gengrid_item_size_get() - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_size_get(const Evas_Object *obj, Evas_Coord *w, @@ -1890,17 +1720,6 @@ elm_gengrid_item_size_get(const Evas_Object *obj, if (h) *h = wd->item_height; } -/** - * Set item's alignment within the scroller. - * - * @param obj The Gengrid object. - * @param align_x The x alignment (0 <= x <= 1). - * @param align_y The y alignment (0 <= y <= 1). - * - * @see elm_gengrid_align_get() - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_align_set(Evas_Object *obj, double align_x, @@ -1927,17 +1746,6 @@ elm_gengrid_align_set(Evas_Object *obj, evas_object_smart_calculate(wd->pan_smart); } -/** - * Get the alignenment set for the Gengrid object. - * - * @param obj The Gengrid object. - * @param align_x Pointer to x alignenment. - * @param align_y Pointer to y alignenment. - * - * @see elm_gengrid_align_set() - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_align_get(const Evas_Object *obj, double *align_x, @@ -1949,23 +1757,6 @@ elm_gengrid_align_get(const Evas_Object *obj, if (align_y) *align_y = wd->align_y; } -/** - * Add item to the end of the Gengrid. - * - * @param obj The Gengrid object. - * @param gic The item class for the item. - * @param data The item data. - * @param func Convenience function called when item is selected. - * @param func_data Data passed to @p func above. - * @return A handle to the item added or NULL if not possible. - * - * @see elm_gengrid_item_prepend() - * @see elm_gengrid_item_insert_before() - * @see elm_gengrid_item_insert_after() - * @see elm_gengrid_item_del() - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_item_append(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, @@ -1988,25 +1779,6 @@ elm_gengrid_item_append(Evas_Object *obj, return item; } -/** - * Add item at start of the Gengrid. - * - * This adds an item to the beginning of the grid. - * - * @param obj The Gengrid object. - * @param gic The item class for the item. - * @param data The item data. - * @param func Convenience function called when item is selected. - * @param func_data Data passed to @p func above. - * @return A handle to the item added or NULL if not possible. - * - * @see elm_gengrid_item_append() - * @see elm_gengrid_item_insert_before() - * @see elm_gengrid_item_insert_after() - * @see elm_gengrid_item_del() - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_item_prepend(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, @@ -2029,26 +1801,6 @@ elm_gengrid_item_prepend(Evas_Object *obj, return item; } -/** - * Insert and item before another in the Gengrid. - * - * This inserts an item before another in the grid. - * - * @param obj The Gengrid object. - * @param gic The item class for the item. - * @param data The item data. - * @param relative The item to which insert before. - * @param func Convenience function called when item is selected. - * @param func_data Data passed to @p func above. - * @return A handle to the item added or NULL if not possible. - * - * @see elm_gengrid_item_append() - * @see elm_gengrid_item_prepend() - * @see elm_gengrid_item_insert_after() - * @see elm_gengrid_item_del() - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_item_insert_before(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, @@ -2074,26 +1826,6 @@ elm_gengrid_item_insert_before(Evas_Object *obj, return item; } -/** - * Insert and item after another in the Gengrid. - * - * This inserts an item after another in the grid. - * - * @param obj The Gengrid object. - * @param gic The item class for the item. - * @param data The item data. - * @param relative The item to which insert after. - * @param func Convenience function called when item is selected. - * @param func_data Data passed to @p func above. - * @return A handle to the item added or NULL if not possible. - * - * @see elm_gengrid_item_append() - * @see elm_gengrid_item_prepend() - * @see elm_gengrid_item_insert_before() - * @see elm_gengrid_item_del() - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_item_insert_after(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic, @@ -2157,16 +1889,6 @@ elm_gengrid_item_sorted_insert(Evas_Object *obj, return elm_gengrid_item_direct_sorted_insert(obj, gic, data, _elm_gengrid_item_compare_data, func, func_data); } -/** - * Remove an item from the Gengrid. - * - * @param item The item to be removed. - * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise. - * - * @see elm_gengrid_clear() to remove all items of the Gengrid. - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_del(Elm_Gengrid_Item *item) { @@ -2185,15 +1907,6 @@ elm_gengrid_item_del(Elm_Gengrid_Item *item) _item_del(item); } -/** - * Set for what direction the Gengrid will expand. - * - * @param obj The Gengrid object. - * @param setting If @c EINA_TRUE the Gengrid will expand horizontally - * or vertically if @c EINA_FALSE. - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_horizontal_set(Evas_Object *obj, Eina_Bool setting) @@ -2209,15 +1922,6 @@ elm_gengrid_horizontal_set(Evas_Object *obj, wd->calc_job = ecore_job_add(_calc_job, wd); } -/** - * 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) { @@ -2227,17 +1931,6 @@ elm_gengrid_horizontal_get(const Evas_Object *obj) return wd->horizontal; } -/** - * Clear the Gengrid - * - * This clears all items in the Gengrid, leaving it empty. - * - * @param obj The Gengrid object. - * - * @see elm_gengrid_item_del() to remove just one item. - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_clear(Evas_Object *obj) { @@ -2288,24 +1981,6 @@ elm_gengrid_clear(Evas_Object *obj) evas_object_smart_callback_call(wd->pan_smart, "changed", NULL); } -/** - * Get the real evas object of the Gengrid item - * - * This returns the actual evas object used for the specified Gengrid - * item. This may be NULL as it may not be created, and may be - * deleted at any time by Gengrid. Do not modify this object (move, - * resize, show, hide etc.) as Gengrid is controlling it. This - * function is for querying, emitting custom signals or hooking lower - * level callbacks for events. Do not delete this object under any - * circumstances. - * - * @param item The Gengrid item. - * @return the evas object associated to this item. - * - * @see elm_gengrid_item_data_get() - * - * @ingroup Gengrid - */ EAPI const Evas_Object * elm_gengrid_item_object_get(const Elm_Gengrid_Item *item) { @@ -2313,17 +1988,6 @@ elm_gengrid_item_object_get(const Elm_Gengrid_Item *item) return item->base.view; } -/** - * Update the contents of an item - * - * This updates an item by calling all the item class functions again - * to get the icons, labels and states. Use this when the original - * item data has changed and the changes are desired to be reflected. - * - * @param item The item - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_update(Elm_Gengrid_Item *item) { @@ -2335,20 +1999,6 @@ elm_gengrid_item_update(Elm_Gengrid_Item *item) _item_place(item, item->x, item->y); } -/** - * Returns the data associated to an item - * - * This returns the data value passed on the elm_gengrid_item_append() - * and related item addition calls. - * - * @param item The Gengrid item. - * @return the data associated to this item. - * - * @see elm_gengrid_item_append() - * @see elm_gengrid_item_object_get() - * - * @ingroup Gengrid - */ EAPI void * elm_gengrid_item_data_get(const Elm_Gengrid_Item *item) { @@ -2396,17 +2046,6 @@ elm_gengrid_item_item_class_set(Elm_Gengrid_Item *item, elm_gengrid_item_update(item); } -/** - * Get the item's coordinates. - * - * This returns the logical position of the item whithin the Gengrid. - * - * @param item The Gengrid item. - * @param x The x-axis coordinate pointer. - * @param y The y-axis coordinate pointer. - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_pos_get(const Elm_Gengrid_Item *item, unsigned int *x, @@ -2417,17 +2056,6 @@ elm_gengrid_item_pos_get(const Elm_Gengrid_Item *item, if (y) *y = item->y; } -/** - * Enable or disable multi-select in the Gengrid. - * - * This enables (EINA_TRUE) or disables (EINA_FALSE) multi-select in - * the Gengrid. This allows more than 1 item to be selected. - * - * @param obj The Gengrid object. - * @param multi Multi-select enabled/disabled - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_multi_select_set(Evas_Object *obj, Eina_Bool multi) @@ -2438,15 +2066,6 @@ elm_gengrid_multi_select_set(Evas_Object *obj, wd->multi = multi; } -/** - * Get if multi-select in Gengrid is enabled or disabled - * - * @param obj The Gengrid object - * @return Multi-select enable/disable - * (EINA_TRUE = enabled / EINA_FALSE = disabled) - * - * @ingroup Gengrid - */ EAPI Eina_Bool elm_gengrid_multi_select_get(const Evas_Object *obj) { @@ -2456,21 +2075,6 @@ elm_gengrid_multi_select_get(const Evas_Object *obj) return wd->multi; } -/** - * Get the selected item in the Gengrid - * - * This gets the selected item in the Gengrid (if multi-select is - * enabled only the first item in the list is selected - which is not - * very useful, so see elm_gengrid_selected_items_get() for when - * multi-select is used). - * - * If no item is selected, NULL is returned. - * - * @param obj The Gengrid object. - * @return The selected item, or NULL if none. - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_selected_item_get(const Evas_Object *obj) { @@ -2481,19 +2085,6 @@ elm_gengrid_selected_item_get(const Evas_Object *obj) return NULL; } -/** - * Get a list of selected items in the Gengrid. - * - * This returns a list of the selected items. This list pointer is - * only valid so long as no items are selected or unselected (or - * unselected implictly by deletion). The list contains - * Elm_Gengrid_Item pointers. - * - * @param obj The Gengrid object. - * @return The list of selected items, or NULL if none are selected. - * - * @ingroup Gengrid - */ EAPI const Eina_List * elm_gengrid_selected_items_get(const Evas_Object *obj) { @@ -2503,18 +2094,6 @@ elm_gengrid_selected_items_get(const Evas_Object *obj) return wd->selected; } -/** - * Set the selected state of an item. - * - * This sets the selected state of an item. If multi-select is not - * enabled and selected is EINA_TRUE, previously selected items are - * unselected. - * - * @param item The item - * @param selected The selected state. - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_selected_set(Elm_Gengrid_Item *item, Eina_Bool selected) @@ -2540,16 +2119,6 @@ elm_gengrid_item_selected_set(Elm_Gengrid_Item *item, _item_unselect(item); } -/** - * Get the selected state of an item. - * - * This gets the selected state of an item (1 selected, 0 not selected). - * - * @param item The item - * @return The selected state - * - * @ingroup Gengrid - */ EAPI Eina_Bool elm_gengrid_item_selected_get(const Elm_Gengrid_Item *item) { @@ -2557,18 +2126,6 @@ elm_gengrid_item_selected_get(const Elm_Gengrid_Item *item) return item->selected; } -/** - * 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 - * disabled, 0 not disabled). - * - * @param item The item - * @param disabled The disabled state - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_disabled_set(Elm_Gengrid_Item *item, Eina_Bool disabled) @@ -2586,16 +2143,6 @@ elm_gengrid_item_disabled_set(Elm_Gengrid_Item *item, } } -/** - * Get the disabled state of an item. - * - * This gets the disabled state of the given item. - * - * @param item The item - * @return The disabled state - * - * @ingroup Gengrid - */ EAPI Eina_Bool elm_gengrid_item_disabled_get(const Elm_Gengrid_Item *item) { @@ -2625,17 +2172,6 @@ _elm_gengrid_item_label_del_cb(void *data, eina_stringshare_del(data); } -/** - * Set the text to be shown in the gengrid item. - * - * @param item Target item - * @param text The text to set in the content - * - * Setup the text as tooltip to object. The item can have only one - * tooltip, so any previous tooltip data is removed. - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_tooltip_text_set(Elm_Gengrid_Item *item, const char *text) @@ -2647,26 +2183,6 @@ elm_gengrid_item_tooltip_text_set(Elm_Gengrid_Item *item, _elm_gengrid_item_label_del_cb); } -/** - * Set the content to be shown in the tooltip item - * - * Setup the tooltip to item. The item can have only one tooltip, so - * any previous tooltip data is removed. @p func(with @p data) will be - * called every time that need show the tooltip and it should return a - * valid Evas_Object. This object is then managed fully by tooltip - * system and is deleted when the tooltip is gone. - * - * @param item the gengrid item being attached a tooltip. - * @param func the function used to create the tooltip contents. - * @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 @an item - * dies. This callback receives as the first parameter the - * given @a data, and @c event_info is the item. - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_tooltip_content_cb_set(Elm_Gengrid_Item *item, Elm_Tooltip_Item_Content_Cb func, @@ -2698,19 +2214,6 @@ error: if (del_cb) del_cb((void *)data, NULL, NULL); } -/** - * Unset tooltip from item - * - * @param item gengrid item to remove previously set tooltip. - * - * Remove tooltip from item. The callback provided as del_cb to - * elm_gengrid_item_tooltip_content_cb_set() will be called to notify - * it is not used anymore. - * - * @see elm_gengrid_item_tooltip_content_cb_set() - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_tooltip_unset(Elm_Gengrid_Item *item) { @@ -2727,18 +2230,6 @@ elm_gengrid_item_tooltip_unset(Elm_Gengrid_Item *item) elm_gengrid_item_tooltip_style_set(item, NULL); } -/** - * Sets a different style for this item tooltip. - * - * @note before you set a style you should define a tooltip with - * elm_gengrid_item_tooltip_content_cb_set() or - * elm_gengrid_item_tooltip_text_set() - * - * @param item gengrid item with tooltip already set. - * @param style the theme style to use (default, transparent, ...) - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_tooltip_style_set(Elm_Gengrid_Item *item, const char *style) @@ -2748,15 +2239,6 @@ elm_gengrid_item_tooltip_style_set(Elm_Gengrid_Item *item, if (item->base.view) elm_widget_item_tooltip_style_set(item, style); } -/** - * Get the style for this item tooltip. - * - * @param item gengrid item with tooltip already set. - * @return style the theme style in use, defaults to "default". If the - * object does not have a tooltip set, then NULL is returned. - * - * @ingroup Gengrid - */ EAPI const char * elm_gengrid_item_tooltip_style_get(const Elm_Gengrid_Item *item) { @@ -2764,15 +2246,6 @@ elm_gengrid_item_tooltip_style_get(const Elm_Gengrid_Item *item) return item->tooltip.style; } -/** - * Set the cursor to be shown when mouse is over the gengrid item - * - * @param item Target item - * @param cursor the cursor name to be used. - * - * @see elm_object_cursor_set() - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_cursor_set(Elm_Gengrid_Item *item, const char *cursor) @@ -2782,14 +2255,6 @@ elm_gengrid_item_cursor_set(Elm_Gengrid_Item *item, if (item->base.view) elm_widget_item_cursor_set(item, cursor); } -/** - * Get the cursor to be shown when mouse is over the gengrid item - * - * @param item gengrid item with cursor already set. - * @return the cursor name. - * - * @ingroup Gengrid - */ EAPI const char * elm_gengrid_item_cursor_get(const Elm_Gengrid_Item *item) { @@ -2797,14 +2262,6 @@ elm_gengrid_item_cursor_get(const Elm_Gengrid_Item *item) return elm_widget_item_cursor_get(item); } -/** - * Unset the cursor to be shown when mouse is over the gengrid item - * - * @param item Target item - * - * @see elm_object_cursor_unset() - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_cursor_unset(Elm_Gengrid_Item *item) { @@ -2819,17 +2276,6 @@ elm_gengrid_item_cursor_unset(Elm_Gengrid_Item *item) item->mouse_cursor = NULL; } -/** - * Sets a different style for this item cursor. - * - * @note before you set a style you should define a cursor with - * elm_gengrid_item_cursor_set() - * - * @param item gengrid item with cursor already set. - * @param style the theme style to use (default, transparent, ...) - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_cursor_style_set(Elm_Gengrid_Item *item, const char *style) @@ -2838,15 +2284,6 @@ elm_gengrid_item_cursor_style_set(Elm_Gengrid_Item *item, elm_widget_item_cursor_style_set(item, style); } -/** - * Get the style for this item cursor. - * - * @param item gengrid item with cursor already set. - * @return style the theme style in use, defaults to "default". If the - * object does not have a cursor set, then NULL is returned. - * - * @ingroup Gengrid - */ EAPI const char * elm_gengrid_item_cursor_style_get(const Elm_Gengrid_Item *item) { @@ -2854,21 +2291,6 @@ elm_gengrid_item_cursor_style_get(const Elm_Gengrid_Item *item) return elm_widget_item_cursor_style_get(item); } -/** - * Set if the cursor set should be searched on the theme or should use - * the provided by the engine, only. - * - * @note before you set if should look on theme you should define a - * cursor with elm_object_cursor_set(). By default it will only look - * for cursors provided by the engine. - * - * @param item widget item with cursor already set. - * @param engine_only boolean to define it cursors should be looked - * only between the provided by the engine or searched on widget's - * theme as well. - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_cursor_engine_only_set(Elm_Gengrid_Item *item, Eina_Bool engine_only) @@ -2877,17 +2299,6 @@ elm_gengrid_item_cursor_engine_only_set(Elm_Gengrid_Item *item, elm_widget_item_cursor_engine_only_set(item, engine_only); } -/** - * Get the cursor engine only usage for this item cursor. - * - * @param item widget item with cursor already set. - * @return engine_only boolean to define it cursors should be looked - * only between the provided by the engine or searched on widget's - * theme as well. If the object does not have a cursor set, then - * EINA_FALSE is returned. - * - * @ingroup Gengrid - */ EAPI Eina_Bool elm_gengrid_item_cursor_engine_only_get(const Elm_Gengrid_Item *item) { @@ -2895,15 +2306,6 @@ elm_gengrid_item_cursor_engine_only_get(const Elm_Gengrid_Item *item) return elm_widget_item_cursor_engine_only_get(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) @@ -2914,15 +2316,6 @@ elm_gengrid_reorder_mode_set(Evas_Object *obj, 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) { @@ -2932,21 +2325,6 @@ elm_gengrid_reorder_mode_get(const Evas_Object *obj) return wd->reorder_mode; } -/** - * Set the always select mode. - * - * Cells will only call their selection func and callback when first - * becoming selected. Any further clicks will do nothing, unless you - * enable always select with - * elm_gengrid_always_select_mode_set(). This means even if selected, - * every click will make the selected callbacks be called. - * - * @param obj The Gengrid object - * @param always_select The always select mode (EINA_TRUE = on, - * EINA_FALSE = off) - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select) @@ -2957,14 +2335,6 @@ elm_gengrid_always_select_mode_set(Evas_Object *obj, wd->always_select = always_select; } -/** - * Get the always select mode. - * - * @param obj The Gengrid object. - * @return The always select mode (EINA_TRUE = on, EINA_FALSE = off) - * - * @ingroup Gengrid - */ EAPI Eina_Bool elm_gengrid_always_select_mode_get(const Evas_Object *obj) { @@ -2974,17 +2344,6 @@ elm_gengrid_always_select_mode_get(const Evas_Object *obj) return wd->always_select; } -/** - * Set no select mode. - * - * This will turn off the ability to select items entirely and they - * will neither appear selected nor call selected callback functions. - * - * @param obj The Gengrid object - * @param no_select The no select mode (EINA_TRUE = on, EINA_FALSE = off) - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select) @@ -2995,14 +2354,6 @@ elm_gengrid_no_select_mode_set(Evas_Object *obj, wd->no_select = no_select; } -/** - * Gets no select mode. - * - * @param obj The Gengrid object - * @return The no select mode (EINA_TRUE = on, EINA_FALSE = off) - * - * @ingroup Gengrid - */ EAPI Eina_Bool elm_gengrid_no_select_mode_get(const Evas_Object *obj) { @@ -3012,18 +2363,6 @@ elm_gengrid_no_select_mode_get(const Evas_Object *obj) return wd->no_select; } -/** - * Set bounce mode. - * - * This will enable or disable the scroller bounce mode for the - * Gengrid. See elm_scroller_bounce_set() for details. - * - * @param obj The Gengrid object - * @param h_bounce Allow bounce horizontally - * @param v_bounce Allow bounce vertically - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, @@ -3037,15 +2376,6 @@ elm_gengrid_bounce_set(Evas_Object *obj, wd->v_bounce = v_bounce; } -/** - * Get the bounce mode - * - * @param obj The Gengrid object - * @param h_bounce Allow bounce horizontally - * @param v_bounce Allow bounce vertically - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, @@ -3054,43 +2384,10 @@ elm_gengrid_bounce_get(const Evas_Object *obj, ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - *h_bounce = wd->h_bounce; - *v_bounce = wd->v_bounce; + if (h_bounce) *h_bounce = wd->h_bounce; + if (v_bounce) *v_bounce = wd->v_bounce; } -/** - * Get all items in the Gengrid. - * - * This returns a list of the Gengrid items. The list contains - * Elm_Gengrid_Item pointers. - * - * @param obj The Gengrid object. - * @return The list of items, or NULL if none. - * - * @ingroup Gengrid - */ - -/** - * Set 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_set(Evas_Object *obj, double h_pagerel, @@ -3108,27 +2405,6 @@ 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) { @@ -3139,19 +2415,6 @@ elm_gengrid_page_relative_get(const Evas_Object *obj, double *h_pagerel, double elm_smart_scroller_paging_get(wd->scr, h_pagerel, v_pagerel, NULL, NULL); } -/** - * Set gengrid scroll page size. - * - * See also elm_gengrid_page_relative_set(). This, instead of a page - * size being relative to the viewport, sets it to an absolute fixed - * value, with 0 turning it off for that axis. - * - * @param obj The gengrid object - * @param h_pagesize The horizontal page size - * @param v_pagesize The vertical page size - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, @@ -3168,16 +2431,6 @@ elm_gengrid_page_size_set(Evas_Object *obj, v_pagesize); } -/** - * Get the first item in the gengrid - * - * This returns the first item in the list. - * - * @param obj The gengrid object - * @return The first item, or NULL if none - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_first_item_get(const Evas_Object *obj) { @@ -3191,15 +2444,6 @@ elm_gengrid_first_item_get(const Evas_Object *obj) return item; } -/** - * Get the last item in the gengrid - * - * This returns the last item in the list. - * - * @return The last item, or NULL if none - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_last_item_get(const Evas_Object *obj) { @@ -3213,16 +2457,6 @@ elm_gengrid_last_item_get(const Evas_Object *obj) return item; } -/** - * Get the next item in the gengrid - * - * This returns the item after the item @p item. - * - * @param item The item - * @return The item after @p item, or NULL if none - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_item_next_get(const Elm_Gengrid_Item *item) { @@ -3235,16 +2469,6 @@ elm_gengrid_item_next_get(const Elm_Gengrid_Item *item) return (Elm_Gengrid_Item *)item; } -/** - * Get the previous item in the gengrid - * - * This returns the item before the item @p item. - * - * @param item The item - * @return The item before @p item, or NULL if none - * - * @ingroup Gengrid - */ EAPI Elm_Gengrid_Item * elm_gengrid_item_prev_get(const Elm_Gengrid_Item *item) { @@ -3257,16 +2481,6 @@ elm_gengrid_item_prev_get(const Elm_Gengrid_Item *item) return (Elm_Gengrid_Item *)item; } -/** - * Get the gengrid object from an item - * - * This returns the gengrid object itself that an item belongs to. - * - * @param item The item - * @return The gengrid object - * - * @ingroup Gengrid - */ EAPI Evas_Object * elm_gengrid_item_gengrid_get(const Elm_Gengrid_Item *item) { @@ -3274,16 +2488,6 @@ elm_gengrid_item_gengrid_get(const Elm_Gengrid_Item *item) return item->base.widget; } -/** - * Show the given item - * - * This causes gengrid to jump to the given item @p item and show it - * (by scrolling), if it is not fully visible. - * - * @param item The item - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_show(Elm_Gengrid_Item *item) { @@ -3302,17 +2506,6 @@ elm_gengrid_item_show(Elm_Gengrid_Item *item) item->wd->item_height); } -/** - * Bring in the given item - * - * This causes gengrig to jump to the given item @p item and show it - * (by scrolling), if it is not fully visible. This may use animation - * to do so and take a period of time - * - * @param item The item - * - * @ingroup Gengrid - */ EAPI void elm_gengrid_item_bring_in(Elm_Gengrid_Item *item) {