
\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -g actionslider\_example\_01.c -o actionslider\_example\_01 `pkg-config --cflags --libs elementary`}

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

\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_pos\_selected\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   printf(\textcolor{stringliteral}{"Selection: %s\(\backslash\)n"}, (\textcolor{keywordtype}{char} *)event\_info);
   printf(\textcolor{stringliteral}{"Label selected: %s\(\backslash\)n"}, elm_actionslider_selected_label_get(obj));
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_position\_change\_magnetic\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object * obj, \textcolor{keywordtype}{void} *event\_info)
\{
   \textcolor{keywordflow}{if} (!strcmp((\textcolor{keywordtype}{char} *)event\_info, \textcolor{stringliteral}{"left"}))
     elm_actionslider_magnet_pos_set(obj, ELM\_ACTIONSLIDER\_LEFT);
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp((\textcolor{keywordtype}{char} *)event\_info, \textcolor{stringliteral}{"right"}))
     elm_actionslider_magnet_pos_set(obj, ELM\_ACTIONSLIDER\_RIGHT);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_magnet\_enable\_disable\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   \textcolor{keywordflow}{if} (!strcmp((\textcolor{keywordtype}{char} *)event\_info, \textcolor{stringliteral}{"left"}))
     elm_actionslider_magnet_pos_set(obj, ELM\_ACTIONSLIDER\_CENTER);
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp((\textcolor{keywordtype}{char} *)event\_info, \textcolor{stringliteral}{"right"}))
     elm_actionslider_magnet_pos_set(obj, ELM\_ACTIONSLIDER\_NONE);
\}

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

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

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

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

   as = elm_actionslider_add(win);
   evas\_object\_size\_hint\_weight\_set(as, EVAS\_HINT\_EXPAND, 0);
   evas\_object\_size\_hint\_align\_set(as, EVAS\_HINT\_FILL, 0);
   elm_actionslider_indicator_pos_set(as, ELM\_ACTIONSLIDER\_RIGHT);
   elm_actionslider_magnet_pos_set(as, ELM\_ACTIONSLIDER\_RIGHT);
   elm_object_part_text_set(as, \textcolor{stringliteral}{"left"}, \textcolor{stringliteral}{"Snooze"});
   elm_object_part_text_set(as, \textcolor{stringliteral}{"right"}, \textcolor{stringliteral}{"Stop"});
   elm_actionslider_enabled_pos_set(as, ELM\_ACTIONSLIDER\_LEFT |
                                    ELM\_ACTIONSLIDER\_RIGHT);
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"pos\_changed"},
                                  \_position\_change\_magnetic\_cb, NULL);
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"selected"}, \_pos\_selected\_cb, NULL);
   evas\_object\_show(as);
   elm_box_pack_end(bx, as);

   as = elm_actionslider_add(win);
   evas\_object\_size\_hint\_weight\_set(as, EVAS\_HINT\_EXPAND, 0);
   evas\_object\_size\_hint\_align\_set(as, EVAS\_HINT\_FILL, 0);
   elm_actionslider_indicator_pos_set(as, ELM\_ACTIONSLIDER\_CENTER);
   elm_actionslider_magnet_pos_set(as, ELM\_ACTIONSLIDER\_CENTER);
   elm_object_part_text_set(as, \textcolor{stringliteral}{"left"}, \textcolor{stringliteral}{"Snooze"});
   elm_object_part_text_set(as, \textcolor{stringliteral}{"right"}, \textcolor{stringliteral}{"Stop"});
   elm_actionslider_enabled_pos_set(as, ELM\_ACTIONSLIDER\_LEFT |
                                    ELM\_ACTIONSLIDER\_RIGHT);
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"selected"}, \_pos\_selected\_cb, NULL);
   evas\_object\_show(as);
   elm_box_pack_end(bx, as);

   as = elm_actionslider_add(win);
   elm_object_style_set(as, \textcolor{stringliteral}{"bar"});
   evas\_object\_size\_hint\_weight\_set(as, EVAS\_HINT\_EXPAND, 0);
   evas\_object\_size\_hint\_align\_set(as, EVAS\_HINT\_FILL, 0);
   elm_actionslider_indicator_pos_set(as, ELM\_ACTIONSLIDER\_LEFT);
   elm_actionslider_magnet_pos_set(as, ELM\_ACTIONSLIDER\_CENTER|
                                   ELM\_ACTIONSLIDER\_RIGHT);
   elm_actionslider_enabled_pos_set(as, ELM\_ACTIONSLIDER\_CENTER |
                                    ELM\_ACTIONSLIDER\_RIGHT);
   elm_object_part_text_set(as, \textcolor{stringliteral}{"center"}, \textcolor{stringliteral}{"Accept"});
   elm_object_part_text_set(as, \textcolor{stringliteral}{"right"}, \textcolor{stringliteral}{"Reject"});
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"selected"}, \_pos\_selected\_cb, NULL);
   evas\_object\_show(as);
   elm_box_pack_end(bx, as);

   as = elm_actionslider_add(win);
   elm_object_style_set(as, \textcolor{stringliteral}{"bar"});
   evas\_object\_size\_hint\_weight\_set(as, EVAS\_HINT\_EXPAND, 0);
   evas\_object\_size\_hint\_align\_set(as, EVAS\_HINT\_FILL, 0);
   elm_actionslider_indicator_pos_set(as, ELM\_ACTIONSLIDER\_LEFT);
   elm_actionslider_magnet_pos_set(as, ELM\_ACTIONSLIDER\_LEFT);
   elm_object_part_text_set(as, \textcolor{stringliteral}{"center"}, \textcolor{stringliteral}{"Accept"});
   elm_object_part_text_set(as, \textcolor{stringliteral}{"right"}, \textcolor{stringliteral}{"Reject"});
   elm\_object\_text\_set(as, \textcolor{stringliteral}{"Go"});
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"pos\_changed"},
                                  \_position\_change\_magnetic\_cb, NULL);
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"selected"}, \_pos\_selected\_cb, NULL);
   evas\_object\_show(as);
   elm_box_pack_end(bx, as);


   as = elm_actionslider_add(win);
   evas\_object\_size\_hint\_weight\_set(as, EVAS\_HINT\_EXPAND, 0);
   evas\_object\_size\_hint\_align\_set(as, EVAS\_HINT\_FILL, 0);
   elm_actionslider_indicator_pos_set(as, ELM\_ACTIONSLIDER\_LEFT);
   elm_actionslider_magnet_pos_set(as, ELM\_ACTIONSLIDER\_ALL);
   elm_object_part_text_set(as, \textcolor{stringliteral}{"left"}, \textcolor{stringliteral}{"Left"});
   elm_object_part_text_set(as, \textcolor{stringliteral}{"center"}, \textcolor{stringliteral}{"Center"});
   elm_object_part_text_set(as, \textcolor{stringliteral}{"right"}, \textcolor{stringliteral}{"Right"});
   elm\_object\_text\_set(as, \textcolor{stringliteral}{"Go"});
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"selected"}, \_pos\_selected\_cb, NULL);
   evas\_object\_show(as);
   elm_box_pack_end(bx, as);

   as = elm_actionslider_add(win);
   evas\_object\_size\_hint\_weight\_set(as, EVAS\_HINT\_EXPAND, 0);
   evas\_object\_size\_hint\_align\_set(as, EVAS\_HINT\_FILL, 0);
   elm_actionslider_indicator_pos_set(as, ELM\_ACTIONSLIDER\_CENTER);
   elm_actionslider_magnet_pos_set(as, ELM\_ACTIONSLIDER\_CENTER);
   elm_object_part_text_set(as, \textcolor{stringliteral}{"left"}, \textcolor{stringliteral}{"Enable"});
   elm_object_part_text_set(as, \textcolor{stringliteral}{"center"}, \textcolor{stringliteral}{"Magnet"});
   elm_object_part_text_set(as, \textcolor{stringliteral}{"right"}, \textcolor{stringliteral}{"Disable"});
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"pos\_changed"},
                                  \_magnet\_enable\_disable\_cb, NULL);
   evas\_object\_smart\_callback\_add(as, \textcolor{stringliteral}{"selected"}, \_pos\_selected\_cb, NULL);
   evas\_object\_show(as);
   elm_box_pack_end(bx, as);

   evas\_object\_resize(win, 320, 400);
   evas\_object\_show(win);

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