MAP_LOCATION_CHANGED,
MAP_ZOOM_CHANGED,
MAP_PANNED,
+ MAP_CENTER_MODE_CHANGED,
MARKER_CLICK,
LAST_SIGNAL
};
g_type_class_add_private (object_class, sizeof(GtkMapPriv));
gtk_map_signals[MAP_ZOOM_CHANGED]=g_signal_new("zoom-changed", G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(GtkMapClass, zoom_changed),
- NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(GtkMapClass, zoom_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+
+gtk_map_signals[MAP_LOCATION_CHANGED]=g_signal_new("location-changed", G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(GtkMapClass, location_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+
+gtk_map_signals[MAP_LOCATION_CHANGED]=g_signal_new("center-mode-changed", G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(GtkMapClass, center_mode_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}
priv->center.unitx = priv->location.unitx;
priv->center.unity = priv->location.unity;
break;
+ case CENTER_MANUAL:
default:
-#if 0
- priv->center.unitx = center->unitx;
- priv->center.unity = center->unity;
-#endif
+ /* Do nothing, use priv->center.* */
break;
}
}
g_debug("GTKMAP: Size allocate (%d, %d)", widget->allocation.width, widget->allocation.height);
-if (GTK_WIDGET_REALIZED(widget))
+if (GTK_WIDGET_REALIZED(widget)) {
gdk_window_move_resize(widget->window, allocation->x, allocation->y, allocation->width, allocation->height);
+ gtk_map_update_size(widget, allocation->width, allocation->height);
+ gtk_map_refresh(widget);
+}
-gtk_map_update_size(widget, allocation->width, allocation->height);
-gtk_map_refresh(widget);
}
static void
map=GTK_MAP(widget);
g_debug("GTKMAP: Size request");
-
+
requisition->width=GTK_MAP_TILE_SIZE_PIXELS/2;
requisition->height=GTK_MAP_TILE_SIZE_PIXELS/2;
-gtk_map_update_size(widget, requisition->width, requisition->height);
+/* gtk_map_update_size(widget, requisition->width, requisition->height); */
}
static gboolean
g_signal_connect(G_OBJECT(widget), "button_press_event", G_CALLBACK(gtk_map_press_cb), NULL);
#endif
+gtk_widget_queue_resize(widget);
}
static gboolean
priv=GTK_MAP_GET_PRIVATE(map);
style=widget->style;
+priv->center_mode=CENTER_MANUAL;
+
/* Assure that _center.unitx/y are bounded. */
BOUND(unitx, priv->min_center.unitx, priv->max_center.unitx);
BOUND(unity, priv->min_center.unity, priv->max_center.unity);
gtk_map_recalc_offset(priv);
gtk_map_recalc_focus_base(priv);
gtk_map_refresh(widget);
+g_signal_emit(widget, gtk_map_signals[MAP_LOCATION_CHANGED], 0, priv->zoom);
}
void
for (x = 0; x < priv->buf_width_tiles; ++x)
gtk_map_render_tile(map, priv->base_tilex + x, priv->base_tiley + y, x * GTK_MAP_TILE_SIZE_PIXELS, y * GTK_MAP_TILE_SIZE_PIXELS, FALSE);
-gtk_widget_queue_draw_area(widget, 0, 0, widget->allocation.width, widget->allocation.height);
+gtk_widget_queue_draw(widget);
}
gint