; Module/File: Window_BackgroundImage.pb ; Function: Window: set window background image as pattern - Linux gtk2 ; Author: Shardik ; Date: Juli 29, 2014 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ; Link to topic: http://www.purebasic.fr/english/viewtopic.php?f=15&t=58738 ;-------------------------------------------------------------- ;At the moment 10-2015 there's no replacement for gtk3 EnableExplicit ; Object constants #MainWin= 0 #Image0 = 0 #WinX=300 #WinY=200 #WinW=300 #WinH=300 Global.i gEvent, gQuit Procedure Window_SetBackgroundImage(Window, *image) Protected *BackGrnd Protected *FixedBox.GtkFixed Protected *style.GtkStyle gdk_pixbuf_render_pixmap_and_mask_(*image, @*backgrnd, 0, 0) *style = gtk_style_new_() *style\bg_pixmap[0] = *BackGrnd *FixedBox = g_list_nth_data_(gtk_container_get_children_(gtk_bin_get_child_(WindowID(Window))), 0) gtk_widget_set_style_(*FixedBox, *style) EndProcedure If LoadImage(#Image0, #PB_Compiler_Home + "examples/sources/Data/Background.bmp") = #False Debug "Error loading background image" Else OpenWindow(#MainWin, #WinX, #WinY, #WinW, #WinH, "Window with background image", #PB_Window_SizeGadget) Window_SetBackgroundImage(#MainWin, ImageID(#Image0)) Repeat gEvent= WaitWindowEvent() Select gEvent Case #PB_Event_CloseWindow gQuit= #True EndSelect Until gQuit EndIf ; IDE Options = PureBasic 5.44 LTS (Linux - x86) ; CursorPosition = 10 ; Folding = - ; EnableUnicode ; EnableXP ; SubSystem = gtk2 ; CurrentDirectory = /home/charly-xubuntu/Programming/PureBasic/purebasic/