\chapter{genlist\+\_\+example\+\_\+01.\+c}
\hypertarget{genlist_example_01_c}{}\label{genlist_example_01_c}\index{genlist\_example\_01.c@{genlist\_example\_01.c}}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile\ with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc\ -\/g\ genlist\_example\_01.c\ -\/o\ genlist\_example\_01\ \`{}pkg-\/config\ -\/-\/cflags\ -\/-\/libs\ elementary`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Elementary.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define\ N\_ITEMS\ 30}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{struct__Elm__Gen__Item__Class}{Elm\_Genlist\_Item\_Class}}\ *\_itc\ =\ NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{char}\ *}
\DoxyCodeLine{\_item\_label\_get(\textcolor{keywordtype}{void}\ *data,\ Evas\_Object\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *part\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{char}\ buf[256];}
\DoxyCodeLine{\ \ \ snprintf(buf,\ \textcolor{keyword}{sizeof}(buf),\ \textcolor{stringliteral}{"{}Item\ \#\ \%i"{}},\ (\textcolor{keywordtype}{int})(uintptr\_t)data);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ strdup(buf);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ Evas\_Object\ *}
\DoxyCodeLine{\_item\_content\_get(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ Evas\_Object\ *obj,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *part)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Evas\_Object\ *ic\ =\ \mbox{\hyperlink{group__Elm__Icon_gac369f2d67be417e5cff81e8f001ff326}{elm\_icon\_add}}(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!strcmp(part,\ \textcolor{stringliteral}{"{}elm.swallow.icon"{}}))}
\DoxyCodeLine{\ \ \ \ \ \mbox{\hyperlink{group__Elm__Icon_gab764b4c6c90543f254c013eff6a6db66}{elm\_icon\_standard\_set}}(ic,\ \textcolor{stringliteral}{"{}clock"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gab09d6bf93b5435230b41ceca2abe783a}{evas\_object\_size\_hint\_aspect\_set}}(ic,\ \mbox{\hyperlink{Evas__Common_8h_ac68b577b7c0b79c356f01926e4a8099faeaf1e019f2dbfbbc2da9ab1fe1f175f6}{EVAS\_ASPECT\_CONTROL\_VERTICAL}},\ 1,\ 1);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ ic;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_item\_sel\_cb(\textcolor{keywordtype}{void}\ *data,\ Evas\_Object\ *obj,\ \textcolor{keywordtype}{void}\ *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}sel\ item\ data\ [\%p]\ on\ genlist\ obj\ [\%p],\ item\ pointer\ [\%p]\(\backslash\)n"{}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ data,\ obj,\ event\_info);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int}\ argc\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{char}\ **argv\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Evas\_Object\ *win;}
\DoxyCodeLine{\ \ \ Evas\_Object\ *list;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ i;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ win\ =\ \mbox{\hyperlink{group__Elm__Win__Group_ga23d9d1ffa0a65a1a1dd482d570db1ba0}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"{}genlist"{}},\ \textcolor{stringliteral}{"{}Genlist"{}});}
\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__Win__Group_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!\_itc)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \_itc\ =\ \mbox{\hyperlink{group__Elm__Genlist__Group_gaddc052cd4804afe97c2c6a4ac68eb8a4}{elm\_genlist\_item\_class\_new}}();}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \_itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_aa611ea90d00c3e0f9abe25ff56fc420f}{item\_style}}\ =\ \textcolor{stringliteral}{"{}default"{}};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \_itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_ae7a3a244fab9e126b3ac264615535c41}{text\_get}}\ =\ \_item\_label\_get;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \_itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a796220b356374cd6395bcd2c3668f8d8}{content\_get}}\ =\ \_item\_content\_get;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \_itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a23a335ae22003578adc536313f21e6e5}{state\_get}}\ =\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \_itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a29069fe3b82c13e822a3ce515e12dac0}{del}}\ =\ NULL;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ list\ =\ \mbox{\hyperlink{group__Elm__Genlist__Group_ga450dfb84aa3e9c092b9c003db1e1c47f}{elm\_genlist\_add}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ N\_ITEMS;\ i++)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__Genlist__Group_ga869214cf76896bc311c9464ad21126e0}{elm\_genlist\_item\_append}}(list,\ \_itc,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (\textcolor{keywordtype}{void}\ *)(uintptr\_t)i,\ NULL,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__Genlist__Item__Group_gga9727d3b92987319ac981247bc196bd0fa1ffe76fc4e7fd2bb40e47290c01ac0df}{ELM\_GENLIST\_ITEM\_NONE}},}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_item\_sel\_cb,\ NULL);}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(list,\ \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,\ list);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(list);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(win,\ 320,\ 320);}
\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}
 