diff options
author | StapleButter <thetotalworm@gmail.com> | 2018-12-30 01:07:25 +0100 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2018-12-30 01:07:25 +0100 |
commit | f9e143fc690bb3a179f3fb23801fd823b04e7592 (patch) | |
tree | 4270ca1198db65d03b4db99128b8c4b23b5f7125 /src/libui_sdl/libui/unix/window.c | |
parent | 62704aee31e809fdcefaac67bb35a30f20804fa3 (diff) |
libui/gtk: add functions to uiWindow for setting/getting minimized/maximized state
remember if main window is maximized, avoid updating the saved size when it is
Diffstat (limited to 'src/libui_sdl/libui/unix/window.c')
-rw-r--r-- | src/libui_sdl/libui/unix/window.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/libui_sdl/libui/unix/window.c b/src/libui_sdl/libui/unix/window.c index 04630bc..8eb50b4 100644 --- a/src/libui_sdl/libui/unix/window.c +++ b/src/libui_sdl/libui/unix/window.c @@ -209,6 +209,34 @@ void uiWindowSetContentSize(uiWindow *w, int width, int height) gtk_window_resize(w->window, winWidth, winHeight); } +int uiWindowMinimized(uiWindow *w) +{ + // TODO!! + return 0; +} + +void uiWindowSetMinimized(uiWindow *w, int minimized) +{ + if (minimized) + gtk_window_iconify(w->window); + else + gtk_window_deiconify(w->window); +} + +int uiWindowMaximized(uiWindow *w) +{ + return gtk_window_is_maximized(w->window); +} + +void uiWindowSetMaximized(uiWindow *w, int maximized) +{ + if (maximized) + gtk_window_maximize(w->window); + else + gtk_window_unmaximize(w->window); +} + + int uiWindowFullscreen(uiWindow *w) { return w->fullscreen; @@ -344,9 +372,11 @@ void uiWindowSetDropTarget(uiWindow* w, int drop) g_signal_connect(w->widget, "drag-data-received", G_CALLBACK(onDragDataReceived), w); } -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; + + if (!resizable) maximized = 0; uiUnixNewControl(uiWindow, w); @@ -404,6 +434,9 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar, w->width = width; w->height = height; + + if (maximized) + gtk_window_maximize(w->window); return w; } |