Code: Select all
EnableExplicit
InitNetwork()
UseJPEGImageDecoder()
Procedure.I GetContainer(WindowID.I, ContainerName.S)
Protected Child.I
Protected ChildrenList.I
Protected *Name
Protected Widget.I = WindowID(WindowID)
Child = gtk_bin_get_child_(Widget)
Repeat
ChildrenList = gtk_container_get_children_(Widget)
Child = g_list_nth_data_(ChildrenList, 0)
If Child = 0
Break
Else
*Name = gtk_widget_get_name_(Child)
Widget = Child
EndIf
Until PeekS(*Name, -1, #PB_UTF8) = ContainerName
ProcedureReturn Child
EndProcedure
Procedure SetWindowBackgroundImage(WindowID.I, ImageID.I)
Protected Container.I
Container = GetContainer(0, "GtkFixed")
If Container
gtk_fixed_put_(Container, gtk_image_new_from_pixbuf_(ImageID(ImageID)), 0, 0)
gtk_widget_show_all_(WindowID(WindowID))
EndIf
EndProcedure
If FileSize(GetTemporaryDirectory() + "stargate_atlantis.jpg") <= 0
ReceiveHTTPFile("http://realsource.de/images/stargate_atlantis.jpg",
GetTemporaryDirectory() + "stargate_atlantis.jpg")
EndIf
If LoadImage(0, GetTemporaryDirectory() + "stargate_atlantis.jpg")
OpenWindow(0, 100, 100, ImageWidth(0), ImageHeight(0),
"Window with background image")
SetWindowBackgroundImage(0, 0)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf