From 70e4841d311d68689724768157cc9cbfbde7a9fc Mon Sep 17 00:00:00 2001 From: StapleButter Date: Sat, 9 Sep 2017 02:30:51 +0200 Subject: another UI attempt, I guess. sorry. --- src/libui_sdl/libui/windows/separator.cpp | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/libui_sdl/libui/windows/separator.cpp (limited to 'src/libui_sdl/libui/windows/separator.cpp') diff --git a/src/libui_sdl/libui/windows/separator.cpp b/src/libui_sdl/libui/windows/separator.cpp new file mode 100644 index 0000000..e123e27 --- /dev/null +++ b/src/libui_sdl/libui/windows/separator.cpp @@ -0,0 +1,69 @@ +// 20 may 2015 +#include "uipriv_windows.hpp" + +// references: +// - http://stackoverflow.com/questions/2892703/how-do-i-draw-separators +// - https://msdn.microsoft.com/en-us/library/windows/desktop/dn742405%28v=vs.85%29.aspx + +struct uiSeparator { + uiWindowsControl c; + HWND hwnd; + BOOL vertical; +}; + +uiWindowsControlAllDefaults(uiSeparator) + +// via https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx +#define separatorHeight 1 + +// TODO +#define separatorWidth 1 + +static void uiSeparatorMinimumSize(uiWindowsControl *c, int *width, int *height) +{ + uiSeparator *s = uiSeparator(c); + uiWindowsSizing sizing; + int x, y; + + *width = 1; // TODO + *height = 1; + x = separatorWidth; + y = separatorHeight; + uiWindowsGetSizing(s->hwnd, &sizing); + uiWindowsSizingDlgUnitsToPixels(&sizing, &x, &y); + if (s->vertical) + *width = x; + else + *height = y; +} + +uiSeparator *uiNewHorizontalSeparator(void) +{ + uiSeparator *s; + + uiWindowsNewControl(uiSeparator, s); + + s->hwnd = uiWindowsEnsureCreateControlHWND(0, + L"static", L"", + SS_ETCHEDHORZ, + hInstance, NULL, + TRUE); + + return s; +} + +uiSeparator *uiNewVerticalSeparator(void) +{ + uiSeparator *s; + + uiWindowsNewControl(uiSeparator, s); + + s->hwnd = uiWindowsEnsureCreateControlHWND(0, + L"static", L"", + SS_ETCHEDHORZ, + hInstance, NULL, + TRUE); + s->vertical = TRUE; + + return s; +} -- cgit v1.2.3