Ejemplo n.º 1
0
EAPI_MAIN int
elm_main(int argc, char **argv) {
	Evas_Object *map = NULL;
	Evas_Object *bg = NULL;
	Evas_Object *icon = NULL;
	Elm_Map_Overlay *item =  NULL;

	win = elm_win_add(NULL, "Main Window", ELM_WIN_BASIC);
	elm_win_title_set(win, "Hello, My World Map!");
	elm_win_autodel_set(win, EINA_TRUE);
	elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

	bg = elm_bg_add(win);
	evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(win, bg);
	evas_object_show(bg);

	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);

	icon = elm_icon_add(win);
	elm_object_text_set(icon, "Icon1");
	elm_icon_standard_set(icon, "home");

	item = elm_map_overlay_add(map,21.009865, 52.224855);
	elm_map_overlay_icon_set(item, icon);

	evas_object_smart_callback_add(win, "focus,in", _register_cb, map);

	register_request_listener(EVENT_SET_FOCUS, set_focus, map);
	register_request_listener(EVENT_UNSET_FOCUS, unset_focus, map);
	register_request_listener(EVENT_SET_FOCUSABLE, set_focusable, map);
	register_request_listener(EVENT_UNSET_FOCUSABLE, unset_focusable, map);
	register_request_listener(EVENT_ADD_CHILDREN, add_children,map);
	register_request_listener(EVENT_RM_CHILDREN, rm_children,item);
	register_request_listener(EVENT_HIDE, hide, map);
	register_request_listener(EVENT_SHOW, show, map);

	register_request_listener(ACTION_ZOOM_IN, register_action_zoom_in, map);
	register_request_listener(ACTION_ZOOM_OUT, register_action_zoom_out, map);
	register_request_listener(ACTION_SCROLL_LEFT, register_action_scroll_left, map);
	register_request_listener(ACTION_SCROLL_RIGHT, register_action_scroll_right, map);
	register_request_listener(ACTION_SCROLL_UP, register_action_scroll_up, map);
	register_request_listener(ACTION_SCROLL_DOWN, register_action_scroll_down, map);
	register_request_listener(ACTION_CLICK, register_action_click, map);
	register_request_listener(ACTION_PRESS, register_action_press, map);

	elm_map_zoom_set(map, 2);

	evas_object_resize(win, 800, 800);
	evas_object_show(win);

	elm_run();
	request_shutdown();
	elm_shutdown();
	return 0;
}
Ejemplo n.º 2
0
void add_children(void *data) {
	Evas_Object *map = (Evas_Object*) data;
	Evas_Object *icon = NULL;
	Elm_Map_Overlay *item =  NULL;
	icon = elm_icon_add(win);
	elm_object_text_set(icon, "Icon2");
	elm_icon_standard_set(icon, "home");
	item = elm_map_overlay_add(map,-53.276369,-9.968851);
	elm_map_overlay_icon_set(item, icon);
}
Ejemplo n.º 3
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *map, *box, *bt;
   Eina_List *ovls = NULL;
   Elm_Map_Overlay *ovl, *city_clas, *country_clas;
   char buf[255];

   elm_app_info_set(elm_main, "elementary", "images");
   data_dir = elm_app_data_dir_get();

   snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", "sdf");
   data_argentina.file = strdup(buf);
   snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", "sdf");
   data_chile.file = strdup(buf);
   snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", "sdf");
   data_sampa.file = strdup(buf);
   snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", "sdf");
   data_rio.file = strdup(buf);
   snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", "sdf");
   data_brasilia.file = strdup(buf);

   win = elm_win_add(NULL, "map", ELM_WIN_BASIC);
   elm_win_title_set(win, "Map Overlay Example");
   evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);

   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

   map = elm_map_add(win);
   elm_win_resize_object_add(win, map);
   evas_object_size_hint_weight_set(map, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(map);

   box = elm_box_add(win);
   evas_object_show(box);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "+");
   elm_box_pack_end(box, bt);
   evas_object_show(bt);
   evas_object_smart_callback_add(bt, "clicked", _bt_zoom_in, map);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "-");
   elm_box_pack_end(box, bt);
   evas_object_show(bt);
   evas_object_smart_callback_add(bt, "clicked", _bt_zoom_out, map);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "X");
   elm_box_pack_end(box, bt);
   evas_object_show(bt);
   evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fit, map);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "#");
   elm_box_pack_end(box, bt);
   evas_object_show(bt);
   evas_object_smart_callback_add(bt, "clicked", _bt_zoom_fill, map);

   evas_object_smart_callback_add(map, "overlay,clicked", _overlay_cb, NULL);

   city_clas = elm_map_overlay_class_add(map);
   elm_map_overlay_displayed_zoom_min_set(city_clas, 3);
   elm_map_overlay_icon_set(city_clas, _clas_city_icon_get(map));

   country_clas = elm_map_overlay_class_add(map);
   elm_map_overlay_displayed_zoom_min_set(country_clas, 1);
   elm_map_overlay_icon_set(country_clas, _clas_country_icon_get(map));

   ovl = elm_map_overlay_add(map, -43.2, -22.9);
   elm_map_overlay_icon_set(ovl, _city_icon_get(map));
   elm_map_overlay_data_set(ovl, &data_rio);
   elm_map_overlay_class_append(city_clas, ovl);
   ovls = eina_list_append(ovls, ovl);

   ovl = elm_map_overlay_add(map, -46.63, -23.55);
   elm_map_overlay_icon_set(ovl, _city_icon_get(map));
   elm_map_overlay_data_set(ovl, &data_sampa);
   elm_map_overlay_class_append(city_clas, ovl);
   ovls = eina_list_append(ovls, ovl);

   ovl = elm_map_overlay_add(map, -47.88, -15.78);
   elm_map_overlay_icon_set(ovl, _city_icon_get(map));
   elm_map_overlay_data_set(ovl, &data_brasilia);
   elm_map_overlay_class_append(city_clas, ovl);
   ovls = eina_list_append(ovls, ovl);

   ovl = elm_map_overlay_add(map, -65.23, -35.1);
   elm_map_overlay_icon_set(ovl, _country_icon_get(map));
   elm_map_overlay_data_set(ovl, &data_argentina);
   elm_map_overlay_class_append(country_clas, ovl);
   ovls = eina_list_append(ovls, ovl);

   ovl = elm_map_overlay_add(map, -71.3, -31.75);
   elm_map_overlay_icon_set(ovl, _country_icon_get(map));
   elm_map_overlay_data_set(ovl, &data_chile);
   elm_map_overlay_class_append(country_clas, ovl);
   ovls = eina_list_append(ovls, ovl);

   elm_map_overlays_show(ovls);

   evas_object_resize(win, 512, 512);
   evas_object_show(win);

   ecore_timer_add(1, _nasty_hack, win);

   elm_run();
   elm_shutdown();

   return 0;
}