\hypertarget{index_example_02_8c-example}{}\doxysection{index\+\_\+example\+\_\+02.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Elementary.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *items[] =}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{stringliteral}{"{}Judith"{}},}
\DoxyCodeLine{   \textcolor{stringliteral}{"{}Paulina"{}},}
\DoxyCodeLine{   \textcolor{stringliteral}{"{}Cathy"{}},}
\DoxyCodeLine{   \textcolor{stringliteral}{"{}Vendella"{}},}
\DoxyCodeLine{   \textcolor{stringliteral}{"{}Naomi"{}},}
\DoxyCodeLine{   \textcolor{stringliteral}{"{}Ashley"{}},}
\DoxyCodeLine{   \textcolor{stringliteral}{"{}Stacey"{}},}
\DoxyCodeLine{   \textcolor{stringliteral}{"{}Gail"{}}}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_index\_changed(\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{   \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}} *item = \mbox{\hyperlink{group__Elm__General_ga6593639f5568153bff4960224a7fadcb}{elm\_object\_item\_data\_get}}(event\_info);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_ga0f40aecfe40cac4fc2e557006077f4f9}{elm\_gengrid\_item\_bring\_in}}(item, \mbox{\hyperlink{group__Elm__Gengrid__Item__Group_gga40161f81baa7e0c89b14f84b80c71735a2752198ebed6ede5edf236c45307679e}{ELM\_GENGRID\_ITEM\_SCROLLTO\_IN}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\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{keywordtype}{int} idx = (int)(uintptr\_t)data;}
\DoxyCodeLine{   \textcolor{keywordflow}{return} strdup(items[idx]);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *}
\DoxyCodeLine{\_grid\_content\_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,}
\DoxyCodeLine{                  \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *part)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!strcmp(part, \textcolor{stringliteral}{"{}elm.swallow.icon"{}}))}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordtype}{char} buf[PATH\_MAX];}
\DoxyCodeLine{        snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"{}\%s/images/\%s"{}}, \mbox{\hyperlink{group__Elm__App_gab10cf98c5aa3936dfda01d6bca366d09}{elm\_app\_data\_dir\_get}}(),}
\DoxyCodeLine{                 \textcolor{stringliteral}{"{}sky\_01.jpg"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *icon = \mbox{\hyperlink{group__Elm__Bg_gac8eba3fcce966addec75ab6335e60f6e}{elm\_bg\_add}}(obj);}
\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{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{/* ordering alphabetically */}}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\_index\_icmp(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *data1,}
\DoxyCodeLine{            \textcolor{keyword}{const} \textcolor{keywordtype}{void} *data2)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *label1, *label2;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keyword}{const} \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}} *index\_it1 = data1;}
\DoxyCodeLine{   \textcolor{keyword}{const} \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}} *index\_it2 = data2;}
\DoxyCodeLine{}
\DoxyCodeLine{   label1 = \mbox{\hyperlink{group__Elm__Index__Item__Group_ga63b3be17a2bb05531ba1f31d2da82d7d}{elm\_index\_item\_letter\_get}}(index\_it1);}
\DoxyCodeLine{   label2 = \mbox{\hyperlink{group__Elm__Index__Item__Group_ga63b3be17a2bb05531ba1f31d2da82d7d}{elm\_index\_item\_letter\_get}}(index\_it2);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} strcasecmp(label1, label2);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int}    argc \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},}
\DoxyCodeLine{         \textcolor{keywordtype}{char} **argv \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *win, *grid, *idx;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga13a0c231414b86e62f68afe3c6fb462b}{Elm\_Object\_Item}} *gg\_it;}
\DoxyCodeLine{   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Elm__Gen__Item__Class}{Elm\_Gengrid\_Item\_Class}} gic = \{ 0 \};}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga7a05f37fd3a019da5e26c5fc91fcd937}{elm\_policy\_set}}(\mbox{\hyperlink{group__Elm__General_ggaa16f3378ecdbf660fa378402e3c5a0a9a02fadb6faada04b19d0fa42c11a8d32a}{ELM\_POLICY\_QUIT}}, \mbox{\hyperlink{group__Elm__General_gga46af37e6ac2c406321060be827117196abbe0962d88ae12afe1a173da881f56cd}{ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__App_ga0cefb59efb95841232561d67e34d9909}{elm\_app\_info\_set}}(elm\_main, \textcolor{stringliteral}{"{}elementary"{}}, \textcolor{stringliteral}{"{}images"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{   win = \mbox{\hyperlink{group__Elm__Win__Group_ga23d9d1ffa0a65a1a1dd482d570db1ba0}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"{}index"{}}, \textcolor{stringliteral}{"{}Index Example"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win__Group_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\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{}
\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}} = NULL;}
\DoxyCodeLine{   gic.\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a29069fe3b82c13e822a3ce515e12dac0}{del}} = NULL;}
\DoxyCodeLine{}
\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__Elm__Win__Group_ga505d6bd217e5ee01e82b548ec35986eb}{elm\_win\_resize\_object\_add}}(win, grid);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(grid);}
\DoxyCodeLine{}
\DoxyCodeLine{   idx = \mbox{\hyperlink{group__Elm__Index__Group_gad698859d9e1e325d95d0eaae34a3f2e8}{elm\_index\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(idx, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win__Group_ga505d6bd217e5ee01e82b548ec35986eb}{elm\_win\_resize\_object\_add}}(win, idx);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(idx);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (i = 0; i < (\textcolor{keyword}{sizeof}(items) / \textcolor{keyword}{sizeof}(items[0])); i++)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        \textcolor{keywordtype}{char} buf[32];}
\DoxyCodeLine{}
\DoxyCodeLine{        gg\_it = \mbox{\hyperlink{group__Elm__Gengrid__Group_ga1614357292696e7e8d5bcd71e4843fe6}{elm\_gengrid\_item\_append}}(grid, \&gic, (\textcolor{keywordtype}{void} *)(uintptr\_t)i, NULL, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{comment}{/* indexing by first letters */}}
\DoxyCodeLine{        snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"{}\%c"{}}, items[i][0]);}
\DoxyCodeLine{        \mbox{\hyperlink{group__Elm__Index__Group_ga366a98e1b54ccaaf2f88dca67c812783}{elm\_index\_item\_sorted\_insert}}(idx, buf, NULL, gg\_it, \_index\_icmp, NULL);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(idx, \textcolor{stringliteral}{"{}delay,changed"{}}, \_index\_changed, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Index__Group_ga6569179b38d11fb5fb1286815cf846fb}{elm\_index\_autohide\_disabled\_set}}(idx, \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Index__Group_ga3bb92a868f63463403668a4bbcda21d1}{elm\_index\_level\_go}}(idx, 0);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(win, 320, 300);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_gadf2553f83e6b0b9c7fbe054019a664a1}{elm\_run}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{\mbox{\hyperlink{group__Elm__General_ga50fe52d513f7e89c9c770afd76de7ad9}{ELM\_MAIN}}()}

\end{DoxyCodeInclude}
 