-
Notifications
You must be signed in to change notification settings - Fork 1
/
baseWindow.go
41 lines (38 loc) · 1.11 KB
/
baseWindow.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
package ui
import (
"github.com/iltoga/ecnotes-go/lib/common"
)
// WindowDefaultOptions default options for windows
type WindowDefaultOptions struct {
windowAction common.WindowAction
windowMode common.WindowMode
windowAspect common.WindowAspect
windowVisible bool
}
// ParseDefaultOptions ...
func (ui *WindowDefaultOptions) ParseDefaultOptions(options map[string]interface{}) {
if val := common.GetMapValOrNil(options, common.OPT_WINDOW_ACTION); val != nil {
if mode, ok := val.(common.WindowAction); ok {
ui.windowAction = mode
}
} else {
// default action is new
ui.windowAction = common.WindowAction_New
}
if val := common.GetMapValOrNil(options, common.OPT_WINDOW_MODE); val != nil {
if mode, ok := val.(common.WindowMode); ok {
ui.windowMode = mode
}
} else {
// default mode is view
ui.windowMode = common.WindowMode_View
}
if val := common.GetMapValOrNil(options, common.OPT_WINDOW_ASPECT); val != nil {
if aspect, ok := val.(common.WindowAspect); ok {
ui.windowAspect = aspect
} else {
// default aspect is normal
ui.windowAspect = common.WindowAspect_Normal
}
}
}