\section{segment\+\_\+control\+\_\+example.\+c}

\begin{DoxyCodeInclude}

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

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   Evas\_Object *win, *sc, *ic;
   Elm_Object_Item *seg\_it;
   \textcolor{keywordtype}{int} count, idx;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"segment\_control"}, \textcolor{stringliteral}{"Segment Control Example"});
   elm_win_autodel_set(win, EINA\_TRUE);

   sc = elm_segment_control_add(win);
   evas\_object\_size\_hint\_weight\_set(sc, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   elm_win_resize_object_add(win, sc);
   evas\_object\_show(sc);

   elm_segment_control_item_add(sc, NULL, \textcolor{stringliteral}{"only text"});

   ic = elm_icon_add(win);
   elm_icon_standard_set(ic, \textcolor{stringliteral}{"close"});
   elm_segment_control_item_add(sc, ic, NULL);

   ic = elm_icon_add(win);
   elm_icon_standard_set(ic, \textcolor{stringliteral}{"home"});
   elm_segment_control_item_add(sc, ic, \textcolor{stringliteral}{"Home"});

   ic = elm_icon_add(win);
   elm_icon_standard_set(ic, \textcolor{stringliteral}{"close"});
   elm_segment_control_item_add(sc, ic, \textcolor{stringliteral}{""});

   count = elm_segment_control_item_count_get(sc);
   elm_segment_control_item_insert_at(sc, NULL, \textcolor{stringliteral}{"Inserted at"}, count - 1);

   seg\_it = elm_segment_control_item_insert_at(sc, NULL, \textcolor{stringliteral}{"To be deleted"}, 2);
   elm\_object\_item\_del(seg\_it);

   elm_segment_control_item_insert_at(sc, NULL, \textcolor{stringliteral}{"To be deleted"}, 2);
   elm_segment_control_item_del_at(sc, 2);

   seg\_it = elm_segment_control_item_get(sc, 0);
   elm_object_item_text_set(seg\_it, \textcolor{stringliteral}{"Only Text"});

   count = elm_segment_control_item_count_get(sc);
   seg\_it = elm_segment_control_item_get(sc, count / 2);
   elm_segment_control_item_selected_set(seg\_it, EINA\_TRUE);
   seg\_it = elm_segment_control_item_selected_get(sc);
   idx = elm_segment_control_item_index_get(seg\_it);
   printf(\textcolor{stringliteral}{"Item selected: %i\(\backslash\)n"}, idx);

   evas\_object\_show(win);

   elm_run();

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