This application is a thorough exercise on the gengrid widget\textquotesingle{}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\textquotesingle{}s relevant part begins at the grid\textquotesingle{}s creation. After instantiating it, we set its items sizes, so that we don\textquotesingle{}t end with items one finger size wide, only. We\textquotesingle{}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\textquotesingle{}s value.  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ grid\ =\ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga4551f56817ddd07f021a1d89b8ac542a}{elm\_gengrid\_add}}(win);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_gadea5cce647305f0a8f7bca8778131754}{elm\_gengrid\_item\_size\_set}}(grid,\ 150,\ 150);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(grid,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(grid,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ grid);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(grid,\ \textcolor{stringliteral}{"{}clicked,double"{}},\ \_double\_click,\ NULL);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(grid,\ \textcolor{stringliteral}{"{}longpressed"{}},\ \_long\_pressed,\ NULL);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(grid);}

\end{DoxyCodeInclude}
 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ item\ double\ click\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_double\_click(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Double\ click\ on\ item\ with\ handle\ \%p\(\backslash\)n"{}},\ event\_info);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Before we actually start to deal with the items API, let\textquotesingle{}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\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\_Example\_Item}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path;}
\DoxyCodeLine{\}\ Example\_Item;}

\end{DoxyCodeInclude}
 That path will be used to index an image, to be swallowed into one of the item\textquotesingle{}s icon spots. The images themselves are distributed with Elementary\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *imgs[9]\ =}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}panel\_01.jpg"{}},}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}plant\_01.jpg"{}},}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}rock\_01.jpg"{}},}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}rock\_02.jpg"{}},}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}sky\_01.jpg"{}},}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}sky\_02.jpg"{}},}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}sky\_03.jpg"{}},}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}sky\_04.jpg"{}},}
\DoxyCodeLine{\ \ \ \textcolor{stringliteral}{"{}wood\_01.jpg"{}},}
\DoxyCodeLine{\};}

\end{DoxyCodeInclude}
 We also have an (unique) gengrid item class we\textquotesingle{}ll be using for items in the example\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{struct__Elm__Gen__Item__Class}{Elm\_Gengrid\_Item\_Class}}\ *gic\ =\ NULL;}

\end{DoxyCodeInclude}
 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gic-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_aa611ea90d00c3e0f9abe25ff56fc420f}{item\_style}}\ =\ \textcolor{stringliteral}{"{}default"{}};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gic-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_ae7a3a244fab9e126b3ac264615535c41}{text\_get}}\ =\ \_grid\_label\_get;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gic-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a796220b356374cd6395bcd2c3668f8d8}{content\_get}}\ =\ \_grid\_content\_get;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gic-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a23a335ae22003578adc536313f21e6e5}{state\_get}}\ =\ \_grid\_state\_get;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gic-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a29069fe3b82c13e822a3ce515e12dac0}{del}}\ =\ \_grid\_del;}

\end{DoxyCodeInclude}
 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\textquotesingle{}s image path\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ label\ fetching\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{char}\ *}
\DoxyCodeLine{\_grid\_label\_get(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ \ *part\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ Example\_Item\ *it\ =\ data;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ buf[256];}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ snprintf(buf,\ \textcolor{keyword}{sizeof}(buf),\ \textcolor{stringliteral}{"{}Photo\ \%s"{}},\ it-\/>path);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ strdup(buf);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 For item icons, we\textquotesingle{}ll be populating the item default theme\textquotesingle{}s two icon spots, {\ttfamily \char`\"{}elm.\+swallow.\+icon\char`\"{}} and {\ttfamily \char`\"{}elm.\+swallow.\+end\char`\"{}}. The former will receive one of the images in our list (in the form of a \mbox{\hyperlink{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\textquotesingle{}s selection in the grid\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ icon\ fetching\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *}
\DoxyCodeLine{\_grid\_content\_get(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ \ *part)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ Example\_Item\ *it\ =\ data;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!strcmp(part,\ \textcolor{stringliteral}{"{}elm.swallow.icon"{}}))}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *icon\ =\ \mbox{\hyperlink{group__Elm__Bg_gac8eba3fcce966addec75ab6335e60f6e}{elm\_bg\_add}}(obj);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ buf[PATH\_MAX];}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ snprintf(buf,\ \textcolor{keyword}{sizeof}(buf),\ \textcolor{stringliteral}{"{}\%s/images/\%s"{}},\ \mbox{\hyperlink{group__Elm__App_gab10cf98c5aa3936dfda01d6bca366d09}{elm\_app\_data\_dir\_get}}(),}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ it-\/>path);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__Bg_ga0b11c11879de61126414adfbfe3e431c}{elm\_bg\_file\_set}}(icon,\ buf,\ NULL);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gab09d6bf93b5435230b41ceca2abe783a}{evas\_object\_size\_hint\_aspect\_set}}(icon,\ \mbox{\hyperlink{Evas__Common_8h_ac68b577b7c0b79c356f01926e4a8099faeaf1e019f2dbfbbc2da9ab1fe1f175f6}{EVAS\_ASPECT\_CONTROL\_VERTICAL}},\ 1,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 1);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(icon);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ icon;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (!strcmp(part,\ \textcolor{stringliteral}{"{}elm.swallow.end"{}}))}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *ck;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ ck\ =\ \mbox{\hyperlink{group__Elm__Check_ga467a6a6215c116a18664aa40fc95f4e3}{elm\_check\_add}}(obj);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gae08ef17c04bb69c55c6ca59773a5d8f8}{evas\_object\_propagate\_events\_set}}(ck,\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(ck);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ck;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 As the default gengrid item\textquotesingle{}s theme does not have parts implementing item states, we\textquotesingle{}ll be just returning false for every item state\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ state\ fetching\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_grid\_state\_get(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ \ *part\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Finally, the deletion callback on gengrid items takes care of freeing the item\textquotesingle{}s label string and its data struct\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ deletion\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_grid\_del(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Example\_Item\ *it\ =\ data;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Stringshare__Group_ga5538b4a134987b8a01744fad1a845ba4}{eina\_stringshare\_del}}(it-\/>path);}
\DoxyCodeLine{\ \ \ free(it);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Let\textquotesingle{}s move to item insertion/deletion knobs, them. They are four buttons, above the grid\textquotesingle{}s viewport, namely
\begin{DoxyItemize}
\item \char`\"{}\+Append\char`\"{} (to append an item to the grid),
\item \char`\"{}\+Prepend\char`\"{} (to prepend an item to the grid),
\item \char`\"{}\+Insert before\char`\"{} (to insert an item before the selection, on the grid),
\item \char`\"{}\+Insert after\char`\"{} (to insert an item after the selection, on the grid),
\item \char`\"{}\+Clear\char`\"{} (to delete all items in the grid),
\item \char`\"{}\+Bring in 1st\char`\"{} (to make the 1st item visible, by scrolling),
\item \char`\"{}\+Show last\char`\"{} (to directly show the last item),
\end{DoxyItemize}which are displaced and declared in that order. We\textquotesingle{}re not dealing with the buttons\textquotesingle{} creation code (see \mbox{\hyperlink{button_example_01}{a button example}}, for more details on it), but with their {\ttfamily \char`\"{}clicked\char`\"{}} registered callbacks. For all of them, the grid\textquotesingle{}s handle is passed as {\ttfamily data}. The ones creating new items use a common code, which just gives a new {\ttfamily Example\+\_\+\+Item} struct, with {\ttfamily path} filled with a random image in our images list\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ new\ item\ with\ random\ path\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ Example\_Item\ *}
\DoxyCodeLine{\_item\_new(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Example\_Item\ *it;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ it\ =\ malloc(\textcolor{keyword}{sizeof}(*it));}
\DoxyCodeLine{\ \ \ it-\/>path\ =\ \mbox{\hyperlink{group__Eina__Stringshare__Group_ga4e3ce40744291c1fb8574e26883c0bf2}{eina\_stringshare\_add}}(imgs[rand()\ \%\ (\textcolor{keyword}{sizeof}(imgs)\ /}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{sizeof}(imgs[0]))]);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ it;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Moreover, that ones will set a common function to be issued on the selection of the items. There, we print the item handle\textquotesingle{}s value, along with the callback function data. The latter will be {\ttfamily NULL}, always, because it\textquotesingle{}s what we pass when adding all icons. By using \mbox{\hyperlink{group__Elm__General_ga6593639f5568153bff4960224a7fadcb}{elm\+\_\+object\+\_\+item\+\_\+data\+\_\+get()}}, we can have the item data back and, with that, we\textquotesingle{}re priting the item\textquotesingle{}s path string. Finally, we exemplify \mbox{\hyperlink{group__Elm__Gengrid__Group_gaca9e06b8d918dc034072efac9d32638e}{elm\+\_\+gengrid\+\_\+item\+\_\+pos\+\_\+get()}}, printing the item\textquotesingle{}s position in the grid\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ item\ selection\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_grid\_sel(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ x,\ y;}
\DoxyCodeLine{\ \ \ Example\_Item\ *it\ =\ \mbox{\hyperlink{group__Elm__General_ga6593639f5568153bff4960224a7fadcb}{elm\_object\_item\_data\_get}}(event\_info);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_gaca9e06b8d918dc034072efac9d32638e}{elm\_gengrid\_item\_pos\_get}}(event\_info,\ \&x,\ \&y);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Item\ [\%p],\ with\ data\ [\%p],\ path\ \%s,\ at\ position\ (\%u,\ \%u),"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}\ has\ been\ selected\(\backslash\)n"{}},\ event\_info,\ data,\ it-\/>path,\ x,\ y);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The appending button will exercise \mbox{\hyperlink{group__Elm__Gengrid__Group_ga1614357292696e7e8d5bcd71e4843fe6}{elm\+\_\+gengrid\+\_\+item\+\_\+append()}}, simply\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ append\ an\ item\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_append\_bt\_clicked(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *grid\ =\ data;}
\DoxyCodeLine{\ \ \ Example\_Item\ *it\ =\ \_item\_new();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga1614357292696e7e8d5bcd71e4843fe6}{elm\_gengrid\_item\_append}}(grid,\ gic,\ it,\ \_grid\_sel,\ NULL);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The prepending, naturally, is analogous, but exercising \mbox{\hyperlink{group__Elm__Gengrid__Group_gab5f7ef642fe7d52061ead91881989bee}{elm\+\_\+gengrid\+\_\+item\+\_\+prepend()}}, on its turn. The \char`\"{}\+Insert before\char`\"{} one will expect an item to be selected in the grid, so that it will insert a new item just before it\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ "{}insert\ before"{}\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_before\_bt\_clicked(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Example\_Item\ *it;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *grid\ =\ data;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}}\ *sel;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ sel\ =\ \mbox{\hyperlink{group__Elm__Gengrid__Group_gafd42160540fe4f4ec5b1bb62d6f5f1ec}{elm\_gengrid\_selected\_item\_get}}(grid);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!sel)}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ it\ =\ \_item\_new();}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga1b3a6b5b7f3bd995bbfce582a690f1dc}{elm\_gengrid\_item\_insert\_before}}(grid,\ gic,\ it,\ sel,\ \_grid\_sel,\ NULL);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The \char`\"{}\+Insert after\char`\"{} is analogous, just using \mbox{\hyperlink{group__Elm__Gengrid__Group_ga9b489cf49f257b6d2783b2e201b6f6bf}{elm\+\_\+gengrid\+\_\+item\+\_\+insert\+\_\+after()}}, instead. The \char`\"{}\+Clear\char`\"{} button will, as expected, just issue \mbox{\hyperlink{group__Elm__Gengrid__Group_gaeddd05025a024895cab48060ca9d650e}{elm\+\_\+gengrid\+\_\+clear()}}\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ delete\ items\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_clear\_cb(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_gaeddd05025a024895cab48060ca9d650e}{elm\_gengrid\_clear}}(data);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Clearing\ the\ grid!\(\backslash\)n"{}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The \char`\"{}\+Bring in 1st\char`\"{} button is there exercise two gengrid functions -- \mbox{\hyperlink{group__Elm__Gengrid__Group_ga50682a013bb06121529e42a07dd5b77f}{elm\+\_\+gengrid\+\_\+first\+\_\+item\+\_\+get()}} and \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga0f40aecfe40cac4fc2e557006077f4f9}{elm\+\_\+gengrid\+\_\+item\+\_\+bring\+\_\+in()}}. With the former, we get a handle to the first item and, with the latter, you\textquotesingle{}ll see that the widget animatedly scrolls its view until we can see that item\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ bring\ in\ 1st\ item\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_bring\_1st\_clicked(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}}\ *gg\_it\ =\ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga50682a013bb06121529e42a07dd5b77f}{elm\_gengrid\_first\_item\_get}}(data);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!gg\_it)\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga0f40aecfe40cac4fc2e557006077f4f9}{elm\_gengrid\_item\_bring\_in}}(gg\_it,\ \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_gga40161f81baa7e0c89b14f84b80c71735a2752198ebed6ede5edf236c45307679e}{ELM\_GENGRID\_ITEM\_SCROLLTO\_IN}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The \char`\"{}\+Show last\char`\"{}, in its turn, will use \mbox{\hyperlink{group__Elm__Gengrid__Group_gaa2c4d8ff5e54673c41f1e4667212e53f}{elm\+\_\+gengrid\+\_\+last\+\_\+item\+\_\+get()}} and \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga60cf57e89b4f95230fe618168707bb28}{elm\+\_\+gengrid\+\_\+item\+\_\+show()}}. The latter differs from \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga0f40aecfe40cac4fc2e557006077f4f9}{elm\+\_\+gengrid\+\_\+item\+\_\+bring\+\_\+in()}} in that it immediately replaces the contents of the grid\textquotesingle{}s viewport with the region containing the item in question\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ show\ last\ item\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_show\_last\_clicked(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}}\ *gg\_it\ =\ \mbox{\hyperlink{group__Elm__Gengrid__Group_gaa2c4d8ff5e54673c41f1e4667212e53f}{elm\_gengrid\_last\_item\_get}}(data);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!gg\_it)\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga60cf57e89b4f95230fe618168707bb28}{elm\_gengrid\_item\_show}}(gg\_it,\ \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_gga40161f81baa7e0c89b14f84b80c71735a2752198ebed6ede5edf236c45307679e}{ELM\_GENGRID\_ITEM\_SCROLLTO\_IN}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 To change the grid\textquotesingle{}s cell (items) size, we\textquotesingle{}ve placed a spinner, which has the following {\ttfamily \char`\"{}changed\char`\"{}} smart callback\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ change\ items'\ size\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_size\_changed(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *grid\ =\ data;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ size\ =\ \mbox{\hyperlink{group__Elm__Spinner__Group_ga0f93a325d38ad9a249994a7dc4ea4f1b}{elm\_spinner\_value\_get}}(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_gadea5cce647305f0a8f7bca8778131754}{elm\_gengrid\_item\_size\_set}}(grid,\ size,\ size);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Experiment with it and see how the items are affected. The \char`\"{}\+Disable item\char`\"{} button will, as the name says, disable the currently selected item\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ disable\ selected\ item\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_toggle\_disabled\_cb(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}}\ *gg\_it\ =\ \mbox{\hyperlink{group__Elm__Gengrid__Group_gafd42160540fe4f4ec5b1bb62d6f5f1ec}{elm\_gengrid\_selected\_item\_get}}(data);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!gg\_it)\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga7e66b56863ae43408670ffcdc4b8103c}{elm\_gengrid\_item\_selected\_set}}(gg\_it,\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga1d4c8d3c83ed9408eaa35d605adbd7d2}{elm\_object\_item\_disabled\_set}}(gg\_it,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
Note that we also make use of \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga7e66b56863ae43408670ffcdc4b8103c}{elm\+\_\+gengrid\+\_\+item\+\_\+selected\+\_\+set()}}, there, thus making the item unselected before we actually disable it.

To toggle between horizontal and vertical layouting modes on the grid, use the \char`\"{}\+Horizontal mode\char`\"{} check, which will call the respective API function on the grid\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ change\ layouting\ mode\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_horizontal\_grid(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *grid\ =\ data;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_gabaf4b5619ff307173b9403b525851659}{elm\_gengrid\_horizontal\_set}}(grid,\ \mbox{\hyperlink{group__Elm__Check_ga011ed8bd33b24ab9be27d7f162b80846}{elm\_check\_state\_get}}(obj));}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 If you toggle the check right after that one, \char`\"{}\+Always select\char`\"{}, you\textquotesingle{}ll notice all subsequent clicks on the {\bfseries{same}} grid item will still issue the selection callback on it, what is different from when it\textquotesingle{}s not checked. This is the \mbox{\hyperlink{group__Elm__Gengrid__Group_ga8df7786837dd94e2c1b3fc7dcb06d5d6}{elm\+\_\+gengrid\+\_\+select\+\_\+mode\+\_\+set()}} behavior\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ "{}always\ select"{}\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_always\_select\_change(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *grid\ =\ data;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ always\ =\ \mbox{\hyperlink{group__Elm__Check_ga011ed8bd33b24ab9be27d7f162b80846}{elm\_check\_state\_get}}(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (always)}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga8df7786837dd94e2c1b3fc7dcb06d5d6}{elm\_gengrid\_select\_mode\_set}}(grid,\ \mbox{\hyperlink{group__Elm__General_gga8e4aa5aa238e472f33813babfff0d56fab3cfbf566fdbea2079f3081969f0c59c}{ELM\_OBJECT\_SELECT\_MODE\_ALWAYS}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga8df7786837dd94e2c1b3fc7dcb06d5d6}{elm\_gengrid\_select\_mode\_set}}(grid,\ \mbox{\hyperlink{group__Elm__General_gga8e4aa5aa238e472f33813babfff0d56fa69bb485be5448b469c86485fd884d649}{ELM\_OBJECT\_SELECT\_MODE\_DEFAULT}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}\(\backslash\)"{}Always\ select\(\backslash\)"{}\ mode\ for\ gengrid\ items\ is\ now\ \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ always\ ?\ \textcolor{stringliteral}{"{}on"{}}\ :\ \textcolor{stringliteral}{"{}off"{}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 One more check follows, \char`\"{}\+Bouncing\char`\"{}, 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\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ "{}bouncing\ mode"{}\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_bouncing\_change(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *grid\ =\ data;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ bounce\ =\ \mbox{\hyperlink{group__Elm__Check_ga011ed8bd33b24ab9be27d7f162b80846}{elm\_check\_state\_get}}(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Scroller__Group_gae69101dbdb089598ca790c73bd9d7a42}{elm\_scroller\_bounce\_set}}(grid,\ bounce,\ bounce);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Bouncing\ effect\ for\ gengrid\ is\ now\ \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ bounce\ ?\ \textcolor{stringliteral}{"{}on"{}}\ :\ \textcolor{stringliteral}{"{}off"{}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The next two checks will affect items selection on the grid. The first, \char`\"{}\+Multi-\/selection\char`\"{}, will make it possible to select more the one item on the grid. Because it wouldn\textquotesingle{}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\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ multi-\/selection\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_multi\_change(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *grid\ =\ data;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ multi\ =\ \mbox{\hyperlink{group__Elm__Check_ga011ed8bd33b24ab9be27d7f162b80846}{elm\_check\_state\_get}}(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga3c0ea3e1cf60979a75729c5866932322}{elm\_gengrid\_multi\_select\_set}}(grid,\ multi);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Multi-\/selection\ for\ gengrid\ is\ now\ \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ multi\ ?\ \textcolor{stringliteral}{"{}on"{}}\ :\ \textcolor{stringliteral}{"{}off"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga6849a57df3316eabad5bec443bf87597}{elm\_object\_disabled\_set}}(before\_bt,\ multi);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga6849a57df3316eabad5bec443bf87597}{elm\_object\_disabled\_set}}(after\_bt,\ multi);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!multi)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}}\ *gg\_it;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct__Eina__List}{Eina\_List}}\ *selected\ =\ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga3c495d116499c3d2339b07a36077203a}{elm\_gengrid\_selected\_items\_get}}(grid),\ *l;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Eina__List__Group_gac6efafc19f526d916cdb9757240a8773}{EINA\_LIST\_FOREACH}}(selected,\ l,\ gg\_it)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga7e66b56863ae43408670ffcdc4b8103c}{elm\_gengrid\_item\_selected\_set}}(gg\_it,\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{\ \ \ \ \ \}}

\end{DoxyCodeInclude}
 Note that we also {\bfseries{unselect}} all items in the grid, when returning from multi-\/selection mode, making use of \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga7e66b56863ae43408670ffcdc4b8103c}{elm\+\_\+gengrid\+\_\+item\+\_\+selected\+\_\+set()}}.

The second check acting on selection, \char`\"{}\+No selection\char`\"{}, is just what its name depicts -- no selection will be allowed anymore, on the grid, while it\textquotesingle{}s on. Check it out for yourself, interacting with the program\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ no\ selection\ callback\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_no\_sel\_change(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *grid\ =\ data;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ no\_sel\ =\ \mbox{\hyperlink{group__Elm__Check_ga011ed8bd33b24ab9be27d7f162b80846}{elm\_check\_state\_get}}(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (no\_sel)}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga8df7786837dd94e2c1b3fc7dcb06d5d6}{elm\_gengrid\_select\_mode\_set}}(grid,\ \mbox{\hyperlink{group__Elm__General_gga8e4aa5aa238e472f33813babfff0d56fa0f0e25088d651a379b4eb8b915d2e13f}{ELM\_OBJECT\_SELECT\_MODE\_NONE}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga8df7786837dd94e2c1b3fc7dcb06d5d6}{elm\_gengrid\_select\_mode\_set}}(grid,\ \mbox{\hyperlink{group__Elm__General_gga8e4aa5aa238e472f33813babfff0d56fa69bb485be5448b469c86485fd884d649}{ELM\_OBJECT\_SELECT\_MODE\_DEFAULT}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Selection\ for\ gengrid\ items\ is\ now\ \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ no\_sel\ ?\ \textcolor{stringliteral}{"{}disabled"{}}\ :\ \textcolor{stringliteral}{"{}enabled"{}});}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 We have, finally, one more line of knobs, now sliders, to change the grids behavior. The two first will change the horizontal {\bfseries{alignment}} of the whole actual grid of items within the gengrid\textquotesingle{}s viewport\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ items\ grid\ horizontal\ alignment\ change\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_h\_align\_change\_cb(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{double}\ v\_align;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{double}\ val\ =\ \mbox{\hyperlink{group__Elm__Slider_ga2dd3f70cdbcb4a81b5d7a08a18afaa1d}{elm\_slider\_value\_get}}(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga372a6e82e0ff63ac6126fc1a7c26c152}{elm\_gengrid\_align\_get}}(data,\ NULL,\ \&v\_align);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Setting\ horizontal\ alignment\ to\ \%f\(\backslash\)n"{}},\ val);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Gengrid__Group_ga556d81ee6aadef687bbf2edd885671df}{elm\_gengrid\_align\_set}}(data,\ val,\ v\_align);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Naturally, the vertical counterpart just issues \mbox{\hyperlink{group__Elm__Gengrid__Group_ga556d81ee6aadef687bbf2edd885671df}{elm\+\_\+gengrid\+\_\+align\+\_\+set()}} changing the second alignment component, instead.

The last slider will change the grid\textquotesingle{}s {\bfseries{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\textquotesingle{}ll see it snapping to page boundaries differenty, for each configuration\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{/*\ page\ relative\ size\ change\ */}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_page\_change\_cb(\textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *data,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *obj,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{double}\ val\ =\ \mbox{\hyperlink{group__Elm__Slider_ga2dd3f70cdbcb4a81b5d7a08a18afaa1d}{elm\_slider\_value\_get}}(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Scroller__Group_ga3295a1b41dc53d40b6ff5778313eaaa3}{elm\_scroller\_page\_relative\_set}}(data,\ val,\ val);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Setting\ grid\ page's\ relative\ size\ to\ \%f\(\backslash\)n"{}},\ val);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 This is how the example program\textquotesingle{}s window looks like\+:  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/gengrid_example}}
\end{DoxyImageNoCaption}


Note that it starts with three items which we included at will\+:  
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \_append\_bt\_clicked(grid,\ NULL,\ NULL);}
\DoxyCodeLine{\ \ \ \_append\_bt\_clicked(grid,\ NULL,\ NULL);}
\DoxyCodeLine{\ \ \ \_append\_bt\_clicked(grid,\ NULL,\ NULL);}

\end{DoxyCodeInclude}
 See the full \mbox{\hyperlink{gengrid_example_c}{source code}} for this example. 