Re: gtk window background image with labels overlayed



Dave Cunningham <sparks barrysworld com> writes:

Hi

Is it possible to set the background of a window from a .png (or
similar) file, and then display labels in a vbox or something over the
top of that image, without the background of the labels being drawn
(in the form of a long horizontal rectangle) over the image.

Would I have to supply the image as a gdk_pixmap because that seems
like hard work...

A pointer to some example code would be really really appreciated :)

Not code, but the general strategy is:

- Load the image as a pixbuf (gdk_pixbuf_new_from_file())
- Convert it to a pixmap (gdk_pixbuf_render_pixmap_and_mask())
- Get rid of the pixbuf (g_object_unref())
- Disable repainting of the GtkWindow (gtk_widget_set_app_paintable())
- Realize the window so that the GdkWindow exists (gtk_widget_realize())
- Set the background pixmap (gdk_window_set_back_pixmap(window->window))
- Get rid of the pixmap (g_object_unref())

Regards,
                                        Owen




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