
\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#include <Elementary.h>}

\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Item
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *path;
\} Example\_Item;

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *imgs[9] =
\{
   \textcolor{stringliteral}{"panel\_01.jpg"},
   \textcolor{stringliteral}{"plant\_01.jpg"},
   \textcolor{stringliteral}{"rock\_01.jpg"},
   \textcolor{stringliteral}{"rock\_02.jpg"},
   \textcolor{stringliteral}{"sky\_01.jpg"},
   \textcolor{stringliteral}{"sky\_02.jpg"},
   \textcolor{stringliteral}{"sky\_03.jpg"},
   \textcolor{stringliteral}{"sky\_04.jpg"},
   \textcolor{stringliteral}{"wood\_01.jpg"},
\};

\textcolor{keyword}{static} Elm_Gengrid_Item_Class *gic = NULL;
\textcolor{keyword}{static} Evas\_Object *before\_bt, *after\_bt;

\textcolor{comment}{/* change layouting mode */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_horizontal\_grid(\textcolor{keywordtype}{void}        *data,
                 Evas\_Object *obj,
                 \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;

   elm_gengrid_horizontal_set(grid, elm_check_state_get(obj));
\}

\textcolor{comment}{/* "always select" callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_always\_select\_change(\textcolor{keywordtype}{void}        *data,
                      Evas\_Object *obj,
                      \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Eina\_Bool always = elm_check_state_get(obj);

   \textcolor{keywordflow}{if} (always)
     elm_gengrid_select_mode_set(grid, ELM\_OBJECT\_SELECT\_MODE\_ALWAYS);
   \textcolor{keywordflow}{else}
     elm_gengrid_select_mode_set(grid, ELM\_OBJECT\_SELECT\_MODE\_DEFAULT);

   fprintf(stdout, \textcolor{stringliteral}{"\(\backslash\)"Always select\(\backslash\)" mode for gengrid items is now %s\(\backslash\)n"},
           always ? \textcolor{stringliteral}{"on"} : \textcolor{stringliteral}{"off"});
\}

\textcolor{comment}{/* "bouncing mode" callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_bouncing\_change(\textcolor{keywordtype}{void}        *data,
                 Evas\_Object *obj,
                 \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Eina\_Bool bounce = elm_check_state_get(obj);

   elm_scroller_bounce_set(grid, bounce, bounce);

   fprintf(stdout, \textcolor{stringliteral}{"Bouncing effect for gengrid is now %s\(\backslash\)n"},
           bounce ? \textcolor{stringliteral}{"on"} : \textcolor{stringliteral}{"off"});
\}

\textcolor{comment}{/* multi-selection callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_multi\_change(\textcolor{keywordtype}{void}        *data,
              Evas\_Object *obj,
              \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Eina\_Bool multi = elm_check_state_get(obj);

   elm_gengrid_multi_select_set(grid, multi);

   fprintf(stdout, \textcolor{stringliteral}{"Multi-selection for gengrid is now %s\(\backslash\)n"},
           multi ? \textcolor{stringliteral}{"on"} : \textcolor{stringliteral}{"off"});

   elm_object_disabled_set(before\_bt, multi);
   elm_object_disabled_set(after\_bt, multi);

   \textcolor{keywordflow}{if} (!multi)
     \{
        Elm_Object_Item *gg\_it;
        \textcolor{keyword}{const} Eina\_List *selected = elm_gengrid_selected_items_get(grid), *l;
        EINA\_LIST\_FOREACH(selected, l, gg\_it)
           elm\_gengrid\_item\_selected\_set(gg\_it, EINA\_FALSE);
     \}
\}

\textcolor{comment}{/* no selection callback */}
static \textcolor{keywordtype}{void}
\_no\_sel\_change(\textcolor{keywordtype}{void}        *data,
               Evas\_Object *obj,
               \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Eina\_Bool no\_sel = elm_check_state_get(obj);

   \textcolor{keywordflow}{if} (no\_sel)
     elm_gengrid_select_mode_set(grid, ELM\_OBJECT\_SELECT\_MODE\_NONE);
   \textcolor{keywordflow}{else}
     elm_gengrid_select_mode_set(grid, ELM\_OBJECT\_SELECT\_MODE\_DEFAULT);

   fprintf(stdout, \textcolor{stringliteral}{"Selection for gengrid items is now %s\(\backslash\)n"},
           no\_sel ? \textcolor{stringliteral}{"disabled"} : \textcolor{stringliteral}{"enabled"});
\}

\textcolor{comment}{/* item selection callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_grid\_sel(\textcolor{keywordtype}{void}        *data,
          Evas\_Object *obj,
          \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} x, y;
   Example\_Item *it = elm_object_item_data_get(event\_info);

   elm_gengrid_item_pos_get(event\_info, &x, &y);

   fprintf(stdout, \textcolor{stringliteral}{"Item [%p], with data [%p], path %s, at position (%d, %d),"}
           \textcolor{stringliteral}{" has been selected\(\backslash\)n"}, event\_info, data, it->path, x, y);
\}

\textcolor{comment}{/* new item with random path */}
\textcolor{keyword}{static} Example\_Item *
\_item\_new(\textcolor{keywordtype}{void})
\{
   Example\_Item *it;

   it = malloc(\textcolor{keyword}{sizeof}(*it));
   it->path = eina\_stringshare\_add(imgs[rand() % (\textcolor{keyword}{sizeof}(imgs) /
                                                  \textcolor{keyword}{sizeof}(imgs[0]))]);
   \textcolor{keywordflow}{return} it;
\}

\textcolor{comment}{/* "insert before" callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_before\_bt\_clicked(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   Example\_Item *it;
   Evas\_Object *grid = data;
   Elm_Object_Item *sel;

   sel = elm_gengrid_selected_item_get(grid);
   \textcolor{keywordflow}{if} (!sel)
     \textcolor{keywordflow}{return};

   it = \_item\_new();
   elm_gengrid_item_insert_before(grid, gic, it, sel, \_grid\_sel, NULL);
\}

\textcolor{comment}{/* "insert after" callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_after\_bt\_clicked(\textcolor{keywordtype}{void}        *data,
                  Evas\_Object *obj,
                  \textcolor{keywordtype}{void}        *event\_info)
\{
   Example\_Item *it;
   Evas\_Object *grid = data;
   Elm_Object_Item *sel;

   sel = elm_gengrid_selected_item_get(grid);
   \textcolor{keywordflow}{if} (!sel)
     \textcolor{keywordflow}{return};

   it = \_item\_new();
   elm_gengrid_item_insert_after(grid, gic, it, sel, \_grid\_sel, NULL);
\}

\textcolor{comment}{/* prepend an item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_prepend\_bt\_clicked(\textcolor{keywordtype}{void}        *data,
                    Evas\_Object *obj,
                    \textcolor{keywordtype}{void}        *event\_info)
\{
   Example\_Item *it;
   Evas\_Object *grid = data;

   it = \_item\_new();
   elm_gengrid_item_prepend(grid, gic, it, \_grid\_sel, NULL);
\}

\textcolor{comment}{/* append an item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_append\_bt\_clicked(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Example\_Item *it = \_item\_new();

   elm_gengrid_item_append(grid, gic, it, \_grid\_sel, NULL);
\}

\textcolor{comment}{/* delete items */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_clear\_cb(\textcolor{keywordtype}{void}        *data,
          Evas\_Object *obj,
          \textcolor{keywordtype}{void}        *event\_info)
\{
   elm_gengrid_clear(data);

   fprintf(stdout, \textcolor{stringliteral}{"Clearing the grid!\(\backslash\)n"});
\}

\textcolor{comment}{/* bring in 1st item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_bring\_1st\_clicked(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   Elm_Object_Item *gg\_it = elm_gengrid_first_item_get(data);

   \textcolor{keywordflow}{if} (!gg\_it) \textcolor{keywordflow}{return};

   elm\_gengrid\_item\_bring\_in(gg\_it, ELM\_GENGRID\_ITEM\_SCROLLTO\_IN);
\}

\textcolor{comment}{/* show last item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_show\_last\_clicked(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   Elm_Object_Item *gg\_it = elm_gengrid_last_item_get(data);

   \textcolor{keywordflow}{if} (!gg\_it) \textcolor{keywordflow}{return};

   elm\_gengrid\_item\_show(gg\_it, ELM\_GENGRID\_ITEM\_SCROLLTO\_IN);
\}

\textcolor{comment}{/* disable selected item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_toggle\_disabled\_cb(\textcolor{keywordtype}{void}        *data,
                    Evas\_Object *obj,
                    \textcolor{keywordtype}{void}        *event\_info)
\{
   Elm_Object_Item *gg\_it = elm_gengrid_selected_item_get(data);

   \textcolor{keywordflow}{if} (!gg\_it) \textcolor{keywordflow}{return};

   elm\_gengrid\_item\_selected\_set(gg\_it, EINA\_FALSE);
   elm\_object\_item\_disabled\_set(gg\_it, EINA\_TRUE);
\}

\textcolor{comment}{/* change items' size */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_size\_changed(\textcolor{keywordtype}{void}        *data,
              Evas\_Object *obj,
              \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   \textcolor{keywordtype}{int} size = elm_spinner_value_get(obj);

   elm_gengrid_item_size_set(grid, size, size);
\}

\textcolor{comment}{/* item double click callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_double\_click(\textcolor{keywordtype}{void}        *data,
              Evas\_Object *obj,
              \textcolor{keywordtype}{void}        *event\_info)
\{
   fprintf(stdout, \textcolor{stringliteral}{"Double click on item with handle %p\(\backslash\)n"}, event\_info);
\}

\textcolor{comment}{/* item long press callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_long\_pressed(\textcolor{keywordtype}{void}        *data,
              Evas\_Object *obj,
              \textcolor{keywordtype}{void}        *event\_info)
\{
   fprintf(stdout, \textcolor{stringliteral}{"Long press on item with handle %p\(\backslash\)n"}, event\_info);
\}

\textcolor{comment}{/* label fetching callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{char} *
\_grid\_label\_get(\textcolor{keywordtype}{void}        *data,
                Evas\_Object *obj,
                \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *part)
\{
   \textcolor{keyword}{const} Example\_Item *it = data;
   \textcolor{keywordtype}{char} buf[256];

   snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"Photo %s"}, it->path);
   \textcolor{keywordflow}{return} strdup(buf);
\}

\textcolor{comment}{/* icon fetching callback */}
\textcolor{keyword}{static} Evas\_Object *
\_grid\_content\_get(\textcolor{keywordtype}{void}        *data,
                  Evas\_Object *obj,
                  \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *part)
\{
   \textcolor{keyword}{const} Example\_Item *it = data;

   \textcolor{keywordflow}{if} (!strcmp(part, \textcolor{stringliteral}{"elm.swallow.icon"}))
     \{
        Evas\_Object *icon = elm_bg_add(obj);
        \textcolor{keywordtype}{char} buf[PATH\_MAX];

        snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s/images/%s"}, elm_app_data_dir_get(),
                 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);
        \textcolor{keywordflow}{return} icon;
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(part, \textcolor{stringliteral}{"elm.swallow.end"}))
     \{
        Evas\_Object *ck;
        ck = elm_check_add(obj);
        evas\_object\_propagate\_events\_set(ck, EINA\_FALSE);
        evas\_object\_show(ck);
        \textcolor{keywordflow}{return} ck;
     \}

   \textcolor{keywordflow}{return} NULL;
\}

\textcolor{comment}{/* state fetching callback */}
\textcolor{keyword}{static} Eina\_Bool
\_grid\_state\_get(\textcolor{keywordtype}{void}        *data,
                Evas\_Object *obj,
                \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *part)
\{
   \textcolor{keywordflow}{return} EINA\_FALSE;
\}

\textcolor{comment}{/* deletion callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_grid\_del(\textcolor{keywordtype}{void}        *data,
          Evas\_Object *obj)
\{
   Example\_Item *it = data;

   eina\_stringshare\_del(it->path);
   free(it);
\}

\textcolor{comment}{/* scrolling animation stopped callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_grid\_scroll\_stopped\_cb(\textcolor{keywordtype}{void}        *data,
                        Evas\_Object *obj,
                        \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keywordtype}{int} h\_pagenumber = 0, v\_pagenumber = 0;
   elm_scroller_current_page_get(obj, &h\_pagenumber, &v\_pagenumber);
   fprintf(stdout, \textcolor{stringliteral}{"Grid current horiz page is %d, vert page is %d\(\backslash\)n"},
           h\_pagenumber, v\_pagenumber);
\}

\textcolor{comment}{/* items grid horizontal alignment change */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_h\_align\_change\_cb(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keywordtype}{double} v\_align;
   \textcolor{keywordtype}{double} val = elm_slider_value_get(obj);

   elm_gengrid_align_get(data, NULL, &v\_align);

   fprintf(stdout, \textcolor{stringliteral}{"Setting horizontal alignment to %f\(\backslash\)n"}, val);
   elm_gengrid_align_set(data, val, v\_align);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_v\_align\_change\_cb(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keywordtype}{double} h\_align;
   \textcolor{keywordtype}{double} val = elm_slider_value_get(obj);

   elm_gengrid_align_get(data, &h\_align, NULL);

   fprintf(stdout, \textcolor{stringliteral}{"Setting vertical alignment to %f\(\backslash\)n"}, val);
   elm_gengrid_align_set(data, h\_align, val);
\}

\textcolor{comment}{/* page relative size change */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_page\_change\_cb(\textcolor{keywordtype}{void}        *data,
                Evas\_Object *obj,
                \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keywordtype}{double} val = elm_slider_value_get(obj);

   elm_scroller_page_relative_set(data, val, val);

   fprintf(stdout, \textcolor{stringliteral}{"Setting grid page's relative size to %f\(\backslash\)n"}, val);
\}

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int}    argc,
         \textcolor{keywordtype}{char} **argv)
\{
   Evas\_Object *win, *grid, *bx, *hbx\_1, *hbx\_2, *hbx\_3, *bt, *ck, *sl, *sp;
   Eina\_Bool bounce;
   \textcolor{keywordtype}{double} h, v;

   srand(time(NULL));

   elm_policy_set(ELM\_POLICY\_QUIT, ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED);
   elm_app_info_set(elm\_main, \textcolor{stringliteral}{"elementary"}, \textcolor{stringliteral}{"images"});

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"gengrid"}, \textcolor{stringliteral}{"Generic Grid Example"});
   elm_win_autodel_set(win, EINA\_TRUE);

   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\_align\_set(grid, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_box_pack_end(bx, grid);
   evas\_object\_smart\_callback\_add(grid, \textcolor{stringliteral}{"clicked,double"}, \_double\_click, NULL);
   evas\_object\_smart\_callback\_add(grid, \textcolor{stringliteral}{"longpressed"}, \_long\_pressed, NULL);
   evas\_object\_show(grid);

   hbx\_1 = elm_box_add(win);
   evas\_object\_size\_hint\_weight\_set(hbx\_1, EVAS\_HINT\_EXPAND, 0.0);
   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, \textcolor{stringliteral}{"Append"});
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"Prepend"});
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"Insert before"});
   evas\_object\_smart\_callback\_add(before\_bt, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"Insert after"});
   evas\_object\_smart\_callback\_add(after\_bt, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"Clear"});
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"clicked"}, \_clear\_cb, grid);
   elm_box_pack_end(hbx\_1, bt);
   evas\_object\_show(bt);

   bt = elm_button_add(win);
   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"Bring in 1st"});
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"clicked"}, \_bring\_1st\_clicked, grid);
   elm_box_pack_end(hbx\_1, bt);
   evas\_object\_show(bt);

   bt = elm_button_add(win);
   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"Show last"});
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"clicked"}, \_show\_last\_clicked, 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, \textcolor{stringliteral}{"Item size: %.0f"});
   evas\_object\_smart\_callback\_add(sp, \textcolor{stringliteral}{"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, 0.0);
   elm_box_horizontal_set(hbx\_2, EINA\_TRUE);
   elm_box_pack_end(bx, hbx\_2);
   evas\_object\_show(hbx\_2);

   bt = elm_button_add(win);
   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"Disable item"});
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"clicked"}, \_toggle\_disabled\_cb, grid);
   elm_box_pack_end(hbx\_2, bt);
   evas\_object\_show(bt);

   ck = elm_check_add(win);
   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"Horizontal mode"});
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"Always select"});
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"changed"}, \_always\_select\_change, grid);
   elm_box_pack_end(hbx\_2, ck);
   evas\_object\_show(ck);

   ck = elm_check_add(win);
   elm_scroller_bounce_get(grid, &bounce, NULL);
   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"Bouncing"});
   elm_check_state_set(ck, bounce);
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"Multi-selection"});
   elm_check_state_set(ck, elm_gengrid_multi_select_get(grid));
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"No selection"});
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"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, 0.0);
   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);
   evas\_object\_smart\_callback\_add(grid, \textcolor{stringliteral}{"scroll,anim,stop"}, \_grid\_scroll\_stopped\_cb, NULL);

   sl = elm_slider_add(win);
   elm\_object\_text\_set(sl, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"%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, \textcolor{stringliteral}{"changed"}, \_h\_align\_change\_cb, grid);

   sl = elm_slider_add(win);
   elm\_object\_text\_set(sl, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"%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, \textcolor{stringliteral}{"changed"}, \_v\_align\_change\_cb, grid);

   elm_gengrid_align_get(grid, &h, &v);

   sl = elm_slider_add(win);
   elm\_object\_text\_set(sl, \textcolor{stringliteral}{"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, \textcolor{stringliteral}{"%1.1f"});
   elm_slider_value_set(sl, h);
   elm_box_pack_end(hbx\_3, sl);
   evas\_object\_show(sl);

   \_page\_change\_cb(grid, sl, NULL);
   evas\_object\_smart\_callback\_add(sl, \textcolor{stringliteral}{"changed"}, \_page\_change\_cb, grid);

   \textcolor{keywordflow}{if} (!gic)
     \{
        gic = elm_gengrid_item_class_new();
        gic->item\_style = \textcolor{stringliteral}{"default"};
        gic->func.text\_get = \_grid\_label\_get;
        gic->func.content\_get = \_grid\_content\_get;
        gic->func.state\_get = \_grid\_state\_get;
        gic->func.del = \_grid\_del;
     \} \textcolor{comment}{// we only create the first time its needed. we dont unref/free}

   \_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();

   \textcolor{keywordflow}{return} 0;
\}
ELM_MAIN()
\end{DoxyCodeInclude}
 