Get mouse clicks on the map
- From: Keith Sharp <keith sharp gmail com>
- To: libchamplain-list gnome org
- Subject: Get mouse clicks on the map
- Date: Sat, 9 Jan 2010 18:06:52 +0800
I've been tinkering with the launcher-gtk.c program in the demos, and I was trying to add the abilty to catch mouse clicks on the map and print them to the console (with the ultimate aim of creating a marker or popup menu on a mouse click).
I tried to use the ClutterActor signal button-pressed-event on the ChamplainView, from main():
...
widget = gtk_champlain_embed_new ();
view = gtk_champlain_embed_get_view (GTK_CHAMPLAIN_EMBED (widget));
g_signal_connect (view, "button-press-event", G_CALLBACK (mouse_click_cb), view);
...
and added the callback to catch these events:
gboolean
mouse_click_cb (ClutterActor *actor, ClutterEvent *event, gpointer data)
{
gdouble lat, lon;
champlain_view_get_coords_from_event (CHAMPLAIN_VIEW (data), event, &lat, &lon);
g_print ("Mouse click at: %f %f\n", lat, lon);
return TRUE;
}
Can anyone provide me with some pointers?
Thanks,
Keith.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]