ReactOS 0.4.17-dev-683-g0dafdc5
rebar.c
Go to the documentation of this file.
1/*
2 * Rebar control
3 *
4 * Copyright 1998, 1999 Eric Kohl
5 * Copyright 2007, 2008 Mikolaj Zalewski
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 *
21 * NOTES
22 *
23 * This code was audited for completeness against the documented features
24 * of Comctl32.dll version 6.0 on Oct. 19, 2004, by Robert Shearman.
25 *
26 * Unless otherwise noted, we believe this code to be complete, as per
27 * the specification mentioned above.
28 * If you discover missing features or bugs please note them below.
29 *
30 * TODO
31 * Styles:
32 * - RBS_DBLCLKTOGGLE
33 * - RBS_FIXEDORDER
34 * - RBS_REGISTERDROP
35 * - RBS_TOOLTIPS
36 * Messages:
37 * - RB_BEGINDRAG
38 * - RB_DRAGMOVE
39 * - RB_ENDDRAG
40 * - RB_GETBANDMARGINS
41 * - RB_GETCOLORSCHEME
42 * - RB_GETDROPTARGET
43 * - RB_GETPALETTE
44 * - RB_SETCOLORSCHEME
45 * - RB_SETPALETTE
46 * - RB_SETTOOLTIPS
47 * - WM_CHARTOITEM
48 * - WM_LBUTTONDBLCLK
49 * - WM_PALETTECHANGED
50 * - WM_QUERYNEWPALETTE
51 * - WM_RBUTTONDOWN
52 * - WM_RBUTTONUP
53 * - WM_VKEYTOITEM
54 * - WM_WININICHANGE
55 * Notifications:
56 * - NM_HCHITTEST
57 * - NM_RELEASEDCAPTURE
58 * - RBN_AUTOBREAK
59 * - RBN_GETOBJECT
60 * - RBN_MINMAX
61 * Band styles:
62 * - RBBS_FIXEDBMP
63 * Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT)
64 * to set the size of the separator width (the value SEP_WIDTH_SIZE
65 * in here). Should be fixed!!
66 */
67
68/*
69 * Testing: set to 1 to make background brush *always* green
70 */
71#define GLATESTING 0
72
73/*
74 * 3. REBAR_MoveChildWindows should have a loop because more than
75 * one pass (together with the RBN_CHILDSIZEs) is made on
76 * at least RB_INSERTBAND
77 */
78
79#include <assert.h>
80#include <stdarg.h>
81#include <stdlib.h>
82#include <string.h>
83
84#include "windef.h"
85#include "winbase.h"
86#include "wingdi.h"
87#include "winuser.h"
88#include "winnls.h"
89#include "commctrl.h"
90#include "comctl32.h"
91#include "uxtheme.h"
92#include "vssym32.h"
93#include "wine/debug.h"
94
96
97typedef struct
98{
105 UINT cxMinChild; /* valid if _CHILDSIZE */
106 UINT cyMinChild; /* valid if _CHILDSIZE */
107 UINT cx; /* valid if _SIZE */
110 UINT cyChild; /* valid if _CHILDSIZE */
111 UINT cyMaxChild; /* valid if _CHILDSIZE */
112 UINT cyIntegral; /* valid if _CHILDSIZE */
116
117 INT cxEffective; /* current cx for band */
118 UINT cyHeader; /* the height of the header */
119 UINT cxMinBand; /* minimum cx for band */
120 UINT cyMinBand; /* minimum cy for band */
121
122 UINT cyRowSoFar; /* for RBS_VARHEIGHT - the height of the row if it would break on this band (set by _Layout) */
123 INT iRow; /* zero-based index of the row this band assigned to */
124 UINT fStatus; /* status flags, reset only by _Validate */
125 UINT fDraw; /* drawing flags, reset only by _Layout */
126 UINT uCDret; /* last return from NM_CUSTOMDRAW */
127 RECT rcBand; /* calculated band rectangle - coordinates swapped for CCS_VERT */
128 RECT rcGripper; /* calculated gripper rectangle */
129 RECT rcCapImage; /* calculated caption image rectangle */
130 RECT rcCapText; /* calculated caption text rectangle */
131 RECT rcChild; /* calculated child rectangle */
132 RECT rcChevron; /* calculated chevron rectangle */
133
136} REBAR_BAND;
137
138/* has a value of: 0, CCS_TOP, CCS_NOMOVEY, CCS_BOTTOM */
139#define CCS_LAYOUT_MASK 0x3
140
141/* fStatus flags */
142#define HAS_GRIPPER 0x00000001
143#define HAS_IMAGE 0x00000002
144#define HAS_TEXT 0x00000004
145
146/* fDraw flags */
147#define DRAW_GRIPPER 0x00000001
148#define DRAW_IMAGE 0x00000002
149#define DRAW_TEXT 0x00000004
150#define DRAW_CHEVRONHOT 0x00000040
151#define DRAW_CHEVRONPUSHED 0x00000080
152#define NTF_INVALIDATE 0x01000000
153
154typedef struct
155{
156 COLORREF clrBk; /* background color */
157 COLORREF clrText; /* text color */
158 COLORREF clrBtnText; /* system color for BTNTEXT */
159 COLORREF clrBtnFace; /* system color for BTNFACE */
160 HIMAGELIST himl; /* handle to imagelist */
161 UINT uNumBands; /* # of bands in rebar (first=0, last=uNumBands-1 */
162 UINT uNumRows; /* # of rows of bands (first=1, last=uNumRows */
163 HWND hwndSelf; /* handle of REBAR window itself */
164 HWND hwndToolTip; /* handle to the tool tip control */
165 HWND hwndNotify; /* notification window (parent) */
167 HFONT hFont; /* handle to the rebar's font */
168 SIZE imageSize; /* image size (image list) */
169 DWORD dwStyle; /* window style */
170 DWORD orgStyle; /* original style (dwStyle may change) */
171 SIZE calcSize; /* calculated rebar size - coordinates swapped for CCS_VERT */
172 BOOL bUnicode; /* TRUE if parent wants notify in W format */
173 BOOL DoRedraw; /* TRUE to actually draw bands */
174 UINT fStatus; /* Status flags (see below) */
175 HCURSOR hcurArrow; /* handle to the arrow cursor */
176 HCURSOR hcurHorz; /* handle to the EW cursor */
177 HCURSOR hcurVert; /* handle to the NS cursor */
178 HCURSOR hcurDrag; /* handle to the drag cursor */
179 INT iVersion; /* version number */
180 POINT dragStart; /* x,y of button down */
181 POINT dragNow; /* x,y of this MouseMove */
182 INT iOldBand; /* last band that had the mouse cursor over it */
183 INT ihitoffset; /* offset of hotspot from gripper.left */
184 INT ichevronhotBand; /* last band that had a hot chevron */
185 INT iGrabbedBand;/* band number of band whose gripper was grabbed */
186
187 HDPA bands; /* pointer to the array of rebar bands */
188} REBAR_INFO;
189
190/* fStatus flags */
191#define BEGIN_DRAG_ISSUED 0x00000001
192#define SELF_RESIZE 0x00000002
193#define BAND_NEEDS_REDRAW 0x00000020
194
195/* used by Windows to mark that the header size has been set by the user and shouldn't be changed */
196#define RBBS_UNDOC_FIXEDHEADER 0x40000000
197
198/* ---- REBAR layout constants. Mostly determined by ---- */
199/* ---- experiment on WIN 98. ---- */
200
201/* Width (or height) of separators between bands (either horz. or */
202/* vert.). True only if RBS_BANDBORDERS is set */
203#define SEP_WIDTH_SIZE 2
204#define SEP_WIDTH ((infoPtr->dwStyle & RBS_BANDBORDERS) ? SEP_WIDTH_SIZE : 0)
205
206/* Blank (background color) space between Gripper (if present) */
207/* and next item (image, text, or window). Always present */
208#define REBAR_ALWAYS_SPACE 4
209
210/* Blank (background color) space after Image (if present). */
211#define REBAR_POST_IMAGE 2
212
213/* Blank (background color) space after Text (if present). */
214#define REBAR_POST_TEXT 4
215
216/* Height of vertical gripper in a CCS_VERT rebar. */
217#define GRIPPER_HEIGHT 16
218
219/* Blank (background color) space before Gripper (if present). */
220#define REBAR_PRE_GRIPPER 2
221
222/* Width (of normal vertical gripper) or height (of horz. gripper) */
223/* if present. */
224#define GRIPPER_WIDTH 3
225
226/* Width of the chevron button if present */
227#define CHEVRON_WIDTH 10
228
229/* the gap between the child and the next band */
230#define REBAR_POST_CHILD 4
231
232/* Height of divider for Rebar if not disabled (CCS_NODIVIDER) */
233/* either top or bottom */
234#define REBAR_DIVIDER 2
235
236/* height of a rebar without a child */
237#define REBAR_NO_CHILD_HEIGHT 4
238
239/* minimum vertical height of a normal bar */
240/* or minimum width of a CCS_VERT bar - from experiment on Win2k */
241#define REBAR_MINSIZE 23
242
243/* This is the increment that is used over the band height */
244#define REBARSPACE(a) ((a->fStyle & RBBS_CHILDEDGE) ? 2*REBAR_DIVIDER : 0)
245
246/* ---- End of REBAR layout constants. ---- */
247
248#define RB_GETBANDINFO_OLD (WM_USER+5) /* obsoleted after IE3, but we have to support it anyway */
249
250/* The following define determines if a given band is hidden */
251#define HIDDENBAND(a) (((a)->fStyle & RBBS_HIDDEN) || \
252 ((infoPtr->dwStyle & CCS_VERT) && \
253 ((a)->fStyle & RBBS_NOVERT)))
254
255#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongPtrW (hwnd, 0))
256
258static void REBAR_AutoSize(REBAR_INFO *infoPtr, BOOL needsLayout);
259
260/* no index check here */
261static inline REBAR_BAND* REBAR_GetBand(const REBAR_INFO *infoPtr, INT i)
262{
263 assert(i >= 0 && i < infoPtr->uNumBands);
264 return DPA_GetPtr(infoPtr->bands, i);
265}
266
267/* "constant values" retrieved when DLL was initialized */
268/* FIXME we do this when the classes are registered. */
269static UINT mindragx = 0;
270static UINT mindragy = 0;
271
272static const char * const band_stylename[] = {
273 "RBBS_BREAK", /* 0001 */
274 "RBBS_FIXEDSIZE", /* 0002 */
275 "RBBS_CHILDEDGE", /* 0004 */
276 "RBBS_HIDDEN", /* 0008 */
277 "RBBS_NOVERT", /* 0010 */
278 "RBBS_FIXEDBMP", /* 0020 */
279 "RBBS_VARIABLEHEIGHT", /* 0040 */
280 "RBBS_GRIPPERALWAYS", /* 0080 */
281 "RBBS_NOGRIPPER", /* 0100 */
282 "RBBS_USECHEVRON", /* 0200 */
283 "RBBS_HIDETITLE", /* 0400 */
284 "RBBS_TOPALIGN", /* 0800 */
285 NULL };
286
287static const char * const band_maskname[] = {
288 "RBBIM_STYLE", /* 0x00000001 */
289 "RBBIM_COLORS", /* 0x00000002 */
290 "RBBIM_TEXT", /* 0x00000004 */
291 "RBBIM_IMAGE", /* 0x00000008 */
292 "RBBIM_CHILD", /* 0x00000010 */
293 "RBBIM_CHILDSIZE", /* 0x00000020 */
294 "RBBIM_SIZE", /* 0x00000040 */
295 "RBBIM_BACKGROUND", /* 0x00000080 */
296 "RBBIM_ID", /* 0x00000100 */
297 "RBBIM_IDEALSIZE", /* 0x00000200 */
298 "RBBIM_LPARAM", /* 0x00000400 */
299 "RBBIM_HEADERSIZE", /* 0x00000800 */
300 "RBBIM_CHEVRONLOCATION", /* 0x00001000 */
301 "RBBIM_CHEVRONSTATE", /* 0x00002000 */
302 NULL };
303
304
305static const WCHAR themeClass[] = { 'R','e','b','a','r',0 };
306
307static CHAR *
309{
310 INT i = 0;
311
312 *buffer = 0;
313 while (band_stylename[i]) {
314 if (style & (1<<i)) {
315 if (*buffer) strcat(buffer, " | ");
317 }
318 i++;
319 }
320 return buffer;
321}
322
323
324static CHAR *
326{
327 INT i = 0;
328
329 *buffer = 0;
330 while (band_maskname[i]) {
331 if (mask & (1<<i)) {
332 if (*buffer) strcat(buffer, " | ");
334 }
335 i++;
336 }
337 return buffer;
338}
339
340
341static VOID
343{
344 char buff[300];
345
346 if( !TRACE_ON(rebar) ) return;
347 TRACE("band info: ");
348 if (pB->fMask & RBBIM_ID)
349 TRACE("ID=%u, ", pB->wID);
350 TRACE("size=%u, child=%p", pB->cbSize, pB->hwndChild);
351 if (pB->fMask & RBBIM_COLORS)
352 TRACE(", clrF=0x%06x, clrB=0x%06x", pB->clrFore, pB->clrBack);
353 TRACE("\n");
354
355 TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(buff, pB->fMask));
356 if (pB->fMask & RBBIM_STYLE)
357 TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(buff, pB->fStyle));
359 TRACE("band info:");
360 if (pB->fMask & RBBIM_SIZE)
361 TRACE(" cx=%u", pB->cx);
362 if (pB->fMask & RBBIM_IDEALSIZE)
363 TRACE(" xIdeal=%u", pB->cxIdeal);
364 if (pB->fMask & RBBIM_HEADERSIZE)
365 TRACE(" xHeader=%u", pB->cxHeader);
366 if (pB->fMask & RBBIM_LPARAM)
367 TRACE(" lParam=0x%08lx", pB->lParam);
368 TRACE("\n");
369 }
370 if (pB->fMask & RBBIM_CHILDSIZE)
371 TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
372 pB->cxMinChild,
373 pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
374}
375
376static VOID
378{
379 char buff[300];
380 REBAR_BAND *pB;
381 UINT i;
382
383 if(! TRACE_ON(rebar) ) return;
384
385 TRACE("hwnd=%p: color=%08x/%08x, bands=%u, rows=%u, cSize=%d,%d\n",
386 iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,
387 iP->calcSize.cx, iP->calcSize.cy);
388 TRACE("hwnd=%p: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, iGrabbedBand=%d\n",
389 iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,
390 iP->dragNow.x, iP->dragNow.y,
391 iP->iGrabbedBand);
392 TRACE("hwnd=%p: style=%08x, notify in Unicode=%s, redraw=%s\n",
393 iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",
394 (iP->DoRedraw)?"TRUE":"FALSE");
395 for (i = 0; i < iP->uNumBands; i++) {
396 pB = REBAR_GetBand(iP, i);
397 TRACE("band # %u:", i);
398 if (pB->fMask & RBBIM_ID)
399 TRACE(" ID=%u", pB->wID);
400 if (pB->fMask & RBBIM_CHILD)
401 TRACE(" child=%p", pB->hwndChild);
402 if (pB->fMask & RBBIM_COLORS)
403 TRACE(" clrF=0x%06x clrB=0x%06x", pB->clrFore, pB->clrBack);
404 TRACE("\n");
405 TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(buff, pB->fMask));
406 if (pB->fMask & RBBIM_STYLE)
407 TRACE("band # %u: style=0x%08x (%s)\n", i, pB->fStyle, REBAR_FmtStyle(buff, pB->fStyle));
408 TRACE("band # %u: xHeader=%u",
409 i, pB->cxHeader);
410 if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) {
411 if (pB->fMask & RBBIM_SIZE)
412 TRACE(" cx=%u", pB->cx);
413 if (pB->fMask & RBBIM_IDEALSIZE)
414 TRACE(" xIdeal=%u", pB->cxIdeal);
415 if (pB->fMask & RBBIM_LPARAM)
416 TRACE(" lParam=0x%08lx", pB->lParam);
417 }
418 TRACE("\n");
419 if (RBBIM_CHILDSIZE)
420 TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
421 i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
422 if (pB->fMask & RBBIM_TEXT)
423 TRACE("band # %u: text=%s\n",
424 i, (pB->lpText) ? debugstr_w(pB->lpText) : "(null)");
425 TRACE("band # %u: cxMinBand=%u, cxEffective=%u, cyMinBand=%u\n",
426 i, pB->cxMinBand, pB->cxEffective, pB->cyMinBand);
427 TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%s), Grip=(%s)\n",
428 i, pB->fStatus, pB->fDraw, wine_dbgstr_rect(&pB->rcBand),
430 TRACE("band # %u: Img=(%s), Txt=(%s), Child=(%s)\n",
433 }
434
435}
436
437/* dest can be equal to src */
438static void translate_rect(const REBAR_INFO *infoPtr, RECT *dest, const RECT *src)
439{
440 if (infoPtr->dwStyle & CCS_VERT) {
441 int tmp;
442 tmp = src->left;
443 dest->left = src->top;
444 dest->top = tmp;
445
446 tmp = src->right;
447 dest->right = src->bottom;
448 dest->bottom = tmp;
449 } else {
450 *dest = *src;
451 }
452}
453
454static int get_rect_cx(const REBAR_INFO *infoPtr, const RECT *lpRect)
455{
456 if (infoPtr->dwStyle & CCS_VERT)
457 return lpRect->bottom - lpRect->top;
458 return lpRect->right - lpRect->left;
459}
460
461static int get_rect_cy(const REBAR_INFO *infoPtr, const RECT *lpRect)
462{
463 if (infoPtr->dwStyle & CCS_VERT)
464 return lpRect->right - lpRect->left;
465 return lpRect->bottom - lpRect->top;
466}
467
468static int round_child_height(const REBAR_BAND *lpBand, int cyHeight)
469{
470 int cy = 0;
471 if (lpBand->cyIntegral == 0)
472#ifdef __REACTOS__ /* Import fix from Wine-11.15 */
473 {
474 cyHeight = max(cyHeight, (int)lpBand->cyMinChild);
475 cyHeight = min(cyHeight, (int)lpBand->cyMaxChild);
476 return cyHeight;
477 }
478#else
479 return cyHeight;
480#endif
481 cy = max(cyHeight - (int)lpBand->cyMinChild, 0);
482 cy = lpBand->cyMinChild + (cy/lpBand->cyIntegral) * lpBand->cyIntegral;
483 cy = min(cy, lpBand->cyMaxChild);
484 return cy;
485}
486
487static void update_min_band_height(const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
488{
489 lpBand->cyMinBand = max(lpBand->cyHeader,
490 (lpBand->hwndChild ? lpBand->cyChild + REBARSPACE(lpBand) : REBAR_NO_CHILD_HEIGHT));
491}
492
493static void
495{
496 INT x, y;
497 HPEN hPen, hOldPen;
498
499 if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
500 hOldPen = SelectObject ( hdc, hPen );
501 x = left + 2;
502 y = top;
503 MoveToEx (hdc, x, y, NULL);
504 LineTo (hdc, x+5, y++); x++;
505 MoveToEx (hdc, x, y, NULL);
506 LineTo (hdc, x+3, y++); x++;
507 MoveToEx (hdc, x, y, NULL);
508 LineTo (hdc, x+1, y);
509 SelectObject( hdc, hOldPen );
510 DeleteObject( hPen );
511}
512
513static HWND
515{
516 HWND parent, owner;
517
518 parent = infoPtr->hwndNotify;
519 if (!parent) {
520 parent = GetParent (infoPtr->hwndSelf);
521 owner = GetWindow (infoPtr->hwndSelf, GW_OWNER);
522 if (owner) parent = owner;
523 }
524 return parent;
525}
526
527
528static INT
529REBAR_Notify (NMHDR *nmhdr, const REBAR_INFO *infoPtr, UINT code)
530{
531 HWND parent;
532
533 parent = REBAR_GetNotifyParent (infoPtr);
534 nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf);
535 nmhdr->hwndFrom = infoPtr->hwndSelf;
536 nmhdr->code = code;
537
538 TRACE("window %p, code=%08x, via %s\n", parent, code, (infoPtr->bUnicode)?"Unicode":"ANSI");
539
540 return SendMessageW(parent, WM_NOTIFY, nmhdr->idFrom, (LPARAM)nmhdr);
541}
542
543static INT
545{
546 NMREBAR notify_rebar;
547
548 notify_rebar.dwMask = 0;
549 if (uBand != -1) {
550 REBAR_BAND *lpBand = REBAR_GetBand(infoPtr, uBand);
551
552 if (lpBand->fMask & RBBIM_ID) {
553 notify_rebar.dwMask |= RBNM_ID;
554 notify_rebar.wID = lpBand->wID;
555 }
556 if (lpBand->fMask & RBBIM_LPARAM) {
557 notify_rebar.dwMask |= RBNM_LPARAM;
558 notify_rebar.lParam = lpBand->lParam;
559 }
560 if (lpBand->fMask & RBBIM_STYLE) {
561 notify_rebar.dwMask |= RBNM_STYLE;
562 notify_rebar.fStyle = lpBand->fStyle;
563 }
564 }
565 notify_rebar.uBand = uBand;
566 return REBAR_Notify ((NMHDR *)&notify_rebar, infoPtr, code);
567}
568
569static VOID
570REBAR_DrawBand (HDC hdc, const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
571{
572 HFONT hOldFont = 0;
573 INT oldBkMode = 0;
574 NMCUSTOMDRAW nmcd;
575 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
576 RECT rcBand;
577
578 translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
579
580 if (lpBand->fDraw & DRAW_TEXT) {
581 hOldFont = SelectObject (hdc, infoPtr->hFont);
582 oldBkMode = SetBkMode (hdc, TRANSPARENT);
583 }
584
585 /* should test for CDRF_NOTIFYITEMDRAW here */
587 nmcd.hdc = hdc;
588 nmcd.rc = rcBand;
589 nmcd.rc.right = lpBand->rcCapText.right;
590 nmcd.rc.bottom = lpBand->rcCapText.bottom;
591 nmcd.dwItemSpec = lpBand->wID;
592 nmcd.uItemState = 0;
593 nmcd.lItemlParam = lpBand->lParam;
594 lpBand->uCDret = REBAR_Notify ((NMHDR *)&nmcd, infoPtr, NM_CUSTOMDRAW);
595 if (lpBand->uCDret == CDRF_SKIPDEFAULT) {
596 if (oldBkMode != TRANSPARENT)
597 SetBkMode (hdc, oldBkMode);
598 SelectObject (hdc, hOldFont);
599 return;
600 }
601
602 /* draw gripper */
603 if (lpBand->fDraw & DRAW_GRIPPER)
604 {
605 if (theme)
606 {
607 RECT rcGripper = lpBand->rcGripper;
608 int partId = (infoPtr->dwStyle & CCS_VERT) ? RP_GRIPPERVERT : RP_GRIPPER;
609 GetThemeBackgroundExtent (theme, hdc, partId, 0, &rcGripper, &rcGripper);
610 OffsetRect (&rcGripper, lpBand->rcGripper.left - rcGripper.left,
611 lpBand->rcGripper.top - rcGripper.top);
612 DrawThemeBackground (theme, hdc, partId, 0, &rcGripper, NULL);
613 }
614 else
616 }
617
618 /* draw caption image */
619 if (lpBand->fDraw & DRAW_IMAGE) {
620 POINT pt;
621
622 /* center image */
623 pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;
624 pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;
625
626 ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,
627 pt.x, pt.y,
629 }
630
631 /* draw caption text */
632 if (lpBand->fDraw & DRAW_TEXT) {
633 /* need to handle CDRF_NEWFONT here */
634 INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
635 COLORREF oldcolor = CLR_NONE;
636 COLORREF new;
637 if (lpBand->clrFore != CLR_NONE) {
638 new = (lpBand->clrFore == CLR_DEFAULT) ? infoPtr->clrBtnText :
639 lpBand->clrFore;
640 oldcolor = SetTextColor (hdc, new);
641 }
642
643#ifdef __REACTOS__
644 if (!theme)
645 {
646 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
647 }
648 else
649 {
650 DrawThemeText(theme, hdc, 0, 0, lpBand->lpText, -1, DT_CENTER | DT_VCENTER | DT_SINGLELINE, 0, &lpBand->rcCapText);
651 }
652#else
653 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
655#endif
656
657 if (oldBkMode != TRANSPARENT)
658 SetBkMode (hdc, oldBkMode);
659 if (lpBand->clrFore != CLR_NONE)
660 SetTextColor (hdc, oldcolor);
661 SelectObject (hdc, hOldFont);
662 }
663
664 if (!IsRectEmpty(&lpBand->rcChevron))
665 {
666 if (theme)
667 {
668 int stateId;
669 if (lpBand->fDraw & DRAW_CHEVRONPUSHED)
670 stateId = CHEVS_PRESSED;
671 else if (lpBand->fDraw & DRAW_CHEVRONHOT)
672 stateId = CHEVS_HOT;
673 else
674 stateId = CHEVS_NORMAL;
675 DrawThemeBackground (theme, hdc, RP_CHEVRON, stateId, &lpBand->rcChevron, NULL);
676 }
677 else
678 {
679 if (lpBand->fDraw & DRAW_CHEVRONPUSHED)
680 {
683 }
684 else if (lpBand->fDraw & DRAW_CHEVRONHOT)
685 {
688 }
689 else
691 }
692 }
693
696 nmcd.hdc = hdc;
697 nmcd.rc = rcBand;
698 nmcd.rc.right = lpBand->rcCapText.right;
699 nmcd.rc.bottom = lpBand->rcCapText.bottom;
700 nmcd.dwItemSpec = lpBand->wID;
701 nmcd.uItemState = 0;
702 nmcd.lItemlParam = lpBand->lParam;
703 lpBand->uCDret = REBAR_Notify ((NMHDR *)&nmcd, infoPtr, NM_CUSTOMDRAW);
704 }
705}
706
707
708static VOID
710{
711 REBAR_BAND *lpBand;
712 UINT i;
713
714 if (!infoPtr->DoRedraw) return;
715
716 for (i = 0; i < infoPtr->uNumBands; i++) {
717 lpBand = REBAR_GetBand(infoPtr, i);
718
719 if (HIDDENBAND(lpBand)) continue;
720
721 /* now draw the band */
722 TRACE("[%p] drawing band %i, flags=%08x\n",
723 infoPtr->hwndSelf, i, lpBand->fDraw);
724 REBAR_DrawBand (hdc, infoPtr, lpBand);
725 }
726}
727
728
729static void
730REBAR_CalcHorzBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
731 /* Function: this routine initializes all the rectangles in */
732 /* each band in a row to fit in the adjusted rcBand rect. */
733 /* *** Supports only Horizontal bars. *** */
734{
735 REBAR_BAND *lpBand;
736 UINT i, xoff;
737 RECT work;
738
739 for(i=rstart; i<rend; i++){
740 lpBand = REBAR_GetBand(infoPtr, i);
741 if (HIDDENBAND(lpBand)) {
742 SetRect (&lpBand->rcChild,
743 lpBand->rcBand.right, lpBand->rcBand.top,
744 lpBand->rcBand.right, lpBand->rcBand.bottom);
745 continue;
746 }
747
748 /* set initial gripper rectangle */
749 SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top,
750 lpBand->rcBand.left, lpBand->rcBand.bottom);
751
752 /* calculate gripper rectangle */
753 if ( lpBand->fStatus & HAS_GRIPPER) {
754 lpBand->fDraw |= DRAW_GRIPPER;
756 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;
757 InflateRect(&lpBand->rcGripper, 0, -2);
758
759 SetRect (&lpBand->rcCapImage,
762 }
763 else { /* no gripper will be drawn */
764 xoff = 0;
765 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
766 /* if no gripper but either image or text, then leave space */
767 xoff = REBAR_ALWAYS_SPACE;
768 SetRect (&lpBand->rcCapImage,
769 lpBand->rcBand.left+xoff, lpBand->rcBand.top,
770 lpBand->rcBand.left+xoff, lpBand->rcBand.bottom);
771 }
772
773 /* image is visible */
774 if (lpBand->fStatus & HAS_IMAGE) {
775 lpBand->fDraw |= DRAW_IMAGE;
776 lpBand->rcCapImage.right += infoPtr->imageSize.cx;
777 lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
778
779 /* set initial caption text rectangle */
780 SetRect (&lpBand->rcCapText,
781 lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1,
782 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
783 }
784 else {
785 /* set initial caption text rectangle */
786 SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1,
787 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
788 }
789
790 /* text is visible */
791 if ((lpBand->fStatus & HAS_TEXT) && !(lpBand->fStyle & RBBS_HIDETITLE)) {
792 lpBand->fDraw |= DRAW_TEXT;
793 lpBand->rcCapText.right = max(lpBand->rcCapText.left,
795 }
796
797 /* set initial child window rectangle if there is a child */
798 if (lpBand->hwndChild) {
799
800 lpBand->rcChild.left = lpBand->rcBand.left + lpBand->cxHeader;
801 lpBand->rcChild.right = lpBand->rcBand.right - REBAR_POST_CHILD;
802
803 if (lpBand->cyChild > 0) {
804
805 UINT yoff = (lpBand->rcBand.bottom - lpBand->rcBand.top - lpBand->cyChild) / 2;
806
807 /* center child if height is known */
808 lpBand->rcChild.top = lpBand->rcBand.top + yoff;
809 lpBand->rcChild.bottom = lpBand->rcBand.top + yoff + lpBand->cyChild;
810 }
811 else {
812 lpBand->rcChild.top = lpBand->rcBand.top;
813 lpBand->rcChild.bottom = lpBand->rcBand.bottom;
814 }
815
816 if ((lpBand->fStyle & RBBS_USECHEVRON) && (lpBand->rcChild.right - lpBand->rcChild.left < lpBand->cxIdeal))
817 {
818 lpBand->rcChild.right -= CHEVRON_WIDTH;
819 SetRect(&lpBand->rcChevron, lpBand->rcChild.right,
820 lpBand->rcChild.top, lpBand->rcChild.right + CHEVRON_WIDTH,
821 lpBand->rcChild.bottom);
822 }
823 }
824 else {
825 SetRect (&lpBand->rcChild,
826 lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top,
827 lpBand->rcBand.right, lpBand->rcBand.bottom);
828 }
829
830 /* flag if notify required and invalidate rectangle */
831 if (lpBand->fDraw & NTF_INVALIDATE) {
832 lpBand->fDraw &= ~NTF_INVALIDATE;
833 work = lpBand->rcBand;
834 work.right += SEP_WIDTH;
835 work.bottom += SEP_WIDTH;
836 TRACE("invalidating %s\n", wine_dbgstr_rect(&work));
837 InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
838 if (lpBand->hwndChild) InvalidateRect(lpBand->hwndChild, NULL, TRUE);
839 }
840
841 }
842
843}
844
845
846static VOID
847REBAR_CalcVertBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
848 /* Function: this routine initializes all the rectangles in */
849 /* each band in a row to fit in the adjusted rcBand rect. */
850 /* *** Supports only Vertical bars. *** */
851{
852 REBAR_BAND *lpBand;
853 UINT i, xoff;
854 RECT work;
855
856 for(i=rstart; i<rend; i++){
857 RECT rcBand;
858 lpBand = REBAR_GetBand(infoPtr, i);
859 if (HIDDENBAND(lpBand)) continue;
860
861 translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
862
863 /* set initial gripper rectangle */
864 SetRect (&lpBand->rcGripper, rcBand.left, rcBand.top, rcBand.right, rcBand.top);
865
866 /* calculate gripper rectangle */
867 if (lpBand->fStatus & HAS_GRIPPER) {
868 lpBand->fDraw |= DRAW_GRIPPER;
869
870 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) {
871 /* vertical gripper */
872 lpBand->rcGripper.left += 3;
873 lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;
875 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT;
876
877 /* initialize Caption image rectangle */
878 SetRect (&lpBand->rcCapImage, rcBand.left,
880 rcBand.right,
882 }
883 else {
884 /* horizontal gripper */
885 InflateRect(&lpBand->rcGripper, -2, 0);
887 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_WIDTH;
888
889 /* initialize Caption image rectangle */
890 SetRect (&lpBand->rcCapImage, rcBand.left,
892 rcBand.right,
894 }
895 }
896 else { /* no gripper will be drawn */
897 xoff = 0;
898 if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
899 /* if no gripper but either image or text, then leave space */
900 xoff = REBAR_ALWAYS_SPACE;
901 /* initialize Caption image rectangle */
902 SetRect (&lpBand->rcCapImage,
903 rcBand.left, rcBand.top+xoff,
904 rcBand.right, rcBand.top+xoff);
905 }
906
907 /* image is visible */
908 if (lpBand->fStatus & HAS_IMAGE) {
909 lpBand->fDraw |= DRAW_IMAGE;
910
911 lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
912 lpBand->rcCapImage.bottom += infoPtr->imageSize.cy;
913
914 /* set initial caption text rectangle */
915 SetRect (&lpBand->rcCapText,
916 rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE,
917 rcBand.right, rcBand.top+lpBand->cxHeader);
918 }
919 else {
920 /* set initial caption text rectangle */
921 SetRect (&lpBand->rcCapText,
922 rcBand.left, lpBand->rcCapImage.bottom,
923 rcBand.right, rcBand.top+lpBand->cxHeader);
924 }
925
926 /* text is visible */
927 if ((lpBand->fStatus & HAS_TEXT) && !(lpBand->fStyle & RBBS_HIDETITLE)) {
928 lpBand->fDraw |= DRAW_TEXT;
929 lpBand->rcCapText.bottom = max(lpBand->rcCapText.top,
930 lpBand->rcCapText.bottom);
931 }
932
933 /* set initial child window rectangle if there is a child */
934 if (lpBand->hwndChild) {
935 int cxBand = rcBand.right - rcBand.left;
936 xoff = (cxBand - lpBand->cyChild) / 2;
937 SetRect (&lpBand->rcChild,
938 rcBand.left + xoff, rcBand.top + lpBand->cxHeader,
939 rcBand.left + xoff + lpBand->cyChild, rcBand.bottom - REBAR_POST_CHILD);
940 }
941 else {
942 SetRect (&lpBand->rcChild,
943 rcBand.left, rcBand.top+lpBand->cxHeader,
944 rcBand.right, rcBand.bottom);
945 }
946
947 if (lpBand->fDraw & NTF_INVALIDATE) {
948 lpBand->fDraw &= ~NTF_INVALIDATE;
949 work = rcBand;
950 work.bottom += SEP_WIDTH;
951 work.right += SEP_WIDTH;
952 TRACE("invalidating %s\n", wine_dbgstr_rect(&work));
953 InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
954 if (lpBand->hwndChild) InvalidateRect(lpBand->hwndChild, NULL, TRUE);
955 }
956
957 }
958}
959
960
961static VOID
963 /* Function: This changes the size of the REBAR window to that */
964 /* calculated by REBAR_Layout. */
965{
966 INT x, y, width, height;
967 INT xedge = 0, yedge = 0;
968 RECT rcSelf;
969
970 TRACE("new size [%d x %d]\n", infoPtr->calcSize.cx, infoPtr->calcSize.cy);
971
972 if (infoPtr->dwStyle & CCS_NORESIZE)
973 return;
974
975 if (infoPtr->dwStyle & WS_BORDER)
976 {
979 /* swap for CCS_VERT? */
980 }
981
982 /* compute rebar window rect in parent client coordinates */
983 GetWindowRect(infoPtr->hwndSelf, &rcSelf);
984 MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->hwndSelf), (LPPOINT)&rcSelf, 2);
985 translate_rect(infoPtr, &rcSelf, &rcSelf);
986
987 height = infoPtr->calcSize.cy + 2*yedge;
988 if (!(infoPtr->dwStyle & CCS_NOPARENTALIGN)) {
989 RECT rcParent;
990
991 x = -xedge;
992 width = infoPtr->calcSize.cx + 2*xedge;
993 y = 0; /* quiet compiler warning */
994 switch ( infoPtr->dwStyle & CCS_LAYOUT_MASK) {
995 case 0: /* shouldn't happen - see NCCreate */
996 case CCS_TOP:
997 y = ((infoPtr->dwStyle & CCS_NODIVIDER) ? 0 : REBAR_DIVIDER) - yedge;
998 break;
999 case CCS_NOMOVEY:
1000 y = rcSelf.top;
1001 break;
1002 case CCS_BOTTOM:
1003 GetClientRect(GetParent(infoPtr->hwndSelf), &rcParent);
1004 translate_rect(infoPtr, &rcParent, &rcParent);
1005 y = rcParent.bottom - infoPtr->calcSize.cy - yedge;
1006 break;
1007 }
1008 }
1009 else {
1010 x = rcSelf.left;
1011 /* As on Windows if the CCS_NODIVIDER is not present the control will move
1012 * 2 pixel down after every layout */
1013 y = rcSelf.top + ((infoPtr->dwStyle & CCS_NODIVIDER) ? 0 : REBAR_DIVIDER);
1014 width = rcSelf.right - rcSelf.left;
1015 }
1016
1017 TRACE("hwnd %p, style=%08x, setting at (%d,%d) for (%d,%d)\n",
1018 infoPtr->hwndSelf, infoPtr->dwStyle, x, y, width, height);
1019
1020 /* Set flag to ignore next WM_SIZE message and resize the window */
1021 infoPtr->fStatus |= SELF_RESIZE;
1022 if ((infoPtr->dwStyle & CCS_VERT) == 0)
1023 SetWindowPos(infoPtr->hwndSelf, 0, x, y, width, height, SWP_NOZORDER);
1024 else
1025 SetWindowPos(infoPtr->hwndSelf, 0, y, x, height, width, SWP_NOZORDER);
1026 infoPtr->fStatus &= ~SELF_RESIZE;
1027}
1028
1029
1030static VOID
1032{
1033 static const WCHAR strComboBox[] = { 'C','o','m','b','o','B','o','x',0 };
1034 REBAR_BAND *lpBand;
1035 WCHAR szClassName[40];
1036 UINT i;
1037 NMREBARCHILDSIZE rbcz;
1038 HDWP deferpos;
1039
1040 if (!(deferpos = BeginDeferWindowPos(infoPtr->uNumBands)))
1041 ERR("BeginDeferWindowPos returned NULL\n");
1042
1043 for (i = start; i < endplus; i++) {
1044 lpBand = REBAR_GetBand(infoPtr, i);
1045
1046 if (HIDDENBAND(lpBand)) continue;
1047 if (lpBand->hwndChild) {
1048 TRACE("hwndChild = %p\n", lpBand->hwndChild);
1049
1050 /* Always generate the RBN_CHILDSIZE even if child
1051 did not change */
1052 rbcz.uBand = i;
1053 rbcz.wID = lpBand->wID;
1054 rbcz.rcChild = lpBand->rcChild;
1055 translate_rect(infoPtr, &rbcz.rcBand, &lpBand->rcBand);
1056 if (infoPtr->dwStyle & CCS_VERT)
1057 rbcz.rcBand.top += lpBand->cxHeader;
1058 else
1059 rbcz.rcBand.left += lpBand->cxHeader;
1060 REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE);
1061 if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) {
1062 TRACE("Child rect changed by NOTIFY for band %u\n", i);
1063 TRACE(" from (%s) to (%s)\n",
1064 wine_dbgstr_rect(&lpBand->rcChild),
1065 wine_dbgstr_rect(&rbcz.rcChild));
1066 lpBand->rcChild = rbcz.rcChild; /* *** ??? */
1067 }
1068
1070 if (!lstrcmpW (szClassName, strComboBox) ||
1072 INT nEditHeight, yPos;
1073 RECT rc;
1074
1075 /* special placement code for combo or comboex box */
1076
1077
1078 /* get size of edit line */
1079 GetWindowRect (lpBand->hwndChild, &rc);
1080 nEditHeight = rc.bottom - rc.top;
1081 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
1082
1083 /* center combo box inside child area */
1084 TRACE("moving child (Combo(Ex)) %p to (%d,%d) for (%d,%d)\n",
1085 lpBand->hwndChild,
1086 lpBand->rcChild.left, yPos,
1087 lpBand->rcChild.right - lpBand->rcChild.left,
1088 nEditHeight);
1089 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,
1090 lpBand->rcChild.left,
1091 /*lpBand->rcChild.top*/ yPos,
1092 lpBand->rcChild.right - lpBand->rcChild.left,
1093 nEditHeight,
1094 SWP_NOZORDER);
1095 if (!deferpos)
1096 ERR("DeferWindowPos returned NULL\n");
1097 }
1098 else {
1099 TRACE("moving child (Other) %p to (%d,%d) for (%d,%d)\n",
1100 lpBand->hwndChild,
1101 lpBand->rcChild.left, lpBand->rcChild.top,
1102 lpBand->rcChild.right - lpBand->rcChild.left,
1103 lpBand->rcChild.bottom - lpBand->rcChild.top);
1104 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,
1105 lpBand->rcChild.left,
1106 lpBand->rcChild.top,
1107 lpBand->rcChild.right - lpBand->rcChild.left,
1108 lpBand->rcChild.bottom - lpBand->rcChild.top,
1109 SWP_NOZORDER);
1110 if (!deferpos)
1111 ERR("DeferWindowPos returned NULL\n");
1112 }
1113 }
1114 }
1115 if (!EndDeferWindowPos(deferpos))
1116 ERR("EndDeferWindowPos returned NULL\n");
1117
1118 if (infoPtr->DoRedraw)
1119 UpdateWindow (infoPtr->hwndSelf);
1120}
1121
1122/* Returns the next visible band (the first visible band in [i+1; infoPtr->uNumBands) )
1123 * or infoPtr->uNumBands if none */
1124static int next_visible(const REBAR_INFO *infoPtr, int i)
1125{
1126 unsigned int n;
1127 for (n = i + 1; n < infoPtr->uNumBands; n++)
1128 if (!HIDDENBAND(REBAR_GetBand(infoPtr, n)))
1129 break;
1130 return n;
1131}
1132
1133/* Returns the previous visible band (the last visible band in [0; i) )
1134 * or -1 if none */
1135static int prev_visible(const REBAR_INFO *infoPtr, int i)
1136{
1137 int n;
1138 for (n = i - 1; n >= 0; n--)
1139 if (!HIDDENBAND(REBAR_GetBand(infoPtr, n)))
1140 break;
1141 return n;
1142}
1143
1144/* Returns the first visible band or infoPtr->uNumBands if none */
1145static int first_visible(const REBAR_INFO *infoPtr)
1146{
1147 return next_visible(infoPtr, -1); /* this works*/
1148}
1149
1150/* Returns the first visible band for the given row (or iBand if none) */
1151static int get_row_begin_for_band(const REBAR_INFO *infoPtr, INT iBand)
1152{
1153 int iLastBand = iBand;
1154 int iRow = REBAR_GetBand(infoPtr, iBand)->iRow;
1155 while ((iBand = prev_visible(infoPtr, iBand)) >= 0) {
1156 if (REBAR_GetBand(infoPtr, iBand)->iRow != iRow)
1157 break;
1158 else
1159 iLastBand = iBand;
1160 }
1161 return iLastBand;
1162}
1163
1164/* Returns the first visible band for the next row (or infoPtr->uNumBands if none) */
1165static int get_row_end_for_band(const REBAR_INFO *infoPtr, INT iBand)
1166{
1167 int iRow = REBAR_GetBand(infoPtr, iBand)->iRow;
1168 while ((iBand = next_visible(infoPtr, iBand)) < infoPtr->uNumBands)
1169 if (REBAR_GetBand(infoPtr, iBand)->iRow != iRow)
1170 break;
1171 return iBand;
1172}
1173
1174/* Compute the rcBand.{left,right} from the cxEffective bands widths computed earlier.
1175 * iBeginBand must be visible */
1176static void REBAR_SetRowRectsX(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
1177{
1178 int xPos = 0, i;
1179 for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
1180 {
1181 REBAR_BAND *lpBand = REBAR_GetBand(infoPtr, i);
1182 if (lpBand->rcBand.left != xPos || lpBand->rcBand.right != xPos + lpBand->cxEffective) {
1183 lpBand->fDraw |= NTF_INVALIDATE;
1184 TRACE("Setting rect %d to %d,%d\n", i, xPos, xPos + lpBand->cxEffective);
1185 lpBand->rcBand.left = xPos;
1186 lpBand->rcBand.right = xPos + lpBand->cxEffective;
1187 }
1188 xPos += lpBand->cxEffective + SEP_WIDTH;
1189 }
1190}
1191
1192/* The rationale of this function is probably as follows: if we have some space
1193 * to distribute we want to add it to a band on the right. However we don't want
1194 * to unminimize a minimized band so we search for a band that is big enough.
1195 * For some reason "big enough" is defined as bigger than the minimum size of the
1196 * first band in the row
1197 */
1198static REBAR_BAND *REBAR_FindBandToGrow(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
1199{
1200 INT cxMinFirstBand = 0, i;
1201
1202 cxMinFirstBand = REBAR_GetBand(infoPtr, iBeginBand)->cxMinBand;
1203
1204 for (i = prev_visible(infoPtr, iEndBand); i >= iBeginBand; i = prev_visible(infoPtr, i))
1205 if (REBAR_GetBand(infoPtr, i)->cxEffective > cxMinFirstBand &&
1206 !(REBAR_GetBand(infoPtr, i)->fStyle & RBBS_FIXEDSIZE))
1207 break;
1208
1209 if (i < iBeginBand)
1210 for (i = prev_visible(infoPtr, iEndBand); i >= iBeginBand; i = prev_visible(infoPtr, i))
1211 if (REBAR_GetBand(infoPtr, i)->cxMinBand == cxMinFirstBand)
1212 break;
1213
1214 TRACE("Extra space for row [%d..%d) should be added to band %d\n", iBeginBand, iEndBand, i);
1215 return REBAR_GetBand(infoPtr, i);
1216}
1217
1218/* Try to shrink the visible bands in [iBeginBand; iEndBand) by cxShrink, starting from the right */
1219static int REBAR_ShrinkBandsRTL(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
1220{
1221 REBAR_BAND *lpBand;
1222 INT width, i;
1223
1224 TRACE("Shrinking bands [%d..%d) by %d, right-to-left\n", iBeginBand, iEndBand, cxShrink);
1225 for (i = prev_visible(infoPtr, iEndBand); i >= iBeginBand; i = prev_visible(infoPtr, i))
1226 {
1227 lpBand = REBAR_GetBand(infoPtr, i);
1228
1229 width = max(lpBand->cxEffective - cxShrink, (int)lpBand->cxMinBand);
1230 cxShrink -= lpBand->cxEffective - width;
1231 lpBand->cxEffective = width;
1232 if (bEnforce && lpBand->cx > lpBand->cxEffective)
1233 lpBand->cx = lpBand->cxEffective;
1234 if (cxShrink == 0)
1235 break;
1236 }
1237 return cxShrink;
1238}
1239
1240
1241/* Try to shrink the visible bands in [iBeginBand; iEndBand) by cxShrink, starting from the left.
1242 * iBeginBand must be visible */
1243static int REBAR_ShrinkBandsLTR(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
1244{
1245 REBAR_BAND *lpBand;
1246 INT width, i;
1247
1248 TRACE("Shrinking bands [%d..%d) by %d, left-to-right\n", iBeginBand, iEndBand, cxShrink);
1249 for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
1250 {
1251 lpBand = REBAR_GetBand(infoPtr, i);
1252
1253 width = max(lpBand->cxEffective - cxShrink, (int)lpBand->cxMinBand);
1254 cxShrink -= lpBand->cxEffective - width;
1255 lpBand->cxEffective = width;
1256 if (bEnforce)
1257 lpBand->cx = lpBand->cxEffective;
1258 if (cxShrink == 0)
1259 break;
1260 }
1261 return cxShrink;
1262}
1263
1264/* Tries to move a band to a given offset within a row. */
1265static int REBAR_MoveBandToRowOffset(REBAR_INFO *infoPtr, INT iBand, INT iFirstBand,
1266 INT iLastBand, INT xOff, BOOL reorder)
1267{
1268 REBAR_BAND *insertBand = REBAR_GetBand(infoPtr, iBand);
1269 int xPos = 0, i;
1270 const BOOL setBreak = REBAR_GetBand(infoPtr, iFirstBand)->fStyle & RBBS_BREAK;
1271
1272 /* Find the band's new position */
1273 if(reorder)
1274 {
1275 /* Used during an LR band reorder drag */
1276 for (i = iFirstBand; i < iLastBand; i = next_visible(infoPtr, i))
1277 {
1278 if(xPos > xOff)
1279 break;
1280 xPos += REBAR_GetBand(infoPtr, i)->cxEffective + SEP_WIDTH;
1281 }
1282 }
1283 else
1284 {
1285 /* Used during a UD band insertion drag */
1286 for (i = iFirstBand; i < iLastBand; i = next_visible(infoPtr, i))
1287 {
1288 const REBAR_BAND *band = REBAR_GetBand(infoPtr, i);
1289 if(xPos + band->cxMinBand / 2 > xOff)
1290 break;
1291 xPos += band->cxEffective + SEP_WIDTH;
1292 }
1293 }
1294
1295 /* Move the band to its new position */
1296 DPA_DeletePtr(infoPtr->bands, iBand);
1297 if(i > iBand)
1298 i--;
1299 DPA_InsertPtr(infoPtr->bands, i, insertBand);
1300
1301 /* Ensure only the last band has the RBBS_BREAK flag set */
1302 insertBand->fStyle &= ~RBBS_BREAK;
1303 if(setBreak)
1304 REBAR_GetBand(infoPtr, iFirstBand)->fStyle |= RBBS_BREAK;
1305
1306 /* Return the currently grabbed band */
1307 if(infoPtr->iGrabbedBand == iBand)
1308 {
1309 infoPtr->iGrabbedBand = i;
1310 return i;
1311 }
1312 else return -1;
1313}
1314
1315/* Set the heights of the visible bands in [iBeginBand; iEndBand) to the max height. iBeginBand must be visible */
1316static int REBAR_SetBandsHeight(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT yStart)
1317{
1318 REBAR_BAND *lpBand;
1319 int yMaxHeight = 0;
1320 int yPos = yStart;
1321 int row, i;
1322
1323 for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
1324 {
1325 lpBand = REBAR_GetBand(infoPtr, i);
1326 lpBand->cyRowSoFar = yMaxHeight;
1327 yMaxHeight = max(yMaxHeight, lpBand->cyMinBand);
1328 }
1329 TRACE("Bands [%d; %d) height: %d\n", iBeginBand, iEndBand, yMaxHeight);
1330
1331 row = iBeginBand < iEndBand ? REBAR_GetBand(infoPtr, iBeginBand)->iRow : 0;
1332
1333 for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
1334 {
1335 lpBand = REBAR_GetBand(infoPtr, i);
1336 /* we may be called for multiple rows if RBS_VARHEIGHT not set */
1337 if (lpBand->iRow != row) {
1338 yPos += yMaxHeight + SEP_WIDTH;
1339 row = lpBand->iRow;
1340 }
1341
1342 if (lpBand->rcBand.top != yPos || lpBand->rcBand.bottom != yPos + yMaxHeight) {
1343 lpBand->fDraw |= NTF_INVALIDATE;
1344 lpBand->rcBand.top = yPos;
1345 lpBand->rcBand.bottom = yPos + yMaxHeight;
1346 TRACE("Band %d: %s\n", i, wine_dbgstr_rect(&lpBand->rcBand));
1347 }
1348 }
1349 return yPos + yMaxHeight;
1350}
1351
1352/* Layout the row [iBeginBand; iEndBand). iBeginBand must be visible */
1353static void REBAR_LayoutRow(const REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, int cx, int *piRow, int *pyPos)
1354{
1355 REBAR_BAND *lpBand;
1356 int i, extra;
1357 int width = 0;
1358
1359 TRACE("Adjusting row [%d;%d). Width: %d\n", iBeginBand, iEndBand, cx);
1360 for (i = iBeginBand; i < iEndBand; i++)
1361 REBAR_GetBand(infoPtr, i)->iRow = *piRow;
1362
1363 /* compute the extra space */
1364 for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
1365 {
1366 lpBand = REBAR_GetBand(infoPtr, i);
1367 if (i > iBeginBand)
1368 width += SEP_WIDTH;
1369 lpBand->cxEffective = max(lpBand->cxMinBand, lpBand->cx);
1370 width += lpBand->cxEffective;
1371 }
1372
1373 extra = cx - width;
1374 TRACE("Extra space: %d\n", extra);
1375 if (extra < 0) {
1376 int ret = REBAR_ShrinkBandsRTL(infoPtr, iBeginBand, iEndBand, -extra, FALSE);
1377 if (ret > 0 && next_visible(infoPtr, iBeginBand) != iEndBand) /* one band may be longer than expected... */
1378 ERR("Error layouting row %d - couldn't shrink for %d pixels (%d total shrink)\n", *piRow, ret, -extra);
1379 } else
1380 if (extra > 0) {
1381 lpBand = REBAR_FindBandToGrow(infoPtr, iBeginBand, iEndBand);
1382 lpBand->cxEffective += extra;
1383 }
1384
1385 REBAR_SetRowRectsX(infoPtr, iBeginBand, iEndBand);
1386 if (infoPtr->dwStyle & RBS_VARHEIGHT)
1387 {
1388 if (*piRow > 0)
1389 *pyPos += SEP_WIDTH;
1390 *pyPos = REBAR_SetBandsHeight(infoPtr, iBeginBand, iEndBand, *pyPos);
1391 }
1392 (*piRow)++;
1393}
1394
1395static VOID
1397{
1398 REBAR_BAND *lpBand;
1399 RECT rcAdj;
1400 SIZE oldSize;
1401 INT adjcx, i;
1402 INT rowstart;
1403 INT row = 0;
1404 INT xMin, yPos;
1405
1406 if (infoPtr->dwStyle & (CCS_NORESIZE | CCS_NOPARENTALIGN) || GetParent(infoPtr->hwndSelf) == NULL)
1407 GetClientRect(infoPtr->hwndSelf, &rcAdj);
1408 else
1409 GetClientRect(GetParent(infoPtr->hwndSelf), &rcAdj);
1410 TRACE("adjustment rect is (%s)\n", wine_dbgstr_rect(&rcAdj));
1411
1412 adjcx = get_rect_cx(infoPtr, &rcAdj);
1413
1414 if (infoPtr->uNumBands == 0) {
1415 TRACE("No bands - setting size to (0,%d), style: %x\n", adjcx, infoPtr->dwStyle);
1416 infoPtr->calcSize.cx = adjcx;
1417 /* the calcSize.cy won't change for a 0 band rebar */
1418 infoPtr->uNumRows = 0;
1419 REBAR_ForceResize(infoPtr);
1420 return;
1421 }
1422
1423 yPos = 0;
1424 xMin = 0;
1425 rowstart = first_visible(infoPtr);
1426 /* divide rows */
1427 for (i = rowstart; i < infoPtr->uNumBands; i = next_visible(infoPtr, i))
1428 {
1429 lpBand = REBAR_GetBand(infoPtr, i);
1430
1431 if (i > rowstart && (lpBand->fStyle & RBBS_BREAK || xMin + lpBand->cxMinBand > adjcx)) {
1432 TRACE("%s break on band %d\n", (lpBand->fStyle & RBBS_BREAK ? "Hard" : "Soft"), i - 1);
1433 REBAR_LayoutRow(infoPtr, rowstart, i, adjcx, &row, &yPos);
1434 rowstart = i;
1435 xMin = 0;
1436 }
1437 else
1438 xMin += SEP_WIDTH;
1439
1440 xMin += lpBand->cxMinBand;
1441 }
1442 if (rowstart < infoPtr->uNumBands)
1443 REBAR_LayoutRow(infoPtr, rowstart, infoPtr->uNumBands, adjcx, &row, &yPos);
1444
1445 if (!(infoPtr->dwStyle & RBS_VARHEIGHT))
1446 yPos = REBAR_SetBandsHeight(infoPtr, first_visible(infoPtr), infoPtr->uNumBands, 0);
1447
1448 infoPtr->uNumRows = row;
1449
1450 if (infoPtr->dwStyle & CCS_VERT)
1451 REBAR_CalcVertBand(infoPtr, 0, infoPtr->uNumBands);
1452 else
1453 REBAR_CalcHorzBand(infoPtr, 0, infoPtr->uNumBands);
1454 /* now compute size of Rebar itself */
1455 oldSize = infoPtr->calcSize;
1456
1457 infoPtr->calcSize.cx = adjcx;
1458 infoPtr->calcSize.cy = yPos;
1459 TRACE("calcsize size=(%d, %d), origheight=(%d,%d)\n",
1460 infoPtr->calcSize.cx, infoPtr->calcSize.cy,
1461 oldSize.cx, oldSize.cy);
1462
1463 REBAR_DumpBand (infoPtr);
1464 REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands);
1465 REBAR_ForceResize (infoPtr);
1466
1467 /* note: after a RBN_HEIGHTCHANGE native sends once again all the RBN_CHILDSIZE
1468 * and does another ForceResize */
1469 if (oldSize.cy != infoPtr->calcSize.cy)
1470 {
1471 NMHDR heightchange;
1472 REBAR_Notify(&heightchange, infoPtr, RBN_HEIGHTCHANGE);
1473 REBAR_AutoSize(infoPtr, FALSE);
1474 }
1475}
1476
1477/* iBeginBand must be visible */
1478static int
1479REBAR_SizeChildrenToHeight(const REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, int extra, BOOL *fChanged)
1480{
1481 int cyBandsOld;
1482 int cyBandsNew = 0;
1483 int i;
1484
1485 TRACE("[%d;%d) by %d\n", iBeginBand, iEndBand, extra);
1486
1487 cyBandsOld = REBAR_GetBand(infoPtr, iBeginBand)->rcBand.bottom -
1488 REBAR_GetBand(infoPtr, iBeginBand)->rcBand.top;
1489 for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
1490 {
1491 REBAR_BAND *lpBand = REBAR_GetBand(infoPtr, i);
1492 int cyMaxChild = cyBandsOld - REBARSPACE(lpBand) + extra;
1493 int cyChild = round_child_height(lpBand, cyMaxChild);
1494
1495 if (lpBand->hwndChild && cyChild != lpBand->cyChild && (lpBand->fStyle & RBBS_VARIABLEHEIGHT))
1496 {
1497 TRACE("Resizing %d: %d -> %d [%d]\n", i, lpBand->cyChild, cyChild, lpBand->cyMaxChild);
1498 *fChanged = TRUE;
1499 lpBand->cyChild = cyChild;
1500 lpBand->fDraw |= NTF_INVALIDATE;
1501 update_min_band_height(infoPtr, lpBand);
1502 }
1503 cyBandsNew = max(cyBandsNew, lpBand->cyMinBand);
1504 }
1505 return cyBandsNew - cyBandsOld;
1506}
1507
1508/* worker function for RB_SIZETORECT and RBS_AUTOSIZE */
1509static VOID
1511{
1512 int extra = height - infoPtr->calcSize.cy; /* may be negative */
1513 BOOL fChanged = FALSE;
1514 UINT uNumRows = infoPtr->uNumRows;
1515 int i;
1516
1517 if (uNumRows == 0) /* avoid division by 0 */
1518 return;
1519
1520 /* That's not exactly what Windows does but should be similar */
1521
1522 /* Pass one: break-up/glue rows */
1523 if (extra > 0)
1524 {
1525 for (i = prev_visible(infoPtr, infoPtr->uNumBands); i > 0; i = prev_visible(infoPtr, i))
1526 {
1527 REBAR_BAND *lpBand = REBAR_GetBand(infoPtr, i);
1528 int cyBreakExtra; /* additional cy for the rebar after a RBBS_BREAK on this band */
1529
1530 height = lpBand->rcBand.bottom - lpBand->rcBand.top;
1531
1532 if (infoPtr->dwStyle & RBS_VARHEIGHT)
1533 cyBreakExtra = lpBand->cyRowSoFar; /* 'height' => 'lpBand->cyRowSoFar' + 'height'*/
1534 else
1535 cyBreakExtra = height; /* 'height' => 'height' + 'height'*/
1536 cyBreakExtra += SEP_WIDTH;
1537
1538 if (extra <= cyBreakExtra / 2)
1539 break;
1540
1541 if (!(lpBand->fStyle & RBBS_BREAK))
1542 {
1543 TRACE("Adding break on band %d - extra %d -> %d\n", i, extra, extra - cyBreakExtra);
1544 lpBand->fStyle |= RBBS_BREAK;
1545 lpBand->fDraw |= NTF_INVALIDATE;
1546 fChanged = TRUE;
1547 extra -= cyBreakExtra;
1548 uNumRows++;
1549 /* temporary change for _SizeControlsToHeight. The true values will be computed in _Layout */
1550 if (infoPtr->dwStyle & RBS_VARHEIGHT)
1551 lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->cyMinBand;
1552 }
1553 }
1554 }
1555 /* TODO: else if (extra < 0) { try to remove some RBBS_BREAKs } */
1556
1557 /* Pass two: increase/decrease control height */
1558 if (infoPtr->dwStyle & RBS_VARHEIGHT)
1559 {
1560 int i = first_visible(infoPtr);
1561 int iRow = 0;
1562 while (i < infoPtr->uNumBands)
1563 {
1564 REBAR_BAND *lpBand = REBAR_GetBand(infoPtr, i);
1565 int extraForRow = extra / (int)(uNumRows - iRow);
1566 int rowEnd;
1567
1568 /* we can't use get_row_end_for_band as we might have added RBBS_BREAK in the first phase */
1569 for (rowEnd = next_visible(infoPtr, i); rowEnd < infoPtr->uNumBands; rowEnd = next_visible(infoPtr, rowEnd))
1570 if (REBAR_GetBand(infoPtr, rowEnd)->iRow != lpBand->iRow ||
1571 REBAR_GetBand(infoPtr, rowEnd)->fStyle & RBBS_BREAK)
1572 break;
1573
1574 extra -= REBAR_SizeChildrenToHeight(infoPtr, i, rowEnd, extraForRow, &fChanged);
1575 TRACE("extra = %d\n", extra);
1576 i = rowEnd;
1577 iRow++;
1578 }
1579 }
1580 else
1581 REBAR_SizeChildrenToHeight(infoPtr, first_visible(infoPtr), infoPtr->uNumBands, extra / infoPtr->uNumRows, &fChanged);
1582
1583 if (fChanged)
1584 REBAR_Layout(infoPtr);
1585}
1586
1587static VOID
1588REBAR_AutoSize(REBAR_INFO *infoPtr, BOOL needsLayout)
1589{
1590 RECT rc, rcNew;
1591 NMRBAUTOSIZE autosize;
1592
1593 if (needsLayout)
1594 REBAR_Layout(infoPtr);
1595 GetClientRect(infoPtr->hwndSelf, &rc);
1596 REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, &rc));
1597 GetClientRect(infoPtr->hwndSelf, &rcNew);
1598
1599 GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget);
1600 autosize.fChanged = EqualRect(&rc, &rcNew);
1601 autosize.rcTarget = rc;
1602 autosize.rcActual = rcNew;
1603 REBAR_Notify((NMHDR *)&autosize, infoPtr, RBN_AUTOSIZE);
1604}
1605
1606static VOID
1608 /* Function: This routine evaluates the band specs supplied */
1609 /* by the user and updates the following 5 fields in */
1610 /* the internal band structure: cxHeader, cyHeader, cxMinBand, cyMinBand, fStatus */
1611{
1612 UINT header=0;
1613 UINT textheight=0, imageheight = 0;
1614 UINT i, nonfixed;
1615 REBAR_BAND *tBand;
1616
1617 lpBand->fStatus = 0;
1618 lpBand->cxMinBand = 0;
1619 lpBand->cyMinBand = 0;
1620
1621 /* Data coming in from users into the cx... and cy... fields */
1622 /* may be bad, just garbage, because the user never clears */
1623 /* the fields. RB_{SET|INSERT}BAND{A|W} just passes the data */
1624 /* along if the fields exist in the input area. Here we must */
1625 /* determine if the data is valid. I have no idea how MS does */
1626 /* the validation, but it does because the RB_GETBANDINFO */
1627 /* returns a 0 when I know the sample program passed in an */
1628 /* address. Here I will use the algorithm that if the value */
1629 /* is greater than 65535 then it is bad and replace it with */
1630 /* a zero. Feel free to improve the algorithm. - GA 12/2000 */
1631 if (lpBand->cxMinChild > 65535) lpBand->cxMinChild = 0;
1632 if (lpBand->cyMinChild > 65535) lpBand->cyMinChild = 0;
1633 if (lpBand->cx > 65535) lpBand->cx = 0;
1634 if (lpBand->cyChild > 65535) lpBand->cyChild = 0;
1635 if (lpBand->cyIntegral > 65535) lpBand->cyIntegral = 0;
1636 if (lpBand->cxIdeal > 65535) lpBand->cxIdeal = 0;
1637 if (lpBand->cxHeader > 65535) lpBand->cxHeader = 0;
1638
1639 /* TODO : we could try return to the caller if a value changed so that */
1640 /* a REBAR_Layout is needed. Till now the caller should call it */
1641 /* it always (we should also check what native does) */
1642
1643 /* Header is where the image, text and gripper exist */
1644 /* in the band and precede the child window. */
1645
1646 /* count number of non-FIXEDSIZE and non-Hidden bands */
1647 nonfixed = 0;
1648 for (i=0; i<infoPtr->uNumBands; i++){
1649 tBand = REBAR_GetBand(infoPtr, i);
1650 if (!HIDDENBAND(tBand) && !(tBand->fStyle & RBBS_FIXEDSIZE))
1651 nonfixed++;
1652 }
1653
1654 /* calculate gripper rectangle */
1655 if ( (!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
1656 ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
1657 ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (nonfixed > 1)))
1658 ) {
1659 lpBand->fStatus |= HAS_GRIPPER;
1660 if (infoPtr->dwStyle & CCS_VERT)
1661 if (infoPtr->dwStyle & RBS_VERTICALGRIPPER)
1663 else
1665 else
1667 /* Always have 4 pixels before anything else */
1669 }
1670
1671 /* image is visible */
1672 if (lpBand->iImage != -1 && (infoPtr->himl)) {
1673 lpBand->fStatus |= HAS_IMAGE;
1674 if (infoPtr->dwStyle & CCS_VERT) {
1675 header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE);
1676 imageheight = infoPtr->imageSize.cx + 4;
1677 }
1678 else {
1679 header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE);
1680 imageheight = infoPtr->imageSize.cy + 4;
1681 }
1682 }
1683
1684 /* text is visible */
1685 if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText) &&
1686 !(lpBand->fStyle & RBBS_HIDETITLE)) {
1687 HDC hdc = GetDC (0);
1688 HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
1689 SIZE size;
1690
1691 lpBand->fStatus |= HAS_TEXT;
1693 lstrlenW (lpBand->lpText), &size);
1694 header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT));
1695 textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy;
1696
1697 SelectObject (hdc, hOldFont);
1698 ReleaseDC (0, hdc);
1699 }
1700
1701 /* if no gripper but either image or text, then leave space */
1702 if ((lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) &&
1703 !(lpBand->fStatus & HAS_GRIPPER)) {
1705 }
1706
1707 /* check if user overrode the header value */
1708 if (!(lpBand->fStyle & RBBS_UNDOC_FIXEDHEADER))
1709 lpBand->cxHeader = header;
1710 lpBand->cyHeader = max(textheight, imageheight);
1711
1712 /* Now compute minimum size of child window */
1713 update_min_band_height(infoPtr, lpBand); /* update lpBand->cyMinBand from cyHeader and cyChild*/
1714
1715 lpBand->cxMinBand = lpBand->cxMinChild + lpBand->cxHeader + REBAR_POST_CHILD;
1716 if (lpBand->fStyle & RBBS_USECHEVRON && lpBand->cxMinChild < lpBand->cxIdeal)
1717 lpBand->cxMinBand += CHEVRON_WIDTH;
1718}
1719
1720static UINT
1722 /* Function: This routine copies the supplied values from */
1723 /* user input (lprbbi) to the internal band structure. */
1724 /* It returns the mask of what changed. */
1725{
1726 UINT uChanged = 0x0;
1727
1728 lpBand->fMask |= lprbbi->fMask;
1729
1730 if( (lprbbi->fMask & RBBIM_STYLE) &&
1731 (lpBand->fStyle != lprbbi->fStyle ) )
1732 {
1733 lpBand->fStyle = lprbbi->fStyle;
1734 uChanged |= RBBIM_STYLE;
1735 }
1736
1737 if( (lprbbi->fMask & RBBIM_COLORS) &&
1738 ( ( lpBand->clrFore != lprbbi->clrFore ) ||
1739 ( lpBand->clrBack != lprbbi->clrBack ) ) )
1740 {
1741 lpBand->clrFore = lprbbi->clrFore;
1742 lpBand->clrBack = lprbbi->clrBack;
1743 uChanged |= RBBIM_COLORS;
1744 }
1745
1746 if( (lprbbi->fMask & RBBIM_IMAGE) &&
1747 ( lpBand->iImage != lprbbi->iImage ) )
1748 {
1749 lpBand->iImage = lprbbi->iImage;
1750 uChanged |= RBBIM_IMAGE;
1751 }
1752
1753 if( (lprbbi->fMask & RBBIM_CHILD) &&
1754 (lprbbi->hwndChild != lpBand->hwndChild ) )
1755 {
1756 if (lprbbi->hwndChild) {
1757 lpBand->hwndChild = lprbbi->hwndChild;
1758 lpBand->hwndPrevParent =
1759 SetParent (lpBand->hwndChild, hwnd);
1760 /* below in trace from WinRAR */
1762 /* above in trace from WinRAR */
1763 }
1764 else {
1765 TRACE("child: %p prev parent: %p\n",
1766 lpBand->hwndChild, lpBand->hwndPrevParent);
1767 lpBand->hwndChild = 0;
1768 lpBand->hwndPrevParent = 0;
1769 }
1770 uChanged |= RBBIM_CHILD;
1771 }
1772
1773 if( (lprbbi->fMask & RBBIM_CHILDSIZE) &&
1774 ( (lpBand->cxMinChild != lprbbi->cxMinChild) ||
1775 (lpBand->cyMinChild != lprbbi->cyMinChild ) ||
1776 ( (lprbbi->cbSize >= REBARBANDINFOA_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) &&
1777 ( (lpBand->cyChild != lprbbi->cyChild ) ||
1778 (lpBand->cyMaxChild != lprbbi->cyMaxChild ) ||
1779 (lpBand->cyIntegral != lprbbi->cyIntegral ) ) ) ||
1780 ( (lprbbi->cbSize < REBARBANDINFOA_V6_SIZE) &&
1781 ( (lpBand->cyChild ||
1782 lpBand->cyMaxChild ||
1783 lpBand->cyIntegral ) ) ) ) )
1784 {
1785 lpBand->cxMinChild = lprbbi->cxMinChild;
1786 lpBand->cyMinChild = lprbbi->cyMinChild;
1787 /* These fields where added in WIN32_IE == 0x400 and are set only for RBBS_VARIABLEHEIGHT bands */
1788 if (lprbbi->cbSize >= REBARBANDINFOA_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
1789 lpBand->cyMaxChild = lprbbi->cyMaxChild;
1790 lpBand->cyIntegral = lprbbi->cyIntegral;
1791
1792 lpBand->cyChild = round_child_height(lpBand, lprbbi->cyChild); /* make (cyChild - cyMinChild) a multiple of cyIntergral */
1793 }
1794 else {
1795 lpBand->cyChild = lpBand->cyMinChild;
1796 lpBand->cyMaxChild = 0x7fffffff;
1797 lpBand->cyIntegral = 0;
1798 }
1799 uChanged |= RBBIM_CHILDSIZE;
1800 }
1801
1802 if( (lprbbi->fMask & RBBIM_SIZE) &&
1803 (lpBand->cx != lprbbi->cx ) )
1804 {
1805 lpBand->cx = lprbbi->cx;
1806 uChanged |= RBBIM_SIZE;
1807 }
1808
1809 if( (lprbbi->fMask & RBBIM_BACKGROUND) &&
1810 ( lpBand->hbmBack != lprbbi->hbmBack ) )
1811 {
1812 lpBand->hbmBack = lprbbi->hbmBack;
1813 uChanged |= RBBIM_BACKGROUND;
1814 }
1815
1816 if( (lprbbi->fMask & RBBIM_ID) &&
1817 (lpBand->wID != lprbbi->wID ) )
1818 {
1819 lpBand->wID = lprbbi->wID;
1820 uChanged |= RBBIM_ID;
1821 }
1822
1823 /* check for additional data */
1824 if (lprbbi->cbSize >= REBARBANDINFOA_V6_SIZE) {
1825 if( (lprbbi->fMask & RBBIM_IDEALSIZE) &&
1826 ( lpBand->cxIdeal != lprbbi->cxIdeal ) )
1827 {
1828 lpBand->cxIdeal = lprbbi->cxIdeal;
1829 uChanged |= RBBIM_IDEALSIZE;
1830 }
1831
1832 if( (lprbbi->fMask & RBBIM_LPARAM) &&
1833 (lpBand->lParam != lprbbi->lParam ) )
1834 {
1835 lpBand->lParam = lprbbi->lParam;
1836 uChanged |= RBBIM_LPARAM;
1837 }
1838
1839 if( (lprbbi->fMask & RBBIM_HEADERSIZE) &&
1840 (lpBand->cxHeader != lprbbi->cxHeader ) )
1841 {
1842 lpBand->cxHeader = lprbbi->cxHeader;
1843 lpBand->fStyle |= RBBS_UNDOC_FIXEDHEADER;
1844 uChanged |= RBBIM_HEADERSIZE;
1845 }
1846 }
1847
1848 return uChanged;
1849}
1850
1852 /* Function: This erases the background rectangle by drawing */
1853 /* each band with its background color (or the default) and */
1854 /* draws each bands right separator if necessary. The row */
1855 /* separators are drawn on the first band of the next row. */
1856{
1857 REBAR_BAND *lpBand;
1858 UINT i;
1859 INT oldrow;
1860 RECT cr;
1861 COLORREF old = CLR_NONE, new;
1862 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
1863
1864 GetClientRect (infoPtr->hwndSelf, &cr);
1865
1866#ifdef __REACTOS__
1867 if (theme)
1868 {
1870 {
1871 DrawThemeParentBackground (infoPtr->hwndSelf, hdc, &cr);
1872 }
1873 DrawThemeBackground (theme, hdc, 0, 0, &cr, NULL);
1874 }
1875#endif
1876
1877 oldrow = -1;
1878 for(i=0; i<infoPtr->uNumBands; i++) {
1879 RECT rcBand;
1880 lpBand = REBAR_GetBand(infoPtr, i);
1881 if (HIDDENBAND(lpBand)) continue;
1882 translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
1883
1884 /* draw band separator between rows */
1885 if (lpBand->iRow != oldrow) {
1886 oldrow = lpBand->iRow;
1887 if (infoPtr->dwStyle & RBS_BANDBORDERS) {
1888 RECT rcRowSep;
1889 rcRowSep = rcBand;
1890 if (infoPtr->dwStyle & CCS_VERT) {
1891 rcRowSep.right += SEP_WIDTH_SIZE;
1892 rcRowSep.bottom = infoPtr->calcSize.cx;
1893 if (theme)
1894 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcRowSep, EDGE_ETCHED, BF_RIGHT, NULL);
1895 else
1896 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT);
1897 }
1898 else {
1899 rcRowSep.bottom += SEP_WIDTH_SIZE;
1900 rcRowSep.right = infoPtr->calcSize.cx;
1901 if (theme)
1902 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcRowSep, EDGE_ETCHED, BF_BOTTOM, NULL);
1903 else
1904 DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM);
1905 }
1906 TRACE ("drawing band separator bottom (%s)\n",
1907 wine_dbgstr_rect(&rcRowSep));
1908 }
1909 }
1910
1911 /* draw band separator between bands in a row */
1912 if (infoPtr->dwStyle & RBS_BANDBORDERS && lpBand->rcBand.left > 0) {
1913 RECT rcSep;
1914 rcSep = rcBand;
1915 if (infoPtr->dwStyle & CCS_VERT) {
1916 rcSep.bottom = rcSep.top;
1917 rcSep.top -= SEP_WIDTH_SIZE;
1918 if (theme)
1919 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcSep, EDGE_ETCHED, BF_BOTTOM, NULL);
1920 else
1921 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM);
1922 }
1923 else {
1924 rcSep.right = rcSep.left;
1925 rcSep.left -= SEP_WIDTH_SIZE;
1926 if (theme)
1927 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcSep, EDGE_ETCHED, BF_RIGHT, NULL);
1928 else
1929 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT);
1930 }
1931 TRACE("drawing band separator right (%s)\n",
1932 wine_dbgstr_rect(&rcSep));
1933 }
1934
1935 /* draw the actual background */
1936 if (lpBand->clrBack != CLR_NONE) {
1937 new = (lpBand->clrBack == CLR_DEFAULT) ? infoPtr->clrBtnFace :
1938 lpBand->clrBack;
1939#if GLATESTING
1940 /* testing only - make background green to see it */
1941 new = RGB(0,128,0);
1942#endif
1943 }
1944 else {
1945 /* In the absence of documentation for Rebar vs. CLR_NONE,
1946 * we will use the default BtnFace color. Note documentation
1947 * exists for Listview and Imagelist.
1948 */
1949 new = infoPtr->clrBtnFace;
1950#if GLATESTING
1951 /* testing only - make background green to see it */
1952 new = RGB(0,128,0);
1953#endif
1954 }
1955
1956 if (theme)
1957 {
1958 /* When themed, the background color is ignored (but not a
1959 * background bitmap */
1960 DrawThemeBackground (theme, hdc, 0, 0, &cr, &rcBand);
1961 }
1962 else
1963 {
1964 old = SetBkColor (hdc, new);
1965 TRACE("%s background color=0x%06x, band %s\n",
1966 (lpBand->clrBack == CLR_NONE) ? "none" :
1967 ((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""),
1968 GetBkColor(hdc), wine_dbgstr_rect(&rcBand));
1969 ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &rcBand, NULL, 0, 0);
1970 if (lpBand->clrBack != CLR_NONE)
1971 SetBkColor (hdc, old);
1972 }
1973 }
1974 return TRUE;
1975}
1976
1977static void
1978REBAR_InternalHitTest (const REBAR_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pBand)
1979{
1980 REBAR_BAND *lpBand;
1981 RECT rect;
1982 UINT iCount;
1983
1984 GetClientRect (infoPtr->hwndSelf, &rect);
1985
1986 *pFlags = RBHT_NOWHERE;
1987 if (PtInRect (&rect, *lpPt))
1988 {
1989 if (infoPtr->uNumBands == 0) {
1990 *pFlags = RBHT_NOWHERE;
1991 if (pBand)
1992 *pBand = -1;
1993 TRACE("NOWHERE\n");
1994 return;
1995 }
1996 else {
1997 /* somewhere inside */
1998 for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
1999 RECT rcBand;
2000 lpBand = REBAR_GetBand(infoPtr, iCount);
2001 translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
2002 if (HIDDENBAND(lpBand)) continue;
2003 if (PtInRect (&rcBand, *lpPt)) {
2004 if (pBand)
2005 *pBand = iCount;
2006 if (PtInRect (&lpBand->rcGripper, *lpPt)) {
2007 *pFlags = RBHT_GRABBER;
2008 TRACE("ON GRABBER %d\n", iCount);
2009 return;
2010 }
2011 else if (PtInRect (&lpBand->rcCapImage, *lpPt)) {
2012 *pFlags = RBHT_CAPTION;
2013 TRACE("ON CAPTION %d\n", iCount);
2014 return;
2015 }
2016 else if (PtInRect (&lpBand->rcCapText, *lpPt)) {
2017 *pFlags = RBHT_CAPTION;
2018 TRACE("ON CAPTION %d\n", iCount);
2019 return;
2020 }
2021 else if (PtInRect (&lpBand->rcChild, *lpPt)) {
2022 *pFlags = RBHT_CLIENT;
2023 TRACE("ON CLIENT %d\n", iCount);
2024 return;
2025 }
2026 else if (PtInRect (&lpBand->rcChevron, *lpPt)) {
2027 *pFlags = RBHT_CHEVRON;
2028 TRACE("ON CHEVRON %d\n", iCount);
2029 return;
2030 }
2031 else {
2032 *pFlags = RBHT_NOWHERE;
2033 TRACE("NOWHERE %d\n", iCount);
2034 return;
2035 }
2036 }
2037 }
2038
2039 *pFlags = RBHT_NOWHERE;
2040 if (pBand)
2041 *pBand = -1;
2042
2043 TRACE("NOWHERE\n");
2044 return;
2045 }
2046 }
2047 else {
2048 *pFlags = RBHT_NOWHERE;
2049 if (pBand)
2050 *pBand = -1;
2051 TRACE("NOWHERE\n");
2052 return;
2053 }
2054}
2055
2056static void
2057REBAR_HandleLRDrag (REBAR_INFO *infoPtr, const POINT *ptsmove)
2058 /* Function: This will implement the functionality of a */
2059 /* Gripper drag within a row. It will not implement "out- */
2060 /* of-row" drags. (They are detected and handled in */
2061 /* REBAR_MouseMove.) */
2062{
2063 REBAR_BAND *hitBand;
2064 INT iHitBand, iRowBegin, iRowEnd;
2065 INT movement, xBand, cxLeft = 0;
2066 BOOL shrunkBands = FALSE;
2067
2068 iHitBand = infoPtr->iGrabbedBand;
2069 iRowBegin = get_row_begin_for_band(infoPtr, iHitBand);
2070 iRowEnd = get_row_end_for_band(infoPtr, iHitBand);
2071 hitBand = REBAR_GetBand(infoPtr, iHitBand);
2072
2073 xBand = hitBand->rcBand.left;
2074 movement = (infoPtr->dwStyle&CCS_VERT ? ptsmove->y : ptsmove->x)
2075 - (xBand + REBAR_PRE_GRIPPER - infoPtr->ihitoffset);
2076
2077 /* Dragging the first band in a row cannot cause shrinking */
2078 if(iHitBand != iRowBegin)
2079 {
2080 if (movement < 0) {
2081 cxLeft = REBAR_ShrinkBandsRTL(infoPtr, iRowBegin, iHitBand, -movement, TRUE);
2082
2083 if(cxLeft < -movement)
2084 {
2085 hitBand->cxEffective += -movement - cxLeft;
2086 hitBand->cx = hitBand->cxEffective;
2087 shrunkBands = TRUE;
2088 }
2089
2090 } else if (movement > 0) {
2091
2092 cxLeft = movement;
2093 if (prev_visible(infoPtr, iHitBand) >= 0)
2094 cxLeft = REBAR_ShrinkBandsLTR(infoPtr, iHitBand, iRowEnd, movement, TRUE);
2095
2096 if(cxLeft < movement)
2097 {
2098 REBAR_BAND *lpPrev = REBAR_GetBand(infoPtr, prev_visible(infoPtr, iHitBand));
2099 lpPrev->cxEffective += movement - cxLeft;
2100 lpPrev->cx = hitBand->cxEffective;
2101 shrunkBands = TRUE;
2102 }
2103
2104 }
2105 }
2106
2107 if(!shrunkBands)
2108 {
2109 /* It was not possible to move the band by shrinking bands.
2110 * Try relocating the band instead. */
2111 REBAR_MoveBandToRowOffset(infoPtr, iHitBand, iRowBegin,
2112 iRowEnd, xBand + movement, TRUE);
2113 }
2114
2115 REBAR_SetRowRectsX(infoPtr, iRowBegin, iRowEnd);
2116 if (infoPtr->dwStyle & CCS_VERT)
2117 REBAR_CalcVertBand(infoPtr, 0, infoPtr->uNumBands);
2118 else
2119 REBAR_CalcHorzBand(infoPtr, 0, infoPtr->uNumBands);
2120 REBAR_MoveChildWindows(infoPtr, iRowBegin, iRowEnd);
2121}
2122
2123static void
2124REBAR_HandleUDDrag (REBAR_INFO *infoPtr, const POINT *ptsmove)
2125{
2126 INT yOff = (infoPtr->dwStyle & CCS_VERT) ? ptsmove->x : ptsmove->y;
2127 INT iHitBand, iRowBegin, iNextRowBegin;
2128 REBAR_BAND *hitBand, *rowBeginBand;
2129
2130 if(infoPtr->uNumBands <= 0)
2131 ERR("There are no bands in this rebar\n");
2132
2133 /* Up/down dragging can only occur when there is more than one
2134 * band in the rebar */
2135 if(infoPtr->uNumBands <= 1)
2136 return;
2137
2138 iHitBand = infoPtr->iGrabbedBand;
2139 hitBand = REBAR_GetBand(infoPtr, iHitBand);
2140
2141 /* If we're taking a band that has the RBBS_BREAK style set, this
2142 * style needs to be reapplied to the band that is going to become
2143 * the new start of the row. */
2144 if((hitBand->fStyle & RBBS_BREAK) &&
2145 (iHitBand < infoPtr->uNumBands - 1))
2146 REBAR_GetBand(infoPtr, iHitBand + 1)->fStyle |= RBBS_BREAK;
2147
2148 if(yOff < 0)
2149 {
2150 /* Place the band above the current top row */
2151 if(iHitBand==0 && (infoPtr->uNumBands==1 || REBAR_GetBand(infoPtr, 1)->fStyle&RBBS_BREAK))
2152 return;
2153 DPA_DeletePtr(infoPtr->bands, iHitBand);
2154 hitBand->fStyle &= ~RBBS_BREAK;
2155 REBAR_GetBand(infoPtr, 0)->fStyle |= RBBS_BREAK;
2156 infoPtr->iGrabbedBand = DPA_InsertPtr(
2157 infoPtr->bands, 0, hitBand);
2158 }
2159 else if(yOff > REBAR_GetBand(infoPtr, infoPtr->uNumBands - 1)->rcBand.bottom)
2160 {
2161 /* Place the band below the current bottom row */
2162 if(iHitBand == infoPtr->uNumBands-1 && hitBand->fStyle&RBBS_BREAK)
2163 return;
2164 DPA_DeletePtr(infoPtr->bands, iHitBand);
2165 hitBand->fStyle |= RBBS_BREAK;
2166 infoPtr->iGrabbedBand = DPA_InsertPtr(
2167 infoPtr->bands, infoPtr->uNumBands - 1, hitBand);
2168 }
2169 else
2170 {
2171 /* Place the band in the preexisting row the mouse is hovering over */
2172 iRowBegin = first_visible(infoPtr);
2173 while(iRowBegin < infoPtr->uNumBands)
2174 {
2175 iNextRowBegin = get_row_end_for_band(infoPtr, iRowBegin);
2176 rowBeginBand = REBAR_GetBand(infoPtr, iRowBegin);
2177 if(rowBeginBand->rcBand.bottom > yOff)
2178 {
2180 infoPtr, iHitBand, iRowBegin, iNextRowBegin,
2181 ((infoPtr->dwStyle & CCS_VERT) ? ptsmove->y : ptsmove->x)
2182 - REBAR_PRE_GRIPPER - infoPtr->ihitoffset, FALSE);
2183 break;
2184 }
2185
2186 iRowBegin = iNextRowBegin;
2187 }
2188 }
2189
2190 REBAR_Layout(infoPtr);
2191}
2192
2193
2194/* << REBAR_BeginDrag >> */
2195
2196
2197static LRESULT
2199{
2200 UINT uBand = (UINT)wParam;
2201 REBAR_BAND *lpBand;
2202
2203 if (uBand >= infoPtr->uNumBands)
2204 return FALSE;
2205
2206 TRACE("deleting band %u!\n", uBand);
2207 lpBand = REBAR_GetBand(infoPtr, uBand);
2208 REBAR_Notify_NMREBAR (infoPtr, uBand, RBN_DELETINGBAND);
2209 /* TODO: a return of 1 should probably cancel the deletion */
2210
2211 if (lpBand->hwndChild)
2212 ShowWindow(lpBand->hwndChild, SW_HIDE);
2213 Free(lpBand->lpText);
2214 Free(lpBand);
2215
2216 infoPtr->uNumBands--;
2217 DPA_DeletePtr(infoPtr->bands, uBand);
2218
2220
2221 /* if only 1 band left the re-validate to possible eliminate gripper */
2222 if (infoPtr->uNumBands == 1)
2223 REBAR_ValidateBand (infoPtr, REBAR_GetBand(infoPtr, 0));
2224
2225 REBAR_Layout(infoPtr);
2226
2227 return TRUE;
2228}
2229
2230
2231/* << REBAR_DragMove >> */
2232/* << REBAR_EndDrag >> */
2233
2234
2235static LRESULT
2236REBAR_GetBandBorders (const REBAR_INFO *infoPtr, UINT uBand, RECT *lpRect)
2237{
2238 REBAR_BAND *lpBand;
2239
2240 if (!lpRect)
2241 return 0;
2242 if (uBand >= infoPtr->uNumBands)
2243 return 0;
2244
2245 lpBand = REBAR_GetBand(infoPtr, uBand);
2246
2247 /* FIXME - the following values were determined by experimentation */
2248 /* with the REBAR Control Spy. I have guesses as to what the 4 and */
2249 /* 1 are, but I am not sure. There doesn't seem to be any actual */
2250 /* difference in size of the control area with and without the */
2251 /* style. - GA */
2252 if (infoPtr->dwStyle & RBS_BANDBORDERS) {
2253 if (infoPtr->dwStyle & CCS_VERT) {
2254 lpRect->left = 1;
2255 lpRect->top = lpBand->cxHeader + 4;
2256 lpRect->right = 1;
2257 lpRect->bottom = 0;
2258 }
2259 else {
2260 lpRect->left = lpBand->cxHeader + 4;
2261 lpRect->top = 1;
2262 lpRect->right = 0;
2263 lpRect->bottom = 1;
2264 }
2265 }
2266 else {
2267 lpRect->left = lpBand->cxHeader;
2268 }
2269 return 0;
2270}
2271
2272
2273static inline LRESULT
2275{
2276 TRACE("band count %u!\n", infoPtr->uNumBands);
2277
2278 return infoPtr->uNumBands;
2279}
2280
2281
2282static LRESULT
2283REBAR_GetBandInfoT(const REBAR_INFO *infoPtr, UINT uIndex, LPREBARBANDINFOW lprbbi, BOOL bUnicode)
2284{
2285 REBAR_BAND *lpBand;
2286
2287 if (!lprbbi || lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
2288 return FALSE;
2289
2290 if (uIndex >= infoPtr->uNumBands)
2291 return FALSE;
2292
2293 TRACE("index %u (bUnicode=%d)\n", uIndex, bUnicode);
2294
2295 /* copy band information */
2296 lpBand = REBAR_GetBand(infoPtr, uIndex);
2297
2298 if (lprbbi->fMask & RBBIM_STYLE)
2299 lprbbi->fStyle = lpBand->fStyle;
2300
2301 if (lprbbi->fMask & RBBIM_COLORS) {
2302 lprbbi->clrFore = lpBand->clrFore;
2303 lprbbi->clrBack = lpBand->clrBack;
2304 if (lprbbi->clrBack == CLR_DEFAULT)
2305 lprbbi->clrBack = infoPtr->clrBtnFace;
2306 }
2307
2308 if (lprbbi->fMask & RBBIM_TEXT) {
2309 if (bUnicode)
2310 Str_GetPtrW(lpBand->lpText, lprbbi->lpText, lprbbi->cch);
2311 else
2312 Str_GetPtrWtoA(lpBand->lpText, (LPSTR)lprbbi->lpText, lprbbi->cch);
2313 }
2314
2315 if (lprbbi->fMask & RBBIM_IMAGE)
2316 lprbbi->iImage = lpBand->iImage;
2317
2318 if (lprbbi->fMask & RBBIM_CHILD)
2319 lprbbi->hwndChild = lpBand->hwndChild;
2320
2321 if (lprbbi->fMask & RBBIM_CHILDSIZE) {
2322 lprbbi->cxMinChild = lpBand->cxMinChild;
2323 lprbbi->cyMinChild = lpBand->cyMinChild;
2324 /* to make tests pass we follow Windows' behaviour and allow reading these fields only
2325 * for RBBS_VARIABLEHEIGHTS bands */
2326 if (lprbbi->cbSize >= REBARBANDINFOW_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
2327 lprbbi->cyChild = lpBand->cyChild;
2328 lprbbi->cyMaxChild = lpBand->cyMaxChild;
2329 lprbbi->cyIntegral = lpBand->cyIntegral;
2330 }
2331 }
2332
2333 if (lprbbi->fMask & RBBIM_SIZE)
2334 lprbbi->cx = lpBand->cx;
2335
2336 if (lprbbi->fMask & RBBIM_BACKGROUND)
2337 lprbbi->hbmBack = lpBand->hbmBack;
2338
2339 if (lprbbi->fMask & RBBIM_ID)
2340 lprbbi->wID = lpBand->wID;
2341
2342 /* check for additional data */
2343 if (lprbbi->cbSize >= REBARBANDINFOW_V6_SIZE) {
2344 if (lprbbi->fMask & RBBIM_IDEALSIZE)
2345 lprbbi->cxIdeal = lpBand->cxIdeal;
2346
2347 if (lprbbi->fMask & RBBIM_LPARAM)
2348 lprbbi->lParam = lpBand->lParam;
2349
2350 if (lprbbi->fMask & RBBIM_HEADERSIZE)
2351 lprbbi->cxHeader = lpBand->cxHeader;
2352 }
2353
2354 REBAR_DumpBandInfo(lprbbi);
2355
2356 return TRUE;
2357}
2358
2359
2360static LRESULT
2362{
2363 INT nHeight;
2364
2365 nHeight = infoPtr->calcSize.cy;
2366
2367 TRACE("height = %d\n", nHeight);
2368
2369 return nHeight;
2370}
2371
2372
2373static LRESULT
2375{
2376 if (!lpInfo || lpInfo->cbSize < sizeof (REBARINFO))
2377 return FALSE;
2378
2379 TRACE("getting bar info!\n");
2380
2381 if (infoPtr->himl) {
2382 lpInfo->himl = infoPtr->himl;
2383 lpInfo->fMask |= RBIM_IMAGELIST;
2384 }
2385
2386 return TRUE;
2387}
2388
2389
2390static inline LRESULT
2392{
2393 COLORREF clr = infoPtr->clrBk;
2394
2395 if (clr == CLR_DEFAULT)
2396 clr = infoPtr->clrBtnFace;
2397
2398 TRACE("background color 0x%06x!\n", clr);
2399
2400 return clr;
2401}
2402
2403
2404/* << REBAR_GetColorScheme >> */
2405/* << REBAR_GetDropTarget >> */
2406
2407
2408static LRESULT
2410{
2411 FIXME("empty stub!\n");
2412
2413 return 0;
2414}
2415
2416
2417static LRESULT
2418REBAR_GetRect (const REBAR_INFO *infoPtr, INT iBand, RECT *lprc)
2419{
2420 REBAR_BAND *lpBand;
2421
2422 if (iBand < 0 || iBand >= infoPtr->uNumBands)
2423 return FALSE;
2424 if (!lprc)
2425 return FALSE;
2426
2427 lpBand = REBAR_GetBand(infoPtr, iBand);
2428 /* For CCS_VERT the coordinates will be swapped - like on Windows */
2429 *lprc = lpBand->rcBand;
2430
2431 TRACE("band %d, (%s)\n", iBand, wine_dbgstr_rect(lprc));
2432
2433 return TRUE;
2434}
2435
2436
2437static inline LRESULT
2439{
2440 TRACE("%u\n", infoPtr->uNumRows);
2441
2442 return infoPtr->uNumRows;
2443}
2444
2445
2446static LRESULT
2447REBAR_GetRowHeight (const REBAR_INFO *infoPtr, INT iRow)
2448{
2449 int j = 0, ret = 0;
2450 UINT i;
2451 REBAR_BAND *lpBand;
2452
2453 for (i=0; i<infoPtr->uNumBands; i++) {
2454 lpBand = REBAR_GetBand(infoPtr, i);
2455 if (HIDDENBAND(lpBand)) continue;
2456 if (lpBand->iRow != iRow) continue;
2457 j = lpBand->rcBand.bottom - lpBand->rcBand.top;
2458 if (j > ret) ret = j;
2459 }
2460
2461 TRACE("row %d, height %d\n", iRow, ret);
2462
2463 return ret;
2464}
2465
2466
2467static inline LRESULT
2469{
2470 TRACE("text color 0x%06x!\n", infoPtr->clrText);
2471
2472 return infoPtr->clrText;
2473}
2474
2475
2476static inline LRESULT
2478{
2479 return (LRESULT)infoPtr->hwndToolTip;
2480}
2481
2482
2483static inline LRESULT
2485{
2486 TRACE("%s hwnd=%p\n",
2487 infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);
2488
2489 return infoPtr->bUnicode;
2490}
2491
2492
2493static inline LRESULT
2495{
2496 TRACE("version %d\n", infoPtr->iVersion);
2497 return infoPtr->iVersion;
2498}
2499
2500
2501static LRESULT
2503{
2504 if (!lprbht)
2505 return -1;
2506
2507 REBAR_InternalHitTest (infoPtr, &lprbht->pt, &lprbht->flags, &lprbht->iBand);
2508
2509 return lprbht->iBand;
2510}
2511
2512
2513static LRESULT
2514REBAR_IdToIndex (const REBAR_INFO *infoPtr, UINT uId)
2515{
2516 UINT i;
2517
2518 if (infoPtr->uNumBands < 1)
2519 return -1;
2520
2521 for (i = 0; i < infoPtr->uNumBands; i++) {
2522 if (REBAR_GetBand(infoPtr, i)->wID == uId) {
2523 TRACE("id %u is band %u found!\n", uId, i);
2524 return i;
2525 }
2526 }
2527
2528 TRACE("id %u is not found\n", uId);
2529 return -1;
2530}
2531
2532
2533static LRESULT
2534REBAR_InsertBandT(REBAR_INFO *infoPtr, INT iIndex, const REBARBANDINFOW *lprbbi, BOOL bUnicode)
2535{
2536 REBAR_BAND *lpBand;
2537
2538 if (!lprbbi || lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
2539 return FALSE;
2540
2541 /* trace the index as signed to see the -1 */
2542 TRACE("insert band at %d (bUnicode=%d)!\n", iIndex, bUnicode);
2543 REBAR_DumpBandInfo(lprbbi);
2544
2545 if (!(lpBand = Alloc(sizeof(REBAR_BAND)))) return FALSE;
2546 if ((iIndex == -1) || (iIndex > infoPtr->uNumBands))
2547 iIndex = infoPtr->uNumBands;
2548 if (DPA_InsertPtr(infoPtr->bands, iIndex, lpBand) == -1)
2549 {
2550 Free(lpBand);
2551 return FALSE;
2552 }
2553 infoPtr->uNumBands++;
2554
2555 TRACE("index %d!\n", iIndex);
2556
2557 /* initialize band */
2558 memset(lpBand, 0, sizeof(*lpBand));
2559#ifdef __REACTOS__
2560 lpBand->clrFore = infoPtr->clrText == CLR_NONE ? CLR_DEFAULT : infoPtr->clrText;
2561 lpBand->clrBack = infoPtr->clrBk == CLR_NONE ? CLR_DEFAULT : infoPtr->clrBk;
2562#else
2563 lpBand->clrFore = infoPtr->clrText == CLR_NONE ? infoPtr->clrBtnText :
2564 infoPtr->clrText;
2565 lpBand->clrBack = infoPtr->clrBk == CLR_NONE ? infoPtr->clrBtnFace :
2566 infoPtr->clrBk;
2567#endif
2568 lpBand->iImage = -1;
2569
2570 REBAR_CommonSetupBand(infoPtr->hwndSelf, lprbbi, lpBand);
2571
2572 /* Make sure the defaults for these are correct */
2573 if (lprbbi->cbSize < REBARBANDINFOA_V6_SIZE || !(lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
2574 lpBand->cyChild = lpBand->cyMinChild;
2575 lpBand->cyMaxChild = 0x7fffffff;
2576 lpBand->cyIntegral = 0;
2577 }
2578
2579 if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
2580 if (bUnicode)
2581 Str_SetPtrW(&lpBand->lpText, lprbbi->lpText);
2582 else
2583 Str_SetPtrAtoW(&lpBand->lpText, (LPSTR)lprbbi->lpText);
2584 }
2585
2586 REBAR_ValidateBand (infoPtr, lpBand);
2587 /* On insert of second band, revalidate band 1 to possible add gripper */
2588 if (infoPtr->uNumBands == 2)
2589 REBAR_ValidateBand (infoPtr, REBAR_GetBand(infoPtr, 0));
2590
2591 REBAR_DumpBand (infoPtr);
2592
2593 REBAR_Layout(infoPtr);
2594 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
2595
2596 return TRUE;
2597}
2598
2599
2600static LRESULT
2602{
2603 REBAR_BAND *lpBand;
2604 int iRowBegin, iRowEnd;
2605 int cxDesired, extra, extraOrig;
2606 int cxIdealBand;
2607
2608 /* Validate */
2609 if (infoPtr->uNumBands == 0 || iBand < 0 || iBand >= infoPtr->uNumBands) {
2610 /* error !!! */
2611 ERR("Illegal MaximizeBand, requested=%d, current band count=%d\n",
2612 iBand, infoPtr->uNumBands);
2613 return FALSE;
2614 }
2615
2616 lpBand = REBAR_GetBand(infoPtr, iBand);
2617
2618 if (lpBand->fStyle & RBBS_HIDDEN)
2619 {
2620 /* Windows is buggy and creates a hole */
2621 WARN("Ignoring maximize request on a hidden band (%d)\n", iBand);
2622 return FALSE;
2623 }
2624
2625 cxIdealBand = lpBand->cxIdeal + lpBand->cxHeader + REBAR_POST_CHILD;
2626 if (lParam && (lpBand->cxEffective < cxIdealBand))
2627 cxDesired = cxIdealBand;
2628 else
2629 cxDesired = infoPtr->calcSize.cx;
2630
2631 iRowBegin = get_row_begin_for_band(infoPtr, iBand);
2632 iRowEnd = get_row_end_for_band(infoPtr, iBand);
2633 extraOrig = extra = cxDesired - lpBand->cxEffective;
2634 if (extra > 0)
2635 extra = REBAR_ShrinkBandsRTL(infoPtr, iRowBegin, iBand, extra, TRUE);
2636 if (extra > 0)
2637 extra = REBAR_ShrinkBandsLTR(infoPtr, next_visible(infoPtr, iBand), iRowEnd, extra, TRUE);
2638 lpBand->cxEffective += extraOrig - extra;
2639 lpBand->cx = lpBand->cxEffective;
2640 TRACE("(%d, %ld): Wanted size %d, obtained %d (shrink %d, %d)\n", iBand, lParam, cxDesired, lpBand->cx, extraOrig, extra);
2641 REBAR_SetRowRectsX(infoPtr, iRowBegin, iRowEnd);
2642
2643 if (infoPtr->dwStyle & CCS_VERT)
2644 REBAR_CalcVertBand(infoPtr, iRowBegin, iRowEnd);
2645 else
2646 REBAR_CalcHorzBand(infoPtr, iRowBegin, iRowEnd);
2647 REBAR_MoveChildWindows(infoPtr, iRowBegin, iRowEnd);
2648 return TRUE;
2649
2650}
2651
2652
2653static LRESULT
2654REBAR_MinimizeBand (const REBAR_INFO *infoPtr, INT iBand)
2655{
2656 REBAR_BAND *lpBand;
2657 int iPrev, iRowBegin, iRowEnd;
2658
2659 /* A "minimize" band is equivalent to "dragging" the gripper
2660 * of than band to the right till the band is only the size
2661 * of the cxHeader.
2662 */
2663
2664 /* Validate */
2665 if (infoPtr->uNumBands == 0 || iBand < 0 || iBand >= infoPtr->uNumBands) {
2666 /* error !!! */
2667 ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n",
2668 iBand, infoPtr->uNumBands);
2669 return FALSE;
2670 }
2671
2672 /* compute amount of movement and validate */
2673 lpBand = REBAR_GetBand(infoPtr, iBand);
2674
2675 if (lpBand->fStyle & RBBS_HIDDEN)
2676 {
2677 /* Windows is buggy and creates a hole/overlap */
2678 WARN("Ignoring minimize request on a hidden band (%d)\n", iBand);
2679 return FALSE;
2680 }
2681
2682 iPrev = prev_visible(infoPtr, iBand);
2683 /* if first band in row */
2684 if (iPrev < 0 || REBAR_GetBand(infoPtr, iPrev)->iRow != lpBand->iRow) {
2685 int iNext = next_visible(infoPtr, iBand);
2686 if (iNext < infoPtr->uNumBands && REBAR_GetBand(infoPtr, iNext)->iRow == lpBand->iRow) {
2687 TRACE("(%d): Minimizing the first band in row is by maximizing the second\n", iBand);
2688 REBAR_MaximizeBand(infoPtr, iNext, FALSE);
2689 }
2690 else
2691 TRACE("(%d): Only one band in row - nothing to do\n", iBand);
2692 return TRUE;
2693 }
2694
2695 REBAR_GetBand(infoPtr, iPrev)->cxEffective += lpBand->cxEffective - lpBand->cxMinBand;
2696 REBAR_GetBand(infoPtr, iPrev)->cx = REBAR_GetBand(infoPtr, iPrev)->cxEffective;
2697 lpBand->cx = lpBand->cxEffective = lpBand->cxMinBand;
2698
2699 iRowBegin = get_row_begin_for_band(infoPtr, iBand);
2700 iRowEnd = get_row_end_for_band(infoPtr, iBand);
2701 REBAR_SetRowRectsX(infoPtr, iRowBegin, iRowEnd);
2702
2703 if (infoPtr->dwStyle & CCS_VERT)
2704 REBAR_CalcVertBand(infoPtr, iRowBegin, iRowEnd);
2705 else
2706 REBAR_CalcHorzBand(infoPtr, iRowBegin, iRowEnd);
2707 REBAR_MoveChildWindows(infoPtr, iRowBegin, iRowEnd);
2708 return FALSE;
2709}
2710
2711
2712static LRESULT
2713REBAR_MoveBand (REBAR_INFO *infoPtr, INT iFrom, INT iTo)
2714{
2715 REBAR_BAND *lpBand;
2716
2717 /* Validate */
2718 if ((infoPtr->uNumBands == 0) ||
2719 (iFrom < 0) || iFrom >= infoPtr->uNumBands ||
2720 (iTo < 0) || iTo >= infoPtr->uNumBands) {
2721 /* error !!! */
2722 ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n",
2723 iFrom, iTo, infoPtr->uNumBands);
2724 return FALSE;
2725 }
2726
2727 lpBand = REBAR_GetBand(infoPtr, iFrom);
2728 DPA_DeletePtr(infoPtr->bands, iFrom);
2729 DPA_InsertPtr(infoPtr->bands, iTo, lpBand);
2730
2731 TRACE("moved band %d to index %d\n", iFrom, iTo);
2732 REBAR_DumpBand (infoPtr);
2733
2734 /* **************************************************** */
2735 /* */
2736 /* We do not do a REBAR_Layout here because the native */
2737 /* control does not do that. The actual layout and */
2738 /* repaint is done by the *next* real action, ex.: */
2739 /* RB_INSERTBAND, RB_DELETEBAND, RB_SIZETORECT, etc. */
2740 /* */
2741 /* **************************************************** */
2742
2743 return TRUE;
2744}
2745
2746
2747/* return TRUE if two strings are different */
2748static BOOL
2750{
2751 return ( (a && !b) || (b && !a) || (a && b && lstrcmpW(a, b) ) );
2752}
2753
2754static LRESULT
2755REBAR_SetBandInfoT(REBAR_INFO *infoPtr, INT iBand, const REBARBANDINFOW *lprbbi, BOOL bUnicode)
2756{
2757 REBAR_BAND *lpBand;
2758 UINT uChanged;
2759
2760 if (!lprbbi || lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
2761 return FALSE;
2762
2763 if (iBand >= infoPtr->uNumBands)
2764 return FALSE;
2765
2766 TRACE("index %d\n", iBand);
2767 REBAR_DumpBandInfo (lprbbi);
2768
2769 /* set band information */
2770 lpBand = REBAR_GetBand(infoPtr, iBand);
2771
2772 uChanged = REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand);
2773 if (lprbbi->fMask & RBBIM_TEXT) {
2774 LPWSTR wstr = NULL;
2775 if (bUnicode)
2776 Str_SetPtrW(&wstr, lprbbi->lpText);
2777 else
2778 Str_SetPtrAtoW(&wstr, (LPSTR)lprbbi->lpText);
2779
2780 if (REBAR_strdifW(wstr, lpBand->lpText)) {
2781 Free(lpBand->lpText);
2782 lpBand->lpText = wstr;
2783 uChanged |= RBBIM_TEXT;
2784 }
2785 else
2786 Free(wstr);
2787 }
2788
2789 REBAR_ValidateBand (infoPtr, lpBand);
2790
2791 REBAR_DumpBand (infoPtr);
2792
2793 if (uChanged & (RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE | RBBIM_IMAGE)) {
2794 REBAR_Layout(infoPtr);
2795 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
2796 }
2797
2798 return TRUE;
2799}
2800
2801
2802static LRESULT
2803REBAR_SetBarInfo (REBAR_INFO *infoPtr, const REBARINFO *lpInfo)
2804{
2805 REBAR_BAND *lpBand;
2806 UINT i;
2807
2808 if (!lpInfo || lpInfo->cbSize < sizeof (REBARINFO))
2809 return FALSE;
2810
2811 TRACE("setting bar info!\n");
2812
2813 if (lpInfo->fMask & RBIM_IMAGELIST) {
2814 infoPtr->himl = lpInfo->himl;
2815 if (infoPtr->himl) {
2816 INT cx, cy;
2817 ImageList_GetIconSize (infoPtr->himl, &cx, &cy);
2818 infoPtr->imageSize.cx = cx;
2819 infoPtr->imageSize.cy = cy;
2820 }
2821 else {
2822 infoPtr->imageSize.cx = 0;
2823 infoPtr->imageSize.cy = 0;
2824 }
2825 TRACE("new image cx=%d, cy=%d\n", infoPtr->imageSize.cx,
2826 infoPtr->imageSize.cy);
2827 }
2828
2829 /* revalidate all bands to reset flags for images in headers of bands */
2830 for (i=0; i<infoPtr->uNumBands; i++) {
2831 lpBand = REBAR_GetBand(infoPtr, i);
2832 REBAR_ValidateBand (infoPtr, lpBand);
2833 }
2834
2835 return TRUE;
2836}
2837
2838
2839static LRESULT
2841{
2842 COLORREF clrTemp;
2843
2844 clrTemp = infoPtr->clrBk;
2845 infoPtr->clrBk = clr;
2846
2847 TRACE("background color 0x%06x!\n", infoPtr->clrBk);
2848
2849 return clrTemp;
2850}
2851
2852
2853/* << REBAR_SetColorScheme >> */
2854/* << REBAR_SetPalette >> */
2855
2856
2857static LRESULT
2859{
2860 HWND hwndTemp = infoPtr->hwndNotify;
2861
2862 infoPtr->hwndNotify = parent;
2863
2864 return (LRESULT)hwndTemp;
2865}
2866
2867
2868static LRESULT
2870{
2871 COLORREF clrTemp;
2872
2873 clrTemp = infoPtr->clrText;
2874 infoPtr->clrText = clr;
2875
2876 TRACE("text color 0x%06x!\n", infoPtr->clrText);
2877
2878 return clrTemp;
2879}
2880
2881
2882/* << REBAR_SetTooltips >> */
2883
2884
2885static inline LRESULT
2887{
2888 BOOL bTemp = infoPtr->bUnicode;
2889
2890 TRACE("to %s hwnd=%p, was %s\n",
2891 unicode ? "TRUE" : "FALSE", infoPtr->hwndSelf,
2892 (bTemp) ? "TRUE" : "FALSE");
2893
2894 infoPtr->bUnicode = unicode;
2895
2896 return bTemp;
2897}
2898
2899
2900static LRESULT
2901REBAR_SetVersion (REBAR_INFO *infoPtr, INT iVersion)
2902{
2903 INT iOldVersion = infoPtr->iVersion;
2904
2905 if (iVersion > COMCTL32_VERSION)
2906 return -1;
2907
2908 infoPtr->iVersion = iVersion;
2909
2910 TRACE("new version %d\n", iVersion);
2911
2912 return iOldVersion;
2913}
2914
2915
2916static LRESULT
2917REBAR_ShowBand (REBAR_INFO *infoPtr, INT iBand, BOOL show)
2918{
2919 REBAR_BAND *lpBand;
2920
2921 if (iBand < 0 || iBand >= infoPtr->uNumBands)
2922 return FALSE;
2923
2924 lpBand = REBAR_GetBand(infoPtr, iBand);
2925
2926 if (show) {
2927 TRACE("show band %d\n", iBand);
2928 lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;
2929 if (IsWindow (lpBand->hwndChild))
2930 ShowWindow (lpBand->hwndChild, SW_SHOW);
2931 }
2932 else {
2933 TRACE("hide band %d\n", iBand);
2934 lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;
2935 if (IsWindow (lpBand->hwndChild))
2936 ShowWindow (lpBand->hwndChild, SW_HIDE);
2937 }
2938
2939 REBAR_Layout(infoPtr);
2940 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
2941
2942 return TRUE;
2943}
2944
2945
2946static LRESULT
2947#ifdef __REACTOS__
2948REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM flags, RECT *lpRect)
2949#else
2950REBAR_SizeToRect (REBAR_INFO *infoPtr, const RECT *lpRect)
2951#endif
2952{
2953 if (!lpRect) return FALSE;
2954
2955 TRACE("[%s]\n", wine_dbgstr_rect(lpRect));
2956 REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, lpRect));
2957
2958#ifdef __REACTOS__
2959 /* Note that this undocumented flag is available on comctl32 v6 or later */
2960 if ((flags & RBSTR_CHANGERECT) != 0)
2961 {
2962 RECT rcRebar;
2963 GetClientRect(infoPtr->hwndSelf, &rcRebar);
2964 lpRect->bottom = lpRect->top + (rcRebar.bottom - rcRebar.top);
2965 }
2966#endif
2967 return TRUE;
2968}
2969
2970
2971
2972static LRESULT
2974{
2975 RECT wnrc1, clrc1;
2976
2977 if (TRACE_ON(rebar)) {
2978 GetWindowRect(infoPtr->hwndSelf, &wnrc1);
2979 GetClientRect(infoPtr->hwndSelf, &clrc1);
2980 TRACE("window=(%s) client=(%s) cs=(%d,%d %dx%d)\n",
2981 wine_dbgstr_rect(&wnrc1), wine_dbgstr_rect(&clrc1),
2982 cs->x, cs->y, cs->cx, cs->cy);
2983 }
2984
2985 TRACE("created!\n");
2986
2987 if (OpenThemeData (infoPtr->hwndSelf, themeClass))
2988 {
2989 /* native seems to clear WS_BORDER when themed */
2990 infoPtr->dwStyle &= ~WS_BORDER;
2991 }
2992
2993 return 0;
2994}
2995
2996
2997static LRESULT
2999{
3000 REBAR_BAND *lpBand;
3001 UINT i;
3002
3003 /* clean up each band */
3004 for (i = 0; i < infoPtr->uNumBands; i++) {
3005 lpBand = REBAR_GetBand(infoPtr, i);
3006
3007 /* delete text strings */
3008 Free (lpBand->lpText);
3009 lpBand->lpText = NULL;
3010 /* destroy child window */
3011 DestroyWindow (lpBand->hwndChild);
3012 Free (lpBand);
3013 }
3014
3015 /* free band array */
3016 DPA_Destroy (infoPtr->bands);
3017 infoPtr->bands = NULL;
3018
3019 DestroyCursor (infoPtr->hcurArrow);
3020 DestroyCursor (infoPtr->hcurHorz);
3021 DestroyCursor (infoPtr->hcurVert);
3022 DestroyCursor (infoPtr->hcurDrag);
3023 if (infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont);
3024 SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
3025
3027
3028 /* free rebar info data */
3029 Free (infoPtr);
3030 TRACE("destroyed!\n");
3031 return 0;
3032}
3033
3034static LRESULT
3036{
3037 return (LRESULT)infoPtr->hFont;
3038}
3039
3040static LRESULT
3042{
3043 if (uBand < infoPtr->uNumBands)
3044 {
3045 NMREBARCHEVRON nmrbc;
3046 REBAR_BAND *lpBand = REBAR_GetBand(infoPtr, uBand);
3047
3048 TRACE("Pressed chevron on band %u\n", uBand);
3049
3050 /* redraw chevron in pushed state */
3051 lpBand->fDraw |= DRAW_CHEVRONPUSHED;
3052 RedrawWindow(infoPtr->hwndSelf, &lpBand->rcChevron,0,
3054
3055 /* notify app so it can display a popup menu or whatever */
3056 nmrbc.uBand = uBand;
3057 nmrbc.wID = lpBand->wID;
3058 nmrbc.lParam = lpBand->lParam;
3059 nmrbc.rc = lpBand->rcChevron;
3060 nmrbc.lParamNM = lParam;
3061 REBAR_Notify((NMHDR*)&nmrbc, infoPtr, RBN_CHEVRONPUSHED);
3062
3063 /* redraw chevron in previous state */
3064 lpBand->fDraw &= ~DRAW_CHEVRONPUSHED;
3065 InvalidateRect(infoPtr->hwndSelf, &lpBand->rcChevron, TRUE);
3066
3067 return TRUE;
3068 }
3069 return FALSE;
3070}
3071
3072static LRESULT
3074{
3075 UINT htFlags;
3076 INT iHitBand;
3077 POINT ptMouseDown;
3078 ptMouseDown.x = (short)LOWORD(lParam);
3079 ptMouseDown.y = (short)HIWORD(lParam);
3080
3081 REBAR_InternalHitTest(infoPtr, &ptMouseDown, &htFlags, &iHitBand);
3082
3083 if (htFlags == RBHT_CHEVRON)
3084 {
3085 REBAR_PushChevron(infoPtr, iHitBand, 0);
3086 }
3087 else if (htFlags == RBHT_GRABBER || htFlags == RBHT_CAPTION)
3088 {
3089 REBAR_BAND *lpBand;
3090
3091 TRACE("Starting drag\n");
3092
3093 lpBand = REBAR_GetBand(infoPtr, iHitBand);
3094
3095 SetCapture (infoPtr->hwndSelf);
3096 infoPtr->iGrabbedBand = iHitBand;
3097
3098 /* save off the LOWORD and HIWORD of lParam as initial x,y */
3099 infoPtr->dragStart.x = (short)LOWORD(lParam);
3100 infoPtr->dragStart.y = (short)HIWORD(lParam);
3101 infoPtr->dragNow = infoPtr->dragStart;
3102 if (infoPtr->dwStyle & CCS_VERT)
3103 infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.left + REBAR_PRE_GRIPPER);
3104 else
3105 infoPtr->ihitoffset = infoPtr->dragStart.x - (lpBand->rcBand.left + REBAR_PRE_GRIPPER);
3106 }
3107 return 0;
3108}
3109
3110static LRESULT
3112{
3113 if (infoPtr->iGrabbedBand >= 0)
3114 {
3115 NMHDR layout;
3116 RECT rect;
3117
3118 infoPtr->dragStart.x = 0;
3119 infoPtr->dragStart.y = 0;
3120 infoPtr->dragNow = infoPtr->dragStart;
3121
3122 ReleaseCapture ();
3123
3124 if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) {
3125 REBAR_Notify(&layout, infoPtr, RBN_LAYOUTCHANGED);
3126 REBAR_Notify_NMREBAR (infoPtr, infoPtr->iGrabbedBand, RBN_ENDDRAG);
3127 infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED;
3128 }
3129
3130 infoPtr->iGrabbedBand = -1;
3131
3132 GetClientRect(infoPtr->hwndSelf, &rect);
3133 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
3134 }
3135
3136 return 0;
3137}
3138
3139static LRESULT
3141{
3142 if (infoPtr->ichevronhotBand >= 0)
3143 {
3144 REBAR_BAND *lpChevronBand = REBAR_GetBand(infoPtr, infoPtr->ichevronhotBand);
3145 if (lpChevronBand->fDraw & DRAW_CHEVRONHOT)
3146 {
3147 lpChevronBand->fDraw &= ~DRAW_CHEVRONHOT;
3148 InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
3149 }
3150 }
3151 infoPtr->iOldBand = -1;
3152 infoPtr->ichevronhotBand = -2;
3153
3154 return TRUE;
3155}
3156
3157static LRESULT
3159{
3160 REBAR_BAND *lpChevronBand;
3161 POINT ptMove;
3162
3163 ptMove.x = (short)LOWORD(lParam);
3164 ptMove.y = (short)HIWORD(lParam);
3165
3166 /* if we are currently dragging a band */
3167 if (infoPtr->iGrabbedBand >= 0)
3168 {
3169 REBAR_BAND *band;
3170 int yPtMove = (infoPtr->dwStyle & CCS_VERT ? ptMove.x : ptMove.y);
3171
3172 if (GetCapture() != infoPtr->hwndSelf)
3173 ERR("We are dragging but haven't got capture?!?\n");
3174
3175 band = REBAR_GetBand(infoPtr, infoPtr->iGrabbedBand);
3176
3177 /* if mouse did not move much, exit */
3178 if ((abs(ptMove.x - infoPtr->dragNow.x) <= mindragx) &&
3179 (abs(ptMove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
3180
3181 /* on first significant mouse movement, issue notify */
3182 if (!(infoPtr->fStatus & BEGIN_DRAG_ISSUED)) {
3183 if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) {
3184 /* Notify returned TRUE - abort drag */
3185 infoPtr->dragStart.x = 0;
3186 infoPtr->dragStart.y = 0;
3187 infoPtr->dragNow = infoPtr->dragStart;
3188 infoPtr->iGrabbedBand = -1;
3189 ReleaseCapture ();
3190 return 0;
3191 }
3192 infoPtr->fStatus |= BEGIN_DRAG_ISSUED;
3193 }
3194
3195 /* Test for valid drag case - must not be first band in row */
3196 if ((yPtMove < band->rcBand.top) ||
3197 (yPtMove > band->rcBand.bottom)) {
3198 REBAR_HandleUDDrag (infoPtr, &ptMove);
3199 }
3200 else {
3201 REBAR_HandleLRDrag (infoPtr, &ptMove);
3202 }
3203 }
3204 else
3205 {
3206 INT iHitBand;
3207 UINT htFlags;
3208 TRACKMOUSEEVENT trackinfo;
3209
3210 REBAR_InternalHitTest(infoPtr, &ptMove, &htFlags, &iHitBand);
3211
3212 if (infoPtr->iOldBand >= 0 && infoPtr->iOldBand == infoPtr->ichevronhotBand)
3213 {
3214 lpChevronBand = REBAR_GetBand(infoPtr, infoPtr->ichevronhotBand);
3215 if (lpChevronBand->fDraw & DRAW_CHEVRONHOT)
3216 {
3217 lpChevronBand->fDraw &= ~DRAW_CHEVRONHOT;
3218 InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
3219 }
3220 infoPtr->ichevronhotBand = -2;
3221 }
3222
3223 if (htFlags == RBHT_CHEVRON)
3224 {
3225 /* fill in the TRACKMOUSEEVENT struct */
3226 trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
3227 trackinfo.dwFlags = TME_QUERY;
3228 trackinfo.hwndTrack = infoPtr->hwndSelf;
3229 trackinfo.dwHoverTime = 0;
3230
3231 /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */
3232 _TrackMouseEvent(&trackinfo);
3233
3234 /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
3235 if(!(trackinfo.dwFlags & TME_LEAVE))
3236 {
3237 trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
3238
3239 /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
3240 /* and can properly deactivate the hot chevron */
3241 _TrackMouseEvent(&trackinfo);
3242 }
3243
3244 lpChevronBand = REBAR_GetBand(infoPtr, iHitBand);
3245 if (!(lpChevronBand->fDraw & DRAW_CHEVRONHOT))
3246 {
3247 lpChevronBand->fDraw |= DRAW_CHEVRONHOT;
3248 InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
3249 infoPtr->ichevronhotBand = iHitBand;
3250 }
3251 }
3252 infoPtr->iOldBand = iHitBand;
3253 }
3254
3255 return 0;
3256}
3257
3258
3259static inline LRESULT
3261{
3262 HTHEME theme;
3263
3264 if (infoPtr->dwStyle & WS_BORDER) {
3269 }
3270 else if ((theme = GetWindowTheme (infoPtr->hwndSelf)))
3271 {
3272 /* FIXME: should use GetThemeInt */
3273#ifdef __REACTOS__
3274 rect->top = (rect->top + 1 < rect->bottom) ? rect->top : rect->bottom;
3275#else
3276 rect->top = min(rect->top + 1, rect->bottom);
3277#endif
3278 }
3279 TRACE("new client=(%s)\n", wine_dbgstr_rect(rect));
3280 return 0;
3281}
3282
3283
3284static LRESULT
3286{
3287 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
3288 RECT wnrc1, clrc1;
3289 NONCLIENTMETRICSW ncm;
3290 HFONT tfont;
3291
3292 if (infoPtr) {
3293 ERR("Strange info structure pointer *not* NULL\n");
3294 return FALSE;
3295 }
3296
3297 if (TRACE_ON(rebar)) {
3298 GetWindowRect(hwnd, &wnrc1);
3299 GetClientRect(hwnd, &clrc1);
3300 TRACE("window=(%s) client=(%s) cs=(%d,%d %dx%d)\n",
3301 wine_dbgstr_rect(&wnrc1), wine_dbgstr_rect(&clrc1),
3302 cs->x, cs->y, cs->cx, cs->cy);
3303 }
3304
3305 /* allocate memory for info structure */
3306 infoPtr = Alloc (sizeof(REBAR_INFO));
3307 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
3308
3309 /* initialize info structure - initial values are 0 */
3310 infoPtr->clrBk = CLR_NONE;
3311 infoPtr->clrText = CLR_NONE;
3314 infoPtr->iOldBand = -1;
3315 infoPtr->ichevronhotBand = -2;
3316 infoPtr->iGrabbedBand = -1;
3317 infoPtr->hwndSelf = hwnd;
3318 infoPtr->DoRedraw = TRUE;
3319 infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW);
3320 infoPtr->hcurHorz = LoadCursorW (0, (LPWSTR)IDC_SIZEWE);
3321 infoPtr->hcurVert = LoadCursorW (0, (LPWSTR)IDC_SIZENS);
3322 infoPtr->hcurDrag = LoadCursorW (0, (LPWSTR)IDC_SIZE);
3323 infoPtr->fStatus = 0;
3324 infoPtr->hFont = GetStockObject (SYSTEM_FONT);
3325 infoPtr->bands = DPA_Create(8);
3326
3327 /* issue WM_NOTIFYFORMAT to get unicode status of parent */
3329
3330 /* Stow away the original style */
3331 infoPtr->orgStyle = cs->style;
3332 /* add necessary styles to the requested styles */
3333 infoPtr->dwStyle = cs->style | WS_VISIBLE;
3334 if ((infoPtr->dwStyle & CCS_LAYOUT_MASK) == 0)
3335 infoPtr->dwStyle |= CCS_TOP;
3336 SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle);
3337
3338 /* get font handle for Caption Font */
3339 ncm.cbSize = sizeof(ncm);
3340 SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
3341 /* if the font is bold, set to normal */
3342 if (ncm.lfCaptionFont.lfWeight > FW_NORMAL) {
3343 ncm.lfCaptionFont.lfWeight = FW_NORMAL;
3344 }
3345 tfont = CreateFontIndirectW (&ncm.lfCaptionFont);
3346 if (tfont) {
3347 infoPtr->hFont = infoPtr->hDefaultFont = tfont;
3348 }
3349
3350 return TRUE;
3351}
3352
3353
3354static LRESULT
3356{
3357 NMMOUSE nmmouse;
3358 POINT clpt;
3359 INT i;
3360 UINT scrap;
3362
3363 /*
3364 * Differences from doc at MSDN (as observed with version 4.71 of
3365 * comctl32.dll
3366 * 1. doc says nmmouse.pt is in screen coord, trace shows client coord.
3367 * 2. if band is not identified .dwItemSpec is 0xffffffff.
3368 * 3. native always seems to return HTCLIENT if notify return is 0.
3369 */
3370
3371 clpt.x = (short)LOWORD(lParam);
3372 clpt.y = (short)HIWORD(lParam);
3373 ScreenToClient (infoPtr->hwndSelf, &clpt);
3374 REBAR_InternalHitTest (infoPtr, &clpt, &scrap,
3375 (INT *)&nmmouse.dwItemSpec);
3376 nmmouse.dwItemData = 0;
3377 nmmouse.pt = clpt;
3378#ifdef __REACTOS__
3379 nmmouse.dwHitInfo = scrap;
3380#else
3381 nmmouse.dwHitInfo = 0;
3382#endif
3383 if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) {
3384 TRACE("notify changed return value from %ld to %d\n",
3385 ret, i);
3386 ret = (LRESULT) i;
3387 }
3388 TRACE("returning %ld, client point %s\n", ret, wine_dbgstr_point(&clpt));
3389 return ret;
3390}
3391
3392
3393static LRESULT
3395{
3396 RECT rcWindow;
3397 HDC hdc;
3398 HTHEME theme;
3399
3400 if (infoPtr->dwStyle & WS_MINIMIZE)
3401 return 0; /* Nothing to do */
3402
3403 if (infoPtr->dwStyle & WS_BORDER) {
3404
3405 /* adjust rectangle and draw the necessary edge */
3406 if (!(hdc = GetDCEx( infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW )))
3407 return 0;
3408 GetWindowRect (infoPtr->hwndSelf, &rcWindow);
3409 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
3410 TRACE("rect (%s)\n", wine_dbgstr_rect(&rcWindow));
3411 DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT);
3412 ReleaseDC( infoPtr->hwndSelf, hdc );
3413 }
3414 else if ((theme = GetWindowTheme (infoPtr->hwndSelf)))
3415 {
3416 /* adjust rectangle and draw the necessary edge */
3417 if (!(hdc = GetDCEx( infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW )))
3418 return 0;
3419 GetWindowRect (infoPtr->hwndSelf, &rcWindow);
3420 OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
3421 TRACE("rect (%s)\n", wine_dbgstr_rect(&rcWindow));
3422 DrawThemeEdge (theme, hdc, 0, 0, &rcWindow, BDR_RAISEDINNER, BF_TOP, NULL);
3423 ReleaseDC( infoPtr->hwndSelf, hdc );
3424 }
3425
3426 return 0;
3427}
3428
3429
3430static LRESULT
3432{
3433 INT i;
3434
3435 if (cmd == NF_REQUERY) {
3437 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
3438 if ((i != NFR_ANSI) && (i != NFR_UNICODE)) {
3439 ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
3440 i = NFR_ANSI;
3441 }
3442 infoPtr->bUnicode = (i == NFR_UNICODE);
3443 return (LRESULT)i;
3444 }
3445 return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI);
3446}
3447
3448
3449static LRESULT
3451{
3452 if (hdc) {
3453 TRACE("painting\n");
3454#ifdef __REACTOS__
3455 REBAR_EraseBkGnd (infoPtr, hdc);
3456#endif
3457 REBAR_Refresh (infoPtr, hdc);
3458 } else {
3459 PAINTSTRUCT ps;
3460 hdc = BeginPaint (infoPtr->hwndSelf, &ps);
3461 TRACE("painting (%s)\n", wine_dbgstr_rect(&ps.rcPaint));
3462 if (ps.fErase) {
3463 /* Erase area of paint if requested */
3464 REBAR_EraseBkGnd (infoPtr, hdc);
3465 }
3466 REBAR_Refresh (infoPtr, hdc);
3467 EndPaint (infoPtr->hwndSelf, &ps);
3468 }
3469
3470 return 0;
3471}
3472
3473
3474static LRESULT
3476{
3477 POINT pt;
3478 UINT flags;
3479
3480 TRACE("code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
3481
3482 GetCursorPos (&pt);
3483 ScreenToClient (infoPtr->hwndSelf, &pt);
3484
3485 REBAR_InternalHitTest (infoPtr, &pt, &flags, NULL);
3486
3487 if (flags == RBHT_GRABBER) {
3488 if ((infoPtr->dwStyle & CCS_VERT) &&
3489 !(infoPtr->dwStyle & RBS_VERTICALGRIPPER))
3490 SetCursor (infoPtr->hcurVert);
3491 else
3492 SetCursor (infoPtr->hcurHorz);
3493 }
3494 else if (flags != RBHT_CLIENT)
3495 SetCursor (infoPtr->hcurArrow);
3496
3497 return 0;
3498}
3499
3500
3501static LRESULT
3503{
3504 REBAR_BAND *lpBand;
3505 UINT i;
3506
3507 infoPtr->hFont = font;
3508
3509 /* revalidate all bands to change sizes of text in headers of bands */
3510 for (i=0; i<infoPtr->uNumBands; i++) {
3511 lpBand = REBAR_GetBand(infoPtr, i);
3512 REBAR_ValidateBand (infoPtr, lpBand);
3513 }
3514
3515 REBAR_Layout(infoPtr);
3516 return 0;
3517}
3518
3519
3520/*****************************************************
3521 *
3522 * Handles the WM_SETREDRAW message.
3523 *
3524 * Documentation:
3525 * According to testing V4.71 of COMCTL32 returns the
3526 * *previous* status of the redraw flag (either 0 or -1)
3527 * instead of the MSDN documented value of 0 if handled
3528 *
3529 *****************************************************/
3530static inline LRESULT
3532{
3533 BOOL oldredraw = infoPtr->DoRedraw;
3534
3535 TRACE("set to %s, fStatus=%08x\n",
3536 (redraw) ? "TRUE" : "FALSE", infoPtr->fStatus);
3537 infoPtr->DoRedraw = redraw;
3538 if (redraw) {
3539 if (infoPtr->fStatus & BAND_NEEDS_REDRAW) {
3540 REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands);
3541 REBAR_ForceResize (infoPtr);
3542 InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
3543 }
3544 infoPtr->fStatus &= ~BAND_NEEDS_REDRAW;
3545 }
3546 return (oldredraw) ? -1 : 0;
3547}
3548
3549
3550static LRESULT
3552{
3553 TRACE("wParam=%lx, lParam=%lx\n", wParam, lParam);
3554
3555 /* avoid _Layout resize recursion (but it shouldn't be infinite and it seems Windows does recurse) */
3556 if (infoPtr->fStatus & SELF_RESIZE) {
3557 infoPtr->fStatus &= ~SELF_RESIZE;
3558 TRACE("SELF_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",
3559 infoPtr->fStatus, lParam);
3560 return 0;
3561 }
3562
3563 if (infoPtr->dwStyle & RBS_AUTOSIZE)
3564 REBAR_AutoSize(infoPtr, TRUE);
3565 else
3566 REBAR_Layout(infoPtr);
3567
3568 return 0;
3569}
3570
3571
3572static LRESULT
3573REBAR_StyleChanged (REBAR_INFO *infoPtr, INT nType, const STYLESTRUCT *lpStyle)
3574{
3575 TRACE("current style=%08x, styleOld=%08x, style being set to=%08x\n",
3576 infoPtr->dwStyle, lpStyle->styleOld, lpStyle->styleNew);
3577 if (nType == GWL_STYLE)
3578 {
3579 infoPtr->orgStyle = infoPtr->dwStyle = lpStyle->styleNew;
3580 if (GetWindowTheme (infoPtr->hwndSelf))
3581 infoPtr->dwStyle &= ~WS_BORDER;
3582 /* maybe it should be COMMON_STYLES like in toolbar */
3583 if ((lpStyle->styleNew ^ lpStyle->styleOld) & CCS_VERT)
3584 REBAR_Layout(infoPtr);
3585 }
3586 return FALSE;
3587}
3588
3589/* update theme after a WM_THEMECHANGED message */
3591{
3592 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
3593 CloseThemeData (theme);
3594 theme = OpenThemeData (infoPtr->hwndSelf, themeClass);
3595 /* WS_BORDER disappears when theming is enabled and reappears when
3596 * disabled... */
3597 infoPtr->dwStyle &= ~WS_BORDER;
3598 infoPtr->dwStyle |= theme ? 0 : (infoPtr->orgStyle & WS_BORDER);
3599 return 0;
3600}
3601
3602static LRESULT
3604{
3605 LRESULT ret;
3606 RECT rc;
3607
3609 wParam, lParam);
3610 GetWindowRect(infoPtr->hwndSelf, &rc);
3611 TRACE("hwnd %p new pos (%s)\n", infoPtr->hwndSelf, wine_dbgstr_rect(&rc));
3612 return ret;
3613}
3614
3615
3616static LRESULT WINAPI
3618{
3619 REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
3620
3621 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n",
3622 hwnd, uMsg, wParam, lParam);
3623 if (!infoPtr && (uMsg != WM_NCCREATE))
3624 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
3625 switch (uMsg)
3626 {
3627/* case RB_BEGINDRAG: */
3628
3629 case RB_DELETEBAND:
3630 return REBAR_DeleteBand (infoPtr, wParam);
3631
3632/* case RB_DRAGMOVE: */
3633/* case RB_ENDDRAG: */
3634
3635 case RB_GETBANDBORDERS:
3636 return REBAR_GetBandBorders (infoPtr, wParam, (LPRECT)lParam);
3637
3638 case RB_GETBANDCOUNT:
3639 return REBAR_GetBandCount (infoPtr);
3640
3641 case RB_GETBANDINFO_OLD:
3642 case RB_GETBANDINFOA:
3643 case RB_GETBANDINFOW:
3645 uMsg == RB_GETBANDINFOW);
3646 case RB_GETBARHEIGHT:
3647 return REBAR_GetBarHeight (infoPtr);
3648
3649 case RB_GETBARINFO:
3650 return REBAR_GetBarInfo (infoPtr, (LPREBARINFO)lParam);
3651
3652 case RB_GETBKCOLOR:
3653 return REBAR_GetBkColor (infoPtr);
3654
3655/* case RB_GETCOLORSCHEME: */
3656/* case RB_GETDROPTARGET: */
3657
3658 case RB_GETPALETTE:
3659 return REBAR_GetPalette (infoPtr);
3660
3661 case RB_GETRECT:
3662 return REBAR_GetRect (infoPtr, wParam, (LPRECT)lParam);
3663
3664 case RB_GETROWCOUNT:
3665 return REBAR_GetRowCount (infoPtr);
3666
3667 case RB_GETROWHEIGHT:
3668 return REBAR_GetRowHeight (infoPtr, wParam);
3669
3670 case RB_GETTEXTCOLOR:
3671 return REBAR_GetTextColor (infoPtr);
3672
3673 case RB_GETTOOLTIPS:
3674 return REBAR_GetToolTips (infoPtr);
3675
3677 return REBAR_GetUnicodeFormat (infoPtr);
3678
3679 case CCM_GETVERSION:
3680 return REBAR_GetVersion (infoPtr);
3681
3682 case RB_HITTEST:
3683 return REBAR_HitTest (infoPtr, (LPRBHITTESTINFO)lParam);
3684
3685 case RB_IDTOINDEX:
3686 return REBAR_IdToIndex (infoPtr, wParam);
3687
3688 case RB_INSERTBANDA:
3689 case RB_INSERTBANDW:
3691 uMsg == RB_INSERTBANDW);
3692 case RB_MAXIMIZEBAND:
3693 return REBAR_MaximizeBand (infoPtr, wParam, lParam);
3694
3695 case RB_MINIMIZEBAND:
3696 return REBAR_MinimizeBand (infoPtr, wParam);
3697
3698 case RB_MOVEBAND:
3699 return REBAR_MoveBand (infoPtr, wParam, lParam);
3700
3701 case RB_PUSHCHEVRON:
3702 return REBAR_PushChevron (infoPtr, wParam, lParam);
3703
3704 case RB_SETBANDINFOA:
3705 case RB_SETBANDINFOW:
3707 uMsg == RB_SETBANDINFOW);
3708 case RB_SETBARINFO:
3709 return REBAR_SetBarInfo (infoPtr, (LPREBARINFO)lParam);
3710
3711 case RB_SETBKCOLOR:
3712 return REBAR_SetBkColor (infoPtr, lParam);
3713
3714/* case RB_SETCOLORSCHEME: */
3715/* case RB_SETPALETTE: */
3716
3717 case RB_SETPARENT:
3718 return REBAR_SetParent (infoPtr, (HWND)wParam);
3719
3720 case RB_SETTEXTCOLOR:
3721 return REBAR_SetTextColor (infoPtr, lParam);
3722
3723/* case RB_SETTOOLTIPS: */
3724
3726 return REBAR_SetUnicodeFormat (infoPtr, wParam);
3727
3728 case CCM_SETVERSION:
3729 return REBAR_SetVersion (infoPtr, (INT)wParam);
3730
3731 case RB_SHOWBAND:
3732 return REBAR_ShowBand (infoPtr, wParam, lParam);
3733
3734 case RB_SIZETORECT:
3735#ifdef __REACTOS__
3736 return REBAR_SizeToRect (infoPtr, wParam, (LPRECT)lParam);
3737#else
3738 return REBAR_SizeToRect (infoPtr, (LPCRECT)lParam);
3739#endif
3740
3741
3742/* Messages passed to parent */
3743 case WM_COMMAND:
3744 case WM_DRAWITEM:
3745 case WM_NOTIFY:
3746 case WM_MEASUREITEM:
3747 return SendMessageW(REBAR_GetNotifyParent (infoPtr), uMsg, wParam, lParam);
3748
3749
3750/* case WM_CHARTOITEM: supported according to ControlSpy */
3751
3752 case WM_CREATE:
3753 return REBAR_Create (infoPtr, (LPCREATESTRUCTW)lParam);
3754
3755 case WM_DESTROY:
3756 return REBAR_Destroy (infoPtr);
3757
3758 case WM_ERASEBKGND:
3759 return REBAR_EraseBkGnd (infoPtr, (HDC)wParam);
3760
3761 case WM_GETFONT:
3762 return REBAR_GetFont (infoPtr);
3763
3764/* case WM_LBUTTONDBLCLK: supported according to ControlSpy */
3765
3766 case WM_LBUTTONDOWN:
3767 return REBAR_LButtonDown (infoPtr, lParam);
3768
3769 case WM_LBUTTONUP:
3770 return REBAR_LButtonUp (infoPtr);
3771
3772 case WM_MOUSEMOVE:
3773 return REBAR_MouseMove (infoPtr, lParam);
3774
3775 case WM_MOUSELEAVE:
3776 return REBAR_MouseLeave (infoPtr);
3777
3778 case WM_NCCALCSIZE:
3779 return REBAR_NCCalcSize (infoPtr, (RECT*)lParam);
3780
3781 case WM_NCCREATE:
3783
3784 case WM_NCHITTEST:
3785 return REBAR_NCHitTest (infoPtr, lParam);
3786
3787 case WM_NCPAINT:
3788 return REBAR_NCPaint (infoPtr);
3789
3790 case WM_NOTIFYFORMAT:
3791 return REBAR_NotifyFormat (infoPtr, lParam);
3792
3793 case WM_PRINTCLIENT:
3794 case WM_PAINT:
3795 return REBAR_Paint (infoPtr, (HDC)wParam);
3796
3797/* case WM_PALETTECHANGED: supported according to ControlSpy */
3798/* case WM_QUERYNEWPALETTE:supported according to ControlSpy */
3799/* case WM_RBUTTONDOWN: supported according to ControlSpy */
3800/* case WM_RBUTTONUP: supported according to ControlSpy */
3801
3802 case WM_SETCURSOR:
3803 return REBAR_SetCursor (infoPtr, lParam);
3804
3805 case WM_SETFONT:
3806 return REBAR_SetFont (infoPtr, (HFONT)wParam);
3807
3808 case WM_SETREDRAW:
3809 return REBAR_SetRedraw (infoPtr, wParam);
3810
3811 case WM_SIZE:
3812 return REBAR_Size (infoPtr, wParam, lParam);
3813
3814 case WM_STYLECHANGED:
3815 return REBAR_StyleChanged (infoPtr, wParam, (LPSTYLESTRUCT)lParam);
3816
3817 case WM_THEMECHANGED:
3818 return theme_changed (infoPtr);
3819
3820 case WM_SYSCOLORCHANGE:
3822#ifdef __REACTOS__
3823 /* r51522 - Properly support WM_SYSCOLORCHANGE */
3826#endif
3827 return 0;
3828
3829/* case WM_VKEYTOITEM: supported according to ControlSpy */
3830/* case WM_WININICHANGE: */
3831
3833 return REBAR_WindowPosChanged (infoPtr, wParam, lParam);
3834
3835 default:
3836 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
3837 ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
3838 uMsg, wParam, lParam);
3839 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
3840 }
3841}
3842
3843
3844VOID
3846{
3847 WNDCLASSW wndClass;
3848
3849 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
3850 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
3851 wndClass.lpfnWndProc = REBAR_WindowProc;
3852 wndClass.cbClsExtra = 0;
3853 wndClass.cbWndExtra = sizeof(REBAR_INFO *);
3854 wndClass.hCursor = 0;
3855 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
3856#if GLATESTING
3857 wndClass.hbrBackground = CreateSolidBrush(RGB(0,128,0));
3858#endif
3859 wndClass.lpszClassName = REBARCLASSNAMEW;
3860
3861 RegisterClassW (&wndClass);
3862
3865
3866}
3867
3868
3869VOID
3871{
3873}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
Arabic default style
Definition: afstyles.h:94
static const char * wine_dbgstr_point(const POINT *ppt)
Definition: atltest.h:138
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
static const WCHAR szClassName[]
Definition: clipbrd.c:11
RECT rect
Definition: combotst.c:67
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
INT Str_GetPtrWtoA(LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1759
BOOL Str_SetPtrAtoW(LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1597
INT WINAPI Str_GetPtrW(LPCWSTR, LPWSTR, INT)
Definition: string.c:200
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
BOOL WINAPI _TrackMouseEvent(TRACKMOUSEEVENT *ptme)
Definition: commctrl.c:1218
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LPVOID WINAPI DPA_DeletePtr(HDPA hdpa, INT i)
Definition: dpa.c:677
BOOL WINAPI DPA_Destroy(HDPA hdpa)
Definition: dpa.c:396
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
INT WINAPI DPA_InsertPtr(HDPA hdpa, INT i, LPVOID p)
Definition: dpa.c:591
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1246
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2055
#define REBAR_POST_TEXT
Definition: rebar.c:214
static void REBAR_HandleUDDrag(REBAR_INFO *infoPtr, const POINT *ptsmove)
Definition: rebar.c:2124
static LRESULT REBAR_GetBarInfo(const REBAR_INFO *infoPtr, LPREBARINFO lpInfo)
Definition: rebar.c:2374
#define DRAW_IMAGE
Definition: rebar.c:148
static LRESULT REBAR_SetCursor(const REBAR_INFO *infoPtr, LPARAM lParam)
Definition: rebar.c:3475
#define HIDDENBAND(a)
Definition: rebar.c:251
#define SELF_RESIZE
Definition: rebar.c:192
static LRESULT WINAPI REBAR_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: rebar.c:3617
static void translate_rect(const REBAR_INFO *infoPtr, RECT *dest, const RECT *src)
Definition: rebar.c:438
static LRESULT REBAR_GetBandInfoT(const REBAR_INFO *infoPtr, UINT uIndex, LPREBARBANDINFOW lprbbi, BOOL bUnicode)
Definition: rebar.c:2283
static LRESULT REBAR_SetVersion(REBAR_INFO *infoPtr, INT iVersion)
Definition: rebar.c:2901
#define REBAR_PRE_GRIPPER
Definition: rebar.c:220
static LRESULT REBAR_IdToIndex(const REBAR_INFO *infoPtr, UINT uId)
Definition: rebar.c:2514
static LRESULT REBAR_Create(REBAR_INFO *infoPtr, LPCREATESTRUCTW cs)
Definition: rebar.c:2973
static LRESULT REBAR_NCCalcSize(const REBAR_INFO *infoPtr, RECT *rect)
Definition: rebar.c:3260
static UINT mindragy
Definition: rebar.c:270
static LRESULT REBAR_GetRect(const REBAR_INFO *infoPtr, INT iBand, RECT *lprc)
Definition: rebar.c:2418
static VOID REBAR_ForceResize(REBAR_INFO *infoPtr)
Definition: rebar.c:962
static UINT mindragx
Definition: rebar.c:269
#define REBAR_ALWAYS_SPACE
Definition: rebar.c:208
static HWND REBAR_GetNotifyParent(const REBAR_INFO *infoPtr)
Definition: rebar.c:514
static VOID REBAR_MoveChildWindows(const REBAR_INFO *infoPtr, UINT start, UINT endplus)
Definition: rebar.c:1031
static CHAR * REBAR_FmtStyle(char *buffer, UINT style)
Definition: rebar.c:308
static int REBAR_ShrinkBandsRTL(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
Definition: rebar.c:1219
static LRESULT REBAR_SetRedraw(REBAR_INFO *infoPtr, BOOL redraw)
Definition: rebar.c:3531
static VOID REBAR_DumpBandInfo(const REBARBANDINFOW *pB)
Definition: rebar.c:342
static LRESULT REBAR_SetTextColor(REBAR_INFO *infoPtr, COLORREF clr)
Definition: rebar.c:2869
static LRESULT REBAR_SetBkColor(REBAR_INFO *infoPtr, COLORREF clr)
Definition: rebar.c:2840
static LRESULT REBAR_GetRowCount(const REBAR_INFO *infoPtr)
Definition: rebar.c:2438
#define RB_GETBANDINFO_OLD
Definition: rebar.c:248
static REBAR_BAND * REBAR_GetBand(const REBAR_INFO *infoPtr, INT i)
Definition: rebar.c:261
static LRESULT REBAR_GetBandCount(const REBAR_INFO *infoPtr)
Definition: rebar.c:2274
static int get_rect_cx(const REBAR_INFO *infoPtr, const RECT *lpRect)
Definition: rebar.c:454
static LRESULT REBAR_LButtonDown(REBAR_INFO *infoPtr, LPARAM lParam)
Definition: rebar.c:3073
static LRESULT REBAR_GetTextColor(const REBAR_INFO *infoPtr)
Definition: rebar.c:2468
static LRESULT REBAR_InsertBandT(REBAR_INFO *infoPtr, INT iIndex, const REBARBANDINFOW *lprbbi, BOOL bUnicode)
Definition: rebar.c:2534
#define NTF_INVALIDATE
Definition: rebar.c:152
static LRESULT REBAR_SizeToRect(REBAR_INFO *infoPtr, const RECT *lpRect)
Definition: rebar.c:2950
static CHAR * REBAR_FmtMask(char *buffer, UINT mask)
Definition: rebar.c:325
#define HAS_TEXT
Definition: rebar.c:144
static LRESULT REBAR_ShowBand(REBAR_INFO *infoPtr, INT iBand, BOOL show)
Definition: rebar.c:2917
static LRESULT REBAR_MouseLeave(REBAR_INFO *infoPtr)
Definition: rebar.c:3140
VOID REBAR_Unregister(void)
Definition: rebar.c:3870
static int get_row_end_for_band(const REBAR_INFO *infoPtr, INT iBand)
Definition: rebar.c:1165
#define REBAR_DIVIDER
Definition: rebar.c:234
static int REBAR_MoveBandToRowOffset(REBAR_INFO *infoPtr, INT iBand, INT iFirstBand, INT iLastBand, INT xOff, BOOL reorder)
Definition: rebar.c:1265
static LRESULT REBAR_GetFont(const REBAR_INFO *infoPtr)
Definition: rebar.c:3035
static BOOL REBAR_strdifW(LPCWSTR a, LPCWSTR b)
Definition: rebar.c:2749
static LRESULT REBAR_HitTest(const REBAR_INFO *infoPtr, LPRBHITTESTINFO lprbht)
Definition: rebar.c:2502
static const char *const band_maskname[]
Definition: rebar.c:287
static void REBAR_DrawChevron(HDC hdc, INT left, INT top, INT colorRef)
Definition: rebar.c:494
#define RBBS_UNDOC_FIXEDHEADER
Definition: rebar.c:196
#define HAS_IMAGE
Definition: rebar.c:143
static LRESULT REBAR_GetToolTips(const REBAR_INFO *infoPtr)
Definition: rebar.c:2477
static LRESULT REBAR_PushChevron(const REBAR_INFO *infoPtr, UINT uBand, LPARAM lParam)
Definition: rebar.c:3041
#define REBARSPACE(a)
Definition: rebar.c:244
static LRESULT REBAR_SetParent(REBAR_INFO *infoPtr, HWND parent)
Definition: rebar.c:2858
static int REBAR_ShrinkBandsLTR(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
Definition: rebar.c:1243
static LRESULT REBAR_EraseBkGnd(const REBAR_INFO *infoPtr, HDC hdc)
Definition: rebar.c:1851
static int REBAR_SizeChildrenToHeight(const REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, int extra, BOOL *fChanged)
Definition: rebar.c:1479
static INT REBAR_Notify_NMREBAR(const REBAR_INFO *infoPtr, UINT uBand, UINT code)
Definition: rebar.c:544
#define GRIPPER_HEIGHT
Definition: rebar.c:217
#define CCS_LAYOUT_MASK
Definition: rebar.c:139
#define BAND_NEEDS_REDRAW
Definition: rebar.c:193
static LRESULT REBAR_DeleteBand(REBAR_INFO *infoPtr, WPARAM wParam)
Definition: rebar.c:2198
static VOID REBAR_ValidateBand(const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
Definition: rebar.c:1607
static LRESULT REBAR_Destroy(REBAR_INFO *infoPtr)
Definition: rebar.c:2998
static LRESULT REBAR_GetBkColor(const REBAR_INFO *infoPtr)
Definition: rebar.c:2391
static LRESULT REBAR_GetPalette(const REBAR_INFO *infoPtr)
Definition: rebar.c:2409
static VOID REBAR_CalcVertBand(const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
Definition: rebar.c:847
#define BEGIN_DRAG_ISSUED
Definition: rebar.c:191
#define DRAW_CHEVRONHOT
Definition: rebar.c:150
static VOID REBAR_Layout(REBAR_INFO *infoPtr)
Definition: rebar.c:1396
static int round_child_height(const REBAR_BAND *lpBand, int cyHeight)
Definition: rebar.c:468
static int get_row_begin_for_band(const REBAR_INFO *infoPtr, INT iBand)
Definition: rebar.c:1151
#define GLATESTING
Definition: rebar.c:71
static LRESULT REBAR_NCHitTest(const REBAR_INFO *infoPtr, LPARAM lParam)
Definition: rebar.c:3355
static LRESULT REBAR_MinimizeBand(const REBAR_INFO *infoPtr, INT iBand)
Definition: rebar.c:2654
static LRESULT REBAR_GetBandBorders(const REBAR_INFO *infoPtr, UINT uBand, RECT *lpRect)
Definition: rebar.c:2236
#define CHEVRON_WIDTH
Definition: rebar.c:227
static LRESULT REBAR_NotifyFormat(REBAR_INFO *infoPtr, LPARAM lParam)
Definition: rebar.c:3431
static VOID REBAR_DumpBand(const REBAR_INFO *iP)
Definition: rebar.c:377
#define GRIPPER_WIDTH
Definition: rebar.c:224
static LRESULT REBAR_WindowPosChanged(const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: rebar.c:3603
#define REBAR_GetInfoPtr(wndPtr)
Definition: rebar.c:255
static LRESULT REBAR_SetBandInfoT(REBAR_INFO *infoPtr, INT iBand, const REBARBANDINFOW *lprbbi, BOOL bUnicode)
Definition: rebar.c:2755
static int get_rect_cy(const REBAR_INFO *infoPtr, const RECT *lpRect)
Definition: rebar.c:461
static VOID REBAR_SizeToHeight(REBAR_INFO *infoPtr, int height)
Definition: rebar.c:1510
#define SEP_WIDTH
Definition: rebar.c:204
static LRESULT REBAR_SetBarInfo(REBAR_INFO *infoPtr, const REBARINFO *lpInfo)
Definition: rebar.c:2803
static const char *const band_stylename[]
Definition: rebar.c:272
static LRESULT REBAR_GetVersion(const REBAR_INFO *infoPtr)
Definition: rebar.c:2494
#define DRAW_TEXT
Definition: rebar.c:149
static const WCHAR themeClass[]
Definition: rebar.c:305
static LRESULT REBAR_NCPaint(const REBAR_INFO *infoPtr)
Definition: rebar.c:3394
static LRESULT REBAR_GetBarHeight(const REBAR_INFO *infoPtr)
Definition: rebar.c:2361
static int next_visible(const REBAR_INFO *infoPtr, int i)
Definition: rebar.c:1124
VOID REBAR_Register(void)
Definition: rebar.c:3845
static void REBAR_SetRowRectsX(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
Definition: rebar.c:1176
static LRESULT REBAR_MouseMove(REBAR_INFO *infoPtr, LPARAM lParam)
Definition: rebar.c:3158
static void update_min_band_height(const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
Definition: rebar.c:487
static VOID REBAR_Refresh(const REBAR_INFO *infoPtr, HDC hdc)
Definition: rebar.c:709
static LRESULT REBAR_NCCreate(HWND hwnd, const CREATESTRUCTW *cs)
Definition: rebar.c:3285
#define DRAW_GRIPPER
Definition: rebar.c:147
static LRESULT REBAR_GetRowHeight(const REBAR_INFO *infoPtr, INT iRow)
Definition: rebar.c:2447
static int REBAR_SetBandsHeight(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT yStart)
Definition: rebar.c:1316
static LRESULT REBAR_GetUnicodeFormat(const REBAR_INFO *infoPtr)
Definition: rebar.c:2484
static LRESULT REBAR_Paint(const REBAR_INFO *infoPtr, HDC hdc)
Definition: rebar.c:3450
static UINT REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBand)
Definition: rebar.c:1721
static void REBAR_InternalHitTest(const REBAR_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pBand)
Definition: rebar.c:1978
static LRESULT REBAR_StyleChanged(REBAR_INFO *infoPtr, INT nType, const STYLESTRUCT *lpStyle)
Definition: rebar.c:3573
static void REBAR_AutoSize(REBAR_INFO *infoPtr, BOOL needsLayout)
Definition: rebar.c:1588
static LRESULT REBAR_MoveBand(REBAR_INFO *infoPtr, INT iFrom, INT iTo)
Definition: rebar.c:2713
static REBAR_BAND * REBAR_FindBandToGrow(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
Definition: rebar.c:1198
static LRESULT REBAR_MaximizeBand(const REBAR_INFO *infoPtr, INT iBand, LPARAM lParam)
Definition: rebar.c:2601
static INT REBAR_Notify(NMHDR *nmhdr, const REBAR_INFO *infoPtr, UINT code)
Definition: rebar.c:529
static VOID REBAR_DrawBand(HDC hdc, const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
Definition: rebar.c:570
static LRESULT REBAR_Size(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: rebar.c:3551
static void REBAR_HandleLRDrag(REBAR_INFO *infoPtr, const POINT *ptsmove)
Definition: rebar.c:2057
static LRESULT REBAR_SetFont(REBAR_INFO *infoPtr, HFONT font)
Definition: rebar.c:3502
static void REBAR_CalcHorzBand(const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
Definition: rebar.c:730
#define DRAW_CHEVRONPUSHED
Definition: rebar.c:151
#define REBAR_NO_CHILD_HEIGHT
Definition: rebar.c:237
#define REBAR_POST_CHILD
Definition: rebar.c:230
static LRESULT theme_changed(REBAR_INFO *infoPtr)
Definition: rebar.c:3590
#define HAS_GRIPPER
Definition: rebar.c:142
static int first_visible(const REBAR_INFO *infoPtr)
Definition: rebar.c:1145
static LRESULT REBAR_SetUnicodeFormat(REBAR_INFO *infoPtr, BOOL unicode)
Definition: rebar.c:2886
static void REBAR_LayoutRow(const REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, int cx, int *piRow, int *pyPos)
Definition: rebar.c:1353
#define REBAR_POST_IMAGE
Definition: rebar.c:211
#define SEP_WIDTH_SIZE
Definition: rebar.c:203
static int prev_visible(const REBAR_INFO *infoPtr, int i)
Definition: rebar.c:1135
static LRESULT REBAR_LButtonUp(REBAR_INFO *infoPtr)
Definition: rebar.c:3111
#define COMCTL32_VERSION
Definition: resource.h:72
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:232
#define TRACE_ON(x)
Definition: compat.h:75
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
#define assert(_expr)
Definition: assert.h:32
HRESULT WINAPI DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pDestRect, UINT uEdge, UINT uFlags, RECT *pContentRect)
Definition: draw.c:1342
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: draw.c:1927
HRESULT WINAPI GetThemeBackgroundExtent(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pContentRect, RECT *pExtentRect)
Definition: draw.c:1572
HRESULT WINAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect)
Definition: draw.c:1500
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:920
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:1036
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
Definition: system.c:890
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
#define RGB(r, g, b)
Definition: precomp.h:67
return ret
Definition: mutex.c:147
r parent
Definition: btrfs.c:3010
#define WM_APP
Definition: eventvwr.h:73
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble n
Definition: glext.h:7729
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLint left
Definition: glext.h:7726
GLbitfield flags
Definition: glext.h:7161
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
unsigned int UINT
Definition: sysinfo.c:13
#define cs
Definition: i386-dis.c:442
@ extra
Definition: id3.c:95
#define debugstr_w
Definition: kernel32.h:32
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static char * dest
Definition: rtl.c:149
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define min(a, b)
Definition: monoChain.cc:55
Definition: mk_font.cpp:20
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define LRESULT
Definition: ole.h:14
#define LOWORD(l)
Definition: pedump.c:82
short WCHAR
Definition: pedump.c:58
#define WS_BORDER
Definition: pedump.c:625
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_VISIBLE
Definition: pedump.c:620
char CHAR
Definition: pedump.c:57
#define RBBIM_IMAGE
Definition: commctrl.h:1505
#define RB_SETTEXTCOLOR
Definition: commctrl.h:1593
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:286
#define RBSTR_CHANGERECT
Definition: commctrl.h:1596
#define RBN_CHILDSIZE
Definition: commctrl.h:1636
#define RB_SETBANDINFOA
Definition: commctrl.h:1579
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define RB_SETBANDINFOW
Definition: commctrl.h:1584
#define RB_GETROWCOUNT
Definition: commctrl.h:1586
#define RB_GETBARHEIGHT
Definition: commctrl.h:1608
#define RBN_BEGINDRAG
Definition: commctrl.h:1632
#define RBBS_BREAK
Definition: commctrl.h:1489
#define TME_LEAVE
Definition: commctrl.h:4998
#define REBARBANDINFOW_V6_SIZE
Definition: commctrl.h:1542
#define RB_DELETEBAND
Definition: commctrl.h:1576
#define REBARBANDINFOA_V3_SIZE
Definition: commctrl.h:1539
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define RB_SETUNICODEFORMAT
Definition: commctrl.h:1622
#define REBARCLASSNAMEW
Definition: commctrl.h:1463
#define RBN_ENDDRAG
Definition: commctrl.h:1633
#define RBN_DELETEDBAND
Definition: commctrl.h:1635
#define RBBIM_CHILDSIZE
Definition: commctrl.h:1507
#define RBN_DELETINGBAND
Definition: commctrl.h:1634
#define RB_INSERTBANDW
Definition: commctrl.h:1583
#define RBBIM_BACKGROUND
Definition: commctrl.h:1509
#define RB_GETUNICODEFORMAT
Definition: commctrl.h:1623
#define RB_GETTEXTCOLOR
Definition: commctrl.h:1594
#define CCS_BOTTOM
Definition: commctrl.h:2249
#define CLR_NONE
Definition: commctrl.h:319
#define CCM_GETVERSION
Definition: commctrl.h:115
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define RBS_BANDBORDERS
Definition: commctrl.h:1472
#define RBN_HEIGHTCHANGE
Definition: commctrl.h:1628
#define RBHT_CAPTION
Definition: commctrl.h:1692
#define RB_INSERTBANDA
Definition: commctrl.h:1575
#define RB_MINIMIZEBAND
Definition: commctrl.h:1614
#define RB_PUSHCHEVRON
Definition: commctrl.h:1626
#define RBBIM_CHILD
Definition: commctrl.h:1506
#define RB_MAXIMIZEBAND
Definition: commctrl.h:1615
_Out_opt_ int * cx
Definition: commctrl.h:585
#define WC_COMBOBOXEXW
Definition: commctrl.h:3786
#define RBHT_NOWHERE
Definition: commctrl.h:1691
#define RB_GETBANDBORDERS
Definition: commctrl.h:1617
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define RBIM_IMAGELIST
Definition: commctrl.h:1468
#define RB_GETRECT
Definition: commctrl.h:1582
#define RB_GETBARINFO
Definition: commctrl.h:1577
#define RBS_AUTOSIZE
Definition: commctrl.h:1475
#define CCS_VERT
Definition: commctrl.h:2254
#define RBNM_ID
Definition: commctrl.h:1658
#define RBBS_FIXEDSIZE
Definition: commctrl.h:1490
#define RBBS_NOGRIPPER
Definition: commctrl.h:1497
#define RB_GETBANDINFOW
Definition: commctrl.h:1609
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define RBNM_STYLE
Definition: commctrl.h:1659
#define RB_SETBKCOLOR
Definition: commctrl.h:1591
#define RB_GETBANDINFOA
Definition: commctrl.h:1610
#define RBN_LAYOUTCHANGED
Definition: commctrl.h:1630
#define NM_NCHITTEST
Definition: commctrl.h:139
#define RBHT_GRABBER
Definition: commctrl.h:1694
#define ILD_TRANSPARENT
Definition: commctrl.h:418
#define RB_SHOWBAND
Definition: commctrl.h:1618
#define CCS_NODIVIDER
Definition: commctrl.h:2253
#define CCS_TOP
Definition: commctrl.h:2247
#define WM_MOUSELEAVE
Definition: commctrl.h:4992
#define RBN_AUTOSIZE
Definition: commctrl.h:1631
#define CLR_DEFAULT
Definition: commctrl.h:320
#define RB_IDTOINDEX
Definition: commctrl.h:1588
#define REBARBANDINFOA_V6_SIZE
Definition: commctrl.h:1541
#define RBBS_HIDDEN
Definition: commctrl.h:1492
#define CCM_SETVERSION
Definition: commctrl.h:114
#define RBHT_CLIENT
Definition: commctrl.h:1693
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
#define RBBIM_ID
Definition: commctrl.h:1510
#define RBBIM_LPARAM
Definition: commctrl.h:1512
#define RB_SIZETORECT
Definition: commctrl.h:1598
#define RB_GETTOOLTIPS
Definition: commctrl.h:1589
#define RBS_VARHEIGHT
Definition: commctrl.h:1471
#define RBN_CHEVRONPUSHED
Definition: commctrl.h:1637
#define RBNM_LPARAM
Definition: commctrl.h:1660
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2251
#define RB_GETPALETTE
Definition: commctrl.h:1620
#define CCS_NORESIZE
Definition: commctrl.h:2250
#define TME_QUERY
Definition: commctrl.h:5000
#define RBBS_HIDETITLE
Definition: commctrl.h:1499
#define RB_MOVEBAND
Definition: commctrl.h:1621
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
#define CCS_NOMOVEY
Definition: commctrl.h:2248
#define RBBIM_STYLE
Definition: commctrl.h:1502
#define RB_SETBARINFO
Definition: commctrl.h:1578
#define RB_GETBKCOLOR
Definition: commctrl.h:1592
#define RBBIM_SIZE
Definition: commctrl.h:1508
#define RB_HITTEST
Definition: commctrl.h:1581
#define RBBIM_TEXT
Definition: commctrl.h:1504
#define RBBIM_COLORS
Definition: commctrl.h:1503
#define RB_SETPARENT
Definition: commctrl.h:1580
#define RBBIM_HEADERSIZE
Definition: commctrl.h:1513
#define RB_GETROWHEIGHT
Definition: commctrl.h:1587
#define RBBS_USECHEVRON
Definition: commctrl.h:1498
#define RB_GETBANDCOUNT
Definition: commctrl.h:1585
#define RBBS_GRIPPERALWAYS
Definition: commctrl.h:1496
#define RBS_VERTICALGRIPPER
Definition: commctrl.h:1476
#define RBBS_VARIABLEHEIGHT
Definition: commctrl.h:1495
#define RBHT_CHEVRON
Definition: commctrl.h:1695
#define RBBIM_IDEALSIZE
Definition: commctrl.h:1511
void redraw(int x, int y, int cx, int cy)
Definition: qtewin.cpp:1248
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_NOTIFY
Definition: richedit.h:61
strcat
Definition: string.h:92
#define memset(x, y, z)
Definition: compat.h:39
static const char *static const char const char DWORD void DWORD *static const char const char DWORD void DWORD *static const char DWORD DWORD void * buff
Definition: shcore.c:41
#define TRACE(s)
Definition: solgame.cpp:4
COLORREF clrBtnText
Definition: comctl32.h:173
COLORREF clrBtnFace
Definition: comctl32.h:174
UINT cxMinBand
Definition: rebar.c:119
UINT cyMaxChild
Definition: rebar.c:111
UINT fStatus
Definition: rebar.c:124
UINT cxMinChild
Definition: rebar.c:105
INT iRow
Definition: rebar.c:123
LPARAM lParam
Definition: rebar.c:114
RECT rcChild
Definition: rebar.c:131
RECT rcGripper
Definition: rebar.c:128
HWND hwndChild
Definition: rebar.c:104
UINT cyIntegral
Definition: rebar.c:112
UINT fStyle
Definition: rebar.c:99
UINT uCDret
Definition: rebar.c:126
LPWSTR lpText
Definition: rebar.c:134
UINT cyMinChild
Definition: rebar.c:106
UINT cxIdeal
Definition: rebar.c:113
RECT rcCapText
Definition: rebar.c:130
RECT rcCapImage
Definition: rebar.c:129
RECT rcBand
Definition: rebar.c:127
HWND hwndPrevParent
Definition: rebar.c:135
COLORREF clrFore
Definition: rebar.c:101
INT iImage
Definition: rebar.c:103
RECT rcChevron
Definition: rebar.c:132
UINT cyHeader
Definition: rebar.c:118
UINT cyMinBand
Definition: rebar.c:120
HBITMAP hbmBack
Definition: rebar.c:108
COLORREF clrBack
Definition: rebar.c:102
UINT cyChild
Definition: rebar.c:110
UINT cyRowSoFar
Definition: rebar.c:122
UINT cx
Definition: rebar.c:107
UINT wID
Definition: rebar.c:109
UINT fMask
Definition: rebar.c:100
UINT fDraw
Definition: rebar.c:125
INT cxEffective
Definition: rebar.c:117
UINT cxHeader
Definition: rebar.c:115
HCURSOR hcurDrag
Definition: rebar.c:178
SIZE imageSize
Definition: rebar.c:168
HFONT hDefaultFont
Definition: rebar.c:166
HCURSOR hcurArrow
Definition: rebar.c:175
HIMAGELIST himl
Definition: rebar.c:160
BOOL bUnicode
Definition: rebar.c:172
COLORREF clrBk
Definition: rebar.c:156
HCURSOR hcurHorz
Definition: rebar.c:176
HWND hwndSelf
Definition: rebar.c:163
INT iGrabbedBand
Definition: rebar.c:185
COLORREF clrBtnFace
Definition: rebar.c:159
INT iOldBand
Definition: rebar.c:182
INT ihitoffset
Definition: rebar.c:183
POINT dragNow
Definition: rebar.c:181
POINT dragStart
Definition: rebar.c:180
HCURSOR hcurVert
Definition: rebar.c:177
UINT uNumBands
Definition: rebar.c:161
HDPA bands
Definition: rebar.c:187
COLORREF clrBtnText
Definition: rebar.c:158
INT iVersion
Definition: rebar.c:179
HFONT hFont
Definition: rebar.c:167
INT ichevronhotBand
Definition: rebar.c:184
COLORREF clrText
Definition: rebar.c:157
UINT uNumRows
Definition: rebar.c:162
HWND hwndNotify
Definition: rebar.c:165
SIZE calcSize
Definition: rebar.c:171
BOOL DoRedraw
Definition: rebar.c:173
HWND hwndToolTip
Definition: rebar.c:164
DWORD orgStyle
Definition: rebar.c:170
UINT fStatus
Definition: rebar.c:174
DWORD dwStyle
Definition: rebar.c:169
Definition: dpa.c:49
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
LPCWSTR lpszClassName
Definition: winuser.h:3293
HBRUSH hbrBackground
Definition: winuser.h:3291
int cbClsExtra
Definition: winuser.h:3286
UINT style
Definition: winuser.h:3284
WNDPROC lpfnWndProc
Definition: winuser.h:3285
int cbWndExtra
Definition: winuser.h:3287
HCURSOR hCursor
Definition: winuser.h:3290
Definition: ftp_var.h:139
Definition: inflate.c:139
DWORD_PTR dwItemSpec
Definition: commctrl.h:307
UINT_PTR idFrom
Definition: winuser.h:3266
UINT code
Definition: winuser.h:3267
HWND hwndFrom
Definition: winuser.h:3265
POINT pt
Definition: commctrl.h:166
DWORD_PTR dwItemData
Definition: commctrl.h:165
DWORD_PTR dwItemSpec
Definition: commctrl.h:164
LPARAM dwHitInfo
Definition: commctrl.h:167
DWORD dwMask
Definition: commctrl.h:1651
UINT fStyle
Definition: commctrl.h:1653
UINT wID
Definition: commctrl.h:1654
LPARAM lParam
Definition: commctrl.h:1655
UINT uBand
Definition: commctrl.h:1652
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
COLORREF clrBack
Definition: commctrl.h:1549
COLORREF clrFore
Definition: commctrl.h:1548
HIMAGELIST himl
Definition: commctrl.h:1483
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
DWORD styleNew
Definition: winuser.h:3801
DWORD styleOld
Definition: winuser.h:3800
#define max(a, b)
Definition: svc.c:63
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
@ CHEVS_PRESSED
Definition: vsstyle.h:1042
@ CHEVS_NORMAL
Definition: vsstyle.h:1040
@ CHEVS_HOT
Definition: vsstyle.h:1041
@ RP_CHEVRON
Definition: vsstyle.h:1030
@ RP_GRIPPER
Definition: vsstyle.h:1027
@ RP_GRIPPERVERT
Definition: vsstyle.h:1028
@ RP_BAND
Definition: vsstyle.h:1029
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DWORD COLORREF
Definition: windef.h:100
HICON HCURSOR
Definition: windef.h:99
#define WINAPI
Definition: msvc.h:6
#define DPA_GetPtr
Definition: commctrl.h:5
HGDIOBJ WINAPI GetStockObject(_In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define TRANSPARENT
Definition: wingdi.h:950
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
#define FW_NORMAL
Definition: wingdi.h:373
#define SYSTEM_FONT
Definition: wingdi.h:911
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define SW_SHOWNORMAL
Definition: winuser.h:781
#define WM_PAINT
Definition: winuser.h:1648
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define GW_OWNER
Definition: winuser.h:777
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1653
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:779
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define BDR_SUNKENOUTER
Definition: winuser.h:443
#define SM_CYEDGE
Definition: winuser.h:1020
#define SM_CXDRAG
Definition: winuser.h:1039
BOOL WINAPI DestroyCursor(_In_ HCURSOR)
Definition: cursoricon.c:3083
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define COLOR_WINDOWFRAME
Definition: winuser.h:930
#define DT_CENTER
Definition: winuser.h:527
#define DCX_WINDOW
Definition: winuser.h:2149
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SM_CXEDGE
Definition: winuser.h:1019
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define WM_CREATE
Definition: winuser.h:1636
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define WM_SIZE
Definition: winuser.h:1639
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_COMMAND
Definition: winuser.h:1768
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:695
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:3064
#define WM_NCHITTEST
Definition: winuser.h:1714
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define EDGE_ETCHED
Definition: winuser.h:452
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1803
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define RDW_UPDATENOW
Definition: winuser.h:1231
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define RDW_ERASE
Definition: winuser.h:1222
#define BF_MIDDLE
Definition: winuser.h:468
#define BF_BOTTOM
Definition: winuser.h:457
#define CS_DBLCLKS
Definition: winuser.h:659
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define NF_REQUERY
Definition: winuser.h:2497
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1654
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2474
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WM_GETFONT
Definition: winuser.h:1679
#define WM_DRAWITEM
Definition: winuser.h:1673
#define WM_NCCREATE
Definition: winuser.h:1711
#define HWND_DESKTOP
Definition: winuser.h:1220
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define IDC_SIZENS
Definition: winuser.h:703
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define HWND_TOP
Definition: winuser.h:1218
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_TOP
Definition: winuser.h:455
#define WM_SETFONT
Definition: winuser.h:1678
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define BF_RIGHT
Definition: winuser.h:456
#define BDR_RAISEDINNER
Definition: winuser.h:444
BOOL WINAPI UpdateWindow(_In_ HWND)
#define HTCLIENT
Definition: winuser.h:2511
HDC WINAPI GetDC(_In_opt_ HWND)
#define WM_MEASUREITEM
Definition: winuser.h:1674
#define WM_LBUTTONUP
Definition: winuser.h:1805
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define DT_VCENTER
Definition: winuser.h:543
HWND WINAPI GetParent(_In_ HWND)
#define CS_GLOBALCLASS
Definition: winuser.h:660
#define NFR_ANSI
Definition: winuser.h:2494
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4620
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
#define WM_SETCURSOR
Definition: winuser.h:1664
#define WM_USER
Definition: winuser.h:1923
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetDlgCtrlID(_In_ HWND)
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define SWP_NOZORDER
Definition: winuser.h:1258
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define IDC_SIZE
Definition: winuser.h:710
#define SetWindowLongPtrW
Definition: winuser.h:5512
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SM_CYDRAG
Definition: winuser.h:1040
#define NFR_UNICODE
Definition: winuser.h:2495
#define BF_RECT
Definition: winuser.h:462
#define WM_NCCALCSIZE
Definition: winuser.h:1713
#define GWL_STYLE
Definition: winuser.h:863
#define IDC_SIZEWE
Definition: winuser.h:702
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1690
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
int WINAPI GetSystemMetrics(_In_ int)
#define RDW_INVALIDATE
Definition: winuser.h:1225
#define NF_QUERY
Definition: winuser.h:2496
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_BTNFACE
Definition: winuser.h:939
#define WM_NCPAINT
Definition: winuser.h:1715
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HDWP WINAPI BeginDeferWindowPos(_In_ int)
#define WM_SETREDRAW
Definition: winuser.h:1644
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList