From f9e143fc690bb3a179f3fb23801fd823b04e7592 Mon Sep 17 00:00:00 2001 From: StapleButter Date: Sun, 30 Dec 2018 01:07:25 +0100 Subject: 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 --- src/libui_sdl/libui/unix/window.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src/libui_sdl/libui/unix/window.c') 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; } -- cgit v1.2.3