From: Kaj-Michael Lang Date: Thu, 22 May 2008 14:03:29 +0000 (+0300) Subject: MapWidget: More documentation. Remove context menu clear function, let NULL value... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35f13044bbef842408b32c0aa0e34f987a0e0d46;p=mapper MapWidget: More documentation. Remove context menu clear function, let NULL value is set function handle that. --- diff --git a/libs/libgtkmap/gtkmap.c b/libs/libgtkmap/gtkmap.c index d316ffa..80756d9 100644 --- a/libs/libgtkmap/gtkmap.c +++ b/libs/libgtkmap/gtkmap.c @@ -2003,7 +2003,7 @@ gtk_map_set_center(widget, priv->center.unitx + delta_x*GTK_MAP_PAN_UNITS, priv- * * Rotates the map view around the current center point. * - * Returns TRUE if rotation was possible, otherwise FALSE. + * Returns: TRUE if rotation was possible, otherwise FALSE. */ gboolean gtk_map_rotate(GtkWidget *widget, gfloat angle) @@ -2054,6 +2054,11 @@ gtk_widget_queue_draw(widget); /******************************************************************************/ +/** + * gtk_map_get_zoom: + * + * Returns: Current zoom value + */ gint gtk_map_get_zoom(GtkWidget *widget) { @@ -2068,6 +2073,13 @@ priv=GTK_MAP_GET_PRIVATE(map); return priv->zoom; } +/** + * gtk_map_set_autozoom: + * + * Enable or disable autozoom. Currently not implemented. + * + * Returns: TRUE if autozoom was enabled, FALSE if autozoom can't be enabled. + */ gboolean gtk_map_set_autozoom(GtkWidget *widget, gboolean az) { @@ -2078,6 +2090,14 @@ GtkMapPriv *priv; return TRUE; } +/** + * gtk_map_set_zoom: + * @new_zoom: Zoom value to set + * + * Set map view zoom value, 0 is close zoom, larger values zoom out. + * + * Returns: TRUE is zoom could be set, FALSE if not. + */ gboolean gtk_map_set_zoom(GtkWidget *widget, gint new_zoom) { @@ -2122,6 +2142,14 @@ g_signal_emit(widget, gtk_map_signals[MAP_ZOOM_CHANGED], 0, priv->zoom); return TRUE; } +/** + * gtk_map_zoom: + * zdir: Relative zoom direction + * + * Zooms map view relative to current zoom value. + * + * Returns: The new zoom value + */ gint gtk_map_zoom(GtkWidget *widget, gint zdir) { @@ -2161,7 +2189,7 @@ return FALSE; /** * gtk_map_set_context_menu: - * @menu: A #GtkMenu to add as context menu + * @menu: A #GtkMenu to add as context menu or NULL to clear context menu * * Add a context menu to display when the map is clicked on with the right mouse button. * On hildon build the context menu is set with gtk_widget_tap_and_hold_setup(). @@ -2177,32 +2205,22 @@ g_return_if_fail(GTK_IS_MAP(widget)); map=GTK_MAP(widget); priv=GTK_MAP_GET_PRIVATE(map); +if (menu) { #ifdef WITH_DEVICE_770 -gtk_widget_tap_and_hold_setup(widget, GTK_WIDGET(menu), NULL, 0); + gtk_widget_tap_and_hold_setup(widget, GTK_WIDGET(menu), NULL, 0); #else -g_object_ref(menu); -priv->menu=menu; + g_object_ref(menu); + priv->menu=menu; #endif -} - -void -gtk_map_clear_context_menu(GtkWidget *widget) -{ -GtkMap *map; -GtkMapPriv *priv; - -g_return_if_fail(GTK_IS_MAP(widget)); -map=GTK_MAP(widget); -priv=GTK_MAP_GET_PRIVATE(map); - -g_return_if_fail(priv->menu); - + priv->menu=menu; +} else if (priv->menu) { #ifdef WITH_DEVICE_770 -gtk_widget_tap_and_hold_setup(widget, NULL, NULL, 0); + gtk_widget_tap_and_hold_setup(widget, NULL, NULL, 0); #else -g_object_unref(priv->menu); + g_object_unref(priv->menu); #endif -priv->menu=NULL; + priv->menu=NULL; +} } /** diff --git a/libs/libgtkmap/gtkmap.h b/libs/libgtkmap/gtkmap.h index 29fd9e6..755ca28 100644 --- a/libs/libgtkmap/gtkmap.h +++ b/libs/libgtkmap/gtkmap.h @@ -25,6 +25,15 @@ #include "position.h" #include "map-tile-repo.h" +/** + * GtkMapCenterMode: + * @CENTER_MANUAL: View center is set by user or from code + * @CENTER_LATLAT: Center on active track last point + * @CENTER_LEAD: Center on active track last point+speed offset + * + * Map centering mode. + * + */ typedef enum { CENTER_WAS_LATLON = -2, CENTER_WAS_LEAD = -1, @@ -33,6 +42,16 @@ typedef enum { CENTER_LATLON = 2 } GtkMapCenterMode; +/** + * GtkMapMarkerType: + * @MAP_MARKER_TYPE_POI: Marker is a Point of Interest + * @MAP_MARKER_TYPE_POSITION: Marker is a special Position (Home, Destination) + * @MAP_MARKER_TYPE_BOOKMARK: Marker is a bookmark Position + * @MAP_MARKER_TYPE_CACHE: Marker is a GeoCache + * + * Map marker types. + * + */ typedef enum { MAP_MARKER_TYPE_POI=0, MAP_MARKER_TYPE_POSITION, @@ -40,6 +59,20 @@ typedef enum { MAP_MARKER_TYPE_CACHE, } GtkMapMarkerType; +/** + * GtkMapMarkerStoreID: + * @MAP_MARKER_ID: Marker ID number + * @MAP_MARKER_TYPE: Marker type, must be one from #GtkMapMarkerType + * @MAP_MARKER_LAT: Marker latitude + * @MAP_MARKER_LON: Marker longitude + * @MAP_MARKER_LABEL: Marker name or label to display on a #GtkMap + * @MAP_MARKER_ICON: Icon to display on a #GtkMap + * @MAP_MARKER_COLOR: Color to use for marker arc if no icon is given or found + * @MAP_MARKER_CACHE_X: Internal cache widget x coordinate for marker + * @MAP_MARKER_CACHE_Y: Internal cache widget y coordinate for marker + * + * #GtkListStore ID numbers for marker store. + */ typedef enum { MAP_MARKER_ID=0, MAP_MARKER_TYPE, @@ -62,16 +95,13 @@ typedef enum { #define GTK_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_MAP_TYPE, GtkMapClass)) #define GTK_IS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_MAP_TYPE)) -typedef struct _GtkMap GtkMap; -typedef struct _GtkMapClass GtkMapClass; +typedef struct _GtkMap GtkMap; struct _GtkMap { GtkDrawingArea map; - guint size; - gfloat heading; - gfloat speed; }; +typedef struct _GtkMapClass GtkMapClass; struct _GtkMapClass { GtkDrawingAreaClass parent_class; void (* zoom_changed) (GtkWidget *widget, int zoom); @@ -132,7 +162,6 @@ gboolean gtk_map_set_autozoom(GtkWidget *map, gboolean az); /* Menu and mouse related */ void gtk_map_set_context_menu(GtkWidget *widget, GtkMenu *menu); -void gtk_map_clear_context_menu(GtkWidget *widget); void gtk_map_get_menu_latlon(GtkWidget *map, gdouble *lat, gdouble *lon); G_END_DECLS