Mercurial > dwindows
diff win/dw.c @ 1449:632346743f46
Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change.
Remove notebook page subclass and do the redrawing in _resize_box() itself.
Fixed expandable boxes with no contents not consuming any space on OS/2, Windows and Mac.
Added invalidated window redraw on entering dw_main() on OS/2, Windows and Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 14 Dec 2011 00:23:30 +0000 |
parents | 508dde3dc398 |
children | 145edf67013e |
line wrap: on
line diff
--- a/win/dw.c Sat Dec 10 23:27:21 2011 +0000 +++ b/win/dw.c Wed Dec 14 00:23:30 2011 +0000 @@ -1122,7 +1122,6 @@ _focus_check_box_back(thisbox, handle, 2, 0); } } - /* This function calculates how much space the widgets and boxes require * and does expansion as necessary. */ @@ -1200,6 +1199,12 @@ thisbox->items[z].width = tmp->minwidth; thisbox->items[z].height = tmp->minheight; + /* If the box has no contents but is expandable... default the size to 1 */ + if(!thisbox->items[z].width && thisbox->items[z].hsize) + thisbox->items[z].width = 1; + if(!thisbox->items[z].height && thisbox->items[z].vsize) + thisbox->items[z].height = 1; + (*depth)--; } } @@ -1407,7 +1412,7 @@ MoveWindow(handle, currentx + pad, currenty + pad, width, height, FALSE); - if(percent) + if(percent && width > 0 && height > 0) _handle_splitbar_resize(handle, *percent, type, width, height); } else if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) @@ -1477,6 +1482,7 @@ TabCtrl_AdjustRect(handle,FALSE,&rect); MoveWindow(array[pageid]->hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom-rect.top, FALSE); + dw_window_redraw(array[pageid]->hwnd); } } /* So does the List View... handle delayed cursoring */ @@ -2965,23 +2971,20 @@ void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) { - HWND handle1, handle2; - Box *tmp; + HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); + HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); + Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); + + ShowWindow(handle1, SW_HIDE); + ShowWindow(handle2, SW_HIDE); if(type == DW_HORZ) { int newx = x; float ratio = (float)percent/(float)100.0; - handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); - handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); - tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); - newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); - ShowWindow(handle1, SW_HIDE); - ShowWindow(handle2, SW_HIDE); - MoveWindow(handle1, 0, 0, newx, y, FALSE); _do_resize(tmp, newx - 1, y - 1); @@ -2999,15 +3002,8 @@ int newy = y; float ratio = (float)(100.0-percent)/(float)100.0; - handle1 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); - handle2 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); - tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); - newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); - ShowWindow(handle1, SW_HIDE); - ShowWindow(handle2, SW_HIDE); - MoveWindow(handle1, 0, y - newy, x, newy, FALSE); _do_resize(tmp, x - 1, newy - 1); @@ -3706,6 +3702,8 @@ MSG msg; _dwtid = dw_thread_id(); + /* Make sure any queued redraws are handled */ + _dw_redraw(0, FALSE); while(GetMessage(&msg, NULL, 0, 0)) { @@ -6387,7 +6385,7 @@ } GetClassName(box, tmpbuf, 99); - + /* If we are in a scrolled box... extract the interal box */ if(strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) { @@ -6867,7 +6865,6 @@ HWND tmpbox = dw_box_new(DW_VERT, 0); dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); - SubclassWindow(tmpbox, _wndproc); if(array[pageid]->hwnd) dw_window_destroy(array[pageid]->hwnd); array[pageid]->hwnd = tmpbox; @@ -10211,7 +10208,8 @@ dw_window_get_pos_size(handle, NULL, NULL, &width, &height); - _handle_splitbar_resize(handle, percent, type, width, height); + if(width > 0 && height > 0) + _handle_splitbar_resize(handle, percent, type, width, height); } /*