aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-10-02 23:26:25 +0200
committerStapleButter <thetotalworm@gmail.com>2017-10-02 23:26:25 +0200
commitdad0e6b6e85f0845b7437e33974f061283f28ecc (patch)
treef646b8528b3de0ca90c230c862f40e832f4a45dc /src/libui_sdl
parentf8b63759f722be1f2ae0156bea6957a739c1bb6f (diff)
add support for non-resizable windows
Diffstat (limited to 'src/libui_sdl')
-rw-r--r--src/libui_sdl/DlgEmuSettings.cpp2
-rw-r--r--src/libui_sdl/DlgInputConfig.cpp2
-rw-r--r--src/libui_sdl/libui/ui.h2
-rw-r--r--src/libui_sdl/libui/windows/window.cpp9
-rw-r--r--src/libui_sdl/main.cpp2
5 files changed, 10 insertions, 7 deletions
diff --git a/src/libui_sdl/DlgEmuSettings.cpp b/src/libui_sdl/DlgEmuSettings.cpp
index 1097ec5..8cb2ccc 100644
--- a/src/libui_sdl/DlgEmuSettings.cpp
+++ b/src/libui_sdl/DlgEmuSettings.cpp
@@ -65,7 +65,7 @@ void OnOk(uiButton* btn, void* blarg)
void Open()
{
- win = uiNewWindow("Emu settings - melonDS", 300, 200, 0);
+ win = uiNewWindow("Emu settings - melonDS", 300, 200, 0, 0);
uiWindowSetMargined(win, 1);
uiWindowOnClosing(win, OnCloseWindow, NULL);
diff --git a/src/libui_sdl/DlgInputConfig.cpp b/src/libui_sdl/DlgInputConfig.cpp
index 2d26001..4348261 100644
--- a/src/libui_sdl/DlgInputConfig.cpp
+++ b/src/libui_sdl/DlgInputConfig.cpp
@@ -283,7 +283,7 @@ void Open()
memcpy(keymap, Config::KeyMapping, sizeof(int)*12);
memcpy(joymap, Config::JoyMapping, sizeof(int)*12);
- win = uiNewWindow("Input config - melonDS", 600, 400, 0);
+ win = uiNewWindow("Input config - melonDS", 600, 400, 0, 0);
uiWindowSetMargined(win, 1);
uiWindowOnClosing(win, OnCloseWindow, NULL);
uiWindowOnGetFocus(win, OnGetFocus, NULL);
diff --git a/src/libui_sdl/libui/ui.h b/src/libui_sdl/libui/ui.h
index 84a71c3..e78de5e 100644
--- a/src/libui_sdl/libui/ui.h
+++ b/src/libui_sdl/libui/ui.h
@@ -115,7 +115,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);
+_UI_EXTERN uiWindow *uiNewWindow(const char *title, int width, int height, 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/windows/window.cpp b/src/libui_sdl/libui/windows/window.cpp
index e126efc..44fb306 100644
--- a/src/libui_sdl/libui/windows/window.cpp
+++ b/src/libui_sdl/libui/windows/window.cpp
@@ -512,7 +512,7 @@ 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)
+uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar, int resizable)
{
uiWindow *w;
WCHAR *wtitle;
@@ -525,8 +525,11 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
hasMenubarBOOL = TRUE;
w->hasMenubar = hasMenubarBOOL;
-#define style WS_OVERLAPPEDWINDOW
-#define exstyle 0
+ int style = WS_OVERLAPPEDWINDOW;
+ int exstyle = 0;
+
+ if (!resizable)
+ style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
wtitle = toUTF16(title);
w->hwnd = CreateWindowExW(exstyle,
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index 3bd57f5..dceef64 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -646,7 +646,7 @@ int main(int argc, char** argv)
if (w < 256) w = 256;
if (h < 384) h = 384;
- MainWindow = uiNewWindow("melonDS " MELONDS_VERSION, w, h, 1);
+ MainWindow = uiNewWindow("melonDS " MELONDS_VERSION, w, h, 1, 1);
uiWindowOnClosing(MainWindow, OnCloseWindow, NULL);
uiWindowSetDropTarget(MainWindow, 1);