More Windows uiArea migration and compiler error fixes. Now to figure out what happened with GetSize again...
This commit is contained in:
parent
e76b34b670
commit
6d06e15390
|
@ -19,7 +19,9 @@ static void handlerMouseEvent(uiAreaHandler *a, uiArea *area, uiAreaMouseEvent *
|
||||||
{
|
{
|
||||||
char pos[128];
|
char pos[128];
|
||||||
|
|
||||||
snprintf(pos, 127, "X %g Y %g", e->X, e->Y);
|
// wonderful, vanilla snprintf() isn't in visual studio 2013 - http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx
|
||||||
|
// we can't use _snprintf() in the test suite because that's msvc-only, so oops. sprintf() it is.
|
||||||
|
sprintf(pos, "X %g Y %g", e->X, e->Y);
|
||||||
uiCheckboxSetText(label, pos);
|
uiCheckboxSetText(label, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,12 @@ static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
a = (uiArea *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
a = (uiArea *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
||||||
if (a == NULL) {
|
if (a == NULL) {
|
||||||
if (uMsg == WM_CREATE)
|
if (uMsg == WM_CREATE) {
|
||||||
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) (cs->lpCreateParams));
|
a = (uiArea *) (cs->lpCreateParams);
|
||||||
|
// assign a->hwnd here so we can use it immediately
|
||||||
|
a->hwnd = hwnd;
|
||||||
|
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) a);
|
||||||
|
}
|
||||||
// fall through to DefWindowProcW() anyway
|
// fall through to DefWindowProcW() anyway
|
||||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +107,8 @@ uiArea *uiNewArea(uiAreaHandler *ah)
|
||||||
a->scrolling = FALSE;
|
a->scrolling = FALSE;
|
||||||
clickCounterReset(&(a->cc));
|
clickCounterReset(&(a->cc));
|
||||||
|
|
||||||
a->hwnd = uiWindowsEnsureCreateControlHWND(0,
|
// a->hwnd is assigned in areaWndProc()
|
||||||
|
uiWindowsEnsureCreateControlHWND(0,
|
||||||
areaClass, L"",
|
areaClass, L"",
|
||||||
0,
|
0,
|
||||||
hInstance, a,
|
hInstance, a,
|
||||||
|
@ -126,13 +131,14 @@ uiArea *uiNewScrollingArea(uiAreaHandler *ah, intmax_t width, intmax_t height)
|
||||||
a->scrollHeight = height;
|
a->scrollHeight = height;
|
||||||
clickCounterReset(&(a->cc));
|
clickCounterReset(&(a->cc));
|
||||||
|
|
||||||
a->hwnd = uiWindowsEnsureCreateControlHWND(0,
|
// a->hwnd is assigned in areaWndProc()
|
||||||
|
uiWindowsEnsureCreateControlHWND(0,
|
||||||
areaClass, L"",
|
areaClass, L"",
|
||||||
WS_HSCROLL | WS_VSCROLL,
|
WS_HSCROLL | WS_VSCROLL,
|
||||||
hInstance, a,
|
hInstance, a,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
areaUpdateScroll(a->hwnd);
|
areaUpdateScroll(a);
|
||||||
|
|
||||||
uiWindowsFinishNewControl(a, uiArea);
|
uiWindowsFinishNewControl(a, uiArea);
|
||||||
|
|
||||||
|
|
|
@ -12,18 +12,19 @@ static HRESULT doPaint(uiArea *a, ID2D1RenderTarget *rt, RECT *clip)
|
||||||
|
|
||||||
dp.Context = newContext(rt);
|
dp.Context = newContext(rt);
|
||||||
|
|
||||||
size = ID2D1RenderTarget_GetSize(rt);
|
dp.AreaWidth = 0;
|
||||||
dp.ClientWidth = size.width;
|
dp.AreaHeight = 0;
|
||||||
dp.ClientHeight = size.height;
|
if (!a->scrolling) {
|
||||||
|
size = ID2D1RenderTarget_GetSize(rt);
|
||||||
|
dp.AreaWidth = size.width;
|
||||||
|
dp.AreaHeight = size.height;
|
||||||
|
}
|
||||||
|
|
||||||
dp.ClipX = clip->left;
|
dp.ClipX = clip->left;
|
||||||
dp.ClipY = clip->top;
|
dp.ClipY = clip->top;
|
||||||
dp.ClipWidth = clip->right - clip->left;
|
dp.ClipWidth = clip->right - clip->left;
|
||||||
dp.ClipHeight = clip->bottom - clip->top;
|
dp.ClipHeight = clip->bottom - clip->top;
|
||||||
|
|
||||||
dp.HScrollPos = a->hscrollpos;
|
|
||||||
dp.VScrollPos = a->vscrollpos;
|
|
||||||
|
|
||||||
ID2D1RenderTarget_BeginDraw(rt);
|
ID2D1RenderTarget_BeginDraw(rt);
|
||||||
|
|
||||||
// TODO only clear the clip area
|
// TODO only clear the clip area
|
||||||
|
@ -94,7 +95,7 @@ BOOL areaDoDraw(uiArea *a, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lRe
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
onWM_PRINTCLIENT(xxxx);
|
onWM_PRINTCLIENT(a);
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,13 @@ static void areaMouseEvent(uiArea *a, uintmax_t down, uintmax_t up, WPARAM wPar
|
||||||
me.X = (xpix * 96) / dpix;
|
me.X = (xpix * 96) / dpix;
|
||||||
me.Y = (ypix * 96) / dpiy;
|
me.Y = (ypix * 96) / dpiy;
|
||||||
|
|
||||||
size = ID2D1HwndRenderTarget_GetSize(a->rt);
|
me.AreaWidth = 0;
|
||||||
me.ClientWidth = size.width;
|
me.AreaHeight = 0;
|
||||||
me.ClientHeight = size.height;
|
if (!a->scrolling) {
|
||||||
me.HScrollPos = a->hscrollpos;
|
size = ID2D1HwndRenderTarget_GetSize(a->rt);
|
||||||
me.VScrollPos = a->vscrollpos;
|
me.AreaWidth = size.width;
|
||||||
|
me.AreaHeight = size.height;
|
||||||
|
}
|
||||||
|
|
||||||
me.Down = down;
|
me.Down = down;
|
||||||
me.Up = up;
|
me.Up = up;
|
||||||
|
@ -233,7 +235,7 @@ enum {
|
||||||
msgAreaKeyUp,
|
msgAreaKeyUp,
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOL areaDoScroll(uiArea *a, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
BOOL areaDoEvents(uiArea *a, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
|
||||||
{
|
{
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
|
|
Loading…
Reference in New Issue