\hypertarget{combobox_example_01_8c-example}{}\doxysection{combobox\+\_\+example\+\_\+01.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc -\/o combobox\_example\_01 combobox\_example\_01.c -\/g `pkg-\/config -\/-\/cflags -\/-\/libs elementary`}}
\DoxyCodeLine{\textcolor{preprocessor}{\#ifndef \_GNU\_SOURCE}}
\DoxyCodeLine{\textcolor{preprocessor}{\# define \_GNU\_SOURCE}}
\DoxyCodeLine{\textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <string.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Elementary.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_combobox\_clicked\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \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{   printf(\textcolor{stringliteral}{"{}Hover button is clicked and 'clicked' callback is called.\(\backslash\)n"{}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_combobox\_selected\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \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{keyword}{const} \textcolor{keywordtype}{char} *txt = elm\_object\_item\_text\_get(event\_info);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}'selected' callback is called. (selected item : \%s)\(\backslash\)n"{}}, txt);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_combobox\_dismissed\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \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{   printf(\textcolor{stringliteral}{"{}'dismissed' callback is called.\(\backslash\)n"{}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_combobox\_expanded\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \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{   printf(\textcolor{stringliteral}{"{}'expanded' callback is called.\(\backslash\)n"{}});}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_combobox\_item\_pressed\_cb(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj,}
\DoxyCodeLine{                      \textcolor{keywordtype}{void} *event\_info)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *txt = elm\_object\_item\_text\_get(event\_info);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}'item,pressed' callback is called. (selected item : \%s)\(\backslash\)n"{}}, txt);}
\DoxyCodeLine{   elm\_object\_text\_set(obj, txt);}
\DoxyCodeLine{   elm\_combobox\_hover\_end(obj);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{char} *}
\DoxyCodeLine{gl\_text\_get(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{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} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} gl\_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{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{gl\_filter\_get(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{void} *key)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{comment}{// if the key is empty/NULL, return true for item}}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!strlen((\textcolor{keywordtype}{char} *)key)) \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\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}{if} (\mbox{\hyperlink{group__Evil__String__Group_ga8a80606ce9378d93ba4e9b256b5c967a}{strcasestr}}(buf, (\textcolor{keywordtype}{char} *)key))}
\DoxyCodeLine{     \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{   \textcolor{comment}{// Default case should return false (item fails filter hence will be hidden)}}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\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{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *win, *bg;}
\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{}
\DoxyCodeLine{   win = \mbox{\hyperlink{group__Elm__Win__Group_ga23d9d1ffa0a65a1a1dd482d570db1ba0}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"{}combobox"{}}, \textcolor{stringliteral}{"{}Combobox"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win__Group_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{   bg = \mbox{\hyperlink{group__Elm__Bg_gac8eba3fcce966addec75ab6335e60f6e}{elm\_bg\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(bg, \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}}(bg, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win__Group_ga505d6bd217e5ee01e82b548ec35986eb}{elm\_win\_resize\_object\_add}}(win, bg);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bg);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *bx = \mbox{\hyperlink{group__Elm__Box__Group_ga49ec615c90bf8bead2158d5ffab2e445}{elm\_box\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(bx, \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, bx);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bx);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *combobox = \mbox{\hyperlink{group__Elm__Combobox_ga37d9eca2d15a9dc90055cdfb1dd95b03}{elm\_combobox\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(combobox, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, 0);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(combobox, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, 0);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga9c088563c442670796564d2e5158f154}{elm\_object\_part\_text\_set}}(combobox, \textcolor{stringliteral}{"{}guide"{}}, \textcolor{stringliteral}{"{}A Simple list"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx, combobox);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(combobox);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Elm__Gen__Item__Class}{Elm\_Genlist\_Item\_Class}} *itc;}
\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}} = gl\_text\_get;}
\DoxyCodeLine{   itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a796220b356374cd6395bcd2c3668f8d8}{content\_get}} = NULL;}
\DoxyCodeLine{   itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a23a335ae22003578adc536313f21e6e5}{state\_get}} = gl\_state\_get;}
\DoxyCodeLine{   itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a6025c63f4b34768fb77bf00d39f20523}{filter\_get}} = gl\_filter\_get;}
\DoxyCodeLine{   itc-\/>\mbox{\hyperlink{struct__Elm__Gen__Item__Class_a457622de444f6539822387321996418d}{func}}.\mbox{\hyperlink{struct__Elm__Gen__Item__Class__Functions_a29069fe3b82c13e822a3ce515e12dac0}{del}} = NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{for} (\textcolor{keywordtype}{int} i = 0; i < 1000; i++)}
\DoxyCodeLine{     \mbox{\hyperlink{group__Elm__Genlist__Group_ga869214cf76896bc311c9464ad21126e0}{elm\_genlist\_item\_append}}(combobox, itc, (\textcolor{keywordtype}{void} *)(uintptr\_t)i,}
\DoxyCodeLine{                             NULL, \mbox{\hyperlink{group__Elm__Genlist__Item__Group_gga9727d3b92987319ac981247bc196bd0fa1ffe76fc4e7fd2bb40e47290c01ac0df}{ELM\_GENLIST\_ITEM\_NONE}}, NULL,}
\DoxyCodeLine{                             (\textcolor{keywordtype}{void}*)(uintptr\_t)(i * 10));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(combobox, \textcolor{stringliteral}{"{}clicked"{}},}
\DoxyCodeLine{                                  \_combobox\_clicked\_cb, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(combobox, \textcolor{stringliteral}{"{}selected"{}},}
\DoxyCodeLine{                                  \_combobox\_selected\_cb, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(combobox, \textcolor{stringliteral}{"{}dismissed"{}},}
\DoxyCodeLine{                                  \_combobox\_dismissed\_cb, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(combobox, \textcolor{stringliteral}{"{}expanded"{}},}
\DoxyCodeLine{                                  \_combobox\_expanded\_cb, NULL);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(combobox, \textcolor{stringliteral}{"{}item,pressed"{}},}
\DoxyCodeLine{                                  \_combobox\_item\_pressed\_cb, NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(win, 300, 500);}
\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}
 