Changeset 6380 for trunk/src/comctl32/rebar.c
- Timestamp:
- Jul 21, 2001, 11:08:03 AM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/comctl32/rebar.c (modified) (129 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/rebar.c
r5630 r6380 1 1 /* 2 * Rebar control rev 6e 2 * 3 * 2. At "FIXME: problem # 2" WinRAR: 4 * if "#if 1" then last band draws in separate row 5 * if "#if 0" then last band draws in previous row *** just like native *** 6 * 7 */ 8 #define PROBLEM2 0 9 10 /* 11 * Rebar control rev 7f 3 12 * 4 13 * Copyright 1998, 1999 Eric Kohl … … 28 37 * RBS_BANDBORDERS. 29 38 * rev 6 30 * 1. Make drawing of rebar attempt to match pixel by pixel with MS. (6a) 31 * 2. Fix interlock between REBAR_ForceResize and REBAR_Size (AUTO_RESIZE flag) (6a) 32 * 3. Fix up some of the notifications (RBN_HEIGHTCHANGE). (6a) 33 * 4. Fix up DeleteBand by hiding child window. (6a) 34 * 5. Change how band borders are drawn and rects are invalidated. (6b) 35 * 6. Fix height of bar with only caption text. (6b) 36 * 7. RBBS_NOGRIPPER trumps RBBS_GRIPPERALWAYS (gripper hidden), but 37 * RBBS_GRIPPERALWAYS trumps RBBS_FIXEDSIZE (gripper displays). (6b) 38 * 8. New algorithim for AdjustBand: 39 * For all bands in a row: bands left to right are sized to their "cx" 40 * size (if space available). Also use max of (cxHeader+cxMinChild) and 41 * cx. (6c) 42 * 9. New alogrithim for Layout: 43 * Insert band in row if cxHeader space is available. If adjustment 44 * rect exists, then back out bands in row from last to second into 45 * separate rows till "y" adjustment rect equalled or exceeded. (6c) 46 * 10. Implement vertical drag. (6c) 47 * 11. Use DeferWindowPos to set child window position. (6c) 48 * 12. Fixup RBN_CHILDSIZE notify. The rcBand rectangle should start 49 * after the header. (6d) 50 * 13. Flags for DeferWindowPos seem to always be SWP_NOZORDER in the 51 * traces. (6d) 52 * 14. Make handling of ComboBox and ComboBoxEx the same in 53 * _MoveChildWindow. (6d) 54 * 15. Changes in phase 2 of _Layout for WinRAR example. (6e) 55 * 16. Do notify change size of children for WM_SIZE message. (6e) 56 * 17. Re-validate first band when second is added (for gripper add). (6e) 39 * - Fix or implement notifications for RBN_HEIGHTCHANGE, RBN_CHILDSIZE. 40 * - Correct styles RBBS_NOGRIPPER, RBBS_GRIPPERALWAYS, and RBBS_FIXEDSIZE. 41 * - Fix algorithm for Layout and AdjustBand. 57 42 * 43 * rev 7 44 * 1. Redesign _Layout to better emulate native. 45 * a. Flag rebar when a band needs to be (and all bands) need to 46 * go through rest of _Layout 47 * 2. Fix RBN_ENDDRAG contents. 48 * 3. REBAR_ForceResize changed to handle shrink of client. 49 * rev 7b 50 * 4. Support RBBS_HIDDEN in _Layout (phase 2 & 3), _InternalEraseBkgnd, 51 * and _InternalHitTest 52 * 5. Support RBS_VARHEIGHT. 53 * 6. Rewrite _AdjustBands with new algorithm. 54 * rev 7c 55 * 7. Format mask and style with labels. 56 * 8. Move calls to _ForceResize and _MoveChildWindows into _Layout to 57 * centralize processing. 58 * 9. Pass "infoPtr" to all routines instead of "hwnd" to eliminate extra 59 * calls to GetWindowLongA. 60 * 10. Use _MoveChildWindows in _HandleLRDrag. 61 * 11. Another rewrite of _AdjustBands with new algorithm. 62 * 12. Correct drawing of rebar borders and handling of RBS_BORDERS. 63 * rev 7d 64 * 13. Support WM_NOTIFYFORMAT (both incoming and outgoing) and do 65 * WM_NOTIFY correctly based on results. 66 * 14. Implement WM_SETREDRAW. 67 * 15. Native WM_ERASEBKGND draws horz and vert separators between bands and 68 * rows, and fills in the background color for each band. The gripper, 69 * image, and text for each band is drawn by the WM_PAINT process. Change 70 * this code to match. 71 * rev 7e 72 * 16. RBBS_FIXEDSIZE should not affect _AdjustBands. (Found by Mike McCormack 73 * in WinZip - Thanks!) 74 * 17. Implement WM_NCCREATE to set necessary additional styles and move most 75 * of creation stuff to it like native control. 76 * 18. WM_SETFONT should redraw only if LOWORD is TRUE. 77 * 19. Implement WM_NCHITTEST to send notify to parent of NM_NCHITTEST. 78 * 20. Cleaned up dead and/or testing code. 79 * 21. Support RB_MOVEBAND. 80 * 22. Support WM_STYLECHANGED and remove all (or most) of the GetWindowLong 81 * for GWL_STYLE. 82 * 23. Support RB_MINIMIZEBAND. 83 * 24. RBBS_HIDDEN (and the CCS_VERT+RBBS_NOVERT case) should be supported 84 * by all routines now. 85 * rev 7f 86 * 25. Fix handling of text color. 87 * 26. Correct implementation of WM_SETREDRAW to be closer to native. 88 * See REBAR_SetRedraw for doc changes of actual vs. MSDN 89 * 27. Do more implementation of RBS_AUTOSIZE in the WM_SIZE processor. 90 * 28. Implement RBBS_VARIABLEHEIGHT. Used by IE4. 91 * 29. Do more testing in WM_SIZE to handle strange cases like native. 58 92 * 59 93 * 60 94 * Still to do: 61 * 1. default row height should be the max height of all visible bands62 95 * 2. Following still not handled: RBBS_FIXEDBMP, RBBS_CHILDEDGE, 63 96 * RBBS_USECHEVRON 64 * 3. RBS_VARHEIGHT is assumed to always be on. 65 * 4. RBBS_HIDDEN (and the CCS_VERT + RBBS_NOVERT case) is not really 66 * supported by the following functions: 67 * _Layout (phase 2), _InternalEraseBkgnd, _InternalHitTest, 68 * _HandleLRDrag 69 * 5. _HandleLRDrag does not properly position ComboBox or ComboBoxEx 70 * children. (See code in _MoveChildWindow.) 71 97 * 3. Following are only partially handled: 98 * RBS_AUTOSIZE, RBBS_VARIABLEHEIGHT 99 * 5. Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT) 100 * to set the size of the separator width (the value SEP_WIDTH_SIZE 101 * in here). Should be fixed!! 102 * 6. The following messages are not implemented: 103 * RB_BEGINDRAG, RB_DRAGMOVE, RB_ENDDRAG, RB_GETCOLORSCHEME, 104 * RB_GETDROPTARGET, RB_MAXIMIZEBAND, 105 * RB_SETCOLORSCHEME, RB_SETPALETTE, RB_SETTOOLTIPS 106 * WM_CHARTOITEM, WM_LBUTTONDBLCLK, WM_MEASUREITEM, 107 * WM_PALETTECHANGED, WM_PRINTCLIENT, WM_QUERYNEWPALETTE, 108 * WM_RBUTTONDOWN, WM_RBUTTONUP, 109 * WM_SYSCOLORCHANGE, WM_VKEYTOITEM, WM_WININICHANGE 110 * 7. The following notifications are not implemented: 111 * NM_CUSTOMDRAW, NM_RELEASEDCAPTURE 112 * RB_CHEVRONPUSHED, RBN_MINMAX 72 113 */ 73 114 … … 75 116 #include <string.h> 76 117 118 #include "win.h" 77 119 #include "winbase.h" 78 120 #include "wingdi.h" 79 121 #include "wine/unicode.h" 80 122 #include "commctrl.h" 123 /* #include "spy.h" */ 81 124 #include "debugtools.h" 125 82 126 #ifdef __WIN32OS2__ 127 #include <winuser.h> 83 128 #include "ccbase.h" 84 129 #endif … … 88 133 typedef struct 89 134 { 135 #ifdef __WIN32OS2__ 136 COMCTL32_HEADER header; 137 #endif 90 138 UINT fStyle; 91 139 UINT fMask; … … 94 142 INT iImage; 95 143 HWND hwndChild; 96 UINT cxMinChild; 97 UINT cyMinChild; 98 UINT cx; 144 UINT cxMinChild; /* valid if _CHILDSIZE */ 145 UINT cyMinChild; /* valid if _CHILDSIZE */ 146 UINT cx; /* valid if _SIZE */ 99 147 HBITMAP hbmBack; 100 148 UINT wID; 101 UINT cyChild; 102 UINT cyMaxChild; 103 UINT cyIntegral; 149 UINT cyChild; /* valid if _CHILDSIZE */ 150 UINT cyMaxChild; /* valid if _CHILDSIZE */ 151 UINT cyIntegral; /* valid if _CHILDSIZE */ 104 152 UINT cxIdeal; 105 153 LPARAM lParam; … … 107 155 108 156 UINT lcx; /* minimum cx for band */ 157 UINT ccx; /* current cx for band */ 109 158 UINT hcx; /* maximum cx for band */ 110 159 UINT lcy; /* minimum cy for band */ 160 UINT ccy; /* current cy for band */ 111 161 UINT hcy; /* maximum cy for band */ 112 162 … … 116 166 UINT fStatus; /* status flags, reset only by _Validate */ 117 167 UINT fDraw; /* drawing flags, reset only by _Layout */ 168 RECT rcoldBand; /* previous calculated band rectangle */ 118 169 RECT rcBand; /* calculated band rectangle */ 119 170 RECT rcGripper; /* calculated gripper rectangle */ … … 137 188 #define DRAW_RIGHTSEP 0x00000010 138 189 #define DRAW_BOTTOMSEP 0x00000020 139 #define DRAW_SEPBOTH (DRAW_RIGHTSEP | DRAW_BOTTOMSEP)140 190 #define NTF_INVALIDATE 0x01000000 141 #define NTF_CHILDSIZE 0x02000000142 191 143 192 144 193 typedef struct 145 194 { 146 #ifdef __WIN32OS2__147 COMCTL32_HEADER header;148 #endif149 195 COLORREF clrBk; /* background color */ 150 196 COLORREF clrText; /* text color */ 197 COLORREF clrBtnText; /* system color for BTNTEXT */ 198 COLORREF clrBtnFace; /* system color for BTNFACE */ 151 199 HIMAGELIST himl; /* handle to imagelist */ 152 UINT uNumBands; /* number of bands in the rebar */ 153 UINT uNumRows; /* number of rows of bands */ 200 UINT uNumBands; /* # of bands in rebar (first=0, last=uNumRows-1 */ 201 UINT uNumRows; /* # of rows of bands (first=1, last=uNumRows */ 202 HWND hwndSelf; /* handle of REBAR window itself */ 154 203 HWND hwndToolTip; /* handle to the tool tip control */ 155 204 HWND hwndNotify; /* notification window (parent) */ 156 205 HFONT hFont; /* handle to the rebar's font */ 157 206 SIZE imageSize; /* image size (image list) */ 158 207 DWORD dwStyle; /* window style */ 159 208 SIZE calcSize; /* calculated rebar size */ 160 209 SIZE oldSize; /* previous calculated rebar size */ 161 BOOL bUnicode; /* Unicode flag */ 210 BOOL bUnicode; /* TRUE if this window is W type */ 211 BOOL NtfUnicode; /* TRUE if parent wants notify in W format */ 212 BOOL DoRedraw; /* TRUE to acutally draw bands */ 162 213 UINT fStatus; /* Status flags (see below) */ 163 214 HCURSOR hcurArrow; /* handle to the arrow cursor */ … … 175 226 176 227 /* fStatus flags */ 177 #define BEGIN_DRAG_ISSUED 1 178 #define AUTO_RESIZE 2 179 #define RESIZE_ANYHOW 4 180 #define NTF_HGHTCHG 8 228 #define BEGIN_DRAG_ISSUED 0x00000001 229 #define AUTO_RESIZE 0x00000002 230 #define RESIZE_ANYHOW 0x00000004 231 #define NTF_HGHTCHG 0x00000008 232 #define BAND_NEEDS_LAYOUT 0x00000010 233 #define BAND_NEEDS_REDRAW 0x00000020 234 #define CREATE_RUNNING 0x00000040 181 235 182 236 /* ---- REBAR layout constants. Mostly determined by ---- */ … … 186 240 /* vert.). True only if RBS_BANDBORDERS is set */ 187 241 #define SEP_WIDTH_SIZE 2 188 #define SEP_WIDTH (( dwStyle & RBS_BANDBORDERS) ? SEP_WIDTH_SIZE : 0)242 #define SEP_WIDTH ((infoPtr->dwStyle & RBS_BANDBORDERS) ? SEP_WIDTH_SIZE : 0) 189 243 190 244 /* Blank (background color) space between Gripper (if present) */ … … 215 269 216 270 217 /* The following 4defines return the proper rcBand element */271 /* The following 6 defines return the proper rcBand element */ 218 272 /* depending on whether CCS_VERT was set. */ 219 #define rcBlt(b) ((dwStyle & CCS_VERT) ? b->rcBand.top : b->rcBand.left) 220 #define rcBrb(b) ((dwStyle & CCS_VERT) ? b->rcBand.bottom : b->rcBand.right) 221 #define ircBlt(b) ((dwStyle & CCS_VERT) ? b->rcBand.left : b->rcBand.top) 222 #define ircBrb(b) ((dwStyle & CCS_VERT) ? b->rcBand.right : b->rcBand.bottom) 273 #define rcBlt(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.top : b->rcBand.left) 274 #define rcBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.bottom : b->rcBand.right) 275 #define rcBw(b) ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.bottom - b->rcBand.top) : \ 276 (b->rcBand.right - b->rcBand.left)) 277 #define ircBlt(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.left : b->rcBand.top) 278 #define ircBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.right : b->rcBand.bottom) 279 #define ircBw(b) ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.right - b->rcBand.left) : \ 280 (b->rcBand.bottom - b->rcBand.top)) 223 281 224 282 /* The following define determines if a given band is hidden */ 225 283 #define HIDDENBAND(a) (((a)->fStyle & RBBS_HIDDEN) || \ 226 (( dwStyle & CCS_VERT) && \284 ((infoPtr->dwStyle & CCS_VERT) && \ 227 285 ((a)->fStyle & RBBS_NOVERT))) 286 287 /* The following defines adjust the right or left end of a rectangle */ 288 #define READJ(b,i) {if(infoPtr->dwStyle & CCS_VERT) b->rcBand.bottom+=(i); \ 289 else b->rcBand.right += (i);} 290 #define LEADJ(b,i) {if(infoPtr->dwStyle & CCS_VERT) b->rcBand.top+=(i); \ 291 else b->rcBand.left += (i);} 228 292 229 293 … … 236 300 static UINT mindragy = 0; 237 301 302 static char *band_stylename[] = { 303 "RBBS_BREAK", /* 0001 */ 304 "RBBS_FIXEDSIZE", /* 0002 */ 305 "RBBS_CHILDEDGE", /* 0004 */ 306 "RBBS_HIDDEN", /* 0008 */ 307 "RBBS_NOVERT", /* 0010 */ 308 "RBBS_FIXEDBMP", /* 0020 */ 309 "RBBS_VARIABLEHEIGHT", /* 0040 */ 310 "RBBS_GRIPPERALWAYS", /* 0080 */ 311 "RBBS_NOGRIPPER", /* 0100 */ 312 NULL }; 313 314 static char *band_maskname[] = { 315 "RBBIM_STYLE", /* 0x00000001 */ 316 "RBBIM_COLORS", /* 0x00000002 */ 317 "RBBIM_TEXT", /* 0x00000004 */ 318 "RBBIM_IMAGE", /* 0x00000008 */ 319 "RBBIM_CHILD", /* 0x00000010 */ 320 "RBBIM_CHILDSIZE", /* 0x00000020 */ 321 "RBBIM_SIZE", /* 0x00000040 */ 322 "RBBIM_BACKGROUND", /* 0x00000080 */ 323 "RBBIM_ID", /* 0x00000100 */ 324 "RBBIM_IDEALSIZE", /* 0x00000200 */ 325 "RBBIM_LPARAM", /* 0x00000400 */ 326 "RBBIM_HEADERSIZE", /* 0x00000800 */ 327 NULL }; 328 329 330 static CHAR line[200]; 331 332 333 static CHAR * 334 REBAR_FmtStyle( UINT style) 335 { 336 INT i = 0; 337 338 *line = 0; 339 while (band_stylename[i]) { 340 if (style & (1<<i)) { 341 if (*line != 0) strcat(line, " | "); 342 strcat(line, band_stylename[i]); 343 } 344 i++; 345 } 346 return line; 347 } 348 349 350 static CHAR * 351 REBAR_FmtMask( UINT mask) 352 { 353 INT i = 0; 354 355 *line = 0; 356 while (band_maskname[i]) { 357 if (mask & (1<<i)) { 358 if (*line != 0) strcat(line, " | "); 359 strcat(line, band_maskname[i]); 360 } 361 i++; 362 } 363 return line; 364 } 365 238 366 239 367 static VOID 240 368 REBAR_DumpBandInfo( LPREBARBANDINFOA pB) 241 369 { 242 TRACE("band info: ID=%u, size=%u, style=0x%08x, mask=0x%08x, child=%04x\n", 243 pB->wID, pB->cbSize, pB->fStyle, pB->fMask, pB->hwndChild); 244 TRACE("band info: cx=%u, xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 245 pB->cx, pB->cxMinChild, 246 pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 247 TRACE("band info: xIdeal=%u, xHeader=%u, lParam=0x%08lx, clrF=0x%06lx, clrB=0x%06lx\n", 248 pB->cxIdeal, pB->cxHeader, pB->lParam, pB->clrFore, pB->clrBack); 370 if( !TRACE_ON(rebar) ) return; 371 TRACE("band info: ID=%u, size=%u, child=%04x, clrF=0x%06lx, clrB=0x%06lx\n", 372 pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack); 373 TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask)); 374 if (pB->fMask & RBBIM_STYLE) 375 TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle)); 376 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_HEADERSIZE | RBBIM_LPARAM )) { 377 TRACE("band info:"); 378 if (pB->fMask & RBBIM_SIZE) 379 DPRINTF(" cx=%u", pB->cx); 380 if (pB->fMask & RBBIM_IDEALSIZE) 381 DPRINTF(" xIdeal=%u", pB->cxIdeal); 382 if (pB->fMask & RBBIM_HEADERSIZE) 383 DPRINTF(" xHeader=%u", pB->cxHeader); 384 if (pB->fMask & RBBIM_LPARAM) 385 DPRINTF(" lParam=0x%08lx", pB->lParam); 386 DPRINTF("\n"); 387 } 388 if (pB->fMask & RBBIM_CHILDSIZE) 389 TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 390 pB->cxMinChild, 391 pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 249 392 } 250 393 251 394 static VOID 252 REBAR_DumpBand (HWND hwnd) 253 { 254 REBAR_INFO *iP = REBAR_GetInfoPtr (hwnd); 395 REBAR_DumpBand (REBAR_INFO *iP) 396 { 255 397 REBAR_BAND *pB; 256 398 UINT i; 257 399 258 if( TRACE_ON(rebar) ) { 259 260 TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", 261 hwnd, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows, 262 iP->calcSize.cx, iP->calcSize.cy); 263 TRACE("hwnd=%04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n", 264 hwnd, iP->fStatus, iP->dragStart.x, iP->dragStart.y, 265 iP->dragNow.x, iP->dragNow.y, 266 iP->ihitBand); 267 for (i = 0; i < iP->uNumBands; i++) { 400 if(! TRACE_ON(rebar) ) return; 401 402 TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", 403 iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows, 404 iP->calcSize.cx, iP->calcSize.cy); 405 TRACE("hwnd=%04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n", 406 iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y, 407 iP->dragNow.x, iP->dragNow.y, 408 iP->ihitBand); 409 TRACE("hwnd=%04x: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n", 410 iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE", 411 (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE"); 412 for (i = 0; i < iP->uNumBands; i++) { 268 413 pB = &iP->bands[i]; 269 TRACE("band # %u: ID=%u, mask=0x%08x, style=0x%08x, child=%04x, row=%u\n", 270 i, pB->wID, pB->fMask, pB->fStyle, pB->hwndChild, pB->iRow); 271 TRACE("band # %u: xMin=%u, yMin=%u, cx=%u, yChild=%u, yMax=%u, yIntgl=%u, uMinH=%u,\n", 272 i, pB->cxMinChild, pB->cyMinChild, pB->cx, 273 pB->cyChild, pB->cyMaxChild, pB->cyIntegral, pB->uMinHeight); 274 TRACE("band # %u: header=%u, lcx=%u, hcx=%u, lcy=%u, hcy=%u, offChild=%ld,%ld\n", 275 i, pB->cxHeader, pB->lcx, pB->hcx, pB->lcy, pB->hcy, pB->offChild.cx, pB->offChild.cy); 414 TRACE("band # %u: ID=%u, child=%04x, row=%u, clrF=0x%06lx, clrB=0x%06lx\n", 415 i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack); 416 TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask)); 417 if (pB->fMask & RBBIM_STYLE) 418 TRACE("band # %u: style=0x%08x (%s)\n", 419 i, pB->fStyle, REBAR_FmtStyle(pB->fStyle)); 420 TRACE("band # %u: uMinH=%u xHeader=%u", 421 i, pB->uMinHeight, pB->cxHeader); 422 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) { 423 if (pB->fMask & RBBIM_SIZE) 424 DPRINTF(" cx=%u", pB->cx); 425 if (pB->fMask & RBBIM_IDEALSIZE) 426 DPRINTF(" xIdeal=%u", pB->cxIdeal); 427 if (pB->fMask & RBBIM_LPARAM) 428 DPRINTF(" lParam=0x%08lx", pB->lParam); 429 } 430 DPRINTF("\n"); 431 if (RBBIM_CHILDSIZE) 432 TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", 433 i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); 434 TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n", 435 i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy); 276 436 TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n", 277 i, pB->fStatus, pB->fDraw,278 pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom,279 pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom);437 i, pB->fStatus, pB->fDraw, 438 pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom, 439 pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom); 280 440 TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n", 281 i,282 pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom,283 pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom,284 pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom);285 }286 287 }288 } 289 290 static INT291 REBAR_ Notify (HWND hwnd, NMHDR *nmhdr, REBAR_INFO *infoPtr, UINT code)441 i, 442 pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom, 443 pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom, 444 pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom); 445 } 446 447 } 448 449 450 static HWND 451 REBAR_GetNotifyParent (REBAR_INFO *infoPtr) 292 452 { 293 453 HWND parent, owner; … … 295 455 parent = infoPtr->hwndNotify; 296 456 if (!parent) { 297 parent = GetParent ( hwnd);298 owner = GetWindow ( hwnd, GW_OWNER);457 parent = GetParent (infoPtr->hwndSelf); 458 owner = GetWindow (infoPtr->hwndSelf, GW_OWNER); 299 459 if (owner) parent = owner; 300 460 } 301 nmhdr->idFrom = GetDlgCtrlID (hwnd); 302 nmhdr->hwndFrom = hwnd; 461 return parent; 462 } 463 464 465 static INT 466 REBAR_Notify (NMHDR *nmhdr, REBAR_INFO *infoPtr, UINT code) 467 { 468 HWND parent; 469 470 parent = REBAR_GetNotifyParent (infoPtr); 471 nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf); 472 nmhdr->hwndFrom = infoPtr->hwndSelf; 303 473 nmhdr->code = code; 304 474 305 return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom, 306 (LPARAM)nmhdr); 475 TRACE("window %04x, code=%08x, %s\n", parent, code, 476 (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI"); 477 478 if (infoPtr->NtfUnicode) 479 return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom, 480 (LPARAM)nmhdr); 481 else 482 return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom, 483 (LPARAM)nmhdr); 307 484 } 308 485 309 486 static INT 310 REBAR_Notify_NMREBAR ( HWND hwnd,REBAR_INFO *infoPtr, UINT uBand, UINT code)487 REBAR_Notify_NMREBAR (REBAR_INFO *infoPtr, UINT uBand, UINT code) 311 488 { 312 489 NMREBAR notify_rebar; … … 330 507 } 331 508 notify_rebar.uBand = uBand; 332 return REBAR_Notify ( hwnd,(NMHDR *)¬ify_rebar, infoPtr, code);509 return REBAR_Notify ((NMHDR *)¬ify_rebar, infoPtr, code); 333 510 } 334 511 335 512 static VOID 336 REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand, DWORD dwStyle) 337 { 338 339 /* draw separators on both the bottom and right */ 340 if ((lpBand->fDraw & DRAW_SEPBOTH) == DRAW_SEPBOTH) { 341 RECT rcSep; 342 SetRect (&rcSep, 343 lpBand->rcBand.left, 344 lpBand->rcBand.top, 345 lpBand->rcBand.right + SEP_WIDTH_SIZE, 346 lpBand->rcBand.bottom + SEP_WIDTH_SIZE); 347 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOMRIGHT); 348 TRACE("drawing band separator both (%d,%d)-(%d,%d)\n", 349 rcSep.left, rcSep.top, rcSep.right, rcSep.bottom); 350 } 351 352 /* draw band separator between bands in a row */ 353 if ((lpBand->fDraw & DRAW_SEPBOTH) == DRAW_RIGHTSEP) { 354 RECT rcSep; 355 if (dwStyle & CCS_VERT) { 356 SetRect (&rcSep, 357 lpBand->rcBand.left, 358 lpBand->rcBand.bottom, 359 lpBand->rcBand.right, 360 lpBand->rcBand.bottom + SEP_WIDTH_SIZE); 361 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM); 362 } 363 else { 364 SetRect (&rcSep, 365 lpBand->rcBand.right, 366 lpBand->rcBand.top, 367 lpBand->rcBand.right + SEP_WIDTH_SIZE, 368 lpBand->rcBand.bottom); 369 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT); 370 } 371 TRACE("drawing band separator right (%d,%d)-(%d,%d)\n", 372 rcSep.left, rcSep.top, rcSep.right, rcSep.bottom); 373 } 374 375 /* draw band separator between rows */ 376 if ((lpBand->fDraw & DRAW_SEPBOTH) == DRAW_BOTTOMSEP) { 377 RECT rcRowSep; 378 if (dwStyle & CCS_VERT) { 379 SetRect (&rcRowSep, 380 lpBand->rcBand.right, 381 lpBand->rcBand.top, 382 lpBand->rcBand.right + SEP_WIDTH_SIZE, 383 lpBand->rcBand.bottom); 384 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT); 385 } 386 else { 387 SetRect (&rcRowSep, 388 lpBand->rcBand.left, 389 lpBand->rcBand.bottom, 390 lpBand->rcBand.right, 391 lpBand->rcBand.bottom + SEP_WIDTH_SIZE); 392 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM); 393 } 394 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n", 395 rcRowSep.left, rcRowSep.top, 396 rcRowSep.right, rcRowSep.bottom); 397 } 513 REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand) 514 { 515 398 516 399 517 /* draw gripper */ … … 419 537 INT oldBkMode = SetBkMode (hdc, TRANSPARENT); 420 538 COLORREF oldcolor = CLR_NONE; 421 if (lpBand->clrFore != CLR_NONE)422 oldcolor = SetTextColor (hdc, lpBand->clrFore);539 oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ? 540 lpBand->clrFore : infoPtr->clrBtnText); 423 541 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, 424 542 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 425 543 if (oldBkMode != TRANSPARENT) 426 544 SetBkMode (hdc, oldBkMode); 427 if (lpBand->clrFore != CLR_NONE) 428 SetTextColor (hdc, oldcolor); 545 SetTextColor (hdc, oldcolor); 429 546 SelectObject (hdc, hOldFont); 430 547 } … … 433 550 434 551 static VOID 435 REBAR_Refresh (HWND hwnd, HDC hdc) 436 { 437 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 552 REBAR_Refresh (REBAR_INFO *infoPtr, HDC hdc) 553 { 438 554 REBAR_BAND *lpBand; 439 555 UINT i, oldrow; 440 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 556 557 if (!infoPtr->DoRedraw) return; 441 558 442 559 oldrow = infoPtr->bands[0].iRow; … … 444 561 lpBand = &infoPtr->bands[i]; 445 562 446 if ((lpBand->fStyle & RBBS_HIDDEN) || 447 ((dwStyle & CCS_VERT) && 448 (lpBand->fStyle & RBBS_NOVERT))) 449 continue; 563 if (HIDDENBAND(lpBand)) continue; 450 564 451 565 /* now draw the band */ 452 REBAR_DrawBand (hdc, infoPtr, lpBand, dwStyle); 453 454 } 455 } 566 REBAR_DrawBand (hdc, infoPtr, lpBand); 567 568 } 569 } 570 456 571 457 572 static void 458 REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, 459 INT maxx, INT usedx, INT mcy, DWORD dwStyle) 460 /* Function: This routine distributes the extra space in a row */ 461 /* by increasing bands from left to right to their "cx" width.*/ 462 /* Uses "cxHeader"+"cxMinChild" if it is bigger than "cx". */ 573 REBAR_FixVert (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, 574 INT mcy) 575 /* Function: */ 576 /* Cycle through bands in row and fix height of each band. */ 577 /* Also determine whether each band has changed. */ 578 /* On entry: */ 579 /* all bands at desired size. */ 580 /* start and end bands are *not* hidden */ 463 581 { 464 582 REBAR_BAND *lpBand; 465 UINT i; 466 INT j, k; 467 INT incr, current_width, lastx=0; 468 RECT oldband; 469 470 TRACE("start=%u, end=%u, max x=%d, used x=%d, max y=%d\n", 471 rowstart, rowend-1, maxx, usedx, mcy); 472 473 incr = maxx - usedx; 474 475 for (i = rowstart; i<rowend; i++) { 583 INT i; 584 585 for (i = (INT)rowstart; i<=(INT)rowend; i++) { 476 586 lpBand = &infoPtr->bands[i]; 477 587 if (HIDDENBAND(lpBand)) continue; 478 j = 0; 479 k = 0; 480 oldband = lpBand->rcBand; 481 482 /* get the current width of the band */ 483 if (dwStyle & CCS_VERT) 484 current_width = lpBand->rcBand.bottom - lpBand->rcBand.top; 485 else 486 current_width = lpBand->rcBand.right - lpBand->rcBand.left; 487 488 /* compute (in "j") the adjustment for this band */ 489 /* FIXME ??? should this not use "cx" and "cxHeader" and "cxMinChild" */ 490 if (!(lpBand->fStyle & RBBS_FIXEDSIZE)) { 491 if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0)) 492 j = min(lpBand->cx - current_width, incr); 493 if ((lpBand->fMask & RBBIM_CHILDSIZE) && 494 (lpBand->cxMinChild > 0) && 495 (lpBand->fMask & RBBIM_CHILD) && 496 (lpBand->hwndChild)) { 497 k = lpBand->cxHeader + lpBand->cxMinChild - current_width; 498 if (k > 0) { 499 j = max(k, j); 500 j = min(j, incr); 501 } 502 } 503 } 504 505 incr -= j; 506 507 /* validate values */ 508 if (incr < 0) { 509 ERR("failed, incr=%d, current_width=%d, j=%d, k=%d\n", 510 incr, current_width, j, k); 511 j -= incr; 512 incr = 0; 513 } 514 if (lastx + j + current_width > maxx) { 515 ERR("exceeded maximum, lastx=%d, j=%d, current_width=%d\n", 516 lastx, j, current_width); 517 j = maxx - lastx - current_width; 518 incr = 0; 519 } 520 521 /* adjust the band rectangle for adding width */ 522 /* and setting height of all bands in row. */ 523 if (dwStyle & CCS_VERT) { 524 lpBand->rcBand.top = lastx; 525 lpBand->rcBand.bottom = lastx + j + current_width; 526 if ((lpBand->rcBand.top != oldband.top) || 527 (lpBand->rcBand.bottom != oldband.bottom)) 528 lpBand->fDraw |= NTF_INVALIDATE; 529 if (lpBand->rcBand.right != lpBand->rcBand.left + mcy) { 588 589 /* adjust height of bands in row to "mcy" value */ 590 if (infoPtr->dwStyle & CCS_VERT) { 591 if (lpBand->rcBand.right != lpBand->rcBand.left + mcy) 530 592 lpBand->rcBand.right = lpBand->rcBand.left + mcy; 531 lpBand->fDraw |= NTF_INVALIDATE;532 }533 593 } 534 594 else { 535 lpBand->rcBand.left = lastx; 536 lpBand->rcBand.right = lastx + j + current_width; 537 if ((lpBand->rcBand.left != oldband.left) || 538 (lpBand->rcBand.right != oldband.right)) 539 lpBand->fDraw |= NTF_INVALIDATE; 540 if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy) { 595 if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy) 541 596 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy; 542 lpBand->fDraw |= NTF_INVALIDATE; 543 } 544 } 545 546 /* update to the next band start */ 547 lastx += (j + current_width + SEP_WIDTH); 548 if (j) { 549 TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d)\n", 597 598 } 599 600 /* mark whether we need to invalidate this band and trace */ 601 if ((lpBand->rcoldBand.left !=lpBand->rcBand.left) || 602 (lpBand->rcoldBand.top !=lpBand->rcBand.top) || 603 (lpBand->rcoldBand.right !=lpBand->rcBand.right) || 604 (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) { 605 lpBand->fDraw |= NTF_INVALIDATE; 606 TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d) from (%d,%d)-(%d,%d)\n", 550 607 i, lpBand->iRow, 551 608 lpBand->rcBand.left, lpBand->rcBand.top, 552 lpBand->rcBand.right, lpBand->rcBand.bottom); 553 } 554 else { 609 lpBand->rcBand.right, lpBand->rcBand.bottom, 610 lpBand->rcoldBand.left, lpBand->rcoldBand.top, 611 lpBand->rcoldBand.right, lpBand->rcoldBand.bottom); 612 } 613 else 555 614 TRACE("band %d row=%d: unchanged (%d,%d)-(%d,%d)\n", 556 615 i, lpBand->iRow, 557 616 lpBand->rcBand.left, lpBand->rcBand.top, 558 617 lpBand->rcBand.right, lpBand->rcBand.bottom); 559 } 560 } 561 562 /* if any remaining space then add to the rowstart band */ 563 if (incr > 0) { 564 lpBand = &infoPtr->bands[rowstart]; 565 lpBand->rcBand.right += incr; 566 TRACE("band %d row=%d: extended to (%d,%d)-(%d,%d)\n", 567 rowstart, lpBand->iRow, 568 lpBand->rcBand.left, lpBand->rcBand.top, 569 lpBand->rcBand.right, lpBand->rcBand.bottom); 570 for (i=rowstart+1; i<rowend; i++) { 571 lpBand = &infoPtr->bands[i]; 572 if (HIDDENBAND(lpBand)) continue; 573 lpBand->rcBand.left += incr; 574 lpBand->rcBand.right += incr; 575 lpBand->fDraw |= NTF_INVALIDATE; 576 } 577 } 578 } 618 } 619 } 620 579 621 580 622 static void 581 REBAR_CalcHorzBand (HWND hwnd, REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify, DWORD dwStyle) 623 REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, 624 INT maxx, INT mcy) 625 /* Function: This routine distributes the extra space in a row. */ 626 /* See algorithm below. */ 627 /* On entry: */ 628 /* all bands @ ->cxHeader size */ 629 /* start and end bands are *not* hidden */ 630 { 631 REBAR_BAND *lpBand; 632 UINT x, xsep, extra, curwidth, fudge; 633 INT i, last_adjusted; 634 635 TRACE("start=%u, end=%u, max x=%d, max y=%d\n", 636 rowstart, rowend, maxx, mcy); 637 638 /* ******************* Phase 1 ************************ */ 639 /* Alg: */ 640 /* For each visible band with valid child */ 641 /* a. inflate band till either all extra space used */ 642 /* or band's ->ccx reached. */ 643 /* If any band modified, add any space left to last band */ 644 /* adjusted. */ 645 /* */ 646 /* ****************************************************** */ 647 lpBand = &infoPtr->bands[rowend]; 648 extra = maxx - rcBrb(lpBand); 649 x = 0; 650 last_adjusted = 0; 651 for (i=(INT)rowstart; i<=(INT)rowend; i++) { 652 lpBand = &infoPtr->bands[i]; 653 if (HIDDENBAND(lpBand)) continue; 654 xsep = (x == 0) ? 0 : SEP_WIDTH; 655 curwidth = rcBw(lpBand); 656 657 /* set new left/top point */ 658 if (infoPtr->dwStyle & CCS_VERT) 659 lpBand->rcBand.top = x + xsep; 660 else 661 lpBand->rcBand.left = x + xsep; 662 663 /* compute new width */ 664 if (lpBand->hwndChild && extra) { 665 /* set to the "current" band size less the header */ 666 fudge = lpBand->ccx; 667 last_adjusted = i; 668 if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0) && 669 (fudge > curwidth)) { 670 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d, extra=%d\n", 671 i, fudge-curwidth, fudge, curwidth, extra); 672 if ((fudge - curwidth) > extra) 673 fudge = curwidth + extra; 674 extra -= (fudge - curwidth); 675 curwidth = fudge; 676 } 677 else { 678 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d\n", 679 i, extra, fudge, curwidth); 680 curwidth += extra; 681 extra = 0; 682 } 683 } 684 685 /* set new right/bottom point */ 686 if (infoPtr->dwStyle & CCS_VERT) 687 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth; 688 else 689 lpBand->rcBand.right = lpBand->rcBand.left + curwidth; 690 TRACE("Phase 1 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n", 691 i, lpBand->rcBand.left, lpBand->rcBand.top, 692 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep); 693 x = rcBrb(lpBand); 694 } 695 if ((x >= maxx) || last_adjusted) { 696 if (x > maxx) { 697 ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n", 698 x, maxx, rowstart, rowend); 699 } 700 /* done, so spread extra space */ 701 if (x < maxx) { 702 fudge = maxx - x; 703 TRACE("Need to spread %d on last adjusted band %d\n", 704 fudge, last_adjusted); 705 for (i=(INT)last_adjusted; i<=(INT)rowend; i++) { 706 lpBand = &infoPtr->bands[i]; 707 if (HIDDENBAND(lpBand)) continue; 708 709 /* set right/bottom point */ 710 if (i != last_adjusted) { 711 if (infoPtr->dwStyle & CCS_VERT) 712 lpBand->rcBand.top += fudge; 713 else 714 lpBand->rcBand.left += fudge; 715 } 716 717 /* set left/bottom point */ 718 if (infoPtr->dwStyle & CCS_VERT) 719 lpBand->rcBand.bottom += fudge; 720 else 721 lpBand->rcBand.right += fudge; 722 } 723 } 724 TRACE("Phase 1 succeeded, used x=%d\n", x); 725 REBAR_FixVert (infoPtr, rowstart, rowend, mcy); 726 return; 727 } 728 729 /* ******************* Phase 2 ************************ */ 730 /* Alg: */ 731 /* Find first visible band, put all */ 732 /* extra space there. */ 733 /* */ 734 /* ****************************************************** */ 735 736 x = 0; 737 for (i=(INT)rowstart; i<=(INT)rowend; i++) { 738 lpBand = &infoPtr->bands[i]; 739 if (HIDDENBAND(lpBand)) continue; 740 xsep = (x == 0) ? 0 : SEP_WIDTH; 741 curwidth = rcBw(lpBand); 742 743 /* set new left/top point */ 744 if (infoPtr->dwStyle & CCS_VERT) 745 lpBand->rcBand.top = x + xsep; 746 else 747 lpBand->rcBand.left = x + xsep; 748 749 /* compute new width */ 750 if (extra) { 751 curwidth += extra; 752 extra = 0; 753 } 754 755 /* set new right/bottom point */ 756 if (infoPtr->dwStyle & CCS_VERT) 757 lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth; 758 else 759 lpBand->rcBand.right = lpBand->rcBand.left + curwidth; 760 TRACE("Phase 2 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n", 761 i, lpBand->rcBand.left, lpBand->rcBand.top, 762 lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep); 763 x = rcBrb(lpBand); 764 } 765 if (x >= maxx) { 766 if (x > maxx) { 767 ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n", 768 x, maxx, rowstart, rowend); 769 } 770 /* done, so spread extra space */ 771 TRACE("Phase 2 succeeded, used x=%d\n", x); 772 REBAR_FixVert (infoPtr, rowstart, rowend, mcy); 773 return; 774 } 775 776 /* ******************* Phase 3 ************************ */ 777 /* at this point everything is back to ->cxHeader values */ 778 /* and should not have gotten here. */ 779 /* ****************************************************** */ 780 781 lpBand = &infoPtr->bands[rowstart]; 782 ERR("Serious problem adjusting row %d, start band %d, end band %d\n", 783 lpBand->iRow, rowstart, rowend); 784 REBAR_DumpBand (infoPtr); 785 return; 786 } 787 788 789 static void 790 REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify) 582 791 /* Function: this routine initializes all the rectangles in */ 583 792 /* each band in a row to fit in the adjusted rcBand rect. */ … … 590 799 591 800 /* MS seems to use GetDlgCtrlID() for above GetWindowLong call */ 592 parenthwnd = GetParent ( hwnd);801 parenthwnd = GetParent (infoPtr->hwndSelf); 593 802 594 803 for(i=rstart; i<rend; i++){ … … 682 891 lpBand->rcChild.left, lpBand->rcChild.top, 683 892 lpBand->rcChild.right, lpBand->rcChild.bottom); 684 lpBand->fDraw |= NTF_CHILDSIZE;685 893 } 686 894 if (lpBand->fDraw & NTF_INVALIDATE) { … … 694 902 if (lpBand->fDraw & DRAW_RIGHTSEP) work.right += SEP_WIDTH_SIZE; 695 903 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.bottom += SEP_WIDTH_SIZE; 696 InvalidateRect( hwnd, &work, TRUE);904 InvalidateRect(infoPtr->hwndSelf, &work, TRUE); 697 905 } 698 906 … … 703 911 704 912 static VOID 705 REBAR_CalcVertBand ( HWND hwnd, REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify, DWORD dwStyle)913 REBAR_CalcVertBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify) 706 914 /* Function: this routine initializes all the rectangles in */ 707 915 /* each band in a row to fit in the adjusted rcBand rect. */ … … 710 918 REBAR_BAND *lpBand; 711 919 UINT i, xoff, yoff; 712 NMREBARCHILDSIZE rbcz;713 920 HWND parenthwnd; 714 921 RECT oldChild, work; 715 922 716 rbcz.hdr.hwndFrom = hwnd;717 rbcz.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);718 923 /* MS seems to use GetDlgCtrlID() for above GetWindowLong call */ 719 parenthwnd = GetParent ( hwnd);924 parenthwnd = GetParent (infoPtr->hwndSelf); 720 925 721 926 for(i=rstart; i<rend; i++){ … … 732 937 lpBand->fDraw |= DRAW_GRIPPER; 733 938 734 if ( dwStyle & RBS_VERTICALGRIPPER) {939 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) { 735 940 /* vertical gripper */ 736 941 lpBand->rcGripper.left += 3; … … 825 1030 lpBand->rcChild.left, lpBand->rcChild.top, 826 1031 lpBand->rcChild.right, lpBand->rcChild.bottom); 827 lpBand->fDraw |= NTF_CHILDSIZE;828 1032 } 829 1033 if (lpBand->fDraw & NTF_INVALIDATE) { … … 837 1041 if (lpBand->fDraw & DRAW_RIGHTSEP) work.bottom += SEP_WIDTH_SIZE; 838 1042 if (lpBand->fDraw & DRAW_BOTTOMSEP) work.right += SEP_WIDTH_SIZE; 839 InvalidateRect( hwnd, &work, TRUE);1043 InvalidateRect(infoPtr->hwndSelf, &work, TRUE); 840 1044 } 841 1045 … … 845 1049 846 1050 static VOID 847 REBAR_Layout (HWND hwnd, LPRECT lpRect, BOOL notify, BOOL resetclient) 1051 REBAR_ForceResize (REBAR_INFO *infoPtr) 1052 /* Function: This changes the size of the REBAR window to that */ 1053 /* calculated by REBAR_Layout. */ 1054 { 1055 RECT rc; 1056 1057 /* TEST TEST TEST */ 1058 GetWindowRect (infoPtr->hwndSelf, &rc); 1059 /* END TEST END TEST END TEST */ 1060 1061 1062 GetClientRect (infoPtr->hwndSelf, &rc); 1063 1064 TRACE( " old [%ld x %ld], new [%ld x %ld], client [%d x %d]\n", 1065 infoPtr->oldSize.cx, infoPtr->oldSize.cy, 1066 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 1067 rc.right, rc.bottom); 1068 1069 /* If we need to shrink client, then skip size test */ 1070 if ((infoPtr->calcSize.cy >= rc.bottom) && 1071 (infoPtr->calcSize.cx >= rc.right)) { 1072 1073 /* if size did not change then skip process */ 1074 if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) && 1075 (infoPtr->oldSize.cy == infoPtr->calcSize.cy) && 1076 !(infoPtr->fStatus & RESIZE_ANYHOW)) 1077 { 1078 TRACE("skipping reset\n"); 1079 return; 1080 } 1081 } 1082 1083 infoPtr->fStatus &= ~RESIZE_ANYHOW; 1084 /* Set flag to ignore next WM_SIZE message */ 1085 infoPtr->fStatus |= AUTO_RESIZE; 1086 1087 rc.left = 0; 1088 rc.top = 0; 1089 rc.right = infoPtr->calcSize.cx; 1090 rc.bottom = infoPtr->calcSize.cy; 1091 1092 InflateRect (&rc, 0, GetSystemMetrics(SM_CYEDGE)); 1093 /* see comments in _NCCalcSize for reason below is not done */ 1094 #if 0 1095 if (GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE) & WS_BORDER) { 1096 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); 1097 } 1098 #endif 1099 1100 TRACE("setting to (0,0)-(%d,%d)\n", 1101 rc.right - rc.left, rc.bottom - rc.top); 1102 SetWindowPos (infoPtr->hwndSelf, 0, 0, 0, 1103 rc.right - rc.left, rc.bottom - rc.top, 1104 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); 1105 } 1106 1107 1108 static VOID 1109 REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus) 1110 { 1111 REBAR_BAND *lpBand; 1112 CHAR szClassName[40]; 1113 UINT i; 1114 NMREBARCHILDSIZE rbcz; 1115 NMHDR heightchange; 1116 HDWP deferpos; 1117 1118 if (!(deferpos = BeginDeferWindowPos(infoPtr->uNumBands))) 1119 ERR("BeginDeferWindowPos returned NULL\n"); 1120 1121 for (i = start; i < endplus; i++) { 1122 lpBand = &infoPtr->bands[i]; 1123 1124 if (HIDDENBAND(lpBand)) continue; 1125 if (lpBand->hwndChild) { 1126 TRACE("hwndChild = %x\n", lpBand->hwndChild); 1127 1128 /* Always geterate the RBN_CHILDSIZE even it child 1129 did not change */ 1130 rbcz.uBand = i; 1131 rbcz.wID = lpBand->wID; 1132 rbcz.rcChild = lpBand->rcChild; 1133 rbcz.rcBand = lpBand->rcBand; 1134 rbcz.rcBand.left += lpBand->cxHeader; 1135 REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE); 1136 if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) { 1137 TRACE("Child rect changed by NOTIFY for band %u\n", i); 1138 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 1139 lpBand->rcChild.left, lpBand->rcChild.top, 1140 lpBand->rcChild.right, lpBand->rcChild.bottom, 1141 rbcz.rcChild.left, rbcz.rcChild.top, 1142 rbcz.rcChild.right, rbcz.rcChild.bottom); 1143 } 1144 1145 GetClassNameA (lpBand->hwndChild, szClassName, 40); 1146 if (!lstrcmpA (szClassName, "ComboBox") || 1147 !lstrcmpA (szClassName, WC_COMBOBOXEXA)) { 1148 INT nEditHeight, yPos; 1149 RECT rc; 1150 1151 /* special placement code for combo or comboex box */ 1152 1153 1154 /* get size of edit line */ 1155 GetWindowRect (lpBand->hwndChild, &rc); 1156 nEditHeight = rc.bottom - rc.top; 1157 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; 1158 1159 /* center combo box inside child area */ 1160 TRACE("moving child (Combo(Ex)) %04x to (%d,%d) for (%d,%d)\n", 1161 lpBand->hwndChild, 1162 lpBand->rcChild.left, yPos, 1163 lpBand->rcChild.right - lpBand->rcChild.left, 1164 nEditHeight); 1165 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1166 lpBand->rcChild.left, 1167 /*lpBand->rcChild.top*/ yPos, 1168 lpBand->rcChild.right - lpBand->rcChild.left, 1169 nEditHeight, 1170 SWP_NOZORDER); 1171 if (!deferpos) 1172 ERR("DeferWindowPos returned NULL\n"); 1173 } 1174 else { 1175 TRACE("moving child (Other) %04x to (%d,%d) for (%d,%d)\n", 1176 lpBand->hwndChild, 1177 lpBand->rcChild.left, lpBand->rcChild.top, 1178 lpBand->rcChild.right - lpBand->rcChild.left, 1179 lpBand->rcChild.bottom - lpBand->rcChild.top); 1180 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1181 lpBand->rcChild.left, 1182 lpBand->rcChild.top, 1183 lpBand->rcChild.right - lpBand->rcChild.left, 1184 lpBand->rcChild.bottom - lpBand->rcChild.top, 1185 SWP_NOZORDER); 1186 if (!deferpos) 1187 ERR("DeferWindowPos returned NULL\n"); 1188 } 1189 } 1190 } 1191 if (!EndDeferWindowPos(deferpos)) 1192 ERR("EndDeferWindowPos returned NULL\n"); 1193 if (infoPtr->fStatus & NTF_HGHTCHG) { 1194 infoPtr->fStatus &= ~NTF_HGHTCHG; 1195 REBAR_Notify (&heightchange, infoPtr, RBN_HEIGHTCHANGE); 1196 } 1197 } 1198 1199 1200 static VOID 1201 REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient) 848 1202 /* Function: This routine is resposible for laying out all */ 849 1203 /* the bands in a rebar. It assigns each band to a row and*/ 850 1204 /* determines when to start a new row. */ 851 1205 { 852 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);853 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);854 1206 REBAR_BAND *lpBand, *prevBand; 855 RECT rcClient, rcAdj , rcoldBand;856 INT x, y, cx, cxsep, m cy, clientcx, clientcy;1207 RECT rcClient, rcAdj; 1208 INT x, y, cx, cxsep, mmcy, mcy, clientcx, clientcy; 857 1209 INT adjcx, adjcy, row, rightx, bottomy, origheight; 858 UINT i, rowstartband;1210 UINT i, j, rowstart; 859 1211 BOOL dobreak; 860 1212 861 GetClientRect (hwnd, &rcClient); 1213 if (!(infoPtr->fStatus & BAND_NEEDS_LAYOUT)) { 1214 TRACE("no layout done. No band changed.\n"); 1215 REBAR_DumpBand (infoPtr); 1216 return; 1217 } 1218 infoPtr->fStatus &= ~BAND_NEEDS_LAYOUT; 1219 if (!infoPtr->DoRedraw) infoPtr->fStatus |= BAND_NEEDS_REDRAW; 1220 1221 GetClientRect (infoPtr->hwndSelf, &rcClient); 862 1222 TRACE("Client is (%d,%d)-(%d,%d)\n", 863 1223 rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); … … 882 1242 } 883 1243 1244 if (!infoPtr->DoRedraw && (clientcx == 0) && (clientcy == 0)) { 1245 ERR("no redraw and client is zero, skip layout\n"); 1246 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 1247 return; 1248 } 1249 884 1250 /* save height of original control */ 885 if ( dwStyle & CCS_VERT)1251 if (infoPtr->dwStyle & CCS_VERT) 886 1252 origheight = infoPtr->calcSize.cx; 887 1253 else … … 891 1257 /* ******* Start Phase 1 - all bands on row at minimum size ******* */ 892 1258 1259 TRACE("band loop constants, clientcx=%d, clientcy=%d\n", 1260 clientcx, clientcy); 893 1261 x = 0; 894 1262 y = 0; … … 896 1264 cx = 0; 897 1265 mcy = 0; 1266 rowstart = 0; 898 1267 prevBand = NULL; 899 1268 … … 903 1272 lpBand->iRow = row; 904 1273 905 if ((lpBand->fStyle & RBBS_HIDDEN) || 906 ((dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT))) 907 continue; 908 909 rcoldBand = lpBand->rcBand; 1274 if (HIDDENBAND(lpBand)) continue; 1275 1276 lpBand->rcoldBand = lpBand->rcBand; 910 1277 911 1278 /* separator from previous band */ 912 cxsep = ( (( dwStyle & CCS_VERT) ? y : x)==0) ? 0 : SEP_WIDTH;1279 cxsep = ( ((infoPtr->dwStyle & CCS_VERT) ? y : x)==0) ? 0 : SEP_WIDTH; 913 1280 914 1281 /* Header: includes gripper, text, image */ 915 1282 cx = lpBand->cxHeader; 916 if (lpBand->fStyle & RBBS_FIXEDSIZE) cx += lpBand->lcx;917 918 if ( dwStyle & CCS_VERT)1283 if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx; 1284 1285 if (infoPtr->dwStyle & CCS_VERT) 919 1286 dobreak = (y + cx + cxsep > adjcy); 920 1287 else … … 923 1290 /* This is the check for whether we need to start a new row */ 924 1291 if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) || 925 ( ((dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) { 1292 ( ((infoPtr->dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) { 1293 1294 for (j = rowstart; j < i; j++) { 1295 REBAR_BAND *lpB; 1296 lpB = &infoPtr->bands[j]; 1297 if (infoPtr->dwStyle & CCS_VERT) { 1298 lpB->rcBand.right = lpB->rcBand.left + mcy; 1299 } 1300 else { 1301 lpB->rcBand.bottom = lpB->rcBand.top + mcy; 1302 } 1303 } 1304 926 1305 TRACE("Spliting to new row %d on band %u\n", row+1, i); 927 if ( dwStyle & CCS_VERT) {1306 if (infoPtr->dwStyle & CCS_VERT) { 928 1307 y = 0; 929 1308 x += (mcy + SEP_WIDTH); … … 934 1313 } 935 1314 936 /* FIXME: if not RBS_VARHEIGHT then find max */937 1315 mcy = 0; 938 1316 cxsep = 0; … … 940 1318 lpBand->iRow = row; 941 1319 prevBand = NULL; 1320 rowstart = i; 942 1321 } 943 1322 … … 946 1325 /* if boundary rect specified then limit mcy */ 947 1326 if (lpRect) { 948 if ( dwStyle & CCS_VERT) {1327 if (infoPtr->dwStyle & CCS_VERT) { 949 1328 if (x+mcy > adjcx) { 950 1329 mcy = adjcx - x; … … 962 1341 } 963 1342 964 if (dwStyle & CCS_VERT) { 1343 TRACE("band %u, row %d, x=%d, y=%d, cxsep=%d, cx=%d\n", 1344 i, row, 1345 x, y, cxsep, cx); 1346 if (infoPtr->dwStyle & CCS_VERT) { 965 1347 /* bound the bottom side if we have a bounding rectangle */ 966 if ((x>0) && (dwStyle & RBS_BANDBORDERS) && prevBand)967 prevBand->fDraw |= DRAW_RIGHTSEP;968 1348 rightx = clientcx; 969 1349 bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx; … … 973 1353 lpBand->rcBand.bottom = bottomy; 974 1354 lpBand->uMinHeight = lpBand->lcy; 975 if (!EqualRect(&rcoldBand, &lpBand->rcBand))976 lpBand->fDraw |= NTF_INVALIDATE;977 1355 y = bottomy; 978 1356 } 979 1357 else { 980 1358 /* bound the right side if we have a bounding rectangle */ 981 if ((x>0) && (dwStyle & RBS_BANDBORDERS) && prevBand)982 prevBand->fDraw |= DRAW_RIGHTSEP;983 1359 rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx; 984 1360 bottomy = clientcy; … … 988 1364 lpBand->rcBand.bottom = y + min(mcy, lpBand->lcy+REBARSPACE); 989 1365 lpBand->uMinHeight = lpBand->lcy; 990 if (!EqualRect(&rcoldBand, &lpBand->rcBand))991 lpBand->fDraw |= NTF_INVALIDATE;992 1366 x = rightx; 993 1367 } … … 1000 1374 } /* for (i = 0; i < infoPtr->uNumBands... */ 1001 1375 1002 if ( dwStyle & CCS_VERT)1376 if (infoPtr->dwStyle & CCS_VERT) 1003 1377 x += mcy; 1004 1378 else 1005 1379 y += mcy; 1006 1380 1381 for (j = rowstart; j < infoPtr->uNumBands; j++) { 1382 lpBand = &infoPtr->bands[j]; 1383 if (infoPtr->dwStyle & CCS_VERT) { 1384 lpBand->rcBand.right = lpBand->rcBand.left + mcy; 1385 } 1386 else { 1387 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy; 1388 } 1389 } 1390 1007 1391 if (infoPtr->uNumBands) 1008 1392 infoPtr->uNumRows = row; 1009 1393 1010 1394 /* ******* End Phase 1 - all bands on row at minimum size ******* */ 1395 1396 1397 /* ******* Start Phase 1a - Adjust heights for RBS_VARHEIGHT off ******* */ 1398 1399 mmcy = 0; 1400 if (!(infoPtr->dwStyle & RBS_VARHEIGHT)) { 1401 INT xy; 1402 1403 /* get the max height of all bands */ 1404 for (i=0; i<infoPtr->uNumBands; i++) { 1405 lpBand = &infoPtr->bands[i]; 1406 if (HIDDENBAND(lpBand)) continue; 1407 if (infoPtr->dwStyle & CCS_VERT) 1408 mmcy = max(mmcy, lpBand->rcBand.right - lpBand->rcBand.left); 1409 else 1410 mmcy = max(mmcy, lpBand->rcBand.bottom - lpBand->rcBand.top); 1411 } 1412 1413 /* now adjust all rectangles by using the height found above */ 1414 xy = 0; 1415 row = 1; 1416 for (i=0; i<infoPtr->uNumBands; i++) { 1417 lpBand = &infoPtr->bands[i]; 1418 if (HIDDENBAND(lpBand)) continue; 1419 if (lpBand->iRow != row) 1420 xy += (mmcy + SEP_WIDTH); 1421 if (infoPtr->dwStyle & CCS_VERT) { 1422 lpBand->rcBand.left = xy; 1423 lpBand->rcBand.right = xy + mmcy; 1424 } 1425 else { 1426 lpBand->rcBand.top = xy; 1427 lpBand->rcBand.bottom = xy + mmcy; 1428 } 1429 } 1430 1431 /* set the x/y values to the correct maximum */ 1432 if (infoPtr->dwStyle & CCS_VERT) 1433 x = xy + mmcy; 1434 else 1435 y = xy + mmcy; 1436 } 1437 1438 /* ******* End Phase 1a - Adjust heights for RBS_VARHEIGHT off ******* */ 1011 1439 1012 1440 … … 1016 1444 /* y/x current height/width of all rows */ 1017 1445 if (lpRect) { 1018 INT i, j, prev_rh, current_rh, new_rh, adj_rh;1446 INT i, j, prev_rh, new_rh, adj_rh, prev_idx, current_idx; 1019 1447 REBAR_BAND *prev, *current, *walk; 1020 1448 1021 /* if (((dwStyle & CCS_VERT) ? (x < adjcx) : (y < adjcy)) && */ 1022 1023 if (((dwStyle & CCS_VERT) ? (adjcx - x > 4) : (adjcy - y > 4)) && 1449 /* FIXME: problem # 2 */ 1450 if (((infoPtr->dwStyle & CCS_VERT) ? 1451 #if PROBLEM2 1452 (x < adjcx) : (y < adjcy) 1453 #else 1454 (adjcx - x > 4) : (adjcy - y > 4) 1455 #endif 1456 ) && 1024 1457 (infoPtr->uNumBands > 1)) { 1025 for (i= infoPtr->uNumBands-2; i>=0; i--) {1458 for (i=(INT)infoPtr->uNumBands-2; i>=0; i--) { 1026 1459 TRACE("adjcx=%d, adjcy=%d, x=%d, y=%d\n", 1027 1460 adjcx, adjcy, x, y); 1461 1462 /* find the current band (starts at i+1) */ 1463 current = &infoPtr->bands[i+1]; 1464 current_idx = i+1; 1465 while (HIDDENBAND(current)) { 1466 i--; 1467 if (i < 0) break; /* out of bands */ 1468 current = &infoPtr->bands[i+1]; 1469 current_idx = i+1; 1470 } 1471 if (i < 0) break; /* out of bands */ 1472 1473 /* now find the prev band (starts at i) */ 1028 1474 prev = &infoPtr->bands[i]; 1029 prev_rh = ircBrb(prev) - ircBlt(prev); 1030 current = &infoPtr->bands[i+1]; 1031 current_rh = ircBrb(current) - ircBlt(current); 1475 prev_idx = i; 1476 while (HIDDENBAND(prev)) { 1477 i--; 1478 if (i < 0) break; /* out of bands */ 1479 prev = &infoPtr->bands[i]; 1480 prev_idx = i; 1481 } 1482 if (i < 0) break; /* out of bands */ 1483 1484 prev_rh = ircBw(prev); 1032 1485 if (prev->iRow == current->iRow) { 1033 new_rh = current->lcy + REBARSPACE; 1034 adj_rh = prev_rh + new_rh + SEP_WIDTH - current_rh; 1486 new_rh = (infoPtr->dwStyle & RBS_VARHEIGHT) ? 1487 current->lcy + REBARSPACE : 1488 mmcy; 1489 adj_rh = new_rh + SEP_WIDTH; 1035 1490 infoPtr->uNumRows++; 1036 1491 current->fDraw |= NTF_INVALIDATE; 1037 1492 current->iRow++; 1038 if ( dwStyle & CCS_VERT) {1493 if (infoPtr->dwStyle & CCS_VERT) { 1039 1494 current->rcBand.top = 0; 1040 1495 current->rcBand.bottom = clientcy; … … 1051 1506 } 1052 1507 TRACE("moving band %d to own row at (%d,%d)-(%d,%d)\n", 1053 i+1,1508 current_idx, 1054 1509 current->rcBand.left, current->rcBand.top, 1055 1510 current->rcBand.right, current->rcBand.bottom); 1056 1511 TRACE("prev band %d at (%d,%d)-(%d,%d)\n", 1057 i,1512 prev_idx, 1058 1513 prev->rcBand.left, prev->rcBand.top, 1059 1514 prev->rcBand.right, prev->rcBand.bottom); 1060 TRACE("values: prev_rh=%d, current_rh=%d,new_rh=%d, adj_rh=%d\n",1061 prev_rh, current_rh,new_rh, adj_rh);1515 TRACE("values: prev_rh=%d, new_rh=%d, adj_rh=%d\n", 1516 prev_rh, new_rh, adj_rh); 1062 1517 /* for bands below current adjust row # and top/bottom */ 1063 for (j = i+2; j<infoPtr->uNumBands; j++) {1518 for (j = current_idx+1; j<infoPtr->uNumBands; j++) { 1064 1519 walk = &infoPtr->bands[j]; 1520 if (HIDDENBAND(walk)) continue; 1065 1521 walk->fDraw |= NTF_INVALIDATE; 1066 1522 walk->iRow++; 1067 if ( dwStyle & CCS_VERT) {1523 if (infoPtr->dwStyle & CCS_VERT) { 1068 1524 walk->rcBand.left += adj_rh; 1069 1525 walk->rcBand.right += adj_rh; … … 1074 1530 } 1075 1531 } 1076 if (( dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy))1532 if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy)) 1077 1533 break; /* all done */ 1078 1534 } … … 1084 1540 1085 1541 1542 /* ******* Start Phase 2a - adjust all bands for height full ******* */ 1543 /* assumes that the following variables contain: */ 1544 /* y/x current height/width of all rows */ 1545 /* clientcy/clientcx height/width of client area */ 1546 1547 /* **** FIXME FIXME FIXME 1548 * this does not take into account that more than one band 1549 * is in a row!!!!!!!!! 1550 */ 1551 1552 if (((infoPtr->dwStyle & CCS_VERT) ? clientcx > x : clientcy > y) && 1553 infoPtr->uNumBands) { 1554 INT diff, i, j; 1555 1556 diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y; 1557 for (i = infoPtr->uNumBands-1; i >= 0; i--) { 1558 lpBand = &infoPtr->bands[i]; 1559 if(HIDDENBAND(lpBand)) continue; 1560 if (!lpBand->fMask & RBBS_VARIABLEHEIGHT) continue; 1561 if (((INT)lpBand->cyMaxChild < 1) || 1562 ((INT)lpBand->cyIntegral < 1)) { 1563 if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue; 1564 ERR("band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n", 1565 i, lpBand->cyMaxChild, lpBand->cyIntegral); 1566 continue; 1567 } 1568 /* j is now the maximum height/width in the client area */ 1569 j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) + 1570 ircBw(lpBand); 1571 if (j > lpBand->cyMaxChild + REBARSPACE) 1572 j = lpBand->cyMaxChild + REBARSPACE; 1573 diff -= (j - ircBw(lpBand)); 1574 if (infoPtr->dwStyle & CCS_VERT) 1575 lpBand->rcBand.right = lpBand->rcBand.left + j; 1576 else 1577 lpBand->rcBand.bottom = lpBand->rcBand.top + j; 1578 TRACE("P2a band %d, row %d changed to (%d,%d)-(%d,%d)\n", 1579 i, lpBand->iRow, 1580 lpBand->rcBand.left, lpBand->rcBand.top, 1581 lpBand->rcBand.right, lpBand->rcBand.bottom); 1582 if (diff <= 0) break; 1583 } 1584 if (diff < 0) { 1585 ERR("allocated more than available, diff=%d\n", diff); 1586 diff = 0; 1587 } 1588 if (infoPtr->dwStyle & CCS_VERT) 1589 x = clientcx - diff; 1590 else 1591 y = clientcy - diff; 1592 } 1593 1594 /* ******* End Phase 2a - adjust all bands for height full ******* */ 1595 1086 1596 1087 1597 /* ******* Start Phase 3 - adjust all bands for width full ******* */ 1088 1598 1089 1599 if (infoPtr->uNumBands) { 1090 REBAR_BAND *prev, *current; 1600 INT bandnum, bandnum_start, bandnum_end; 1601 1091 1602 /* If RBS_BANDBORDERS set then indicate to draw bottom separator */ 1092 if (dwStyle & RBS_BANDBORDERS) { 1603 /* on all bands in all rows but last row. */ 1604 /* Also indicate to draw the right separator for each band in */ 1605 /* each row but the rightmost band. */ 1606 if (infoPtr->dwStyle & RBS_BANDBORDERS) { 1607 REBAR_BAND *prevband; 1608 INT currow; 1609 1610 prevband = NULL; 1611 currow = -1; 1093 1612 for (i = 0; i < infoPtr->uNumBands; i++) { 1094 1613 lpBand = &infoPtr->bands[i]; 1095 1614 if (HIDDENBAND(lpBand)) continue; 1615 1096 1616 if (lpBand->iRow < infoPtr->uNumRows) 1097 1617 lpBand->fDraw |= DRAW_BOTTOMSEP; 1618 1619 if (lpBand->iRow != currow) prevband = NULL; 1620 currow = lpBand->iRow; 1621 if (prevband) prevband->fDraw |= DRAW_RIGHTSEP; 1622 prevband = lpBand; 1098 1623 } 1099 1624 } 1100 1625 1101 /* Adjust the horizontal and vertical of each band */ 1102 prev = &infoPtr->bands[0]; 1103 current = prev; 1104 mcy = prev->lcy + REBARSPACE; 1105 rowstartband = 0; 1106 for (i=1; i<infoPtr->uNumBands; i++) { 1107 prev = &infoPtr->bands[i-1]; 1108 current = &infoPtr->bands[i]; 1109 if (prev->iRow != current->iRow) { 1110 REBAR_AdjustBands (infoPtr, rowstartband, i, 1111 (dwStyle & CCS_VERT) ? clientcy : clientcx, 1112 rcBrb(prev), 1113 mcy, dwStyle); 1114 mcy = 0; 1115 rowstartband = i; 1626 /* Distribute the extra space on the horizontal and adjust */ 1627 /* all bands in row to same height. */ 1628 bandnum = 0; 1629 for (i=1; i<=infoPtr->uNumRows; i++) { 1630 bandnum_start = -1; 1631 bandnum_end = -1; 1632 mcy = 0; 1633 TRACE("processing row %d, starting band %d\n", i, bandnum); 1634 while (TRUE) { 1635 lpBand = &infoPtr->bands[bandnum]; 1636 if ((bandnum >= infoPtr->uNumBands) || 1637 ((lpBand->iRow != i) && 1638 !HIDDENBAND(lpBand))) { 1639 if ((bandnum_start == -1) || 1640 (bandnum_end == -1)) { 1641 ERR("logic error? bands=%d, rows=%d, start=%d, end=%d\n", 1642 infoPtr->uNumBands, infoPtr->uNumRows, 1643 (INT)bandnum_start, (INT)bandnum_end); 1644 ERR(" current row=%d, band=%d\n", 1645 i, bandnum); 1646 break; 1647 } 1648 REBAR_AdjustBands (infoPtr, bandnum_start, bandnum_end, 1649 (infoPtr->dwStyle & CCS_VERT) ? 1650 clientcy : clientcx, mcy); 1651 break; 1652 } 1653 if (!HIDDENBAND(lpBand)) { 1654 if (bandnum_start == -1) bandnum_start = bandnum; 1655 if (bandnum_end < bandnum) bandnum_end = bandnum; 1656 if (mcy < ircBw(lpBand)) 1657 mcy = ircBw(lpBand); 1658 } 1659 bandnum++; 1660 TRACE("point 1, bandnum=%d\n", bandnum); 1116 1661 } 1117 if (mcy < current->lcy + REBARSPACE) 1118 mcy = current->lcy + REBARSPACE; 1119 } 1120 REBAR_AdjustBands (infoPtr, rowstartband, infoPtr->uNumBands, 1121 (dwStyle & CCS_VERT) ? clientcy : clientcx, 1122 rcBrb(current), 1123 mcy, dwStyle); 1662 TRACE("point 2, i=%d, numrows=%d, bandnum=%d\n", 1663 i, infoPtr->uNumRows, bandnum); 1664 } 1665 TRACE("point 3\n"); 1124 1666 1125 1667 /* Calculate the other rectangles in each band */ 1126 if ( dwStyle & CCS_VERT) {1127 REBAR_CalcVertBand ( hwnd,infoPtr, 0, infoPtr->uNumBands,1128 notify , dwStyle);1668 if (infoPtr->dwStyle & CCS_VERT) { 1669 REBAR_CalcVertBand (infoPtr, 0, infoPtr->uNumBands, 1670 notify); 1129 1671 } 1130 1672 else { 1131 REBAR_CalcHorzBand ( hwnd,infoPtr, 0, infoPtr->uNumBands,1132 notify , dwStyle);1673 REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands, 1674 notify); 1133 1675 } 1134 1676 } … … 1136 1678 /* ******* End Phase 3 - adjust all bands for width full ******* */ 1137 1679 1138 1139 /* FIXME: if not RBS_VARHEIGHT then find max mcy and adj rect*/ 1140 1680 /* now compute size of Rebar itself */ 1141 1681 infoPtr->oldSize = infoPtr->calcSize; 1142 if ( dwStyle & CCS_VERT) {1682 if (infoPtr->dwStyle & CCS_VERT) { 1143 1683 infoPtr->calcSize.cx = x; 1144 1684 infoPtr->calcSize.cy = clientcy; … … 1154 1694 if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; 1155 1695 } 1156 REBAR_DumpBand (hwnd); 1696 1697 REBAR_DumpBand (infoPtr); 1698 1699 REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands); 1700 1701 REBAR_ForceResize (infoPtr); 1157 1702 } 1158 1703 1159 1704 1160 1705 static VOID 1161 REBAR_ForceResize (HWND hwnd) 1162 /* Function: This changes the size of the REBAR window to that */ 1163 /* calculated by REBAR_Layout. */ 1164 { 1165 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 1166 RECT rc; 1167 1168 TRACE( " from [%ld x %ld] to [%ld x %ld]!\n", 1169 infoPtr->oldSize.cx, infoPtr->oldSize.cy, 1170 infoPtr->calcSize.cx, infoPtr->calcSize.cy); 1171 1172 /* if size did not change then skip process */ 1173 if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) && 1174 (infoPtr->oldSize.cy == infoPtr->calcSize.cy) && 1175 !(infoPtr->fStatus & RESIZE_ANYHOW)) 1176 return; 1177 1178 infoPtr->fStatus &= ~RESIZE_ANYHOW; 1179 /* Set flag to ignore next WM_SIZE message */ 1180 infoPtr->fStatus |= AUTO_RESIZE; 1181 1182 rc.left = 0; 1183 rc.top = 0; 1184 rc.right = infoPtr->calcSize.cx; 1185 rc.bottom = infoPtr->calcSize.cy; 1186 1187 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) { 1188 InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); 1189 } 1190 1191 SetWindowPos (hwnd, 0, 0, 0, 1192 rc.right - rc.left, rc.bottom - rc.top, 1193 SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); 1194 } 1195 1196 1197 static VOID 1198 REBAR_MoveChildWindows (HWND hwnd) 1199 { 1200 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 1201 REBAR_BAND *lpBand; 1202 CHAR szClassName[40]; 1203 UINT i; 1204 NMREBARCHILDSIZE rbcz; 1205 NMHDR heightchange; 1206 HDWP deferpos; 1207 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 1208 1209 if (!(deferpos = BeginDeferWindowPos(8))) 1210 ERR("BeginDeferWindowPso returned NULL\n"); 1211 1212 for (i = 0; i < infoPtr->uNumBands; i++) { 1213 lpBand = &infoPtr->bands[i]; 1214 1215 if (HIDDENBAND(lpBand)) continue; 1216 if (lpBand->hwndChild) { 1217 TRACE("hwndChild = %x\n", lpBand->hwndChild); 1218 1219 if (lpBand->fDraw & NTF_CHILDSIZE) { 1220 lpBand->fDraw &= ~NTF_CHILDSIZE; 1221 rbcz.uBand = i; 1222 rbcz.wID = lpBand->wID; 1223 rbcz.rcChild = lpBand->rcChild; 1224 rbcz.rcBand = lpBand->rcBand; 1225 rbcz.rcBand.left += lpBand->cxHeader; 1226 REBAR_Notify (hwnd, (NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE); 1227 if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) { 1228 TRACE("Child rect changed by NOTIFY for band %u\n", i); 1229 TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", 1230 lpBand->rcChild.left, lpBand->rcChild.top, 1231 lpBand->rcChild.right, lpBand->rcChild.bottom, 1232 rbcz.rcChild.left, rbcz.rcChild.top, 1233 rbcz.rcChild.right, rbcz.rcChild.bottom); 1234 } 1235 } 1236 1237 GetClassNameA (lpBand->hwndChild, szClassName, 40); 1238 if (!lstrcmpA (szClassName, "ComboBox") || 1239 !lstrcmpA (szClassName, WC_COMBOBOXEXA)) { 1240 INT nEditHeight, yPos; 1241 RECT rc; 1242 1243 /* special placement code for combo or comboex box */ 1244 1245 1246 /* get size of edit line */ 1247 GetWindowRect (lpBand->hwndChild, &rc); 1248 nEditHeight = rc.bottom - rc.top; 1249 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; 1250 1251 /* center combo box inside child area */ 1252 TRACE("moving child (Combo(Ex)) %04x to (%d,%d)-(%d,%d)\n", 1253 lpBand->hwndChild, 1254 lpBand->rcChild.left, yPos, 1255 lpBand->rcChild.right - lpBand->rcChild.left, 1256 nEditHeight); 1257 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1258 lpBand->rcChild.left, 1259 /*lpBand->rcChild.top*/ yPos, 1260 lpBand->rcChild.right - lpBand->rcChild.left, 1261 nEditHeight, 1262 SWP_NOZORDER); 1263 if (!deferpos) 1264 ERR("DeferWindowPos returned NULL\n"); 1265 } 1266 else { 1267 TRACE("moving child (Other) %04x to (%d,%d)-(%d,%d)\n", 1268 lpBand->hwndChild, 1269 lpBand->rcChild.left, lpBand->rcChild.top, 1270 lpBand->rcChild.right - lpBand->rcChild.left, 1271 lpBand->rcChild.bottom - lpBand->rcChild.top); 1272 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP, 1273 lpBand->rcChild.left, 1274 lpBand->rcChild.top, 1275 lpBand->rcChild.right - lpBand->rcChild.left, 1276 lpBand->rcChild.bottom - lpBand->rcChild.top, 1277 SWP_NOZORDER); 1278 if (!deferpos) 1279 ERR("DeferWindowPos returned NULL\n"); 1280 } 1281 } 1282 } 1283 if (!EndDeferWindowPos(deferpos)) 1284 ERR("EndDeferWindowPos returned NULL\n"); 1285 if (infoPtr->fStatus & NTF_HGHTCHG) { 1286 infoPtr->fStatus &= ~NTF_HGHTCHG; 1287 REBAR_Notify (hwnd, &heightchange, infoPtr, RBN_HEIGHTCHANGE); 1288 } 1289 } 1290 1291 1292 static VOID 1293 REBAR_ValidateBand (HWND hwnd, REBAR_INFO *infoPtr, REBAR_BAND *lpBand) 1706 REBAR_ValidateBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand) 1294 1707 /* Function: This routine evaluates the band specs supplied */ 1295 1708 /* by the user and updates the following 5 fields in */ … … 1298 1711 UINT header=0; 1299 1712 UINT textheight=0; 1300 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);1301 1713 1302 1714 lpBand->fStatus = 0; 1303 1715 lpBand->lcx = 0; 1304 1716 lpBand->lcy = 0; 1717 lpBand->ccx = 0; 1718 lpBand->ccy = 0; 1305 1719 lpBand->hcx = 0; 1306 1720 lpBand->hcy = 0; … … 1325 1739 if (lpBand->cxHeader > 65535) lpBand->cxHeader = 0; 1326 1740 1741 /* FIXME: probably should only set NEEDS_LAYOUT flag when */ 1742 /* values change. Till then always set it. */ 1743 TRACE("setting NEEDS_LAYOUT\n"); 1744 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 1745 1327 1746 /* Header is where the image, text and gripper exist */ 1328 1747 /* in the band and preceed the child window. */ … … 1334 1753 ) { 1335 1754 lpBand->fStatus |= HAS_GRIPPER; 1336 if ( dwStyle & CCS_VERT)1337 if ( dwStyle & RBS_VERTICALGRIPPER)1755 if (infoPtr->dwStyle & CCS_VERT) 1756 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) 1338 1757 header += (GRIPPER_HEIGHT + REBAR_PRE_GRIPPER); 1339 1758 else … … 1348 1767 if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) { 1349 1768 lpBand->fStatus |= HAS_IMAGE; 1350 if ( dwStyle & CCS_VERT) {1769 if (infoPtr->dwStyle & CCS_VERT) { 1351 1770 header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE); 1352 1771 lpBand->lcy = infoPtr->imageSize.cx + 2; … … 1367 1786 GetTextExtentPoint32W (hdc, lpBand->lpText, 1368 1787 lstrlenW (lpBand->lpText), &size); 1369 header += (( dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT));1370 textheight = ( dwStyle & CCS_VERT) ? 0 : size.cy;1788 header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT)); 1789 textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy; 1371 1790 1372 1791 SelectObject (hdc, hOldFont); … … 1389 1808 lpBand->offChild.cy = 0; 1390 1809 lpBand->lcy = textheight; 1810 lpBand->ccy = lpBand->lcy; 1391 1811 if (lpBand->fMask & RBBIM_CHILDSIZE) { 1392 1812 if (!(lpBand->fStyle & RBBS_FIXEDSIZE)) { … … 1395 1815 } 1396 1816 lpBand->lcx = lpBand->cxMinChild; 1817 1818 /* Set the .cy values for CHILDSIZE case */ 1397 1819 lpBand->lcy = max(lpBand->lcy, lpBand->cyMinChild); 1820 lpBand->ccy = lpBand->lcy; 1398 1821 lpBand->hcy = lpBand->lcy; 1399 if (lpBand->fStyle & RBBS_VARIABLEHEIGHT) { 1400 if (lpBand->cyChild != 0xffffffff) 1401 lpBand->lcy = max (lpBand->cyChild, lpBand->lcy); 1822 if (lpBand->cyMaxChild != 0xffffffff) { 1402 1823 lpBand->hcy = lpBand->cyMaxChild; 1403 1824 } 1825 if (lpBand->cyChild != 0xffffffff) 1826 lpBand->ccy = max (lpBand->cyChild, lpBand->lcy); 1827 1404 1828 TRACE("_CHILDSIZE\n"); 1405 1829 } 1406 1830 if (lpBand->fMask & RBBIM_SIZE) { 1407 lpBand->hcx = max (lpBand->cx , lpBand->lcx);1831 lpBand->hcx = max (lpBand->cx-lpBand->cxHeader, lpBand->lcx); 1408 1832 TRACE("_SIZE\n"); 1409 1833 } 1410 1834 else 1411 1835 lpBand->hcx = lpBand->lcx; 1836 lpBand->ccx = lpBand->hcx; 1837 1838 /* make ->.cx include header size for _Layout */ 1839 lpBand->lcx += lpBand->cxHeader; 1840 lpBand->ccx += lpBand->cxHeader; 1841 lpBand->hcx += lpBand->cxHeader; 1412 1842 1413 1843 } … … 1436 1866 lpBand->hwndPrevParent = 1437 1867 SetParent (lpBand->hwndChild, hwnd); 1868 /* below in trace fro WinRAR */ 1869 ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL); 1870 /* above in trace fro WinRAR */ 1438 1871 } 1439 1872 else { … … 1484 1917 1485 1918 static LRESULT 1486 REBAR_InternalEraseBkGnd (HWND hwnd, WPARAM wParam, LPARAM lParam, RECT *clip) 1487 /* Function: This erases the background rectangle with the */ 1488 /* default brush, then with any band that has a different */ 1489 /* background color. */ 1490 { 1491 HBRUSH hbrBackground = GetClassWord(hwnd, GCW_HBRBACKGROUND); 1492 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 1493 RECT eraserect; 1919 REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, RECT *clip) 1920 /* Function: This erases the background rectangle by drawing */ 1921 /* each band with its background color (or the default) and */ 1922 /* draws each bands right separator if necessary. The row */ 1923 /* separators are drawn on the first band of the next row. */ 1924 { 1494 1925 REBAR_BAND *lpBand; 1495 INT i; 1496 1497 if (hbrBackground) 1498 FillRect( (HDC) wParam, clip, hbrBackground); 1499 1926 INT i, oldrow; 1927 HDC hdc = (HDC)wParam; 1928 RECT rect; 1929 COLORREF old, new; 1930 1931 oldrow = -1; 1500 1932 for(i=0; i<infoPtr->uNumBands; i++) { 1501 1933 lpBand = &infoPtr->bands[i]; 1502 if (lpBand->clrBack != CLR_NONE) { 1503 if (IntersectRect (&eraserect, clip, &lpBand->rcBand)) { 1504 /* draw background */ 1505 HBRUSH brh = CreateSolidBrush (lpBand->clrBack); 1506 TRACE("backround color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", 1507 lpBand->clrBack, 1508 lpBand->rcBand.left,lpBand->rcBand.top, 1509 lpBand->rcBand.right,lpBand->rcBand.bottom, 1510 clip->left, clip->top, 1511 clip->right, clip->bottom); 1512 FillRect ( (HDC)wParam, &eraserect, brh); 1513 DeleteObject (brh); 1514 } 1515 } 1934 if (HIDDENBAND(lpBand)) continue; 1935 1936 /* draw band separator between rows */ 1937 if (lpBand->iRow != oldrow) { 1938 oldrow = lpBand->iRow; 1939 if (lpBand->fDraw & DRAW_BOTTOMSEP) { 1940 RECT rcRowSep; 1941 rcRowSep = lpBand->rcBand; 1942 if (infoPtr->dwStyle & CCS_VERT) { 1943 rcRowSep.right += SEP_WIDTH_SIZE; 1944 rcRowSep.bottom = infoPtr->calcSize.cy; 1945 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT); 1946 } 1947 else { 1948 rcRowSep.bottom += SEP_WIDTH_SIZE; 1949 rcRowSep.right = infoPtr->calcSize.cx; 1950 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM); 1951 } 1952 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n", 1953 rcRowSep.left, rcRowSep.top, 1954 rcRowSep.right, rcRowSep.bottom); 1955 } 1956 } 1957 1958 /* draw band separator between bands in a row */ 1959 if (lpBand->fDraw & DRAW_RIGHTSEP) { 1960 RECT rcSep; 1961 rcSep = lpBand->rcBand; 1962 if (infoPtr->dwStyle & CCS_VERT) { 1963 rcSep.bottom += SEP_WIDTH_SIZE; 1964 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM); 1965 } 1966 else { 1967 rcSep.right += SEP_WIDTH_SIZE; 1968 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT); 1969 } 1970 TRACE("drawing band separator right (%d,%d)-(%d,%d)\n", 1971 rcSep.left, rcSep.top, rcSep.right, rcSep.bottom); 1972 } 1973 1974 /* draw the actual background */ 1975 if (lpBand->clrBack != CLR_NONE) 1976 new = lpBand->clrBack; 1977 else 1978 new = infoPtr->clrBtnFace; 1979 rect = lpBand->rcBand; 1980 old = SetBkColor (hdc, new); 1981 TRACE("%s backround color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", 1982 (lpBand->clrBack == CLR_NONE) ? "std" : "", 1983 new, 1984 lpBand->rcBand.left,lpBand->rcBand.top, 1985 lpBand->rcBand.right,lpBand->rcBand.bottom, 1986 clip->left, clip->top, 1987 clip->right, clip->bottom); 1988 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); 1989 SetBkColor (hdc, old); 1516 1990 } 1517 1991 return TRUE; … … 1519 1993 1520 1994 static void 1521 REBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pBand) 1522 { 1523 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 1995 REBAR_InternalHitTest (REBAR_INFO *infoPtr, LPPOINT lpPt, UINT *pFlags, INT *pBand) 1996 { 1524 1997 REBAR_BAND *lpBand; 1525 1998 RECT rect; 1526 1999 INT iCount; 1527 2000 1528 GetClientRect ( hwnd, &rect);2001 GetClientRect (infoPtr->hwndSelf, &rect); 1529 2002 1530 2003 *pFlags = RBHT_NOWHERE; … … 1543 2016 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) { 1544 2017 lpBand = &infoPtr->bands[iCount]; 2018 if (HIDDENBAND(lpBand)) continue; 1545 2019 if (PtInRect (&lpBand->rcBand, *lpPt)) { 1546 2020 if (pBand) … … 1595 2069 } 1596 2070 1597 #define READJ(b,i) {if(dwStyle & CCS_VERT) b->rcBand.bottom+=(i); \1598 else b->rcBand.right += (i);}1599 #define LEADJ(b,i) {if(dwStyle & CCS_VERT) b->rcBand.top+=(i); \1600 else b->rcBand.left += (i);}1601 1602 2071 1603 2072 static INT 1604 REBAR_Shrink (REBAR_ BAND *band, INT movement, INT i, DWORD dwStyle)2073 REBAR_Shrink (REBAR_INFO *infoPtr, REBAR_BAND *band, INT movement, INT i) 1605 2074 /* Function: This attempts to shrink the given band by the */ 1606 2075 /* the amount in "movement". A shrink to the left is indi- */ … … 1615 2084 /* it is then the band does not move. */ 1616 2085 1617 avail = rcB rb(band) - rcBlt(band) - band->cxHeader- band->lcx;2086 avail = rcBw(band) - band->lcx; 1618 2087 1619 2088 /* now compute the Left End adjustment factor and Right End */ … … 1671 2140 1672 2141 static void 1673 REBAR_HandleLRDrag ( HWND hwnd, REBAR_INFO *infoPtr, POINTS *ptsmove, DWORD dwStyle)2142 REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove) 1674 2143 /* Function: This will implement the functionality of a */ 1675 2144 /* Gripper drag within a row. It will not implement "out- */ … … 1679 2148 /* **** yet implemented. **** */ 1680 2149 { 1681 REBAR_BAND *hitBand, *band, *prevband, *mindBand, *maxdBand; 1682 HDWP deferpos; 1683 NMREBARCHILDSIZE cs; 2150 REBAR_BAND *hitBand, *band, *mindBand, *maxdBand; 1684 2151 RECT newrect; 1685 INT imindBand = -1, imaxdBand, ihitBand, i, movement , tempx;2152 INT imindBand = -1, imaxdBand, ihitBand, i, movement; 1686 2153 INT RHeaderSum = 0, LHeaderSum = 0; 1687 2154 INT compress; … … 1690 2157 1691 2158 if (!(infoPtr->fStatus & BEGIN_DRAG_ISSUED)) { 1692 if (REBAR_Notify_NMREBAR ( hwnd,infoPtr, -1, RBN_BEGINDRAG)) {2159 if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) { 1693 2160 /* Notify returned TRUE - abort drag */ 1694 2161 infoPtr->dragStart.x = 0; … … 1717 2184 /* a one to separate each band. */ 1718 2185 if (i < ihitBand) 1719 LHeaderSum += (band-> cxHeader + band->lcx + SEP_WIDTH);2186 LHeaderSum += (band->lcx + SEP_WIDTH); 1720 2187 else 1721 RHeaderSum += (band-> cxHeader + band->lcx + SEP_WIDTH);2188 RHeaderSum += (band->lcx + SEP_WIDTH); 1722 2189 1723 2190 } … … 1738 2205 return; /* should swap bands */ 1739 2206 1740 if ( dwStyle & CCS_VERT)2207 if (infoPtr->dwStyle & CCS_VERT) 1741 2208 movement = ptsmove->y - ((hitBand->rcBand.top+REBAR_PRE_GRIPPER) - 1742 2209 infoPtr->ihitoffset); … … 1749 2216 movement, ptsmove->x, ptsmove->y, imindBand, ihitBand, 1750 2217 imaxdBand, LHeaderSum, RHeaderSum); 1751 REBAR_DumpBand ( hwnd);2218 REBAR_DumpBand (infoPtr); 1752 2219 1753 2220 if (movement < 0) { … … 1761 2228 movement = -compress; 1762 2229 } 2230 1763 2231 for (i=ihitBand; i>=imindBand; i--) { 1764 2232 band = &infoPtr->bands[i]; 2233 if (HIDDENBAND(band)) continue; 1765 2234 if (i == ihitBand) { 1766 prevband = &infoPtr->bands[i-1];1767 if (rcBlt(band) - movement <= rcBlt(prevband)) {1768 tempx = movement - (rcBrb(prevband)-rcBlt(band)+1);1769 ERR("movement bad. BUG!! was %d, left=%d, right=%d, setting to %d\n",1770 movement, rcBlt(band), rcBlt(prevband), tempx);1771 movement = tempx;1772 }1773 2235 LEADJ(band, movement) 1774 2236 } 1775 2237 else 1776 movement = REBAR_Shrink (band, movement, i, dwStyle); 2238 movement = REBAR_Shrink (infoPtr, band, movement, i); 2239 band->ccx = rcBw(band); 1777 2240 } 1778 2241 } 1779 2242 else { 2243 BOOL first = TRUE; 1780 2244 1781 2245 /* *** Drag right/down *** */ … … 1790 2254 band = &infoPtr->bands[i]; 1791 2255 if (HIDDENBAND(band)) continue; 1792 if (i == ihitBand-1) { 2256 if (first) { 2257 first = FALSE; 1793 2258 READJ(band, movement) 1794 2259 } 1795 2260 else 1796 movement = REBAR_Shrink (band, movement, i, dwStyle); 2261 movement = REBAR_Shrink (infoPtr, band, movement, i); 2262 band->ccx = rcBw(band); 1797 2263 } 1798 2264 } 1799 2265 1800 2266 /* recompute all rectangles */ 1801 if ( dwStyle & CCS_VERT) {1802 REBAR_CalcVertBand ( hwnd,infoPtr, imindBand, imaxdBand+1,1803 FALSE , dwStyle);2267 if (infoPtr->dwStyle & CCS_VERT) { 2268 REBAR_CalcVertBand (infoPtr, imindBand, imaxdBand+1, 2269 FALSE); 1804 2270 } 1805 2271 else { 1806 REBAR_CalcHorzBand ( hwnd,infoPtr, imindBand, imaxdBand+1,1807 FALSE , dwStyle);2272 REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1, 2273 FALSE); 1808 2274 } 1809 2275 1810 2276 TRACE("bands after adjustment, see band # %d, %d\n", 1811 2277 imindBand, imaxdBand); 1812 REBAR_DumpBand ( hwnd);2278 REBAR_DumpBand (infoPtr); 1813 2279 1814 2280 SetRect (&newrect, … … 1818 2284 maxdBand->rcBand.bottom); 1819 2285 1820 if (!(deferpos = BeginDeferWindowPos (4))) { 1821 ERR("BeginDeferWindowPos returned NULL\n"); 1822 } 1823 1824 for (i=imindBand; i<=imaxdBand; i++) { 1825 band = &infoPtr->bands[i]; 1826 if ((band->fMask & RBBIM_CHILD) && band->hwndChild) { 1827 cs.uBand = i; 1828 cs.wID = band->wID; 1829 cs.rcChild = band->rcChild; 1830 cs.rcBand = band->rcBand; 1831 cs.rcBand.left += band->cxHeader; 1832 REBAR_Notify (hwnd, (NMHDR *) &cs, infoPtr, RBN_CHILDSIZE); 1833 deferpos = DeferWindowPos (deferpos, band->hwndChild, HWND_TOP, 1834 cs.rcChild.left, cs.rcChild.top, 1835 cs.rcChild.right - cs.rcChild.left, 1836 cs.rcChild.bottom - cs.rcChild.top, 1837 SWP_NOZORDER); 1838 if (!deferpos) { 1839 ERR("DeferWindowPos returned NULL\n"); 1840 } 1841 } 1842 } 1843 1844 if (!EndDeferWindowPos (deferpos)) { 1845 ERR("EndDeferWindowPos failed\n"); 1846 } 1847 1848 InvalidateRect (hwnd, &newrect, TRUE); 1849 UpdateWindow (hwnd); 1850 1851 } 1852 #undef READJ 1853 #undef LEADJ 2286 REBAR_MoveChildWindows (infoPtr, imindBand, imaxdBand+1); 2287 2288 InvalidateRect (infoPtr->hwndSelf, &newrect, TRUE); 2289 UpdateWindow (infoPtr->hwndSelf); 2290 2291 } 1854 2292 1855 2293 … … 1859 2297 1860 2298 static LRESULT 1861 REBAR_DeleteBand (HWND hwnd, WPARAM wParam, LPARAM lParam) 1862 { 1863 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2299 REBAR_DeleteBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2300 { 1864 2301 UINT uBand = (UINT)wParam; 1865 2302 HWND childhwnd = 0; … … 1871 2308 TRACE("deleting band %u!\n", uBand); 1872 2309 lpBand = &infoPtr->bands[uBand]; 1873 REBAR_Notify_NMREBAR ( hwnd,infoPtr, uBand, RBN_DELETINGBAND);2310 REBAR_Notify_NMREBAR (infoPtr, uBand, RBN_DELETINGBAND); 1874 2311 1875 2312 if (infoPtr->uNumBands == 1) { … … 1906 2343 ShowWindow (childhwnd, SW_HIDE); 1907 2344 1908 REBAR_Notify_NMREBAR ( hwnd,infoPtr, -1, RBN_DELETEDBAND);2345 REBAR_Notify_NMREBAR (infoPtr, -1, RBN_DELETEDBAND); 1909 2346 1910 2347 /* if only 1 band left the re-validate to possible eliminate gripper */ 1911 2348 if (infoPtr->uNumBands == 1) 1912 REBAR_ValidateBand (hwnd, infoPtr, &infoPtr->bands[0]); 1913 1914 REBAR_Layout (hwnd, NULL, TRUE, FALSE); 2349 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]); 2350 2351 TRACE("setting NEEDS_LAYOUT\n"); 2352 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 1915 2353 infoPtr->fStatus |= RESIZE_ANYHOW; 1916 REBAR_ForceResize (hwnd); 1917 REBAR_MoveChildWindows (hwnd); 2354 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 1918 2355 1919 2356 return TRUE; … … 1926 2363 1927 2364 static LRESULT 1928 REBAR_GetBandBorders (HWND hwnd, WPARAM wParam, LPARAM lParam) 1929 { 1930 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2365 REBAR_GetBandBorders (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2366 { 1931 2367 LPRECT lpRect = (LPRECT)lParam; 1932 2368 REBAR_BAND *lpBand; 1933 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);1934 2369 1935 2370 if (!lParam) … … 1945 2380 /* difference in size of the control area with and without the */ 1946 2381 /* style. - GA */ 1947 if ( GetWindowLongA (hwnd, GWL_STYLE)& RBS_BANDBORDERS) {1948 if ( dwStyle & CCS_VERT) {2382 if (infoPtr->dwStyle & RBS_BANDBORDERS) { 2383 if (infoPtr->dwStyle & CCS_VERT) { 1949 2384 lpRect->left = 1; 1950 2385 lpRect->top = lpBand->cxHeader + 4; … … 1962 2397 lpRect->left = lpBand->cxHeader; 1963 2398 } 1964 FIXME("stub\n");1965 2399 return 0; 1966 2400 } … … 1968 2402 1969 2403 inline static LRESULT 1970 REBAR_GetBandCount (HWND hwnd) 1971 { 1972 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 1973 2404 REBAR_GetBandCount (REBAR_INFO *infoPtr) 2405 { 1974 2406 TRACE("band count %u!\n", infoPtr->uNumBands); 1975 2407 … … 1979 2411 1980 2412 static LRESULT 1981 REBAR_GetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1982 { 1983 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2413 REBAR_GetBandInfoA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2414 { 1984 2415 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; 1985 2416 REBAR_BAND *lpBand; … … 2004 2435 lprbbi->clrBack = lpBand->clrBack; 2005 2436 if (lprbbi->clrBack == CLR_NONE) 2006 lprbbi->clrBack = GetSysColor (COLOR_BTNFACE);2437 lprbbi->clrBack = infoPtr->clrBtnFace; 2007 2438 } 2008 2439 … … 2066 2497 2067 2498 static LRESULT 2068 REBAR_GetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) 2069 { 2070 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2499 REBAR_GetBandInfoW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2500 { 2071 2501 LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; 2072 2502 REBAR_BAND *lpBand; … … 2091 2521 lprbbi->clrBack = lpBand->clrBack; 2092 2522 if (lprbbi->clrBack == CLR_NONE) 2093 lprbbi->clrBack = GetSysColor (COLOR_BTNFACE);2523 lprbbi->clrBack = infoPtr->clrBtnFace; 2094 2524 } 2095 2525 … … 2149 2579 2150 2580 static LRESULT 2151 REBAR_GetBarHeight (HWND hwnd, WPARAM wParam, LPARAM lParam) 2152 { 2153 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2581 REBAR_GetBarHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2582 { 2154 2583 INT nHeight; 2155 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 2156 2157 nHeight = (dwStyle & CCS_VERT) ? infoPtr->calcSize.cx : infoPtr->calcSize.cy; 2584 2585 nHeight = (infoPtr->dwStyle & CCS_VERT) ? infoPtr->calcSize.cx : infoPtr->calcSize.cy; 2158 2586 2159 2587 TRACE("height = %d\n", nHeight); … … 2164 2592 2165 2593 static LRESULT 2166 REBAR_GetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam) 2167 { 2168 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2594 REBAR_GetBarInfo (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2595 { 2169 2596 LPREBARINFO lpInfo = (LPREBARINFO)lParam; 2170 2597 … … 2187 2614 2188 2615 inline static LRESULT 2189 REBAR_GetBkColor (HWND hwnd) 2190 { 2191 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2616 REBAR_GetBkColor (REBAR_INFO *infoPtr) 2617 { 2192 2618 COLORREF clr = infoPtr->clrBk; 2193 2619 2194 2620 if (clr == CLR_NONE) 2195 clr = GetSysColor (COLOR_BTNFACE);2621 clr = infoPtr->clrBtnFace; 2196 2622 2197 2623 TRACE("background color 0x%06lx!\n", clr); … … 2206 2632 2207 2633 static LRESULT 2208 REBAR_GetPalette ( HWND hwnd, WPARAM wParam, LPARAM lParam)2634 REBAR_GetPalette (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2209 2635 { 2210 2636 FIXME("empty stub!\n"); … … 2215 2641 2216 2642 static LRESULT 2217 REBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam) 2218 { 2219 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2643 REBAR_GetRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2644 { 2220 2645 INT iBand = (INT)wParam; 2221 2646 LPRECT lprc = (LPRECT)lParam; … … 2238 2663 2239 2664 inline static LRESULT 2240 REBAR_GetRowCount (HWND hwnd) 2241 { 2242 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2243 2665 REBAR_GetRowCount (REBAR_INFO *infoPtr) 2666 { 2244 2667 TRACE("%u\n", infoPtr->uNumRows); 2245 2668 … … 2249 2672 2250 2673 static LRESULT 2251 REBAR_GetRowHeight (HWND hwnd, WPARAM wParam, LPARAM lParam) 2252 { 2253 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2674 REBAR_GetRowHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2675 { 2254 2676 INT iRow = (INT)wParam; 2255 2677 int ret = 0; 2256 2678 int i, j = 0; 2257 2679 REBAR_BAND *lpBand; 2258 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);2259 2680 2260 2681 for (i=0; i<infoPtr->uNumBands; i++) { 2261 lpBand = &infoPtr->bands[i];2262 if (HIDDENBAND(lpBand)) continue;2263 if (lpBand->iRow != iRow) continue;2264 if (dwStyle & CCS_VERT)2265 j = lpBand->rcBand.right - lpBand->rcBand.left;2266 else2267 j = lpBand->rcBand.bottom - lpBand->rcBand.top;2268 if (j > ret) ret = j;2682 lpBand = &infoPtr->bands[i]; 2683 if (HIDDENBAND(lpBand)) continue; 2684 if (lpBand->iRow != iRow) continue; 2685 if (infoPtr->dwStyle & CCS_VERT) 2686 j = lpBand->rcBand.right - lpBand->rcBand.left; 2687 else 2688 j = lpBand->rcBand.bottom - lpBand->rcBand.top; 2689 if (j > ret) ret = j; 2269 2690 } 2270 2691 … … 2276 2697 2277 2698 inline static LRESULT 2278 REBAR_GetTextColor (HWND hwnd) 2279 { 2280 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2281 2699 REBAR_GetTextColor (REBAR_INFO *infoPtr) 2700 { 2282 2701 TRACE("text color 0x%06lx!\n", infoPtr->clrText); 2283 2702 … … 2287 2706 2288 2707 inline static LRESULT 2289 REBAR_GetToolTips (HWND hwnd) 2290 { 2291 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2708 REBAR_GetToolTips (REBAR_INFO *infoPtr) 2709 { 2292 2710 return infoPtr->hwndToolTip; 2293 2711 } … … 2295 2713 2296 2714 inline static LRESULT 2297 REBAR_GetUnicodeFormat (HWND hwnd) 2298 { 2299 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2715 REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr) 2716 { 2717 TRACE("%s hwnd=0x%x\n", 2718 infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf); 2719 2300 2720 return infoPtr->bUnicode; 2301 2721 } … … 2303 2723 2304 2724 inline static LRESULT 2305 REBAR_GetVersion (HWND hwnd) 2306 { 2307 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2725 REBAR_GetVersion (REBAR_INFO *infoPtr) 2726 { 2308 2727 TRACE("version %d\n", infoPtr->iVersion); 2309 2728 return infoPtr->iVersion; … … 2312 2731 2313 2732 static LRESULT 2314 REBAR_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) 2315 { 2316 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ 2733 REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2734 { 2317 2735 LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 2318 2736 … … 2320 2738 return -1; 2321 2739 2322 REBAR_InternalHitTest ( hwnd, &lprbht->pt, &lprbht->flags, &lprbht->iBand);2740 REBAR_InternalHitTest (infoPtr, &lprbht->pt, &lprbht->flags, &lprbht->iBand); 2323 2741 2324 2742 return lprbht->iBand; … … 2327 2745 2328 2746 static LRESULT 2329 REBAR_IdToIndex (HWND hwnd, WPARAM wParam, LPARAM lParam) 2330 { 2331 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2747 REBAR_IdToIndex (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2748 { 2332 2749 UINT i; 2333 2750 … … 2351 2768 2352 2769 static LRESULT 2353 REBAR_InsertBandA (HWND hwnd, WPARAM wParam, LPARAM lParam) 2354 { 2355 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2770 REBAR_InsertBandA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2771 { 2356 2772 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; 2357 2773 UINT uIndex = (UINT)wParam; … … 2408 2824 lpBand->hwndPrevParent = 0; 2409 2825 2410 REBAR_CommonSetupBand ( hwnd, lprbbi, lpBand);2826 REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand); 2411 2827 lpBand->lpText = NULL; 2412 2828 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { … … 2418 2834 } 2419 2835 2420 REBAR_ValidateBand ( hwnd,infoPtr, lpBand);2836 REBAR_ValidateBand (infoPtr, lpBand); 2421 2837 /* On insert of second band, revalidate band 1 to possible add gripper */ 2422 2838 if (infoPtr->uNumBands == 2) 2423 REBAR_ValidateBand (hwnd, infoPtr, &infoPtr->bands[0]); 2424 2425 REBAR_DumpBand (hwnd); 2426 2427 REBAR_Layout (hwnd, NULL, TRUE, FALSE); 2428 REBAR_ForceResize (hwnd); 2429 REBAR_MoveChildWindows (hwnd); 2839 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]); 2840 2841 REBAR_DumpBand (infoPtr); 2842 2843 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 2430 2844 2431 2845 return TRUE; … … 2434 2848 2435 2849 static LRESULT 2436 REBAR_InsertBandW (HWND hwnd, WPARAM wParam, LPARAM lParam) 2437 { 2438 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2850 REBAR_InsertBandW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2851 { 2439 2852 LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; 2440 2853 UINT uIndex = (UINT)wParam; … … 2491 2904 lpBand->hwndPrevParent = 0; 2492 2905 2493 REBAR_CommonSetupBand ( hwnd, (LPREBARBANDINFOA)lprbbi, lpBand);2906 REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand); 2494 2907 lpBand->lpText = NULL; 2495 2908 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { … … 2501 2914 } 2502 2915 2503 REBAR_ValidateBand ( hwnd,infoPtr, lpBand);2916 REBAR_ValidateBand (infoPtr, lpBand); 2504 2917 /* On insert of second band, revalidate band 1 to possible add gripper */ 2505 2918 if (infoPtr->uNumBands == 2) 2506 REBAR_ValidateBand (hwnd, infoPtr, &infoPtr->bands[0]); 2507 2508 REBAR_DumpBand (hwnd); 2509 2510 REBAR_Layout (hwnd, NULL, TRUE, FALSE); 2511 REBAR_ForceResize (hwnd); 2512 REBAR_MoveChildWindows (hwnd); 2919 REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]); 2920 2921 REBAR_DumpBand (infoPtr); 2922 2923 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 2513 2924 2514 2925 return TRUE; … … 2517 2928 2518 2929 static LRESULT 2519 REBAR_MaximizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam) 2520 { 2521 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ 2522 2930 REBAR_MaximizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2931 { 2523 2932 FIXME("(uBand = %u fIdeal = %s) stub\n", 2524 2933 (UINT)wParam, lParam ? "TRUE" : "FALSE"); 2525 2934 2526 2527 2935 return 0; 2936 2528 2937 } 2529 2938 2530 2939 2531 2940 static LRESULT 2532 REBAR_MinimizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam) 2533 { 2534 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ 2535 2536 FIXME("(uBand = %u) stub\n", (UINT)wParam); 2537 2538 2539 return 0; 2941 REBAR_MinimizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2942 { 2943 REBAR_BAND *band, *lpBand; 2944 UINT uBand = (UINT) wParam; 2945 RECT newrect; 2946 INT imindBand, imaxdBand, iprevBand, startBand, endBand; 2947 INT movement, i; 2948 2949 /* A "minimize" band is equivalent to "dragging" the gripper 2950 * of than band to the right till the band is only the size 2951 * of the cxHeader. 2952 */ 2953 2954 /* Validate */ 2955 if ((infoPtr->uNumBands == 0) || 2956 ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) { 2957 /* error !!! */ 2958 ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n", 2959 (INT)uBand, infoPtr->uNumBands); 2960 return FALSE; 2961 } 2962 2963 /* compute amount of movement and validate */ 2964 lpBand = &infoPtr->bands[uBand]; 2965 2966 if (infoPtr->dwStyle & CCS_VERT) 2967 movement = lpBand->rcBand.bottom - lpBand->rcBand.top - 2968 lpBand->cxHeader; 2969 else 2970 movement = lpBand->rcBand.right - lpBand->rcBand.left - 2971 lpBand->cxHeader; 2972 if (movement < 0) { 2973 ERR("something is wrong, band=(%d,%d)-(%d,%d), cxheader=%d\n", 2974 lpBand->rcBand.left, lpBand->rcBand.top, 2975 lpBand->rcBand.right, lpBand->rcBand.bottom, 2976 lpBand->cxHeader); 2977 return FALSE; 2978 } 2979 2980 imindBand = -1; 2981 imaxdBand = -1; 2982 iprevBand = -1; /* to suppress warning message */ 2983 2984 /* find the first band in row of the one whose is being minimized */ 2985 for (i=0; i<infoPtr->uNumBands; i++) { 2986 band = &infoPtr->bands[i]; 2987 if (HIDDENBAND(band)) continue; 2988 if (band->iRow == lpBand->iRow) { 2989 imaxdBand = i; 2990 if (imindBand == -1) imindBand = i; 2991 } 2992 } 2993 2994 /* if the selected band is first in row then need to expand */ 2995 /* next visible band */ 2996 if (imindBand == uBand) { 2997 band = NULL; 2998 movement = -movement; 2999 /* find the first visible band to the right of the selected band */ 3000 for (i=uBand+1; i<=imaxdBand; i++) { 3001 band = &infoPtr->bands[i]; 3002 if (!HIDDENBAND(band)) { 3003 iprevBand = i; 3004 LEADJ(band, movement); 3005 band->ccx = rcBw(band); 3006 break; 3007 } 3008 } 3009 /* what case is this */ 3010 if (iprevBand == -1) { 3011 ERR("no previous visible band\n"); 3012 return FALSE; 3013 } 3014 startBand = uBand; 3015 endBand = iprevBand; 3016 SetRect (&newrect, 3017 lpBand->rcBand.left, 3018 lpBand->rcBand.top, 3019 band->rcBand.right, 3020 band->rcBand.bottom); 3021 } 3022 /* otherwise expand previous visible band */ 3023 else { 3024 band = NULL; 3025 /* find the first visible band to the left of the selected band */ 3026 for (i=uBand-1; i>=imindBand; i--) { 3027 band = &infoPtr->bands[i]; 3028 if (!HIDDENBAND(band)) { 3029 iprevBand = i; 3030 READJ(band, movement); 3031 band->ccx = rcBw(band); 3032 break; 3033 } 3034 } 3035 /* what case is this */ 3036 if (iprevBand == -1) { 3037 ERR("no previous visible band\n"); 3038 return FALSE; 3039 } 3040 startBand = iprevBand; 3041 endBand = uBand; 3042 SetRect (&newrect, 3043 band->rcBand.left, 3044 band->rcBand.top, 3045 lpBand->rcBand.right, 3046 lpBand->rcBand.bottom); 3047 } 3048 3049 REBAR_Shrink (infoPtr, lpBand, movement, uBand); 3050 3051 /* recompute all rectangles */ 3052 if (infoPtr->dwStyle & CCS_VERT) { 3053 REBAR_CalcVertBand (infoPtr, startBand, endBand+1, 3054 FALSE); 3055 } 3056 else { 3057 REBAR_CalcHorzBand (infoPtr, startBand, endBand+1, 3058 FALSE); 3059 } 3060 3061 TRACE("bands after minimize, see band # %d, %d\n", 3062 startBand, endBand); 3063 REBAR_DumpBand (infoPtr); 3064 3065 REBAR_MoveChildWindows (infoPtr, startBand, endBand+1); 3066 3067 InvalidateRect (infoPtr->hwndSelf, &newrect, TRUE); 3068 UpdateWindow (infoPtr->hwndSelf); 3069 return FALSE; 2540 3070 } 2541 3071 2542 3072 2543 3073 static LRESULT 2544 REBAR_MoveBand (HWND hwnd, WPARAM wParam, LPARAM lParam) 2545 { 2546 /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ 2547 2548 FIXME("(iFrom = %u iTof = %u) stub\n", 2549 (UINT)wParam, (UINT)lParam); 2550 2551 2552 return FALSE; 3074 REBAR_MoveBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3075 { 3076 REBAR_BAND *oldBands = infoPtr->bands; 3077 REBAR_BAND holder; 3078 UINT uFrom = (UINT)wParam; 3079 UINT uTo = (UINT)lParam; 3080 3081 /* Validate */ 3082 if ((infoPtr->uNumBands == 0) || 3083 ((INT)uFrom < 0) || (uFrom >= infoPtr->uNumBands) || 3084 ((INT)uTo < 0) || (uTo >= infoPtr->uNumBands)) { 3085 /* error !!! */ 3086 ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n", 3087 (INT)uFrom, (INT)uTo, infoPtr->uNumBands); 3088 return FALSE; 3089 } 3090 3091 /* save one to be moved */ 3092 memcpy (&holder, &oldBands[uFrom], sizeof(REBAR_BAND)); 3093 3094 /* close up rest of bands (psuedo delete) */ 3095 if (uFrom < infoPtr->uNumBands - 1) { 3096 memcpy (&oldBands[uFrom], &oldBands[uFrom+1], 3097 (infoPtr->uNumBands - uFrom - 1) * sizeof(REBAR_BAND)); 3098 } 3099 3100 /* allocate new space and copy rest of bands into it */ 3101 infoPtr->bands = 3102 (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND)); 3103 3104 /* pre insert copy */ 3105 if (uTo > 0) { 3106 memcpy (&infoPtr->bands[0], &oldBands[0], 3107 uTo * sizeof(REBAR_BAND)); 3108 } 3109 3110 /* set moved band */ 3111 memcpy (&infoPtr->bands[uTo], &holder, sizeof(REBAR_BAND)); 3112 3113 /* post copy */ 3114 if (uTo < infoPtr->uNumBands - 1) { 3115 memcpy (&infoPtr->bands[uTo+1], &oldBands[uTo], 3116 (infoPtr->uNumBands - uTo - 1) * sizeof(REBAR_BAND)); 3117 } 3118 3119 COMCTL32_Free (oldBands); 3120 3121 TRACE("moved band %d to index %d\n", uFrom, uTo); 3122 REBAR_DumpBand (infoPtr); 3123 3124 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3125 /* **************************************************** */ 3126 /* */ 3127 /* We do not do a REBAR_Layout here because the native */ 3128 /* control does not do that. The actual layout and */ 3129 /* repaint is done by the *next* real action, ex.: */ 3130 /* RB_INSERTBAND, RB_DELETEBAND, RB_SIZETORECT, etc. */ 3131 /* */ 3132 /* **************************************************** */ 3133 3134 return TRUE; 2553 3135 } 2554 3136 2555 3137 2556 3138 static LRESULT 2557 REBAR_SetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) 2558 { 2559 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3139 REBAR_SetBandInfoA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3140 { 2560 3141 LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; 2561 3142 REBAR_BAND *lpBand; … … 2574 3155 lpBand = &infoPtr->bands[(UINT)wParam]; 2575 3156 2576 REBAR_CommonSetupBand ( hwnd, lprbbi, lpBand);3157 REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand); 2577 3158 if (lprbbi->fMask & RBBIM_TEXT) { 2578 3159 if (lpBand->lpText) { … … 2587 3168 } 2588 3169 2589 REBAR_ValidateBand (hwnd, infoPtr, lpBand); 2590 2591 REBAR_DumpBand (hwnd); 2592 2593 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) { 2594 REBAR_Layout (hwnd, NULL, TRUE, FALSE); 2595 REBAR_ForceResize (hwnd); 2596 REBAR_MoveChildWindows (hwnd); 2597 } 3170 REBAR_ValidateBand (infoPtr, lpBand); 3171 3172 REBAR_DumpBand (infoPtr); 3173 3174 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) 3175 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 2598 3176 2599 3177 return TRUE; … … 2602 3180 2603 3181 static LRESULT 2604 REBAR_SetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) 2605 { 2606 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3182 REBAR_SetBandInfoW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3183 { 2607 3184 LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; 2608 3185 REBAR_BAND *lpBand; … … 2621 3198 lpBand = &infoPtr->bands[(UINT)wParam]; 2622 3199 2623 REBAR_CommonSetupBand ( hwnd, (LPREBARBANDINFOA)lprbbi, lpBand);3200 REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand); 2624 3201 if (lprbbi->fMask & RBBIM_TEXT) { 2625 3202 if (lpBand->lpText) { … … 2634 3211 } 2635 3212 2636 REBAR_ValidateBand (hwnd, infoPtr, lpBand); 2637 2638 REBAR_DumpBand (hwnd); 2639 2640 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) { 2641 REBAR_Layout (hwnd, NULL, TRUE, FALSE); 2642 REBAR_ForceResize (hwnd); 2643 REBAR_MoveChildWindows (hwnd); 2644 } 3213 REBAR_ValidateBand (infoPtr, lpBand); 3214 3215 REBAR_DumpBand (infoPtr); 3216 3217 if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) 3218 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 2645 3219 2646 3220 return TRUE; … … 2649 3223 2650 3224 static LRESULT 2651 REBAR_SetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam) 2652 { 2653 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3225 REBAR_SetBarInfo (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3226 { 2654 3227 LPREBARINFO lpInfo = (LPREBARINFO)lParam; 2655 3228 REBAR_BAND *lpBand; … … 2683 3256 for (i=0; i<infoPtr->uNumBands; i++) { 2684 3257 lpBand = &infoPtr->bands[i]; 2685 REBAR_ValidateBand ( hwnd,infoPtr, lpBand);3258 REBAR_ValidateBand (infoPtr, lpBand); 2686 3259 } 2687 3260 … … 2691 3264 2692 3265 static LRESULT 2693 REBAR_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) 2694 { 2695 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3266 REBAR_SetBkColor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3267 { 2696 3268 COLORREF clrTemp; 2697 3269 … … 2710 3282 2711 3283 static LRESULT 2712 REBAR_SetParent (HWND hwnd, WPARAM wParam, LPARAM lParam) 2713 { 2714 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3284 REBAR_SetParent (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3285 { 2715 3286 HWND hwndTemp = infoPtr->hwndNotify; 2716 3287 … … 2722 3293 2723 3294 static LRESULT 2724 REBAR_SetTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam) 2725 { 2726 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3295 REBAR_SetTextColor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3296 { 2727 3297 COLORREF clrTemp; 2728 3298 … … 2740 3310 2741 3311 inline static LRESULT 2742 REBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam) 2743 { 2744 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3312 REBAR_SetUnicodeFormat (REBAR_INFO *infoPtr, WPARAM wParam) 3313 { 2745 3314 BOOL bTemp = infoPtr->bUnicode; 3315 3316 TRACE("to %s hwnd=0x%04x, was %s\n", 3317 ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf, 3318 (bTemp) ? "TRUE" : "FALSE"); 3319 2746 3320 infoPtr->bUnicode = (BOOL)wParam; 2747 return bTemp; 3321 3322 return bTemp; 2748 3323 } 2749 3324 2750 3325 2751 3326 static LRESULT 2752 REBAR_SetVersion (HWND hwnd, INT iVersion) 2753 { 2754 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3327 REBAR_SetVersion (REBAR_INFO *infoPtr, INT iVersion) 3328 { 2755 3329 INT iOldVersion = infoPtr->iVersion; 2756 3330 … … 2767 3341 2768 3342 static LRESULT 2769 REBAR_ShowBand (HWND hwnd, WPARAM wParam, LPARAM lParam) 2770 { 2771 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3343 REBAR_ShowBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3344 { 2772 3345 REBAR_BAND *lpBand; 2773 3346 … … 2790 3363 } 2791 3364 2792 REBAR_Layout (hwnd, NULL, TRUE, FALSE); 2793 REBAR_ForceResize (hwnd); 2794 REBAR_MoveChildWindows (hwnd); 3365 REBAR_Layout (infoPtr, NULL, TRUE, FALSE); 2795 3366 2796 3367 return TRUE; … … 2799 3370 2800 3371 static LRESULT 2801 REBAR_SizeToRect ( HWND hwnd, WPARAM wParam, LPARAM lParam)3372 REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 2802 3373 { 2803 3374 LPRECT lpRect = (LPRECT)lParam; … … 2811 3382 2812 3383 /* what is going on???? */ 2813 GetWindowRect( hwnd, &t1);3384 GetWindowRect(infoPtr->hwndSelf, &t1); 2814 3385 TRACE("window rect [%d %d %d %d]\n", 2815 3386 t1.left, t1.top, t1.right, t1.bottom); 2816 GetClientRect( hwnd, &t1);3387 GetClientRect(infoPtr->hwndSelf, &t1); 2817 3388 TRACE("client rect [%d %d %d %d]\n", 2818 3389 t1.left, t1.top, t1.right, t1.bottom); 2819 3390 2820 REBAR_Layout (hwnd, lpRect, TRUE, FALSE); 2821 REBAR_ForceResize (hwnd); 2822 REBAR_MoveChildWindows (hwnd); 3391 /* force full _Layout processing */ 3392 TRACE("setting NEEDS_LAYOUT\n"); 3393 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3394 REBAR_Layout (infoPtr, lpRect, TRUE, FALSE); 3395 InvalidateRect (infoPtr->hwndSelf, NULL, TRUE); 2823 3396 return TRUE; 2824 3397 } … … 2827 3400 2828 3401 static LRESULT 2829 REBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) 2830 { 2831 REBAR_INFO *infoPtr; 3402 REBAR_Create (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3403 { 3404 LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam; 3405 RECT wnrc1, clrc1; 3406 3407 if (TRACE_ON(rebar)) { 3408 GetWindowRect(infoPtr->hwndSelf, &wnrc1); 3409 GetClientRect(infoPtr->hwndSelf, &clrc1); 3410 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n", 3411 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 3412 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 3413 cs->x, cs->y, cs->cx, cs->cy); 3414 } 3415 3416 TRACE("created!\n"); 3417 return 0; 3418 } 3419 3420 3421 static LRESULT 3422 REBAR_Destroy (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3423 { 3424 REBAR_BAND *lpBand; 3425 INT i; 3426 3427 3428 /* free rebar bands */ 3429 if ((infoPtr->uNumBands > 0) && infoPtr->bands) { 3430 /* clean up each band */ 3431 for (i = 0; i < infoPtr->uNumBands; i++) { 3432 lpBand = &infoPtr->bands[i]; 3433 3434 /* delete text strings */ 3435 if (lpBand->lpText) { 3436 COMCTL32_Free (lpBand->lpText); 3437 lpBand->lpText = NULL; 3438 } 3439 /* destroy child window */ 3440 DestroyWindow (lpBand->hwndChild); 3441 } 3442 3443 /* free band array */ 3444 COMCTL32_Free (infoPtr->bands); 3445 infoPtr->bands = NULL; 3446 } 3447 3448 DeleteObject (infoPtr->hcurArrow); 3449 DeleteObject (infoPtr->hcurHorz); 3450 DeleteObject (infoPtr->hcurVert); 3451 DeleteObject (infoPtr->hcurDrag); 3452 SetWindowLongA (infoPtr->hwndSelf, 0, 0); 3453 3454 /* free rebar info data */ 3455 COMCTL32_Free (infoPtr); 3456 TRACE("destroyed!\n"); 3457 return 0; 3458 } 3459 3460 3461 static LRESULT 3462 REBAR_EraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3463 { 3464 RECT cliprect; 3465 3466 if (GetClipBox ( (HDC)wParam, &cliprect)) 3467 return REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &cliprect); 3468 return 0; 3469 } 3470 3471 3472 static LRESULT 3473 REBAR_GetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3474 { 3475 return (LRESULT)infoPtr->hFont; 3476 } 3477 3478 3479 static LRESULT 3480 REBAR_LButtonDown (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3481 { 3482 REBAR_BAND *lpBand; 3483 3484 /* If InternalHitTest did not find a hit on the Gripper, */ 3485 /* then ignore the button click. */ 3486 if (infoPtr->ihitBand == -1) return 0; 3487 3488 SetCapture (infoPtr->hwndSelf); 3489 3490 /* save off the LOWORD and HIWORD of lParam as initial x,y */ 3491 lpBand = &infoPtr->bands[infoPtr->ihitBand]; 3492 infoPtr->dragStart = MAKEPOINTS(lParam); 3493 infoPtr->dragNow = infoPtr->dragStart; 3494 if (infoPtr->dwStyle & CCS_VERT) 3495 infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.top+REBAR_PRE_GRIPPER); 3496 else 3497 infoPtr->ihitoffset = infoPtr->dragStart.x - (lpBand->rcBand.left+REBAR_PRE_GRIPPER); 3498 3499 return 0; 3500 } 3501 3502 3503 static LRESULT 3504 REBAR_LButtonUp (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3505 { 3506 NMHDR layout; 3507 RECT rect; 3508 INT ihitBand; 3509 3510 /* If InternalHitTest did not find a hit on the Gripper, */ 3511 /* then ignore the button click. */ 3512 if (infoPtr->ihitBand == -1) return 0; 3513 3514 ihitBand = infoPtr->ihitBand; 3515 infoPtr->dragStart.x = 0; 3516 infoPtr->dragStart.y = 0; 3517 infoPtr->dragNow = infoPtr->dragStart; 3518 infoPtr->ihitBand = -1; 3519 3520 ReleaseCapture (); 3521 3522 if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) { 3523 REBAR_Notify((NMHDR *) &layout, infoPtr, RBN_LAYOUTCHANGED); 3524 REBAR_Notify_NMREBAR (infoPtr, ihitBand, RBN_ENDDRAG); 3525 infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED; 3526 } 3527 3528 GetClientRect(infoPtr->hwndSelf, &rect); 3529 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); 3530 3531 return 0; 3532 } 3533 3534 3535 static LRESULT 3536 REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3537 { 3538 REBAR_BAND *band1, *band2; 3539 POINTS ptsmove; 3540 3541 /* Validate entry as hit on Gripper has occured */ 3542 if (GetCapture() != infoPtr->hwndSelf) return 0; 3543 if (infoPtr->ihitBand == -1) return 0; 3544 3545 ptsmove = MAKEPOINTS(lParam); 3546 3547 /* if mouse did not move much, exit */ 3548 if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) && 3549 (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0; 3550 3551 band1 = &infoPtr->bands[infoPtr->ihitBand-1]; 3552 band2 = &infoPtr->bands[infoPtr->ihitBand]; 3553 3554 /* Test for valid drag case - must not be first band in row */ 3555 if (infoPtr->dwStyle & CCS_VERT) { 3556 if ((ptsmove.x < band2->rcBand.left) || 3557 (ptsmove.x > band2->rcBand.right) || 3558 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3559 FIXME("Cannot drag to other rows yet!!\n"); 3560 } 3561 else { 3562 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3563 } 3564 } 3565 else { 3566 if ((ptsmove.y < band2->rcBand.top) || 3567 (ptsmove.y > band2->rcBand.bottom) || 3568 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3569 FIXME("Cannot drag to other rows yet!!\n"); 3570 } 3571 else { 3572 REBAR_HandleLRDrag (infoPtr, &ptsmove); 3573 } 3574 } 3575 return 0; 3576 } 3577 3578 3579 inline static LRESULT 3580 REBAR_NCCalcSize (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3581 { 3582 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 3583 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); 3584 3585 /* While the code below seems to be the reasonable way of */ 3586 /* handling the WS_BORDER style, the native version (as */ 3587 /* of 4.71 seems to only do the above. Go figure!! */ 3588 #if 0 3589 if (GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE) & WS_BORDER) { 3590 ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE); 3591 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 3592 ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE); 3593 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); 3594 } 3595 #endif 3596 3597 return 0; 3598 } 3599 3600 3601 static LRESULT 3602 REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) 3603 { 3604 LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam; 3605 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3606 RECT wnrc1, clrc1; 3607 INT i; 3608 3609 if (infoPtr != NULL) { 3610 ERR("Strange info structure pointer *not* NULL\n"); 3611 return FALSE; 3612 } 3613 3614 if (TRACE_ON(rebar)) { 3615 GetWindowRect(hwnd, &wnrc1); 3616 GetClientRect(hwnd, &clrc1); 3617 TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n", 3618 wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, 3619 clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, 3620 cs->x, cs->y, cs->cx, cs->cy); 3621 } 2832 3622 2833 3623 /* allocate memory for info structure */ … … 2841 3631 /* initialize info structure - initial values are 0 */ 2842 3632 infoPtr->clrBk = CLR_NONE; 2843 infoPtr->clrText = GetSysColor (COLOR_BTNTEXT); 3633 infoPtr->clrText = CLR_NONE; 3634 infoPtr->clrBtnText = GetSysColor (COLOR_BTNTEXT); 3635 infoPtr->clrBtnFace = GetSysColor (COLOR_BTNFACE); 2844 3636 infoPtr->ihitBand = -1; 2845 3637 infoPtr->hwndSelf = hwnd; 3638 infoPtr->DoRedraw = TRUE; 2846 3639 infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA); 2847 3640 infoPtr->hcurHorz = LoadCursorA (0, IDC_SIZEWEA); 2848 3641 infoPtr->hcurVert = LoadCursorA (0, IDC_SIZENSA); 2849 3642 infoPtr->hcurDrag = LoadCursorA (0, IDC_SIZEA); 2850 2851 3643 infoPtr->bUnicode = IsWindowUnicode (hwnd); 2852 2853 if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_AUTOSIZE) 2854 FIXME("style RBS_AUTOSIZE set!\n"); 2855 2856 #if 0 2857 SendMessageA (hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); 2858 #endif 2859 2860 TRACE("created!\n"); 2861 return 0; 3644 infoPtr->fStatus = CREATE_RUNNING; 3645 3646 /* issue WM_NOTIFYFORMAT to get unicode status of parent */ 3647 i = SendMessageA(REBAR_GetNotifyParent (infoPtr), 3648 WM_NOTIFYFORMAT, hwnd, NF_QUERY); 3649 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 3650 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 3651 i); 3652 i = NFR_ANSI; 3653 } 3654 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; 3655 3656 /* add necessary styles to the requested styles */ 3657 infoPtr->dwStyle = cs->style | WS_VISIBLE | CCS_TOP; 3658 SetWindowLongA (hwnd, GWL_STYLE, infoPtr->dwStyle); 3659 3660 /* native does: 3661 GetSysColor (numerous); 3662 GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE); 3663 GetStockObject (SYSTEM_FONT); 3664 *SetWindowLong (hwnd, 0, info ptr); 3665 *WM_NOTIFYFORMAT; 3666 *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001); 3667 WS_VISIBLE = 0x10000000; 3668 CCS_TOP = 0x00000001; 3669 SystemParametersInfo (SPI_GETNONCLIENTMETRICS...); 3670 CreateFontIndirect (lfCaptionFont from above); 3671 GetDC (); 3672 SelectObject (hdc, fontabove); 3673 GetTextMetrics (hdc, ); guessing is tmHeight 3674 SelectObject (hdc, oldfont); 3675 ReleaseDC (); 3676 GetWindowRect (); 3677 MapWindowPoints (0, parent, rectabove, 2); 3678 GetWindowRect (); 3679 GetClientRect (); 3680 ClientToScreen (clientrect); 3681 SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER); 3682 */ 3683 return TRUE; 2862 3684 } 2863 3685 2864 3686 2865 3687 static LRESULT 2866 REBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 2867 { 2868 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2869 REBAR_BAND *lpBand; 3688 REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3689 { 3690 NMMOUSE nmmouse; 3691 POINTS shortpt; 3692 POINT clpt, pt; 2870 3693 INT i; 2871 2872 2873 /* free rebar bands */ 2874 if ((infoPtr->uNumBands > 0) && infoPtr->bands) { 2875 /* clean up each band */ 2876 for (i = 0; i < infoPtr->uNumBands; i++) { 2877 lpBand = &infoPtr->bands[i]; 2878 2879 /* delete text strings */ 2880 if (lpBand->lpText) { 2881 COMCTL32_Free (lpBand->lpText); 2882 lpBand->lpText = NULL; 2883 } 2884 /* destroy child window */ 2885 DestroyWindow (lpBand->hwndChild); 2886 } 2887 2888 /* free band array */ 2889 COMCTL32_Free (infoPtr->bands); 2890 infoPtr->bands = NULL; 2891 } 2892 2893 DeleteObject (infoPtr->hcurArrow); 2894 DeleteObject (infoPtr->hcurHorz); 2895 DeleteObject (infoPtr->hcurVert); 2896 DeleteObject (infoPtr->hcurDrag); 2897 2898 /* free rebar info data */ 2899 COMCTL32_Free (infoPtr); 2900 SetWindowLongA (hwnd, 0, 0); 2901 TRACE("destroyed!\n"); 2902 return 0; 3694 UINT scrap; 3695 LRESULT ret = HTCLIENT; 3696 3697 /* 3698 * Differences from doc at MSDN (as observed with version 4.71 of 3699 * comctl32.dll 3700 * 1. doc says nmmouse.pt is in screen coord, trace shows client coord. 3701 * 2. if band is not identified .dwItemSpec is 0xffffffff. 3702 * 3. native always seems to return HTCLIENT if notify return is 0. 3703 */ 3704 3705 shortpt = MAKEPOINTS (lParam); 3706 POINTSTOPOINT(pt, shortpt); 3707 clpt = pt; 3708 ScreenToClient (infoPtr->hwndSelf, &clpt); 3709 REBAR_InternalHitTest (infoPtr, &clpt, &scrap, 3710 (INT *)&nmmouse.dwItemSpec); 3711 nmmouse.dwItemData = 0; 3712 nmmouse.pt = clpt; 3713 nmmouse.dwHitInfo = 0; 3714 if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) { 3715 TRACE("notify changed return value from %ld to %d\n", 3716 ret, i); 3717 ret = (LRESULT) i; 3718 } 3719 TRACE("returning %ld, client point (%ld,%ld)\n", ret, clpt.x, clpt.y); 3720 return ret; 2903 3721 } 2904 3722 2905 3723 2906 3724 static LRESULT 2907 REBAR_EraseBkGnd (HWND hwnd, WPARAM wParam, LPARAM lParam) 2908 { 2909 RECT cliprect; 2910 2911 if (GetClipBox ( (HDC)wParam, &cliprect)) 2912 return REBAR_InternalEraseBkGnd (hwnd, wParam, lParam, &cliprect); 2913 return 0; 2914 } 2915 2916 2917 static LRESULT 2918 REBAR_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) 2919 { 2920 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2921 2922 return (LRESULT)infoPtr->hFont; 2923 } 2924 2925 2926 static LRESULT 2927 REBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) 2928 { 2929 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2930 REBAR_BAND *lpBand; 2931 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 2932 2933 /* If InternalHitTest did not find a hit on the Gripper, */ 2934 /* then ignore the button click. */ 2935 if (infoPtr->ihitBand == -1) return 0; 2936 2937 SetCapture (hwnd); 2938 2939 /* save off the LOWORD and HIWORD of lParam as initial x,y */ 2940 lpBand = &infoPtr->bands[infoPtr->ihitBand]; 2941 infoPtr->dragStart = MAKEPOINTS(lParam); 2942 infoPtr->dragNow = infoPtr->dragStart; 2943 if (dwStyle & CCS_VERT) 2944 infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.top+REBAR_PRE_GRIPPER); 2945 else 2946 infoPtr->ihitoffset = infoPtr->dragStart.x - (lpBand->rcBand.left+REBAR_PRE_GRIPPER); 2947 2948 return 0; 2949 } 2950 2951 2952 static LRESULT 2953 REBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) 2954 { 2955 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2956 NMHDR layout; 2957 RECT rect; 2958 2959 /* If InternalHitTest did not find a hit on the Gripper, */ 2960 /* then ignore the button click. */ 2961 if (infoPtr->ihitBand == -1) return 0; 2962 2963 infoPtr->dragStart.x = 0; 2964 infoPtr->dragStart.y = 0; 2965 infoPtr->dragNow = infoPtr->dragStart; 2966 infoPtr->ihitBand = -1; 2967 2968 ReleaseCapture (); 2969 2970 if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) { 2971 REBAR_Notify(hwnd, (NMHDR *) &layout, infoPtr, RBN_LAYOUTCHANGED); 2972 REBAR_Notify_NMREBAR (hwnd, infoPtr, -1, RBN_ENDDRAG); 2973 infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED; 2974 } 2975 2976 GetClientRect(hwnd, &rect); 2977 InvalidateRect(hwnd, NULL, TRUE); 2978 2979 return 0; 2980 } 2981 2982 2983 static LRESULT 2984 REBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) 2985 { 2986 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 2987 REBAR_BAND *band1, *band2; 2988 POINTS ptsmove; 2989 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 2990 2991 /* Validate entry as hit on Gripper has occured */ 2992 if (GetCapture() != hwnd) return 0; 2993 if (infoPtr->ihitBand == -1) return 0; 2994 2995 ptsmove = MAKEPOINTS(lParam); 2996 2997 /* if mouse did not move much, exit */ 2998 if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) && 2999 (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0; 3000 3001 band1 = &infoPtr->bands[infoPtr->ihitBand-1]; 3002 band2 = &infoPtr->bands[infoPtr->ihitBand]; 3003 3004 /* Test for valid drag case - must not be first band in row */ 3005 if (dwStyle & CCS_VERT) { 3006 if ((ptsmove.x < band2->rcBand.left) || 3007 (ptsmove.x > band2->rcBand.right) || 3008 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3009 FIXME("Cannot drag to other rows yet!!\n"); 3010 } 3011 else { 3012 REBAR_HandleLRDrag (hwnd, infoPtr, &ptsmove, dwStyle); 3013 } 3014 } 3015 else { 3016 if ((ptsmove.y < band2->rcBand.top) || 3017 (ptsmove.y > band2->rcBand.bottom) || 3018 ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { 3019 FIXME("Cannot drag to other rows yet!!\n"); 3020 } 3021 else { 3022 REBAR_HandleLRDrag (hwnd, infoPtr, &ptsmove, dwStyle); 3023 } 3024 } 3025 return 0; 3026 } 3027 3028 3029 inline static LRESULT 3030 REBAR_NCCalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam) 3031 { 3032 if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) { 3033 ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE); 3034 ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); 3035 ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE); 3036 ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); 3037 } 3038 3039 return 0; 3040 } 3041 3042 3043 static LRESULT 3044 REBAR_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam) 3045 { 3046 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 3725 REBAR_NCPaint (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3726 { 3047 3727 RECT rcWindow; 3048 3728 HDC hdc; 3049 3729 3050 if ( dwStyle & WS_MINIMIZE)3730 if (infoPtr->dwStyle & WS_MINIMIZE) 3051 3731 return 0; /* Nothing to do */ 3052 3732 3053 DefWindowProcA ( hwnd, WM_NCPAINT, wParam, lParam);3054 3055 if (!(hdc = GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW )))3733 DefWindowProcA (infoPtr->hwndSelf, WM_NCPAINT, wParam, lParam); 3734 3735 if (!(hdc = GetDCEx( infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW ))) 3056 3736 return 0; 3057 3737 3058 if ( dwStyle & WS_BORDER) {3059 GetWindowRect ( hwnd, &rcWindow);3738 if (infoPtr->dwStyle & WS_BORDER) { 3739 GetWindowRect (infoPtr->hwndSelf, &rcWindow); 3060 3740 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); 3061 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); 3062 } 3063 3064 ReleaseDC( hwnd, hdc ); 3741 TRACE("rect (%d,%d)-(%d,%d)\n", 3742 rcWindow.left, rcWindow.top, 3743 rcWindow.right, rcWindow.bottom); 3744 /* see comments in _NCCalcSize for reason this is not done */ 3745 /* DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); */ 3746 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP | BF_BOTTOM); 3747 } 3748 3749 ReleaseDC( infoPtr->hwndSelf, hdc ); 3065 3750 3066 3751 return 0; … … 3069 3754 3070 3755 static LRESULT 3071 REBAR_Paint (HWND hwnd, WPARAM wParam, LPARAM lParam) 3756 REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3757 { 3758 INT i; 3759 3760 if (lParam == NF_REQUERY) { 3761 i = SendMessageA(REBAR_GetNotifyParent (infoPtr), 3762 WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY); 3763 if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { 3764 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", 3765 i); 3766 i = NFR_ANSI; 3767 } 3768 infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; 3769 return (LRESULT)i; 3770 } 3771 return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI); 3772 } 3773 3774 3775 static LRESULT 3776 REBAR_Paint (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3072 3777 { 3073 3778 HDC hdc; 3074 3779 PAINTSTRUCT ps; 3075 3076 hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; 3077 3078 TRACE("painting (%d,%d)-(%d,%d)\n", 3780 RECT rc; 3781 3782 GetClientRect(infoPtr->hwndSelf, &rc); 3783 hdc = wParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : (HDC)wParam; 3784 3785 TRACE("painting (%d,%d)-(%d,%d) client (%d,%d)-(%d,%d)\n", 3079 3786 ps.rcPaint.left, ps.rcPaint.top, 3080 ps.rcPaint.right, ps.rcPaint.bottom); 3787 ps.rcPaint.right, ps.rcPaint.bottom, 3788 rc.left, rc.top, rc.right, rc.bottom); 3081 3789 3082 3790 if (ps.fErase) { 3083 3791 /* Erase area of paint if requested */ 3084 REBAR_InternalEraseBkGnd ( hwnd, wParam, lParam, &ps.rcPaint);3085 } 3086 3087 REBAR_Refresh ( hwnd, hdc);3792 REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint); 3793 } 3794 3795 REBAR_Refresh (infoPtr, hdc); 3088 3796 if (!wParam) 3089 EndPaint ( hwnd, &ps);3797 EndPaint (infoPtr->hwndSelf, &ps); 3090 3798 return 0; 3091 3799 } … … 3093 3801 3094 3802 static LRESULT 3095 REBAR_SetCursor (HWND hwnd, WPARAM wParam, LPARAM lParam) 3096 { 3097 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3098 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 3803 REBAR_SetCursor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3804 { 3099 3805 POINT pt; 3100 3806 UINT flags; … … 3103 3809 3104 3810 GetCursorPos (&pt); 3105 ScreenToClient ( hwnd, &pt);3106 3107 REBAR_InternalHitTest ( hwnd, &pt, &flags, NULL);3811 ScreenToClient (infoPtr->hwndSelf, &pt); 3812 3813 REBAR_InternalHitTest (infoPtr, &pt, &flags, NULL); 3108 3814 3109 3815 if (flags == RBHT_GRABBER) { 3110 if (( dwStyle & CCS_VERT) &&3111 !( dwStyle & RBS_VERTICALGRIPPER))3816 if ((infoPtr->dwStyle & CCS_VERT) && 3817 !(infoPtr->dwStyle & RBS_VERTICALGRIPPER)) 3112 3818 SetCursor (infoPtr->hcurVert); 3113 3819 else … … 3122 3828 3123 3829 static LRESULT 3124 REBAR_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) 3125 { 3126 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3830 REBAR_SetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3831 { 3127 3832 RECT rcClient; 3128 3833 REBAR_BAND *lpBand; … … 3134 3839 for (i=0; i<infoPtr->uNumBands; i++) { 3135 3840 lpBand = &infoPtr->bands[i]; 3136 REBAR_ValidateBand (hwnd, infoPtr, lpBand); 3137 } 3138 3139 3140 if (lParam) { 3141 GetClientRect (hwnd, &rcClient); 3142 REBAR_Layout (hwnd, &rcClient, FALSE, TRUE); 3143 REBAR_ForceResize (hwnd); 3144 REBAR_MoveChildWindows (hwnd); 3841 REBAR_ValidateBand (infoPtr, lpBand); 3842 } 3843 3844 3845 if (LOWORD(lParam)) { 3846 GetClientRect (infoPtr->hwndSelf, &rcClient); 3847 REBAR_Layout (infoPtr, &rcClient, FALSE, TRUE); 3145 3848 } 3146 3849 … … 3149 3852 3150 3853 3854 inline static LRESULT 3855 REBAR_SetRedraw (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3856 /***************************************************** 3857 * 3858 * Function; 3859 * Handles the WM_SETREDRAW message. 3860 * 3861 * Documentation: 3862 * According to testing V4.71 of COMCTL32 returns the 3863 * *previous* status of the redraw flag (either 0 or -1) 3864 * instead of the MSDN documented value of 0 if handled 3865 * 3866 *****************************************************/ 3867 { 3868 BOOL oldredraw = infoPtr->DoRedraw; 3869 3870 TRACE("set to %s, fStatus=%08x\n", 3871 (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus); 3872 infoPtr->DoRedraw = (BOOL) wParam; 3873 if (wParam) { 3874 if (infoPtr->fStatus & BAND_NEEDS_REDRAW) { 3875 REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands); 3876 REBAR_ForceResize (infoPtr); 3877 InvalidateRect (infoPtr->hwndSelf, 0, TRUE); 3878 } 3879 infoPtr->fStatus &= ~BAND_NEEDS_REDRAW; 3880 } 3881 return (oldredraw) ? -1 : 0; 3882 } 3883 3884 3151 3885 static LRESULT 3152 REBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam) 3153 { 3154 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3886 REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3887 { 3155 3888 RECT rcClient; 3156 3889 … … 3158 3891 if (infoPtr->fStatus & AUTO_RESIZE) { 3159 3892 infoPtr->fStatus &= ~AUTO_RESIZE; 3160 TRACE("AUTO_RESIZE was set, reset, fStatus=%08x \n",3161 infoPtr->fStatus );3893 TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n", 3894 infoPtr->fStatus, lParam); 3162 3895 return 0; 3163 3896 } 3164 3897 3165 GetClientRect (hwnd, &rcClient); 3166 if ((lParam == 0) && (rcClient.right == 0) && (rcClient.bottom == 0)) { 3167 /* native control seems to do this */ 3168 GetClientRect (GetParent(hwnd), &rcClient); 3169 TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", 3170 rcClient.right, rcClient.bottom); 3898 if (infoPtr->fStatus & CREATE_RUNNING) { 3899 /* still in CreateWindow */ 3900 RECT rcWin; 3901 3902 TRACE("still in CreateWindow\n"); 3903 infoPtr->fStatus &= ~CREATE_RUNNING; 3904 GetWindowRect ( infoPtr->hwndSelf, &rcWin); 3905 TRACE("win rect (%d,%d)-(%d,%d)\n", 3906 rcWin.left, rcWin.top, rcWin.right, rcWin.bottom); 3907 3908 if ((lParam == 0) && (rcWin.right-rcWin.left == 0) && 3909 (rcWin.bottom-rcWin.top == 0)) { 3910 /* native control seems to do this */ 3911 GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient); 3912 TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", 3913 rcClient.right, rcClient.bottom); 3914 } 3915 else { 3916 INT cx, cy; 3917 3918 cx = rcWin.right - rcWin.left; 3919 cy = rcWin.bottom - rcWin.top; 3920 if ((cx == LOWORD(lParam)) && (cy == HIWORD(lParam))) { 3921 return 0; 3922 } 3923 3924 /* do the actual WM_SIZE request */ 3925 GetClientRect (infoPtr->hwndSelf, &rcClient); 3926 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3927 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3928 LOWORD(lParam), HIWORD(lParam), 3929 rcClient.right, rcClient.bottom); 3930 } 3171 3931 } 3172 3932 else { 3173 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3174 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3175 LOWORD(lParam), HIWORD(lParam), 3176 rcClient.right, rcClient.bottom); 3177 } 3178 3179 REBAR_Layout (hwnd, &rcClient, TRUE, TRUE); 3180 REBAR_ForceResize (hwnd); 3933 /* Handle cases when outside of the CreateWindow process */ 3934 3935 GetClientRect (infoPtr->hwndSelf, &rcClient); 3936 if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) && 3937 (infoPtr->dwStyle & RBS_AUTOSIZE)) { 3938 /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */ 3939 /* native seems to use the current client rect for the size */ 3940 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3941 TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n", 3942 rcClient.right, rcClient.bottom); 3943 } 3944 else { 3945 TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", 3946 infoPtr->calcSize.cx, infoPtr->calcSize.cy, 3947 LOWORD(lParam), HIWORD(lParam), 3948 rcClient.right, rcClient.bottom); 3949 } 3950 } 3951 3952 if (infoPtr->dwStyle & RBS_AUTOSIZE) { 3953 NMRBAUTOSIZE autosize; 3954 3955 GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget); 3956 autosize.fChanged = 0; /* ??? */ 3957 autosize.rcActual = autosize.rcTarget; /* ??? */ 3958 REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE); 3959 TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n", 3960 autosize.rcTarget.right, autosize.rcTarget.bottom, lParam); 3961 } 3962 3963 if ((infoPtr->calcSize.cx != rcClient.right) || 3964 (infoPtr->calcSize.cy != rcClient.bottom)) 3965 infoPtr->fStatus |= BAND_NEEDS_LAYOUT; 3966 3967 REBAR_Layout (infoPtr, &rcClient, TRUE, TRUE); 3181 3968 infoPtr->fStatus &= ~AUTO_RESIZE; 3182 REBAR_MoveChildWindows (hwnd);3183 3969 3184 3970 return 0; 3971 } 3972 3973 3974 static LRESULT 3975 REBAR_StyleChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) 3976 { 3977 STYLESTRUCT *ss = (STYLESTRUCT *)lParam; 3978 3979 TRACE("current style=%08lx, styleOld=%08lx, style being set to=%08lx\n", 3980 infoPtr->dwStyle, ss->styleOld, ss->styleNew); 3981 infoPtr->dwStyle = ss->styleNew; 3982 3983 return FALSE; 3185 3984 } 3186 3985 … … 3189 3988 REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 3190 3989 { 3191 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam); 3192 if (!REBAR_GetInfoPtr (hwnd) && (uMsg != WM_CREATE)) 3990 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); 3991 3992 TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", 3993 hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); 3994 if (!infoPtr && (uMsg != WM_NCCREATE)) 3193 3995 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 3194 3996 switch (uMsg) … … 3197 3999 3198 4000 case RB_DELETEBAND: 3199 return REBAR_DeleteBand ( hwnd, wParam, lParam);4001 return REBAR_DeleteBand (infoPtr, wParam, lParam); 3200 4002 3201 4003 /* case RB_DRAGMOVE: */ … … 3203 4005 3204 4006 case RB_GETBANDBORDERS: 3205 return REBAR_GetBandBorders ( hwnd, wParam, lParam);4007 return REBAR_GetBandBorders (infoPtr, wParam, lParam); 3206 4008 3207 4009 case RB_GETBANDCOUNT: 3208 return REBAR_GetBandCount ( hwnd);4010 return REBAR_GetBandCount (infoPtr); 3209 4011 3210 4012 case RB_GETBANDINFO: /* obsoleted after IE3, but we have to 3211 4013 support it anyway. */ 3212 4014 case RB_GETBANDINFOA: 3213 return REBAR_GetBandInfoA ( hwnd, wParam, lParam);4015 return REBAR_GetBandInfoA (infoPtr, wParam, lParam); 3214 4016 3215 4017 case RB_GETBANDINFOW: 3216 return REBAR_GetBandInfoW ( hwnd, wParam, lParam);4018 return REBAR_GetBandInfoW (infoPtr, wParam, lParam); 3217 4019 3218 4020 case RB_GETBARHEIGHT: 3219 return REBAR_GetBarHeight ( hwnd, wParam, lParam);4021 return REBAR_GetBarHeight (infoPtr, wParam, lParam); 3220 4022 3221 4023 case RB_GETBARINFO: 3222 return REBAR_GetBarInfo ( hwnd, wParam, lParam);4024 return REBAR_GetBarInfo (infoPtr, wParam, lParam); 3223 4025 3224 4026 case RB_GETBKCOLOR: 3225 return REBAR_GetBkColor ( hwnd);4027 return REBAR_GetBkColor (infoPtr); 3226 4028 3227 4029 /* case RB_GETCOLORSCHEME: */ … … 3229 4031 3230 4032 case RB_GETPALETTE: 3231 return REBAR_GetPalette ( hwnd, wParam, lParam);4033 return REBAR_GetPalette (infoPtr, wParam, lParam); 3232 4034 3233 4035 case RB_GETRECT: 3234 return REBAR_GetRect ( hwnd, wParam, lParam);4036 return REBAR_GetRect (infoPtr, wParam, lParam); 3235 4037 3236 4038 case RB_GETROWCOUNT: 3237 return REBAR_GetRowCount ( hwnd);4039 return REBAR_GetRowCount (infoPtr); 3238 4040 3239 4041 case RB_GETROWHEIGHT: 3240 return REBAR_GetRowHeight ( hwnd, wParam, lParam);4042 return REBAR_GetRowHeight (infoPtr, wParam, lParam); 3241 4043 3242 4044 case RB_GETTEXTCOLOR: 3243 return REBAR_GetTextColor ( hwnd);4045 return REBAR_GetTextColor (infoPtr); 3244 4046 3245 4047 case RB_GETTOOLTIPS: 3246 return REBAR_GetToolTips ( hwnd);4048 return REBAR_GetToolTips (infoPtr); 3247 4049 3248 4050 case RB_GETUNICODEFORMAT: 3249 return REBAR_GetUnicodeFormat ( hwnd);4051 return REBAR_GetUnicodeFormat (infoPtr); 3250 4052 3251 4053 case CCM_GETVERSION: 3252 return REBAR_GetVersion ( hwnd);4054 return REBAR_GetVersion (infoPtr); 3253 4055 3254 4056 case RB_HITTEST: 3255 return REBAR_HitTest ( hwnd, wParam, lParam);4057 return REBAR_HitTest (infoPtr, wParam, lParam); 3256 4058 3257 4059 case RB_IDTOINDEX: 3258 return REBAR_IdToIndex ( hwnd, wParam, lParam);4060 return REBAR_IdToIndex (infoPtr, wParam, lParam); 3259 4061 3260 4062 case RB_INSERTBANDA: 3261 return REBAR_InsertBandA ( hwnd, wParam, lParam);4063 return REBAR_InsertBandA (infoPtr, wParam, lParam); 3262 4064 3263 4065 case RB_INSERTBANDW: 3264 return REBAR_InsertBandW ( hwnd, wParam, lParam);4066 return REBAR_InsertBandW (infoPtr, wParam, lParam); 3265 4067 3266 4068 case RB_MAXIMIZEBAND: 3267 return REBAR_MaximizeBand ( hwnd, wParam, lParam);4069 return REBAR_MaximizeBand (infoPtr, wParam, lParam); 3268 4070 3269 4071 case RB_MINIMIZEBAND: 3270 return REBAR_MinimizeBand ( hwnd, wParam, lParam);4072 return REBAR_MinimizeBand (infoPtr, wParam, lParam); 3271 4073 3272 4074 case RB_MOVEBAND: 3273 return REBAR_MoveBand ( hwnd, wParam, lParam);4075 return REBAR_MoveBand (infoPtr, wParam, lParam); 3274 4076 3275 4077 case RB_SETBANDINFOA: 3276 return REBAR_SetBandInfoA ( hwnd, wParam, lParam);4078 return REBAR_SetBandInfoA (infoPtr, wParam, lParam); 3277 4079 3278 4080 case RB_SETBANDINFOW: 3279 return REBAR_SetBandInfoW ( hwnd, wParam, lParam);4081 return REBAR_SetBandInfoW (infoPtr, wParam, lParam); 3280 4082 3281 4083 case RB_SETBARINFO: 3282 return REBAR_SetBarInfo ( hwnd, wParam, lParam);4084 return REBAR_SetBarInfo (infoPtr, wParam, lParam); 3283 4085 3284 4086 case RB_SETBKCOLOR: 3285 return REBAR_SetBkColor ( hwnd, wParam, lParam);4087 return REBAR_SetBkColor (infoPtr, wParam, lParam); 3286 4088 3287 4089 /* case RB_SETCOLORSCHEME: */ 3288 4090 /* case RB_SETPALETTE: */ 3289 /* return REBAR_GetPalette ( hwnd, wParam, lParam); */4091 /* return REBAR_GetPalette (infoPtr, wParam, lParam); */ 3290 4092 3291 4093 case RB_SETPARENT: 3292 return REBAR_SetParent ( hwnd, wParam, lParam);4094 return REBAR_SetParent (infoPtr, wParam, lParam); 3293 4095 3294 4096 case RB_SETTEXTCOLOR: 3295 return REBAR_SetTextColor ( hwnd, wParam, lParam);4097 return REBAR_SetTextColor (infoPtr, wParam, lParam); 3296 4098 3297 4099 /* case RB_SETTOOLTIPS: */ 3298 4100 3299 4101 case RB_SETUNICODEFORMAT: 3300 return REBAR_SetUnicodeFormat ( hwnd, wParam);4102 return REBAR_SetUnicodeFormat (infoPtr, wParam); 3301 4103 3302 4104 case CCM_SETVERSION: 3303 return REBAR_SetVersion ( hwnd, (INT)wParam);4105 return REBAR_SetVersion (infoPtr, (INT)wParam); 3304 4106 3305 4107 case RB_SHOWBAND: 3306 return REBAR_ShowBand ( hwnd, wParam, lParam);4108 return REBAR_ShowBand (infoPtr, wParam, lParam); 3307 4109 3308 4110 case RB_SIZETORECT: 3309 return REBAR_SizeToRect ( hwnd, wParam, lParam);4111 return REBAR_SizeToRect (infoPtr, wParam, lParam); 3310 4112 3311 4113 … … 3314 4116 case WM_DRAWITEM: 3315 4117 case WM_NOTIFY: 3316 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 4118 if (infoPtr->NtfUnicode) 4119 return SendMessageW (REBAR_GetNotifyParent (infoPtr), 4120 uMsg, wParam, lParam); 4121 else 4122 return SendMessageA (REBAR_GetNotifyParent (infoPtr), 4123 uMsg, wParam, lParam); 3317 4124 3318 4125 … … 3320 4127 3321 4128 case WM_CREATE: 3322 return REBAR_Create ( hwnd, wParam, lParam);4129 return REBAR_Create (infoPtr, wParam, lParam); 3323 4130 3324 4131 case WM_DESTROY: 3325 return REBAR_Destroy ( hwnd, wParam, lParam);4132 return REBAR_Destroy (infoPtr, wParam, lParam); 3326 4133 3327 4134 case WM_ERASEBKGND: 3328 return REBAR_EraseBkGnd ( hwnd, wParam, lParam);4135 return REBAR_EraseBkGnd (infoPtr, wParam, lParam); 3329 4136 3330 4137 case WM_GETFONT: 3331 return REBAR_GetFont ( hwnd, wParam, lParam);4138 return REBAR_GetFont (infoPtr, wParam, lParam); 3332 4139 3333 4140 /* case WM_LBUTTONDBLCLK: supported according to ControlSpy */ 3334 4141 3335 4142 case WM_LBUTTONDOWN: 3336 return REBAR_LButtonDown ( hwnd, wParam, lParam);4143 return REBAR_LButtonDown (infoPtr, wParam, lParam); 3337 4144 3338 4145 case WM_LBUTTONUP: 3339 return REBAR_LButtonUp ( hwnd, wParam, lParam);4146 return REBAR_LButtonUp (infoPtr, wParam, lParam); 3340 4147 3341 4148 /* case WM_MEASUREITEM: supported according to ControlSpy */ 3342 4149 3343 4150 case WM_MOUSEMOVE: 3344 return REBAR_MouseMove ( hwnd, wParam, lParam);4151 return REBAR_MouseMove (infoPtr, wParam, lParam); 3345 4152 3346 4153 case WM_NCCALCSIZE: 3347 return REBAR_NCCalcSize (hwnd, wParam, lParam); 3348 3349 /* case WM_NCCREATE: supported according to ControlSpy */ 3350 /* case WM_NCHITTEST: supported according to ControlSpy */ 4154 return REBAR_NCCalcSize (infoPtr, wParam, lParam); 4155 4156 case WM_NCCREATE: 4157 return REBAR_NCCreate (hwnd, wParam, lParam); 4158 4159 case WM_NCHITTEST: 4160 return REBAR_NCHitTest (infoPtr, wParam, lParam); 3351 4161 3352 4162 case WM_NCPAINT: 3353 return REBAR_NCPaint (hwnd, wParam, lParam); 3354 3355 /* case WM_NOTIFYFORMAT: supported according to ControlSpy */ 4163 return REBAR_NCPaint (infoPtr, wParam, lParam); 4164 4165 case WM_NOTIFYFORMAT: 4166 return REBAR_NotifyFormat (infoPtr, wParam, lParam); 3356 4167 3357 4168 case WM_PAINT: 3358 return REBAR_Paint ( hwnd, wParam, lParam);4169 return REBAR_Paint (infoPtr, wParam, lParam); 3359 4170 3360 4171 /* case WM_PALETTECHANGED: supported according to ControlSpy */ … … 3365 4176 3366 4177 case WM_SETCURSOR: 3367 return REBAR_SetCursor ( hwnd, wParam, lParam);4178 return REBAR_SetCursor (infoPtr, wParam, lParam); 3368 4179 3369 4180 case WM_SETFONT: 3370 return REBAR_SetFont (hwnd, wParam, lParam); 3371 3372 /* case WM_SETREDRAW: supported according to ControlSpy */ 4181 return REBAR_SetFont (infoPtr, wParam, lParam); 4182 4183 case WM_SETREDRAW: 4184 return REBAR_SetRedraw (infoPtr, wParam, lParam); 3373 4185 3374 4186 case WM_SIZE: 3375 return REBAR_Size (hwnd, wParam, lParam); 3376 3377 /* case WM_STYLECHANGED: supported according to ControlSpy */ 4187 return REBAR_Size (infoPtr, wParam, lParam); 4188 4189 case WM_STYLECHANGED: 4190 return REBAR_StyleChanged (infoPtr, wParam, lParam); 4191 3378 4192 /* case WM_SYSCOLORCHANGE: supported according to ControlSpy */ 4193 /* "Applications that have brushes using the existing system colors 4194 should delete those brushes and recreate them using the new 4195 system colors." per MSDN */ 4196 3379 4197 /* case WM_VKEYTOITEM: supported according to ControlSpy */ 3380 4198 /* case WM_WININICHANGE: */
Note:
See TracChangeset
for help on using the changeset viewer.
