diff options
Diffstat (limited to 'src/libui_sdl/libui/windows/window.cpp')
-rw-r--r-- | src/libui_sdl/libui/windows/window.cpp | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/src/libui_sdl/libui/windows/window.cpp b/src/libui_sdl/libui/windows/window.cpp index e2127cb..f52e2f6 100644 --- a/src/libui_sdl/libui/windows/window.cpp +++ b/src/libui_sdl/libui/windows/window.cpp @@ -13,6 +13,7 @@ struct uiWindow { int margined; BOOL hasMenubar; BOOL changingSize; + int maximized; int fullscreen; WINDOWPLACEMENT fsPrevPlacement; int borderless; @@ -248,9 +249,16 @@ static void uiWindowShow(uiControl *c) return; } w->shownOnce = TRUE; + + int cmd; + if (w->maximized) + cmd = SW_SHOWMAXIMIZED; + else + cmd = SW_SHOWDEFAULT; + // make sure the child is the correct size uiWindowsControlMinimumSizeChanged(uiWindowsControl(w)); - ShowWindow(w->hwnd, nCmdShow); + ShowWindow(w->hwnd, cmd);//nCmdShow); if (UpdateWindow(w->hwnd) == 0) logLastError(L"error calling UpdateWindow() after showing uiWindow for the first time"); } @@ -374,6 +382,36 @@ void uiWindowSetContentSize(uiWindow *w, int width, int height) w->changingSize = FALSE; } +int uiWindowMinimized(uiWindow *w) +{ + return IsIconic(w->hwnd); +} + +void uiWindowSetMinimized(uiWindow *w, int minimized) +{ + if (minimized) + ShowWindow(w->hwnd, SW_MINIMIZE); + else if (w->maximized) + ShowWindow(w->hwnd, SW_MAXIMIZE); + else + ShowWindow(w->hwnd, SW_RESTORE); +} + +int uiWindowMaximized(uiWindow *w) +{ + return IsZoomed(w->hwnd); +} + +void uiWindowSetMaximized(uiWindow *w, int maximized) +{ + w->maximized = maximized; + if (maximized) + ShowWindow(w->hwnd, SW_MAXIMIZE); + else + ShowWindow(w->hwnd, SW_RESTORE); +} + + int uiWindowFullscreen(uiWindow *w) { return w->fullscreen; @@ -517,12 +555,14 @@ static void setClientSize(uiWindow *w, int width, int height, BOOL hasMenubar, D logLastError(L"error resizing window"); } -uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar, int resizable) +uiWindow *uiNewWindow(const char *title, int width, int height, int maximized, int hasMenubar, int resizable) { uiWindow *w; WCHAR *wtitle; BOOL hasMenubarBOOL; + if (!resizable) maximized = 0; + uiWindowsNewControl(uiWindow, w); hasMenubarBOOL = FALSE; @@ -559,6 +599,8 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar, // and use the proper size setClientSize(w, width, height, hasMenubarBOOL, style, exstyle); + w->maximized = maximized; + uiWindowOnClosing(w, defaultOnClosing, NULL); uiWindowOnContentSizeChanged(w, defaultOnPositionContentSizeChanged, NULL); |