\hypertarget{box_example_02_8c-example}{}\doxysection{box\+\_\+example\+\_\+02.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc -\/g box\_example\_02.c -\/o box\_example\_02 `pkg-\/config -\/-\/cflags -\/-\/libs elementary`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Elementary.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef} \textcolor{keyword}{struct}}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *transitions;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *box;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Box_gad3ef5177a00dcda0c08c86287419d5b5}{Evas\_Object\_Box\_Layout}} last\_layout;}
\DoxyCodeLine{\} Transitions\_Data;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_add\_cb(\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} *ev \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *btn;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *children;}
\DoxyCodeLine{   Transitions\_Data *tdata = data;}
\DoxyCodeLine{}
\DoxyCodeLine{   btn = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(tdata-\/>box);}
\DoxyCodeLine{   elm\_object\_text\_set(btn, \textcolor{stringliteral}{"I do nothing"});}
\DoxyCodeLine{   children = (\mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *)elm\_box\_children\_get(tdata-\/>box);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (children)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        elm\_box\_pack\_after(tdata-\/>box, btn, (\mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *)children-\/>\mbox{\hyperlink{struct__Eina__List_a043e22d601d3a0504f30255a43a25e7a}{data}});}
\DoxyCodeLine{        \mbox{\hyperlink{group__Eina__List__Group_ga608bd2fbf06293a1b794648990703ab4}{eina\_list\_free}}(children);}
\DoxyCodeLine{     \}}
\DoxyCodeLine{   \textcolor{keywordflow}{else}}
\DoxyCodeLine{     elm\_box\_pack\_end(tdata-\/>box, btn);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(btn);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_clear\_cb(\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} *ev \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Transitions\_Data *tdata = data;}
\DoxyCodeLine{   elm\_box\_clear(tdata-\/>box);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_unpack\_cb(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *ev \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Transitions\_Data *tdata = data;}
\DoxyCodeLine{   elm\_box\_unpack(tdata-\/>box, obj);}
\DoxyCodeLine{   evas\_object\_move(obj, 0, 50);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(obj, 128, 64, 0, 128);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_test\_box\_transition\_change(\textcolor{keywordtype}{void} *data)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Transitions\_Data *tdata = data;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Elm__Box__Transition}{Elm\_Box\_Transition}} *layout\_data;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Box_gad3ef5177a00dcda0c08c86287419d5b5}{Evas\_Object\_Box\_Layout}} next\_layout;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!data) \textcolor{keywordflow}{return};}
\DoxyCodeLine{   next\_layout = \mbox{\hyperlink{group__Eina__List__Group_gaec845f0bfb16a14e8d7f0cd508ca7e9c}{eina\_list\_data\_get}}(tdata-\/>transitions);}
\DoxyCodeLine{   layout\_data = \mbox{\hyperlink{group__Elm__Box_ga4a70cd7719f20a6d60e4abdf57eeca4e}{elm\_box\_transition\_new}}(2.0, tdata-\/>last\_layout,}
\DoxyCodeLine{                                        NULL, NULL, next\_layout, NULL, NULL,}
\DoxyCodeLine{                                        \_test\_box\_transition\_change, tdata);}
\DoxyCodeLine{   elm\_box\_layout\_set(tdata-\/>box, \mbox{\hyperlink{group__Elm__Box_ga15194ef319ae722b03f608373f90fe1f}{elm\_box\_layout\_transition}}, layout\_data,}
\DoxyCodeLine{                      \mbox{\hyperlink{group__Elm__Box_gab7b726e4dbfb80da529431d198add95e}{elm\_box\_transition\_free}});}
\DoxyCodeLine{   tdata-\/>last\_layout = next\_layout;}
\DoxyCodeLine{}
\DoxyCodeLine{   tdata-\/>transitions = \mbox{\hyperlink{group__Eina__List__Group_ga082644881a2333bd16208c00931703cd}{eina\_list\_demote\_list}}(tdata-\/>transitions,}
\DoxyCodeLine{                                              tdata-\/>transitions);}
\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, *bigbox, *bx, *bt;}
\DoxyCodeLine{   \textcolor{keyword}{static} Transitions\_Data tdata = \{}
\DoxyCodeLine{        .transitions = NULL,}
\DoxyCodeLine{        .box = NULL,}
\DoxyCodeLine{        .last\_layout = NULL}
\DoxyCodeLine{   \};}
\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_gac75d7752662fab73d6420706ce5be996}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"box-\/transition"}, \textcolor{stringliteral}{"Box Transition"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{   bigbox = \mbox{\hyperlink{group__Elm__Box_ga3d0998b60ada633bacfa8869a921cfd7}{elm\_box\_add}}(win);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(bigbox, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win_ga505d6bd217e5ee01e82b548ec35986eb}{elm\_win\_resize\_object\_add}}(win, bigbox);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bigbox);}
\DoxyCodeLine{}
\DoxyCodeLine{   bx = \mbox{\hyperlink{group__Elm__Box_ga3d0998b60ada633bacfa8869a921cfd7}{elm\_box\_add}}(win);}
\DoxyCodeLine{   elm\_box\_horizontal\_set(bx, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   elm\_box\_pack\_end(bigbox, bx);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bx);}
\DoxyCodeLine{}
\DoxyCodeLine{   bt = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"Add"});}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(bt, \textcolor{stringliteral}{"clicked"}, \_add\_cb, \&tdata);}
\DoxyCodeLine{}
\DoxyCodeLine{   bt = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"Clear"});}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(bt, \textcolor{stringliteral}{"clicked"}, \_clear\_cb, \&tdata);}
\DoxyCodeLine{}
\DoxyCodeLine{   bx = \mbox{\hyperlink{group__Elm__Box_ga3d0998b60ada633bacfa8869a921cfd7}{elm\_box\_add}}(win);}
\DoxyCodeLine{   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{   evas\_object\_size\_hint\_align\_set(bx, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   elm\_box\_pack\_end(bigbox, bx);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bx);}
\DoxyCodeLine{}
\DoxyCodeLine{   bt = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"Button 1"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(bt, \textcolor{stringliteral}{"clicked"}, \_unpack\_cb, \&tdata);}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(bt, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   evas\_object\_size\_hint\_align\_set(bt, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bt);}
\DoxyCodeLine{}
\DoxyCodeLine{   bt = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"Button 2"});}
\DoxyCodeLine{   evas\_object\_size\_hint\_weight\_set(bt, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, 0.0);}
\DoxyCodeLine{   evas\_object\_size\_hint\_align\_set(bt, 1.0, 0.5);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(bt, \textcolor{stringliteral}{"clicked"}, \_unpack\_cb, \&tdata);}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bt);}
\DoxyCodeLine{}
\DoxyCodeLine{   bt = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"Button 3"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(bt, \textcolor{stringliteral}{"clicked"}, \_unpack\_cb, \&tdata);}
\DoxyCodeLine{   elm\_box\_pack\_end(bx, bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bt);}
\DoxyCodeLine{}
\DoxyCodeLine{   tdata.box = bx;}
\DoxyCodeLine{   tdata.last\_layout = evas\_object\_box\_layout\_horizontal;}
\DoxyCodeLine{   tdata.transitions = \mbox{\hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}}(tdata.transitions,}
\DoxyCodeLine{                                        evas\_object\_box\_layout\_vertical);}
\DoxyCodeLine{   tdata.transitions = \mbox{\hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}}(tdata.transitions,}
\DoxyCodeLine{                                        evas\_object\_box\_layout\_horizontal);}
\DoxyCodeLine{   tdata.transitions = \mbox{\hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}}(tdata.transitions,}
\DoxyCodeLine{                                        evas\_object\_box\_layout\_stack);}
\DoxyCodeLine{   tdata.transitions = \mbox{\hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}}(tdata.transitions,}
\DoxyCodeLine{                                        evas\_object\_box\_layout\_homogeneous\_vertical);}
\DoxyCodeLine{   tdata.transitions = \mbox{\hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}}(tdata.transitions,}
\DoxyCodeLine{                                        evas\_object\_box\_layout\_homogeneous\_horizontal);}
\DoxyCodeLine{   tdata.transitions = \mbox{\hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}}(tdata.transitions,}
\DoxyCodeLine{                                        evas\_object\_box\_layout\_flow\_vertical);}
\DoxyCodeLine{   tdata.transitions = \mbox{\hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}}(tdata.transitions,}
\DoxyCodeLine{                                        evas\_object\_box\_layout\_flow\_horizontal);}
\DoxyCodeLine{   tdata.transitions = \mbox{\hyperlink{group__Eina__List__Group_ga92ec14d1a1040a361c4d8cd0ab7b0ecc}{eina\_list\_append}}(tdata.transitions,}
\DoxyCodeLine{                                        evas\_object\_box\_layout\_stack);}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_box\_layout\_set(bx, evas\_object\_box\_layout\_horizontal, NULL, NULL);}
\DoxyCodeLine{   \_test\_box\_transition\_change(\&tdata);}
\DoxyCodeLine{}
\DoxyCodeLine{   evas\_object\_resize(win, 300, 320);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{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}
 