[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: getting the depth before realizing any windows?
- From: Erik Mouw <J A K Mouw its tudelft nl>
- To: gtk-app-devel-list redhat com
- Subject: Re: getting the depth before realizing any windows?
- Date: Thu, 3 Jun 99 20:39:14 +0200
On Thu, 03 Jun 1999 19:38:06 +0200 (CEST), gtk-app-devel-list@redhat.com (Oliver Freyd) wrote:
> I have a problem with pixmaps that I make from xbm-data,
> that is something like:
>
> #define updir_width 28
> #define updir_height 16
Use:
static const int updir_width = 28;
static const int updir_height = 16;
It does exactly the same, but you will get the C++ compiler's type
checking for free. Can save you lots of trouble and nightly debug
sessions.
> static char updir_bits[] = {
> 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00,
> 0x20, 0x40, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x01, 0x10, 0x00, 0x00, 0x01,
> 0x10, 0x02, 0x00, 0x01, 0x10, 0x07, 0x00, 0x01, 0x90, 0x0f, 0x00, 0x01,
> 0x10, 0x02, 0x00, 0x01, 0x10, 0x02, 0x00, 0x01, 0x10, 0x02, 0x00, 0x01,
> 0x10, 0xfe, 0x07, 0x01, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x01,
> 0xf0, 0xff, 0xff, 0x01};
>
> I know I could also use xpm, but I have a large file with these bitmaps,
> so why not use it.
>
> To get this into a Gtk_Pixmap (I use gtk--), I first have to create
> a Gdk_Pixmap, and a Gdk_Bitmap for the mask.
>
> Gtk_Pixmap *pixmap;
> Gdk_Pixmap *gdkpix;
> Gdk_Bitmap *gdkbit;
> gdkpix=new Gdk_Pixmap;
> gdkbit=new Gdk_Bitmap;
> Gdk_Window win=toolbar.get_window();
> Gtk_Style * style= toolbar.Gtk_Widget::get_style();
> gdkpix->create_from_data(NULL,delete_bits,36,32,16,
> &style->gtkobj()->fg[GTK_STATE_NORMAL],
> &style->gtkobj()->bg[GTK_STATE_NORMAL]);
> gdkbit->create(win,delete_bits,36,32);
>
> pixmap = new Gtk_Pixmap(*gdkpix,*gdkbit);
>
> the problem is that create_from _data needs the window or the depth,
> and in the constructor of the app window the Gdk_Window is NULL, so I
> hardcoded the depth. But this only runs on a 16 bit xserver.
>
> So does anybody know how to get the depth of the root window or
> something, before realising anything?
Just realize the main window before you add pixmaps to the toolbar. In
plain GTK, you would do:
gtk_widget_realize(mainwindow);
I think you can figure out the correct method to call for Gtk--.
Almost forgot: please don't cross-post between gtk-list and
gtk-app-devel-list.
Erik
--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
Phone: +31-15-2785859 Fax: +31-15-2781843 Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]