summaryrefslogtreecommitdiff
path: root/demo.go
blob: a9c0761ff3993e22e48305e16de9daf4b3a5a3e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package gui

import "log"

import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"

var demowin *ui.Window
var demotab *ui.Tab

func SetupDemoUI() {
	log.Println("setupDemoUI() START")
	demowin = ui.NewWindow("Demo GUI Widgets", 500, 300, false)
	demowin.OnClosing(func(*ui.Window) bool {
		ui.Quit()
		return true
	})
	ui.OnShouldQuit(func() bool {
		demowin.Destroy()
		return true
	})

	demotab = ui.NewTab()
	demowin.SetChild(demotab)
	demowin.SetMargined(true)

	demotab.Append("List examples", makeNumbersPage())
	tabcount := 0
	demotab.SetMargined(tabcount, true)

	demotab.Append("Choosers examples", makeDataChoosersPage())
	tabcount += 1
	demotab.SetMargined(tabcount, true)

	demotab.Append("Group examples", makeGroupEntries())
	tabcount += 1
	demotab.SetMargined(tabcount, true)

	demowin.Show()
}

func CloseDemoUI() {
	if demowin != nil {
		demowin.Destroy()
	}
	demowin = nil
}