[Gtk-sharp-list] What is the equivalent of the rc files "bg_pixmap"?

Anset Anset@anset.org
Mon, 14 Mar 2005 12:28:23 +0100


Hi,

I'm trying to set the background pixmap of widgets. (I know this breaks 
the theme philosophy of gtk, but I want to make a skinnable app.)

I've tried different ways, but the only way I can make it work is using 
the bg_pixmap setting in the resource file.

As far as I can tell, this should change the Tile propperty of the 
BackgroundGCs in the Style propperty of the Widget.

There's a BackgroundGC for every Gtk.StateType.

I have tried the following: ("this" inherits from Gtk.Window)


this.Realize();

Gtk.Style style = this.Style;
Gdk.GC thisgc = style.ForegroundGC(Gtk.StateType.Normal);

thisgc.Tile = pixmap_Background_Image;
 
style.SetForegroundGC(Gtk.StateType.Normal,
this.Style = style;


And also:


this.Realize();

Gdk.GC newgc = new Gdk.GC(this.GdkWindow);
newgc.Tile = pixmap_Background_Image;

Gtk.Style newstyle = new Gtk.Style();
newstyle.SetBackgroundGC(Gtk.StateType.Normal, newgc);

newstyle.SetBackground(this.GdkWindow, Gtk.StateType.Normal);


But neither approach works.

If I give "this" a name, and then put in the resource file a style with 
a png backgound, it works beautifully...

I've tried reading the GTK sourcecode, but I could not get the info I am 
looking for.

Any help appreciated,

Anset.