Re: Translating co-ordinates from local to screen space



On 11 June 2010 11:50, Matthew Allen <list sydneyband com au> wrote:
I'm trying to translate co-ordinates from local widget space into screen
space and back again. Is that possible with GTK?

You can use _get_allocation() to get the size and position of a widget
within it's parent:

http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-get-allocation

There's also a more general thing that will translate between any two
widgets which share a common ancestor:

http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-translate-coordinates

If you're trying to turn mouse x/y into widget x/y, I think that
should be done for you, as far as I know.

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]