Changeset 6705 for trunk/src/comctl32/rebar.c
- Timestamp:
- Sep 15, 2001, 11:13:31 AM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/comctl32/rebar.c (modified) (131 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/rebar.c
r6644 r6705 1 /* $Id: rebar.c,v 1.16 2001-09-05 12:05:01 bird Exp $ */ 1 /* 2 * Testing: set to 1 to make background brush *always* green 3 */ 4 #define GLATESTING 0 5 2 6 /* 3 7 * … … 10 14 11 15 /* 12 * Rebar control rev 7f 16 * 3. REBAR_MoveChildWindows should have a loop because more than 17 * one pass is made (together with the RBN_CHILDSIZEs) is made on 18 * at least RB_INSERTBAND 19 */ 20 21 22 /* 23 * Rebar control rev 8a 13 24 * 14 25 * Copyright 1998, 1999 Eric Kohl … … 22 33 * - vertical placement 23 34 * - ComboBox and ComboBoxEx placement 24 * - center image 35 * - center image 25 36 * - Layout code. 26 37 * - Display code. … … 31 42 * rev 2,3,4 32 43 * - Implement initial version of row grouping, row separators, 33 * text and background colors. Support additional messages. 44 * text and background colors. Support additional messages. 34 45 * Support RBBS_BREAK. Implement ERASEBKGND and improve painting. 35 46 * rev 5 36 47 * - implement support for dragging Gripper left or right in a row. Supports 37 * WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support 48 * WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support 38 49 * RBS_BANDBORDERS. 39 50 * rev 6 … … 43 54 * 44 55 * rev 7 45 * 1. Redesign _Layout to better emulate native. 46 * a. Flag rebar when a band needs to be (and all bands) need to 47 * go through rest of _Layout 48 * 2. Fix RBN_ENDDRAG contents. 49 * 3. REBAR_ForceResize changed to handle shrink of client. 50 * rev 7b 51 * 4. Support RBBS_HIDDEN in _Layout (phase 2 & 3), _InternalEraseBkgnd, 52 * and _InternalHitTest 53 * 5. Support RBS_VARHEIGHT. 54 * 6. Rewrite _AdjustBands with new algorithm. 55 * rev 7c 56 * 7. Format mask and style with labels. 57 * 8. Move calls to _ForceResize and _MoveChildWindows into _Layout to 58 * centralize processing. 59 * 9. Pass "infoPtr" to all routines instead of "hwnd" to eliminate extra 60 * calls to GetWindowLongA. 61 * 10. Use _MoveChildWindows in _HandleLRDrag. 62 * 11. Another rewrite of _AdjustBands with new algorithm. 63 * 12. Correct drawing of rebar borders and handling of RBS_BORDERS. 64 * rev 7d 65 * 13. Support WM_NOTIFYFORMAT (both incoming and outgoing) and do 66 * WM_NOTIFY correctly based on results. 67 * 14. Implement WM_SETREDRAW. 68 * 15. Native WM_ERASEBKGND draws horz and vert separators between bands and 69 * rows, and fills in the background color for each band. The gripper, 70 * image, and text for each band is drawn by the WM_PAINT process. Change 71 * this code to match. 72 * rev 7e 73 * 16. RBBS_FIXEDSIZE should not affect _AdjustBands. (Found by Mike McCormack 74 * in WinZip - Thanks!) 75 * 17. Implement WM_NCCREATE to set necessary additional styles and move most 76 * of creation stuff to it like native control. 77 * 18. WM_SETFONT should redraw only if LOWORD is TRUE. 78 * 19. Implement WM_NCHITTEST to send notify to parent of NM_NCHITTEST. 79 * 20. Cleaned up dead and/or testing code. 80 * 21. Support RB_MOVEBAND. 81 * 22. Support WM_STYLECHANGED and remove all (or most) of the GetWindowLong 82 * for GWL_STYLE. 83 * 23. Support RB_MINIMIZEBAND. 84 * 24. RBBS_HIDDEN (and the CCS_VERT+RBBS_NOVERT case) should be supported 85 * by all routines now. 86 * rev 7f 87 * 25. Fix handling of text color. 88 * 26. Correct implementation of WM_SETREDRAW to be closer to native. 89 * See REBAR_SetRedraw for doc changes of actual vs. MSDN 90 * 27. Do more implementation of RBS_AUTOSIZE in the WM_SIZE processor. 91 * 28. Implement RBBS_VARIABLEHEIGHT. Used by IE4. 92 * 29. Do more testing in WM_SIZE to handle strange cases like native. 56 * - Fix algorithm for _Layout and _AdjustBand. 57 * - Fix or implement RBN_ENDDRAG, RB_MOVEBAND, WM_SETREDRAW, 58 * WM_STYLECHANGED, RB_MINIMIZEBAND, RBBS_VARIABLEHEIGHT, RBS_VARHEIGHT, 59 * RBBS_HIDDEN, WM_NOTIFYFORMAT, NM_NCHITTEST, WM_SETREDRAW, RBS_AUTOSIZE, 60 * WM_SETFONT, RBS_BORDERS 61 * - Create structures in WM_NCCREATE 62 * - Additional performance enhancements. 63 * 64 * rev 8 65 * 1. Create array of start and end band indexes by row and use. 66 * 2. Fix problem with REBAR_Layout Phase 2b to process only if only 67 * band in row. 68 * 3. Set the Caption Font (Regular) as default font for text. 69 * 4. Delete font handle on control distruction. 70 * 5. Add UpdateWindow call in _MoveChildWindows to match repainting done 71 * by native control 72 * 6. Improve some traces. 73 * 7. Invalidate window rectangles after SetBandInfo, InsertBand, ShowBand 74 * so that repainting is correct. 75 * 8. Implement RB_MAXIMIZEBAND for the "ideal=TRUE" case. 76 * 9. Implement item custom draw notifications partially. Only done for 77 * ITEMPREPAINT and ITEMPOSTPAINT. (Used by IE4 for "Favorites" frame 78 * to draw the word "Favorites"). 79 * rev 8a 80 * 10. Handle CCS_NODIVIDER and fix WS_BORDER code. 81 * 11. Fix logic error in _AdjustBands where flag was set to valid band 82 * number (0) to indicate *no* band. 83 * 12. Fix CCS_VERT errors in _ForceResize, _NCCalcSize, and _NCPaint. 84 * 13. Support some special cases of CCS_TOP (and therefore CCS_LEFT), 85 * CCS_BOTTOM (and therefore CCS_RIGHT) and CCS_NOPARENTALIGN. Not 86 * at all sure whether this is all cases. 87 * 14. Handle returned value for the RBN_CHILDSIZE notify. 88 * 15. Implement RBBS_CHILDEDGE, and set each bands "offChild" at _Layout 89 * time. 90 * 16. Fix REBARSPACE. It should depend on CCS_NODIVIDER. 93 91 * 94 92 * 95 93 * Still to do: 96 * 2. Following still not handled: RBBS_FIXEDBMP, RBBS_CHILDEDGE, 97 * RBBS_USECHEVRON 98 * 3. Following are only partially handled: 94 * 2. Following still not handled: RBBS_FIXEDBMP, 95 * RBBS_USECHEVRON, CCS_NORESIZE, 96 * CCS_NOMOVEX, CCS_NOMOVEY 97 * 3. Following are only partially handled: 99 98 * RBS_AUTOSIZE, RBBS_VARIABLEHEIGHT 100 99 * 5. Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT) 101 * to set the size of the separator width (the value SEP_WIDTH_SIZE 100 * to set the size of the separator width (the value SEP_WIDTH_SIZE 102 101 * in here). Should be fixed!! 103 102 * 6. The following messages are not implemented: … … 117 116 #include <string.h> 118 117 119 #include "win.h"120 118 #include "winbase.h" 121 119 #include "wingdi.h" … … 134 132 typedef struct 135 133 { 136 #ifdef __WIN32OS2__137 COMCTL32_HEADER header;138 #endif139 134 UINT fStyle; 140 135 UINT fMask; … … 167 162 UINT fStatus; /* status flags, reset only by _Validate */ 168 163 UINT fDraw; /* drawing flags, reset only by _Layout */ 164 UINT uCDret; /* last return from NM_CUSTOMDRAW */ 169 165 RECT rcoldBand; /* previous calculated band rectangle */ 170 166 RECT rcBand; /* calculated band rectangle */ … … 191 187 #define NTF_INVALIDATE 0x01000000 192 188 193 194 189 typedef struct 195 190 { 191 INT istartband; /* index of first band in row */ 192 INT iendband; /* index of last band in row */ 193 } REBAR_ROW; 194 195 196 typedef struct 197 { 198 #ifdef __WIN32OS2__ 199 COMCTL32_HEADER header; 200 #endif 196 201 COLORREF clrBk; /* background color */ 197 202 COLORREF clrText; /* text color */ … … 199 204 COLORREF clrBtnFace; /* system color for BTNFACE */ 200 205 HIMAGELIST himl; /* handle to imagelist */ 201 UINT uNumBands; /* # of bands in rebar (first=0, last=uNum Rows-1 */206 UINT uNumBands; /* # of bands in rebar (first=0, last=uNumBands-1 */ 202 207 UINT uNumRows; /* # of rows of bands (first=1, last=uNumRows */ 203 208 HWND hwndSelf; /* handle of REBAR window itself */ … … 212 217 BOOL NtfUnicode; /* TRUE if parent wants notify in W format */ 213 218 BOOL DoRedraw; /* TRUE to acutally draw bands */ 214 UINT fStatus; /* Status flags (see below) */ 219 UINT fStatus; /* Status flags (see below) */ 215 220 HCURSOR hcurArrow; /* handle to the arrow cursor */ 216 221 HCURSOR hcurHorz; /* handle to the EW cursor */ … … 223 228 INT ihitoffset; /* offset of hotspot from gripper.left */ 224 229 230 REBAR_ROW *rows; /* pointer to row indexes */ 225 231 REBAR_BAND *bands; /* pointer to the array of rebar bands */ 226 232 } REBAR_INFO; … … 263 269 #define GRIPPER_WIDTH 3 264 270 265 /* This is the increment that is used over the band height */ 266 /* Determined by experiment. */ 267 #define REBARSPACE 4 271 /* Height of divider for Rebar if not disabled (CCS_NODIVIDER) */ 272 /* either top or bottom */ 273 #define REBAR_DIVIDER 2 274 275 /* This is the increment that is used over the band height */ 276 #define REBARSPACE(a) ((a->fStyle & RBBS_CHILDEDGE) ? 2*REBAR_DIVIDER : 0) 268 277 269 278 /* ---- End of REBAR layout constants. ---- */ … … 275 284 #define rcBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.bottom : b->rcBand.right) 276 285 #define rcBw(b) ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.bottom - b->rcBand.top) : \ 277 (b->rcBand.right - b->rcBand.left))286 (b->rcBand.right - b->rcBand.left)) 278 287 #define ircBlt(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.left : b->rcBand.top) 279 288 #define ircBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.right : b->rcBand.bottom) 280 289 #define ircBw(b) ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.right - b->rcBand.left) : \ 281 (b->rcBand.bottom - b->rcBand.top))290 (b->rcBand.bottom - b->rcBand.top)) 282 291 283 292 /* The following define determines if a given band is hidden */ … … 339 348 *line = 0; 340 349 while (band_stylename[i]) { 341 if (style & (1<<i)) {342 if (*line != 0) strcat(line, " | ");343 strcat(line, band_stylename[i]);344 }345 i++;350 if (style & (1<<i)) { 351 if (*line != 0) strcat(line, " | "); 352 strcat(line, band_stylename[i]); 353 } 354 i++; 346 355 } 347 356 return line; … … 356 365 *line = 0; 357 366 while (band_maskname[i]) { 358 if (mask & (1<<i)) {359 if (*line != 0) strcat(line, " | ");360 strcat(line, band_maskname[i]);361 }362 i++;367 if (mask & (1<<i)) { 368 if (*line != 0) strcat(line, " | "); 369 strcat(line, band_maskname[i]); 370 } 371 i++; 363 372 } 364 373 return line; … … 371 380 if( !TRACE_ON(rebar) ) return; 372 381 TRACE("band info: ID=%u, size=%u, child=%04x, clrF=0x%06lx, clrB=0x%06lx\n", 373 pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack); 382 pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack); 374 383 TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask)); 375 384 if (pB->fMask & RBBIM_STYLE) 376 TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));385 TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle)); 377 386 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_HEADERSIZE | RBBIM_LPARAM )) { 378 TRACE("band info:");379 if (pB->fMask & RBBIM_SIZE)380 DPRINTF(" cx=%u", pB->cx);381 if (pB->fMask & RBBIM_IDEALSIZE)382 DPRINTF(" xIdeal=%u", pB->cxIdeal);383 if (pB->fMask & RBBIM_HEADERSIZE)384 DPRINTF(" xHeader=%u", pB->cxHeader);385 if (pB->fMask & RBBIM_LPARAM)386 DPRINTF(" lParam=0x%08lx", pB->lParam);387 DPRINTF("\n");387 TRACE("band info:"); 388 if (pB->fMask & RBBIM_SIZE) 389 DPRINTF(" cx=%u", pB->cx); 390 if (pB->fMask & RBBIM_IDEALSIZE) 391 DPRINTF(" xIdeal=%u", pB->cxIdeal); 392 if (pB->fMask & RBBIM_HEADERSIZE) 393 DPRINTF(" xHeader=%u", pB->cxHeader); 394 if (pB->fMask & RBBIM_LPARAM) 395 DPRINTF(" lParam=0x%08lx", pB->lParam); 396 DPRINTF("\n"); 388 397 } 389 398 if (pB->fMask & RBBIM_CHILDSIZE) 390 TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",391 pB->cxMinChild, 392 pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);399 TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 400 pB->cxMinChild, 401 pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 393 402 } 394 403 … … 401 410 if(! TRACE_ON(rebar) ) return; 402 411 403 TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", 404 iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,405 iP->calcSize.cx, iP->calcSize.cy);412 TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", 413 iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows, 414 iP->calcSize.cx, iP->calcSize.cy); 406 415 TRACE("hwnd=%04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n", 407 iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,408 iP->dragNow.x, iP->dragNow.y,409 iP->ihitBand);416 iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y, 417 iP->dragNow.x, iP->dragNow.y, 418 iP->ihitBand); 410 419 TRACE("hwnd=%04x: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n", 411 iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",412 (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE");420 iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE", 421 (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE"); 413 422 for (i = 0; i < iP->uNumBands; i++) { 414 pB = &iP->bands[i]; 415 TRACE("band # %u: ID=%u, child=%04x, row=%u, clrF=0x%06lx, clrB=0x%06lx\n", 416 i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack); 417 TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask)); 418 if (pB->fMask & RBBIM_STYLE) 419 TRACE("band # %u: style=0x%08x (%s)\n", 420 i, pB->fStyle, REBAR_FmtStyle(pB->fStyle)); 421 TRACE("band # %u: uMinH=%u xHeader=%u", 422 i, pB->uMinHeight, pB->cxHeader); 423 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) { 424 if (pB->fMask & RBBIM_SIZE) 425 DPRINTF(" cx=%u", pB->cx); 426 if (pB->fMask & RBBIM_IDEALSIZE) 427 DPRINTF(" xIdeal=%u", pB->cxIdeal); 428 if (pB->fMask & RBBIM_LPARAM) 429 DPRINTF(" lParam=0x%08lx", pB->lParam); 430 } 431 DPRINTF("\n"); 432 if (RBBIM_CHILDSIZE) 433 TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 434 i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 435 TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n", 436 i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy); 437 TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n", 438 i, pB->fStatus, pB->fDraw, 439 pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom, 440 pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom); 441 TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n", 442 i, 443 pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom, 444 pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom, 445 pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom); 423 pB = &iP->bands[i]; 424 TRACE("band # %u: ID=%u, child=%04x, row=%u, clrF=0x%06lx, clrB=0x%06lx\n", 425 i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack); 426 TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask)); 427 if (pB->fMask & RBBIM_STYLE) 428 TRACE("band # %u: style=0x%08x (%s)\n", 429 i, pB->fStyle, REBAR_FmtStyle(pB->fStyle)); 430 TRACE("band # %u: uMinH=%u xHeader=%u", 431 i, pB->uMinHeight, pB->cxHeader); 432 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) { 433 if (pB->fMask & RBBIM_SIZE) 434 DPRINTF(" cx=%u", pB->cx); 435 if (pB->fMask & RBBIM_IDEALSIZE) 436 DPRINTF(" xIdeal=%u", pB->cxIdeal); 437 if (pB->fMask & RBBIM_LPARAM) 438 DPRINTF(" lParam=0x%08lx", pB->lParam); 439 } 440 DPRINTF("\n"); 441 if (RBBIM_CHILDSIZE) 442 TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 443 i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 444 if (pB->fMask & RBBIM_TEXT) 445 TRACE("band # %u: text=%s\n", 446 i, (pB->lpText) ? debugstr_w(pB->lpText) : "(null)"); 447 TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n", 448 i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy); 449 TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n", 450 i, pB->fStatus, pB->fDraw, 451 pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom, 452 pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom); 453 TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n", 454 i, 455 pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom, 456 pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom, 457 pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom); 446 458 } 447 459 … … 457 469 if (!parent) { 458 470 parent = GetParent (infoPtr->hwndSelf); 459 owner = GetWindow (infoPtr->hwndSelf, GW_OWNER);460 if (owner) parent = owner;471 owner = GetWindow (infoPtr->hwndSelf, GW_OWNER); 472 if (owner) parent = owner; 461 473 } 462 474 return parent; … … 475 487 476 488 TRACE("window %04x, code=%08x, %s\n", parent, code, 477 (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI");489 (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI"); 478 490 479 491 if (infoPtr->NtfUnicode) 480 return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,481 (LPARAM)nmhdr);492 return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom, 493 (LPARAM)nmhdr); 482 494 else 483 return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,484 (LPARAM)nmhdr);495 return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom, 496 (LPARAM)nmhdr); 485 497 } 486 498 … … 493 505 notify_rebar.dwMask = 0; 494 506 if (uBand!=-1) { 495 lpBand = &infoPtr->bands[uBand];496 if (lpBand->fMask & RBBIM_ID) {497 notify_rebar.dwMask |= RBNM_ID;498 notify_rebar.wID = lpBand->wID;499 }500 if (lpBand->fMask & RBBIM_LPARAM) {501 notify_rebar.dwMask |= RBNM_LPARAM;502 notify_rebar.lParam = lpBand->lParam;503 }504 if (lpBand->fMask & RBBIM_STYLE) {505 notify_rebar.dwMask |= RBNM_STYLE;506 notify_rebar.fStyle = lpBand->fStyle;507 }507 lpBand = &infoPtr->bands[uBand]; 508 if (lpBand->fMask & RBBIM_ID) { 509 notify_rebar.dwMask |= RBNM_ID; 510 notify_rebar.wID = lpBand->wID; 511 } 512 if (lpBand->fMask & RBBIM_LPARAM) { 513 notify_rebar.dwMask |= RBNM_LPARAM; 514 notify_rebar.lParam = lpBand->lParam; 515 } 516 if (lpBand->fMask & RBBIM_STYLE) { 517 notify_rebar.dwMask |= RBNM_STYLE; 518 notify_rebar.fStyle = lpBand->fStyle; 519 } 508 520 } 509 521 notify_rebar.uBand = uBand; … … 514 526 REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand) 515 527 { 516 528 HFONT hOldFont = 0; 529 INT oldBkMode = 0; 530 NMCUSTOMDRAW nmcd; 531 532 if (lpBand->fDraw & DRAW_TEXT) { 533 hOldFont = SelectObject (hdc, infoPtr->hFont); 534 oldBkMode = SetBkMode (hdc, TRANSPARENT); 535 } 536 537 /* should test for CDRF_NOTIFYITEMDRAW here */ 538 nmcd.dwDrawStage = CDDS_ITEMPREPAINT; 539 nmcd.hdc = hdc; 540 nmcd.rc = lpBand->rcBand; 541 nmcd.rc.right = lpBand->rcCapText.right; 542 nmcd.rc.bottom = lpBand->rcCapText.bottom; 543 nmcd.dwItemSpec = lpBand->wID; 544 nmcd.uItemState = 0; 545 nmcd.lItemlParam = lpBand->lParam; 546 lpBand->uCDret = REBAR_Notify ((NMHDR *)&nmcd, infoPtr, NM_CUSTOMDRAW); 547 if (lpBand->uCDret == CDRF_SKIPDEFAULT) { 548 if (oldBkMode != TRANSPARENT) 549 SetBkMode (hdc, oldBkMode); 550 SelectObject (hdc, hOldFont); 551 return; 552 } 517 553 518 554 /* draw gripper */ … … 522 558 /* draw caption image */ 523 559 if (lpBand->fDraw & DRAW_IMAGE) { 524 POINT pt;525 526 /* center image */527 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;528 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;529 530 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,531 pt.x, pt.y,532 ILD_TRANSPARENT);560 POINT pt; 561 562 /* center image */ 563 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2; 564 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2; 565 566 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc, 567 pt.x, pt.y, 568 ILD_TRANSPARENT); 533 569 } 534 570 535 571 /* draw caption text */ 536 572 if (lpBand->fDraw & DRAW_TEXT) { 537 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); 538 INT oldBkMode = SetBkMode (hdc, TRANSPARENT); 539 COLORREF oldcolor = CLR_NONE; 540 oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ? 541 lpBand->clrFore : infoPtr->clrBtnText); 542 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, 543 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 544 if (oldBkMode != TRANSPARENT) 545 SetBkMode (hdc, oldBkMode); 546 SetTextColor (hdc, oldcolor); 547 SelectObject (hdc, hOldFont); 573 /* need to handle CDRF_NEWFONT here */ 574 INT oldBkMode = SetBkMode (hdc, TRANSPARENT); 575 COLORREF oldcolor = CLR_NONE; 576 oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ? 577 lpBand->clrFore : infoPtr->clrBtnText); 578 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, 579 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 580 if (oldBkMode != TRANSPARENT) 581 SetBkMode (hdc, oldBkMode); 582 SetTextColor (hdc, oldcolor); 583 SelectObject (hdc, hOldFont); 584 } 585 586 if (lpBand->uCDret == (CDRF_NOTIFYPOSTPAINT | CDRF_NOTIFYITEMDRAW)) { 587 nmcd.dwDrawStage = CDDS_ITEMPOSTPAINT; 588 nmcd.hdc = hdc; 589 nmcd.rc = lpBand->rcBand; 590 nmcd.rc.right = lpBand->rcCapText.right; 591 nmcd.rc.bottom = lpBand->rcCapText.bottom; 592 nmcd.dwItemSpec = lpBand->wID; 593 nmcd.uItemState = 0; 594 nmcd.lItemlParam = lpBand->lParam; 595 lpBand->uCDret = REBAR_Notify ((NMHDR *)&nmcd, infoPtr, NM_CUSTOMDRAW); 548 596 } 549 597 } … … 560 608 oldrow = infoPtr->bands[0].iRow; 561 609 for (i = 0; i < infoPtr->uNumBands; i++) { 562 lpBand = &infoPtr->bands[i]; 563 564 if (HIDDENBAND(lpBand)) continue; 565 566 /* now draw the band */ 567 REBAR_DrawBand (hdc, infoPtr, lpBand); 610 lpBand = &infoPtr->bands[i]; 611 612 if (HIDDENBAND(lpBand)) continue; 613 614 /* now draw the band */ 615 TRACE("[%04x] drawing band %i, flags=%08x\n", 616 infoPtr->hwndSelf, i, lpBand->fDraw); 617 REBAR_DrawBand (hdc, infoPtr, lpBand); 568 618 569 619 } … … 573 623 static void 574 624 REBAR_FixVert (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, 575 INT mcy)576 /* Function: */ 625 INT mcy) 626 /* Function: */ 577 627 /* Cycle through bands in row and fix height of each band. */ 578 628 /* Also determine whether each band has changed. */ … … 586 636 for (i = (INT)rowstart; i<=(INT)rowend; i++) { 587 637 lpBand = &infoPtr->bands[i]; 588 if (HIDDENBAND(lpBand)) continue;589 590 /* adjust height of bands in row to "mcy" value */591 if (infoPtr->dwStyle & CCS_VERT) {592 if (lpBand->rcBand.right != lpBand->rcBand.left + mcy)593 lpBand->rcBand.right = lpBand->rcBand.left + mcy;594 }595 else {596 if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy)597 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;598 599 }600 601 /* mark whether we need to invalidate this band and trace */602 if ((lpBand->rcoldBand.left !=lpBand->rcBand.left) ||603 (lpBand->rcoldBand.top !=lpBand->rcBand.top) ||604 (lpBand->rcoldBand.right !=lpBand->rcBand.right) ||605 (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) {606 lpBand->fDraw |= NTF_INVALIDATE;607 TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d) from (%d,%d)-(%d,%d)\n",608 i, lpBand->iRow,609 lpBand->rcBand.left, lpBand->rcBand.top,610 lpBand->rcBand.right, lpBand->rcBand.bottom,611 lpBand->rcoldBand.left, lpBand->rcoldBand.top,612 lpBand->rcoldBand.right, lpBand->rcoldBand.bottom);613 }614 else615 TRACE("band %d row=%d: unchanged (%d,%d)-(%d,%d)\n",616 i, lpBand->iRow,617 lpBand->rcBand.left, lpBand->rcBand.top,618 lpBand->rcBand.right, lpBand->rcBand.bottom);638 if (HIDDENBAND(lpBand)) continue; 639 640 /* adjust height of bands in row to "mcy" value */ 641 if (infoPtr->dwStyle & CCS_VERT) { 642 if (lpBand->rcBand.right != lpBand->rcBand.left + mcy) 643 lpBand->rcBand.right = lpBand->rcBand.left + mcy; 644 } 645 else { 646 if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy) 647 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy; 648 649 } 650 651 /* mark whether we need to invalidate this band and trace */ 652 if ((lpBand->rcoldBand.left !=lpBand->rcBand.left) || 653 (lpBand->rcoldBand.top !=lpBand->rcBand.top) || 654 (lpBand->rcoldBand.right !=lpBand->rcBand.right) || 655 (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) { 656 lpBand->fDraw |= NTF_INVALIDATE; 657 TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d) from (%d,%d)-(%d,%d)\n", 658 i, lpBand->iRow, 659 lpBand->rcBand.left, lpBand->rcBand.top, 660 lpBand->rcBand.right, lpBand->rcBand.bottom, 661 lpBand->rcoldBand.left, lpBand->rcoldBand.top, 662 lpBand->rcoldBand.right, lpBand->rcoldBand.bottom); 663 } 664 else 665 TRACE("band %d row=%d: unchanged (%d,%d)-(%d,%d)\n", 666 i, lpBand->iRow, 667 lpBand->rcBand.left, lpBand->rcBand.top, 668 lpBand->rcBand.right, lpBand->rcBand.bottom); 619 669 } 620 670 } … … 623 673 static void 624 674 REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, 625 INT maxx, INT mcy)675 INT maxx, INT mcy) 626 676 /* Function: This routine distributes the extra space in a row. */ 627 677 /* See algorithm below. */ … … 635 685 636 686 TRACE("start=%u, end=%u, max x=%d, max y=%d\n", 637 rowstart, rowend, maxx, mcy);687 rowstart, rowend, maxx, mcy); 638 688 639 689 /* ******************* Phase 1 ************************ */ … … 643 693 /* or band's ->ccx reached. */ 644 694 /* If any band modified, add any space left to last band */ 645 /* adjusted. */ 695 /* adjusted. */ 646 696 /* */ 647 697 /* ****************************************************** */ … … 649 699 extra = maxx - rcBrb(lpBand); 650 700 x = 0; 651 last_adjusted = 0;701 last_adjusted = -1; 652 702 for (i=(INT)rowstart; i<=(INT)rowend; i++) { 653 lpBand = &infoPtr->bands[i];654 if (HIDDENBAND(lpBand)) continue;655 xsep = (x == 0) ? 0 : SEP_WIDTH;656 curwidth = rcBw(lpBand);657 658 /* set new left/top point */659 if (infoPtr->dwStyle & CCS_VERT)660 lpBand->rcBand.top = x + xsep;661 else662 lpBand->rcBand.left = x + xsep;663 664 /* compute new width */665 if (lpBand->hwndChild && extra) {666 /* set to the "current" band size less the header */667 fudge = lpBand->ccx;668 last_adjusted = i;669 if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0) &&670 (fudge > curwidth)) {671 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d, extra=%d\n",672 i, fudge-curwidth, fudge, curwidth, extra);673 if ((fudge - curwidth) > extra)674 fudge = curwidth + extra;675 extra -= (fudge - curwidth);676 curwidth = fudge;677 }678 else {679 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d\n",680 i, extra, fudge, curwidth);681 curwidth += extra;682 extra = 0;683 }684 }685 686 /* set new right/bottom point */687 if (infoPtr->dwStyle & CCS_VERT)688 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;689 else690 lpBand->rcBand.right = lpBand->rcBand.left + curwidth;691 TRACE("Phase 1 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",692 i, lpBand->rcBand.left, lpBand->rcBand.top,693 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);694 x = rcBrb(lpBand);695 } 696 if ((x >= maxx) || last_adjusted) {697 if (x > maxx) {698 ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n", 699 x, maxx, rowstart, rowend);700 }701 /* done, so spread extra space */702 if (x < maxx) {703 fudge = maxx - x;704 TRACE("Need to spread %d on last adjusted band %d\n",705 fudge, last_adjusted);706 for (i=(INT)last_adjusted; i<=(INT)rowend; i++) {707 lpBand = &infoPtr->bands[i];708 if (HIDDENBAND(lpBand)) continue;709 710 /* set right/bottom point */711 if (i != last_adjusted) {712 if (infoPtr->dwStyle & CCS_VERT)713 lpBand->rcBand.top += fudge;714 else715 lpBand->rcBand.left += fudge;716 }717 718 /* set left/bottom point */719 if (infoPtr->dwStyle & CCS_VERT)720 lpBand->rcBand.bottom += fudge;721 else722 lpBand->rcBand.right += fudge;723 }724 }725 TRACE("Phase 1 succeeded, used x=%d\n", x);726 REBAR_FixVert (infoPtr, rowstart, rowend, mcy);727 return;703 lpBand = &infoPtr->bands[i]; 704 if (HIDDENBAND(lpBand)) continue; 705 xsep = (x == 0) ? 0 : SEP_WIDTH; 706 curwidth = rcBw(lpBand); 707 708 /* set new left/top point */ 709 if (infoPtr->dwStyle & CCS_VERT) 710 lpBand->rcBand.top = x + xsep; 711 else 712 lpBand->rcBand.left = x + xsep; 713 714 /* compute new width */ 715 if (lpBand->hwndChild && extra) { 716 /* set to the "current" band size less the header */ 717 fudge = lpBand->ccx; 718 last_adjusted = i; 719 if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0) && 720 (fudge > curwidth)) { 721 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d, extra=%d\n", 722 i, fudge-curwidth, fudge, curwidth, extra); 723 if ((fudge - curwidth) > extra) 724 fudge = curwidth + extra; 725 extra -= (fudge - curwidth); 726 curwidth = fudge; 727 } 728 else { 729 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d\n", 730 i, extra, fudge, curwidth); 731 curwidth += extra; 732 extra = 0; 733 } 734 } 735 736 /* set new right/bottom point */ 737 if (infoPtr->dwStyle & CCS_VERT) 738 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth; 739 else 740 lpBand->rcBand.right = lpBand->rcBand.left + curwidth; 741 TRACE("Phase 1 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n", 742 i, lpBand->rcBand.left, lpBand->rcBand.top, 743 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep); 744 x = rcBrb(lpBand); 745 } 746 if ((x >= maxx) || (last_adjusted != -1)) { 747 if (x > maxx) { 748 ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n", 749 x, maxx, rowstart, rowend); 750 } 751 /* done, so spread extra space */ 752 if (x < maxx) { 753 fudge = maxx - x; 754 TRACE("Need to spread %d on last adjusted band %d\n", 755 fudge, last_adjusted); 756 for (i=(INT)last_adjusted; i<=(INT)rowend; i++) { 757 lpBand = &infoPtr->bands[i]; 758 if (HIDDENBAND(lpBand)) continue; 759 760 /* set right/bottom point */ 761 if (i != last_adjusted) { 762 if (infoPtr->dwStyle & CCS_VERT) 763 lpBand->rcBand.top += fudge; 764 else 765 lpBand->rcBand.left += fudge; 766 } 767 768 /* set left/bottom point */ 769 if (infoPtr->dwStyle & CCS_VERT) 770 lpBand->rcBand.bottom += fudge; 771 else 772 lpBand->rcBand.right += fudge; 773 } 774 } 775 TRACE("Phase 1 succeeded, used x=%d\n", x); 776 REBAR_FixVert (infoPtr, rowstart, rowend, mcy); 777 return; 728 778 } 729 779 … … 737 787 x = 0; 738 788 for (i=(INT)rowstart; i<=(INT)rowend; i++) { 739 lpBand = &infoPtr->bands[i];740 if (HIDDENBAND(lpBand)) continue;741 xsep = (x == 0) ? 0 : SEP_WIDTH;742 curwidth = rcBw(lpBand);743 744 /* set new left/top point */745 if (infoPtr->dwStyle & CCS_VERT)746 lpBand->rcBand.top = x + xsep;747 else748 lpBand->rcBand.left = x + xsep;749 750 /* compute new width */751 if (extra) {752 curwidth += extra;753 extra = 0;754 }755 756 /* set new right/bottom point */757 if (infoPtr->dwStyle & CCS_VERT)758 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;759 else760 lpBand->rcBand.right = lpBand->rcBand.left + curwidth;761 TRACE("Phase 2 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",762 i, lpBand->rcBand.left, lpBand->rcBand.top,763 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);764 x = rcBrb(lpBand);789 lpBand = &infoPtr->bands[i]; 790 if (HIDDENBAND(lpBand)) continue; 791 xsep = (x == 0) ? 0 : SEP_WIDTH; 792 curwidth = rcBw(lpBand); 793 794 /* set new left/top point */ 795 if (infoPtr->dwStyle & CCS_VERT) 796 lpBand->rcBand.top = x + xsep; 797 else 798 lpBand->rcBand.left = x + xsep; 799 800 /* compute new width */ 801 if (extra) { 802 curwidth += extra; 803 extra = 0; 804 } 805 806 /* set new right/bottom point */ 807 if (infoPtr->dwStyle & CCS_VERT) 808 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth; 809 else 810 lpBand->rcBand.right = lpBand->rcBand.left + curwidth; 811 TRACE("Phase 2 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n", 812 i, lpBand->rcBand.left, lpBand->rcBand.top, 813 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep); 814 x = rcBrb(lpBand); 765 815 } 766 816 if (x >= maxx) { 767 if (x > maxx) {768 ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n", 769 x, maxx, rowstart, rowend);770 }771 /* done, so spread extra space */772 TRACE("Phase 2 succeeded, used x=%d\n", x);773 REBAR_FixVert (infoPtr, rowstart, rowend, mcy);774 return;817 if (x > maxx) { 818 ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n", 819 x, maxx, rowstart, rowend); 820 } 821 /* done, so spread extra space */ 822 TRACE("Phase 2 succeeded, used x=%d\n", x); 823 REBAR_FixVert (infoPtr, rowstart, rowend, mcy); 824 return; 775 825 } 776 826 … … 782 832 lpBand = &infoPtr->bands[rowstart]; 783 833 ERR("Serious problem adjusting row %d, start band %d, end band %d\n", 784 lpBand->iRow, rowstart, rowend);834 lpBand->iRow, rowstart, rowend); 785 835 REBAR_DumpBand (infoPtr); 786 836 return; … … 806 856 if (HIDDENBAND(lpBand)) { 807 857 SetRect (&lpBand->rcChild, 808 lpBand->rcBand.right, lpBand->rcBand.top,809 lpBand->rcBand.right, lpBand->rcBand.bottom);810 continue;858 lpBand->rcBand.right, lpBand->rcBand.top, 859 lpBand->rcBand.right, lpBand->rcBand.bottom); 860 continue; 811 861 } 812 862 … … 815 865 /* set initial gripper rectangle */ 816 866 SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top, 817 lpBand->rcBand.left, lpBand->rcBand.bottom);867 lpBand->rcBand.left, lpBand->rcBand.bottom); 818 868 819 869 /* calculate gripper rectangle */ 820 870 if ( lpBand->fStatus & HAS_GRIPPER) { 821 lpBand->fDraw |= DRAW_GRIPPER;822 lpBand->rcGripper.left += REBAR_PRE_GRIPPER;823 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;824 lpBand->rcGripper.top += 2;825 lpBand->rcGripper.bottom -= 2;826 827 SetRect (&lpBand->rcCapImage,828 lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.top,829 lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.bottom);871 lpBand->fDraw |= DRAW_GRIPPER; 872 lpBand->rcGripper.left += REBAR_PRE_GRIPPER; 873 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH; 874 lpBand->rcGripper.top += 2; 875 lpBand->rcGripper.bottom -= 2; 876 877 SetRect (&lpBand->rcCapImage, 878 lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.top, 879 lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.bottom); 830 880 } 831 881 else { /* no gripper will be drawn */ 832 xoff = 0;833 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))834 /* if no gripper but either image or text, then leave space */835 xoff = REBAR_ALWAYS_SPACE;836 SetRect (&lpBand->rcCapImage, 837 lpBand->rcBand.left+xoff, lpBand->rcBand.top,838 lpBand->rcBand.left+xoff, lpBand->rcBand.bottom);882 xoff = 0; 883 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) 884 /* if no gripper but either image or text, then leave space */ 885 xoff = REBAR_ALWAYS_SPACE; 886 SetRect (&lpBand->rcCapImage, 887 lpBand->rcBand.left+xoff, lpBand->rcBand.top, 888 lpBand->rcBand.left+xoff, lpBand->rcBand.bottom); 839 889 } 840 890 841 891 /* image is visible */ 842 892 if (lpBand->fStatus & HAS_IMAGE) { 843 lpBand->fDraw |= DRAW_IMAGE;844 lpBand->rcCapImage.right += infoPtr->imageSize.cx;845 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;846 847 /* set initial caption text rectangle */848 SetRect (&lpBand->rcCapText,849 lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1,850 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);851 /* update band height 852 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {853 lpBand->uMinHeight = infoPtr->imageSize.cy + 2;854 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;855 } */893 lpBand->fDraw |= DRAW_IMAGE; 894 lpBand->rcCapImage.right += infoPtr->imageSize.cx; 895 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy; 896 897 /* set initial caption text rectangle */ 898 SetRect (&lpBand->rcCapText, 899 lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1, 900 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1); 901 /* update band height 902 if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) { 903 lpBand->uMinHeight = infoPtr->imageSize.cy + 2; 904 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight; 905 } */ 856 906 } 857 907 else { 858 /* set initial caption text rectangle */859 SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1,860 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);908 /* set initial caption text rectangle */ 909 SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1, 910 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1); 861 911 } 862 912 863 913 /* text is visible */ 864 914 if (lpBand->fStatus & HAS_TEXT) { 865 lpBand->fDraw |= DRAW_TEXT;866 lpBand->rcCapText.right = max(lpBand->rcCapText.left, 867 lpBand->rcCapText.right-REBAR_POST_TEXT);915 lpBand->fDraw |= DRAW_TEXT; 916 lpBand->rcCapText.right = max(lpBand->rcCapText.left, 917 lpBand->rcCapText.right-REBAR_POST_TEXT); 868 918 } 869 919 870 920 /* set initial child window rectangle if there is a child */ 871 921 if (lpBand->fMask & RBBIM_CHILD) { 872 xoff = lpBand->offChild.cx;873 yoff = lpBand->offChild.cy;874 SetRect (&lpBand->rcChild,875 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top+yoff,876 lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);922 xoff = lpBand->offChild.cx; 923 yoff = lpBand->offChild.cy; 924 SetRect (&lpBand->rcChild, 925 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top+yoff, 926 lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff); 877 927 } 878 928 else { 879 929 SetRect (&lpBand->rcChild, 880 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top,881 lpBand->rcBand.right, lpBand->rcBand.bottom);930 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top, 931 lpBand->rcBand.right, lpBand->rcBand.bottom); 882 932 } 883 933 884 934 /* flag if notify required and invalidate rectangle */ 885 if (notify && 886 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||887 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {888 TRACE("Child rectangle changed for band %u\n", i);889 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n",890 oldChild.left, oldChild.top,891 oldChild.right, oldChild.bottom,892 lpBand->rcChild.left, lpBand->rcChild.top,893 lpBand->rcChild.right, lpBand->rcChild.bottom);935 if (notify && 936 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) || 937 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) { 938 TRACE("Child rectangle changed for band %u\n", i); 939 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 940 oldChild.left, oldChild.top, 941 oldChild.right, oldChild.bottom, 942 lpBand->rcChild.left, lpBand->rcChild.top, 943 lpBand->rcChild.right, lpBand->rcChild.bottom); 894 944 } 895 945 if (lpBand->fDraw & NTF_INVALIDATE) { 896 TRACE("invalidating (%d,%d)-(%d,%d)\n",897 lpBand->rcBand.left, 898 lpBand->rcBand.top,899 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0), 900 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0));901 lpBand->fDraw &= ~NTF_INVALIDATE;902 work = lpBand->rcBand;903 if (lpBand->fDraw & DRAW_RIGHTSEP) work.right += SEP_WIDTH_SIZE;904 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.bottom += SEP_WIDTH_SIZE;905 InvalidateRect(infoPtr->hwndSelf, &work, TRUE);946 TRACE("invalidating (%d,%d)-(%d,%d)\n", 947 lpBand->rcBand.left, 948 lpBand->rcBand.top, 949 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0), 950 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0)); 951 lpBand->fDraw &= ~NTF_INVALIDATE; 952 work = lpBand->rcBand; 953 if (lpBand->fDraw & DRAW_RIGHTSEP) work.right += SEP_WIDTH_SIZE; 954 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.bottom += SEP_WIDTH_SIZE; 955 InvalidateRect(infoPtr->hwndSelf, &work, TRUE); 906 956 } 907 957 … … 926 976 927 977 for(i=rstart; i<rend; i++){ 928 lpBand = &infoPtr->bands[i];929 if (HIDDENBAND(lpBand)) continue;930 oldChild = lpBand->rcChild;931 932 /* set initial gripper rectangle */933 SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top,934 lpBand->rcBand.right, lpBand->rcBand.top);935 936 /* calculate gripper rectangle */937 if (lpBand->fStatus & HAS_GRIPPER) {938 lpBand->fDraw |= DRAW_GRIPPER;939 940 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) {941 /* vertical gripper */942 lpBand->rcGripper.left += 3;943 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;944 lpBand->rcGripper.top += REBAR_PRE_GRIPPER;945 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT;946 947 /* initialize Caption image rectangle */948 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,949 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,950 lpBand->rcBand.right,951 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);952 }953 else {954 /* horizontal gripper */955 lpBand->rcGripper.left += 3;956 lpBand->rcGripper.right -= 3;957 lpBand->rcGripper.top += REBAR_PRE_GRIPPER;958 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_WIDTH;959 960 /* initialize Caption image rectangle */961 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,962 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,963 lpBand->rcBand.right,964 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);965 }966 }967 else { /* no gripper will be drawn */968 xoff = 0;969 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))970 /* if no gripper but either image or text, then leave space */971 xoff = REBAR_ALWAYS_SPACE;972 /* initialize Caption image rectangle */973 SetRect (&lpBand->rcCapImage, 974 lpBand->rcBand.left, lpBand->rcBand.top+xoff,975 lpBand->rcBand.right, lpBand->rcBand.top+xoff);976 }977 978 /* image is visible */979 if (lpBand->fStatus & HAS_IMAGE) {980 lpBand->fDraw |= DRAW_IMAGE;981 982 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;983 lpBand->rcCapImage.bottom += infoPtr->imageSize.cy;984 985 /* set initial caption text rectangle */986 SetRect (&lpBand->rcCapText, 987 lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE,988 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);989 /* update band height *990 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {991 lpBand->uMinHeight = infoPtr->imageSize.cx + 2;992 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;993 } */994 }995 else {996 /* set initial caption text rectangle */997 SetRect (&lpBand->rcCapText, 998 lpBand->rcBand.left, lpBand->rcCapImage.bottom,999 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);1000 }1001 1002 /* text is visible */1003 if (lpBand->fStatus & HAS_TEXT) {1004 lpBand->fDraw |= DRAW_TEXT;1005 lpBand->rcCapText.bottom = max(lpBand->rcCapText.top,1006 lpBand->rcCapText.bottom-REBAR_POST_TEXT);1007 }1008 1009 /* set initial child window rectangle if there is a child */1010 if (lpBand->fMask & RBBIM_CHILD) {1011 yoff = lpBand->offChild.cx;1012 xoff = lpBand->offChild.cy;1013 SetRect (&lpBand->rcChild,1014 lpBand->rcBand.left+xoff, lpBand->rcBand.top+lpBand->cxHeader,1015 lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);1016 }1017 else {1018 SetRect (&lpBand->rcChild,1019 lpBand->rcBand.left, lpBand->rcBand.top+lpBand->cxHeader,1020 lpBand->rcBand.right, lpBand->rcBand.bottom);1021 }1022 1023 /* flag if notify required and invalidate rectangle */1024 if (notify && 1025 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||1026 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {1027 TRACE("Child rectangle changed for band %u\n", i);1028 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n",1029 oldChild.left, oldChild.top,1030 oldChild.right, oldChild.bottom,1031 lpBand->rcChild.left, lpBand->rcChild.top,1032 lpBand->rcChild.right, lpBand->rcChild.bottom);1033 }1034 if (lpBand->fDraw & NTF_INVALIDATE) {1035 TRACE("invalidating (%d,%d)-(%d,%d)\n",1036 lpBand->rcBand.left, 1037 lpBand->rcBand.top,1038 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0), 1039 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0));1040 lpBand->fDraw &= ~NTF_INVALIDATE;1041 work = lpBand->rcBand;1042 if (lpBand->fDraw & DRAW_RIGHTSEP) work.bottom += SEP_WIDTH_SIZE;1043 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.right += SEP_WIDTH_SIZE;1044 InvalidateRect(infoPtr->hwndSelf, &work, TRUE);1045 }978 lpBand = &infoPtr->bands[i]; 979 if (HIDDENBAND(lpBand)) continue; 980 oldChild = lpBand->rcChild; 981 982 /* set initial gripper rectangle */ 983 SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top, 984 lpBand->rcBand.right, lpBand->rcBand.top); 985 986 /* calculate gripper rectangle */ 987 if (lpBand->fStatus & HAS_GRIPPER) { 988 lpBand->fDraw |= DRAW_GRIPPER; 989 990 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) { 991 /* vertical gripper */ 992 lpBand->rcGripper.left += 3; 993 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH; 994 lpBand->rcGripper.top += REBAR_PRE_GRIPPER; 995 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT; 996 997 /* initialize Caption image rectangle */ 998 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left, 999 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE, 1000 lpBand->rcBand.right, 1001 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE); 1002 } 1003 else { 1004 /* horizontal gripper */ 1005 lpBand->rcGripper.left += 2; 1006 lpBand->rcGripper.right -= 2; 1007 lpBand->rcGripper.top += REBAR_PRE_GRIPPER; 1008 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_WIDTH; 1009 1010 /* initialize Caption image rectangle */ 1011 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left, 1012 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE, 1013 lpBand->rcBand.right, 1014 lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE); 1015 } 1016 } 1017 else { /* no gripper will be drawn */ 1018 xoff = 0; 1019 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) 1020 /* if no gripper but either image or text, then leave space */ 1021 xoff = REBAR_ALWAYS_SPACE; 1022 /* initialize Caption image rectangle */ 1023 SetRect (&lpBand->rcCapImage, 1024 lpBand->rcBand.left, lpBand->rcBand.top+xoff, 1025 lpBand->rcBand.right, lpBand->rcBand.top+xoff); 1026 } 1027 1028 /* image is visible */ 1029 if (lpBand->fStatus & HAS_IMAGE) { 1030 lpBand->fDraw |= DRAW_IMAGE; 1031 1032 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx; 1033 lpBand->rcCapImage.bottom += infoPtr->imageSize.cy; 1034 1035 /* set initial caption text rectangle */ 1036 SetRect (&lpBand->rcCapText, 1037 lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE, 1038 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader); 1039 /* update band height * 1040 if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) { 1041 lpBand->uMinHeight = infoPtr->imageSize.cx + 2; 1042 lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight; 1043 } */ 1044 } 1045 else { 1046 /* set initial caption text rectangle */ 1047 SetRect (&lpBand->rcCapText, 1048 lpBand->rcBand.left, lpBand->rcCapImage.bottom, 1049 lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader); 1050 } 1051 1052 /* text is visible */ 1053 if (lpBand->fStatus & HAS_TEXT) { 1054 lpBand->fDraw |= DRAW_TEXT; 1055 lpBand->rcCapText.bottom = max(lpBand->rcCapText.top, 1056 lpBand->rcCapText.bottom); 1057 } 1058 1059 /* set initial child window rectangle if there is a child */ 1060 if (lpBand->fMask & RBBIM_CHILD) { 1061 yoff = lpBand->offChild.cx; 1062 xoff = lpBand->offChild.cy; 1063 SetRect (&lpBand->rcChild, 1064 lpBand->rcBand.left+xoff, lpBand->rcBand.top+lpBand->cxHeader, 1065 lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff); 1066 } 1067 else { 1068 SetRect (&lpBand->rcChild, 1069 lpBand->rcBand.left, lpBand->rcBand.top+lpBand->cxHeader, 1070 lpBand->rcBand.right, lpBand->rcBand.bottom); 1071 } 1072 1073 /* flag if notify required and invalidate rectangle */ 1074 if (notify && 1075 ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) || 1076 (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) { 1077 TRACE("Child rectangle changed for band %u\n", i); 1078 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 1079 oldChild.left, oldChild.top, 1080 oldChild.right, oldChild.bottom, 1081 lpBand->rcChild.left, lpBand->rcChild.top, 1082 lpBand->rcChild.right, lpBand->rcChild.bottom); 1083 } 1084 if (lpBand->fDraw & NTF_INVALIDATE) { 1085 TRACE("invalidating (%d,%d)-(%d,%d)\n", 1086 lpBand->rcBand.left, 1087 lpBand->rcBand.top, 1088 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0), 1089 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0)); 1090 lpBand->fDraw &= ~NTF_INVALIDATE; 1091 work = lpBand->rcBand; 1092 if (lpBand->fDraw & DRAW_RIGHTSEP) work.bottom += SEP_WIDTH_SIZE; 1093 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.right += SEP_WIDTH_SIZE; 1094 InvalidateRect(infoPtr->hwndSelf, &work, TRUE); 1095 } 1046 1096 1047 1097 } … … 1055 1105 { 1056 1106 RECT rc; 1107 INT x, y, width, height; 1108 INT xedge = GetSystemMetrics(SM_CXEDGE); 1109 INT yedge = GetSystemMetrics(SM_CYEDGE); 1057 1110 1058 1111 /* TEST TEST TEST */ … … 1064 1117 1065 1118 TRACE( " old [%ld x %ld], new [%ld x %ld], client [%d x %d]\n", 1066 infoPtr->oldSize.cx, infoPtr->oldSize.cy,1067 infoPtr->calcSize.cx, infoPtr->calcSize.cy,1068 rc.right, rc.bottom);1119 infoPtr->oldSize.cx, infoPtr->oldSize.cy, 1120 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 1121 rc.right, rc.bottom); 1069 1122 1070 1123 /* If we need to shrink client, then skip size test */ 1071 1124 if ((infoPtr->calcSize.cy >= rc.bottom) && 1072 (infoPtr->calcSize.cx >= rc.right)) {1073 1074 /* if size did not change then skip process */1075 if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) &&1076 (infoPtr->oldSize.cy == infoPtr->calcSize.cy) &&1077 !(infoPtr->fStatus & RESIZE_ANYHOW))1078 {1079 TRACE("skipping reset\n");1080 return;1081 }1125 (infoPtr->calcSize.cx >= rc.right)) { 1126 1127 /* if size did not change then skip process */ 1128 if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) && 1129 (infoPtr->oldSize.cy == infoPtr->calcSize.cy) && 1130 !(infoPtr->fStatus & RESIZE_ANYHOW)) 1131 { 1132 TRACE("skipping reset\n"); 1133 return; 1134 } 1082 1135 } 1083 1136 … … 1086 1139 infoPtr->fStatus |= AUTO_RESIZE; 1087 1140 1088 rc.left = 0; 1089 rc.top = 0; 1090 rc.right = infoPtr->calcSize.cx; 1091 rc.bottom = infoPtr->calcSize.cy; 1092 1093 InflateRect (&rc, 0, GetSystemMetrics(SM_CYEDGE)); 1094 /* see comments in _NCCalcSize for reason below is not done */ 1095 #if 0 1096 if (GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE) & WS_BORDER) { 1097 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); 1098 } 1099 #endif 1100 1101 TRACE("setting to (0,0)-(%d,%d)\n", 1102 rc.right - rc.left, rc.bottom - rc.top); 1103 SetWindowPos (infoPtr->hwndSelf, 0, 0, 0, 1104 rc.right - rc.left, rc.bottom - rc.top, 1105 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); 1141 width = 0; 1142 height = 0; 1143 x = 0; 1144 y = 0; 1145 1146 if (infoPtr->dwStyle & WS_BORDER) { 1147 width = 2 * xedge; 1148 height = 2 * yedge; 1149 } 1150 1151 if (!(infoPtr->dwStyle & CCS_NOPARENTALIGN)) { 1152 INT mode = infoPtr->dwStyle & (CCS_VERT | CCS_TOP | CCS_BOTTOM); 1153 RECT rcPcl; 1154 1155 GetClientRect(GetParent(infoPtr->hwndSelf), &rcPcl); 1156 switch (mode) { 1157 case CCS_TOP: 1158 /* _TOP sets width to parents width */ 1159 width += (rcPcl.right - rcPcl.left); 1160 height += infoPtr->calcSize.cy; 1161 x += ((infoPtr->dwStyle & WS_BORDER) ? -xedge : 0); 1162 y += ((infoPtr->dwStyle & WS_BORDER) ? -yedge : 0); 1163 y += ((infoPtr->dwStyle & CCS_NODIVIDER) ? 0 : REBAR_DIVIDER); 1164 break; 1165 case CCS_BOTTOM: 1166 /* FIXME: wrong wrong wrong */ 1167 /* _BOTTOM sets width to parents width */ 1168 width += (rcPcl.right - rcPcl.left); 1169 height += infoPtr->calcSize.cy; 1170 x += -xedge; 1171 y = rcPcl.bottom - height + 1; 1172 break; 1173 case CCS_LEFT: 1174 /* _LEFT sets height to parents height */ 1175 width += infoPtr->calcSize.cx; 1176 height += (rcPcl.bottom - rcPcl.top); 1177 x += ((infoPtr->dwStyle & WS_BORDER) ? -xedge : 0); 1178 x += ((infoPtr->dwStyle & CCS_NODIVIDER) ? 0 : REBAR_DIVIDER); 1179 y += ((infoPtr->dwStyle & WS_BORDER) ? -yedge : 0); 1180 break; 1181 case CCS_RIGHT: 1182 /* FIXME: wrong wrong wrong */ 1183 /* _RIGHT sets height to parents height */ 1184 width += infoPtr->calcSize.cx; 1185 height += (rcPcl.bottom - rcPcl.top); 1186 x = rcPcl.right - width + 1; 1187 y = -yedge; 1188 break; 1189 default: 1190 width += infoPtr->calcSize.cx; 1191 height += infoPtr->calcSize.cy; 1192 } 1193 } 1194 else { 1195 width += infoPtr->calcSize.cx; 1196 height += infoPtr->calcSize.cy; 1197 } 1198 1199 TRACE("hwnd %04x, style=%08lx, setting at (%d,%d) for (%d,%d)\n", 1200 infoPtr->hwndSelf, infoPtr->dwStyle, 1201 x, y, width, height); 1202 SetWindowPos (infoPtr->hwndSelf, 0, x, y, width, height, 1203 SWP_NOZORDER); 1106 1204 } 1107 1205 … … 1121 1219 1122 1220 for (i = start; i < endplus; i++) { 1123 lpBand = &infoPtr->bands[i]; 1124 1125 if (HIDDENBAND(lpBand)) continue; 1126 if (lpBand->hwndChild) { 1127 TRACE("hwndChild = %x\n", lpBand->hwndChild); 1128 1129 /* Always geterate the RBN_CHILDSIZE even it child 1130 did not change */ 1131 rbcz.uBand = i; 1132 rbcz.wID = lpBand->wID; 1133 rbcz.rcChild = lpBand->rcChild; 1134 rbcz.rcBand = lpBand->rcBand; 1135 rbcz.rcBand.left += lpBand->cxHeader; 1136 REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE); 1137 if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) { 1138 TRACE("Child rect changed by NOTIFY for band %u\n", i); 1139 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 1140 lpBand->rcChild.left, lpBand->rcChild.top, 1141 lpBand->rcChild.right, lpBand->rcChild.bottom, 1142 rbcz.rcChild.left, rbcz.rcChild.top, 1143 rbcz.rcChild.right, rbcz.rcChild.bottom); 1144 } 1145 1146 GetClassNameA (lpBand->hwndChild, szClassName, 40); 1147 if (!lstrcmpA (szClassName, "ComboBox") || 1148 !lstrcmpA (szClassName, WC_COMBOBOXEXA)) { 1149 INT nEditHeight, yPos; 1150 RECT rc; 1151 1152 /* special placement code for combo or comboex box */ 1153 1154 1155 /* get size of edit line */ 1156 GetWindowRect (lpBand->hwndChild, &rc); 1157 nEditHeight = rc.bottom - rc.top; 1158 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; 1159 1160 /* center combo box inside child area */ 1161 TRACE("moving child (Combo(Ex)) %04x to (%d,%d) for (%d,%d)\n", 1162 lpBand->hwndChild, 1163 lpBand->rcChild.left, yPos, 1164 lpBand->rcChild.right - lpBand->rcChild.left, 1165 nEditHeight); 1166 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1167 lpBand->rcChild.left, 1168 /*lpBand->rcChild.top*/ yPos, 1169 lpBand->rcChild.right - lpBand->rcChild.left, 1170 nEditHeight, 1171 SWP_NOZORDER); 1172 if (!deferpos) 1173 ERR("DeferWindowPos returned NULL\n"); 1174 } 1175 else { 1176 TRACE("moving child (Other) %04x to (%d,%d) for (%d,%d)\n", 1177 lpBand->hwndChild, 1178 lpBand->rcChild.left, lpBand->rcChild.top, 1179 lpBand->rcChild.right - lpBand->rcChild.left, 1180 lpBand->rcChild.bottom - lpBand->rcChild.top); 1181 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1182 lpBand->rcChild.left, 1183 lpBand->rcChild.top, 1184 lpBand->rcChild.right - lpBand->rcChild.left, 1185 lpBand->rcChild.bottom - lpBand->rcChild.top, 1186 SWP_NOZORDER); 1187 if (!deferpos) 1188 ERR("DeferWindowPos returned NULL\n"); 1189 } 1190 } 1221 lpBand = &infoPtr->bands[i]; 1222 1223 if (HIDDENBAND(lpBand)) continue; 1224 if (lpBand->hwndChild) { 1225 TRACE("hwndChild = %x\n", lpBand->hwndChild); 1226 1227 /* Always geterate the RBN_CHILDSIZE even it child 1228 did not change */ 1229 rbcz.uBand = i; 1230 rbcz.wID = lpBand->wID; 1231 rbcz.rcChild = lpBand->rcChild; 1232 rbcz.rcBand = lpBand->rcBand; 1233 rbcz.rcBand.left += lpBand->cxHeader; 1234 REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE); 1235 if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) { 1236 TRACE("Child rect changed by NOTIFY for band %u\n", i); 1237 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 1238 lpBand->rcChild.left, lpBand->rcChild.top, 1239 lpBand->rcChild.right, lpBand->rcChild.bottom, 1240 rbcz.rcChild.left, rbcz.rcChild.top, 1241 rbcz.rcChild.right, rbcz.rcChild.bottom); 1242 lpBand->rcChild = rbcz.rcChild; /* *** ??? */ 1243 } 1244 1245 /* native (IE4 in "Favorites" frame **1) does: 1246 * SetRect (&rc, -1, -1, -1, -1) 1247 * EqualRect (&rc,band->rc???) 1248 * if ret==0 1249 * CopyRect (band->rc????, &rc) 1250 * set flag outside of loop 1251 */ 1252 1253 GetClassNameA (lpBand->hwndChild, szClassName, 40); 1254 if (!lstrcmpA (szClassName, "ComboBox") || 1255 !lstrcmpA (szClassName, WC_COMBOBOXEXA)) { 1256 INT nEditHeight, yPos; 1257 RECT rc; 1258 1259 /* special placement code for combo or comboex box */ 1260 1261 1262 /* get size of edit line */ 1263 GetWindowRect (lpBand->hwndChild, &rc); 1264 nEditHeight = rc.bottom - rc.top; 1265 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; 1266 1267 /* center combo box inside child area */ 1268 TRACE("moving child (Combo(Ex)) %04x to (%d,%d) for (%d,%d)\n", 1269 lpBand->hwndChild, 1270 lpBand->rcChild.left, yPos, 1271 lpBand->rcChild.right - lpBand->rcChild.left, 1272 nEditHeight); 1273 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1274 lpBand->rcChild.left, 1275 /*lpBand->rcChild.top*/ yPos, 1276 lpBand->rcChild.right - lpBand->rcChild.left, 1277 nEditHeight, 1278 SWP_NOZORDER); 1279 if (!deferpos) 1280 ERR("DeferWindowPos returned NULL\n"); 1281 } 1282 else { 1283 TRACE("moving child (Other) %04x to (%d,%d) for (%d,%d)\n", 1284 lpBand->hwndChild, 1285 lpBand->rcChild.left, lpBand->rcChild.top, 1286 lpBand->rcChild.right - lpBand->rcChild.left, 1287 lpBand->rcChild.bottom - lpBand->rcChild.top); 1288 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1289 lpBand->rcChild.left, 1290 lpBand->rcChild.top, 1291 lpBand->rcChild.right - lpBand->rcChild.left, 1292 lpBand->rcChild.bottom - lpBand->rcChild.top, 1293 SWP_NOZORDER); 1294 if (!deferpos) 1295 ERR("DeferWindowPos returned NULL\n"); 1296 } 1297 } 1191 1298 } 1192 1299 if (!EndDeferWindowPos(deferpos)) 1193 1300 ERR("EndDeferWindowPos returned NULL\n"); 1301 1302 UpdateWindow (infoPtr->hwndSelf); 1303 1194 1304 if (infoPtr->fStatus & NTF_HGHTCHG) { 1195 1305 infoPtr->fStatus &= ~NTF_HGHTCHG; 1196 1306 REBAR_Notify (&heightchange, infoPtr, RBN_HEIGHTCHANGE); 1197 1307 } 1308 1309 /* native (from **1 above) does: 1310 * UpdateWindow(rebar) 1311 * REBAR_ForceResize 1312 * RBN_HEIGHTCHANGE if necessary 1313 * if ret from any EqualRect was 0 1314 * Goto "BeginDeferWindowPos" 1315 */ 1316 1198 1317 } 1199 1318 … … 1207 1326 REBAR_BAND *lpBand, *prevBand; 1208 1327 RECT rcClient, rcAdj; 1209 INT x, y, cx, cxsep, mmcy, mcy, clientcx, clientcy;1328 INT initx, inity, x, y, cx, cxsep, mmcy, mcy, clientcx, clientcy; 1210 1329 INT adjcx, adjcy, row, rightx, bottomy, origheight; 1211 UINT i, j, rowstart ;1330 UINT i, j, rowstart, origrows; 1212 1331 BOOL dobreak; 1213 1332 1214 1333 if (!(infoPtr->fStatus & BAND_NEEDS_LAYOUT)) { 1215 TRACE("no layout done. No band changed.\n");1216 REBAR_DumpBand (infoPtr);1217 return;1334 TRACE("no layout done. No band changed.\n"); 1335 REBAR_DumpBand (infoPtr); 1336 return; 1218 1337 } 1219 1338 infoPtr->fStatus &= ~BAND_NEEDS_LAYOUT; … … 1222 1341 GetClientRect (infoPtr->hwndSelf, &rcClient); 1223 1342 TRACE("Client is (%d,%d)-(%d,%d)\n", 1224 rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);1343 rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); 1225 1344 1226 1345 if (lpRect) { 1227 rcAdj = *lpRect;1228 TRACE("adjustment rect is (%d,%d)-(%d,%d)\n",1229 rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom);1346 rcAdj = *lpRect; 1347 TRACE("adjustment rect is (%d,%d)-(%d,%d)\n", 1348 rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom); 1230 1349 } 1231 1350 else { … … 1244 1363 1245 1364 if (!infoPtr->DoRedraw && (clientcx == 0) && (clientcy == 0)) { 1246 ERR("no redraw and client is zero, skip layout\n");1247 infoPtr->fStatus |= BAND_NEEDS_LAYOUT;1248 return;1365 ERR("no redraw and client is zero, skip layout\n"); 1366 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 1367 return; 1249 1368 } 1250 1369 1251 1370 /* save height of original control */ 1252 if (infoPtr->dwStyle & CCS_VERT) 1371 if (infoPtr->dwStyle & CCS_VERT) 1253 1372 origheight = infoPtr->calcSize.cx; 1254 1373 else 1255 1374 origheight = infoPtr->calcSize.cy; 1256 1375 origrows = infoPtr->uNumRows; 1376 1377 initx = 0; 1378 inity = 0; 1257 1379 1258 1380 /* ******* Start Phase 1 - all bands on row at minimum size ******* */ 1259 1381 1260 TRACE("band loop constants, clientcx=%d, clientcy=%d \n",1261 clientcx, clientcy);1262 x = 0;1263 y = 0;1382 TRACE("band loop constants, clientcx=%d, clientcy=%d, adjcx=%d, adjcy=%d\n", 1383 clientcx, clientcy, adjcx, adjcy); 1384 x = initx; 1385 y = inity; 1264 1386 row = 1; 1265 1387 cx = 0; … … 1269 1391 1270 1392 for (i = 0; i < infoPtr->uNumBands; i++) { 1271 lpBand = &infoPtr->bands[i]; 1272 lpBand->fDraw = 0; 1273 lpBand->iRow = row; 1274 1275 if (HIDDENBAND(lpBand)) continue; 1276 1277 lpBand->rcoldBand = lpBand->rcBand; 1278 1279 /* separator from previous band */ 1280 cxsep = ( ((infoPtr->dwStyle & CCS_VERT) ? y : x)==0) ? 0 : SEP_WIDTH; 1281 1282 /* Header: includes gripper, text, image */ 1283 cx = lpBand->cxHeader; 1284 if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx; 1285 1286 if (infoPtr->dwStyle & CCS_VERT) 1287 dobreak = (y + cx + cxsep > adjcy); 1393 lpBand = &infoPtr->bands[i]; 1394 lpBand->fDraw = 0; 1395 lpBand->iRow = row; 1396 1397 if (HIDDENBAND(lpBand)) continue; 1398 1399 lpBand->rcoldBand = lpBand->rcBand; 1400 1401 /* Set the offset of the child window */ 1402 if ((lpBand->fMask & RBBIM_CHILD) && 1403 !(lpBand->fStyle & RBBS_FIXEDSIZE)) { 1404 lpBand->offChild.cx = 4; /* ??? */ 1405 } 1406 lpBand->offChild.cy = ((lpBand->fStyle & RBBS_CHILDEDGE) ? 2 : 0); 1407 1408 /* separator from previous band */ 1409 cxsep = ( ((infoPtr->dwStyle & CCS_VERT) ? y==inity : x==initx)) ? 1410 0 : SEP_WIDTH; 1411 1412 /* Header: includes gripper, text, image */ 1413 cx = lpBand->cxHeader; 1414 if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx; 1415 1416 if (infoPtr->dwStyle & CCS_VERT) 1417 dobreak = (y + cx + cxsep > adjcy); 1288 1418 else 1289 dobreak = (x + cx + cxsep > adjcx); 1290 1291 /* This is the check for whether we need to start a new row */ 1292 if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) || 1293 ( ((infoPtr->dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) { 1294 1295 for (j = rowstart; j < i; j++) { 1296 REBAR_BAND *lpB; 1297 lpB = &infoPtr->bands[j]; 1298 if (infoPtr->dwStyle & CCS_VERT) { 1299 lpB->rcBand.right = lpB->rcBand.left + mcy; 1300 } 1301 else { 1302 lpB->rcBand.bottom = lpB->rcBand.top + mcy; 1303 } 1304 } 1305 1306 TRACE("Spliting to new row %d on band %u\n", row+1, i); 1307 if (infoPtr->dwStyle & CCS_VERT) { 1308 y = 0; 1309 x += (mcy + SEP_WIDTH); 1310 } 1311 else { 1312 x = 0; 1313 y += (mcy + SEP_WIDTH); 1314 } 1315 1316 mcy = 0; 1317 cxsep = 0; 1318 row++; 1319 lpBand->iRow = row; 1320 prevBand = NULL; 1321 rowstart = i; 1322 } 1323 1324 if (mcy < lpBand->lcy + REBARSPACE) mcy = lpBand->lcy + REBARSPACE; 1325 1326 /* if boundary rect specified then limit mcy */ 1327 if (lpRect) { 1328 if (infoPtr->dwStyle & CCS_VERT) { 1329 if (x+mcy > adjcx) { 1330 mcy = adjcx - x; 1331 TRACE("row %u limiting mcy=%d, adjcx=%d, x=%d\n", 1332 i, mcy, adjcx, x); 1333 } 1334 } 1335 else { 1336 if (y+mcy > adjcy) { 1337 mcy = adjcy - y; 1338 TRACE("row %u limiting mcy=%d, adjcy=%d, y=%d\n", 1339 i, mcy, adjcy, y); 1340 } 1341 } 1342 } 1343 1344 TRACE("band %u, row %d, x=%d, y=%d, cxsep=%d, cx=%d\n", 1345 i, row, 1346 x, y, cxsep, cx); 1347 if (infoPtr->dwStyle & CCS_VERT) { 1348 /* bound the bottom side if we have a bounding rectangle */ 1349 rightx = clientcx; 1350 bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx; 1351 lpBand->rcBand.left = x; 1352 lpBand->rcBand.right = x + min(mcy, lpBand->lcy+REBARSPACE); 1353 lpBand->rcBand.top = min(bottomy, y + cxsep); 1354 lpBand->rcBand.bottom = bottomy; 1355 lpBand->uMinHeight = lpBand->lcy; 1356 y = bottomy; 1357 } 1358 else { 1359 /* bound the right side if we have a bounding rectangle */ 1360 rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx; 1361 bottomy = clientcy; 1362 lpBand->rcBand.left = min(rightx, x + cxsep); 1363 lpBand->rcBand.right = rightx; 1364 lpBand->rcBand.top = y; 1365 lpBand->rcBand.bottom = y + min(mcy, lpBand->lcy+REBARSPACE); 1366 lpBand->uMinHeight = lpBand->lcy; 1367 x = rightx; 1368 } 1369 TRACE("band %u, row %d, (%d,%d)-(%d,%d)\n", 1370 i, row, 1371 lpBand->rcBand.left, lpBand->rcBand.top, 1372 lpBand->rcBand.right, lpBand->rcBand.bottom); 1373 prevBand = lpBand; 1419 dobreak = (x + cx + cxsep > adjcx); 1420 1421 /* This is the check for whether we need to start a new row */ 1422 if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) || 1423 ( ((infoPtr->dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) { 1424 1425 for (j = rowstart; j < i; j++) { 1426 REBAR_BAND *lpB; 1427 lpB = &infoPtr->bands[j]; 1428 if (infoPtr->dwStyle & CCS_VERT) { 1429 lpB->rcBand.right = lpB->rcBand.left + mcy; 1430 } 1431 else { 1432 lpB->rcBand.bottom = lpB->rcBand.top + mcy; 1433 } 1434 } 1435 1436 TRACE("P1 Spliting to new row %d on band %u\n", row+1, i); 1437 if (infoPtr->dwStyle & CCS_VERT) { 1438 y = inity; 1439 x += (mcy + SEP_WIDTH); 1440 } 1441 else { 1442 x = initx; 1443 y += (mcy + SEP_WIDTH); 1444 } 1445 1446 mcy = 0; 1447 cxsep = 0; 1448 row++; 1449 lpBand->iRow = row; 1450 prevBand = NULL; 1451 rowstart = i; 1452 } 1453 1454 if (mcy < lpBand->lcy + REBARSPACE(lpBand)) 1455 mcy = lpBand->lcy + REBARSPACE(lpBand); 1456 1457 /* if boundary rect specified then limit mcy */ 1458 if (lpRect) { 1459 if (infoPtr->dwStyle & CCS_VERT) { 1460 if (x+mcy > adjcx) { 1461 mcy = adjcx - x; 1462 TRACE("P1 row %u limiting mcy=%d, adjcx=%d, x=%d\n", 1463 i, mcy, adjcx, x); 1464 } 1465 } 1466 else { 1467 if (y+mcy > adjcy) { 1468 mcy = adjcy - y; 1469 TRACE("P1 row %u limiting mcy=%d, adjcy=%d, y=%d\n", 1470 i, mcy, adjcy, y); 1471 } 1472 } 1473 } 1474 1475 TRACE("P1 band %u, row %d, x=%d, y=%d, cxsep=%d, cx=%d\n", 1476 i, row, 1477 x, y, cxsep, cx); 1478 if (infoPtr->dwStyle & CCS_VERT) { 1479 /* bound the bottom side if we have a bounding rectangle */ 1480 rightx = clientcx; 1481 bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx; 1482 lpBand->rcBand.left = x; 1483 lpBand->rcBand.right = x + min(mcy, 1484 lpBand->lcy+REBARSPACE(lpBand)); 1485 lpBand->rcBand.top = min(bottomy, y + cxsep); 1486 lpBand->rcBand.bottom = bottomy; 1487 lpBand->uMinHeight = lpBand->lcy; 1488 y = bottomy; 1489 } 1490 else { 1491 /* bound the right side if we have a bounding rectangle */ 1492 rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx; 1493 bottomy = clientcy; 1494 lpBand->rcBand.left = min(rightx, x + cxsep); 1495 lpBand->rcBand.right = rightx; 1496 lpBand->rcBand.top = y; 1497 lpBand->rcBand.bottom = y + min(mcy, 1498 lpBand->lcy+REBARSPACE(lpBand)); 1499 lpBand->uMinHeight = lpBand->lcy; 1500 x = rightx; 1501 } 1502 TRACE("P1 band %u, row %d, (%d,%d)-(%d,%d)\n", 1503 i, row, 1504 lpBand->rcBand.left, lpBand->rcBand.top, 1505 lpBand->rcBand.right, lpBand->rcBand.bottom); 1506 prevBand = lpBand; 1374 1507 1375 1508 } /* for (i = 0; i < infoPtr->uNumBands... */ … … 1381 1514 1382 1515 for (j = rowstart; j < infoPtr->uNumBands; j++) { 1383 lpBand = &infoPtr->bands[j];1384 if (infoPtr->dwStyle & CCS_VERT) {1385 lpBand->rcBand.right = lpBand->rcBand.left + mcy;1386 }1387 else {1388 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;1389 }1516 lpBand = &infoPtr->bands[j]; 1517 if (infoPtr->dwStyle & CCS_VERT) { 1518 lpBand->rcBand.right = lpBand->rcBand.left + mcy; 1519 } 1520 else { 1521 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy; 1522 } 1390 1523 } 1391 1524 … … 1400 1533 mmcy = 0; 1401 1534 if (!(infoPtr->dwStyle & RBS_VARHEIGHT)) { 1402 INT xy;1403 1404 /* get the max height of all bands */1405 for (i=0; i<infoPtr->uNumBands; i++) {1406 lpBand = &infoPtr->bands[i];1407 if (HIDDENBAND(lpBand)) continue;1408 if (infoPtr->dwStyle & CCS_VERT)1409 mmcy = max(mmcy, lpBand->rcBand.right - lpBand->rcBand.left);1410 else1411 mmcy = max(mmcy, lpBand->rcBand.bottom - lpBand->rcBand.top);1412 }1413 1414 /* now adjust all rectangles by using the height found above */1415 xy = 0;1416 row = 1;1417 for (i=0; i<infoPtr->uNumBands; i++) {1418 lpBand = &infoPtr->bands[i];1419 if (HIDDENBAND(lpBand)) continue;1420 if (lpBand->iRow != row)1421 xy += (mmcy + SEP_WIDTH);1422 if (infoPtr->dwStyle & CCS_VERT) {1423 lpBand->rcBand.left = xy;1424 lpBand->rcBand.right = xy + mmcy;1425 }1426 else {1427 lpBand->rcBand.top = xy;1428 lpBand->rcBand.bottom = xy + mmcy;1429 }1430 }1431 1432 /* set the x/y values to the correct maximum */1433 if (infoPtr->dwStyle & CCS_VERT)1434 x = xy + mmcy;1435 else1436 y = xy + mmcy;1535 INT xy; 1536 1537 /* get the max height of all bands */ 1538 for (i=0; i<infoPtr->uNumBands; i++) { 1539 lpBand = &infoPtr->bands[i]; 1540 if (HIDDENBAND(lpBand)) continue; 1541 if (infoPtr->dwStyle & CCS_VERT) 1542 mmcy = max(mmcy, lpBand->rcBand.right - lpBand->rcBand.left); 1543 else 1544 mmcy = max(mmcy, lpBand->rcBand.bottom - lpBand->rcBand.top); 1545 } 1546 1547 /* now adjust all rectangles by using the height found above */ 1548 xy = 0; 1549 row = 1; 1550 for (i=0; i<infoPtr->uNumBands; i++) { 1551 lpBand = &infoPtr->bands[i]; 1552 if (HIDDENBAND(lpBand)) continue; 1553 if (lpBand->iRow != row) 1554 xy += (mmcy + SEP_WIDTH); 1555 if (infoPtr->dwStyle & CCS_VERT) { 1556 lpBand->rcBand.left = xy; 1557 lpBand->rcBand.right = xy + mmcy; 1558 } 1559 else { 1560 lpBand->rcBand.top = xy; 1561 lpBand->rcBand.bottom = xy + mmcy; 1562 } 1563 } 1564 1565 /* set the x/y values to the correct maximum */ 1566 if (infoPtr->dwStyle & CCS_VERT) 1567 x = xy + mmcy; 1568 else 1569 y = xy + mmcy; 1437 1570 } 1438 1571 … … 1446 1579 if (lpRect) { 1447 1580 INT i, j, prev_rh, new_rh, adj_rh, prev_idx, current_idx; 1448 REBAR_BAND *prev, *current, *walk;1581 REBAR_BAND *prev, *current, *walk; 1449 1582 1450 1583 /* FIXME: problem # 2 */ 1451 if (((infoPtr->dwStyle & CCS_VERT) ? 1584 if (((infoPtr->dwStyle & CCS_VERT) ? 1452 1585 #if PROBLEM2 1453 (x < adjcx) : (y < adjcy)1586 (x < adjcx) : (y < adjcy) 1454 1587 #else 1455 (adjcx - x > 4) : (adjcy - y > 4)1588 (adjcx - x > 4) : (adjcy - y > 4) 1456 1589 #endif 1457 ) &&1458 (infoPtr->uNumBands > 1)) {1459 for (i=(INT)infoPtr->uNumBands-2; i>=0; i--) {1460 TRACE("adjcx=%d, adjcy=%d, x=%d, y=%d\n",1461 adjcx, adjcy, x, y);1462 1463 /* find the current band (starts at i+1) */1464 current = &infoPtr->bands[i+1];1465 current_idx = i+1;1466 while (HIDDENBAND(current)) {1467 i--;1468 if (i < 0) break; /* out of bands */1469 current = &infoPtr->bands[i+1];1470 current_idx = i+1;1471 }1472 if (i < 0) break; /* out of bands */1473 1474 /* now find the prev band (starts at i) */1475 prev = &infoPtr->bands[i];1476 prev_idx = i;1477 while (HIDDENBAND(prev)) {1478 i--;1479 if (i < 0) break; /* out of bands */1480 prev = &infoPtr->bands[i];1481 prev_idx = i;1482 }1483 if (i < 0) break; /* out of bands */1484 1485 prev_rh = ircBw(prev);1486 if (prev->iRow == current->iRow) {1487 new_rh = (infoPtr->dwStyle & RBS_VARHEIGHT) ?1488 current->lcy + REBARSPACE:1489 mmcy;1490 adj_rh = new_rh + SEP_WIDTH;1491 infoPtr->uNumRows++;1492 current->fDraw |= NTF_INVALIDATE;1493 current->iRow++;1494 if (infoPtr->dwStyle & CCS_VERT) {1495 current->rcBand.top = 0;1496 current->rcBand.bottom = clientcy;1497 current->rcBand.left += (prev_rh + SEP_WIDTH);1498 current->rcBand.right = current->rcBand.left + new_rh;1499 x += adj_rh;1500 }1501 else {1502 current->rcBand.left = 0;1503 current->rcBand.right = clientcx;1504 current->rcBand.top += (prev_rh + SEP_WIDTH);1505 current->rcBand.bottom = current->rcBand.top + new_rh;1506 y += adj_rh;1507 }1508 TRACE("moving band %d to own row at (%d,%d)-(%d,%d)\n",1509 current_idx,1510 current->rcBand.left, current->rcBand.top,1511 current->rcBand.right, current->rcBand.bottom);1512 TRACE("prev band %d at (%d,%d)-(%d,%d)\n",1513 prev_idx,1514 prev->rcBand.left, prev->rcBand.top,1515 prev->rcBand.right, prev->rcBand.bottom);1516 TRACE("values: prev_rh=%d, new_rh=%d, adj_rh=%d\n",1517 prev_rh, new_rh, adj_rh);1518 /* for bands below current adjust row # and top/bottom */1519 for (j = current_idx+1; j<infoPtr->uNumBands; j++) {1520 walk = &infoPtr->bands[j];1521 if (HIDDENBAND(walk)) continue;1522 walk->fDraw |= NTF_INVALIDATE;1523 walk->iRow++;1524 if (infoPtr->dwStyle & CCS_VERT) {1525 walk->rcBand.left += adj_rh;1526 walk->rcBand.right += adj_rh;1527 }1528 else {1529 walk->rcBand.top += adj_rh;1530 walk->rcBand.bottom += adj_rh;1531 }1532 }1533 if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy)) 1534 break; /* all done */1535 }1536 }1537 }1590 ) && 1591 (infoPtr->uNumBands > 1)) { 1592 for (i=(INT)infoPtr->uNumBands-2; i>=0; i--) { 1593 TRACE("P2 adjcx=%d, adjcy=%d, x=%d, y=%d\n", 1594 adjcx, adjcy, x, y); 1595 1596 /* find the current band (starts at i+1) */ 1597 current = &infoPtr->bands[i+1]; 1598 current_idx = i+1; 1599 while (HIDDENBAND(current)) { 1600 i--; 1601 if (i < 0) break; /* out of bands */ 1602 current = &infoPtr->bands[i+1]; 1603 current_idx = i+1; 1604 } 1605 if (i < 0) break; /* out of bands */ 1606 1607 /* now find the prev band (starts at i) */ 1608 prev = &infoPtr->bands[i]; 1609 prev_idx = i; 1610 while (HIDDENBAND(prev)) { 1611 i--; 1612 if (i < 0) break; /* out of bands */ 1613 prev = &infoPtr->bands[i]; 1614 prev_idx = i; 1615 } 1616 if (i < 0) break; /* out of bands */ 1617 1618 prev_rh = ircBw(prev); 1619 if (prev->iRow == current->iRow) { 1620 new_rh = (infoPtr->dwStyle & RBS_VARHEIGHT) ? 1621 current->lcy + REBARSPACE(current) : 1622 mmcy; 1623 adj_rh = new_rh + SEP_WIDTH; 1624 infoPtr->uNumRows++; 1625 current->fDraw |= NTF_INVALIDATE; 1626 current->iRow++; 1627 if (infoPtr->dwStyle & CCS_VERT) { 1628 current->rcBand.top = inity; 1629 current->rcBand.bottom = clientcy; 1630 current->rcBand.left += (prev_rh + SEP_WIDTH); 1631 current->rcBand.right = current->rcBand.left + new_rh; 1632 x += adj_rh; 1633 } 1634 else { 1635 current->rcBand.left = initx; 1636 current->rcBand.right = clientcx; 1637 current->rcBand.top += (prev_rh + SEP_WIDTH); 1638 current->rcBand.bottom = current->rcBand.top + new_rh; 1639 y += adj_rh; 1640 } 1641 TRACE("P2 moving band %d to own row at (%d,%d)-(%d,%d)\n", 1642 current_idx, 1643 current->rcBand.left, current->rcBand.top, 1644 current->rcBand.right, current->rcBand.bottom); 1645 TRACE("P2 prev band %d at (%d,%d)-(%d,%d)\n", 1646 prev_idx, 1647 prev->rcBand.left, prev->rcBand.top, 1648 prev->rcBand.right, prev->rcBand.bottom); 1649 TRACE("P2 values: prev_rh=%d, new_rh=%d, adj_rh=%d\n", 1650 prev_rh, new_rh, adj_rh); 1651 /* for bands below current adjust row # and top/bottom */ 1652 for (j = current_idx+1; j<infoPtr->uNumBands; j++) { 1653 walk = &infoPtr->bands[j]; 1654 if (HIDDENBAND(walk)) continue; 1655 walk->fDraw |= NTF_INVALIDATE; 1656 walk->iRow++; 1657 if (infoPtr->dwStyle & CCS_VERT) { 1658 walk->rcBand.left += adj_rh; 1659 walk->rcBand.right += adj_rh; 1660 } 1661 else { 1662 walk->rcBand.top += adj_rh; 1663 walk->rcBand.bottom += adj_rh; 1664 } 1665 } 1666 if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy)) 1667 break; /* all done */ 1668 } 1669 } 1670 } 1538 1671 } 1539 1672 … … 1541 1674 1542 1675 1543 /* ******* Start Phase 2a - adjust all bands for height full ******* */ 1676 /* ******* Start Phase 2a - create array of start and end ******* */ 1677 /* indexes by row */ 1678 1679 if (infoPtr->uNumRows != origrows) { 1680 if (infoPtr->rows) COMCTL32_Free (infoPtr->rows); 1681 infoPtr->rows = COMCTL32_Alloc (sizeof (REBAR_ROW) * infoPtr->uNumRows); 1682 } 1683 1684 row = 0; 1685 for (i = 0; i < infoPtr->uNumBands; i++) { 1686 lpBand = &infoPtr->bands[i]; 1687 if (HIDDENBAND(lpBand)) continue; 1688 1689 if (lpBand->iRow > row) { 1690 row++; 1691 infoPtr->rows[row-1].istartband = i; 1692 } 1693 if (row == 0) { 1694 ERR("P2a bug!!!!!!\n"); 1695 } 1696 infoPtr->rows[row-1].iendband = i; 1697 } 1698 1699 for (i = 0; i < infoPtr->uNumRows; i++) { 1700 REBAR_ROW *p; 1701 1702 p = &infoPtr->rows[i]; 1703 TRACE("P2a row %d, starts %d, ends %d\n", 1704 i+1, p->istartband, p->iendband); 1705 } 1706 1707 /* ******* End Phase 2a - create array of start and end ******* */ 1708 /* indexes by row */ 1709 1710 1711 /* ******* Start Phase 2b - adjust all bands for height full ******* */ 1544 1712 /* assumes that the following variables contain: */ 1545 1713 /* y/x current height/width of all rows */ 1546 1714 /* clientcy/clientcx height/width of client area */ 1547 1715 1548 /* **** FIXME FIXME FIXME1549 * this does not take into account that more than one band1550 * is in a row!!!!!!!!!1551 */1552 1553 1716 if (((infoPtr->dwStyle & CCS_VERT) ? clientcx > x : clientcy > y) && 1554 infoPtr->uNumBands) { 1555 INT diff, i, j; 1556 1557 diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y; 1558 for (i = infoPtr->uNumBands-1; i >= 0; i--) { 1559 lpBand = &infoPtr->bands[i]; 1560 if(HIDDENBAND(lpBand)) continue; 1561 if (!lpBand->fMask & RBBS_VARIABLEHEIGHT) continue; 1562 if (((INT)lpBand->cyMaxChild < 1) || 1563 ((INT)lpBand->cyIntegral < 1)) { 1564 if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue; 1565 ERR("band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n", 1566 i, lpBand->cyMaxChild, lpBand->cyIntegral); 1567 continue; 1568 } 1569 /* j is now the maximum height/width in the client area */ 1570 j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) + 1571 ircBw(lpBand); 1572 if (j > lpBand->cyMaxChild + REBARSPACE) 1573 j = lpBand->cyMaxChild + REBARSPACE; 1574 diff -= (j - ircBw(lpBand)); 1575 if (infoPtr->dwStyle & CCS_VERT) 1576 lpBand->rcBand.right = lpBand->rcBand.left + j; 1577 else 1578 lpBand->rcBand.bottom = lpBand->rcBand.top + j; 1579 TRACE("P2a band %d, row %d changed to (%d,%d)-(%d,%d)\n", 1580 i, lpBand->iRow, 1581 lpBand->rcBand.left, lpBand->rcBand.top, 1582 lpBand->rcBand.right, lpBand->rcBand.bottom); 1583 if (diff <= 0) break; 1584 } 1585 if (diff < 0) { 1586 ERR("allocated more than available, diff=%d\n", diff); 1587 diff = 0; 1588 } 1589 if (infoPtr->dwStyle & CCS_VERT) 1590 x = clientcx - diff; 1591 else 1592 y = clientcy - diff; 1593 } 1594 1595 /* ******* End Phase 2a - adjust all bands for height full ******* */ 1717 infoPtr->uNumBands) { 1718 INT diff, i, iband, j; 1719 1720 diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y; 1721 for (i = infoPtr->uNumRows; i >= 1; i--) { 1722 /* if row has more than 1 band, ignore row */ 1723 if (infoPtr->rows[i-1].istartband != infoPtr->rows[i-1].iendband) 1724 continue; 1725 /* point to only band in row */ 1726 iband = infoPtr->rows[i-1].istartband; 1727 lpBand = &infoPtr->bands[iband]; 1728 if(HIDDENBAND(lpBand)) continue; 1729 if (!lpBand->fMask & RBBS_VARIABLEHEIGHT) continue; 1730 if (((INT)lpBand->cyMaxChild < 1) || 1731 ((INT)lpBand->cyIntegral < 1)) { 1732 if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue; 1733 ERR("P2b band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n", 1734 iband, lpBand->cyMaxChild, lpBand->cyIntegral); 1735 continue; 1736 } 1737 /* j is now the maximum height/width in the client area */ 1738 j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) + 1739 ircBw(lpBand); 1740 if (j > lpBand->cyMaxChild + REBARSPACE(lpBand)) 1741 j = lpBand->cyMaxChild + REBARSPACE(lpBand); 1742 diff -= (j - ircBw(lpBand)); 1743 if (infoPtr->dwStyle & CCS_VERT) 1744 lpBand->rcBand.right = lpBand->rcBand.left + j; 1745 else 1746 lpBand->rcBand.bottom = lpBand->rcBand.top + j; 1747 TRACE("P2b band %d, row %d changed to (%d,%d)-(%d,%d)\n", 1748 iband, lpBand->iRow, 1749 lpBand->rcBand.left, lpBand->rcBand.top, 1750 lpBand->rcBand.right, lpBand->rcBand.bottom); 1751 if (diff <= 0) break; 1752 } 1753 if (diff < 0) { 1754 ERR("P2b allocated more than available, diff=%d\n", diff); 1755 diff = 0; 1756 } 1757 if (infoPtr->dwStyle & CCS_VERT) 1758 x = clientcx - diff; 1759 else 1760 y = clientcy - diff; 1761 } 1762 1763 /* ******* End Phase 2b - adjust all bands for height full ******* */ 1596 1764 1597 1765 … … 1599 1767 1600 1768 if (infoPtr->uNumBands) { 1601 INT bandnum, bandnum_start, bandnum_end; 1602 1603 /* If RBS_BANDBORDERS set then indicate to draw bottom separator */ 1604 /* on all bands in all rows but last row. */ 1605 /* Also indicate to draw the right separator for each band in */ 1606 /* each row but the rightmost band. */ 1607 if (infoPtr->dwStyle & RBS_BANDBORDERS) { 1608 REBAR_BAND *prevband; 1609 INT currow; 1610 1611 prevband = NULL; 1612 currow = -1; 1613 for (i = 0; i < infoPtr->uNumBands; i++) { 1614 lpBand = &infoPtr->bands[i]; 1615 if (HIDDENBAND(lpBand)) continue; 1616 1617 if (lpBand->iRow < infoPtr->uNumRows) 1618 lpBand->fDraw |= DRAW_BOTTOMSEP; 1619 1620 if (lpBand->iRow != currow) prevband = NULL; 1621 currow = lpBand->iRow; 1622 if (prevband) prevband->fDraw |= DRAW_RIGHTSEP; 1623 prevband = lpBand; 1624 } 1625 } 1626 1627 /* Distribute the extra space on the horizontal and adjust */ 1628 /* all bands in row to same height. */ 1629 bandnum = 0; 1630 for (i=1; i<=infoPtr->uNumRows; i++) { 1631 bandnum_start = -1; 1632 bandnum_end = -1; 1633 mcy = 0; 1634 TRACE("processing row %d, starting band %d\n", i, bandnum); 1635 while (TRUE) { 1636 lpBand = &infoPtr->bands[bandnum]; 1637 if ((bandnum >= infoPtr->uNumBands) || 1638 ((lpBand->iRow != i) && 1639 !HIDDENBAND(lpBand))) { 1640 if ((bandnum_start == -1) || 1641 (bandnum_end == -1)) { 1642 ERR("logic error? bands=%d, rows=%d, start=%d, end=%d\n", 1643 infoPtr->uNumBands, infoPtr->uNumRows, 1644 (INT)bandnum_start, (INT)bandnum_end); 1645 ERR(" current row=%d, band=%d\n", 1646 i, bandnum); 1647 break; 1648 } 1649 REBAR_AdjustBands (infoPtr, bandnum_start, bandnum_end, 1650 (infoPtr->dwStyle & CCS_VERT) ? 1651 clientcy : clientcx, mcy); 1652 break; 1653 } 1654 if (!HIDDENBAND(lpBand)) { 1655 if (bandnum_start == -1) bandnum_start = bandnum; 1656 if (bandnum_end < bandnum) bandnum_end = bandnum; 1657 if (mcy < ircBw(lpBand)) 1658 mcy = ircBw(lpBand); 1659 } 1660 bandnum++; 1661 TRACE("point 1, bandnum=%d\n", bandnum); 1662 } 1663 TRACE("point 2, i=%d, numrows=%d, bandnum=%d\n", 1664 i, infoPtr->uNumRows, bandnum); 1665 } 1666 TRACE("point 3\n"); 1667 1668 /* Calculate the other rectangles in each band */ 1669 if (infoPtr->dwStyle & CCS_VERT) { 1670 REBAR_CalcVertBand (infoPtr, 0, infoPtr->uNumBands, 1671 notify); 1672 } 1673 else { 1674 REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands, 1675 notify); 1676 } 1769 REBAR_ROW *p; 1770 1771 /* If RBS_BANDBORDERS set then indicate to draw bottom separator */ 1772 /* on all bands in all rows but last row. */ 1773 /* Also indicate to draw the right separator for each band in */ 1774 /* each row but the rightmost band. */ 1775 if (infoPtr->dwStyle & RBS_BANDBORDERS) { 1776 1777 for(i = 0; i < infoPtr->uNumRows; i++) { 1778 p = &infoPtr->rows[i]; 1779 for (j = p->istartband; j <= p->iendband; j++) { 1780 lpBand = &infoPtr->bands[j]; 1781 if (HIDDENBAND(lpBand)) continue; 1782 if (j != p->iendband) 1783 lpBand->fDraw |= DRAW_RIGHTSEP; 1784 if (i != infoPtr->uNumRows-1) 1785 lpBand->fDraw |= DRAW_BOTTOMSEP; 1786 } 1787 } 1788 } 1789 1790 /* Distribute the extra space on the horizontal and adjust */ 1791 /* all bands in row to same height. */ 1792 for (i=1; i<=infoPtr->uNumRows; i++) { 1793 p = &infoPtr->rows[i-1]; 1794 mcy = 0; 1795 1796 TRACE("P3 processing row %d, starting band %d, ending band %d\n", 1797 i, p->istartband, p->iendband); 1798 1799 /* Find the largest height of the bands in the row */ 1800 for (j = p->istartband; j <= p->iendband; j++) { 1801 lpBand = &infoPtr->bands[j]; 1802 if (HIDDENBAND(lpBand)) continue; 1803 if (mcy < ircBw(lpBand)) 1804 mcy = ircBw(lpBand); 1805 } 1806 1807 REBAR_AdjustBands (infoPtr, p->istartband, p->iendband, 1808 (infoPtr->dwStyle & CCS_VERT) ? 1809 clientcy : clientcx, mcy); 1810 } 1811 1812 /* Calculate the other rectangles in each band */ 1813 if (infoPtr->dwStyle & CCS_VERT) { 1814 REBAR_CalcVertBand (infoPtr, 0, infoPtr->uNumBands, 1815 notify); 1816 } 1817 else { 1818 REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands, 1819 notify); 1820 } 1677 1821 } 1678 1822 … … 1681 1825 /* now compute size of Rebar itself */ 1682 1826 infoPtr->oldSize = infoPtr->calcSize; 1827 if (infoPtr->uNumBands == 0) { 1828 /* we have no bands, so make size the size of client */ 1829 x = clientcx; 1830 y = clientcy; 1831 } 1683 1832 if (infoPtr->dwStyle & CCS_VERT) { 1684 infoPtr->calcSize.cx = x;1685 infoPtr->calcSize.cy = clientcy;1686 TRACE("vert, notify=%d, x=%d, origheight=%d\n",1687 notify, x, origheight);1688 if (notify && (x != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;1833 infoPtr->calcSize.cx = x; 1834 infoPtr->calcSize.cy = clientcy; 1835 TRACE("vert, notify=%d, x=%d, origheight=%d\n", 1836 notify, x, origheight); 1837 if (notify && (x != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1689 1838 } 1690 1839 else { 1691 infoPtr->calcSize.cx = clientcx;1692 infoPtr->calcSize.cy = y;1693 TRACE("horz, notify=%d, y=%d, origheight=%d\n",1694 notify, y, origheight);1695 if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1840 infoPtr->calcSize.cx = clientcx; 1841 infoPtr->calcSize.cy = y; 1842 TRACE("horz, notify=%d, y=%d, origheight=%d\n", 1843 notify, y, origheight); 1844 if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1696 1845 } 1697 1846 … … 1750 1899 /* calculate gripper rectangle */ 1751 1900 if ( (!(lpBand->fStyle & RBBS_NOGRIPPER)) && 1752 ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) || 1753 ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (infoPtr->uNumBands > 1)))1901 ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) || 1902 ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (infoPtr->uNumBands > 1))) 1754 1903 ) { 1755 lpBand->fStatus |= HAS_GRIPPER;1904 lpBand->fStatus |= HAS_GRIPPER; 1756 1905 if (infoPtr->dwStyle & CCS_VERT) 1757 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER)1906 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) 1758 1907 header += (GRIPPER_HEIGHT + REBAR_PRE_GRIPPER); 1759 1908 else 1760 header += (GRIPPER_WIDTH + REBAR_PRE_GRIPPER);1909 header += (GRIPPER_WIDTH + REBAR_PRE_GRIPPER); 1761 1910 else 1762 1911 header += (REBAR_PRE_GRIPPER + GRIPPER_WIDTH); … … 1767 1916 /* image is visible */ 1768 1917 if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) { 1769 lpBand->fStatus |= HAS_IMAGE;1918 lpBand->fStatus |= HAS_IMAGE; 1770 1919 if (infoPtr->dwStyle & CCS_VERT) { 1771 header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE);1772 lpBand->lcy = infoPtr->imageSize.cx + 2;1773 }1774 else {1775 header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE);1776 lpBand->lcy = infoPtr->imageSize.cy + 2;1777 }1920 header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE); 1921 lpBand->lcy = infoPtr->imageSize.cx + 2; 1922 } 1923 else { 1924 header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE); 1925 lpBand->lcy = infoPtr->imageSize.cy + 2; 1926 } 1778 1927 } 1779 1928 1780 1929 /* text is visible */ 1781 1930 if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText)) { 1782 HDC hdc = GetDC (0);1783 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);1784 SIZE size;1785 1786 lpBand->fStatus |= HAS_TEXT;1787 GetTextExtentPoint32W (hdc, lpBand->lpText,1788 lstrlenW (lpBand->lpText), &size);1789 header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT));1790 textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy;1791 1792 SelectObject (hdc, hOldFont);1793 ReleaseDC (0, hdc);1931 HDC hdc = GetDC (0); 1932 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); 1933 SIZE size; 1934 1935 lpBand->fStatus |= HAS_TEXT; 1936 GetTextExtentPoint32W (hdc, lpBand->lpText, 1937 lstrlenW (lpBand->lpText), &size); 1938 header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT)); 1939 textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy; 1940 1941 SelectObject (hdc, hOldFont); 1942 ReleaseDC (0, hdc); 1794 1943 } 1795 1944 1796 1945 /* if no gripper but either image or text, then leave space */ 1797 1946 if ((lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) && 1798 !(lpBand->fStatus & HAS_GRIPPER)) {1799 header += REBAR_ALWAYS_SPACE;1947 !(lpBand->fStatus & HAS_GRIPPER)) { 1948 header += REBAR_ALWAYS_SPACE; 1800 1949 } 1801 1950 … … 1811 1960 lpBand->ccy = lpBand->lcy; 1812 1961 if (lpBand->fMask & RBBIM_CHILDSIZE) { 1813 if (!(lpBand->fStyle & RBBS_FIXEDSIZE)) {1814 lpBand->offChild.cx = 4;1815 lpBand->offChild.cy = 2;1816 }1817 1962 lpBand->lcx = lpBand->cxMinChild; 1818 1963 1819 /* Set the .cy values for CHILDSIZE case */1964 /* Set the .cy values for CHILDSIZE case */ 1820 1965 lpBand->lcy = max(lpBand->lcy, lpBand->cyMinChild); 1821 lpBand->ccy = lpBand->lcy;1966 lpBand->ccy = lpBand->lcy; 1822 1967 lpBand->hcy = lpBand->lcy; 1823 1968 if (lpBand->cyMaxChild != 0xffffffff) { 1824 lpBand->hcy = lpBand->cyMaxChild;1969 lpBand->hcy = lpBand->cyMaxChild; 1825 1970 } 1826 if (lpBand->cyChild != 0xffffffff)1827 lpBand->ccy = max (lpBand->cyChild, lpBand->lcy);1971 if (lpBand->cyChild != 0xffffffff) 1972 lpBand->ccy = max (lpBand->cyChild, lpBand->lcy); 1828 1973 1829 1974 TRACE("_CHILDSIZE\n"); … … 1852 1997 1853 1998 if (lprbbi->fMask & RBBIM_STYLE) 1854 lpBand->fStyle = lprbbi->fStyle;1999 lpBand->fStyle = lprbbi->fStyle; 1855 2000 1856 2001 if (lprbbi->fMask & RBBIM_COLORS) { 1857 lpBand->clrFore = lprbbi->clrFore;1858 lpBand->clrBack = lprbbi->clrBack;2002 lpBand->clrFore = lprbbi->clrFore; 2003 lpBand->clrBack = lprbbi->clrBack; 1859 2004 } 1860 2005 1861 2006 if (lprbbi->fMask & RBBIM_IMAGE) 1862 lpBand->iImage = lprbbi->iImage;2007 lpBand->iImage = lprbbi->iImage; 1863 2008 1864 2009 if (lprbbi->fMask & RBBIM_CHILD) { 1865 if (lprbbi->hwndChild) {1866 lpBand->hwndChild = lprbbi->hwndChild;1867 lpBand->hwndPrevParent =1868 SetParent (lpBand->hwndChild, hwnd);1869 /* below in trace fro WinRAR */1870 ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL);1871 /* above in trace fro WinRAR */1872 }1873 else {1874 TRACE("child: 0x%x prev parent: 0x%x\n",1875 lpBand->hwndChild, lpBand->hwndPrevParent);1876 lpBand->hwndChild = 0;1877 lpBand->hwndPrevParent = 0;1878 }2010 if (lprbbi->hwndChild) { 2011 lpBand->hwndChild = lprbbi->hwndChild; 2012 lpBand->hwndPrevParent = 2013 SetParent (lpBand->hwndChild, hwnd); 2014 /* below in trace fro WinRAR */ 2015 ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL); 2016 /* above in trace fro WinRAR */ 2017 } 2018 else { 2019 TRACE("child: 0x%x prev parent: 0x%x\n", 2020 lpBand->hwndChild, lpBand->hwndPrevParent); 2021 lpBand->hwndChild = 0; 2022 lpBand->hwndPrevParent = 0; 2023 } 1879 2024 } 1880 2025 1881 2026 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 1882 lpBand->cxMinChild = lprbbi->cxMinChild;1883 lpBand->cyMinChild = lprbbi->cyMinChild;1884 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {1885 lpBand->cyChild = lprbbi->cyChild;1886 lpBand->cyMaxChild = lprbbi->cyMaxChild;1887 lpBand->cyIntegral = lprbbi->cyIntegral;1888 }1889 else { /* special case - these should be zeroed out since */1890 /* RBBIM_CHILDSIZE added these in WIN32_IE >= 0x0400 */1891 lpBand->cyChild = 0;1892 lpBand->cyMaxChild = 0;1893 lpBand->cyIntegral = 0;1894 }2027 lpBand->cxMinChild = lprbbi->cxMinChild; 2028 lpBand->cyMinChild = lprbbi->cyMinChild; 2029 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 2030 lpBand->cyChild = lprbbi->cyChild; 2031 lpBand->cyMaxChild = lprbbi->cyMaxChild; 2032 lpBand->cyIntegral = lprbbi->cyIntegral; 2033 } 2034 else { /* special case - these should be zeroed out since */ 2035 /* RBBIM_CHILDSIZE added these in WIN32_IE >= 0x0400 */ 2036 lpBand->cyChild = 0; 2037 lpBand->cyMaxChild = 0; 2038 lpBand->cyIntegral = 0; 2039 } 1895 2040 } 1896 2041 1897 2042 if (lprbbi->fMask & RBBIM_SIZE) 1898 lpBand->cx = lprbbi->cx;2043 lpBand->cx = lprbbi->cx; 1899 2044 1900 2045 if (lprbbi->fMask & RBBIM_BACKGROUND) 1901 lpBand->hbmBack = lprbbi->hbmBack;2046 lpBand->hbmBack = lprbbi->hbmBack; 1902 2047 1903 2048 if (lprbbi->fMask & RBBIM_ID) 1904 lpBand->wID = lprbbi->wID;2049 lpBand->wID = lprbbi->wID; 1905 2050 1906 2051 /* check for additional data */ 1907 2052 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 1908 if (lprbbi->fMask & RBBIM_IDEALSIZE)1909 lpBand->cxIdeal = lprbbi->cxIdeal;1910 1911 if (lprbbi->fMask & RBBIM_LPARAM)1912 lpBand->lParam = lprbbi->lParam;1913 1914 if (lprbbi->fMask & RBBIM_HEADERSIZE)1915 lpBand->cxHeader = lprbbi->cxHeader;2053 if (lprbbi->fMask & RBBIM_IDEALSIZE) 2054 lpBand->cxIdeal = lprbbi->cxIdeal; 2055 2056 if (lprbbi->fMask & RBBIM_LPARAM) 2057 lpBand->lParam = lprbbi->lParam; 2058 2059 if (lprbbi->fMask & RBBIM_HEADERSIZE) 2060 lpBand->cxHeader = lprbbi->cxHeader; 1916 2061 } 1917 2062 } … … 1933 2078 for(i=0; i<infoPtr->uNumBands; i++) { 1934 2079 lpBand = &infoPtr->bands[i]; 1935 if (HIDDENBAND(lpBand)) continue; 1936 1937 /* draw band separator between rows */ 1938 if (lpBand->iRow != oldrow) { 1939 oldrow = lpBand->iRow; 1940 if (lpBand->fDraw & DRAW_BOTTOMSEP) { 1941 RECT rcRowSep; 1942 rcRowSep = lpBand->rcBand; 1943 if (infoPtr->dwStyle & CCS_VERT) { 1944 rcRowSep.right += SEP_WIDTH_SIZE; 1945 rcRowSep.bottom = infoPtr->calcSize.cy; 1946 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT); 1947 } 1948 else { 1949 rcRowSep.bottom += SEP_WIDTH_SIZE; 1950 rcRowSep.right = infoPtr->calcSize.cx; 1951 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM); 1952 } 1953 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n", 1954 rcRowSep.left, rcRowSep.top, 1955 rcRowSep.right, rcRowSep.bottom); 1956 } 1957 } 1958 1959 /* draw band separator between bands in a row */ 1960 if (lpBand->fDraw & DRAW_RIGHTSEP) { 1961 RECT rcSep; 1962 rcSep = lpBand->rcBand; 1963 if (infoPtr->dwStyle & CCS_VERT) { 1964 rcSep.bottom += SEP_WIDTH_SIZE; 1965 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM); 1966 } 1967 else { 1968 rcSep.right += SEP_WIDTH_SIZE; 1969 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT); 1970 } 1971 TRACE("drawing band separator right (%d,%d)-(%d,%d)\n", 1972 rcSep.left, rcSep.top, rcSep.right, rcSep.bottom); 1973 } 1974 1975 /* draw the actual background */ 1976 if (lpBand->clrBack != CLR_NONE) 1977 new = lpBand->clrBack; 1978 else 1979 new = infoPtr->clrBtnFace; 1980 rect = lpBand->rcBand; 1981 old = SetBkColor (hdc, new); 1982 TRACE("%s backround color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", 1983 (lpBand->clrBack == CLR_NONE) ? "std" : "", 1984 new, 1985 lpBand->rcBand.left,lpBand->rcBand.top, 1986 lpBand->rcBand.right,lpBand->rcBand.bottom, 1987 clip->left, clip->top, 1988 clip->right, clip->bottom); 1989 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); 1990 SetBkColor (hdc, old); 2080 if (HIDDENBAND(lpBand)) continue; 2081 2082 /* draw band separator between rows */ 2083 if (lpBand->iRow != oldrow) { 2084 oldrow = lpBand->iRow; 2085 if (lpBand->fDraw & DRAW_BOTTOMSEP) { 2086 RECT rcRowSep; 2087 rcRowSep = lpBand->rcBand; 2088 if (infoPtr->dwStyle & CCS_VERT) { 2089 rcRowSep.right += SEP_WIDTH_SIZE; 2090 rcRowSep.bottom = infoPtr->calcSize.cy; 2091 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT); 2092 } 2093 else { 2094 rcRowSep.bottom += SEP_WIDTH_SIZE; 2095 rcRowSep.right = infoPtr->calcSize.cx; 2096 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM); 2097 } 2098 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n", 2099 rcRowSep.left, rcRowSep.top, 2100 rcRowSep.right, rcRowSep.bottom); 2101 } 2102 } 2103 2104 /* draw band separator between bands in a row */ 2105 if (lpBand->fDraw & DRAW_RIGHTSEP) { 2106 RECT rcSep; 2107 rcSep = lpBand->rcBand; 2108 if (infoPtr->dwStyle & CCS_VERT) { 2109 rcSep.bottom += SEP_WIDTH_SIZE; 2110 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM); 2111 } 2112 else { 2113 rcSep.right += SEP_WIDTH_SIZE; 2114 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT); 2115 } 2116 TRACE("drawing band separator right (%d,%d)-(%d,%d)\n", 2117 rcSep.left, rcSep.top, rcSep.right, rcSep.bottom); 2118 } 2119 2120 /* draw the actual background */ 2121 if (lpBand->clrBack != CLR_NONE) 2122 new = lpBand->clrBack; 2123 else 2124 new = infoPtr->clrBtnFace; 2125 rect = lpBand->rcBand; 2126 #if GLATESTING 2127 /* testing only - make background green to see it */ 2128 new = RGB(0,128,0); 2129 #endif 2130 old = SetBkColor (hdc, new); 2131 TRACE("%s background color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", 2132 (lpBand->clrBack == CLR_NONE) ? "std" : "", 2133 new, 2134 lpBand->rcBand.left,lpBand->rcBand.top, 2135 lpBand->rcBand.right,lpBand->rcBand.bottom, 2136 clip->left, clip->top, 2137 clip->right, clip->bottom); 2138 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); 2139 SetBkColor (hdc, old); 1991 2140 } 1992 2141 return TRUE; … … 2005 2154 if (PtInRect (&rect, *lpPt)) 2006 2155 { 2007 if (infoPtr->uNumBands == 0) { 2008 *pFlags = RBHT_NOWHERE; 2009 if (pBand) 2010 *pBand = -1; 2011 TRACE("NOWHERE\n"); 2012 return; 2156 if (infoPtr->uNumBands == 0) { 2157 *pFlags = RBHT_NOWHERE; 2158 if (pBand) 2159 *pBand = -1; 2160 TRACE("NOWHERE\n"); 2161 return; 2162 } 2163 else { 2164 /* somewhere inside */ 2165 infoPtr->ihitBand = -1; 2166 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) { 2167 lpBand = &infoPtr->bands[iCount]; 2168 if (HIDDENBAND(lpBand)) continue; 2169 if (PtInRect (&lpBand->rcBand, *lpPt)) { 2170 if (pBand) 2171 *pBand = iCount; 2172 if (PtInRect (&lpBand->rcGripper, *lpPt)) { 2173 *pFlags = RBHT_GRABBER; 2174 infoPtr->ihitBand = iCount; 2175 TRACE("ON GRABBER %d\n", iCount); 2176 return; 2177 } 2178 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) { 2179 *pFlags = RBHT_CAPTION; 2180 TRACE("ON CAPTION %d\n", iCount); 2181 return; 2182 } 2183 else if (PtInRect (&lpBand->rcCapText, *lpPt)) { 2184 *pFlags = RBHT_CAPTION; 2185 TRACE("ON CAPTION %d\n", iCount); 2186 return; 2187 } 2188 else if (PtInRect (&lpBand->rcChild, *lpPt)) { 2189 *pFlags = RBHT_CLIENT; 2190 TRACE("ON CLIENT %d\n", iCount); 2191 return; 2192 } 2193 else { 2194 *pFlags = RBHT_NOWHERE; 2195 TRACE("NOWHERE %d\n", iCount); 2196 return; 2197 } 2198 } 2199 } 2200 2201 *pFlags = RBHT_NOWHERE; 2202 if (pBand) 2203 *pBand = -1; 2204 2205 TRACE("NOWHERE\n"); 2206 return; 2207 } 2013 2208 } 2014 2209 else { 2015 /* somewhere inside */ 2016 infoPtr->ihitBand = -1; 2017 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) { 2018 lpBand = &infoPtr->bands[iCount]; 2019 if (HIDDENBAND(lpBand)) continue; 2020 if (PtInRect (&lpBand->rcBand, *lpPt)) { 2021 if (pBand) 2022 *pBand = iCount; 2023 if (PtInRect (&lpBand->rcGripper, *lpPt)) { 2024 *pFlags = RBHT_GRABBER; 2025 infoPtr->ihitBand = iCount; 2026 TRACE("ON GRABBER %d\n", iCount); 2027 return; 2028 } 2029 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) { 2030 *pFlags = RBHT_CAPTION; 2031 TRACE("ON CAPTION %d\n", iCount); 2032 return; 2033 } 2034 else if (PtInRect (&lpBand->rcCapText, *lpPt)) { 2035 *pFlags = RBHT_CAPTION; 2036 TRACE("ON CAPTION %d\n", iCount); 2037 return; 2038 } 2039 else if (PtInRect (&lpBand->rcChild, *lpPt)) { 2040 *pFlags = RBHT_CLIENT; 2041 TRACE("ON CLIENT %d\n", iCount); 2042 return; 2043 } 2044 else { 2045 *pFlags = RBHT_NOWHERE; 2046 TRACE("NOWHERE %d\n", iCount); 2047 return; 2048 } 2049 } 2050 } 2051 2052 *pFlags = RBHT_NOWHERE; 2053 if (pBand) 2054 *pBand = -1; 2055 2056 TRACE("NOWHERE\n"); 2057 return; 2058 } 2059 } 2060 else { 2061 *pFlags = RBHT_NOWHERE; 2062 if (pBand) 2063 *pBand = -1; 2064 TRACE("NOWHERE\n"); 2065 return; 2210 *pFlags = RBHT_NOWHERE; 2211 if (pBand) 2212 *pBand = -1; 2213 TRACE("NOWHERE\n"); 2214 return; 2066 2215 } 2067 2216 … … 2092 2241 /* if this band is not shrinkable, then just move it */ 2093 2242 Leadjust = Readjust = movement; 2094 ret = movement;2243 ret = movement; 2095 2244 } 2096 2245 else { 2097 2246 if (movement < 0) { 2098 /* Drag to left */2099 if (avail <= abs(movement)) {2100 Readjust = movement;2101 Leadjust = movement + avail;2102 ret = Leadjust;2103 }2104 else {2105 Readjust = movement;2106 Leadjust = 0;2107 ret = 0;2108 }2109 }2110 else {2111 /* Drag to right */2112 if (avail <= abs(movement)) {2113 Leadjust = movement;2114 Readjust = movement - avail;2115 ret = Readjust;2116 }2117 else {2118 Leadjust = movement;2119 Readjust = 0;2120 ret = 0;2121 }2122 }2247 /* Drag to left */ 2248 if (avail <= abs(movement)) { 2249 Readjust = movement; 2250 Leadjust = movement + avail; 2251 ret = Leadjust; 2252 } 2253 else { 2254 Readjust = movement; 2255 Leadjust = 0; 2256 ret = 0; 2257 } 2258 } 2259 else { 2260 /* Drag to right */ 2261 if (avail <= abs(movement)) { 2262 Leadjust = movement; 2263 Readjust = movement - avail; 2264 ret = Readjust; 2265 } 2266 else { 2267 Leadjust = movement; 2268 Readjust = 0; 2269 ret = 0; 2270 } 2271 } 2123 2272 } 2124 2273 … … 2126 2275 if (rcBlt(band) + Leadjust < 0) { 2127 2276 ERR("adjustment will fail, band %d: left=%d, right=%d, move=%d, rtn=%d\n", 2128 i, Leadjust, Readjust, movement, ret);2277 i, Leadjust, Readjust, movement, ret); 2129 2278 } 2130 2279 … … 2133 2282 2134 2283 TRACE("band %d: left=%d, right=%d, move=%d, rtn=%d, rcBand=(%d,%d)-(%d,%d)\n", 2135 i, Leadjust, Readjust, movement, ret,2136 band->rcBand.left, band->rcBand.top,2137 band->rcBand.right, band->rcBand.bottom);2284 i, Leadjust, Readjust, movement, ret, 2285 band->rcBand.left, band->rcBand.top, 2286 band->rcBand.right, band->rcBand.bottom); 2138 2287 return ret; 2139 2288 } … … 2158 2307 2159 2308 if (!(infoPtr->fStatus & BEGIN_DRAG_ISSUED)) { 2160 if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) {2161 /* Notify returned TRUE - abort drag */2162 infoPtr->dragStart.x = 0;2163 infoPtr->dragStart.y = 0;2164 infoPtr->dragNow = infoPtr->dragStart;2165 infoPtr->ihitBand = -1;2166 ReleaseCapture ();2167 return ;2168 }2169 infoPtr->fStatus |= BEGIN_DRAG_ISSUED;2309 if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) { 2310 /* Notify returned TRUE - abort drag */ 2311 infoPtr->dragStart.x = 0; 2312 infoPtr->dragStart.y = 0; 2313 infoPtr->dragNow = infoPtr->dragStart; 2314 infoPtr->ihitBand = -1; 2315 ReleaseCapture (); 2316 return ; 2317 } 2318 infoPtr->fStatus |= BEGIN_DRAG_ISSUED; 2170 2319 } 2171 2320 … … 2177 2326 for (i=0; i<infoPtr->uNumBands; i++) { 2178 2327 band = &infoPtr->bands[i]; 2179 if (HIDDENBAND(band)) continue;2180 if (band->iRow == hitBand->iRow) {2181 imaxdBand = i;2182 if (imindBand == -1) imindBand = i;2183 /* minimum size of each band is size of header plus */2184 /* size of minimum child plus offset of child from header plus */2185 /* a one to separate each band. */2186 if (i < ihitBand)2187 LHeaderSum += (band->lcx + SEP_WIDTH);2188 else 2189 RHeaderSum += (band->lcx + SEP_WIDTH);2190 2191 }2328 if (HIDDENBAND(band)) continue; 2329 if (band->iRow == hitBand->iRow) { 2330 imaxdBand = i; 2331 if (imindBand == -1) imindBand = i; 2332 /* minimum size of each band is size of header plus */ 2333 /* size of minimum child plus offset of child from header plus */ 2334 /* a one to separate each band. */ 2335 if (i < ihitBand) 2336 LHeaderSum += (band->lcx + SEP_WIDTH); 2337 else 2338 RHeaderSum += (band->lcx + SEP_WIDTH); 2339 2340 } 2192 2341 } 2193 2342 if (RHeaderSum) RHeaderSum -= SEP_WIDTH; /* no separator afterlast band */ … … 2201 2350 /* limit movement to inside adjustable bands - Left */ 2202 2351 if ( (ptsmove->x < mindBand->rcBand.left) || 2203 (ptsmove->x > maxdBand->rcBand.right) ||2204 (ptsmove->y < mindBand->rcBand.top) ||2205 (ptsmove->y > maxdBand->rcBand.bottom))2352 (ptsmove->x > maxdBand->rcBand.right) || 2353 (ptsmove->y < mindBand->rcBand.top) || 2354 (ptsmove->y > maxdBand->rcBand.bottom)) 2206 2355 return; /* should swap bands */ 2207 2356 2208 2357 if (infoPtr->dwStyle & CCS_VERT) 2209 2358 movement = ptsmove->y - ((hitBand->rcBand.top+REBAR_PRE_GRIPPER) - 2210 infoPtr->ihitoffset);2359 infoPtr->ihitoffset); 2211 2360 else 2212 2361 movement = ptsmove->x - ((hitBand->rcBand.left+REBAR_PRE_GRIPPER) - 2213 infoPtr->ihitoffset);2362 infoPtr->ihitoffset); 2214 2363 infoPtr->dragNow = *ptsmove; 2215 2364 2216 2365 TRACE("before: movement=%d (%d,%d), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n", 2217 movement, ptsmove->x, ptsmove->y, imindBand, ihitBand,2218 imaxdBand, LHeaderSum, RHeaderSum);2366 movement, ptsmove->x, ptsmove->y, imindBand, ihitBand, 2367 imaxdBand, LHeaderSum, RHeaderSum); 2219 2368 REBAR_DumpBand (infoPtr); 2220 2369 2221 if (movement < 0) { 2370 if (movement < 0) { 2222 2371 2223 2372 /* *** Drag left/up *** */ 2224 2373 compress = rcBlt(hitBand) - rcBlt(mindBand) - 2225 LHeaderSum;2226 if (compress < abs(movement)) {2227 TRACE("limiting left drag, was %d changed to %d\n",2228 movement, -compress);2229 movement = -compress;2230 }2374 LHeaderSum; 2375 if (compress < abs(movement)) { 2376 TRACE("limiting left drag, was %d changed to %d\n", 2377 movement, -compress); 2378 movement = -compress; 2379 } 2231 2380 2232 2381 for (i=ihitBand; i>=imindBand; i--) { 2233 band = &infoPtr->bands[i];2234 if (HIDDENBAND(band)) continue;2235 if (i == ihitBand) {2236 LEADJ(band, movement)2237 }2238 else 2239 movement = REBAR_Shrink (infoPtr, band, movement, i);2240 band->ccx = rcBw(band);2241 }2382 band = &infoPtr->bands[i]; 2383 if (HIDDENBAND(band)) continue; 2384 if (i == ihitBand) { 2385 LEADJ(band, movement) 2386 } 2387 else 2388 movement = REBAR_Shrink (infoPtr, band, movement, i); 2389 band->ccx = rcBw(band); 2390 } 2242 2391 } 2243 2392 else { 2244 BOOL first = TRUE;2393 BOOL first = TRUE; 2245 2394 2246 2395 /* *** Drag right/down *** */ 2247 2396 compress = rcBrb(maxdBand) - rcBlt(hitBand) - 2248 RHeaderSum;2249 if (compress < abs(movement)) {2250 TRACE("limiting right drag, was %d changed to %d\n",2251 movement, compress);2252 movement = compress;2253 }2397 RHeaderSum; 2398 if (compress < abs(movement)) { 2399 TRACE("limiting right drag, was %d changed to %d\n", 2400 movement, compress); 2401 movement = compress; 2402 } 2254 2403 for (i=ihitBand-1; i<=imaxdBand; i++) { 2255 band = &infoPtr->bands[i];2256 if (HIDDENBAND(band)) continue;2257 if (first) {2258 first = FALSE;2259 READJ(band, movement)2260 }2261 else 2262 movement = REBAR_Shrink (infoPtr, band, movement, i);2263 band->ccx = rcBw(band);2264 }2404 band = &infoPtr->bands[i]; 2405 if (HIDDENBAND(band)) continue; 2406 if (first) { 2407 first = FALSE; 2408 READJ(band, movement) 2409 } 2410 else 2411 movement = REBAR_Shrink (infoPtr, band, movement, i); 2412 band->ccx = rcBw(band); 2413 } 2265 2414 } 2266 2415 2267 2416 /* recompute all rectangles */ 2268 2417 if (infoPtr->dwStyle & CCS_VERT) { 2269 REBAR_CalcVertBand (infoPtr, imindBand, imaxdBand+1,2270 FALSE);2418 REBAR_CalcVertBand (infoPtr, imindBand, imaxdBand+1, 2419 FALSE); 2271 2420 } 2272 2421 else { 2273 REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1, 2274 FALSE);2422 REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1, 2423 FALSE); 2275 2424 } 2276 2425 2277 2426 TRACE("bands after adjustment, see band # %d, %d\n", 2278 imindBand, imaxdBand);2427 imindBand, imaxdBand); 2279 2428 REBAR_DumpBand (infoPtr); 2280 2429 2281 SetRect (&newrect, 2282 mindBand->rcBand.left,2283 mindBand->rcBand.top,2284 maxdBand->rcBand.right,2285 maxdBand->rcBand.bottom);2430 SetRect (&newrect, 2431 mindBand->rcBand.left, 2432 mindBand->rcBand.top, 2433 maxdBand->rcBand.right, 2434 maxdBand->rcBand.bottom); 2286 2435 2287 2436 REBAR_MoveChildWindows (infoPtr, imindBand, imaxdBand+1); … … 2305 2454 2306 2455 if (uBand >= infoPtr->uNumBands) 2307 return FALSE;2456 return FALSE; 2308 2457 2309 2458 TRACE("deleting band %u!\n", uBand); … … 2312 2461 2313 2462 if (infoPtr->uNumBands == 1) { 2314 TRACE(" simple delete!\n");2315 if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)2316 childhwnd = lpBand->hwndChild;2317 COMCTL32_Free (infoPtr->bands);2318 infoPtr->bands = NULL;2319 infoPtr->uNumBands = 0;2463 TRACE(" simple delete!\n"); 2464 if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild) 2465 childhwnd = lpBand->hwndChild; 2466 COMCTL32_Free (infoPtr->bands); 2467 infoPtr->bands = NULL; 2468 infoPtr->uNumBands = 0; 2320 2469 } 2321 2470 else { 2322 REBAR_BAND *oldBands = infoPtr->bands;2471 REBAR_BAND *oldBands = infoPtr->bands; 2323 2472 TRACE("complex delete! [uBand=%u]\n", uBand); 2324 2473 2325 if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)2326 childhwnd = lpBand->hwndChild;2327 2328 infoPtr->uNumBands--;2329 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);2474 if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild) 2475 childhwnd = lpBand->hwndChild; 2476 2477 infoPtr->uNumBands--; 2478 infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands); 2330 2479 if (uBand > 0) { 2331 2480 memcpy (&infoPtr->bands[0], &oldBands[0], … … 2338 2487 } 2339 2488 2340 COMCTL32_Free (oldBands);2489 COMCTL32_Free (oldBands); 2341 2490 } 2342 2491 … … 2370 2519 2371 2520 if (!lParam) 2372 return 0;2521 return 0; 2373 2522 if ((UINT)wParam >= infoPtr->uNumBands) 2374 return 0;2523 return 0; 2375 2524 2376 2525 lpBand = &infoPtr->bands[(UINT)wParam]; … … 2382 2531 /* style. - GA */ 2383 2532 if (infoPtr->dwStyle & RBS_BANDBORDERS) { 2384 if (infoPtr->dwStyle & CCS_VERT) { 2385 lpRect->left = 1; 2386 lpRect->top = lpBand->cxHeader + 4; 2387 lpRect->right = 1; 2388 lpRect->bottom = 0; 2533 if (infoPtr->dwStyle & CCS_VERT) { 2534 lpRect->left = 1; 2535 lpRect->top = lpBand->cxHeader + 4; 2536 lpRect->right = 1; 2537 lpRect->bottom = 0; 2538 } 2539 else { 2540 lpRect->left = lpBand->cxHeader + 4; 2541 lpRect->top = 1; 2542 lpRect->right = 0; 2543 lpRect->bottom = 1; 2544 } 2389 2545 } 2390 2546 else { 2391 lpRect->left = lpBand->cxHeader + 4; 2392 lpRect->top = 1; 2393 lpRect->right = 0; 2394 lpRect->bottom = 1; 2395 } 2396 } 2397 else { 2398 lpRect->left = lpBand->cxHeader; 2547 lpRect->left = lpBand->cxHeader; 2399 2548 } 2400 2549 return 0; … … 2418 2567 2419 2568 if (lprbbi == NULL) 2420 return FALSE;2569 return FALSE; 2421 2570 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 2422 return FALSE;2571 return FALSE; 2423 2572 if ((UINT)wParam >= infoPtr->uNumBands) 2424 return FALSE;2573 return FALSE; 2425 2574 2426 2575 TRACE("index %u\n", (UINT)wParam); … … 2430 2579 2431 2580 if (lprbbi->fMask & RBBIM_STYLE) 2432 lprbbi->fStyle = lpBand->fStyle;2581 lprbbi->fStyle = lpBand->fStyle; 2433 2582 2434 2583 if (lprbbi->fMask & RBBIM_COLORS) { 2435 lprbbi->clrFore = lpBand->clrFore;2436 lprbbi->clrBack = lpBand->clrBack;2437 if (lprbbi->clrBack == CLR_NONE)2438 lprbbi->clrBack = infoPtr->clrBtnFace;2584 lprbbi->clrFore = lpBand->clrFore; 2585 lprbbi->clrBack = lpBand->clrBack; 2586 if (lprbbi->clrBack == CLR_NONE) 2587 lprbbi->clrBack = infoPtr->clrBtnFace; 2439 2588 } 2440 2589 … … 2446 2595 lprbbi->lpText[lprbbi->cch-1] = 0; 2447 2596 } 2448 else 2449 *lprbbi->lpText = 0;2597 else 2598 *lprbbi->lpText = 0; 2450 2599 } 2451 2600 2452 2601 if (lprbbi->fMask & RBBIM_IMAGE) { 2453 2602 if (lpBand->fMask & RBBIM_IMAGE) 2454 lprbbi->iImage = lpBand->iImage;2603 lprbbi->iImage = lpBand->iImage; 2455 2604 else 2456 lprbbi->iImage = -1;2605 lprbbi->iImage = -1; 2457 2606 } 2458 2607 2459 2608 if (lprbbi->fMask & RBBIM_CHILD) 2460 lprbbi->hwndChild = lpBand->hwndChild;2609 lprbbi->hwndChild = lpBand->hwndChild; 2461 2610 2462 2611 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 2463 lprbbi->cxMinChild = lpBand->cxMinChild;2464 lprbbi->cyMinChild = lpBand->cyMinChild;2465 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {2466 lprbbi->cyChild = lpBand->cyChild;2467 lprbbi->cyMaxChild = lpBand->cyMaxChild;2468 lprbbi->cyIntegral = lpBand->cyIntegral;2469 }2612 lprbbi->cxMinChild = lpBand->cxMinChild; 2613 lprbbi->cyMinChild = lpBand->cyMinChild; 2614 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 2615 lprbbi->cyChild = lpBand->cyChild; 2616 lprbbi->cyMaxChild = lpBand->cyMaxChild; 2617 lprbbi->cyIntegral = lpBand->cyIntegral; 2618 } 2470 2619 } 2471 2620 2472 2621 if (lprbbi->fMask & RBBIM_SIZE) 2473 lprbbi->cx = lpBand->cx;2622 lprbbi->cx = lpBand->cx; 2474 2623 2475 2624 if (lprbbi->fMask & RBBIM_BACKGROUND) 2476 lprbbi->hbmBack = lpBand->hbmBack;2625 lprbbi->hbmBack = lpBand->hbmBack; 2477 2626 2478 2627 if (lprbbi->fMask & RBBIM_ID) 2479 lprbbi->wID = lpBand->wID;2628 lprbbi->wID = lpBand->wID; 2480 2629 2481 2630 /* check for additional data */ 2482 2631 if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { 2483 if (lprbbi->fMask & RBBIM_IDEALSIZE)2484 lprbbi->cxIdeal = lpBand->cxIdeal;2485 2486 if (lprbbi->fMask & RBBIM_LPARAM)2487 lprbbi->lParam = lpBand->lParam;2488 2489 if (lprbbi->fMask & RBBIM_HEADERSIZE)2490 lprbbi->cxHeader = lpBand->cxHeader;2632 if (lprbbi->fMask & RBBIM_IDEALSIZE) 2633 lprbbi->cxIdeal = lpBand->cxIdeal; 2634 2635 if (lprbbi->fMask & RBBIM_LPARAM) 2636 lprbbi->lParam = lpBand->lParam; 2637 2638 if (lprbbi->fMask & RBBIM_HEADERSIZE) 2639 lprbbi->cxHeader = lpBand->cxHeader; 2491 2640 } 2492 2641 … … 2504 2653 2505 2654 if (lprbbi == NULL) 2506 return FALSE;2655 return FALSE; 2507 2656 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 2508 return FALSE;2657 return FALSE; 2509 2658 if ((UINT)wParam >= infoPtr->uNumBands) 2510 return FALSE;2659 return FALSE; 2511 2660 2512 2661 TRACE("index %u\n", (UINT)wParam); … … 2516 2665 2517 2666 if (lprbbi->fMask & RBBIM_STYLE) 2518 lprbbi->fStyle = lpBand->fStyle;2667 lprbbi->fStyle = lpBand->fStyle; 2519 2668 2520 2669 if (lprbbi->fMask & RBBIM_COLORS) { 2521 lprbbi->clrFore = lpBand->clrFore;2522 lprbbi->clrBack = lpBand->clrBack;2523 if (lprbbi->clrBack == CLR_NONE)2524 lprbbi->clrBack = infoPtr->clrBtnFace;2670 lprbbi->clrFore = lpBand->clrFore; 2671 lprbbi->clrBack = lpBand->clrBack; 2672 if (lprbbi->clrBack == CLR_NONE) 2673 lprbbi->clrBack = infoPtr->clrBtnFace; 2525 2674 } 2526 2675 2527 2676 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { 2528 2677 if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT)) 2529 lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);2530 else 2531 *lprbbi->lpText = 0;2678 lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch); 2679 else 2680 *lprbbi->lpText = 0; 2532 2681 } 2533 2682 2534 2683 if (lprbbi->fMask & RBBIM_IMAGE) { 2535 2684 if (lpBand->fMask & RBBIM_IMAGE) 2536 lprbbi->iImage = lpBand->iImage;2685 lprbbi->iImage = lpBand->iImage; 2537 2686 else 2538 lprbbi->iImage = -1;2687 lprbbi->iImage = -1; 2539 2688 } 2540 2689 2541 2690 if (lprbbi->fMask & RBBIM_CHILD) 2542 lprbbi->hwndChild = lpBand->hwndChild;2691 lprbbi->hwndChild = lpBand->hwndChild; 2543 2692 2544 2693 if (lprbbi->fMask & RBBIM_CHILDSIZE) { 2545 lprbbi->cxMinChild = lpBand->cxMinChild;2546 lprbbi->cyMinChild = lpBand->cyMinChild;2547 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {2548 lprbbi->cyChild = lpBand->cyChild;2549 lprbbi->cyMaxChild = lpBand->cyMaxChild;2550 lprbbi->cyIntegral = lpBand->cyIntegral;2551 }2694 lprbbi->cxMinChild = lpBand->cxMinChild; 2695 lprbbi->cyMinChild = lpBand->cyMinChild; 2696 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) { 2697 lprbbi->cyChild = lpBand->cyChild; 2698 lprbbi->cyMaxChild = lpBand->cyMaxChild; 2699 lprbbi->cyIntegral = lpBand->cyIntegral; 2700 } 2552 2701 } 2553 2702 2554 2703 if (lprbbi->fMask & RBBIM_SIZE) 2555 lprbbi->cx = lpBand->cx;2704 lprbbi->cx = lpBand->cx; 2556 2705 2557 2706 if (lprbbi->fMask & RBBIM_BACKGROUND) 2558 lprbbi->hbmBack = lpBand->hbmBack;2707 lprbbi->hbmBack = lpBand->hbmBack; 2559 2708 2560 2709 if (lprbbi->fMask & RBBIM_ID) 2561 lprbbi->wID = lpBand->wID;2710 lprbbi->wID = lpBand->wID; 2562 2711 2563 2712 /* check for additional data */ 2564 2713 if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) { 2565 if (lprbbi->fMask & RBBIM_IDEALSIZE)2566 lprbbi->cxIdeal = lpBand->cxIdeal;2567 2568 if (lprbbi->fMask & RBBIM_LPARAM)2569 lprbbi->lParam = lpBand->lParam;2570 2571 if (lprbbi->fMask & RBBIM_HEADERSIZE)2572 lprbbi->cxHeader = lpBand->cxHeader;2714 if (lprbbi->fMask & RBBIM_IDEALSIZE) 2715 lprbbi->cxIdeal = lpBand->cxIdeal; 2716 2717 if (lprbbi->fMask & RBBIM_LPARAM) 2718 lprbbi->lParam = lpBand->lParam; 2719 2720 if (lprbbi->fMask & RBBIM_HEADERSIZE) 2721 lprbbi->cxHeader = lpBand->cxHeader; 2573 2722 } 2574 2723 … … 2598 2747 2599 2748 if (lpInfo == NULL) 2600 return FALSE;2749 return FALSE; 2601 2750 2602 2751 if (lpInfo->cbSize < sizeof (REBARINFO)) 2603 return FALSE;2752 return FALSE; 2604 2753 2605 2754 TRACE("getting bar info!\n"); 2606 2755 2607 2756 if (infoPtr->himl) { 2608 lpInfo->himl = infoPtr->himl;2609 lpInfo->fMask |= RBIM_IMAGELIST;2757 lpInfo->himl = infoPtr->himl; 2758 lpInfo->fMask |= RBIM_IMAGELIST; 2610 2759 } 2611 2760 … … 2649 2798 2650 2799 if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands)) 2651 return FALSE;2800 return FALSE; 2652 2801 if (!lprc) 2653 return FALSE;2802 return FALSE; 2654 2803 2655 2804 lpBand = &infoPtr->bands[iBand]; … … 2657 2806 2658 2807 TRACE("band %d, (%d,%d)-(%d,%d)\n", iBand, 2659 lprc->left, lprc->top, lprc->right, lprc->bottom);2808 lprc->left, lprc->top, lprc->right, lprc->bottom); 2660 2809 2661 2810 return TRUE; … … 2681 2830 2682 2831 for (i=0; i<infoPtr->uNumBands; i++) { 2683 lpBand = &infoPtr->bands[i];2684 if (HIDDENBAND(lpBand)) continue;2685 if (lpBand->iRow != iRow) continue;2686 if (infoPtr->dwStyle & CCS_VERT)2687 j = lpBand->rcBand.right - lpBand->rcBand.left;2688 else2689 j = lpBand->rcBand.bottom - lpBand->rcBand.top;2690 if (j > ret) ret = j;2832 lpBand = &infoPtr->bands[i]; 2833 if (HIDDENBAND(lpBand)) continue; 2834 if (lpBand->iRow != iRow) continue; 2835 if (infoPtr->dwStyle & CCS_VERT) 2836 j = lpBand->rcBand.right - lpBand->rcBand.left; 2837 else 2838 j = lpBand->rcBand.bottom - lpBand->rcBand.top; 2839 if (j > ret) ret = j; 2691 2840 } 2692 2841 … … 2716 2865 REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr) 2717 2866 { 2718 TRACE("%s hwnd=0x%x\n", 2719 infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);2867 TRACE("%s hwnd=0x%x\n", 2868 infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf); 2720 2869 2721 2870 return infoPtr->bUnicode; … … 2734 2883 REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2735 2884 { 2736 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 2885 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 2737 2886 2738 2887 if (!lprbht) 2739 return -1;2888 return -1; 2740 2889 2741 2890 REBAR_InternalHitTest (infoPtr, &lprbht->pt, &lprbht->flags, &lprbht->iBand); … … 2751 2900 2752 2901 if (infoPtr == NULL) 2753 return -1;2902 return -1; 2754 2903 2755 2904 if (infoPtr->uNumBands < 1) 2756 return -1;2905 return -1; 2757 2906 2758 2907 for (i = 0; i < infoPtr->uNumBands; i++) { 2759 if (infoPtr->bands[i].wID == (UINT)wParam) {2760 TRACE("id %u is band %u found!\n", (UINT)wParam, i);2761 return i;2762 }2908 if (infoPtr->bands[i].wID == (UINT)wParam) { 2909 TRACE("id %u is band %u found!\n", (UINT)wParam, i); 2910 return i; 2911 } 2763 2912 } 2764 2913 … … 2776 2925 2777 2926 if (infoPtr == NULL) 2778 return FALSE;2927 return FALSE; 2779 2928 if (lprbbi == NULL) 2780 return FALSE;2929 return FALSE; 2781 2930 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 2782 return FALSE;2931 return FALSE; 2783 2932 2784 2933 /* trace the index as signed to see the -1 */ … … 2787 2936 2788 2937 if (infoPtr->uNumBands == 0) { 2789 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));2790 uIndex = 0;2938 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); 2939 uIndex = 0; 2791 2940 } 2792 2941 else { 2793 REBAR_BAND *oldBands = infoPtr->bands;2794 infoPtr->bands =2795 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));2796 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))2797 uIndex = infoPtr->uNumBands;2798 2799 /* pre insert copy */2800 if (uIndex > 0) {2801 memcpy (&infoPtr->bands[0], &oldBands[0],2802 uIndex * sizeof(REBAR_BAND));2803 }2804 2805 /* post copy */2806 if (uIndex < infoPtr->uNumBands - 1) {2807 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],2808 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));2809 }2810 2811 COMCTL32_Free (oldBands);2942 REBAR_BAND *oldBands = infoPtr->bands; 2943 infoPtr->bands = 2944 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); 2945 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) 2946 uIndex = infoPtr->uNumBands; 2947 2948 /* pre insert copy */ 2949 if (uIndex > 0) { 2950 memcpy (&infoPtr->bands[0], &oldBands[0], 2951 uIndex * sizeof(REBAR_BAND)); 2952 } 2953 2954 /* post copy */ 2955 if (uIndex < infoPtr->uNumBands - 1) { 2956 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], 2957 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); 2958 } 2959 2960 COMCTL32_Free (oldBands); 2812 2961 } 2813 2962 … … 2832 2981 lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR)); 2833 2982 MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len ); 2834 }2983 } 2835 2984 } 2836 2985 … … 2838 2987 /* On insert of second band, revalidate band 1 to possible add gripper */ 2839 2988 if (infoPtr->uNumBands == 2) 2840 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);2989 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]); 2841 2990 2842 2991 REBAR_DumpBand (infoPtr); 2843 2992 2844 2993 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 2994 InvalidateRect(infoPtr->hwndSelf, 0, 1); 2845 2995 2846 2996 return TRUE; … … 2856 3006 2857 3007 if (infoPtr == NULL) 2858 return FALSE;3008 return FALSE; 2859 3009 if (lprbbi == NULL) 2860 return FALSE;3010 return FALSE; 2861 3011 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 2862 return FALSE;3012 return FALSE; 2863 3013 2864 3014 /* trace the index as signed to see the -1 */ … … 2867 3017 2868 3018 if (infoPtr->uNumBands == 0) { 2869 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));2870 uIndex = 0;3019 infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); 3020 uIndex = 0; 2871 3021 } 2872 3022 else { 2873 REBAR_BAND *oldBands = infoPtr->bands;2874 infoPtr->bands =2875 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));2876 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))2877 uIndex = infoPtr->uNumBands;2878 2879 /* pre insert copy */2880 if (uIndex > 0) {2881 memcpy (&infoPtr->bands[0], &oldBands[0],2882 uIndex * sizeof(REBAR_BAND));2883 }2884 2885 /* post copy */2886 if (uIndex < infoPtr->uNumBands - 1) {2887 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],2888 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));2889 }2890 2891 COMCTL32_Free (oldBands);3023 REBAR_BAND *oldBands = infoPtr->bands; 3024 infoPtr->bands = 3025 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); 3026 if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) 3027 uIndex = infoPtr->uNumBands; 3028 3029 /* pre insert copy */ 3030 if (uIndex > 0) { 3031 memcpy (&infoPtr->bands[0], &oldBands[0], 3032 uIndex * sizeof(REBAR_BAND)); 3033 } 3034 3035 /* post copy */ 3036 if (uIndex < infoPtr->uNumBands - 1) { 3037 memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], 3038 (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); 3039 } 3040 3041 COMCTL32_Free (oldBands); 2892 3042 } 2893 3043 … … 2908 3058 lpBand->lpText = NULL; 2909 3059 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { 2910 INT len = lstrlenW (lprbbi->lpText);2911 if (len > 0) {2912 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));2913 strcpyW (lpBand->lpText, lprbbi->lpText);2914 }3060 INT len = lstrlenW (lprbbi->lpText); 3061 if (len > 0) { 3062 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 3063 strcpyW (lpBand->lpText, lprbbi->lpText); 3064 } 2915 3065 } 2916 3066 … … 2918 3068 /* On insert of second band, revalidate band 1 to possible add gripper */ 2919 3069 if (infoPtr->uNumBands == 2) 2920 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);3070 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]); 2921 3071 2922 3072 REBAR_DumpBand (infoPtr); 2923 3073 2924 3074 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 3075 InvalidateRect(infoPtr->hwndSelf, 0, 1); 2925 3076 2926 3077 return TRUE; … … 2931 3082 REBAR_MaximizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2932 3083 { 2933 FIXME("(uBand = %u fIdeal = %s) stub\n", 2934 (UINT)wParam, lParam ? "TRUE" : "FALSE"); 2935 2936 return 0; 3084 REBAR_BAND *lpBand; 3085 UINT uBand = (UINT) wParam; 3086 3087 /* Validate */ 3088 if ((infoPtr->uNumBands == 0) || 3089 ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) { 3090 /* error !!! */ 3091 ERR("Illegal MaximizeBand, requested=%d, current band count=%d\n", 3092 (INT)uBand, infoPtr->uNumBands); 3093 return FALSE; 3094 } 3095 3096 lpBand = &infoPtr->bands[uBand]; 3097 3098 if (lParam && (lpBand->fMask & RBBIM_IDEALSIZE)) { 3099 /* handle setting ideal size */ 3100 lpBand->ccx = lpBand->cxIdeal; 3101 } 3102 else { 3103 /* handle setting to max */ 3104 FIXME("(uBand = %u fIdeal = %s) case not coded\n", 3105 (UINT)wParam, lParam ? "TRUE" : "FALSE"); 3106 return FALSE; 3107 } 3108 3109 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3110 REBAR_Layout (infoPtr, 0, TRUE, TRUE); 3111 InvalidateRect (infoPtr->hwndSelf, 0, TRUE); 3112 3113 return TRUE; 2937 3114 2938 3115 } … … 2955 3132 /* Validate */ 2956 3133 if ((infoPtr->uNumBands == 0) || 2957 ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) {2958 /* error !!! */2959 ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n",2960 (INT)uBand, infoPtr->uNumBands);2961 return FALSE;3134 ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) { 3135 /* error !!! */ 3136 ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n", 3137 (INT)uBand, infoPtr->uNumBands); 3138 return FALSE; 2962 3139 } 2963 3140 … … 2966 3143 2967 3144 if (infoPtr->dwStyle & CCS_VERT) 2968 movement = lpBand->rcBand.bottom - lpBand->rcBand.top -2969 lpBand->cxHeader;3145 movement = lpBand->rcBand.bottom - lpBand->rcBand.top - 3146 lpBand->cxHeader; 2970 3147 else 2971 movement = lpBand->rcBand.right - lpBand->rcBand.left -2972 lpBand->cxHeader;3148 movement = lpBand->rcBand.right - lpBand->rcBand.left - 3149 lpBand->cxHeader; 2973 3150 if (movement < 0) { 2974 ERR("something is wrong, band=(%d,%d)-(%d,%d), cxheader=%d\n",2975 lpBand->rcBand.left, lpBand->rcBand.top,2976 lpBand->rcBand.right, lpBand->rcBand.bottom,2977 lpBand->cxHeader);2978 return FALSE;3151 ERR("something is wrong, band=(%d,%d)-(%d,%d), cxheader=%d\n", 3152 lpBand->rcBand.left, lpBand->rcBand.top, 3153 lpBand->rcBand.right, lpBand->rcBand.bottom, 3154 lpBand->cxHeader); 3155 return FALSE; 2979 3156 } 2980 3157 … … 2986 3163 for (i=0; i<infoPtr->uNumBands; i++) { 2987 3164 band = &infoPtr->bands[i]; 2988 if (HIDDENBAND(band)) continue;2989 if (band->iRow == lpBand->iRow) {2990 imaxdBand = i;2991 if (imindBand == -1) imindBand = i;2992 }3165 if (HIDDENBAND(band)) continue; 3166 if (band->iRow == lpBand->iRow) { 3167 imaxdBand = i; 3168 if (imindBand == -1) imindBand = i; 3169 } 2993 3170 } 2994 3171 … … 2996 3173 /* next visible band */ 2997 3174 if (imindBand == uBand) { 2998 band = NULL;2999 movement = -movement;3000 /* find the first visible band to the right of the selected band */3001 for (i=uBand+1; i<=imaxdBand; i++) {3002 band = &infoPtr->bands[i];3003 if (!HIDDENBAND(band)) {3004 iprevBand = i;3005 LEADJ(band, movement);3006 band->ccx = rcBw(band);3007 break;3008 }3009 }3010 /* what case is this */3011 if (iprevBand == -1) {3012 ERR("no previous visible band\n");3013 return FALSE;3014 }3015 startBand = uBand;3016 endBand = iprevBand;3017 SetRect (&newrect, 3018 lpBand->rcBand.left,3019 lpBand->rcBand.top,3020 band->rcBand.right,3021 band->rcBand.bottom);3175 band = NULL; 3176 movement = -movement; 3177 /* find the first visible band to the right of the selected band */ 3178 for (i=uBand+1; i<=imaxdBand; i++) { 3179 band = &infoPtr->bands[i]; 3180 if (!HIDDENBAND(band)) { 3181 iprevBand = i; 3182 LEADJ(band, movement); 3183 band->ccx = rcBw(band); 3184 break; 3185 } 3186 } 3187 /* what case is this */ 3188 if (iprevBand == -1) { 3189 ERR("no previous visible band\n"); 3190 return FALSE; 3191 } 3192 startBand = uBand; 3193 endBand = iprevBand; 3194 SetRect (&newrect, 3195 lpBand->rcBand.left, 3196 lpBand->rcBand.top, 3197 band->rcBand.right, 3198 band->rcBand.bottom); 3022 3199 } 3023 3200 /* otherwise expand previous visible band */ 3024 3201 else { 3025 band = NULL;3026 /* find the first visible band to the left of the selected band */3027 for (i=uBand-1; i>=imindBand; i--) {3028 band = &infoPtr->bands[i];3029 if (!HIDDENBAND(band)) {3030 iprevBand = i;3031 READJ(band, movement);3032 band->ccx = rcBw(band);3033 break;3034 }3035 }3036 /* what case is this */3037 if (iprevBand == -1) {3038 ERR("no previous visible band\n");3039 return FALSE;3040 }3041 startBand = iprevBand;3042 endBand = uBand;3043 SetRect (&newrect, 3044 band->rcBand.left,3045 band->rcBand.top,3046 lpBand->rcBand.right,3047 lpBand->rcBand.bottom);3202 band = NULL; 3203 /* find the first visible band to the left of the selected band */ 3204 for (i=uBand-1; i>=imindBand; i--) { 3205 band = &infoPtr->bands[i]; 3206 if (!HIDDENBAND(band)) { 3207 iprevBand = i; 3208 READJ(band, movement); 3209 band->ccx = rcBw(band); 3210 break; 3211 } 3212 } 3213 /* what case is this */ 3214 if (iprevBand == -1) { 3215 ERR("no previous visible band\n"); 3216 return FALSE; 3217 } 3218 startBand = iprevBand; 3219 endBand = uBand; 3220 SetRect (&newrect, 3221 band->rcBand.left, 3222 band->rcBand.top, 3223 lpBand->rcBand.right, 3224 lpBand->rcBand.bottom); 3048 3225 } 3049 3226 … … 3052 3229 /* recompute all rectangles */ 3053 3230 if (infoPtr->dwStyle & CCS_VERT) { 3054 REBAR_CalcVertBand (infoPtr, startBand, endBand+1,3055 FALSE);3231 REBAR_CalcVertBand (infoPtr, startBand, endBand+1, 3232 FALSE); 3056 3233 } 3057 3234 else { 3058 REBAR_CalcHorzBand (infoPtr, startBand, endBand+1, 3059 FALSE);3235 REBAR_CalcHorzBand (infoPtr, startBand, endBand+1, 3236 FALSE); 3060 3237 } 3061 3238 3062 3239 TRACE("bands after minimize, see band # %d, %d\n", 3063 startBand, endBand);3240 startBand, endBand); 3064 3241 REBAR_DumpBand (infoPtr); 3065 3242 … … 3082 3259 /* Validate */ 3083 3260 if ((infoPtr->uNumBands == 0) || 3084 ((INT)uFrom < 0) || (uFrom >= infoPtr->uNumBands) ||3085 ((INT)uTo < 0) || (uTo >= infoPtr->uNumBands)) {3086 /* error !!! */3087 ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n",3088 (INT)uFrom, (INT)uTo, infoPtr->uNumBands);3089 return FALSE;3261 ((INT)uFrom < 0) || (uFrom >= infoPtr->uNumBands) || 3262 ((INT)uTo < 0) || (uTo >= infoPtr->uNumBands)) { 3263 /* error !!! */ 3264 ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n", 3265 (INT)uFrom, (INT)uTo, infoPtr->uNumBands); 3266 return FALSE; 3090 3267 } 3091 3268 … … 3095 3272 /* close up rest of bands (psuedo delete) */ 3096 3273 if (uFrom < infoPtr->uNumBands - 1) { 3097 memcpy (&oldBands[uFrom], &oldBands[uFrom+1],3098 (infoPtr->uNumBands - uFrom - 1) * sizeof(REBAR_BAND));3274 memcpy (&oldBands[uFrom], &oldBands[uFrom+1], 3275 (infoPtr->uNumBands - uFrom - 1) * sizeof(REBAR_BAND)); 3099 3276 } 3100 3277 3101 3278 /* allocate new space and copy rest of bands into it */ 3102 3279 infoPtr->bands = 3103 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));3280 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND)); 3104 3281 3105 3282 /* pre insert copy */ 3106 3283 if (uTo > 0) { 3107 memcpy (&infoPtr->bands[0], &oldBands[0],3108 uTo * sizeof(REBAR_BAND));3284 memcpy (&infoPtr->bands[0], &oldBands[0], 3285 uTo * sizeof(REBAR_BAND)); 3109 3286 } 3110 3287 … … 3114 3291 /* post copy */ 3115 3292 if (uTo < infoPtr->uNumBands - 1) { 3116 memcpy (&infoPtr->bands[uTo+1], &oldBands[uTo],3117 (infoPtr->uNumBands - uTo - 1) * sizeof(REBAR_BAND));3293 memcpy (&infoPtr->bands[uTo+1], &oldBands[uTo], 3294 (infoPtr->uNumBands - uTo - 1) * sizeof(REBAR_BAND)); 3118 3295 } 3119 3296 … … 3144 3321 3145 3322 if (lprbbi == NULL) 3146 return FALSE;3323 return FALSE; 3147 3324 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) 3148 return FALSE;3325 return FALSE; 3149 3326 if ((UINT)wParam >= infoPtr->uNumBands) 3150 return FALSE;3327 return FALSE; 3151 3328 3152 3329 TRACE("index %u\n", (UINT)wParam); … … 3158 3335 REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand); 3159 3336 if (lprbbi->fMask & RBBIM_TEXT) { 3160 if (lpBand->lpText) {3161 COMCTL32_Free (lpBand->lpText);3162 lpBand->lpText = NULL;3163 }3164 if (lprbbi->lpText) {3337 if (lpBand->lpText) { 3338 COMCTL32_Free (lpBand->lpText); 3339 lpBand->lpText = NULL; 3340 } 3341 if (lprbbi->lpText) { 3165 3342 INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 ); 3166 3343 lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR)); 3167 3344 MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len ); 3168 }3345 } 3169 3346 } 3170 3347 … … 3173 3350 REBAR_DumpBand (infoPtr); 3174 3351 3175 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) 3176 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 3352 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) { 3353 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 3354 InvalidateRect(infoPtr->hwndSelf, 0, 1); 3355 } 3177 3356 3178 3357 return TRUE; … … 3187 3366 3188 3367 if (lprbbi == NULL) 3189 return FALSE;3368 return FALSE; 3190 3369 if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) 3191 return FALSE;3370 return FALSE; 3192 3371 if ((UINT)wParam >= infoPtr->uNumBands) 3193 return FALSE;3372 return FALSE; 3194 3373 3195 3374 TRACE("index %u\n", (UINT)wParam); … … 3201 3380 REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand); 3202 3381 if (lprbbi->fMask & RBBIM_TEXT) { 3203 if (lpBand->lpText) {3204 COMCTL32_Free (lpBand->lpText);3205 lpBand->lpText = NULL;3206 }3207 if (lprbbi->lpText) {3208 INT len = lstrlenW (lprbbi->lpText);3209 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));3210 strcpyW (lpBand->lpText, lprbbi->lpText);3211 }3382 if (lpBand->lpText) { 3383 COMCTL32_Free (lpBand->lpText); 3384 lpBand->lpText = NULL; 3385 } 3386 if (lprbbi->lpText) { 3387 INT len = lstrlenW (lprbbi->lpText); 3388 lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 3389 strcpyW (lpBand->lpText, lprbbi->lpText); 3390 } 3212 3391 } 3213 3392 … … 3216 3395 REBAR_DumpBand (infoPtr); 3217 3396 3218 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) 3397 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) { 3219 3398 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 3399 InvalidateRect(infoPtr->hwndSelf, 0, 1); 3400 } 3220 3401 3221 3402 return TRUE; … … 3231 3412 3232 3413 if (lpInfo == NULL) 3233 return FALSE;3414 return FALSE; 3234 3415 3235 3416 if (lpInfo->cbSize < sizeof (REBARINFO)) 3236 return FALSE;3417 return FALSE; 3237 3418 3238 3419 TRACE("setting bar info!\n"); 3239 3420 3240 3421 if (lpInfo->fMask & RBIM_IMAGELIST) { 3241 infoPtr->himl = lpInfo->himl;3242 if (infoPtr->himl) {3422 infoPtr->himl = lpInfo->himl; 3423 if (infoPtr->himl) { 3243 3424 INT cx, cy; 3244 ImageList_GetIconSize (infoPtr->himl, &cx, &cy);3245 infoPtr->imageSize.cx = cx;3246 infoPtr->imageSize.cy = cy;3247 }3248 else {3249 infoPtr->imageSize.cx = 0;3250 infoPtr->imageSize.cy = 0;3251 }3252 TRACE("new image cx=%ld, cy=%ld\n", infoPtr->imageSize.cx,3253 infoPtr->imageSize.cy);3425 ImageList_GetIconSize (infoPtr->himl, &cx, &cy); 3426 infoPtr->imageSize.cx = cx; 3427 infoPtr->imageSize.cy = cy; 3428 } 3429 else { 3430 infoPtr->imageSize.cx = 0; 3431 infoPtr->imageSize.cy = 0; 3432 } 3433 TRACE("new image cx=%ld, cy=%ld\n", infoPtr->imageSize.cx, 3434 infoPtr->imageSize.cy); 3254 3435 } 3255 3436 … … 3257 3438 for (i=0; i<infoPtr->uNumBands; i++) { 3258 3439 lpBand = &infoPtr->bands[i]; 3259 REBAR_ValidateBand (infoPtr, lpBand);3440 REBAR_ValidateBand (infoPtr, lpBand); 3260 3441 } 3261 3442 … … 3315 3496 BOOL bTemp = infoPtr->bUnicode; 3316 3497 3317 TRACE("to %s hwnd=0x%04x, was %s\n", 3318 ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf,3319 (bTemp) ? "TRUE" : "FALSE");3498 TRACE("to %s hwnd=0x%04x, was %s\n", 3499 ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf, 3500 (bTemp) ? "TRUE" : "FALSE"); 3320 3501 3321 3502 infoPtr->bUnicode = (BOOL)wParam; 3322 3503 3323 3504 return bTemp; 3324 3505 } … … 3331 3512 3332 3513 if (iVersion > COMCTL32_VERSION) 3333 return -1;3514 return -1; 3334 3515 3335 3516 infoPtr->iVersion = iVersion; … … 3347 3528 3348 3529 if (((INT)wParam < 0) || ((INT)wParam > infoPtr->uNumBands)) 3349 return FALSE;3530 return FALSE; 3350 3531 3351 3532 lpBand = &infoPtr->bands[(INT)wParam]; 3352 3533 3353 3534 if ((BOOL)lParam) { 3354 TRACE("show band %d\n", (INT)wParam);3355 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;3356 if (IsWindow (lpBand->hwndChild))3357 ShowWindow (lpBand->hwndChild, SW_SHOW);3535 TRACE("show band %d\n", (INT)wParam); 3536 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN; 3537 if (IsWindow (lpBand->hwndChild)) 3538 ShowWindow (lpBand->hwndChild, SW_SHOW); 3358 3539 } 3359 3540 else { 3360 TRACE("hide band %d\n", (INT)wParam);3361 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;3362 if (IsWindow (lpBand->hwndChild))3363 ShowWindow (lpBand->hwndChild, SW_HIDE);3541 TRACE("hide band %d\n", (INT)wParam); 3542 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN; 3543 if (IsWindow (lpBand->hwndChild)) 3544 ShowWindow (lpBand->hwndChild, SW_HIDE); 3364 3545 } 3365 3546 3366 3547 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 3548 InvalidateRect(infoPtr->hwndSelf, 0, 1); 3367 3549 3368 3550 return TRUE; … … 3380 3562 3381 3563 TRACE("[%d %d %d %d]\n", 3382 lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);3564 lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); 3383 3565 3384 3566 /* what is going on???? */ 3385 3567 GetWindowRect(infoPtr->hwndSelf, &t1); 3386 3568 TRACE("window rect [%d %d %d %d]\n", 3387 t1.left, t1.top, t1.right, t1.bottom);3569 t1.left, t1.top, t1.right, t1.bottom); 3388 3570 GetClientRect(infoPtr->hwndSelf, &t1); 3389 3571 TRACE("client rect [%d %d %d %d]\n", 3390 t1.left, t1.top, t1.right, t1.bottom);3572 t1.left, t1.top, t1.right, t1.bottom); 3391 3573 3392 3574 /* force full _Layout processing */ … … 3407 3589 3408 3590 if (TRACE_ON(rebar)) { 3409 GetWindowRect(infoPtr->hwndSelf, &wnrc1);3410 GetClientRect(infoPtr->hwndSelf, &clrc1);3411 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",3412 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,3413 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,3414 cs->x, cs->y, cs->cx, cs->cy);3591 GetWindowRect(infoPtr->hwndSelf, &wnrc1); 3592 GetClientRect(infoPtr->hwndSelf, &clrc1); 3593 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n", 3594 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 3595 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 3596 cs->x, cs->y, cs->cx, cs->cy); 3415 3597 } 3416 3598 … … 3429 3611 /* free rebar bands */ 3430 3612 if ((infoPtr->uNumBands > 0) && infoPtr->bands) { 3431 /* clean up each band */3432 for (i = 0; i < infoPtr->uNumBands; i++) {3433 lpBand = &infoPtr->bands[i];3434 3435 /* delete text strings */3436 if (lpBand->lpText) {3437 COMCTL32_Free (lpBand->lpText);3438 lpBand->lpText = NULL;3439 }3440 /* destroy child window */3441 DestroyWindow (lpBand->hwndChild);3442 }3443 3444 /* free band array */3445 COMCTL32_Free (infoPtr->bands);3446 infoPtr->bands = NULL;3613 /* clean up each band */ 3614 for (i = 0; i < infoPtr->uNumBands; i++) { 3615 lpBand = &infoPtr->bands[i]; 3616 3617 /* delete text strings */ 3618 if (lpBand->lpText) { 3619 COMCTL32_Free (lpBand->lpText); 3620 lpBand->lpText = NULL; 3621 } 3622 /* destroy child window */ 3623 DestroyWindow (lpBand->hwndChild); 3624 } 3625 3626 /* free band array */ 3627 COMCTL32_Free (infoPtr->bands); 3628 infoPtr->bands = NULL; 3447 3629 } 3448 3630 … … 3451 3633 DeleteObject (infoPtr->hcurVert); 3452 3634 DeleteObject (infoPtr->hcurDrag); 3635 DeleteObject (infoPtr->hFont); 3453 3636 SetWindowLongA (infoPtr->hwndSelf, 0, 0); 3454 3637 … … 3523 3706 if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) { 3524 3707 REBAR_Notify((NMHDR *) &layout, infoPtr, RBN_LAYOUTCHANGED); 3525 REBAR_Notify_NMREBAR (infoPtr, ihitBand, RBN_ENDDRAG);3526 infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED;3708 REBAR_Notify_NMREBAR (infoPtr, ihitBand, RBN_ENDDRAG); 3709 infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED; 3527 3710 } 3528 3711 … … 3548 3731 /* if mouse did not move much, exit */ 3549 3732 if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) && 3550 (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0;3733 (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0; 3551 3734 3552 3735 band1 = &infoPtr->bands[infoPtr->ihitBand-1]; … … 3555 3738 /* Test for valid drag case - must not be first band in row */ 3556 3739 if (infoPtr->dwStyle & CCS_VERT) { 3557 if ((ptsmove.x < band2->rcBand.left) || 3558 (ptsmove.x > band2->rcBand.right) || 3559 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3560 FIXME("Cannot drag to other rows yet!!\n"); 3740 if ((ptsmove.x < band2->rcBand.left) || 3741 (ptsmove.x > band2->rcBand.right) || 3742 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3743 FIXME("Cannot drag to other rows yet!!\n"); 3744 } 3745 else { 3746 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3747 } 3561 3748 } 3562 3749 else { 3563 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3564 } 3565 } 3566 else { 3567 if ((ptsmove.y < band2->rcBand.top) || 3568 (ptsmove.y > band2->rcBand.bottom) || 3569 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3570 FIXME("Cannot drag to other rows yet!!\n"); 3571 } 3572 else { 3573 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3574 } 3750 if ((ptsmove.y < band2->rcBand.top) || 3751 (ptsmove.y > band2->rcBand.bottom) || 3752 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3753 FIXME("Cannot drag to other rows yet!!\n"); 3754 } 3755 else { 3756 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3757 } 3575 3758 } 3576 3759 return 0; … … 3581 3764 REBAR_NCCalcSize (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3582 3765 { 3583 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 3584 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); 3585 3586 /* While the code below seems to be the reasonable way of */ 3587 /* handling the WS_BORDER style, the native version (as */ 3588 /* of 4.71 seems to only do the above. Go figure!! */ 3589 #if 0 3590 if (GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE) & WS_BORDER) { 3591 ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE); 3592 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 3593 ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE); 3594 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); 3595 } 3596 #endif 3597 3766 if (infoPtr->dwStyle & WS_BORDER) { 3767 InflateRect((LPRECT)lParam, -GetSystemMetrics(SM_CXEDGE), 3768 -GetSystemMetrics(SM_CYEDGE)); 3769 } 3770 TRACE("new client=(%d,%d)-(%d,%d)\n", 3771 ((LPRECT)lParam)->left, ((LPRECT)lParam)->top, 3772 ((LPRECT)lParam)->right, ((LPRECT)lParam)->bottom); 3598 3773 return 0; 3599 3774 } … … 3606 3781 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3607 3782 RECT wnrc1, clrc1; 3783 NONCLIENTMETRICSA ncm; 3784 HFONT tfont; 3608 3785 INT i; 3609 3786 3610 3787 if (infoPtr != NULL) { 3611 ERR("Strange info structure pointer *not* NULL\n");3612 return FALSE;3788 ERR("Strange info structure pointer *not* NULL\n"); 3789 return FALSE; 3613 3790 } 3614 3791 3615 3792 if (TRACE_ON(rebar)) { 3616 GetWindowRect(hwnd, &wnrc1);3617 GetClientRect(hwnd, &clrc1);3618 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",3619 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,3620 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,3621 cs->x, cs->y, cs->cx, cs->cy);3793 GetWindowRect(hwnd, &wnrc1); 3794 GetClientRect(hwnd, &clrc1); 3795 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n", 3796 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 3797 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 3798 cs->x, cs->y, cs->cx, cs->cy); 3622 3799 } 3623 3800 … … 3644 3821 infoPtr->bUnicode = IsWindowUnicode (hwnd); 3645 3822 infoPtr->fStatus = CREATE_RUNNING; 3823 infoPtr->hFont = GetStockObject (SYSTEM_FONT); 3646 3824 3647 3825 /* issue WM_NOTIFYFORMAT to get unicode status of parent */ 3648 3826 i = SendMessageA(REBAR_GetNotifyParent (infoPtr), 3649 WM_NOTIFYFORMAT, hwnd, NF_QUERY);3827 WM_NOTIFYFORMAT, hwnd, NF_QUERY); 3650 3828 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 3651 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",3652 i);3653 i = NFR_ANSI;3829 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 3830 i); 3831 i = NFR_ANSI; 3654 3832 } 3655 3833 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; … … 3659 3837 SetWindowLongA (hwnd, GWL_STYLE, infoPtr->dwStyle); 3660 3838 3839 /* get font handle for Caption Font */ 3840 ncm.cbSize = sizeof(NONCLIENTMETRICSA); 3841 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 3842 ncm.cbSize, &ncm, 0); 3843 /* if the font is bold, set to normal */ 3844 if (ncm.lfCaptionFont.lfWeight > FW_NORMAL) { 3845 ncm.lfCaptionFont.lfWeight = FW_NORMAL; 3846 } 3847 tfont = CreateFontIndirectA (&ncm.lfCaptionFont); 3848 if (tfont) { 3849 infoPtr->hFont = tfont; 3850 } 3851 3661 3852 /* native does: 3662 GetSysColor (numerous);3663 GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE);3664 GetStockObject (SYSTEM_FONT);3665 *SetWindowLong (hwnd, 0, info ptr);3666 *WM_NOTIFYFORMAT;3667 *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001);3853 GetSysColor (numerous); 3854 GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE); 3855 *GetStockObject (SYSTEM_FONT); 3856 *SetWindowLong (hwnd, 0, info ptr); 3857 *WM_NOTIFYFORMAT; 3858 *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001); 3668 3859 WS_VISIBLE = 0x10000000; 3669 3860 CCS_TOP = 0x00000001; 3670 SystemParametersInfo (SPI_GETNONCLIENTMETRICS...);3671 CreateFontIndirect (lfCaptionFont from above);3672 GetDC ();3673 SelectObject (hdc, fontabove);3674 GetTextMetrics (hdc, ); guessing is tmHeight3675 SelectObject (hdc, oldfont);3676 ReleaseDC ();3677 GetWindowRect ();3678 MapWindowPoints (0, parent, rectabove, 2);3679 GetWindowRect ();3680 GetClientRect ();3681 ClientToScreen (clientrect);3682 SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER);3861 *SystemParametersInfo (SPI_GETNONCLIENTMETRICS...); 3862 *CreateFontIndirect (lfCaptionFont from above); 3863 GetDC (); 3864 SelectObject (hdc, fontabove); 3865 GetTextMetrics (hdc, ); guessing is tmHeight 3866 SelectObject (hdc, oldfont); 3867 ReleaseDC (); 3868 GetWindowRect (); 3869 MapWindowPoints (0, parent, rectabove, 2); 3870 GetWindowRect (); 3871 GetClientRect (); 3872 ClientToScreen (clientrect); 3873 SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER); 3683 3874 */ 3684 3875 return TRUE; … … 3708 3899 clpt = pt; 3709 3900 ScreenToClient (infoPtr->hwndSelf, &clpt); 3710 REBAR_InternalHitTest (infoPtr, &clpt, &scrap, 3711 (INT *)&nmmouse.dwItemSpec);3901 REBAR_InternalHitTest (infoPtr, &clpt, &scrap, 3902 (INT *)&nmmouse.dwItemSpec); 3712 3903 nmmouse.dwItemData = 0; 3713 3904 nmmouse.pt = clpt; 3714 3905 nmmouse.dwHitInfo = 0; 3715 3906 if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) { 3716 TRACE("notify changed return value from %ld to %d\n",3717 ret, i); 3718 ret = (LRESULT) i;3907 TRACE("notify changed return value from %ld to %d\n", 3908 ret, i); 3909 ret = (LRESULT) i; 3719 3910 } 3720 3911 TRACE("returning %ld, client point (%ld,%ld)\n", ret, clpt.x, clpt.y); … … 3730 3921 3731 3922 if (infoPtr->dwStyle & WS_MINIMIZE) 3732 return 0; /* Nothing to do */ 3733 3734 DefWindowProcA (infoPtr->hwndSelf, WM_NCPAINT, wParam, lParam); 3735 3736 if (!(hdc = GetDCEx( infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW ))) 3737 return 0; 3923 return 0; /* Nothing to do */ 3738 3924 3739 3925 if (infoPtr->dwStyle & WS_BORDER) { 3740 GetWindowRect (infoPtr->hwndSelf, &rcWindow); 3741 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); 3742 TRACE("rect (%d,%d)-(%d,%d)\n", 3743 rcWindow.left, rcWindow.top, 3744 rcWindow.right, rcWindow.bottom); 3745 /* see comments in _NCCalcSize for reason this is not done */ 3746 /* DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); */ 3747 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP | BF_BOTTOM); 3748 } 3749 3750 ReleaseDC( infoPtr->hwndSelf, hdc ); 3926 3927 /* adjust rectangle and draw the necessary edge */ 3928 if (!(hdc = GetDCEx( infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW ))) 3929 return 0; 3930 GetWindowRect (infoPtr->hwndSelf, &rcWindow); 3931 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); 3932 TRACE("rect (%d,%d)-(%d,%d)\n", 3933 rcWindow.left, rcWindow.top, 3934 rcWindow.right, rcWindow.bottom); 3935 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); 3936 ReleaseDC( infoPtr->hwndSelf, hdc ); 3937 } 3751 3938 3752 3939 return 0; … … 3760 3947 3761 3948 if (lParam == NF_REQUERY) { 3762 i = SendMessageA(REBAR_GetNotifyParent (infoPtr),3763 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);3764 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {3765 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",3766 i);3767 i = NFR_ANSI;3768 }3769 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;3770 return (LRESULT)i;3949 i = SendMessageA(REBAR_GetNotifyParent (infoPtr), 3950 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY); 3951 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 3952 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 3953 i); 3954 i = NFR_ANSI; 3955 } 3956 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; 3957 return (LRESULT)i; 3771 3958 } 3772 3959 return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI); … … 3785 3972 3786 3973 TRACE("painting (%d,%d)-(%d,%d) client (%d,%d)-(%d,%d)\n", 3787 ps.rcPaint.left, ps.rcPaint.top,3788 ps.rcPaint.right, ps.rcPaint.bottom,3789 rc.left, rc.top, rc.right, rc.bottom);3974 ps.rcPaint.left, ps.rcPaint.top, 3975 ps.rcPaint.right, ps.rcPaint.bottom, 3976 rc.left, rc.top, rc.right, rc.bottom); 3790 3977 3791 3978 if (ps.fErase) { 3792 /* Erase area of paint if requested */3979 /* Erase area of paint if requested */ 3793 3980 REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint); 3794 3981 } … … 3796 3983 REBAR_Refresh (infoPtr, hdc); 3797 3984 if (!wParam) 3798 EndPaint (infoPtr->hwndSelf, &ps);3985 EndPaint (infoPtr->hwndSelf, &ps); 3799 3986 return 0; 3800 3987 } … … 3815 4002 3816 4003 if (flags == RBHT_GRABBER) { 3817 if ((infoPtr->dwStyle & CCS_VERT) &&3818 !(infoPtr->dwStyle & RBS_VERTICALGRIPPER))3819 SetCursor (infoPtr->hcurVert);3820 else3821 SetCursor (infoPtr->hcurHorz);4004 if ((infoPtr->dwStyle & CCS_VERT) && 4005 !(infoPtr->dwStyle & RBS_VERTICALGRIPPER)) 4006 SetCursor (infoPtr->hcurVert); 4007 else 4008 SetCursor (infoPtr->hcurHorz); 3822 4009 } 3823 4010 else if (flags != RBHT_CLIENT) 3824 SetCursor (infoPtr->hcurArrow);4011 SetCursor (infoPtr->hcurArrow); 3825 4012 3826 4013 return 0; … … 3840 4027 for (i=0; i<infoPtr->uNumBands; i++) { 3841 4028 lpBand = &infoPtr->bands[i]; 3842 REBAR_ValidateBand (infoPtr, lpBand);4029 REBAR_ValidateBand (infoPtr, lpBand); 3843 4030 } 3844 4031 … … 3861 4048 * 3862 4049 * Documentation: 3863 * According to testing V4.71 of COMCTL32 returns the 4050 * According to testing V4.71 of COMCTL32 returns the 3864 4051 * *previous* status of the redraw flag (either 0 or -1) 3865 4052 * instead of the MSDN documented value of 0 if handled … … 3869 4056 BOOL oldredraw = infoPtr->DoRedraw; 3870 4057 3871 TRACE("set to %s, fStatus=%08x\n", 3872 (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus);4058 TRACE("set to %s, fStatus=%08x\n", 4059 (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus); 3873 4060 infoPtr->DoRedraw = (BOOL) wParam; 3874 4061 if (wParam) { 3875 if (infoPtr->fStatus & BAND_NEEDS_REDRAW) {3876 REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands);3877 REBAR_ForceResize (infoPtr);3878 InvalidateRect (infoPtr->hwndSelf, 0, TRUE);3879 }3880 infoPtr->fStatus &= ~BAND_NEEDS_REDRAW;4062 if (infoPtr->fStatus & BAND_NEEDS_REDRAW) { 4063 REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands); 4064 REBAR_ForceResize (infoPtr); 4065 InvalidateRect (infoPtr->hwndSelf, 0, TRUE); 4066 } 4067 infoPtr->fStatus &= ~BAND_NEEDS_REDRAW; 3881 4068 } 3882 4069 return (oldredraw) ? -1 : 0; … … 3891 4078 /* auto resize deadlock check */ 3892 4079 if (infoPtr->fStatus & AUTO_RESIZE) { 3893 infoPtr->fStatus &= ~AUTO_RESIZE;3894 TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",3895 infoPtr->fStatus, lParam);3896 return 0;4080 infoPtr->fStatus &= ~AUTO_RESIZE; 4081 TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n", 4082 infoPtr->fStatus, lParam); 4083 return 0; 3897 4084 } 3898 4085 3899 4086 if (infoPtr->fStatus & CREATE_RUNNING) { 3900 /* still in CreateWindow */ 3901 RECT rcWin; 3902 3903 TRACE("still in CreateWindow\n"); 3904 infoPtr->fStatus &= ~CREATE_RUNNING; 3905 GetWindowRect ( infoPtr->hwndSelf, &rcWin); 3906 TRACE("win rect (%d,%d)-(%d,%d)\n", 3907 rcWin.left, rcWin.top, rcWin.right, rcWin.bottom); 3908 3909 if ((lParam == 0) && (rcWin.right-rcWin.left == 0) && 3910 (rcWin.bottom-rcWin.top == 0)) { 3911 /* native control seems to do this */ 3912 GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient); 3913 TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", 3914 rcClient.right, rcClient.bottom); 4087 /* still in CreateWindow */ 4088 RECT rcWin; 4089 4090 if ((INT)wParam != SIZE_RESTORED) { 4091 ERR("WM_SIZE in create and flags=%08x, lParam=%08lx\n", 4092 wParam, lParam); 4093 } 4094 4095 TRACE("still in CreateWindow\n"); 4096 infoPtr->fStatus &= ~CREATE_RUNNING; 4097 GetWindowRect ( infoPtr->hwndSelf, &rcWin); 4098 TRACE("win rect (%d,%d)-(%d,%d)\n", 4099 rcWin.left, rcWin.top, rcWin.right, rcWin.bottom); 4100 4101 if ((lParam == 0) && (rcWin.right-rcWin.left == 0) && 4102 (rcWin.bottom-rcWin.top == 0)) { 4103 /* native control seems to do this */ 4104 GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient); 4105 TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", 4106 rcClient.right, rcClient.bottom); 4107 } 4108 else { 4109 INT cx, cy; 4110 4111 cx = rcWin.right - rcWin.left; 4112 cy = rcWin.bottom - rcWin.top; 4113 if ((cx == LOWORD(lParam)) && (cy == HIWORD(lParam))) { 4114 return 0; 4115 } 4116 4117 /* do the actual WM_SIZE request */ 4118 GetClientRect (infoPtr->hwndSelf, &rcClient); 4119 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 4120 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 4121 LOWORD(lParam), HIWORD(lParam), 4122 rcClient.right, rcClient.bottom); 4123 } 3915 4124 } 3916 4125 else { 3917 INT cx, cy; 3918 3919 cx = rcWin.right - rcWin.left; 3920 cy = rcWin.bottom - rcWin.top; 3921 if ((cx == LOWORD(lParam)) && (cy == HIWORD(lParam))) { 3922 return 0; 3923 } 3924 3925 /* do the actual WM_SIZE request */ 3926 GetClientRect (infoPtr->hwndSelf, &rcClient); 3927 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3928 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3929 LOWORD(lParam), HIWORD(lParam), 3930 rcClient.right, rcClient.bottom); 3931 } 3932 } 3933 else { 3934 /* Handle cases when outside of the CreateWindow process */ 3935 3936 GetClientRect (infoPtr->hwndSelf, &rcClient); 3937 if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) && 3938 (infoPtr->dwStyle & RBS_AUTOSIZE)) { 3939 /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */ 3940 /* native seems to use the current client rect for the size */ 3941 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3942 TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n", 3943 rcClient.right, rcClient.bottom); 3944 } 3945 else { 3946 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3947 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3948 LOWORD(lParam), HIWORD(lParam), 3949 rcClient.right, rcClient.bottom); 3950 } 4126 if ((INT)wParam != SIZE_RESTORED) { 4127 ERR("WM_SIZE out of create and flags=%08x, lParam=%08lx\n", 4128 wParam, lParam); 4129 } 4130 4131 /* Handle cases when outside of the CreateWindow process */ 4132 4133 GetClientRect (infoPtr->hwndSelf, &rcClient); 4134 if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) && 4135 (infoPtr->dwStyle & RBS_AUTOSIZE)) { 4136 /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */ 4137 /* native seems to use the current client rect for the size */ 4138 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 4139 TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n", 4140 rcClient.right, rcClient.bottom); 4141 } 4142 else { 4143 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 4144 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 4145 LOWORD(lParam), HIWORD(lParam), 4146 rcClient.right, rcClient.bottom); 4147 } 3951 4148 } 3952 4149 3953 4150 if (infoPtr->dwStyle & RBS_AUTOSIZE) { 3954 NMRBAUTOSIZE autosize;3955 3956 GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget);3957 autosize.fChanged = 0; /* ??? */3958 autosize.rcActual = autosize.rcTarget; /* ??? */3959 REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE);3960 TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n", 3961 autosize.rcTarget.right, autosize.rcTarget.bottom, lParam);4151 NMRBAUTOSIZE autosize; 4152 4153 GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget); 4154 autosize.fChanged = 0; /* ??? */ 4155 autosize.rcActual = autosize.rcTarget; /* ??? */ 4156 REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE); 4157 TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n", 4158 autosize.rcTarget.right, autosize.rcTarget.bottom, lParam); 3962 4159 } 3963 4160 3964 4161 if ((infoPtr->calcSize.cx != rcClient.right) || 3965 (infoPtr->calcSize.cy != rcClient.bottom))3966 infoPtr->fStatus |= BAND_NEEDS_LAYOUT;4162 (infoPtr->calcSize.cy != rcClient.bottom)) 4163 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3967 4164 3968 4165 REBAR_Layout (infoPtr, &rcClient, TRUE, TRUE); … … 3979 4176 3980 4177 TRACE("current style=%08lx, styleOld=%08lx, style being set to=%08lx\n", 3981 infoPtr->dwStyle, ss->styleOld, ss->styleNew);4178 infoPtr->dwStyle, ss->styleOld, ss->styleNew); 3982 4179 infoPtr->dwStyle = ss->styleNew; 3983 4180 … … 3991 4188 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3992 4189 3993 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", 3994 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);4190 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", 4191 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); 3995 4192 if (!infoPtr && (uMsg != WM_NCCREATE)) 3996 return DefWindowProcA (hwnd, uMsg, wParam, lParam);4193 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 3997 4194 switch (uMsg) 3998 4195 { 3999 /* case RB_BEGINDRAG: */4000 4001 case RB_DELETEBAND:4002 return REBAR_DeleteBand (infoPtr, wParam, lParam);4003 4004 /* case RB_DRAGMOVE: */4005 /* case RB_ENDDRAG: */4006 4007 case RB_GETBANDBORDERS:4008 return REBAR_GetBandBorders (infoPtr, wParam, lParam);4009 4010 case RB_GETBANDCOUNT:4011 return REBAR_GetBandCount (infoPtr);4012 4013 case RB_GETBANDINFO:/* obsoleted after IE3, but we have to4014 support it anyway. */4015 case RB_GETBANDINFOA:4016 return REBAR_GetBandInfoA (infoPtr, wParam, lParam);4017 4018 case RB_GETBANDINFOW:4019 return REBAR_GetBandInfoW (infoPtr, wParam, lParam);4020 4021 case RB_GETBARHEIGHT:4022 return REBAR_GetBarHeight (infoPtr, wParam, lParam);4023 4024 case RB_GETBARINFO:4025 return REBAR_GetBarInfo (infoPtr, wParam, lParam);4026 4027 case RB_GETBKCOLOR:4028 return REBAR_GetBkColor (infoPtr);4029 4030 /* case RB_GETCOLORSCHEME: */4031 /* case RB_GETDROPTARGET: */4032 4033 case RB_GETPALETTE:4034 return REBAR_GetPalette (infoPtr, wParam, lParam);4035 4036 case RB_GETRECT:4037 return REBAR_GetRect (infoPtr, wParam, lParam);4038 4039 case RB_GETROWCOUNT:4040 return REBAR_GetRowCount (infoPtr);4041 4042 case RB_GETROWHEIGHT:4043 return REBAR_GetRowHeight (infoPtr, wParam, lParam);4044 4045 case RB_GETTEXTCOLOR:4046 return REBAR_GetTextColor (infoPtr);4047 4048 case RB_GETTOOLTIPS:4049 return REBAR_GetToolTips (infoPtr);4050 4051 case RB_GETUNICODEFORMAT:4052 return REBAR_GetUnicodeFormat (infoPtr);4053 4054 case CCM_GETVERSION:4055 return REBAR_GetVersion (infoPtr);4056 4057 case RB_HITTEST:4058 return REBAR_HitTest (infoPtr, wParam, lParam);4059 4060 case RB_IDTOINDEX:4061 return REBAR_IdToIndex (infoPtr, wParam, lParam);4062 4063 case RB_INSERTBANDA:4064 return REBAR_InsertBandA (infoPtr, wParam, lParam);4065 4066 case RB_INSERTBANDW:4067 return REBAR_InsertBandW (infoPtr, wParam, lParam);4068 4069 case RB_MAXIMIZEBAND:4070 return REBAR_MaximizeBand (infoPtr, wParam, lParam);4071 4072 case RB_MINIMIZEBAND:4073 return REBAR_MinimizeBand (infoPtr, wParam, lParam);4074 4075 case RB_MOVEBAND:4076 return REBAR_MoveBand (infoPtr, wParam, lParam);4077 4078 case RB_SETBANDINFOA:4079 return REBAR_SetBandInfoA (infoPtr, wParam, lParam);4080 4081 case RB_SETBANDINFOW:4082 return REBAR_SetBandInfoW (infoPtr, wParam, lParam);4083 4084 case RB_SETBARINFO:4085 return REBAR_SetBarInfo (infoPtr, wParam, lParam);4086 4087 case RB_SETBKCOLOR:4088 return REBAR_SetBkColor (infoPtr, wParam, lParam);4089 4090 /* case RB_SETCOLORSCHEME: */4091 /* case RB_SETPALETTE: */4092 /* return REBAR_GetPalette (infoPtr, wParam, lParam); */4093 4094 case RB_SETPARENT:4095 return REBAR_SetParent (infoPtr, wParam, lParam);4096 4097 case RB_SETTEXTCOLOR:4098 return REBAR_SetTextColor (infoPtr, wParam, lParam);4099 4100 /* case RB_SETTOOLTIPS: */4101 4102 case RB_SETUNICODEFORMAT:4103 return REBAR_SetUnicodeFormat (infoPtr, wParam);4104 4105 case CCM_SETVERSION:4106 return REBAR_SetVersion (infoPtr, (INT)wParam);4107 4108 case RB_SHOWBAND:4109 return REBAR_ShowBand (infoPtr, wParam, lParam);4110 4111 case RB_SIZETORECT:4112 return REBAR_SizeToRect (infoPtr, wParam, lParam);4196 /* case RB_BEGINDRAG: */ 4197 4198 case RB_DELETEBAND: 4199 return REBAR_DeleteBand (infoPtr, wParam, lParam); 4200 4201 /* case RB_DRAGMOVE: */ 4202 /* case RB_ENDDRAG: */ 4203 4204 case RB_GETBANDBORDERS: 4205 return REBAR_GetBandBorders (infoPtr, wParam, lParam); 4206 4207 case RB_GETBANDCOUNT: 4208 return REBAR_GetBandCount (infoPtr); 4209 4210 case RB_GETBANDINFO: /* obsoleted after IE3, but we have to 4211 support it anyway. */ 4212 case RB_GETBANDINFOA: 4213 return REBAR_GetBandInfoA (infoPtr, wParam, lParam); 4214 4215 case RB_GETBANDINFOW: 4216 return REBAR_GetBandInfoW (infoPtr, wParam, lParam); 4217 4218 case RB_GETBARHEIGHT: 4219 return REBAR_GetBarHeight (infoPtr, wParam, lParam); 4220 4221 case RB_GETBARINFO: 4222 return REBAR_GetBarInfo (infoPtr, wParam, lParam); 4223 4224 case RB_GETBKCOLOR: 4225 return REBAR_GetBkColor (infoPtr); 4226 4227 /* case RB_GETCOLORSCHEME: */ 4228 /* case RB_GETDROPTARGET: */ 4229 4230 case RB_GETPALETTE: 4231 return REBAR_GetPalette (infoPtr, wParam, lParam); 4232 4233 case RB_GETRECT: 4234 return REBAR_GetRect (infoPtr, wParam, lParam); 4235 4236 case RB_GETROWCOUNT: 4237 return REBAR_GetRowCount (infoPtr); 4238 4239 case RB_GETROWHEIGHT: 4240 return REBAR_GetRowHeight (infoPtr, wParam, lParam); 4241 4242 case RB_GETTEXTCOLOR: 4243 return REBAR_GetTextColor (infoPtr); 4244 4245 case RB_GETTOOLTIPS: 4246 return REBAR_GetToolTips (infoPtr); 4247 4248 case RB_GETUNICODEFORMAT: 4249 return REBAR_GetUnicodeFormat (infoPtr); 4250 4251 case CCM_GETVERSION: 4252 return REBAR_GetVersion (infoPtr); 4253 4254 case RB_HITTEST: 4255 return REBAR_HitTest (infoPtr, wParam, lParam); 4256 4257 case RB_IDTOINDEX: 4258 return REBAR_IdToIndex (infoPtr, wParam, lParam); 4259 4260 case RB_INSERTBANDA: 4261 return REBAR_InsertBandA (infoPtr, wParam, lParam); 4262 4263 case RB_INSERTBANDW: 4264 return REBAR_InsertBandW (infoPtr, wParam, lParam); 4265 4266 case RB_MAXIMIZEBAND: 4267 return REBAR_MaximizeBand (infoPtr, wParam, lParam); 4268 4269 case RB_MINIMIZEBAND: 4270 return REBAR_MinimizeBand (infoPtr, wParam, lParam); 4271 4272 case RB_MOVEBAND: 4273 return REBAR_MoveBand (infoPtr, wParam, lParam); 4274 4275 case RB_SETBANDINFOA: 4276 return REBAR_SetBandInfoA (infoPtr, wParam, lParam); 4277 4278 case RB_SETBANDINFOW: 4279 return REBAR_SetBandInfoW (infoPtr, wParam, lParam); 4280 4281 case RB_SETBARINFO: 4282 return REBAR_SetBarInfo (infoPtr, wParam, lParam); 4283 4284 case RB_SETBKCOLOR: 4285 return REBAR_SetBkColor (infoPtr, wParam, lParam); 4286 4287 /* case RB_SETCOLORSCHEME: */ 4288 /* case RB_SETPALETTE: */ 4289 /* return REBAR_GetPalette (infoPtr, wParam, lParam); */ 4290 4291 case RB_SETPARENT: 4292 return REBAR_SetParent (infoPtr, wParam, lParam); 4293 4294 case RB_SETTEXTCOLOR: 4295 return REBAR_SetTextColor (infoPtr, wParam, lParam); 4296 4297 /* case RB_SETTOOLTIPS: */ 4298 4299 case RB_SETUNICODEFORMAT: 4300 return REBAR_SetUnicodeFormat (infoPtr, wParam); 4301 4302 case CCM_SETVERSION: 4303 return REBAR_SetVersion (infoPtr, (INT)wParam); 4304 4305 case RB_SHOWBAND: 4306 return REBAR_ShowBand (infoPtr, wParam, lParam); 4307 4308 case RB_SIZETORECT: 4309 return REBAR_SizeToRect (infoPtr, wParam, lParam); 4113 4310 4114 4311 4115 4312 /* Messages passed to parent */ 4116 case WM_COMMAND:4117 case WM_DRAWITEM:4118 case WM_NOTIFY:4119 if (infoPtr->NtfUnicode)4120 return SendMessageW (REBAR_GetNotifyParent (infoPtr),4121 uMsg, wParam, lParam);4122 else4123 return SendMessageA (REBAR_GetNotifyParent (infoPtr),4124 uMsg, wParam, lParam);4313 case WM_COMMAND: 4314 case WM_DRAWITEM: 4315 case WM_NOTIFY: 4316 if (infoPtr->NtfUnicode) 4317 return SendMessageW (REBAR_GetNotifyParent (infoPtr), 4318 uMsg, wParam, lParam); 4319 else 4320 return SendMessageA (REBAR_GetNotifyParent (infoPtr), 4321 uMsg, wParam, lParam); 4125 4322 4126 4323 4127 4324 /* case WM_CHARTOITEM: supported according to ControlSpy */ 4128 4325 4129 case WM_CREATE:4130 return REBAR_Create (infoPtr, wParam, lParam);4131 4132 case WM_DESTROY:4133 return REBAR_Destroy (infoPtr, wParam, lParam);4326 case WM_CREATE: 4327 return REBAR_Create (infoPtr, wParam, lParam); 4328 4329 case WM_DESTROY: 4330 return REBAR_Destroy (infoPtr, wParam, lParam); 4134 4331 4135 4332 case WM_ERASEBKGND: 4136 return REBAR_EraseBkGnd (infoPtr, wParam, lParam);4137 4138 case WM_GETFONT:4139 return REBAR_GetFont (infoPtr, wParam, lParam);4333 return REBAR_EraseBkGnd (infoPtr, wParam, lParam); 4334 4335 case WM_GETFONT: 4336 return REBAR_GetFont (infoPtr, wParam, lParam); 4140 4337 4141 4338 /* case WM_LBUTTONDBLCLK: supported according to ControlSpy */ 4142 4339 4143 case WM_LBUTTONDOWN:4144 return REBAR_LButtonDown (infoPtr, wParam, lParam);4145 4146 case WM_LBUTTONUP:4147 return REBAR_LButtonUp (infoPtr, wParam, lParam);4340 case WM_LBUTTONDOWN: 4341 return REBAR_LButtonDown (infoPtr, wParam, lParam); 4342 4343 case WM_LBUTTONUP: 4344 return REBAR_LButtonUp (infoPtr, wParam, lParam); 4148 4345 4149 4346 /* case WM_MEASUREITEM: supported according to ControlSpy */ 4150 4347 4151 case WM_MOUSEMOVE:4152 return REBAR_MouseMove (infoPtr, wParam, lParam);4153 4154 case WM_NCCALCSIZE:4155 return REBAR_NCCalcSize (infoPtr, wParam, lParam);4348 case WM_MOUSEMOVE: 4349 return REBAR_MouseMove (infoPtr, wParam, lParam); 4350 4351 case WM_NCCALCSIZE: 4352 return REBAR_NCCalcSize (infoPtr, wParam, lParam); 4156 4353 4157 4354 case WM_NCCREATE: 4158 return REBAR_NCCreate (hwnd, wParam, lParam);4355 return REBAR_NCCreate (hwnd, wParam, lParam); 4159 4356 4160 4357 case WM_NCHITTEST: 4161 return REBAR_NCHitTest (infoPtr, wParam, lParam);4162 4163 case WM_NCPAINT:4164 return REBAR_NCPaint (infoPtr, wParam, lParam);4358 return REBAR_NCHitTest (infoPtr, wParam, lParam); 4359 4360 case WM_NCPAINT: 4361 return REBAR_NCPaint (infoPtr, wParam, lParam); 4165 4362 4166 4363 case WM_NOTIFYFORMAT: 4167 return REBAR_NotifyFormat (infoPtr, wParam, lParam);4168 4169 case WM_PAINT:4170 return REBAR_Paint (infoPtr, wParam, lParam);4364 return REBAR_NotifyFormat (infoPtr, wParam, lParam); 4365 4366 case WM_PAINT: 4367 return REBAR_Paint (infoPtr, wParam, lParam); 4171 4368 4172 4369 /* case WM_PALETTECHANGED: supported according to ControlSpy */ … … 4176 4373 /* case WM_RBUTTONUP: supported according to ControlSpy */ 4177 4374 4178 case WM_SETCURSOR:4179 return REBAR_SetCursor (infoPtr, wParam, lParam);4180 4181 case WM_SETFONT:4182 return REBAR_SetFont (infoPtr, wParam, lParam);4375 case WM_SETCURSOR: 4376 return REBAR_SetCursor (infoPtr, wParam, lParam); 4377 4378 case WM_SETFONT: 4379 return REBAR_SetFont (infoPtr, wParam, lParam); 4183 4380 4184 4381 case WM_SETREDRAW: 4185 return REBAR_SetRedraw (infoPtr, wParam, lParam);4186 4187 case WM_SIZE:4188 return REBAR_Size (infoPtr, wParam, lParam);4382 return REBAR_SetRedraw (infoPtr, wParam, lParam); 4383 4384 case WM_SIZE: 4385 return REBAR_Size (infoPtr, wParam, lParam); 4189 4386 4190 4387 case WM_STYLECHANGED: 4191 return REBAR_StyleChanged (infoPtr, wParam, lParam);4388 return REBAR_StyleChanged (infoPtr, wParam, lParam); 4192 4389 4193 4390 /* case WM_SYSCOLORCHANGE: supported according to ControlSpy */ 4194 4391 /* "Applications that have brushes using the existing system colors 4195 should delete those brushes and recreate them using the new 4392 should delete those brushes and recreate them using the new 4196 4393 system colors." per MSDN */ 4197 4394 4198 4395 /* case WM_VKEYTOITEM: supported according to ControlSpy */ 4199 /* case WM_WININICHANGE: */4200 4201 default:4202 if (uMsg >= WM_USER)4203 ERR("unknown msg %04x wp=%08x lp=%08lx\n",4204 uMsg, wParam, lParam);4396 /* case WM_WININICHANGE: */ 4397 4398 default: 4399 if (uMsg >= WM_USER) 4400 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 4401 uMsg, wParam, lParam); 4205 4402 #ifdef __WIN32OS2__ 4206 4403 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 4207 4404 #else 4208 return DefWindowProcA (hwnd, uMsg, wParam, lParam);4405 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 4209 4406 #endif 4210 4407 } … … 4225 4422 wndClass.hCursor = 0; 4226 4423 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); 4424 #if GLATESTING 4425 wndClass.hbrBackground = CreateSolidBrush(RGB(0,128,0)); 4426 #endif 4227 4427 wndClass.lpszClassName = REBARCLASSNAMEA; 4228 4428 4229 4429 RegisterClassA (&wndClass); 4230 4430
Note:
See TracChangeset
for help on using the changeset viewer.
