

In this example we are going to pack two rectangles in a box, and have a separator in the middle.

So we start we the window, background, box and rectangle creation, all pretty normal stuff\-: 
\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -g separator\_example\_01.c -o separator\_example\_01 `pkg-config --cflags --libs elementary`}

\textcolor{preprocessor}{#include <Elementary.h>}

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   Evas\_Object *win, *bx, *rect, *separator;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"separator"}, \textcolor{stringliteral}{"Separator"});
   elm_win_autodel_set(win, EINA\_TRUE);

   bx = elm_box_add(win);
   elm_box_horizontal_set(bx, EINA\_TRUE);
   evas\_object\_size\_hint\_weight\_set(bx, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   elm_win_resize_object_add(win, bx);
   evas\_object\_show(bx);

   rect = evas\_object\_rectangle\_add(evas\_object\_evas\_get(win));
   evas\_object\_color\_set(rect, 0, 255, 0, 255);
   evas\_object\_size\_hint\_min\_set(rect, 90, 200);
   evas\_object\_size\_hint\_weight\_set(rect, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(rect, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   evas\_object\_show(rect);
   elm_box_pack_end(bx, rect);

\end{DoxyCodeInclude}


Once we have our first rectangle in the box we create and add our separator\-: 
\begin{DoxyCodeInclude}

   separator = elm_separator_add(win);
   elm_separator_horizontal_set(separator, EINA\_TRUE);
   evas\_object\_show(separator);
   elm_box_pack_end(bx, separator);

\end{DoxyCodeInclude}
 \begin{DoxyNote}{Note}
Since our box is in horizontal mode it's a good idea to set the separator to be horizontal too.
\end{DoxyNote}
And now we add our second rectangle and run the main loop\-: 
\begin{DoxyCodeInclude}

   rect = evas\_object\_rectangle\_add(evas\_object\_evas\_get(win));
   evas\_object\_color\_set(rect, 0, 0, 255, 255);
   evas\_object\_size\_hint\_min\_set(rect, 90, 200);
   evas\_object\_size\_hint\_weight\_set(rect, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(rect, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   evas\_object\_show(rect);
   elm_box_pack_end(bx, rect);

   evas\_object\_show(win);

   elm_run();
   elm_shutdown();

   \textcolor{keywordflow}{return} 0;
\}
ELM_MAIN()

\end{DoxyCodeInclude}


This example will look like this\-:

 
\begin{DoxyImage}
\includegraphics{screenshots/separator_example_01}
\caption{width=}
\end{DoxyImage}
 