Implemented the new functions on Windows. Now to test.

This commit is contained in:
Pietro Gagliardi 2016-10-25 23:24:13 -04:00
parent 7fbbba37f6
commit 9d754bbf2a
2 changed files with 61 additions and 0 deletions

1
ui.h
View File

@ -316,6 +316,7 @@ _UI_EXTERN void uiAreaScrollTo(uiArea *a, double x, double y, double width, doub
// TODO should these be allowed on scrolling areas?
// TODO decide which mouse events should be accepted; Down is the only one guaranteed to work right now
// TODO what happens to events after calling this up to and including the next mouse up?
// TODO release capture?
_UI_EXTERN void uiAreaBeginUserWindowMove(uiArea *a);
_UI_EXTERN void uiAreaBeginUserWindowResize(uiArea *a, uiWindowResizeEdge edge);
_UI_EXTERN uiArea *uiNewArea(uiAreaHandler *ah);

View File

@ -98,6 +98,66 @@ void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height)
// TODO
}
void uiAreaBeginUserWindowMove(uiArea *a)
{
HWND toplevel;
// TODO restrict execution
// TODO release capture
toplevel = xxxx(a->hwnd);
if (toplevel == NULL) {
// TODO
return;
}
// see http://stackoverflow.com/questions/40249940/how-do-i-initiate-a-user-mouse-driven-move-or-resize-for-custom-window-borders-o#40250654
SendMessageW(toplevel, WM_SYSCOMMAND,
SC_MOVE | 2, 0);
}
void uiAreaBeginUserWindowResize(uiArea *a, uiWindowResizeEdge edge)
{
HWND toplevel;
WPARAM wParam;
// TODO restrict execution
// TODO release capture
toplevel = parentToplevel(a->hwnd);
if (toplevel == NULL) {
// TODO
return;
}
// see http://stackoverflow.com/questions/40249940/how-do-i-initiate-a-user-mouse-driven-move-or-resize-for-custom-window-borders-o#40250654
wParam = SC_SIZE;
switch (edge) {
case uiWindowResizeEdgeLeft,
wParam |= 1;
break
case uiWindowResizeEdgeTop,
wParam |= 3;
break
case uiWindowResizeEdgeRight,
wParam |= 2;
break
case uiWindowResizeEdgeBottom,
wParam |= 6;
break
case uiWindowResizeEdgeTopLeft,
wParam |= 4;
break
case uiWindowResizeEdgeTopRight,
wParam |= 5;
break
case uiWindowResizeEdgeBottomLeft,
wParam |= 7;
break
case uiWindowResizeEdgeBottomRight:
wParam |= 8;
break
}
SendMessageW(toplevel, WM_SYSCOMMAND,
wParam, 0);
}
uiArea *uiNewArea(uiAreaHandler *ah)
{
uiArea *a;