5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 03:10:22 +08:00

[v2] Add WindowGetPos & WindowGetSize

This commit is contained in:
Lea Anthony 2021-10-18 21:42:02 +11:00
parent 3edbda313e
commit 4e68f92083
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -2,6 +2,7 @@ package runtime
import (
"context"
"github.com/wailsapp/wails/v2/pkg/options"
)
@ -53,6 +54,11 @@ func WindowSetSize(ctx context.Context, width int, height int) {
appFrontend.WindowSetSize(width, height)
}
func WindowGetSize(ctx context.Context) (int, int) {
appFrontend := getFrontend(ctx)
return appFrontend.WindowGetSize()
}
// WindowSetMinSize sets the minimum size of the window
func WindowSetMinSize(ctx context.Context, width int, height int) {
appFrontend := getFrontend(ctx)
@ -71,6 +77,11 @@ func WindowSetPosition(ctx context.Context, x int, y int) {
appFrontend.WindowSetPos(x, y)
}
func WindowGetPos(ctx context.Context) (int, int) {
appFrontend := getFrontend(ctx)
return appFrontend.WindowGetPos()
}
// WindowMaximise the window
func WindowMaximise(ctx context.Context) {
appFrontend := getFrontend(ctx)