mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-08 02:50:00 +08:00
Move menu to Windows window options.
This commit is contained in:
parent
5833f0f109
commit
08ec2beb7c
BIN
mkdocs-website/docs/favicon.ico
Normal file
BIN
mkdocs-website/docs/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 109 KiB |
@ -8,7 +8,7 @@ theme:
|
||||
logo: assets/images/wails-logo-horizontal-dark.svg
|
||||
icon:
|
||||
repo: fontawesome/brands/github
|
||||
favicon: assets/images/favicon.svg
|
||||
favicon: /favicon.ico
|
||||
features:
|
||||
- navigation.tabs
|
||||
- navigation.sections
|
||||
|
@ -10,38 +10,98 @@ const (
|
||||
)
|
||||
|
||||
type WebviewWindowOptions struct {
|
||||
Name string
|
||||
Title string
|
||||
Width int
|
||||
Height int
|
||||
AlwaysOnTop bool
|
||||
URL string
|
||||
DisableResize bool
|
||||
Frameless bool
|
||||
MinWidth int
|
||||
MinHeight int
|
||||
MaxWidth int
|
||||
MaxHeight int
|
||||
StartState WindowState
|
||||
Centered bool
|
||||
BackgroundType BackgroundType
|
||||
BackgroundColour RGBA
|
||||
HTML string
|
||||
JS string
|
||||
CSS string
|
||||
X int
|
||||
Y int
|
||||
FullscreenButtonEnabled bool
|
||||
Hidden bool
|
||||
EnableFraudulentWebsiteWarnings bool
|
||||
Zoom float64
|
||||
ZoomControlEnabled bool
|
||||
EnableDragAndDrop bool
|
||||
OpenInspectorOnStartup bool
|
||||
Mac MacWindow
|
||||
Windows WindowsWindow
|
||||
Focused bool
|
||||
Menu *Menu
|
||||
// Name is a unique identifier that can be given to a window.
|
||||
Name string
|
||||
|
||||
// Title is the title of the window.
|
||||
Title string
|
||||
|
||||
// Width is the starting width of the window.
|
||||
Width int
|
||||
|
||||
// Height is the starting height of the window.
|
||||
Height int
|
||||
|
||||
// AlwaysOnTop will make the window float above other windows.
|
||||
AlwaysOnTop bool
|
||||
|
||||
// URL is the URL to load in the window.
|
||||
URL string
|
||||
|
||||
// DisableResize will disable the ability to resize the window.
|
||||
DisableResize bool
|
||||
|
||||
// Frameless will remove the window frame.
|
||||
Frameless bool
|
||||
|
||||
// MinWidth is the minimum width of the window.
|
||||
MinWidth int
|
||||
|
||||
// MinHeight is the minimum height of the window.
|
||||
MinHeight int
|
||||
|
||||
// MaxWidth is the maximum width of the window.
|
||||
MaxWidth int
|
||||
|
||||
// MaxHeight is the maximum height of the window.
|
||||
MaxHeight int
|
||||
|
||||
// StartState indicates the state of the window when it is first shown.
|
||||
// Default: WindowStateNormal
|
||||
StartState WindowState
|
||||
|
||||
// Centered will center the window on the screen.
|
||||
Centered bool
|
||||
|
||||
// BackgroundType is the type of background to use for the window.
|
||||
// Default: BackgroundTypeSolid
|
||||
BackgroundType BackgroundType
|
||||
|
||||
// BackgroundColour is the colour to use for the window background.
|
||||
BackgroundColour RGBA
|
||||
|
||||
// HTML is the HTML to load in the window.
|
||||
HTML string
|
||||
|
||||
// JS is the JavaScript to load in the window.
|
||||
JS string
|
||||
|
||||
// CSS is the CSS to load in the window.
|
||||
CSS string
|
||||
|
||||
// X is the starting X position of the window.
|
||||
X int
|
||||
|
||||
// Y is the starting Y position of the window.
|
||||
Y int
|
||||
|
||||
// TransparentTitlebar will make the titlebar transparent.
|
||||
// TODO: Move to mac window options
|
||||
FullscreenButtonEnabled bool
|
||||
|
||||
// Hidden will hide the window when it is first created.
|
||||
Hidden bool
|
||||
|
||||
// Zoom is the zoom level of the window.
|
||||
Zoom float64
|
||||
|
||||
// ZoomControlEnabled will enable the zoom control.
|
||||
ZoomControlEnabled bool
|
||||
|
||||
// EnableDragAndDrop will enable drag and drop.
|
||||
EnableDragAndDrop bool
|
||||
|
||||
// OpenInspectorOnStartup will open the inspector when the window is first shown.
|
||||
OpenInspectorOnStartup bool
|
||||
|
||||
// Mac options
|
||||
Mac MacWindow
|
||||
|
||||
// Windows options
|
||||
Windows WindowsWindow
|
||||
|
||||
// Focused indicates the window should be focused when initially shown
|
||||
Focused bool
|
||||
|
||||
// ShouldClose is called when the window is about to close.
|
||||
// Return true to allow the window to close, or false to prevent it from closing.
|
||||
|
@ -85,6 +85,13 @@ type WindowsWindow struct {
|
||||
// EnableSwipeGestures enables swipe gestures for the window
|
||||
// Default: false
|
||||
EnableSwipeGestures bool
|
||||
|
||||
// EnableFraudulentWebsiteWarnings will enable warnings for fraudulent websites.
|
||||
// Default: false
|
||||
EnableFraudulentWebsiteWarnings bool
|
||||
|
||||
// Menu is the menu to use for the window.
|
||||
Menu *Menu
|
||||
}
|
||||
|
||||
type Theme int
|
||||
|
@ -193,8 +193,8 @@ func (w *windowsWebviewWindow) run() {
|
||||
if !options.Windows.DisableMenu {
|
||||
theMenu := globalApplication.ApplicationMenu
|
||||
// Create the menu if we have one
|
||||
if w.parent.options.Menu != nil {
|
||||
theMenu = w.parent.options.Menu
|
||||
if w.parent.options.Windows.Menu != nil {
|
||||
theMenu = w.parent.options.Windows.Menu
|
||||
}
|
||||
if theMenu != nil {
|
||||
w.menu = NewApplicationMenu(w.hwnd, theMenu)
|
||||
@ -1379,7 +1379,7 @@ func (w *windowsWebviewWindow) setupChromium() {
|
||||
|
||||
disableFeatues := []string{}
|
||||
|
||||
if !w.parent.options.EnableFraudulentWebsiteWarnings {
|
||||
if !opts.EnableFraudulentWebsiteWarnings {
|
||||
disableFeatues = append(disableFeatues, "msSmartScreenProtection")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user