diff options
Diffstat (limited to 'src/libui_sdl/libui')
-rw-r--r-- | src/libui_sdl/libui/ui.h | 6 | ||||
-rw-r--r-- | src/libui_sdl/libui/unix/window.c | 35 |
2 files changed, 39 insertions, 2 deletions
diff --git a/src/libui_sdl/libui/ui.h b/src/libui_sdl/libui/ui.h index 1af8f59..b100c08 100644 --- a/src/libui_sdl/libui/ui.h +++ b/src/libui_sdl/libui/ui.h @@ -110,6 +110,10 @@ _UI_EXTERN char *uiWindowTitle(uiWindow *w); _UI_EXTERN void uiWindowSetTitle(uiWindow *w, const char *title); _UI_EXTERN void uiWindowContentSize(uiWindow *w, int *width, int *height); _UI_EXTERN void uiWindowSetContentSize(uiWindow *w, int width, int height); +_UI_EXTERN int uiWindowMinimized(uiWindow *w); +_UI_EXTERN void uiWindowSetMinimized(uiWindow *w, int minimized); +_UI_EXTERN int uiWindowMaximized(uiWindow *w); +_UI_EXTERN void uiWindowSetMaximized(uiWindow *w, int maximized); _UI_EXTERN int uiWindowFullscreen(uiWindow *w); _UI_EXTERN void uiWindowSetFullscreen(uiWindow *w, int fullscreen); _UI_EXTERN int uiWindowBorderless(uiWindow *w); @@ -118,7 +122,7 @@ _UI_EXTERN void uiWindowSetChild(uiWindow *w, uiControl *child); _UI_EXTERN int uiWindowMargined(uiWindow *w); _UI_EXTERN void uiWindowSetMargined(uiWindow *w, int margined); _UI_EXTERN void uiWindowSetDropTarget(uiWindow* w, int drop); -_UI_EXTERN uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar, int resizable); +_UI_EXTERN uiWindow *uiNewWindow(const char *title, int width, int height, int maximized, int hasMenubar, int resizable); _UI_EXTERN void uiWindowOnContentSizeChanged(uiWindow *w, void (*f)(uiWindow *, void *), void *data); _UI_EXTERN void uiWindowOnClosing(uiWindow *w, int (*f)(uiWindow *w, void *data), void *data); 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; } |