This example shows how one can send and receive signals to/from the layout, and what to do when the layout theme has its size changed.

The full source code for this example can be found at \mbox{\hyperlink{layout_example_03_c}{layout\+\_\+example\+\_\+03.\+c}}.

In this example we will use another group from the same layout theme file used in \mbox{\hyperlink{layout_example_01}{Layout -\/ Content, Table and Box}}. Its instantiation and loading happens in the following lines\+:

 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ layout\ =\ \mbox{\hyperlink{group__Elm__Layout_ga5bcf7d68b0401cc7d557ef7d297baa3e}{elm\_layout\_add}}(win);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(layout,\ \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,\ layout);}
\DoxyCodeLine{\ \ \ snprintf(buf,\ \textcolor{keyword}{sizeof}(buf),\ \textcolor{stringliteral}{"{}\%s/examples/layout\_example.edj"{}},\ \mbox{\hyperlink{group__Elm__App_gab10cf98c5aa3936dfda01d6bca366d09}{elm\_app\_data\_dir\_get}}());}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Layout_ga8d1105463d52787a7b0ca8d7402cd3ea}{elm\_layout\_file\_set}}(layout,\ buf,\ \textcolor{stringliteral}{"{}example/mylayout3"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(layout);}

\end{DoxyCodeInclude}
 This time we register a callback to be called whenever we receive a signal after the end of the animation that happens in this layout\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga6f9574b798efcd454afdac6f2904f633}{elm\_object\_signal\_callback\_add}}(layout,\ \textcolor{stringliteral}{"{}size,changed"{}},\ \textcolor{stringliteral}{"{}"{}},\ \_size\_changed\_cb,\ layout);}

\end{DoxyCodeInclude}
 We also add a button that will send signals to the layout\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Setting\ title}}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *title\ =\ \mbox{\hyperlink{group__Elm__Layout_ga29b7c0fb4a44526c76154782bc4e3b8e}{elm\_layout\_data\_get}}(layout,\ \textcolor{stringliteral}{"{}title"{}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (title)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__Win__Group_ga0e0b613ac6b5d1e0e71f2ec17e80cb07}{elm\_win\_title\_set}}(win,\ title);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__General_ga9c088563c442670796564d2e5158f154}{elm\_object\_part\_text\_set}}(layout,\ TITLE,\ title);}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ btn\ =\ \mbox{\hyperlink{group__Elm__Button_gaf5caf46d74c4e122a18da323935d25e4}{elm\_button\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(btn,\ \textcolor{stringliteral}{"{}Enlarge\ me!"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(btn,\ \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}}(btn,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(layout,\ SWALLOW,\ btn);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(btn,\ \textcolor{stringliteral}{"{}clicked"{}},\ \_swallow\_btn\_cb,\ layout);}

\end{DoxyCodeInclude}
 The callback for this button will check what type of signal it should send, and then emit it. The code for this callback follows\+:

 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}\ \_btn\_large\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_swallow\_btn\_cb(\textcolor{keywordtype}{void}\ *data,\ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *btn,\ \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}}\ *layout\ =\ data;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (\_btn\_large\ ==\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}})}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \_btn\_large\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__General_ga1beada7edf5d714c0dba5459bcc993fc}{elm\_object\_signal\_emit}}(layout,\ \textcolor{stringliteral}{"{}button,enlarge"{}},\ \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ elm\_object\_text\_set(btn,\ \textcolor{stringliteral}{"{}Reduce\ me!"{}});}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \_btn\_large\ =\ \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \mbox{\hyperlink{group__Elm__General_ga1beada7edf5d714c0dba5459bcc993fc}{elm\_object\_signal\_emit}}(layout,\ \textcolor{stringliteral}{"{}button,reduce"{}},\ \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ elm\_object\_text\_set(btn,\ \textcolor{stringliteral}{"{}Enlarge\ me!"{}});}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 As we said before, we are receiving a signal whenever the animation started by the button click ends. This is the callback for that signal\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_size\_changed\_cb(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *layout,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *emission\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *source\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}}\ *edje;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{Evas__Common_8h_a2453e92182bad3b0e0d84e5aff433b07}{Evas\_Coord}}\ w,\ h;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Layout_ga706284d5508c9ef6ee23e93d072dbb8d}{elm\_layout\_sizing\_eval}}(layout);}
\DoxyCodeLine{\ \ \ edje\ =\ \mbox{\hyperlink{group__Elm__Layout_ga1bdc387d277400861d72a3f6d43c5c03}{elm\_layout\_edje\_get}}(layout);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Edje__Object__Group_gae8dc1397ff94126f3083280a0400cfbc}{edje\_object\_size\_min\_calc}}(edje,\ \&w,\ \&h);}
\DoxyCodeLine{\ \ \ printf(\textcolor{stringliteral}{"{}Minimum\ size\ for\ this\ theme:\ \%dx\%d\(\backslash\)n"{}},\ w,\ h);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Notice from this callback that the \mbox{\hyperlink{group__Elm__Layout_ga706284d5508c9ef6ee23e93d072dbb8d}{elm\+\_\+layout\+\_\+sizing\+\_\+eval()}} function must be called if we want our widget to update its size after the layout theme having changed its minimum size. This happens because the animation specified in the theme increases the size of the content area to a value higher than the widget size, thus requiring more space. But the elementary layout widget has no way to know this, thus needing the \mbox{\hyperlink{group__Elm__Layout_ga706284d5508c9ef6ee23e93d072dbb8d}{elm\+\_\+layout\+\_\+sizing\+\_\+eval()}} to be called on the layout, informing that this size has changed.

A screenshot of this example can be seen on\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{layout_example_03}}
\end{DoxyImageNoCaption}
 