Code: Select all
Procedure SetWindowBackgroundImage(hWnd.I, hImage.I)
Protected *Background
Protected FixedBox.I
Protected *Style.GtkStyle
gdk_pixbuf_render_pixmap_and_mask_(hImage, @*Background, 0, 0)
*Style = gtk_style_new_()
*Style\bg_pixmap[0] = *Background
FixedBox = g_list_nth_data_(gtk_container_get_children_(gtk_bin_get_child_(hWnd)), 0)
gtk_widget_set_style_(FixedBox, *Style)
EndProcedure
If LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/Geebee2.bmp") = #False
Debug "Error loading background image"
Else
OpenWindow(0, 270, 100, 254, 260, "With background image", #PB_Window_SizeGadget)
SetWindowBackgroundImage(WindowID(0), ImageID(0))
ButtonGadget(0, 90, 116, 74, 25, "Click me!")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 0
Debug "Button was clicked!"
EndIf
EndSelect
ForEver
EndIf