-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.go
68 lines (54 loc) · 1.5 KB
/
window.go
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package yaac_frontend_template
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
yaac_shared "github.com/DHBW-SE-2023/YAAC/internal/shared"
)
var gv GlobalVars
// Put all variables you want to expose to the package here
type GlobalVars struct {
App fyne.App
Window fyne.Window
}
// This function MUST be the first access to this package
func (f *WindowTemplate) Open() {
gv = GlobalVars{}
gv.App = *yaac_shared.GetApp()
// setuping window
gv.Window = gv.App.NewWindow("TEMPLATE")
// set icon
gv.Window.SetIcon(yaac_shared.ResourceIconPng)
// handle main window
gv.Window.SetContent(makeWindow(f))
//gv.Window.Resize(fyne.NewSize(800, 600))
gv.Window.Show()
gv.App.Run()
}
// Outsources UI building
func makeWindow(f *WindowTemplate) *fyne.Container {
return container.NewVBox(
widget.NewLabel("TEMPLATE"),
)
}
// Accessing content in the MVVM
func (f *WindowTemplate) AccessMVVM() {
f.MVVM.TemplateFuncRecive(false)
}
/*
# Functions
func (f *WindowTemplate) ExposedFunction() {
// This function is Exposed to the MVVM using WindowTemplate 'f'
// Functions exposed to this package, see the mvvm interface in the mvvm.go file,
// can be accessed via f.MVVM.funcname()
}
func PublicFunction() {
// ONLY use when neccecary
// This function can be accessed by all packages importing this one
}
func privateFunction() {
// DEFAULT
// This function is invisible to packages importing this one
// Decalring an unused private function will result in a warning
}
*/