Re: Displaying a pixmap as background of any control.



ahmad hassan wrote:

Hi,
I want to display a pixmap as a background of any control or container. And on top of that container(hbox, vbox etc) i would have any controls.

How can i achieve that using gtk+ c source code

One thing more i want the image to resize(scale) when the window is resized.

Any help would be greatly appreciated.

Thank you.



hi,

you can play with:

void
set_background (GtkWidget *widget,  GdkPixmap *pixmap)
{
GtkRcStyle *rc_style;
GtkStyle   *style;

style = gtk_style_copy (widget->style);
if (style->bg_pixmap[0])
  g_object_unref (style->bg_pixmap[0]);
style->bg_pixmap[0] = g_object_ref (pixmap);
gtk_widget_set_style (widget, style);
g_object_unref (style);
}

(hbox, vbox will probably not work, us the widget direct instead, or the parent widget)

if nothing happens take look on this bug:

http://bugzilla.gnome.org/show_bug.cgi?id=318074


cu jochen









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