Re: [gtk-list] Re: Gtk-- create Pixmaps at startup?



Craig Anderson wrote:
> 
> Thanks to  Todd Dukes <tdukes@ibmoto.com> for suggesting
> that realize() be called in the init for  the Gtk_Window subclass.
I am NOT sure, whether this is a good solution.
But you are using C++, so you don't have to care about memory
usage, resources, executing code twice, etc.,anyway :-)

Because this is really a FAQ, but no FAQ-file does exist and this
question is asked every week: I am tired to type the same text
again and again :-)

There is another call in GTK which allows to create pixmaps without
"realizing". What is missing (see your gdk messages) is a "window".
Why is it missing: It's sole use in the call to create a pixmap
is to get the colormap of this (or any other window, see the patch
to your code) window. However, as long as a window is not realized,
there is no window and therefore no colormap !
But, if you just get the default system colormap and use the call
to create a pixmap together with this colormap you simply
avoid executing code twice and have the same result. I am doing
this and it works !
In detail:
	GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
is your friend as is:
	GdkColormap *default_colormap;
	default_colormap = gdk_colormap_get_system ();
That's it.
Now, how do you do this in GTK-- ?
This task is left to the reader :-) I am not using it.

HTH,

Norbert.

-- 
Norbert Bladt		 Payphone Management System Software Development
ascom Autelca AG
Worbstrasse 201		 CH-3073 Guemligen, Switzerland
abladtn@autelca.ascom.ch VOICE: +41 31 999 6552, FAX: +41 31 999 6575



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