Mercurial > dwindows
comparison os2/dw.c @ 1020:c63abcab5312
Fix for dw_window_redraw not resetting box position on OS/2.
Also fix for scrollboxes layout not inverting the Y axis on OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 18 May 2011 06:58:39 +0000 |
parents | 452388c9c3d8 |
children | 814e4767277f |
comparison
equal
deleted
inserted
replaced
1019:452388c9c3d8 | 1020:c63abcab5312 |
---|---|
1355 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) | 1355 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) |
1356 { | 1356 { |
1357 /* Handle special case of scrollbox */ | 1357 /* Handle special case of scrollbox */ |
1358 int cx = width + vectorx; | 1358 int cx = width + vectorx; |
1359 int cy = height + vectory; | 1359 int cy = height + vectory; |
1360 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0; | 1360 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0; |
1361 HWND box = (HWND)dw_window_get_data(handle, "_dw_resizebox"); | 1361 HWND box = (HWND)dw_window_get_data(handle, "_dw_resizebox"); |
1362 HWND client = WinWindowFromID(handle, FID_CLIENT); | 1362 HWND client = WinWindowFromID(handle, FID_CLIENT); |
1363 HWND vscroll = WinWindowFromID(handle, FID_VERTSCROLL); | 1363 HWND vscroll = WinWindowFromID(handle, FID_VERTSCROLL); |
1364 HWND hscroll = WinWindowFromID(handle, FID_HORZSCROLL); | 1364 HWND hscroll = WinWindowFromID(handle, FID_HORZSCROLL); |
1365 Box *thisbox = (Box *)WinQueryWindowPtr(box, QWP_USER); | 1365 Box *contentbox = (Box *)WinQueryWindowPtr(box, QWP_USER); |
1366 int origx, origy; | 1366 int origx, origy; |
1367 unsigned int hpos = (unsigned int)WinSendMsg(hscroll, SBM_QUERYPOS, 0, 0); | 1367 unsigned int hpos = (unsigned int)WinSendMsg(hscroll, SBM_QUERYPOS, 0, 0); |
1368 unsigned int vpos = (unsigned int)WinSendMsg(vscroll, SBM_QUERYPOS, 0, 0); | 1368 unsigned int vpos = (unsigned int)WinSendMsg(vscroll, SBM_QUERYPOS, 0, 0); |
1369 | 1369 |
1370 /* Position the scrollbox parts */ | 1370 /* Position the scrollbox parts */ |
1371 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1371 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1372 WinSetWindowPos(client, HWND_TOP, 0, _DW_DEFAULT_SCROLLBAR_WIDTH, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, cy - _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1372 WinSetWindowPos(client, HWND_TOP, 0, _DW_DEFAULT_SCROLLBAR_WIDTH, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, cy - _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1373 WinSetWindowPos(hscroll, HWND_TOP, 0, 0, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1373 WinSetWindowPos(hscroll, HWND_TOP, 0, 0, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1374 WinSetWindowPos(vscroll, HWND_TOP, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, cy - _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1374 WinSetWindowPos(vscroll, HWND_TOP, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, cy - _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1375 | 1375 |
1376 origx = cx = cx - _DW_DEFAULT_SCROLLBAR_WIDTH; | 1376 origx = cx = cx - _DW_DEFAULT_SCROLLBAR_WIDTH; |
1377 origy = cy = cy - _DW_DEFAULT_SCROLLBAR_WIDTH; | 1377 origy = cy = cy - _DW_DEFAULT_SCROLLBAR_WIDTH; |
1378 | 1378 |
1379 /* Get the required space for the box */ | 1379 /* Get the required space for the box */ |
1380 _resize_box(thisbox, &depth, cx, cy, &usedx, &usedy, 1, &usedpadx, &usedpady); | 1380 _resize_box(contentbox, &depth, cx, cy, &usedx, &usedy, 1, &usedpadx, &usedpady); |
1381 | 1381 |
1382 if(cx < usedx) | 1382 if(cx < usedx) |
1383 { | 1383 { |
1384 cx = usedx; | 1384 cx = usedx; |
1385 } | 1385 } |
1387 { | 1387 { |
1388 cy = usedy; | 1388 cy = usedy; |
1389 } | 1389 } |
1390 | 1390 |
1391 /* Setup vertical scroller */ | 1391 /* Setup vertical scroller */ |
1392 WinSendMsg(vscroll, SBM_SETSCROLLBAR, (MPARAM)vpos, MPFROM2SHORT(0, (unsigned short)usedy - origy)); | 1392 WinSendMsg(vscroll, SBM_SETSCROLLBAR, (MPARAM)vpos, MPFROM2SHORT(0, (unsigned short)usedy - origy)); |
1393 WinSendMsg(vscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)origy, usedy), 0); | 1393 WinSendMsg(vscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)origy, usedy), 0); |
1394 if(vpos > usedy) | 1394 if(vpos > usedy) |
1395 { | 1395 { |
1396 vpos = usedy; | 1396 vpos = usedy; |
1397 WinSendMsg(vscroll, SBM_SETPOS, (MPARAM)vpos, 0); | 1397 WinSendMsg(vscroll, SBM_SETPOS, (MPARAM)vpos, 0); |
1398 } | 1398 } |
1399 | 1399 |
1400 /* Setup horizontal scroller */ | 1400 /* Setup horizontal scroller */ |
1401 WinSendMsg(hscroll, SBM_SETSCROLLBAR, (MPARAM)hpos, MPFROM2SHORT(0, (unsigned short)usedx - origx)); | 1401 WinSendMsg(hscroll, SBM_SETSCROLLBAR, (MPARAM)hpos, MPFROM2SHORT(0, (unsigned short)usedx - origx)); |
1402 WinSendMsg(hscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)origx, usedx), 0); | 1402 WinSendMsg(hscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)origx, usedx), 0); |
1403 if(hpos > usedx) | 1403 if(hpos > usedx) |
1404 { | 1404 { |
1405 hpos = usedx; | 1405 hpos = usedx; |
1406 WinSendMsg(hscroll, SBM_SETPOS, (MPARAM)hpos, 0); | 1406 WinSendMsg(hscroll, SBM_SETPOS, (MPARAM)hpos, 0); |
1407 } | 1407 } |
1408 | 1408 |
1409 /* Position the scrolled box */ | 1409 /* Position the scrolled box */ |
1410 WinSetWindowPos(box, HWND_TOP, 0, -(cy - origy), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | 1410 WinSetWindowPos(box, HWND_TOP, 0, -(cy - origy), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1411 | 1411 |
1412 dw_window_set_data(handle, "_dw_cy", (void *)(cy - origy)); | 1412 dw_window_set_data(handle, "_dw_cy", (void *)(cy - origy)); |
1413 | 1413 |
1414 /* Layout the content of the scrollbox */ | 1414 /* Layout the content of the scrollbox */ |
1415 _do_resize(thisbox, cx, cy); | 1415 _do_resize(contentbox, cx, cy); |
1416 } | 1416 } |
1417 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) | 1417 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
1418 { | 1418 { |
1419 /* Then try the bottom or right box */ | 1419 /* Then try the bottom or right box */ |
1420 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); | 1420 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
2864 /* Hide the window when recalculating to reduce | 2864 /* Hide the window when recalculating to reduce |
2865 * CPU load. | 2865 * CPU load. |
2866 */ | 2866 */ |
2867 WinShowWindow(hWnd, FALSE); | 2867 WinShowWindow(hWnd, FALSE); |
2868 | 2868 |
2869 if(mybox->items) | 2869 if(mybox->items) |
2870 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE); | 2870 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE); |
2871 | 2871 |
2872 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); | 2872 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); |
2873 | 2873 |
2874 WinShowWindow(hWnd, TRUE); | 2874 WinShowWindow(hWnd, TRUE); |
2875 } | 2875 } |
4050 { | 4050 { |
4051 unsigned long width, height; | 4051 unsigned long width, height; |
4052 | 4052 |
4053 dw_window_get_pos_size(window, NULL, NULL, &width, &height); | 4053 dw_window_get_pos_size(window, NULL, NULL, &width, &height); |
4054 | 4054 |
4055 WinShowWindow(client ? mybox->items[0].hwnd : handle, FALSE); | 4055 if(mybox->items) |
4056 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, width, height, SWP_MOVE | SWP_SIZE); | |
4057 | |
4058 WinShowWindow(client && mybox->items ? mybox->items[0].hwnd : handle, FALSE); | |
4056 _do_resize(mybox, width, height); | 4059 _do_resize(mybox, width, height); |
4057 WinShowWindow(client ? mybox->items[0].hwnd : handle, TRUE); | 4060 WinShowWindow(client && mybox->items ? mybox->items[0].hwnd : handle, TRUE); |
4058 } | 4061 } |
4059 } | 4062 } |
4060 | 4063 |
4061 /* | 4064 /* |
4062 * Changes a window's parent to newparent. | 4065 * Changes a window's parent to newparent. |