Re: [gtk-list] Widget offset
- From: Havoc Pennington <rhp zirx pair com>
- To: Gtk-list <gtk-list redhat com>
- Subject: Re: [gtk-list] Widget offset
- Date: Thu, 3 Jun 1999 00:00:00 -0400 (EDT)
On Wed, 2 Jun 1999, Joshua Richardson wrote:
> The event box fills all the area that the scrolled window allocates to it.
> So, I seem to have two options:
>
> 1) Find out the offset of the actual displayed image relative to the event
> box, and then subtract this from the event coordinates.
As a wild guess, the GtkImage is also filling the event box, but the
actual displayed image is centered in the GtkImage. So it would be hard to
do this. But I haven't looked at the source.
But if the event box is doing the centering, just look at GtkImage's
allocation.x and allocation.y.
> 2) Keep the event box from filling the viewport.
>
I think you could do this by placing it in a GtkAlignment. GtkTable or
GtkFixed might also be made to work.
> For option 1, I tried printing out the allocation.x, allocation.y fields
> of all widgets up the parent tree, beginning with the image, but they are
> all zero. The GTK_MISC(my_image)->xpad/ypad fields are also zero.
>
You want to look after the widgets are realized and mapped. You might try
connecting to the "map" signal and checking the allocation then.
You could also connect to configure_event on the toplevel window, perhaps.
I'm not sure which of the several suggestions here will work best -
hopefully these are some ideas though.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]