| 1 | package main |
| 2 | |
| 3 | import "github.com/wailsapp/wails/v2/pkg/runtime" |
| 4 | |
| 5 | // MinimiseMainWindow backs the Windows frameless titlebar controls. |
| 6 | func (a *App) MinimiseMainWindow() { |
| 7 | if a.ctx == nil { |
| 8 | return |
| 9 | } |
| 10 | runtime.WindowMinimise(a.ctx) |
| 11 | } |
| 12 | |
| 13 | // ToggleMaximiseMainWindow backs the Windows frameless titlebar controls. |
| 14 | func (a *App) ToggleMaximiseMainWindow() { |
| 15 | if a.ctx == nil { |
| 16 | return |
| 17 | } |
| 18 | runtime.WindowToggleMaximise(a.ctx) |
| 19 | } |
| 20 | |
| 21 | // IsMainWindowMaximised reports the native maximise state for the Windows |
| 22 | // frameless titlebar controls. |
| 23 | func (a *App) IsMainWindowMaximised() bool { |
| 24 | if a.ctx == nil { |
| 25 | return false |
| 26 | } |
| 27 | return runtime.WindowIsMaximised(a.ctx) |
| 28 | } |
| 29 | |
| 30 | // CloseMainWindow preserves Reasonix's configured close behavior for the |
| 31 | // Windows frameless titlebar close button. |
| 32 | func (a *App) CloseMainWindow() { |
| 33 | if a.ctx == nil { |
| 34 | return |
| 35 | } |
| 36 | if a.beforeClose(a.ctx) { |
| 37 | return |
| 38 | } |
| 39 | a.forceQuit.Store(true) |
| 40 | runtime.Quit(a.ctx) |
| 41 | } |
| 42 |