From 2c1190a78301ec8c5692d4585bdc214177de1968 Mon Sep 17 00:00:00 2001 From: gouache Date: Thu, 26 May 2011 12:40:29 +0000 Subject: [PATCH] Elementary map: add APIs for setting min,max zoom level git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@59704 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/test_map.c | 14 ++++++++++++++ src/lib/Elementary.h.in | 2 ++ src/lib/elm_map.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/src/bin/test_map.c b/src/bin/test_map.c index edc9ee6..4262e0c 100644 --- a/src/bin/test_map.c +++ b/src/bin/test_map.c @@ -429,6 +429,18 @@ map_rotate_reset(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU } static void +map_zoom_min_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_source_zoom_min_set(data, 1); +} + +static void +map_zoom_max_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + elm_map_source_zoom_max_set(data, 10); +} + +static void map_source(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Map_Source *s = data; @@ -628,6 +640,8 @@ _map_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event elm_menu_item_add(menu, NULL, NULL, "Rotate CW", map_rotate_cw, data); elm_menu_item_add(menu, NULL, NULL, "Rotate CCW", map_rotate_ccw, data); elm_menu_item_add(menu, NULL, NULL, "Reset Rotate", map_rotate_reset, data); + elm_menu_item_add(menu, NULL, NULL, "Set Zoom Min to 1", map_zoom_min_set, data); + elm_menu_item_add(menu, NULL, NULL, "Set Zoom Max to 10", map_zoom_max_set, data); elm_menu_move(menu, down->canvas.x, down->canvas.y); evas_object_show(menu); diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 27cca7a..3e8b825 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -2405,7 +2405,9 @@ EAPI Elm_Genlist_Item *elm_genlist_item_sorted_insert(Evas_Object *obj, const El EAPI const char *elm_map_source_name_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_map_route_source_set(Evas_Object *obj, Elm_Map_Route_Sources source) EINA_ARG_NONNULL(1); EAPI Elm_Map_Route_Sources elm_map_route_source_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_map_source_zoom_min_set(Evas_Object *obj, int zoom) EINA_ARG_NONNULL(1); EAPI int elm_map_source_zoom_min_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_map_source_zoom_max_set(Evas_Object *obj, int zoom) EINA_ARG_NONNULL(1); EAPI int elm_map_source_zoom_max_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_map_user_agent_set(Evas_Object *obj, const char *user_agent) EINA_ARG_NONNULL(1, 2); EAPI const char *elm_map_user_agent_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); diff --git a/src/lib/elm_map.c b/src/lib/elm_map.c index 0c57c6c..6b68f59 100644 --- a/src/lib/elm_map.c +++ b/src/lib/elm_map.c @@ -4810,6 +4810,24 @@ elm_map_route_source_get(const Evas_Object *obj) } /** + * Set the maximum zoom of the source. + * + * @param source the source + * + * @ingroup Map + */ +EAPI void +elm_map_source_zoom_max_set(Evas_Object *obj, int zoom) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if ((!wd) || (!wd->src)) return; + if ((zoom > wd->zoom_max) || (zoom < wd->zoom_min)) return; + wd->src->zoom_max = zoom; +} + +/** * Get the maximum zoom of the source. * * @param source the source @@ -4828,6 +4846,25 @@ elm_map_source_zoom_max_get(const Evas_Object *obj) } /** + * Set the minimum zoom of the source. + * + * @param source the source + * + * @ingroup Map + */ +EAPI void +elm_map_source_zoom_min_set(Evas_Object *obj, int zoom) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if ((!wd) || (!wd->src)) return; + if ((zoom > wd->zoom_max) || (zoom < wd->zoom_min)) return; + wd->src->zoom_min = zoom; +} + + +/** * Get the minimum zoom of the source. * * @param source the source -- 2.7.4