\section{map\-\_\-example\-\_\-01.\-c}

\begin{DoxyCodeInclude}

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

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_bt\_zoom\_in(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *ev)
\{
   \textcolor{keywordtype}{int} zoom;
   elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
   zoom = elm_map_zoom_get(data);
   elm_map_zoom_set(data, zoom + 1);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_bt\_zoom\_out(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *ev)
\{
   \textcolor{keywordtype}{int} zoom;
   elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_MANUAL);
   zoom = elm_map_zoom_get(data);
   elm_map_zoom_set(data, zoom - 1);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_bt\_zoom\_fit(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FIT);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_bt\_zoom\_fill(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   elm_map_zoom_mode_set(data, ELM_MAP_ZOOM_MODE_AUTO_FILL);
\}

\textcolor{comment}{/* FIXME: it shouldn't be required. For unknown reason map won't call}
\textcolor{comment}{ * pan\_calculate until shot delay time, but then it will take a screenshot}
\textcolor{comment}{ * when the map isn't loaded yet (actually it won't be downloaded, because}
\textcolor{comment}{ * after the SS it will kill the example). */}
\textcolor{keyword}{static} Eina\_Bool
\_nasty\_hack(\textcolor{keywordtype}{void} *data)
\{
   Evas\_Object *o = data;
   Evas *e = evas\_object\_evas\_get(o);
   evas\_smart\_objects\_calculate(e);
   \textcolor{keywordflow}{return} ECORE\_CALLBACK\_CANCEL;
\}

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

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"map"}, \textcolor{stringliteral}{"Map Creation Example"});
   elm_win_autodel_set(win, EINA\_TRUE);

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

   box = elm_box_add(win);
   evas\_object\_show(box);

   bt = elm_button_add(win);
   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"+"});
   elm_box_pack_end(box, bt);
   evas\_object\_show(bt);
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"clicked"}, \_bt\_zoom\_in, map);

   bt = elm_button_add(win);
   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"-"});
   elm_box_pack_end(box, bt);
   evas\_object\_show(bt);
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"clicked"}, \_bt\_zoom\_out, map);

   bt = elm_button_add(win);
   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"X"});
   elm_box_pack_end(box, bt);
   evas\_object\_show(bt);
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"clicked"}, \_bt\_zoom\_fit, map);

   bt = elm_button_add(win);
   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"#"});
   elm_box_pack_end(box, bt);
   evas\_object\_show(bt);
   evas\_object\_smart\_callback\_add(bt, \textcolor{stringliteral}{"clicked"}, \_bt\_zoom\_fill, map);

   elm_map_zoom_set(map, 12);
   elm_map_region_show(map, -43.2, -22.9);
   evas\_object\_resize(win, 512, 512);
   evas\_object\_show(win);

   ecore\_timer\_add(0.5, \_nasty\_hack, win);

   elm_run();
   elm_shutdown();

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