
\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();
   \textcolor{keywordflow}{return} 0;
\}
ELM_MAIN()
\end{DoxyCodeInclude}
 