Window pixmap background



Hi,

I've tried to do set the background pixmap of my window with the
two following function : 

static void set_window_back(GtkWidget* this_window)
{
    #include "../pixmaps/pdbkgnd.xpm"

    GtkStyle *style;
    GdkBitmap *mask;

    gtk_widget_realize(this_window);

    /******* also tried that one.....
    style = gtk_style_new();
    *******/

    style = gtk_style_copy(gtk_widget_get_style(this_window));

    style->bg_pixmap[GTK_STATE_NORMAL] =
               gdk_pixmap_create_from_xpm_d(this_window->window, &mask,
                  &style->bg[GTK_STATE_NORMAL], pdbkgnd_xpm);

    /*gtk_widget_set_app_paintable(this_window, TRUE);*/

    gtk_widget_set_style(this_window, style);

    gtk_style_unref(style);
    return;
}

I also tried that one...

static void set_window_back(GtkWidget* this_window)
{
    #include "../pixmaps/pdbkgnd.xpm"

    GdkPixmap *pixmap;
    GdkBitmap *mask;

    gtk_widget_realize(this_window);

    pixmap = gdk_pixmap_create_from_xpm_d(this_window->window, &mask,
                  &this_window->style->bg[GTK_STATE_NORMAL], pdbkgnd_xpm);

    gtk_widget_set_app_paintable(this_window, TRUE);

    gdk_window_set_back_pixmap(this_window->window, pixmap, FALSE);

    return;
}

Both of them do NOT draw any pixmap...
I call this function just before gtk_widget_show(windowMain);

I really don't get what is wrong....

Thanks Havoc for the help provided...

I've been diggin' this mailing list archive on mail.gnome.org
for 2 hours now.. damn.

Stephane.

On Mon, 05 Feb 2001, you wrote:
Stephane Duguay <sduguay Matrox COM> writes: 
Any help or directions would be greatly appreciated...


GTK doesn't support overlapping widgets. One way to do this is to just
set the background pixmap for your toplevel window or other container
widget. (The widget you set the background for must be a widget with a
GdkWindow, i.e. the GTK_NO_WINDOW flag should not be set on that
widget.)

To set the background, use the same steps you'd use to set the color
via GtkRcStyle or GtkStyle, I don't have time right this minute to
type those in but the archives will turn them up or I can do it
later. ;-) Or maybe someone else will... ;-)

Havoc
-- 
____________________________________

Stephane Duguay

Software Designer stagiaire,
Matrox Graphics.

E-Mail : sduguay matrox com
Tel : (514) 822-6000 ext. 7331
____________________________________
-------------------------------------------------------

-- 
____________________________________

Stephane Duguay

Software Designer stagiaire,
Matrox Graphics.

E-Mail : sduguay matrox com
Tel : (514) 822-6000 ext. 7331
____________________________________





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