mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 20:39:34 +08:00
Refactored mac titlebar options
This commit is contained in:
parent
72fc2204b4
commit
ef11f45df8
@ -15,31 +15,34 @@ import "C"
|
||||
|
||||
func (a *Application) processPlatformSettings() {
|
||||
|
||||
mac := a.config.Mac
|
||||
titlebar := mac.TitleBar
|
||||
|
||||
// HideTitle
|
||||
if a.config.Mac.HideTitle {
|
||||
if titlebar.HideTitle {
|
||||
C.HideTitle(a.app)
|
||||
}
|
||||
|
||||
// HideTitleBar
|
||||
if a.config.Mac.HideTitleBar {
|
||||
if titlebar.HideTitleBar {
|
||||
C.HideTitleBar(a.app)
|
||||
}
|
||||
|
||||
// Full Size Content
|
||||
if a.config.Mac.FullSizeContent {
|
||||
if titlebar.FullSizeContent {
|
||||
C.FullSizeContent(a.app)
|
||||
}
|
||||
|
||||
// Toolbar
|
||||
if a.config.Mac.UseToolbar {
|
||||
if titlebar.UseToolbar {
|
||||
C.UseToolbar(a.app)
|
||||
}
|
||||
|
||||
if a.config.Mac.HideToolbarSeparator {
|
||||
if titlebar.HideToolbarSeparator {
|
||||
C.HideToolbarSeparator(a.app)
|
||||
}
|
||||
|
||||
if a.config.Mac.TitlebarAppearsTransparent {
|
||||
if titlebar.TitlebarAppearsTransparent {
|
||||
C.TitlebarAppearsTransparent(a.app)
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,12 @@
|
||||
package options
|
||||
package mac
|
||||
|
||||
// Mac ae options speific to Mas
|
||||
type Mac struct {
|
||||
// Options ae options speific to Mac
|
||||
type Options struct {
|
||||
TitleBar *TitleBar
|
||||
}
|
||||
|
||||
// TitleBar contains options for the Mac titlebar
|
||||
type TitleBar struct {
|
||||
TitlebarAppearsTransparent bool
|
||||
HideTitle bool
|
||||
HideTitleBar bool
|
@ -1,5 +1,7 @@
|
||||
package options
|
||||
|
||||
import "github.com/wailsapp/wails/v2/pkg/options/mac"
|
||||
|
||||
// App contains options for creating the App
|
||||
type App struct {
|
||||
Title string
|
||||
@ -15,7 +17,7 @@ type App struct {
|
||||
StartHidden bool
|
||||
DevTools bool
|
||||
Colour int
|
||||
Mac Mac
|
||||
Mac *mac.Options
|
||||
}
|
||||
|
||||
// MergeDefaults will set the minimum default values for an application
|
||||
|
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
wails "github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/mac"
|
||||
)
|
||||
|
||||
type Echo struct {
|
||||
@ -22,13 +23,15 @@ func main() {
|
||||
DisableResize: false,
|
||||
Fullscreen: false,
|
||||
Colour: 0xFF000088,
|
||||
Mac: options.Mac{
|
||||
HideTitle: false,
|
||||
HideTitleBar: false,
|
||||
TitlebarAppearsTransparent: true,
|
||||
FullSizeContent: false,
|
||||
UseToolbar: true,
|
||||
HideToolbarSeparator: true,
|
||||
Mac: &mac.Options{
|
||||
TitleBar: &mac.TitleBar{
|
||||
HideTitle: false,
|
||||
HideTitleBar: false,
|
||||
TitlebarAppearsTransparent: true,
|
||||
FullSizeContent: false,
|
||||
UseToolbar: true,
|
||||
HideToolbarSeparator: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user