mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Add Some WindowState (#1349)
* Add Check for WindowState IsMaximised, IsMinimized, IsNormal and IsFullscreen Solve conflicts # Conflicts: # v2/internal/frontend/desktop/darwin/WailsContext.m # v2/internal/frontend/desktop/darwin/frontend.go # v2/internal/frontend/desktop/linux/window.go # v2/internal/frontend/desktop/windows/window.go * Add Check for WindowState IsMaximised, IsMinimized, IsNormal and IsFullscreen Solve conflict # Conflicts: # v2/pkg/runtime/window.go * Forgot some function to use it # Conflicts: # v2/internal/frontend/desktop/darwin/WailsContext.h # v2/internal/frontend/desktop/windows/win32/consts.go # v2/internal/frontend/desktop/windows/win32/window.go * Modify the instructions # Conflicts: # v2/internal/frontend/devserver/devserver.go * Add Functions to DevServer # Conflicts: # v2/internal/frontend/dispatcher/systemcalls.go # v2/internal/frontend/runtime/desktop/window.js # v2/internal/frontend/runtime/package-lock.json # v2/internal/frontend/runtime/runtime_prod_desktop.js # v2/internal/frontend/runtime/wrapper/runtime.d.ts # v2/internal/frontend/runtime/wrapper/runtime.js * Add Callback and JavaScript Functions # Conflicts: # v2/cmd/wails/internal/commands/initialise/templates/generate/assets/common/frontend/wailsjs/runtime/runtime.js # v2/internal/frontend/runtime/package-lock.json # v2/internal/frontend/runtime/runtime_dev_desktop.js * Remove Merge lines * Fix IsMaximised * Add WindowState Docs * Update docs Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
co-authored by
Lea Anthony
parent
d70d8055cc
commit
70c484f603
+12
@@ -137,6 +137,10 @@ export function WindowUnmaximise() {
|
||||
window.runtime.WindowUnmaximise();
|
||||
}
|
||||
|
||||
export function WindowIsMaximised() {
|
||||
return window.runtime.WindowIsMaximised();
|
||||
}
|
||||
|
||||
export function WindowMinimise() {
|
||||
window.runtime.WindowMinimise();
|
||||
}
|
||||
@@ -153,6 +157,14 @@ export function ScreenGetAll() {
|
||||
return window.runtime.ScreenGetAll();
|
||||
}
|
||||
|
||||
export function WindowIsMinimised() {
|
||||
return window.runtime.WindowIsMinimised();
|
||||
}
|
||||
|
||||
export function WindowIsNormal() {
|
||||
return window.runtime.WindowIsNormal();
|
||||
}
|
||||
|
||||
export function BrowserOpenURL(url) {
|
||||
window.runtime.BrowserOpenURL(url);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ void Quit(void*);
|
||||
|
||||
const char* GetSize(void *ctx);
|
||||
const char* GetPosition(void *ctx);
|
||||
const bool IsFullScreen(void *ctx);
|
||||
const bool IsMinimised(void *ctx);
|
||||
const bool IsMaximised(void *ctx);
|
||||
|
||||
void ProcessURLResponse(void *inctx, unsigned long long requestId, int statusCode, void *headersString, int headersStringLength, void* data, int datalength);
|
||||
|
||||
|
||||
@@ -186,7 +186,21 @@ const char* GetPosition(void *inctx) {
|
||||
y = screenFrame.size.height - y - windowFrame.size.height;
|
||||
NSString *result = [NSString stringWithFormat:@"%d,%d",x,y];
|
||||
return [result UTF8String];
|
||||
}
|
||||
|
||||
const bool IsFullScreen(void *inctx) {
|
||||
WailsContext *ctx = (__bridge WailsContext*) inctx;
|
||||
return [ctx IsFullScreen];
|
||||
}
|
||||
|
||||
const bool IsMinimised(void *inctx) {
|
||||
WailsContext *ctx = (__bridge WailsContext*) inctx;
|
||||
return [ctx IsMinimised];
|
||||
}
|
||||
|
||||
const bool IsMaximised(void *inctx) {
|
||||
WailsContext *ctx = (__bridge WailsContext*) inctx;
|
||||
return [ctx IsMaximised];
|
||||
}
|
||||
|
||||
void UnMaximise(void* inctx) {
|
||||
|
||||
@@ -67,11 +67,14 @@
|
||||
- (void) Center;
|
||||
- (void) Fullscreen;
|
||||
- (void) UnFullscreen;
|
||||
- (bool) IsFullScreen;
|
||||
- (void) Minimise;
|
||||
- (void) UnMinimise;
|
||||
- (bool) IsMinimised;
|
||||
- (void) Maximise;
|
||||
- (void) ToggleMaximise;
|
||||
- (void) UnMaximise;
|
||||
- (bool) IsMaximised;
|
||||
- (void) SetBackgroundColour:(int)r :(int)g :(int)b :(int)a;
|
||||
- (void) HideMouse;
|
||||
- (void) ShowMouse;
|
||||
|
||||
@@ -322,14 +322,14 @@
|
||||
[NSCursor unhide];
|
||||
}
|
||||
|
||||
- (bool) isFullScreen {
|
||||
- (bool) IsFullScreen {
|
||||
long mask = [self.mainWindow styleMask];
|
||||
return (mask & NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen;
|
||||
}
|
||||
|
||||
// Fullscreen sets the main window to be fullscreen
|
||||
- (void) Fullscreen {
|
||||
if( ! [self isFullScreen] ) {
|
||||
if( ! [self IsFullScreen] ) {
|
||||
[self.mainWindow disableWindowConstraints];
|
||||
[self.mainWindow toggleFullScreen:nil];
|
||||
}
|
||||
@@ -337,7 +337,7 @@
|
||||
|
||||
// UnFullscreen resets the main window after a fullscreen
|
||||
- (void) UnFullscreen {
|
||||
if( [self isFullScreen] ) {
|
||||
if( [self IsFullScreen] ) {
|
||||
[self.mainWindow applyWindowConstraints];
|
||||
[self.mainWindow toggleFullScreen:nil];
|
||||
}
|
||||
@@ -351,6 +351,10 @@
|
||||
[self.mainWindow deminiaturize:nil];
|
||||
}
|
||||
|
||||
- (bool) IsMinimised {
|
||||
return [self.mainWindow isMiniaturized];
|
||||
}
|
||||
|
||||
- (void) Hide {
|
||||
[self.mainWindow orderOut:nil];
|
||||
}
|
||||
@@ -394,6 +398,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (bool) IsMaximised {
|
||||
return [self.mainWindow isZoomed];
|
||||
}
|
||||
|
||||
- (void) ExecJS:(NSString*)script {
|
||||
[self.webview evaluateJavaScript:script completionHandler:nil];
|
||||
}
|
||||
@@ -476,7 +484,7 @@
|
||||
|
||||
// Check for drag
|
||||
if ( [m isEqualToString:@"drag"] ) {
|
||||
if( [self isFullScreen] ) {
|
||||
if( [self IsFullScreen] ) {
|
||||
return;
|
||||
}
|
||||
if( self.mouseEvent != nil ) {
|
||||
|
||||
@@ -234,6 +234,23 @@ func (f *Frontend) WindowSetBackgroundColour(col *options.RGBA) {
|
||||
func (f *Frontend) ScreenGetAll() ([]frontend.Screen, error) {
|
||||
return GetAllScreens(f.mainWindow.context)
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsMaximised() bool {
|
||||
return f.mainWindow.IsMaximised()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsMinimised() bool {
|
||||
return f.mainWindow.IsMinimised()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsNormal() bool {
|
||||
return f.mainWindow.IsNormal()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsFullscreen() bool {
|
||||
return f.mainWindow.IsFullScreen()
|
||||
}
|
||||
|
||||
func (f *Frontend) Quit() {
|
||||
if f.frontendOptions.OnBeforeClose != nil {
|
||||
go func() {
|
||||
|
||||
@@ -168,6 +168,10 @@ func (w *Window) UnMaximise() {
|
||||
C.UnMaximise(w.context)
|
||||
}
|
||||
|
||||
func (w *Window) IsMaximised() bool {
|
||||
return (bool)(C.IsMaximised(w.context))
|
||||
}
|
||||
|
||||
func (w *Window) Minimise() {
|
||||
C.Minimise(w.context)
|
||||
}
|
||||
@@ -176,6 +180,14 @@ func (w *Window) UnMinimise() {
|
||||
C.UnMinimise(w.context)
|
||||
}
|
||||
|
||||
func (w *Window) IsMinimised() bool {
|
||||
return (bool)(C.IsMinimised(w.context))
|
||||
}
|
||||
|
||||
func (w *Window) IsNormal() bool {
|
||||
return !w.IsMaximised() && !w.IsMinimised() && !w.IsFullScreen()
|
||||
}
|
||||
|
||||
func (w *Window) SetMinSize(width int, height int) {
|
||||
C.SetMinSize(w.context, C.int(width), C.int(height))
|
||||
}
|
||||
@@ -192,6 +204,10 @@ func (w *Window) UnFullscreen() {
|
||||
C.UnFullscreen(w.context)
|
||||
}
|
||||
|
||||
func (w *Window) IsFullScreen() bool {
|
||||
return (bool)(C.IsFullScreen(w.context))
|
||||
}
|
||||
|
||||
func (w *Window) Show() {
|
||||
C.Show(w.context)
|
||||
}
|
||||
|
||||
@@ -228,6 +228,22 @@ func (f *Frontend) ScreenGetAll() ([]Screen, error) {
|
||||
return GetAllScreens(f.mainWindow.asGTKWindow())
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsMaximised() bool {
|
||||
return f.mainWindow.IsMaximised()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsMinimised() bool {
|
||||
return f.mainWindow.IsMinimised()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsNormal() bool {
|
||||
return f.mainWindow.IsNormal()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsFullscreen() bool {
|
||||
return f.mainWindow.IsFullScreen()
|
||||
}
|
||||
|
||||
func (f *Frontend) Quit() {
|
||||
if f.frontendOptions.OnBeforeClose != nil {
|
||||
go func() {
|
||||
|
||||
@@ -116,7 +116,13 @@ int IsFullscreen(GtkWidget *widget) {
|
||||
int IsMaximised(GtkWidget *widget) {
|
||||
GdkWindow *gdkwindow = gtk_widget_get_window(widget);
|
||||
GdkWindowState state = gdk_window_get_state(GDK_WINDOW(gdkwindow));
|
||||
return state & GDK_WINDOW_STATE_MAXIMIZED;
|
||||
return state & GDK_WINDOW_STATE_MAXIMIZED && !(state & GDK_WINDOW_STATE_FULLSCREEN);
|
||||
}
|
||||
|
||||
int IsMinimised(GtkWidget *widget) {
|
||||
GdkWindow *gdkwindow = gtk_widget_get_window(widget);
|
||||
GdkWindowState state = gdk_window_get_state(GDK_WINDOW(gdkwindow));
|
||||
return state & GDK_WINDOW_STATE_ICONIFIED;
|
||||
}
|
||||
|
||||
|
||||
@@ -808,6 +814,15 @@ func (w *Window) IsMaximised() bool {
|
||||
return result > 0
|
||||
}
|
||||
|
||||
func (w *Window) IsMinimised() bool {
|
||||
result := C.IsMinimised(w.asGTKWidget())
|
||||
return result > 0
|
||||
}
|
||||
|
||||
func (w *Window) IsNormal() bool {
|
||||
return !w.IsMaximised() && !w.IsMinimised() && !w.IsFullScreen()
|
||||
}
|
||||
|
||||
func (w *Window) SetBackgroundColour(r uint8, g uint8, b uint8, a uint8) {
|
||||
data := C.RGBAOptions{
|
||||
r: C.uchar(r),
|
||||
|
||||
@@ -366,6 +366,22 @@ func (f *Frontend) Hide() {
|
||||
f.mainWindow.Hide()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsMaximised() bool {
|
||||
return f.mainWindow.IsMaximised()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsMinimised() bool {
|
||||
return f.mainWindow.IsMinimised()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsNormal() bool {
|
||||
return f.mainWindow.IsNormal()
|
||||
}
|
||||
|
||||
func (f *Frontend) WindowIsFullscreen() bool {
|
||||
return f.mainWindow.IsFullScreen()
|
||||
}
|
||||
|
||||
func (f *Frontend) Quit() {
|
||||
if f.frontendOptions.OnBeforeClose != nil && f.frontendOptions.OnBeforeClose(f.ctx) {
|
||||
return
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
type HRESULT int32
|
||||
type HANDLE uintptr
|
||||
type HMONITOR HANDLE
|
||||
|
||||
var (
|
||||
moduser32 = syscall.NewLazyDLL("user32.dll")
|
||||
@@ -19,6 +20,9 @@ var (
|
||||
procSetClassLongPtr = moduser32.NewProc("SetClassLongPtrW")
|
||||
procShowWindow = moduser32.NewProc("ShowWindow")
|
||||
procIsWindowVisible = moduser32.NewProc("IsWindowVisible")
|
||||
procGetWindowRect = moduser32.NewProc("GetWindowRect")
|
||||
procGetMonitorInfo = moduser32.NewProc("GetMonitorInfoW")
|
||||
procMonitorFromWindow = moduser32.NewProc("MonitorFromWindow")
|
||||
)
|
||||
var (
|
||||
moddwmapi = syscall.NewLazyDLL("dwmapi.dll")
|
||||
|
||||
@@ -13,10 +13,13 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
WS_MINIMIZE = 0x20000000
|
||||
WS_MAXIMIZE = 0x01000000
|
||||
WS_MINIMIZE = 0x20000000
|
||||
|
||||
GWL_STYLE = -16
|
||||
|
||||
MONITOR_DEFAULTTOPRIMARY = 0x00000001
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -66,6 +69,19 @@ type MARGINS struct {
|
||||
CxLeftWidth, CxRightWidth, CyTopHeight, CyBottomHeight int32
|
||||
}
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd162897.aspx
|
||||
type RECT struct {
|
||||
Left, Top, Right, Bottom int32
|
||||
}
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd145065.aspx
|
||||
type MONITORINFO struct {
|
||||
CbSize uint32
|
||||
RcMonitor RECT
|
||||
RcWork RECT
|
||||
DwFlags uint32
|
||||
}
|
||||
|
||||
func ExtendFrameIntoClientArea(hwnd uintptr) {
|
||||
// -1: Adds the default frame styling (aero shadow and e.g. rounded corners on Windows 11)
|
||||
// Also shows the caption buttons if transparent ant translucent but they don't work.
|
||||
@@ -83,6 +99,20 @@ func IsVisible(hwnd uintptr) bool {
|
||||
return ret != 0
|
||||
}
|
||||
|
||||
func IsWindowFullScreen(hwnd uintptr) bool {
|
||||
wRect := GetWindowRect(hwnd)
|
||||
m := MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY)
|
||||
var mi MONITORINFO
|
||||
mi.CbSize = uint32(unsafe.Sizeof(mi))
|
||||
if !GetMonitorInfo(m, &mi) {
|
||||
return false
|
||||
}
|
||||
return wRect.Left == mi.RcMonitor.Left &&
|
||||
wRect.Top == mi.RcMonitor.Top &&
|
||||
wRect.Right == mi.RcMonitor.Right &&
|
||||
wRect.Bottom == mi.RcMonitor.Bottom
|
||||
}
|
||||
|
||||
func IsWindowMaximised(hwnd uintptr) bool {
|
||||
style := uint32(getWindowLong(hwnd, GWL_STYLE))
|
||||
return style&WS_MAXIMIZE != 0
|
||||
@@ -113,6 +143,15 @@ func SetBackgroundColour(hwnd uintptr, r, g, b uint8) {
|
||||
setClassLongPtr(hwnd, GCLP_HBRBACKGROUND, hbrush)
|
||||
}
|
||||
|
||||
func IsWindowMinimised(hwnd uintptr) bool {
|
||||
style := uint32(getWindowLong(hwnd, GWL_STYLE))
|
||||
return style&WS_MINIMIZE != 0
|
||||
}
|
||||
|
||||
func IsWindowNormal(hwnd uintptr) bool {
|
||||
return !IsWindowMaximised(hwnd) && !IsWindowMinimised(hwnd) && !IsWindowFullScreen(hwnd)
|
||||
}
|
||||
|
||||
func dwmExtendFrameIntoClientArea(hwnd uintptr, margins *MARGINS) error {
|
||||
ret, _, _ := procDwmExtendFrameIntoClientArea.Call(
|
||||
hwnd,
|
||||
@@ -158,6 +197,30 @@ func showWindow(hwnd uintptr, cmdshow int) bool {
|
||||
ret, _, _ := procShowWindow.Call(
|
||||
hwnd,
|
||||
uintptr(cmdshow))
|
||||
return ret != 0
|
||||
}
|
||||
|
||||
func GetWindowRect(hwnd uintptr) *RECT {
|
||||
var rect RECT
|
||||
procGetWindowRect.Call(
|
||||
hwnd,
|
||||
uintptr(unsafe.Pointer(&rect)))
|
||||
|
||||
return &rect
|
||||
}
|
||||
|
||||
func MonitorFromWindow(hwnd uintptr, dwFlags uint32) HMONITOR {
|
||||
ret, _, _ := procMonitorFromWindow.Call(
|
||||
hwnd,
|
||||
uintptr(dwFlags),
|
||||
)
|
||||
return HMONITOR(ret)
|
||||
}
|
||||
|
||||
func GetMonitorInfo(hMonitor HMONITOR, lmpi *MONITORINFO) bool {
|
||||
ret, _, _ := procGetMonitorInfo.Call(
|
||||
uintptr(hMonitor),
|
||||
uintptr(unsafe.Pointer(lmpi)),
|
||||
)
|
||||
return ret != 0
|
||||
}
|
||||
|
||||
@@ -292,6 +292,14 @@ func (w *Window) IsMinimised() bool {
|
||||
return win32.IsWindowMinimised(w.Handle())
|
||||
}
|
||||
|
||||
func (w *Window) IsNormal() bool {
|
||||
return win32.IsWindowNormal(w.Handle())
|
||||
}
|
||||
|
||||
func (w *Window) IsFullScreen() bool {
|
||||
return win32.IsWindowFullScreen(w.Handle())
|
||||
}
|
||||
|
||||
func (w *Window) SetTheme(theme winoptions.Theme) {
|
||||
w.theme = theme
|
||||
w.themeChanged = true
|
||||
|
||||
@@ -210,6 +210,10 @@ func (d *DevWebServer) WindowUnmaximise() {
|
||||
d.desktopFrontend.WindowUnmaximise()
|
||||
}
|
||||
|
||||
func (d *DevWebServer) WindowIsMaximised() bool {
|
||||
return d.desktopFrontend.WindowIsMaximised()
|
||||
}
|
||||
|
||||
func (d *DevWebServer) WindowMinimise() {
|
||||
d.desktopFrontend.WindowMinimise()
|
||||
}
|
||||
@@ -221,6 +225,10 @@ func (d *DevWebServer) WindowSetAlwaysOnTop(b bool) {
|
||||
d.desktopFrontend.WindowSetAlwaysOnTop(b)
|
||||
}
|
||||
|
||||
func (d *DevWebServer) WindowIsMinimised() bool {
|
||||
return d.desktopFrontend.WindowIsMinimised()
|
||||
}
|
||||
|
||||
func (d *DevWebServer) WindowSetPosition(x int, y int) {
|
||||
d.desktopFrontend.WindowSetPosition(x, y)
|
||||
}
|
||||
@@ -261,6 +269,14 @@ func (d *DevWebServer) ScreenGetAll() ([]Screen, error) {
|
||||
return d.desktopFrontend.ScreenGetAll()
|
||||
}
|
||||
|
||||
func (d *DevWebServer) WindowIsFullscreen() bool {
|
||||
return d.desktopFrontend.WindowIsFullscreen()
|
||||
}
|
||||
|
||||
func (d *DevWebServer) WindowIsNormal() bool {
|
||||
return d.desktopFrontend.WindowIsNormal()
|
||||
}
|
||||
|
||||
func (d *DevWebServer) MenuSetApplicationMenu(menu *menu.Menu) {
|
||||
d.desktopFrontend.MenuSetApplicationMenu(menu)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,14 @@ func (d *Dispatcher) processSystemCall(payload callMessage, sender frontend.Fron
|
||||
return &size{w, h}, nil
|
||||
case "ScreenGetAll":
|
||||
return sender.ScreenGetAll()
|
||||
case "WindowIsMaximised":
|
||||
return sender.WindowIsMaximised(), nil
|
||||
case "WindowIsMinimised":
|
||||
return sender.WindowIsMinimised(), nil
|
||||
case "WindowIsNormal":
|
||||
return sender.WindowIsNormal(), nil
|
||||
case "WindowIsFullscreen":
|
||||
return sender.WindowIsFullscreen(), nil
|
||||
case "Environment":
|
||||
return runtime.Environment(d.ctx), nil
|
||||
default:
|
||||
|
||||
@@ -101,6 +101,10 @@ type Frontend interface {
|
||||
WindowSetSystemDefaultTheme()
|
||||
WindowSetLightTheme()
|
||||
WindowSetDarkTheme()
|
||||
WindowIsMaximised() bool
|
||||
WindowIsMinimised() bool
|
||||
WindowIsNormal() bool
|
||||
WindowIsFullscreen() bool
|
||||
|
||||
//Screen
|
||||
ScreenGetAll() ([]Screen, error)
|
||||
|
||||
@@ -70,6 +70,16 @@ export function WindowUnfullscreen() {
|
||||
window.WailsInvoke('Wf');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state of the window, i.e. whether the window is in full screen mode or not.
|
||||
*
|
||||
* @export
|
||||
* @return {Promise<boolean>} The state of the window
|
||||
*/
|
||||
export function WindowIsFullscreen() {
|
||||
return Call(":wails:WindowIsFullscreen");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Size of the window
|
||||
*
|
||||
@@ -195,6 +205,16 @@ export function WindowUnmaximise() {
|
||||
window.WailsInvoke('WU');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state of the window, i.e. whether the window is maximised or not.
|
||||
*
|
||||
* @export
|
||||
* @return {Promise<boolean>} The state of the window
|
||||
*/
|
||||
export function WindowIsMaximised() {
|
||||
return Call(":wails:WindowIsMaximised");
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimise the Window
|
||||
*
|
||||
@@ -213,6 +233,26 @@ export function WindowUnminimise() {
|
||||
window.WailsInvoke('Wu');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state of the window, i.e. whether the window is minimised or not.
|
||||
*
|
||||
* @export
|
||||
* @return {Promise<boolean>} The state of the window
|
||||
*/
|
||||
export function WindowIsMinimised() {
|
||||
return Call(":wails:WindowIsMinimised");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state of the window, i.e. whether the window is normal or not.
|
||||
*
|
||||
* @export
|
||||
* @return {Promise<boolean>} The state of the window
|
||||
*/
|
||||
export function WindowIsNormal() {
|
||||
return Call(":wails:WindowIsNormal");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the background colour of the window
|
||||
*
|
||||
|
||||
+881
-12
File diff suppressed because it is too large
Load Diff
@@ -230,6 +230,10 @@
|
||||
WindowGetPosition: () => WindowGetPosition,
|
||||
WindowGetSize: () => WindowGetSize,
|
||||
WindowHide: () => WindowHide,
|
||||
WindowIsFullscreen: () => WindowIsFullscreen,
|
||||
WindowIsMaximised: () => WindowIsMaximised,
|
||||
WindowIsMinimised: () => WindowIsMinimised,
|
||||
WindowIsNormal: () => WindowIsNormal,
|
||||
WindowMaximise: () => WindowMaximise,
|
||||
WindowMinimise: () => WindowMinimise,
|
||||
WindowReload: () => WindowReload,
|
||||
@@ -277,6 +281,9 @@
|
||||
function WindowUnfullscreen() {
|
||||
window.WailsInvoke("Wf");
|
||||
}
|
||||
function WindowIsFullscreen() {
|
||||
return Call(":wails:WindowIsFullscreen");
|
||||
}
|
||||
function WindowSetSize(width, height) {
|
||||
window.WailsInvoke("Ws:" + width + ":" + height);
|
||||
}
|
||||
@@ -313,12 +320,21 @@
|
||||
function WindowUnmaximise() {
|
||||
window.WailsInvoke("WU");
|
||||
}
|
||||
function WindowIsMaximised() {
|
||||
return Call(":wails:WindowIsMaximised");
|
||||
}
|
||||
function WindowMinimise() {
|
||||
window.WailsInvoke("Wm");
|
||||
}
|
||||
function WindowUnminimise() {
|
||||
window.WailsInvoke("Wu");
|
||||
}
|
||||
function WindowIsMinimised() {
|
||||
return Call(":wails:WindowIsMinimised");
|
||||
}
|
||||
function WindowIsNormal() {
|
||||
return Call(":wails:WindowIsNormal");
|
||||
}
|
||||
function WindowSetBackgroundColour(R, G, B, A) {
|
||||
let rgba = JSON.stringify({ r: R || 0, g: G || 0, b: B || 0, a: A || 255 });
|
||||
window.WailsInvoke("Wr:" + rgba);
|
||||
|
||||
@@ -120,6 +120,10 @@ export function WindowFullscreen(): void;
|
||||
// Restores the previous window dimensions and position prior to full screen.
|
||||
export function WindowUnfullscreen(): void;
|
||||
|
||||
// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
|
||||
// Returns the state of the window, i.e. whether the window is in full screen mode or not.
|
||||
export function WindowIsFullscreen(): Promise<boolean>;
|
||||
|
||||
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
|
||||
// Sets the width and height of the window.
|
||||
export function WindowSetSize(width: number, height: number): Promise<Size>;
|
||||
@@ -166,6 +170,10 @@ export function WindowToggleMaximise(): void;
|
||||
// Restores the window to the dimensions and position prior to maximising.
|
||||
export function WindowUnmaximise(): void;
|
||||
|
||||
// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
|
||||
// Returns the state of the window, i.e. whether the window is maximised or not.
|
||||
export function WindowIsMaximised(): Promise<boolean>;
|
||||
|
||||
// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
|
||||
// Minimises the window.
|
||||
export function WindowMinimise(): void;
|
||||
@@ -174,6 +182,14 @@ export function WindowMinimise(): void;
|
||||
// Restores the window to the dimensions and position prior to minimising.
|
||||
export function WindowUnminimise(): void;
|
||||
|
||||
// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
|
||||
// Returns the state of the window, i.e. whether the window is minimised or not.
|
||||
export function WindowIsMinimised(): Promise<boolean>;
|
||||
|
||||
// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
|
||||
// Returns the state of the window, i.e. whether the window is normal or not.
|
||||
export function WindowIsNormal(): Promise<boolean>;
|
||||
|
||||
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
|
||||
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
|
||||
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user