GetCurrentWindow -> CurrentWindow

This commit is contained in:
Lea Anthony 2022-12-23 19:55:54 +11:00
commit 2946a0aa25
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405
5 changed files with 17 additions and 17 deletions

View file

@ -166,7 +166,7 @@ func main() {
CanChooseFiles(true).
CanCreateDirectories(true).
ShowHiddenFiles(true).
AttachToWindow(app.GetCurrentWindow()).
AttachToWindow(app.CurrentWindow()).
PromptForSingleSelection()
if result != "" {
app.NewInfoDialog().SetMessage(result).Show()
@ -277,7 +277,7 @@ func main() {
})
saveMenu.Add("Select File (Attach To Window)").OnClick(func(ctx *application.Context) {
result, _ := app.NewSaveFileDialog().
AttachToWindow(app.GetCurrentWindow()).
AttachToWindow(app.CurrentWindow()).
PromptForSingleSelection()
if result != "" {
app.NewInfoDialog().SetMessage(result).Show()

View file

@ -30,11 +30,11 @@ func main() {
// You can control the current window from the menu
myMenu.Add("Lock Window Resize").OnClick(func(ctx *application.Context) {
if app.GetCurrentWindow().Resizable() {
app.GetCurrentWindow().SetResizable(false)
if app.CurrentWindow().Resizable() {
app.CurrentWindow().SetResizable(false)
ctx.ClickedMenuItem().SetLabel("Unlock Window Resize")
} else {
app.GetCurrentWindow().SetResizable(true)
app.CurrentWindow().SetResizable(true)
ctx.ClickedMenuItem().SetLabel("Lock Window Resize")
}
})

View file

@ -245,7 +245,7 @@ func (a *App) handleMenuItemClicked(menuItemID uint) {
menuItem.handleClick()
}
func (a *App) GetCurrentWindow() *Window {
func (a *App) CurrentWindow() *Window {
if a.impl == nil {
return nil
}

View file

@ -509,7 +509,7 @@ func newCloseMenuItem() *MenuItem {
return newMenuItem("Close").
SetAccelerator("CmdOrCtrl+w").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.Close()
}
@ -520,7 +520,7 @@ func newReloadMenuItem() *MenuItem {
return newMenuItem("Reload").
SetAccelerator("CmdOrCtrl+r").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.Reload()
}
@ -531,7 +531,7 @@ func newForceReloadMenuItem() *MenuItem {
return newMenuItem("Force Reload").
SetAccelerator("CmdOrCtrl+Shift+r").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.ForceReload()
}
@ -541,7 +541,7 @@ func newForceReloadMenuItem() *MenuItem {
func newToggleFullscreenMenuItem() *MenuItem {
result := newMenuItem("Toggle Full Screen").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.ToggleFullscreen()
}
@ -558,7 +558,7 @@ func newToggleDevToolsMenuItem() *MenuItem {
return newMenuItem("Toggle Developer Tools").
SetAccelerator("Alt+Command+I").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.ToggleDevTools()
}
@ -570,7 +570,7 @@ func newResetZoomMenuItem() *MenuItem {
return newMenuItem("Actual Size").
SetAccelerator("CmdOrCtrl+0").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.ResetZoom()
}
@ -581,7 +581,7 @@ func newZoomInMenuItem() *MenuItem {
return newMenuItem("Zoom In").
SetAccelerator("CmdOrCtrl+plus").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.ZoomIn()
}
@ -592,7 +592,7 @@ func newZoomOutMenuItem() *MenuItem {
return newMenuItem("Zoom Out").
SetAccelerator("CmdOrCtrl+-").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.ZoomOut()
}
@ -603,7 +603,7 @@ func newMinimizeMenuItem() *MenuItem {
return newMenuItem("Minimize").
SetAccelerator("CmdOrCtrl+M").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.Minimize()
}
@ -613,7 +613,7 @@ func newMinimizeMenuItem() *MenuItem {
func newZoomMenuItem() *MenuItem {
return newMenuItem("Zoom").
OnClick(func(ctx *Context) {
currentWindow := globalApplication.GetCurrentWindow()
currentWindow := globalApplication.CurrentWindow()
if currentWindow != nil {
currentWindow.Zoom()
}

View file

@ -140,7 +140,7 @@ func newWindowMenu() *MenuItem {
func newHelpMenu() *MenuItem {
menu := NewMenu()
menu.Add("Learn More").OnClick(func(ctx *Context) {
globalApplication.GetCurrentWindow().NavigateToURL("https://wails.io")
globalApplication.CurrentWindow().NavigateToURL("https://wails.io")
})
subMenu := newSubMenuItem("Help")
subMenu.submenu = menu