2015-05-20 13:08:34 -05:00
|
|
|
// 20 may 2015
|
2016-04-22 19:03:10 -05:00
|
|
|
#include "uipriv_windows.hpp"
|
2015-05-20 13:08:34 -05:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2015-08-30 11:25:53 -05:00
|
|
|
struct uiSeparator {
|
|
|
|
uiWindowsControl c;
|
2015-05-20 13:08:34 -05:00
|
|
|
HWND hwnd;
|
2016-06-17 10:02:17 -05:00
|
|
|
BOOL vertical;
|
2015-05-20 13:08:34 -05:00
|
|
|
};
|
|
|
|
|
2016-04-29 13:12:01 -05:00
|
|
|
uiWindowsControlAllDefaults(uiSeparator)
|
2015-05-29 18:48:27 -05:00
|
|
|
|
2015-06-02 17:48:41 -05:00
|
|
|
// via https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx
|
|
|
|
#define separatorHeight 1
|
|
|
|
|
2016-06-17 10:02:17 -05:00
|
|
|
// TODO
|
|
|
|
#define separatorWidth 1
|
|
|
|
|
2016-06-13 20:54:15 -05:00
|
|
|
static void uiSeparatorMinimumSize(uiWindowsControl *c, int *width, int *height)
|
2015-05-20 13:08:34 -05:00
|
|
|
{
|
2016-04-29 13:12:01 -05:00
|
|
|
uiSeparator *s = uiSeparator(c);
|
|
|
|
uiWindowsSizing sizing;
|
2016-06-17 10:02:17 -05:00
|
|
|
int x, y;
|
2016-04-29 13:12:01 -05:00
|
|
|
|
2015-05-20 13:08:34 -05:00
|
|
|
*width = 1; // TODO
|
2016-06-17 10:02:17 -05:00
|
|
|
*height = 1;
|
|
|
|
x = separatorWidth;
|
2016-04-29 13:12:01 -05:00
|
|
|
y = separatorHeight;
|
|
|
|
uiWindowsGetSizing(s->hwnd, &sizing);
|
2016-06-17 10:02:17 -05:00
|
|
|
uiWindowsSizingDlgUnitsToPixels(&sizing, &x, &y);
|
|
|
|
if (s->vertical)
|
|
|
|
*width = x;
|
|
|
|
else
|
|
|
|
*height = y;
|
2015-05-20 13:08:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
uiSeparator *uiNewHorizontalSeparator(void)
|
|
|
|
{
|
2015-08-30 11:25:53 -05:00
|
|
|
uiSeparator *s;
|
2015-05-29 17:03:24 -05:00
|
|
|
|
2016-04-29 13:12:01 -05:00
|
|
|
uiWindowsNewControl(uiSeparator, s);
|
2015-05-29 17:03:24 -05:00
|
|
|
|
2015-08-31 11:33:44 -05:00
|
|
|
s->hwnd = uiWindowsEnsureCreateControlHWND(0,
|
2015-05-29 17:03:24 -05:00
|
|
|
L"static", L"",
|
|
|
|
SS_ETCHEDHORZ,
|
|
|
|
hInstance, NULL,
|
|
|
|
TRUE);
|
2015-05-20 13:08:34 -05:00
|
|
|
|
2015-08-30 11:25:53 -05:00
|
|
|
return s;
|
2015-05-20 13:08:34 -05:00
|
|
|
}
|
2016-06-17 10:02:17 -05:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|