Elementary map: add APIs for setting min,max zoom level
authorgouache <gouache@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 26 May 2011 12:40:29 +0000 (12:40 +0000)
committergouache <gouache@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 26 May 2011 12:40:29 +0000 (12:40 +0000)
git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@59704 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test_map.c
src/lib/Elementary.h.in
src/lib/elm_map.c

index edc9ee6..4262e0c 100644 (file)
@@ -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);
index 27cca7a..3e8b825 100644 (file)
@@ -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);
index 0c57c6c..6b68f59 100644 (file)
@@ -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