diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-09-09 02:30:51 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-09-09 02:30:51 +0200 |
commit | 70e4841d311d68689724768157cc9cbfbde7a9fc (patch) | |
tree | ba9499f77d1258530a7e60aa6e1732c41d98161c /src/libui_sdl/libui/windows/separator.cpp | |
parent | 81747d6c34eb159481a6ca3f283d065fa3568617 (diff) |
another UI attempt, I guess.
sorry.
Diffstat (limited to 'src/libui_sdl/libui/windows/separator.cpp')
-rw-r--r-- | src/libui_sdl/libui/windows/separator.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
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; +} |