Added menu cloning.

Introduced the ability to clone a menu, along with its submenus, in Linux-based web applications to create a full deep copy. This fixes reusing the application menu for window menus.
This commit is contained in:
Lea Anthony
2024-03-06 11:42:19 -06:00
committed by Travis McLane
parent 809863d61a
commit 3d93c83920
9 changed files with 111 additions and 39 deletions
+17 -15
View File
@@ -154,21 +154,23 @@ func main() {
}).Show()
windowCounter++
})
myMenu.Add("New WebviewWindow (ignores mouse events").
SetAccelerator("CmdOrCtrl+F").
OnClick(func(ctx *application.Context) {
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
HTML: "<div style='width: 100%; height: 95%; border: 3px solid red; background-color: \"0000\";'></div>",
X: rand.Intn(1000),
Y: rand.Intn(800),
IgnoreMouseEvents: true,
BackgroundType: application.BackgroundTypeTransparent,
Mac: application.MacWindow{
InvisibleTitleBarHeight: 50,
},
}).Show()
windowCounter++
})
if runtime.GOOS != "linux" {
myMenu.Add("New WebviewWindow (ignores mouse events)").
SetAccelerator("CmdOrCtrl+F").
OnClick(func(ctx *application.Context) {
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
HTML: "<div style='width: 100%; height: 95%; border: 3px solid red; background-color: \"0000\";'></div>",
X: rand.Intn(1000),
Y: rand.Intn(800),
IgnoreMouseEvents: true,
BackgroundType: application.BackgroundTypeTransparent,
Mac: application.MacWindow{
InvisibleTitleBarHeight: 50,
},
}).Show()
windowCounter++
})
}
if runtime.GOOS == "darwin" {
myMenu.Add("New WebviewWindow (MacTitleBarHiddenInset)").
OnClick(func(ctx *application.Context) {