2019-05-12 20:17:12 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
|
|
|
var demowin *ui.Window
|
|
|
|
var demotab *ui.Tab
|
|
|
|
|
2019-05-12 20:54:25 -05:00
|
|
|
func SetupDemoUI() {
|
2019-05-12 20:17:12 -05:00
|
|
|
log.Println("setupDemoUI() START")
|
|
|
|
demowin = ui.NewWindow("Demo GUI Widgets", 500, 300, false)
|
|
|
|
demowin.OnClosing(func(*ui.Window) bool {
|
2019-05-15 13:03:42 -05:00
|
|
|
// if demowin != nil {
|
|
|
|
// demowin.Destroy()
|
|
|
|
// }
|
|
|
|
// // ui.Quit()
|
|
|
|
// demowin = nil
|
2019-05-12 20:17:12 -05:00
|
|
|
return true
|
|
|
|
})
|
|
|
|
ui.OnShouldQuit(func() bool {
|
|
|
|
demowin.Destroy()
|
2019-05-15 13:03:42 -05:00
|
|
|
demowin = nil
|
2019-05-12 20:17:12 -05:00
|
|
|
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()
|
|
|
|
}
|
2019-05-12 21:13:51 -05:00
|
|
|
|
|
|
|
func CloseDemoUI() {
|
|
|
|
if demowin != nil {
|
|
|
|
demowin.Destroy()
|
|
|
|
}
|
|
|
|
demowin = nil
|
|
|
|
}
|