[640] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Best way to handle gtk_images and creation.

daemon@ATHENA.MIT.EDU (Rob Browning)
Sun Aug 3 21:05:28 1997

To: gtk-list@redhat.com
From: Rob Browning <rlb@cs.utexas.edu>
Date: 03 Aug 1997 20:14:52 -0500
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com


I was working on a local C++ wrapper class around gtk images that
allows you to display image streams, and annotate them in a way
similar (but much more simplistic than) the Tk canvas widget.

The problem I ran into was that unlike the other widgets I had been
dealing with, gtk_images can't be created whenever you feel like it.
They rely on you having access to a window that you're sure is already
realized and mapped so that you can get a visual to use in creating
the gdk_image that you need when creating the gtk_image.

This makes automating a "constructor" for my wrapper class a little
awkward since at the point where the user creates an instance of my
wrapper class, I can't actually create the gtk_image since I don't
know what container they're going to add this instance to later.  And
even when they do add the instance to a container, I still may not be
able to create the gtk_image if the container still isn't mapped and
realized yet.

One way I saw around this problem was to always create an alignment
widget as part of the C++ instance and attach to it's realize/map
signals a function that will handle creating the gtk_image as a child
when it's safe.  Is there some better approach I'm overlooking?

Thanks
-- 
Rob

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post