forked from wailsapp/wails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_mac.go
161 lines (141 loc) · 6.44 KB
/
options_mac.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package application
import "github.com/zappie/wails/v3/pkg/events"
import "github.com/leaanthony/u"
// MacBackdrop is the backdrop type for macOS
type MacBackdrop int
const (
// MacBackdropNormal - The default value. The window will have a normal opaque background.
MacBackdropNormal MacBackdrop = iota
// MacBackdropTransparent - The window will have a transparent background, with the content underneath it being visible
MacBackdropTransparent
// MacBackdropTranslucent - The window will have a translucent background, with the content underneath it being "fuzzy" or "frosted"
MacBackdropTranslucent
)
// MacToolbarStyle is the style of toolbar for macOS
type MacToolbarStyle int
const (
// MacToolbarStyleAutomatic - The default value. The style will be determined by the window's given configuration
MacToolbarStyleAutomatic MacToolbarStyle = iota
// MacToolbarStyleExpanded - The toolbar will appear below the window title
MacToolbarStyleExpanded
// MacToolbarStylePreference - The toolbar will appear below the window title and the items in the toolbar will attempt to have equal widths when possible
MacToolbarStylePreference
// MacToolbarStyleUnified - The window title will appear inline with the toolbar when visible
MacToolbarStyleUnified
// MacToolbarStyleUnifiedCompact - Same as MacToolbarStyleUnified, but with reduced margins in the toolbar allowing more focus to be on the contents of the window
MacToolbarStyleUnifiedCompact
)
// MacWindow contains macOS specific options for Webview Windows
type MacWindow struct {
// Backdrop is the backdrop type for the window
Backdrop MacBackdrop
// DisableShadow will disable the window shadow
DisableShadow bool
// TitleBar contains options for the Mac titlebar
TitleBar MacTitleBar
// Appearance is the appearance type for the window
Appearance MacAppearanceType
// InvisibleTitleBarHeight defines the height of an invisible titlebar which responds to dragging
InvisibleTitleBarHeight int
// Maps events from platform specific to common event types
EventMapping map[events.WindowEventType]events.WindowEventType
// EnableFraudulentWebsiteWarnings will enable warnings for fraudulent websites.
// Default: false
EnableFraudulentWebsiteWarnings bool
// WebviewPreferences contains preferences for the webview
WebviewPreferences MacWebviewPreferences
// Disables the minimise button
DisableMinimiseButton bool
// Disables the maximise button
DisableMaximiseButton bool
// Disables the close button
DisableCloseButton bool
}
// MacWebviewPreferences contains preferences for the Mac webview
type MacWebviewPreferences struct {
// TabFocusesLinks will enable tabbing to links
TabFocusesLinks u.Bool
// TextInteractionEnabled will enable text interaction
TextInteractionEnabled u.Bool
// FullscreenEnabled will enable fullscreen
FullscreenEnabled u.Bool
}
// MacTitleBar contains options for the Mac titlebar
type MacTitleBar struct {
// AppearsTransparent will make the titlebar transparent
AppearsTransparent bool
// Hide will hide the titlebar
Hide bool
// HideTitle will hide the title
HideTitle bool
// FullSizeContent will extend the window content to the full size of the window
FullSizeContent bool
// UseToolbar will use a toolbar instead of a titlebar
UseToolbar bool
// HideToolbarSeparator will hide the toolbar separator
HideToolbarSeparator bool
// ToolbarStyle is the style of toolbar to use
ToolbarStyle MacToolbarStyle
}
// MacTitleBarDefault results in the default Mac MacTitleBar
var MacTitleBarDefault = MacTitleBar{
AppearsTransparent: false,
Hide: false,
HideTitle: false,
FullSizeContent: false,
UseToolbar: false,
HideToolbarSeparator: false,
}
// Credit: Comments from Electron site
// MacTitleBarHidden results in a hidden title bar and a full size content window,
// yet the title bar still has the standard window controls (“traffic lights”)
// in the top left.
var MacTitleBarHidden = MacTitleBar{
AppearsTransparent: true,
Hide: false,
HideTitle: true,
FullSizeContent: true,
UseToolbar: false,
HideToolbarSeparator: false,
}
// MacTitleBarHiddenInset results in a hidden title bar with an alternative look where
// the traffic light buttons are slightly more inset from the window edge.
var MacTitleBarHiddenInset = MacTitleBar{
AppearsTransparent: true,
Hide: false,
HideTitle: true,
FullSizeContent: true,
UseToolbar: true,
HideToolbarSeparator: true,
}
// MacTitleBarHiddenInsetUnified results in a hidden title bar with an alternative look where
// the traffic light buttons are even more inset from the window edge.
var MacTitleBarHiddenInsetUnified = MacTitleBar{
AppearsTransparent: true,
Hide: false,
HideTitle: true,
FullSizeContent: true,
UseToolbar: true,
HideToolbarSeparator: true,
ToolbarStyle: MacToolbarStyleUnified,
}
// MacAppearanceType is a type of Appearance for Cocoa windows
type MacAppearanceType string
const (
// DefaultAppearance uses the default system value
DefaultAppearance MacAppearanceType = ""
// NSAppearanceNameAqua - The standard light system appearance.
NSAppearanceNameAqua MacAppearanceType = "NSAppearanceNameAqua"
// NSAppearanceNameDarkAqua - The standard dark system appearance.
NSAppearanceNameDarkAqua MacAppearanceType = "NSAppearanceNameDarkAqua"
// NSAppearanceNameVibrantLight - The light vibrant appearance
NSAppearanceNameVibrantLight MacAppearanceType = "NSAppearanceNameVibrantLight"
// NSAppearanceNameAccessibilityHighContrastAqua - A high-contrast version of the standard light system appearance.
NSAppearanceNameAccessibilityHighContrastAqua MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastAqua"
// NSAppearanceNameAccessibilityHighContrastDarkAqua - A high-contrast version of the standard dark system appearance.
NSAppearanceNameAccessibilityHighContrastDarkAqua MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastDarkAqua"
// NSAppearanceNameAccessibilityHighContrastVibrantLight - A high-contrast version of the light vibrant appearance.
NSAppearanceNameAccessibilityHighContrastVibrantLight MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastVibrantLight"
// NSAppearanceNameAccessibilityHighContrastVibrantDark - A high-contrast version of the dark vibrant appearance.
NSAppearanceNameAccessibilityHighContrastVibrantDark MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastVibrantDark"
)