1package main 2 3import ( 4 "github.com/dlasky/gotk3-layershell/layershell" 5 "github.com/gotk3/gotk3/gtk" 6 "log" 7) 8 9func main() { 10 // Initialize GTK without parsing any command line arguments. 11 gtk.Init(nil) 12 13 // Create a new toplevel window, set its title, and connect it to the 14 // "destroy" signal to exit the GTK main loop when it is destroyed. 15 win, err := gtk.WindowNew(gtk.WINDOW_TOPLEVEL) 16 if err != nil { 17 log.Fatal("Unable to create window:", err) 18 } 19 layershell.InitForWindow(win) 20 21 layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_LEFT,true); 22 layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_TOP, true); 23 layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_RIGHT,true); 24 25 layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_BOTTOM) 26 layershell.SetMargin(win, layershell.LAYER_SHELL_EDGE_TOP, 0) 27 layershell.SetMargin(win, layershell.LAYER_SHELL_EDGE_LEFT, 0) 28 layershell.SetMargin(win, layershell.LAYER_SHELL_EDGE_RIGHT,0) 29 30 layershell.SetExclusiveZone(win, 200) 31 32 33 win.SetTitle("Simple Example") 34 win.Connect("destroy", func() { 35 gtk.MainQuit() 36 }) 37 38 // Create a new label widget to show in the window. 39 l, err := gtk.LabelNew("Hello, gotk3!") 40 if err != nil { 41 log.Fatal("Unable to create label:", err) 42 } 43 44 // Add the label to the window. 45 win.Add(l) 46 47 // Set the default window size. 48 win.SetDefaultSize(800, 30) 49 50 // Recursively show all widgets contained in this window. 51 win.ShowAll() 52 53 // Begin executing the GTK main loop. This blocks until 54 // gtk.MainQuit() is run. 55 gtk.Main() 56}