How to set background image in the Pure Basic for Linux?

Linux specific forum
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: How to set background image in the Pure Basic for Linux?

Post by Shardik »

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
mestnyi
Addict
Addict
Posts: 1098
Joined: Mon Nov 25, 2013 6:41 am

Re: How to set background image in the Pure Basic for Linux?

Post by mestnyi »

what you need, thanks
Post Reply