Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Main Plugin, MBS Linux Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Linux/Linux Window Icon
This example is the version from Tue, 23th Dec 2013.
Project "Linux Window Icon.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim w as new GTKWindowMBS(self)
dim p as new Picture(32,32)
p.Graphics.ForeColor = &c0000FF00
p.Graphics.FillRect 0, 0, 32, 32
w.SetIcon(p)
canvas1.Backdrop = p
End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
dim w as new GTKWindowMBS(self)
dim p as new Picture(32,32)
p.Graphics.ClearRect 0, 0, 32, 32
p.Graphics.ForeColor = &cFF000000
p.Graphics.FillOval 0, 0, 32, 32
w.SetIcon(p)
canvas1.Backdrop = p
End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action()
dim w as new GTKWindowMBS(self)
dim logo as Picture = LogoMBS(500)
dim p as new Picture(32,32)
p.Graphics.ClearRect 0, 0, 32, 32
p.Graphics.DrawPicture logo, 0, 0, 32, 32, 0, 0, logo.Width, logo.Height
w.SetIcon(p)
canvas1.Backdrop = p
End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action()
dim w as new GTKWindowMBS(self)
dim p as new Picture(32,32)
p.Graphics.ClearRect 0, 0, 32, 32
p.Graphics.ForeColor = &c00FF0000
p.Graphics.FillOval 5, 0, 32, 22
w.SetIcon(p)
canvas1.Backdrop = p
End EventHandler
End Control
Control PushButton5 Inherits PushButton
ControlInstance PushButton5 Inherits PushButton
EventHandler Sub Action()
dim w as new GTKWindowMBS(self)
dim p as new Picture(32,32)
p.Graphics.ClearRect 0, 0, 32, 32
p.Graphics.ForeColor = &cFF000000
p.Graphics.FillRect 0, 0, 16, 16
p.Graphics.ForeColor = &c00FF0000
p.Graphics.FillRect 16, 0, 16, 16
p.Graphics.ForeColor = &c0000FF00
p.Graphics.FillRect 0, 16, 16, 16
w.SetIcon(p)
canvas1.Backdrop = p
End EventHandler
End Control
EventHandler Sub Open()
FixButtons self
End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Module Module1
Sub FixButtons(w as window)
#if TargetLinux
// Fix buttons
dim c as integer = w.ControlCount-1
for i as integer = 0 to c
dim v as Variant = w.Control(i)
if v isa PushButton Then
dim p as PushButton = v
p.Height = 28
end if
next
#endif
End Sub
End Module
End Project
See also:
The items on this page are in the following plugins: MBS Linux Plugin.