; Module/File: Window_BackgroundImage2.pb ; Function: Set window background image as pattern, exe embedded - Linux gtk2 ; Author: Shardik / Omi ; Date: Oct. 19, 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/german/viewtopic.php?f=21&t=26990 ;-------------------------------------------------------------- ;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(#MainWin))), 0) gtk_widget_set_style_(*FixedBox, *style) EndProcedure If Not CatchImage(#Image0, ?Img0) 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 End DataSection; bind in executable Img0: : IncludeBinary #PB_Compiler_Home + "examples/sources/Data/Background.bmp" EndDataSection ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 10 ; Folding = - ; EnableUnicode ; EnableXP ; SubSystem = gtk2 ; CurrentDirectory = /home/charly-xubuntu/Programming/PureBasic/purebasic/