| 1 | /*
|
|---|
| 2 | * Testing: set to 1 to make background brush *always* green
|
|---|
| 3 | */
|
|---|
| 4 | #define GLATESTING 0
|
|---|
| 5 |
|
|---|
| 6 | /*
|
|---|
| 7 | *
|
|---|
| 8 | * 2. At "FIXME: problem # 2" WinRAR:
|
|---|
| 9 | * if "#if 1" then last band draws in separate row
|
|---|
| 10 | * if "#if 0" then last band draws in previous row *** just like native ***
|
|---|
| 11 | *
|
|---|
| 12 | */
|
|---|
| 13 | #define PROBLEM2 0
|
|---|
| 14 |
|
|---|
| 15 | /*
|
|---|
| 16 | * 3. REBAR_MoveChildWindows should have a loop because more than
|
|---|
| 17 | * one pass is made (together with the RBN_CHILDSIZEs) is made on
|
|---|
| 18 | * at least RB_INSERTBAND
|
|---|
| 19 | */
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | /*
|
|---|
| 23 | * Rebar control rev 8e
|
|---|
| 24 | *
|
|---|
| 25 | * Copyright 1998, 1999 Eric Kohl
|
|---|
| 26 | *
|
|---|
| 27 | * This library is free software; you can redistribute it and/or
|
|---|
| 28 | * modify it under the terms of the GNU Lesser General Public
|
|---|
| 29 | * License as published by the Free Software Foundation; either
|
|---|
| 30 | * version 2.1 of the License, or (at your option) any later version.
|
|---|
| 31 | *
|
|---|
| 32 | * This library is distributed in the hope that it will be useful,
|
|---|
| 33 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 35 | * Lesser General Public License for more details.
|
|---|
| 36 | *
|
|---|
| 37 | * You should have received a copy of the GNU Lesser General Public
|
|---|
| 38 | * License along with this library; if not, write to the Free Software
|
|---|
| 39 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 40 | *
|
|---|
| 41 | * NOTES
|
|---|
| 42 | * An author is needed! Any volunteers?
|
|---|
| 43 | * I will only improve this control once in a while.
|
|---|
| 44 | * Eric <ekohl@abo.rhein-zeitung.de>
|
|---|
| 45 | *
|
|---|
| 46 | * TODO:
|
|---|
| 47 | * - vertical placement
|
|---|
| 48 | * - ComboBox and ComboBoxEx placement
|
|---|
| 49 | * - center image
|
|---|
| 50 | * - Layout code.
|
|---|
| 51 | * - Display code.
|
|---|
| 52 | * - Some messages.
|
|---|
| 53 | * - All notifications.
|
|---|
| 54 |
|
|---|
| 55 | * Changes Guy Albertelli <galberte@neo.lrun.com>
|
|---|
| 56 | * rev 2,3,4
|
|---|
| 57 | * - Implement initial version of row grouping, row separators,
|
|---|
| 58 | * text and background colors. Support additional messages.
|
|---|
| 59 | * Support RBBS_BREAK. Implement ERASEBKGND and improve painting.
|
|---|
| 60 | * rev 5
|
|---|
| 61 | * - implement support for dragging Gripper left or right in a row. Supports
|
|---|
| 62 | * WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support
|
|---|
| 63 | * RBS_BANDBORDERS.
|
|---|
| 64 | * rev 6
|
|---|
| 65 | * - Fix or implement notifications for RBN_HEIGHTCHANGE, RBN_CHILDSIZE.
|
|---|
| 66 | * - Correct styles RBBS_NOGRIPPER, RBBS_GRIPPERALWAYS, and RBBS_FIXEDSIZE.
|
|---|
| 67 | * - Fix algorithm for Layout and AdjustBand.
|
|---|
| 68 | *
|
|---|
| 69 | * rev 7
|
|---|
| 70 | * - Fix algorithm for _Layout and _AdjustBand.
|
|---|
| 71 | * - Fix or implement RBN_ENDDRAG, RB_MOVEBAND, WM_SETREDRAW,
|
|---|
| 72 | * WM_STYLECHANGED, RB_MINIMIZEBAND, RBBS_VARIABLEHEIGHT, RBS_VARHEIGHT,
|
|---|
| 73 | * RBBS_HIDDEN, WM_NOTIFYFORMAT, NM_NCHITTEST, WM_SETREDRAW, RBS_AUTOSIZE,
|
|---|
| 74 | * WM_SETFONT, RBS_BORDERS
|
|---|
| 75 | * - Create structures in WM_NCCREATE
|
|---|
| 76 | * - Additional performance enhancements.
|
|---|
| 77 | *
|
|---|
| 78 | * rev 8
|
|---|
| 79 | * 1. Create array of start and end band indexes by row and use.
|
|---|
| 80 | * 2. Fix problem with REBAR_Layout Phase 2b to process only if only
|
|---|
| 81 | * band in row.
|
|---|
| 82 | * 3. Set the Caption Font (Regular) as default font for text.
|
|---|
| 83 | * 4. Delete font handle on control distruction.
|
|---|
| 84 | * 5. Add UpdateWindow call in _MoveChildWindows to match repainting done
|
|---|
| 85 | * by native control
|
|---|
| 86 | * 6. Improve some traces.
|
|---|
| 87 | * 7. Invalidate window rectangles after SetBandInfo, InsertBand, ShowBand
|
|---|
| 88 | * so that repainting is correct.
|
|---|
| 89 | * 8. Implement RB_MAXIMIZEBAND for the "ideal=TRUE" case.
|
|---|
| 90 | * 9. Implement item custom draw notifications partially. Only done for
|
|---|
| 91 | * ITEMPREPAINT and ITEMPOSTPAINT. (Used by IE4 for "Favorites" frame
|
|---|
| 92 | * to draw the word "Favorites").
|
|---|
| 93 | * rev 8a
|
|---|
| 94 | * 10. Handle CCS_NODIVIDER and fix WS_BORDER code.
|
|---|
| 95 | * 11. Fix logic error in _AdjustBands where flag was set to valid band
|
|---|
| 96 | * number (0) to indicate *no* band.
|
|---|
| 97 | * 12. Fix CCS_VERT errors in _ForceResize, _NCCalcSize, and _NCPaint.
|
|---|
| 98 | * 13. Support some special cases of CCS_TOP (and therefore CCS_LEFT),
|
|---|
| 99 | * CCS_BOTTOM (and therefore CCS_RIGHT) and CCS_NOPARENTALIGN. Not
|
|---|
| 100 | * at all sure whether this is all cases.
|
|---|
| 101 | * 14. Handle returned value for the RBN_CHILDSIZE notify.
|
|---|
| 102 | * 15. Implement RBBS_CHILDEDGE, and set each bands "offChild" at _Layout
|
|---|
| 103 | * time.
|
|---|
| 104 | * 16. Fix REBARSPACE. It should depend on CCS_NODIVIDER.
|
|---|
| 105 | * rev 8b
|
|---|
| 106 | * 17. Fix determination of whether Gripper is needed in _ValidateBand.
|
|---|
| 107 | * 18. Fix _AdjustBand processing of RBBS_FIXEDSIZE.
|
|---|
| 108 | * rev 8c
|
|---|
| 109 | * 19. Fix problem in _Layout when all lengths are 0.
|
|---|
| 110 | * 20. If CLR_NONE specified, we will use default BtnFace color when drawing.
|
|---|
| 111 | * 21. Fix test in REBAR_Layout.
|
|---|
| 112 | * rev 8d
|
|---|
| 113 | * 22. Add support for WM_WINDOWPOSCHANGED to save new origin of window.
|
|---|
| 114 | * 23. Correct RBN_CHILDSIZE rect value for CCS_VERT rebar.
|
|---|
| 115 | * 24. Do UpdateWindow only if doing redraws.
|
|---|
| 116 | * rev 8e
|
|---|
| 117 | * 25. Adjust setting of offChild.cx based on RBBS_CHILDEDGE.
|
|---|
| 118 | *
|
|---|
| 119 | *
|
|---|
| 120 | * Still to do:
|
|---|
| 121 | * 2. Following still not handled: RBBS_FIXEDBMP,
|
|---|
| 122 | * CCS_NORESIZE,
|
|---|
| 123 | * CCS_NOMOVEX, CCS_NOMOVEY
|
|---|
| 124 | * 3. Following are only partially handled:
|
|---|
| 125 | * RBS_AUTOSIZE, RBBS_VARIABLEHEIGHT
|
|---|
| 126 | * 5. Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT)
|
|---|
| 127 | * to set the size of the separator width (the value SEP_WIDTH_SIZE
|
|---|
| 128 | * in here). Should be fixed!!
|
|---|
| 129 | * 6. The following messages are not implemented:
|
|---|
| 130 | * RB_BEGINDRAG, RB_DRAGMOVE, RB_ENDDRAG, RB_GETCOLORSCHEME,
|
|---|
| 131 | * RB_GETDROPTARGET, RB_MAXIMIZEBAND,
|
|---|
| 132 | * RB_SETCOLORSCHEME, RB_SETPALETTE, RB_SETTOOLTIPS
|
|---|
| 133 | * WM_CHARTOITEM, WM_LBUTTONDBLCLK, WM_MEASUREITEM,
|
|---|
| 134 | * WM_PALETTECHANGED, WM_PRINTCLIENT, WM_QUERYNEWPALETTE,
|
|---|
| 135 | * WM_RBUTTONDOWN, WM_RBUTTONUP,
|
|---|
| 136 | * WM_SYSCOLORCHANGE, WM_VKEYTOITEM, WM_WININICHANGE
|
|---|
| 137 | * 7. The following notifications are not implemented:
|
|---|
| 138 | * NM_CUSTOMDRAW, NM_RELEASEDCAPTURE
|
|---|
| 139 | * RBN_MINMAX
|
|---|
| 140 | */
|
|---|
| 141 |
|
|---|
| 142 | #include <stdarg.h>
|
|---|
| 143 | #include <stdlib.h>
|
|---|
| 144 | #include <string.h>
|
|---|
| 145 |
|
|---|
| 146 | #include "windef.h"
|
|---|
| 147 | #include "winbase.h"
|
|---|
| 148 | #include "wingdi.h"
|
|---|
| 149 | #include "wine/unicode.h"
|
|---|
| 150 | #include "winuser.h"
|
|---|
| 151 | #include "winnls.h"
|
|---|
| 152 | #include "commctrl.h"
|
|---|
| 153 | #include "comctl32.h"
|
|---|
| 154 | #include "wine/debug.h"
|
|---|
| 155 |
|
|---|
| 156 | WINE_DEFAULT_DEBUG_CHANNEL(rebar);
|
|---|
| 157 |
|
|---|
| 158 | typedef struct
|
|---|
| 159 | {
|
|---|
| 160 | UINT fStyle;
|
|---|
| 161 | UINT fMask;
|
|---|
| 162 | COLORREF clrFore;
|
|---|
| 163 | COLORREF clrBack;
|
|---|
| 164 | INT iImage;
|
|---|
| 165 | HWND hwndChild;
|
|---|
| 166 | UINT cxMinChild; /* valid if _CHILDSIZE */
|
|---|
| 167 | UINT cyMinChild; /* valid if _CHILDSIZE */
|
|---|
| 168 | UINT cx; /* valid if _SIZE */
|
|---|
| 169 | HBITMAP hbmBack;
|
|---|
| 170 | UINT wID;
|
|---|
| 171 | UINT cyChild; /* valid if _CHILDSIZE */
|
|---|
| 172 | UINT cyMaxChild; /* valid if _CHILDSIZE */
|
|---|
| 173 | UINT cyIntegral; /* valid if _CHILDSIZE */
|
|---|
| 174 | UINT cxIdeal;
|
|---|
| 175 | LPARAM lParam;
|
|---|
| 176 | UINT cxHeader;
|
|---|
| 177 |
|
|---|
| 178 | UINT lcx; /* minimum cx for band */
|
|---|
| 179 | UINT ccx; /* current cx for band */
|
|---|
| 180 | UINT hcx; /* maximum cx for band */
|
|---|
| 181 | UINT lcy; /* minimum cy for band */
|
|---|
| 182 | UINT ccy; /* current cy for band */
|
|---|
| 183 | UINT hcy; /* maximum cy for band */
|
|---|
| 184 |
|
|---|
| 185 | SIZE offChild; /* x,y offset if child is not FIXEDSIZE */
|
|---|
| 186 | UINT uMinHeight;
|
|---|
| 187 | INT iRow; /* row this band assigned to */
|
|---|
| 188 | UINT fStatus; /* status flags, reset only by _Validate */
|
|---|
| 189 | UINT fDraw; /* drawing flags, reset only by _Layout */
|
|---|
| 190 | UINT uCDret; /* last return from NM_CUSTOMDRAW */
|
|---|
| 191 | RECT rcoldBand; /* previous calculated band rectangle */
|
|---|
| 192 | RECT rcBand; /* calculated band rectangle */
|
|---|
| 193 | RECT rcGripper; /* calculated gripper rectangle */
|
|---|
| 194 | RECT rcCapImage; /* calculated caption image rectangle */
|
|---|
| 195 | RECT rcCapText; /* calculated caption text rectangle */
|
|---|
| 196 | RECT rcChild; /* calculated child rectangle */
|
|---|
| 197 | RECT rcChevron; /* calculated chevron rectangle */
|
|---|
| 198 |
|
|---|
| 199 | LPWSTR lpText;
|
|---|
| 200 | HWND hwndPrevParent;
|
|---|
| 201 | } REBAR_BAND;
|
|---|
| 202 |
|
|---|
| 203 | /* fStatus flags */
|
|---|
| 204 | #define HAS_GRIPPER 0x00000001
|
|---|
| 205 | #define HAS_IMAGE 0x00000002
|
|---|
| 206 | #define HAS_TEXT 0x00000004
|
|---|
| 207 |
|
|---|
| 208 | /* fDraw flags */
|
|---|
| 209 | #define DRAW_GRIPPER 0x00000001
|
|---|
| 210 | #define DRAW_IMAGE 0x00000002
|
|---|
| 211 | #define DRAW_TEXT 0x00000004
|
|---|
| 212 | #define DRAW_RIGHTSEP 0x00000010
|
|---|
| 213 | #define DRAW_BOTTOMSEP 0x00000020
|
|---|
| 214 | #define DRAW_CHEVRONHOT 0x00000040
|
|---|
| 215 | #define DRAW_CHEVRONPUSHED 0x00000080
|
|---|
| 216 | #define DRAW_LAST_IN_ROW 0x00000100
|
|---|
| 217 | #define DRAW_FIRST_IN_ROW 0x00000200
|
|---|
| 218 | #define NTF_INVALIDATE 0x01000000
|
|---|
| 219 |
|
|---|
| 220 | typedef struct
|
|---|
| 221 | {
|
|---|
| 222 | COLORREF clrBk; /* background color */
|
|---|
| 223 | COLORREF clrText; /* text color */
|
|---|
| 224 | COLORREF clrBtnText; /* system color for BTNTEXT */
|
|---|
| 225 | COLORREF clrBtnFace; /* system color for BTNFACE */
|
|---|
| 226 | HIMAGELIST himl; /* handle to imagelist */
|
|---|
| 227 | UINT uNumBands; /* # of bands in rebar (first=0, last=uNumBands-1 */
|
|---|
| 228 | UINT uNumRows; /* # of rows of bands (first=1, last=uNumRows */
|
|---|
| 229 | HWND hwndSelf; /* handle of REBAR window itself */
|
|---|
| 230 | HWND hwndToolTip; /* handle to the tool tip control */
|
|---|
| 231 | HWND hwndNotify; /* notification window (parent) */
|
|---|
| 232 | HFONT hDefaultFont;
|
|---|
| 233 | HFONT hFont; /* handle to the rebar's font */
|
|---|
| 234 | SIZE imageSize; /* image size (image list) */
|
|---|
| 235 | DWORD dwStyle; /* window style */
|
|---|
| 236 | SIZE calcSize; /* calculated rebar size */
|
|---|
| 237 | SIZE oldSize; /* previous calculated rebar size */
|
|---|
| 238 | BOOL bUnicode; /* TRUE if this window is W type */
|
|---|
| 239 | BOOL NtfUnicode; /* TRUE if parent wants notify in W format */
|
|---|
| 240 | BOOL DoRedraw; /* TRUE to acutally draw bands */
|
|---|
| 241 | UINT fStatus; /* Status flags (see below) */
|
|---|
| 242 | HCURSOR hcurArrow; /* handle to the arrow cursor */
|
|---|
| 243 | HCURSOR hcurHorz; /* handle to the EW cursor */
|
|---|
| 244 | HCURSOR hcurVert; /* handle to the NS cursor */
|
|---|
| 245 | HCURSOR hcurDrag; /* handle to the drag cursor */
|
|---|
| 246 | INT iVersion; /* version number */
|
|---|
| 247 | POINTS dragStart; /* x,y of button down */
|
|---|
| 248 | POINTS dragNow; /* x,y of this MouseMove */
|
|---|
| 249 | INT iOldBand; /* last band that had the mouse cursor over it */
|
|---|
| 250 | INT ihitoffset; /* offset of hotspot from gripper.left */
|
|---|
| 251 | POINT origin; /* left/upper corner of client */
|
|---|
| 252 | INT ichevronhotBand; /* last band that had a hot chevron */
|
|---|
| 253 | INT iGrabbedBand;/* band number of band whose gripper was grabbed */
|
|---|
| 254 |
|
|---|
| 255 | REBAR_BAND *bands; /* pointer to the array of rebar bands */
|
|---|
| 256 | } REBAR_INFO;
|
|---|
| 257 |
|
|---|
| 258 | /* fStatus flags */
|
|---|
| 259 | #define BEGIN_DRAG_ISSUED 0x00000001
|
|---|
| 260 | #define AUTO_RESIZE 0x00000002
|
|---|
| 261 | #define RESIZE_ANYHOW 0x00000004
|
|---|
| 262 | #define NTF_HGHTCHG 0x00000008
|
|---|
| 263 | #define BAND_NEEDS_LAYOUT 0x00000010
|
|---|
| 264 | #define BAND_NEEDS_REDRAW 0x00000020
|
|---|
| 265 | #define CREATE_RUNNING 0x00000040
|
|---|
| 266 |
|
|---|
| 267 | /* ---- REBAR layout constants. Mostly determined by ---- */
|
|---|
| 268 | /* ---- experiment on WIN 98. ---- */
|
|---|
| 269 |
|
|---|
| 270 | /* Width (or height) of separators between bands (either horz. or */
|
|---|
| 271 | /* vert.). True only if RBS_BANDBORDERS is set */
|
|---|
| 272 | #define SEP_WIDTH_SIZE 2
|
|---|
| 273 | #define SEP_WIDTH ((infoPtr->dwStyle & RBS_BANDBORDERS) ? SEP_WIDTH_SIZE : 0)
|
|---|
| 274 |
|
|---|
| 275 | /* Blank (background color) space between Gripper (if present) */
|
|---|
| 276 | /* and next item (image, text, or window). Always present */
|
|---|
| 277 | #define REBAR_ALWAYS_SPACE 4
|
|---|
| 278 |
|
|---|
| 279 | /* Blank (background color) space after Image (if present). */
|
|---|
| 280 | #define REBAR_POST_IMAGE 2
|
|---|
| 281 |
|
|---|
| 282 | /* Blank (background color) space after Text (if present). */
|
|---|
| 283 | #define REBAR_POST_TEXT 4
|
|---|
| 284 |
|
|---|
| 285 | /* Height of vertical gripper in a CCS_VERT rebar. */
|
|---|
| 286 | #define GRIPPER_HEIGHT 16
|
|---|
| 287 |
|
|---|
| 288 | /* Blank (background color) space before Gripper (if present). */
|
|---|
| 289 | #define REBAR_PRE_GRIPPER 2
|
|---|
| 290 |
|
|---|
| 291 | /* Width (of normal vertical gripper) or height (of horz. gripper) */
|
|---|
| 292 | /* if present. */
|
|---|
| 293 | #define GRIPPER_WIDTH 3
|
|---|
| 294 |
|
|---|
| 295 | /* Width of the chevron button if present */
|
|---|
| 296 | #define CHEVRON_WIDTH 10
|
|---|
| 297 |
|
|---|
| 298 | /* Height of divider for Rebar if not disabled (CCS_NODIVIDER) */
|
|---|
| 299 | /* either top or bottom */
|
|---|
| 300 | #define REBAR_DIVIDER 2
|
|---|
| 301 |
|
|---|
| 302 | /* This is the increment that is used over the band height */
|
|---|
| 303 | #define REBARSPACE(a) ((a->fStyle & RBBS_CHILDEDGE) ? 2*REBAR_DIVIDER : 0)
|
|---|
| 304 |
|
|---|
| 305 | /* ---- End of REBAR layout constants. ---- */
|
|---|
| 306 |
|
|---|
| 307 | #define RB_GETBANDINFO_OLD (WM_USER+5) /* obsoleted after IE3, but we have to support it anyway */
|
|---|
| 308 |
|
|---|
| 309 | /* The following 6 defines return the proper rcBand element */
|
|---|
| 310 | /* depending on whether CCS_VERT was set. */
|
|---|
| 311 | #define rcBlt(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.top : b->rcBand.left)
|
|---|
| 312 | #define rcBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.bottom : b->rcBand.right)
|
|---|
| 313 | #define rcBw(b) ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.bottom - b->rcBand.top) : \
|
|---|
| 314 | (b->rcBand.right - b->rcBand.left))
|
|---|
| 315 | #define ircBlt(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.left : b->rcBand.top)
|
|---|
| 316 | #define ircBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.right : b->rcBand.bottom)
|
|---|
| 317 | #define ircBw(b) ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.right - b->rcBand.left) : \
|
|---|
| 318 | (b->rcBand.bottom - b->rcBand.top))
|
|---|
| 319 |
|
|---|
| 320 | /* The following define determines if a given band is hidden */
|
|---|
| 321 | #define HIDDENBAND(a) (((a)->fStyle & RBBS_HIDDEN) || \
|
|---|
| 322 | ((infoPtr->dwStyle & CCS_VERT) && \
|
|---|
| 323 | ((a)->fStyle & RBBS_NOVERT)))
|
|---|
| 324 |
|
|---|
| 325 | /* The following defines adjust the right or left end of a rectangle */
|
|---|
| 326 | #define READJ(b,i) do { if(infoPtr->dwStyle & CCS_VERT) b->rcBand.bottom+=(i); \
|
|---|
| 327 | else b->rcBand.right += (i); } while(0)
|
|---|
| 328 | #define LEADJ(b,i) do { if(infoPtr->dwStyle & CCS_VERT) b->rcBand.top+=(i); \
|
|---|
| 329 | else b->rcBand.left += (i); } while(0)
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 | #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongA (hwnd, 0))
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 | /* "constant values" retrieved when DLL was initialized */
|
|---|
| 336 | /* FIXME we do this when the classes are registered. */
|
|---|
| 337 | static UINT mindragx = 0;
|
|---|
| 338 | static UINT mindragy = 0;
|
|---|
| 339 |
|
|---|
| 340 | static const char *band_stylename[] = {
|
|---|
| 341 | "RBBS_BREAK", /* 0001 */
|
|---|
| 342 | "RBBS_FIXEDSIZE", /* 0002 */
|
|---|
| 343 | "RBBS_CHILDEDGE", /* 0004 */
|
|---|
| 344 | "RBBS_HIDDEN", /* 0008 */
|
|---|
| 345 | "RBBS_NOVERT", /* 0010 */
|
|---|
| 346 | "RBBS_FIXEDBMP", /* 0020 */
|
|---|
| 347 | "RBBS_VARIABLEHEIGHT", /* 0040 */
|
|---|
| 348 | "RBBS_GRIPPERALWAYS", /* 0080 */
|
|---|
| 349 | "RBBS_NOGRIPPER", /* 0100 */
|
|---|
| 350 | NULL };
|
|---|
| 351 |
|
|---|
| 352 | static const char *band_maskname[] = {
|
|---|
| 353 | "RBBIM_STYLE", /* 0x00000001 */
|
|---|
| 354 | "RBBIM_COLORS", /* 0x00000002 */
|
|---|
| 355 | "RBBIM_TEXT", /* 0x00000004 */
|
|---|
| 356 | "RBBIM_IMAGE", /* 0x00000008 */
|
|---|
| 357 | "RBBIM_CHILD", /* 0x00000010 */
|
|---|
| 358 | "RBBIM_CHILDSIZE", /* 0x00000020 */
|
|---|
| 359 | "RBBIM_SIZE", /* 0x00000040 */
|
|---|
| 360 | "RBBIM_BACKGROUND", /* 0x00000080 */
|
|---|
| 361 | "RBBIM_ID", /* 0x00000100 */
|
|---|
| 362 | "RBBIM_IDEALSIZE", /* 0x00000200 */
|
|---|
| 363 | "RBBIM_LPARAM", /* 0x00000400 */
|
|---|
| 364 | "RBBIM_HEADERSIZE", /* 0x00000800 */
|
|---|
| 365 | NULL };
|
|---|
| 366 |
|
|---|
| 367 |
|
|---|
| 368 | static CHAR line[200];
|
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 | static CHAR *
|
|---|
| 372 | REBAR_FmtStyle( UINT style)
|
|---|
| 373 | {
|
|---|
| 374 | INT i = 0;
|
|---|
| 375 |
|
|---|
| 376 | *line = 0;
|
|---|
| 377 | while (band_stylename[i]) {
|
|---|
| 378 | if (style & (1<<i)) {
|
|---|
| 379 | if (*line != 0) strcat(line, " | ");
|
|---|
| 380 | strcat(line, band_stylename[i]);
|
|---|
| 381 | }
|
|---|
| 382 | i++;
|
|---|
| 383 | }
|
|---|
| 384 | return line;
|
|---|
| 385 | }
|
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 | static CHAR *
|
|---|
| 389 | REBAR_FmtMask( UINT mask)
|
|---|
| 390 | {
|
|---|
| 391 | INT i = 0;
|
|---|
| 392 |
|
|---|
| 393 | *line = 0;
|
|---|
| 394 | while (band_maskname[i]) {
|
|---|
| 395 | if (mask & (1<<i)) {
|
|---|
| 396 | if (*line != 0) strcat(line, " | ");
|
|---|
| 397 | strcat(line, band_maskname[i]);
|
|---|
| 398 | }
|
|---|
| 399 | i++;
|
|---|
| 400 | }
|
|---|
| 401 | return line;
|
|---|
| 402 | }
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 | static VOID
|
|---|
| 406 | REBAR_DumpBandInfo( LPREBARBANDINFOA pB)
|
|---|
| 407 | {
|
|---|
| 408 | if( !TRACE_ON(rebar) ) return;
|
|---|
| 409 | TRACE("band info: ID=%u, size=%u, child=%p, clrF=0x%06lx, clrB=0x%06lx\n",
|
|---|
| 410 | pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack);
|
|---|
| 411 | TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask));
|
|---|
| 412 | if (pB->fMask & RBBIM_STYLE)
|
|---|
| 413 | TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));
|
|---|
| 414 | if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_HEADERSIZE | RBBIM_LPARAM )) {
|
|---|
| 415 | TRACE("band info:");
|
|---|
| 416 | if (pB->fMask & RBBIM_SIZE)
|
|---|
| 417 | TRACE(" cx=%u", pB->cx);
|
|---|
| 418 | if (pB->fMask & RBBIM_IDEALSIZE)
|
|---|
| 419 | TRACE(" xIdeal=%u", pB->cxIdeal);
|
|---|
| 420 | if (pB->fMask & RBBIM_HEADERSIZE)
|
|---|
| 421 | TRACE(" xHeader=%u", pB->cxHeader);
|
|---|
| 422 | if (pB->fMask & RBBIM_LPARAM)
|
|---|
| 423 | TRACE(" lParam=0x%08lx", pB->lParam);
|
|---|
| 424 | TRACE("\n");
|
|---|
| 425 | }
|
|---|
| 426 | if (pB->fMask & RBBIM_CHILDSIZE)
|
|---|
| 427 | TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
|
|---|
| 428 | pB->cxMinChild,
|
|---|
| 429 | pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
|
|---|
| 430 | }
|
|---|
| 431 |
|
|---|
| 432 | static VOID
|
|---|
| 433 | REBAR_DumpBand (REBAR_INFO *iP)
|
|---|
| 434 | {
|
|---|
| 435 | REBAR_BAND *pB;
|
|---|
| 436 | UINT i;
|
|---|
| 437 |
|
|---|
| 438 | if(! TRACE_ON(rebar) ) return;
|
|---|
| 439 |
|
|---|
| 440 | TRACE("hwnd=%p: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n",
|
|---|
| 441 | iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,
|
|---|
| 442 | iP->calcSize.cx, iP->calcSize.cy);
|
|---|
| 443 | TRACE("hwnd=%p: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, iGrabbedBand=%d\n",
|
|---|
| 444 | iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,
|
|---|
| 445 | iP->dragNow.x, iP->dragNow.y,
|
|---|
| 446 | iP->iGrabbedBand);
|
|---|
| 447 | TRACE("hwnd=%p: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n",
|
|---|
| 448 | iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",
|
|---|
| 449 | (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE");
|
|---|
| 450 | for (i = 0; i < iP->uNumBands; i++) {
|
|---|
| 451 | pB = &iP->bands[i];
|
|---|
| 452 | TRACE("band # %u: ID=%u, child=%p, row=%u, clrF=0x%06lx, clrB=0x%06lx\n",
|
|---|
| 453 | i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack);
|
|---|
| 454 | TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask));
|
|---|
| 455 | if (pB->fMask & RBBIM_STYLE)
|
|---|
| 456 | TRACE("band # %u: style=0x%08x (%s)\n",
|
|---|
| 457 | i, pB->fStyle, REBAR_FmtStyle(pB->fStyle));
|
|---|
| 458 | TRACE("band # %u: uMinH=%u xHeader=%u",
|
|---|
| 459 | i, pB->uMinHeight, pB->cxHeader);
|
|---|
| 460 | if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) {
|
|---|
| 461 | if (pB->fMask & RBBIM_SIZE)
|
|---|
| 462 | TRACE(" cx=%u", pB->cx);
|
|---|
| 463 | if (pB->fMask & RBBIM_IDEALSIZE)
|
|---|
| 464 | TRACE(" xIdeal=%u", pB->cxIdeal);
|
|---|
| 465 | if (pB->fMask & RBBIM_LPARAM)
|
|---|
| 466 | TRACE(" lParam=0x%08lx", pB->lParam);
|
|---|
| 467 | }
|
|---|
| 468 | TRACE("\n");
|
|---|
| 469 | if (RBBIM_CHILDSIZE)
|
|---|
| 470 | TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
|
|---|
| 471 | i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
|
|---|
| 472 | if (pB->fMask & RBBIM_TEXT)
|
|---|
| 473 | TRACE("band # %u: text=%s\n",
|
|---|
| 474 | i, (pB->lpText) ? debugstr_w(pB->lpText) : "(null)");
|
|---|
| 475 | TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n",
|
|---|
| 476 | i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy);
|
|---|
| 477 | TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%ld,%ld)-(%ld,%ld), Grip=(%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 478 | i, pB->fStatus, pB->fDraw,
|
|---|
| 479 | pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom,
|
|---|
| 480 | pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom);
|
|---|
| 481 | TRACE("band # %u: Img=(%ld,%ld)-(%ld,%ld), Txt=(%ld,%ld)-(%ld,%ld), Child=(%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 482 | i,
|
|---|
| 483 | pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom,
|
|---|
| 484 | pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom,
|
|---|
| 485 | pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom);
|
|---|
| 486 | }
|
|---|
| 487 |
|
|---|
| 488 | }
|
|---|
| 489 |
|
|---|
| 490 | static void
|
|---|
| 491 | REBAR_DrawChevron (HDC hdc, INT left, INT top, INT colorRef)
|
|---|
| 492 | {
|
|---|
| 493 | INT x, y;
|
|---|
| 494 | HPEN hPen, hOldPen;
|
|---|
| 495 |
|
|---|
| 496 | if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return;
|
|---|
| 497 | hOldPen = SelectObject ( hdc, hPen );
|
|---|
| 498 | x = left + 2;
|
|---|
| 499 | y = top;
|
|---|
| 500 | MoveToEx (hdc, x, y, NULL);
|
|---|
| 501 | LineTo (hdc, x+5, y++); x++;
|
|---|
| 502 | MoveToEx (hdc, x, y, NULL);
|
|---|
| 503 | LineTo (hdc, x+3, y++); x++;
|
|---|
| 504 | MoveToEx (hdc, x, y, NULL);
|
|---|
| 505 | LineTo (hdc, x+1, y++);
|
|---|
| 506 | SelectObject( hdc, hOldPen );
|
|---|
| 507 | DeleteObject( hPen );
|
|---|
| 508 | }
|
|---|
| 509 |
|
|---|
| 510 | static HWND
|
|---|
| 511 | REBAR_GetNotifyParent (REBAR_INFO *infoPtr)
|
|---|
| 512 | {
|
|---|
| 513 | HWND parent, owner;
|
|---|
| 514 |
|
|---|
| 515 | parent = infoPtr->hwndNotify;
|
|---|
| 516 | if (!parent) {
|
|---|
| 517 | parent = GetParent (infoPtr->hwndSelf);
|
|---|
| 518 | owner = GetWindow (infoPtr->hwndSelf, GW_OWNER);
|
|---|
| 519 | if (owner) parent = owner;
|
|---|
| 520 | }
|
|---|
| 521 | return parent;
|
|---|
| 522 | }
|
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 | static INT
|
|---|
| 526 | REBAR_Notify (NMHDR *nmhdr, REBAR_INFO *infoPtr, UINT code)
|
|---|
| 527 | {
|
|---|
| 528 | HWND parent;
|
|---|
| 529 |
|
|---|
| 530 | parent = REBAR_GetNotifyParent (infoPtr);
|
|---|
| 531 | nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf);
|
|---|
| 532 | nmhdr->hwndFrom = infoPtr->hwndSelf;
|
|---|
| 533 | nmhdr->code = code;
|
|---|
| 534 |
|
|---|
| 535 | TRACE("window %p, code=%08x, %s\n", parent, code,
|
|---|
| 536 | (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI");
|
|---|
| 537 |
|
|---|
| 538 | if (infoPtr->NtfUnicode)
|
|---|
| 539 | return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,
|
|---|
| 540 | (LPARAM)nmhdr);
|
|---|
| 541 | else
|
|---|
| 542 | return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,
|
|---|
| 543 | (LPARAM)nmhdr);
|
|---|
| 544 | }
|
|---|
| 545 |
|
|---|
| 546 | static INT
|
|---|
| 547 | REBAR_Notify_NMREBAR (REBAR_INFO *infoPtr, UINT uBand, UINT code)
|
|---|
| 548 | {
|
|---|
| 549 | NMREBAR notify_rebar;
|
|---|
| 550 | REBAR_BAND *lpBand;
|
|---|
| 551 |
|
|---|
| 552 | notify_rebar.dwMask = 0;
|
|---|
| 553 | if (uBand!=-1) {
|
|---|
| 554 | lpBand = &infoPtr->bands[uBand];
|
|---|
| 555 | if (lpBand->fMask & RBBIM_ID) {
|
|---|
| 556 | notify_rebar.dwMask |= RBNM_ID;
|
|---|
| 557 | notify_rebar.wID = lpBand->wID;
|
|---|
| 558 | }
|
|---|
| 559 | if (lpBand->fMask & RBBIM_LPARAM) {
|
|---|
| 560 | notify_rebar.dwMask |= RBNM_LPARAM;
|
|---|
| 561 | notify_rebar.lParam = lpBand->lParam;
|
|---|
| 562 | }
|
|---|
| 563 | if (lpBand->fMask & RBBIM_STYLE) {
|
|---|
| 564 | notify_rebar.dwMask |= RBNM_STYLE;
|
|---|
| 565 | notify_rebar.fStyle = lpBand->fStyle;
|
|---|
| 566 | }
|
|---|
| 567 | }
|
|---|
| 568 | notify_rebar.uBand = uBand;
|
|---|
| 569 | return REBAR_Notify ((NMHDR *)¬ify_rebar, infoPtr, code);
|
|---|
| 570 | }
|
|---|
| 571 |
|
|---|
| 572 | static VOID
|
|---|
| 573 | REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
|
|---|
| 574 | {
|
|---|
| 575 | HFONT hOldFont = 0;
|
|---|
| 576 | INT oldBkMode = 0;
|
|---|
| 577 | NMCUSTOMDRAW nmcd;
|
|---|
| 578 |
|
|---|
| 579 | if (lpBand->fDraw & DRAW_TEXT) {
|
|---|
| 580 | hOldFont = SelectObject (hdc, infoPtr->hFont);
|
|---|
| 581 | oldBkMode = SetBkMode (hdc, TRANSPARENT);
|
|---|
| 582 | }
|
|---|
| 583 |
|
|---|
| 584 | /* should test for CDRF_NOTIFYITEMDRAW here */
|
|---|
| 585 | nmcd.dwDrawStage = CDDS_ITEMPREPAINT;
|
|---|
| 586 | nmcd.hdc = hdc;
|
|---|
| 587 | nmcd.rc = lpBand->rcBand;
|
|---|
| 588 | nmcd.rc.right = lpBand->rcCapText.right;
|
|---|
| 589 | nmcd.rc.bottom = lpBand->rcCapText.bottom;
|
|---|
| 590 | nmcd.dwItemSpec = lpBand->wID;
|
|---|
| 591 | nmcd.uItemState = 0;
|
|---|
| 592 | nmcd.lItemlParam = lpBand->lParam;
|
|---|
| 593 | lpBand->uCDret = REBAR_Notify ((NMHDR *)&nmcd, infoPtr, NM_CUSTOMDRAW);
|
|---|
| 594 | if (lpBand->uCDret == CDRF_SKIPDEFAULT) {
|
|---|
| 595 | if (oldBkMode != TRANSPARENT)
|
|---|
| 596 | SetBkMode (hdc, oldBkMode);
|
|---|
| 597 | SelectObject (hdc, hOldFont);
|
|---|
| 598 | return;
|
|---|
| 599 | }
|
|---|
| 600 |
|
|---|
| 601 | /* draw gripper */
|
|---|
| 602 | if (lpBand->fDraw & DRAW_GRIPPER)
|
|---|
| 603 | DrawEdge (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
|
|---|
| 604 |
|
|---|
| 605 | /* draw caption image */
|
|---|
| 606 | if (lpBand->fDraw & DRAW_IMAGE) {
|
|---|
| 607 | POINT pt;
|
|---|
| 608 |
|
|---|
| 609 | /* center image */
|
|---|
| 610 | pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;
|
|---|
| 611 | pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;
|
|---|
| 612 |
|
|---|
| 613 | ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,
|
|---|
| 614 | pt.x, pt.y,
|
|---|
| 615 | ILD_TRANSPARENT);
|
|---|
| 616 | }
|
|---|
| 617 |
|
|---|
| 618 | /* draw caption text */
|
|---|
| 619 | if (lpBand->fDraw & DRAW_TEXT) {
|
|---|
| 620 | /* need to handle CDRF_NEWFONT here */
|
|---|
| 621 | INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
|
|---|
| 622 | COLORREF oldcolor = CLR_NONE;
|
|---|
| 623 | COLORREF new;
|
|---|
| 624 | if (lpBand->clrFore != CLR_NONE) {
|
|---|
| 625 | new = (lpBand->clrFore == CLR_DEFAULT) ? infoPtr->clrBtnText :
|
|---|
| 626 | lpBand->clrFore;
|
|---|
| 627 | oldcolor = SetTextColor (hdc, new);
|
|---|
| 628 | }
|
|---|
| 629 | DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
|
|---|
| 630 | DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
|---|
| 631 | if (oldBkMode != TRANSPARENT)
|
|---|
| 632 | SetBkMode (hdc, oldBkMode);
|
|---|
| 633 | if (lpBand->clrFore != CLR_NONE)
|
|---|
| 634 | SetTextColor (hdc, oldcolor);
|
|---|
| 635 | SelectObject (hdc, hOldFont);
|
|---|
| 636 | }
|
|---|
| 637 |
|
|---|
| 638 | if (!IsRectEmpty(&lpBand->rcChevron))
|
|---|
| 639 | {
|
|---|
| 640 | if (lpBand->fDraw & DRAW_CHEVRONPUSHED)
|
|---|
| 641 | {
|
|---|
| 642 | DrawEdge(hdc, &lpBand->rcChevron, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
|
|---|
| 643 | REBAR_DrawChevron(hdc, lpBand->rcChevron.left+1, lpBand->rcChevron.top + 11, COLOR_WINDOWFRAME);
|
|---|
| 644 | }
|
|---|
| 645 | else if (lpBand->fDraw & DRAW_CHEVRONHOT)
|
|---|
| 646 | {
|
|---|
| 647 | DrawEdge(hdc, &lpBand->rcChevron, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
|
|---|
| 648 | REBAR_DrawChevron(hdc, lpBand->rcChevron.left, lpBand->rcChevron.top + 10, COLOR_WINDOWFRAME);
|
|---|
| 649 | }
|
|---|
| 650 | else
|
|---|
| 651 | REBAR_DrawChevron(hdc, lpBand->rcChevron.left, lpBand->rcChevron.top + 10, COLOR_WINDOWFRAME);
|
|---|
| 652 | }
|
|---|
| 653 |
|
|---|
| 654 | if (lpBand->uCDret == (CDRF_NOTIFYPOSTPAINT | CDRF_NOTIFYITEMDRAW)) {
|
|---|
| 655 | nmcd.dwDrawStage = CDDS_ITEMPOSTPAINT;
|
|---|
| 656 | nmcd.hdc = hdc;
|
|---|
| 657 | nmcd.rc = lpBand->rcBand;
|
|---|
| 658 | nmcd.rc.right = lpBand->rcCapText.right;
|
|---|
| 659 | nmcd.rc.bottom = lpBand->rcCapText.bottom;
|
|---|
| 660 | nmcd.dwItemSpec = lpBand->wID;
|
|---|
| 661 | nmcd.uItemState = 0;
|
|---|
| 662 | nmcd.lItemlParam = lpBand->lParam;
|
|---|
| 663 | lpBand->uCDret = REBAR_Notify ((NMHDR *)&nmcd, infoPtr, NM_CUSTOMDRAW);
|
|---|
| 664 | }
|
|---|
| 665 | }
|
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 | static VOID
|
|---|
| 669 | REBAR_Refresh (REBAR_INFO *infoPtr, HDC hdc)
|
|---|
| 670 | {
|
|---|
| 671 | REBAR_BAND *lpBand;
|
|---|
| 672 | UINT i;
|
|---|
| 673 |
|
|---|
| 674 | if (!infoPtr->DoRedraw) return;
|
|---|
| 675 |
|
|---|
| 676 | for (i = 0; i < infoPtr->uNumBands; i++) {
|
|---|
| 677 | lpBand = &infoPtr->bands[i];
|
|---|
| 678 |
|
|---|
| 679 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 680 |
|
|---|
| 681 | /* now draw the band */
|
|---|
| 682 | TRACE("[%p] drawing band %i, flags=%08x\n",
|
|---|
| 683 | infoPtr->hwndSelf, i, lpBand->fDraw);
|
|---|
| 684 | REBAR_DrawBand (hdc, infoPtr, lpBand);
|
|---|
| 685 |
|
|---|
| 686 | }
|
|---|
| 687 | }
|
|---|
| 688 |
|
|---|
| 689 |
|
|---|
| 690 | static void
|
|---|
| 691 | REBAR_FixVert (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend,
|
|---|
| 692 | INT mcy)
|
|---|
| 693 | /* Function: */
|
|---|
| 694 | /* Cycle through bands in row and fix height of each band. */
|
|---|
| 695 | /* Also determine whether each band has changed. */
|
|---|
| 696 | /* On entry: */
|
|---|
| 697 | /* all bands at desired size. */
|
|---|
| 698 | /* start and end bands are *not* hidden */
|
|---|
| 699 | {
|
|---|
| 700 | REBAR_BAND *lpBand;
|
|---|
| 701 | INT i;
|
|---|
| 702 |
|
|---|
| 703 | for (i = (INT)rowstart; i<=(INT)rowend; i++) {
|
|---|
| 704 | lpBand = &infoPtr->bands[i];
|
|---|
| 705 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 706 |
|
|---|
| 707 | /* adjust height of bands in row to "mcy" value */
|
|---|
| 708 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 709 | if (lpBand->rcBand.right != lpBand->rcBand.left + mcy)
|
|---|
| 710 | lpBand->rcBand.right = lpBand->rcBand.left + mcy;
|
|---|
| 711 | }
|
|---|
| 712 | else {
|
|---|
| 713 | if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy)
|
|---|
| 714 | lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;
|
|---|
| 715 |
|
|---|
| 716 | }
|
|---|
| 717 |
|
|---|
| 718 | /* mark whether we need to invalidate this band and trace */
|
|---|
| 719 | if ((lpBand->rcoldBand.left !=lpBand->rcBand.left) ||
|
|---|
| 720 | (lpBand->rcoldBand.top !=lpBand->rcBand.top) ||
|
|---|
| 721 | (lpBand->rcoldBand.right !=lpBand->rcBand.right) ||
|
|---|
| 722 | (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) {
|
|---|
| 723 | lpBand->fDraw |= NTF_INVALIDATE;
|
|---|
| 724 | TRACE("band %d row=%d: changed to (%ld,%ld)-(%ld,%ld) from (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 725 | i, lpBand->iRow,
|
|---|
| 726 | lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 727 | lpBand->rcBand.right, lpBand->rcBand.bottom,
|
|---|
| 728 | lpBand->rcoldBand.left, lpBand->rcoldBand.top,
|
|---|
| 729 | lpBand->rcoldBand.right, lpBand->rcoldBand.bottom);
|
|---|
| 730 | }
|
|---|
| 731 | else
|
|---|
| 732 | TRACE("band %d row=%d: unchanged (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 733 | i, lpBand->iRow,
|
|---|
| 734 | lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 735 | lpBand->rcBand.right, lpBand->rcBand.bottom);
|
|---|
| 736 | }
|
|---|
| 737 | }
|
|---|
| 738 |
|
|---|
| 739 |
|
|---|
| 740 | static void
|
|---|
| 741 | REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend,
|
|---|
| 742 | INT maxx, INT mcy)
|
|---|
| 743 | /* Function: This routine distributes the extra space in a row. */
|
|---|
| 744 | /* See algorithm below. */
|
|---|
| 745 | /* On entry: */
|
|---|
| 746 | /* all bands @ ->cxHeader size */
|
|---|
| 747 | /* start and end bands are *not* hidden */
|
|---|
| 748 | {
|
|---|
| 749 | REBAR_BAND *lpBand;
|
|---|
| 750 | UINT x, xsep, extra, curwidth, fudge;
|
|---|
| 751 | INT i, last_adjusted;
|
|---|
| 752 |
|
|---|
| 753 | TRACE("start=%u, end=%u, max x=%d, max y=%d\n",
|
|---|
| 754 | rowstart, rowend, maxx, mcy);
|
|---|
| 755 |
|
|---|
| 756 | /* ******************* Phase 1 ************************ */
|
|---|
| 757 | /* Alg: */
|
|---|
| 758 | /* For each visible band with valid child */
|
|---|
| 759 | /* a. inflate band till either all extra space used */
|
|---|
| 760 | /* or band's ->ccx reached. */
|
|---|
| 761 | /* If any band modified, add any space left to last band */
|
|---|
| 762 | /* adjusted. */
|
|---|
| 763 | /* */
|
|---|
| 764 | /* ****************************************************** */
|
|---|
| 765 | lpBand = &infoPtr->bands[rowend];
|
|---|
| 766 | extra = maxx - rcBrb(lpBand);
|
|---|
| 767 | x = 0;
|
|---|
| 768 | last_adjusted = -1;
|
|---|
| 769 | for (i=(INT)rowstart; i<=(INT)rowend; i++) {
|
|---|
| 770 | lpBand = &infoPtr->bands[i];
|
|---|
| 771 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 772 | xsep = (x == 0) ? 0 : SEP_WIDTH;
|
|---|
| 773 | curwidth = rcBw(lpBand);
|
|---|
| 774 |
|
|---|
| 775 | /* set new left/top point */
|
|---|
| 776 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 777 | lpBand->rcBand.top = x + xsep;
|
|---|
| 778 | else
|
|---|
| 779 | lpBand->rcBand.left = x + xsep;
|
|---|
| 780 |
|
|---|
| 781 | /* compute new width */
|
|---|
| 782 | if ((lpBand->hwndChild && extra) && !(lpBand->fStyle & RBBS_FIXEDSIZE)) {
|
|---|
| 783 | /* set to the "current" band size less the header */
|
|---|
| 784 | fudge = lpBand->ccx;
|
|---|
| 785 | last_adjusted = i;
|
|---|
| 786 | if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0) &&
|
|---|
| 787 | (fudge > curwidth)) {
|
|---|
| 788 | TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d, extra=%d\n",
|
|---|
| 789 | i, fudge-curwidth, fudge, curwidth, extra);
|
|---|
| 790 | if ((fudge - curwidth) > extra)
|
|---|
| 791 | fudge = curwidth + extra;
|
|---|
| 792 | extra -= (fudge - curwidth);
|
|---|
| 793 | curwidth = fudge;
|
|---|
| 794 | }
|
|---|
| 795 | else {
|
|---|
| 796 | TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d\n",
|
|---|
| 797 | i, extra, fudge, curwidth);
|
|---|
| 798 | curwidth += extra;
|
|---|
| 799 | extra = 0;
|
|---|
| 800 | }
|
|---|
| 801 | }
|
|---|
| 802 |
|
|---|
| 803 | /* set new right/bottom point */
|
|---|
| 804 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 805 | lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;
|
|---|
| 806 | else
|
|---|
| 807 | lpBand->rcBand.right = lpBand->rcBand.left + curwidth;
|
|---|
| 808 | TRACE("Phase 1 band %d, (%ld,%ld)-(%ld,%ld), orig x=%d, xsep=%d\n",
|
|---|
| 809 | i, lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 810 | lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);
|
|---|
| 811 | x = rcBrb(lpBand);
|
|---|
| 812 | }
|
|---|
| 813 | if ((x >= maxx) || (last_adjusted != -1)) {
|
|---|
| 814 | if (x > maxx) {
|
|---|
| 815 | ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n",
|
|---|
| 816 | x, maxx, rowstart, rowend);
|
|---|
| 817 | }
|
|---|
| 818 | /* done, so spread extra space */
|
|---|
| 819 | if (x < maxx) {
|
|---|
| 820 | fudge = maxx - x;
|
|---|
| 821 | TRACE("Need to spread %d on last adjusted band %d\n",
|
|---|
| 822 | fudge, last_adjusted);
|
|---|
| 823 | for (i=(INT)last_adjusted; i<=(INT)rowend; i++) {
|
|---|
| 824 | lpBand = &infoPtr->bands[i];
|
|---|
| 825 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 826 |
|
|---|
| 827 | /* set right/bottom point */
|
|---|
| 828 | if (i != last_adjusted) {
|
|---|
| 829 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 830 | lpBand->rcBand.top += fudge;
|
|---|
| 831 | else
|
|---|
| 832 | lpBand->rcBand.left += fudge;
|
|---|
| 833 | }
|
|---|
| 834 |
|
|---|
| 835 | /* set left/bottom point */
|
|---|
| 836 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 837 | lpBand->rcBand.bottom += fudge;
|
|---|
| 838 | else
|
|---|
| 839 | lpBand->rcBand.right += fudge;
|
|---|
| 840 | }
|
|---|
| 841 | }
|
|---|
| 842 | TRACE("Phase 1 succeeded, used x=%d\n", x);
|
|---|
| 843 | REBAR_FixVert (infoPtr, rowstart, rowend, mcy);
|
|---|
| 844 | return;
|
|---|
| 845 | }
|
|---|
| 846 |
|
|---|
| 847 | /* ******************* Phase 2 ************************ */
|
|---|
| 848 | /* Alg: */
|
|---|
| 849 | /* Find first visible band, put all */
|
|---|
| 850 | /* extra space there. */
|
|---|
| 851 | /* */
|
|---|
| 852 | /* ****************************************************** */
|
|---|
| 853 |
|
|---|
| 854 | x = 0;
|
|---|
| 855 | for (i=(INT)rowstart; i<=(INT)rowend; i++) {
|
|---|
| 856 | lpBand = &infoPtr->bands[i];
|
|---|
| 857 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 858 | xsep = (x == 0) ? 0 : SEP_WIDTH;
|
|---|
| 859 | curwidth = rcBw(lpBand);
|
|---|
| 860 |
|
|---|
| 861 | /* set new left/top point */
|
|---|
| 862 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 863 | lpBand->rcBand.top = x + xsep;
|
|---|
| 864 | else
|
|---|
| 865 | lpBand->rcBand.left = x + xsep;
|
|---|
| 866 |
|
|---|
| 867 | /* compute new width */
|
|---|
| 868 | if (extra) {
|
|---|
| 869 | curwidth += extra;
|
|---|
| 870 | extra = 0;
|
|---|
| 871 | }
|
|---|
| 872 |
|
|---|
| 873 | /* set new right/bottom point */
|
|---|
| 874 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 875 | lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;
|
|---|
| 876 | else
|
|---|
| 877 | lpBand->rcBand.right = lpBand->rcBand.left + curwidth;
|
|---|
| 878 | TRACE("Phase 2 band %d, (%ld,%ld)-(%ld,%ld), orig x=%d, xsep=%d\n",
|
|---|
| 879 | i, lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 880 | lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);
|
|---|
| 881 | x = rcBrb(lpBand);
|
|---|
| 882 | }
|
|---|
| 883 | if (x >= maxx) {
|
|---|
| 884 | if (x > maxx) {
|
|---|
| 885 | ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n",
|
|---|
| 886 | x, maxx, rowstart, rowend);
|
|---|
| 887 | }
|
|---|
| 888 | /* done, so spread extra space */
|
|---|
| 889 | TRACE("Phase 2 succeeded, used x=%d\n", x);
|
|---|
| 890 | REBAR_FixVert (infoPtr, rowstart, rowend, mcy);
|
|---|
| 891 | return;
|
|---|
| 892 | }
|
|---|
| 893 |
|
|---|
| 894 | /* ******************* Phase 3 ************************ */
|
|---|
| 895 | /* at this point everything is back to ->cxHeader values */
|
|---|
| 896 | /* and should not have gotten here. */
|
|---|
| 897 | /* ****************************************************** */
|
|---|
| 898 |
|
|---|
| 899 | lpBand = &infoPtr->bands[rowstart];
|
|---|
| 900 | ERR("Serious problem adjusting row %d, start band %d, end band %d\n",
|
|---|
| 901 | lpBand->iRow, rowstart, rowend);
|
|---|
| 902 | REBAR_DumpBand (infoPtr);
|
|---|
| 903 | return;
|
|---|
| 904 | }
|
|---|
| 905 |
|
|---|
| 906 |
|
|---|
| 907 | static void
|
|---|
| 908 | REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
|
|---|
| 909 | /* Function: this routine initializes all the rectangles in */
|
|---|
| 910 | /* each band in a row to fit in the adjusted rcBand rect. */
|
|---|
| 911 | /* *** Supports only Horizontal bars. *** */
|
|---|
| 912 | {
|
|---|
| 913 | REBAR_BAND *lpBand;
|
|---|
| 914 | UINT i, xoff, yoff;
|
|---|
| 915 | HWND parenthwnd;
|
|---|
| 916 | RECT oldChild, work;
|
|---|
| 917 |
|
|---|
| 918 | /* MS seems to use GetDlgCtrlID() for above GetWindowLong call */
|
|---|
| 919 | parenthwnd = GetParent (infoPtr->hwndSelf);
|
|---|
| 920 |
|
|---|
| 921 | for(i=rstart; i<rend; i++){
|
|---|
| 922 | lpBand = &infoPtr->bands[i];
|
|---|
| 923 | if (HIDDENBAND(lpBand)) {
|
|---|
| 924 | SetRect (&lpBand->rcChild,
|
|---|
| 925 | lpBand->rcBand.right, lpBand->rcBand.top,
|
|---|
| 926 | lpBand->rcBand.right, lpBand->rcBand.bottom);
|
|---|
| 927 | continue;
|
|---|
| 928 | }
|
|---|
| 929 |
|
|---|
| 930 | oldChild = lpBand->rcChild;
|
|---|
| 931 |
|
|---|
| 932 | /* set initial gripper rectangle */
|
|---|
| 933 | SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 934 | lpBand->rcBand.left, lpBand->rcBand.bottom);
|
|---|
| 935 |
|
|---|
| 936 | /* calculate gripper rectangle */
|
|---|
| 937 | if ( lpBand->fStatus & HAS_GRIPPER) {
|
|---|
| 938 | lpBand->fDraw |= DRAW_GRIPPER;
|
|---|
| 939 | lpBand->rcGripper.left += REBAR_PRE_GRIPPER;
|
|---|
| 940 | lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;
|
|---|
| 941 | lpBand->rcGripper.top += 2;
|
|---|
| 942 | lpBand->rcGripper.bottom -= 2;
|
|---|
| 943 |
|
|---|
| 944 | SetRect (&lpBand->rcCapImage,
|
|---|
| 945 | lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.top,
|
|---|
| 946 | lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.bottom);
|
|---|
| 947 | }
|
|---|
| 948 | else { /* no gripper will be drawn */
|
|---|
| 949 | xoff = 0;
|
|---|
| 950 | if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
|
|---|
| 951 | /* if no gripper but either image or text, then leave space */
|
|---|
| 952 | xoff = REBAR_ALWAYS_SPACE;
|
|---|
| 953 | SetRect (&lpBand->rcCapImage,
|
|---|
| 954 | lpBand->rcBand.left+xoff, lpBand->rcBand.top,
|
|---|
| 955 | lpBand->rcBand.left+xoff, lpBand->rcBand.bottom);
|
|---|
| 956 | }
|
|---|
| 957 |
|
|---|
| 958 | /* image is visible */
|
|---|
| 959 | if (lpBand->fStatus & HAS_IMAGE) {
|
|---|
| 960 | lpBand->fDraw |= DRAW_IMAGE;
|
|---|
| 961 | lpBand->rcCapImage.right += infoPtr->imageSize.cx;
|
|---|
| 962 | lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
|
|---|
| 963 |
|
|---|
| 964 | /* set initial caption text rectangle */
|
|---|
| 965 | SetRect (&lpBand->rcCapText,
|
|---|
| 966 | lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1,
|
|---|
| 967 | lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
|
|---|
| 968 | /* update band height
|
|---|
| 969 | if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {
|
|---|
| 970 | lpBand->uMinHeight = infoPtr->imageSize.cy + 2;
|
|---|
| 971 | lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;
|
|---|
| 972 | } */
|
|---|
| 973 | }
|
|---|
| 974 | else {
|
|---|
| 975 | /* set initial caption text rectangle */
|
|---|
| 976 | SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1,
|
|---|
| 977 | lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
|
|---|
| 978 | }
|
|---|
| 979 |
|
|---|
| 980 | /* text is visible */
|
|---|
| 981 | if ((lpBand->fStatus & HAS_TEXT) && !(lpBand->fStyle & RBBS_HIDETITLE)) {
|
|---|
| 982 | lpBand->fDraw |= DRAW_TEXT;
|
|---|
| 983 | lpBand->rcCapText.right = max(lpBand->rcCapText.left,
|
|---|
| 984 | lpBand->rcCapText.right-REBAR_POST_TEXT);
|
|---|
| 985 | }
|
|---|
| 986 |
|
|---|
| 987 | /* set initial child window rectangle if there is a child */
|
|---|
| 988 | if (lpBand->fMask & RBBIM_CHILD) {
|
|---|
| 989 | xoff = lpBand->offChild.cx;
|
|---|
| 990 | yoff = lpBand->offChild.cy;
|
|---|
| 991 | SetRect (&lpBand->rcChild,
|
|---|
| 992 | lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top+yoff,
|
|---|
| 993 | lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);
|
|---|
| 994 | if ((lpBand->fStyle & RBBS_USECHEVRON) && (lpBand->rcChild.right - lpBand->rcChild.left < lpBand->cxIdeal))
|
|---|
| 995 | {
|
|---|
| 996 | lpBand->rcChild.right -= CHEVRON_WIDTH;
|
|---|
| 997 | SetRect(&lpBand->rcChevron, lpBand->rcChild.right,
|
|---|
| 998 | lpBand->rcChild.top, lpBand->rcChild.right + CHEVRON_WIDTH,
|
|---|
| 999 | lpBand->rcChild.bottom);
|
|---|
| 1000 | }
|
|---|
| 1001 | }
|
|---|
| 1002 | else {
|
|---|
| 1003 | SetRect (&lpBand->rcChild,
|
|---|
| 1004 | lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top,
|
|---|
| 1005 | lpBand->rcBand.right, lpBand->rcBand.bottom);
|
|---|
| 1006 | }
|
|---|
| 1007 |
|
|---|
| 1008 | /* flag if notify required and invalidate rectangle */
|
|---|
| 1009 | if (notify &&
|
|---|
| 1010 | ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||
|
|---|
| 1011 | (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
|
|---|
| 1012 | TRACE("Child rectangle changed for band %u\n", i);
|
|---|
| 1013 | TRACE(" from (%ld,%ld)-(%ld,%ld) to (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1014 | oldChild.left, oldChild.top,
|
|---|
| 1015 | oldChild.right, oldChild.bottom,
|
|---|
| 1016 | lpBand->rcChild.left, lpBand->rcChild.top,
|
|---|
| 1017 | lpBand->rcChild.right, lpBand->rcChild.bottom);
|
|---|
| 1018 | }
|
|---|
| 1019 | if (lpBand->fDraw & NTF_INVALIDATE) {
|
|---|
| 1020 | TRACE("invalidating (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1021 | lpBand->rcBand.left,
|
|---|
| 1022 | lpBand->rcBand.top,
|
|---|
| 1023 | lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0),
|
|---|
| 1024 | lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0));
|
|---|
| 1025 | lpBand->fDraw &= ~NTF_INVALIDATE;
|
|---|
| 1026 | work = lpBand->rcBand;
|
|---|
| 1027 | if (lpBand->fDraw & DRAW_RIGHTSEP) work.right += SEP_WIDTH_SIZE;
|
|---|
| 1028 | if (lpBand->fDraw & DRAW_BOTTOMSEP) work.bottom += SEP_WIDTH_SIZE;
|
|---|
| 1029 | InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
|
|---|
| 1030 | }
|
|---|
| 1031 |
|
|---|
| 1032 | }
|
|---|
| 1033 |
|
|---|
| 1034 | }
|
|---|
| 1035 |
|
|---|
| 1036 |
|
|---|
| 1037 | static VOID
|
|---|
| 1038 | REBAR_CalcVertBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
|
|---|
| 1039 | /* Function: this routine initializes all the rectangles in */
|
|---|
| 1040 | /* each band in a row to fit in the adjusted rcBand rect. */
|
|---|
| 1041 | /* *** Supports only Vertical bars. *** */
|
|---|
| 1042 | {
|
|---|
| 1043 | REBAR_BAND *lpBand;
|
|---|
| 1044 | UINT i, xoff, yoff;
|
|---|
| 1045 | HWND parenthwnd;
|
|---|
| 1046 | RECT oldChild, work;
|
|---|
| 1047 |
|
|---|
| 1048 | /* MS seems to use GetDlgCtrlID() for above GetWindowLong call */
|
|---|
| 1049 | parenthwnd = GetParent (infoPtr->hwndSelf);
|
|---|
| 1050 |
|
|---|
| 1051 | for(i=rstart; i<rend; i++){
|
|---|
| 1052 | lpBand = &infoPtr->bands[i];
|
|---|
| 1053 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 1054 | oldChild = lpBand->rcChild;
|
|---|
| 1055 |
|
|---|
| 1056 | /* set initial gripper rectangle */
|
|---|
| 1057 | SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 1058 | lpBand->rcBand.right, lpBand->rcBand.top);
|
|---|
| 1059 |
|
|---|
| 1060 | /* calculate gripper rectangle */
|
|---|
| 1061 | if (lpBand->fStatus & HAS_GRIPPER) {
|
|---|
| 1062 | lpBand->fDraw |= DRAW_GRIPPER;
|
|---|
| 1063 |
|
|---|
| 1064 | if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) {
|
|---|
| 1065 | /* vertical gripper */
|
|---|
| 1066 | lpBand->rcGripper.left += 3;
|
|---|
| 1067 | lpBand->rcGripper.right = lpBand->rcGripper.left + GRIPPER_WIDTH;
|
|---|
| 1068 | lpBand->rcGripper.top += REBAR_PRE_GRIPPER;
|
|---|
| 1069 | lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT;
|
|---|
| 1070 |
|
|---|
| 1071 | /* initialize Caption image rectangle */
|
|---|
| 1072 | SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,
|
|---|
| 1073 | lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,
|
|---|
| 1074 | lpBand->rcBand.right,
|
|---|
| 1075 | lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);
|
|---|
| 1076 | }
|
|---|
| 1077 | else {
|
|---|
| 1078 | /* horizontal gripper */
|
|---|
| 1079 | lpBand->rcGripper.left += 2;
|
|---|
| 1080 | lpBand->rcGripper.right -= 2;
|
|---|
| 1081 | lpBand->rcGripper.top += REBAR_PRE_GRIPPER;
|
|---|
| 1082 | lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_WIDTH;
|
|---|
| 1083 |
|
|---|
| 1084 | /* initialize Caption image rectangle */
|
|---|
| 1085 | SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,
|
|---|
| 1086 | lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,
|
|---|
| 1087 | lpBand->rcBand.right,
|
|---|
| 1088 | lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);
|
|---|
| 1089 | }
|
|---|
| 1090 | }
|
|---|
| 1091 | else { /* no gripper will be drawn */
|
|---|
| 1092 | xoff = 0;
|
|---|
| 1093 | if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
|
|---|
| 1094 | /* if no gripper but either image or text, then leave space */
|
|---|
| 1095 | xoff = REBAR_ALWAYS_SPACE;
|
|---|
| 1096 | /* initialize Caption image rectangle */
|
|---|
| 1097 | SetRect (&lpBand->rcCapImage,
|
|---|
| 1098 | lpBand->rcBand.left, lpBand->rcBand.top+xoff,
|
|---|
| 1099 | lpBand->rcBand.right, lpBand->rcBand.top+xoff);
|
|---|
| 1100 | }
|
|---|
| 1101 |
|
|---|
| 1102 | /* image is visible */
|
|---|
| 1103 | if (lpBand->fStatus & HAS_IMAGE) {
|
|---|
| 1104 | lpBand->fDraw |= DRAW_IMAGE;
|
|---|
| 1105 |
|
|---|
| 1106 | lpBand->rcCapImage.right = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
|
|---|
| 1107 | lpBand->rcCapImage.bottom += infoPtr->imageSize.cy;
|
|---|
| 1108 |
|
|---|
| 1109 | /* set initial caption text rectangle */
|
|---|
| 1110 | SetRect (&lpBand->rcCapText,
|
|---|
| 1111 | lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE,
|
|---|
| 1112 | lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);
|
|---|
| 1113 | /* update band height *
|
|---|
| 1114 | if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {
|
|---|
| 1115 | lpBand->uMinHeight = infoPtr->imageSize.cx + 2;
|
|---|
| 1116 | lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;
|
|---|
| 1117 | } */
|
|---|
| 1118 | }
|
|---|
| 1119 | else {
|
|---|
| 1120 | /* set initial caption text rectangle */
|
|---|
| 1121 | SetRect (&lpBand->rcCapText,
|
|---|
| 1122 | lpBand->rcBand.left, lpBand->rcCapImage.bottom,
|
|---|
| 1123 | lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);
|
|---|
| 1124 | }
|
|---|
| 1125 |
|
|---|
| 1126 | /* text is visible */
|
|---|
| 1127 | if ((lpBand->fStatus & HAS_TEXT) && !(lpBand->fStyle & RBBS_HIDETITLE)) {
|
|---|
| 1128 | lpBand->fDraw |= DRAW_TEXT;
|
|---|
| 1129 | lpBand->rcCapText.bottom = max(lpBand->rcCapText.top,
|
|---|
| 1130 | lpBand->rcCapText.bottom);
|
|---|
| 1131 | }
|
|---|
| 1132 |
|
|---|
| 1133 | /* set initial child window rectangle if there is a child */
|
|---|
| 1134 | if (lpBand->fMask & RBBIM_CHILD) {
|
|---|
| 1135 | yoff = lpBand->offChild.cx;
|
|---|
| 1136 | xoff = lpBand->offChild.cy;
|
|---|
| 1137 | SetRect (&lpBand->rcChild,
|
|---|
| 1138 | lpBand->rcBand.left+xoff, lpBand->rcBand.top+lpBand->cxHeader,
|
|---|
| 1139 | lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);
|
|---|
| 1140 | }
|
|---|
| 1141 | else {
|
|---|
| 1142 | SetRect (&lpBand->rcChild,
|
|---|
| 1143 | lpBand->rcBand.left, lpBand->rcBand.top+lpBand->cxHeader,
|
|---|
| 1144 | lpBand->rcBand.right, lpBand->rcBand.bottom);
|
|---|
| 1145 | }
|
|---|
| 1146 |
|
|---|
| 1147 | /* flag if notify required and invalidate rectangle */
|
|---|
| 1148 | if (notify &&
|
|---|
| 1149 | ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||
|
|---|
| 1150 | (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
|
|---|
| 1151 | TRACE("Child rectangle changed for band %u\n", i);
|
|---|
| 1152 | TRACE(" from (%ld,%ld)-(%ld,%ld) to (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1153 | oldChild.left, oldChild.top,
|
|---|
| 1154 | oldChild.right, oldChild.bottom,
|
|---|
| 1155 | lpBand->rcChild.left, lpBand->rcChild.top,
|
|---|
| 1156 | lpBand->rcChild.right, lpBand->rcChild.bottom);
|
|---|
| 1157 | }
|
|---|
| 1158 | if (lpBand->fDraw & NTF_INVALIDATE) {
|
|---|
| 1159 | TRACE("invalidating (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1160 | lpBand->rcBand.left,
|
|---|
| 1161 | lpBand->rcBand.top,
|
|---|
| 1162 | lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0),
|
|---|
| 1163 | lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0));
|
|---|
| 1164 | lpBand->fDraw &= ~NTF_INVALIDATE;
|
|---|
| 1165 | work = lpBand->rcBand;
|
|---|
| 1166 | if (lpBand->fDraw & DRAW_RIGHTSEP) work.bottom += SEP_WIDTH_SIZE;
|
|---|
| 1167 | if (lpBand->fDraw & DRAW_BOTTOMSEP) work.right += SEP_WIDTH_SIZE;
|
|---|
| 1168 | InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
|
|---|
| 1169 | }
|
|---|
| 1170 |
|
|---|
| 1171 | }
|
|---|
| 1172 | }
|
|---|
| 1173 |
|
|---|
| 1174 | #ifdef __WIN32OS2__
|
|---|
| 1175 | // Rewriting the original function below is too much work. Duplicated it
|
|---|
| 1176 | // instead
|
|---|
| 1177 | static VOID
|
|---|
| 1178 | REBAR_ForceResize2 (REBAR_INFO *infoPtr, INT newWidth, INT newHeight)
|
|---|
| 1179 | /* Function: This changes the size of the REBAR window to that */
|
|---|
| 1180 | /* calculated by REBAR_Layout. */
|
|---|
| 1181 | {
|
|---|
| 1182 | RECT rc;
|
|---|
| 1183 | INT x, y, width, height;
|
|---|
| 1184 | INT xedge = GetSystemMetrics(SM_CXEDGE);
|
|---|
| 1185 | INT yedge = GetSystemMetrics(SM_CYEDGE);
|
|---|
| 1186 |
|
|---|
| 1187 | GetClientRect (infoPtr->hwndSelf, &rc);
|
|---|
| 1188 |
|
|---|
| 1189 | TRACE( " old [%ld x %ld], new [%ld x %ld], client [%ld x %ld]\n",
|
|---|
| 1190 | infoPtr->oldSize.cx, infoPtr->oldSize.cy,
|
|---|
| 1191 | infoPtr->calcSize.cx, infoPtr->calcSize.cy,
|
|---|
| 1192 | rc.right, rc.bottom);
|
|---|
| 1193 |
|
|---|
| 1194 | width = 0;
|
|---|
| 1195 | height = 0;
|
|---|
| 1196 | x = 0;
|
|---|
| 1197 | y = 0;
|
|---|
| 1198 |
|
|---|
| 1199 | if (infoPtr->dwStyle & WS_BORDER) {
|
|---|
| 1200 | width = 2 * xedge;
|
|---|
| 1201 | height = 2 * yedge;
|
|---|
| 1202 | }
|
|---|
| 1203 |
|
|---|
| 1204 | {
|
|---|
| 1205 | INT mode = infoPtr->dwStyle & (CCS_VERT | CCS_TOP | CCS_BOTTOM);
|
|---|
| 1206 |
|
|---|
| 1207 | RECT rcPcl;
|
|---|
| 1208 |
|
|---|
| 1209 | rcPcl.left = 0; rcPcl.right = newWidth;
|
|---|
| 1210 | rcPcl.top = 0; rcPcl.bottom = newHeight;
|
|---|
| 1211 |
|
|---|
| 1212 | switch (mode) {
|
|---|
| 1213 | case CCS_TOP:
|
|---|
| 1214 | /* _TOP sets width to parents width */
|
|---|
| 1215 | width += (rcPcl.right - rcPcl.left);
|
|---|
| 1216 | height += infoPtr->calcSize.cy;
|
|---|
| 1217 | x += ((infoPtr->dwStyle & WS_BORDER) ? -xedge : 0);
|
|---|
| 1218 | y += ((infoPtr->dwStyle & WS_BORDER) ? -yedge : 0);
|
|---|
| 1219 | y += ((infoPtr->dwStyle & CCS_NODIVIDER) ? 0 : REBAR_DIVIDER);
|
|---|
| 1220 | break;
|
|---|
| 1221 | case CCS_BOTTOM:
|
|---|
| 1222 | /* FIXME: wrong wrong wrong */
|
|---|
| 1223 | /* _BOTTOM sets width to parents width */
|
|---|
| 1224 | width += (rcPcl.right - rcPcl.left);
|
|---|
| 1225 | height += infoPtr->calcSize.cy;
|
|---|
| 1226 | x += -xedge;
|
|---|
| 1227 | y = rcPcl.bottom - height + 1;
|
|---|
| 1228 | break;
|
|---|
| 1229 | case CCS_LEFT:
|
|---|
| 1230 | /* _LEFT sets height to parents height */
|
|---|
| 1231 | width += infoPtr->calcSize.cx;
|
|---|
| 1232 | height += (rcPcl.bottom - rcPcl.top);
|
|---|
| 1233 | x += ((infoPtr->dwStyle & WS_BORDER) ? -xedge : 0);
|
|---|
| 1234 | x += ((infoPtr->dwStyle & CCS_NODIVIDER) ? 0 : REBAR_DIVIDER);
|
|---|
| 1235 | y += ((infoPtr->dwStyle & WS_BORDER) ? -yedge : 0);
|
|---|
| 1236 | break;
|
|---|
| 1237 | case CCS_RIGHT:
|
|---|
| 1238 | /* FIXME: wrong wrong wrong */
|
|---|
| 1239 | /* _RIGHT sets height to parents height */
|
|---|
| 1240 | width += infoPtr->calcSize.cx;
|
|---|
| 1241 | height += (rcPcl.bottom - rcPcl.top);
|
|---|
| 1242 | x = rcPcl.right - width + 1;
|
|---|
| 1243 | y = -yedge;
|
|---|
| 1244 | break;
|
|---|
| 1245 | default:
|
|---|
| 1246 | width += infoPtr->calcSize.cx;
|
|---|
| 1247 | height += infoPtr->calcSize.cy;
|
|---|
| 1248 | }
|
|---|
| 1249 | }
|
|---|
| 1250 |
|
|---|
| 1251 | TRACE("hwnd %p, style=%08lx, setting at (%d,%d) for (%d,%d)\n",
|
|---|
| 1252 | infoPtr->hwndSelf, infoPtr->dwStyle,
|
|---|
| 1253 | x, y, width, height);
|
|---|
| 1254 | #ifdef __WIN32OS2__
|
|---|
| 1255 | //NOTE: this one is causing problems!!!!
|
|---|
| 1256 | if(height != 0)
|
|---|
| 1257 | #endif
|
|---|
| 1258 | SetWindowPos (infoPtr->hwndSelf, 0, x, y, width, height,
|
|---|
| 1259 | SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
|
|---|
| 1260 | }
|
|---|
| 1261 | #endif
|
|---|
| 1262 |
|
|---|
| 1263 | static VOID
|
|---|
| 1264 | REBAR_ForceResize (REBAR_INFO *infoPtr)
|
|---|
| 1265 | /* Function: This changes the size of the REBAR window to that */
|
|---|
| 1266 | /* calculated by REBAR_Layout. */
|
|---|
| 1267 | {
|
|---|
| 1268 | RECT rc;
|
|---|
| 1269 | INT x, y, width, height;
|
|---|
| 1270 | INT xedge = GetSystemMetrics(SM_CXEDGE);
|
|---|
| 1271 | INT yedge = GetSystemMetrics(SM_CYEDGE);
|
|---|
| 1272 |
|
|---|
| 1273 | /* TEST TEST TEST */
|
|---|
| 1274 | GetWindowRect (infoPtr->hwndSelf, &rc);
|
|---|
| 1275 | /* END TEST END TEST END TEST */
|
|---|
| 1276 |
|
|---|
| 1277 |
|
|---|
| 1278 | GetClientRect (infoPtr->hwndSelf, &rc);
|
|---|
| 1279 |
|
|---|
| 1280 | TRACE( " old [%ld x %ld], new [%ld x %ld], client [%ld x %ld]\n",
|
|---|
| 1281 | infoPtr->oldSize.cx, infoPtr->oldSize.cy,
|
|---|
| 1282 | infoPtr->calcSize.cx, infoPtr->calcSize.cy,
|
|---|
| 1283 | rc.right, rc.bottom);
|
|---|
| 1284 |
|
|---|
| 1285 | /* If we need to shrink client, then skip size test */
|
|---|
| 1286 | if ((infoPtr->calcSize.cy >= rc.bottom) &&
|
|---|
| 1287 | (infoPtr->calcSize.cx >= rc.right)) {
|
|---|
| 1288 |
|
|---|
| 1289 | /* if size did not change then skip process */
|
|---|
| 1290 | if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) &&
|
|---|
| 1291 | (infoPtr->oldSize.cy == infoPtr->calcSize.cy) &&
|
|---|
| 1292 | !(infoPtr->fStatus & RESIZE_ANYHOW))
|
|---|
| 1293 | {
|
|---|
| 1294 | TRACE("skipping reset\n");
|
|---|
| 1295 | return;
|
|---|
| 1296 | }
|
|---|
| 1297 | }
|
|---|
| 1298 |
|
|---|
| 1299 | infoPtr->fStatus &= ~RESIZE_ANYHOW;
|
|---|
| 1300 | /* Set flag to ignore next WM_SIZE message */
|
|---|
| 1301 | infoPtr->fStatus |= AUTO_RESIZE;
|
|---|
| 1302 |
|
|---|
| 1303 | width = 0;
|
|---|
| 1304 | height = 0;
|
|---|
| 1305 | x = 0;
|
|---|
| 1306 | y = 0;
|
|---|
| 1307 |
|
|---|
| 1308 | if (infoPtr->dwStyle & WS_BORDER) {
|
|---|
| 1309 | width = 2 * xedge;
|
|---|
| 1310 | height = 2 * yedge;
|
|---|
| 1311 | }
|
|---|
| 1312 |
|
|---|
| 1313 | if (!(infoPtr->dwStyle & CCS_NOPARENTALIGN)) {
|
|---|
| 1314 | INT mode = infoPtr->dwStyle & (CCS_VERT | CCS_TOP | CCS_BOTTOM);
|
|---|
| 1315 | RECT rcPcl;
|
|---|
| 1316 |
|
|---|
| 1317 | GetClientRect(GetParent(infoPtr->hwndSelf), &rcPcl);
|
|---|
| 1318 | switch (mode) {
|
|---|
| 1319 | case CCS_TOP:
|
|---|
| 1320 | /* _TOP sets width to parents width */
|
|---|
| 1321 | width += (rcPcl.right - rcPcl.left);
|
|---|
| 1322 | height += infoPtr->calcSize.cy;
|
|---|
| 1323 | x += ((infoPtr->dwStyle & WS_BORDER) ? -xedge : 0);
|
|---|
| 1324 | y += ((infoPtr->dwStyle & WS_BORDER) ? -yedge : 0);
|
|---|
| 1325 | y += ((infoPtr->dwStyle & CCS_NODIVIDER) ? 0 : REBAR_DIVIDER);
|
|---|
| 1326 | break;
|
|---|
| 1327 | case CCS_BOTTOM:
|
|---|
| 1328 | /* FIXME: wrong wrong wrong */
|
|---|
| 1329 | /* _BOTTOM sets width to parents width */
|
|---|
| 1330 | width += (rcPcl.right - rcPcl.left);
|
|---|
| 1331 | height += infoPtr->calcSize.cy;
|
|---|
| 1332 | x += -xedge;
|
|---|
| 1333 | y = rcPcl.bottom - height + 1;
|
|---|
| 1334 | break;
|
|---|
| 1335 | case CCS_LEFT:
|
|---|
| 1336 | /* _LEFT sets height to parents height */
|
|---|
| 1337 | width += infoPtr->calcSize.cx;
|
|---|
| 1338 | height += (rcPcl.bottom - rcPcl.top);
|
|---|
| 1339 | x += ((infoPtr->dwStyle & WS_BORDER) ? -xedge : 0);
|
|---|
| 1340 | x += ((infoPtr->dwStyle & CCS_NODIVIDER) ? 0 : REBAR_DIVIDER);
|
|---|
| 1341 | y += ((infoPtr->dwStyle & WS_BORDER) ? -yedge : 0);
|
|---|
| 1342 | break;
|
|---|
| 1343 | case CCS_RIGHT:
|
|---|
| 1344 | /* FIXME: wrong wrong wrong */
|
|---|
| 1345 | /* _RIGHT sets height to parents height */
|
|---|
| 1346 | width += infoPtr->calcSize.cx;
|
|---|
| 1347 | height += (rcPcl.bottom - rcPcl.top);
|
|---|
| 1348 | x = rcPcl.right - width + 1;
|
|---|
| 1349 | y = -yedge;
|
|---|
| 1350 | break;
|
|---|
| 1351 | default:
|
|---|
| 1352 | width += infoPtr->calcSize.cx;
|
|---|
| 1353 | height += infoPtr->calcSize.cy;
|
|---|
| 1354 | }
|
|---|
| 1355 | }
|
|---|
| 1356 | else {
|
|---|
| 1357 | width += infoPtr->calcSize.cx;
|
|---|
| 1358 | height += infoPtr->calcSize.cy;
|
|---|
| 1359 | x = infoPtr->origin.x;
|
|---|
| 1360 | y = infoPtr->origin.y;
|
|---|
| 1361 | }
|
|---|
| 1362 |
|
|---|
| 1363 | TRACE("hwnd %p, style=%08lx, setting at (%d,%d) for (%d,%d)\n",
|
|---|
| 1364 | infoPtr->hwndSelf, infoPtr->dwStyle,
|
|---|
| 1365 | x, y, width, height);
|
|---|
| 1366 | #ifdef __WIN32OS2__
|
|---|
| 1367 | //NOTE: this one is causing problems!!!!
|
|---|
| 1368 | if(height != 0)
|
|---|
| 1369 | #endif
|
|---|
| 1370 | SetWindowPos (infoPtr->hwndSelf, 0, x, y, width, height,
|
|---|
| 1371 | SWP_NOZORDER);
|
|---|
| 1372 | }
|
|---|
| 1373 |
|
|---|
| 1374 |
|
|---|
| 1375 | static VOID
|
|---|
| 1376 | REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus)
|
|---|
| 1377 | {
|
|---|
| 1378 | REBAR_BAND *lpBand;
|
|---|
| 1379 | CHAR szClassName[40];
|
|---|
| 1380 | UINT i;
|
|---|
| 1381 | NMREBARCHILDSIZE rbcz;
|
|---|
| 1382 | NMHDR heightchange;
|
|---|
| 1383 | HDWP deferpos;
|
|---|
| 1384 |
|
|---|
| 1385 | if (!(deferpos = BeginDeferWindowPos(infoPtr->uNumBands)))
|
|---|
| 1386 | ERR("BeginDeferWindowPos returned NULL\n");
|
|---|
| 1387 |
|
|---|
| 1388 | for (i = start; i < endplus; i++) {
|
|---|
| 1389 | lpBand = &infoPtr->bands[i];
|
|---|
| 1390 |
|
|---|
| 1391 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 1392 | if (lpBand->hwndChild) {
|
|---|
| 1393 | TRACE("hwndChild = %p\n", lpBand->hwndChild);
|
|---|
| 1394 |
|
|---|
| 1395 | /* Always geterate the RBN_CHILDSIZE even it child
|
|---|
| 1396 | did not change */
|
|---|
| 1397 | rbcz.uBand = i;
|
|---|
| 1398 | rbcz.wID = lpBand->wID;
|
|---|
| 1399 | rbcz.rcChild = lpBand->rcChild;
|
|---|
| 1400 | rbcz.rcBand = lpBand->rcBand;
|
|---|
| 1401 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 1402 | rbcz.rcBand.top += lpBand->cxHeader;
|
|---|
| 1403 | else
|
|---|
| 1404 | rbcz.rcBand.left += lpBand->cxHeader;
|
|---|
| 1405 | REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE);
|
|---|
| 1406 | if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) {
|
|---|
| 1407 | TRACE("Child rect changed by NOTIFY for band %u\n", i);
|
|---|
| 1408 | TRACE(" from (%ld,%ld)-(%ld,%ld) to (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1409 | lpBand->rcChild.left, lpBand->rcChild.top,
|
|---|
| 1410 | lpBand->rcChild.right, lpBand->rcChild.bottom,
|
|---|
| 1411 | rbcz.rcChild.left, rbcz.rcChild.top,
|
|---|
| 1412 | rbcz.rcChild.right, rbcz.rcChild.bottom);
|
|---|
| 1413 | lpBand->rcChild = rbcz.rcChild; /* *** ??? */
|
|---|
| 1414 | }
|
|---|
| 1415 |
|
|---|
| 1416 | /* native (IE4 in "Favorites" frame **1) does:
|
|---|
| 1417 | * SetRect (&rc, -1, -1, -1, -1)
|
|---|
| 1418 | * EqualRect (&rc,band->rc???)
|
|---|
| 1419 | * if ret==0
|
|---|
| 1420 | * CopyRect (band->rc????, &rc)
|
|---|
| 1421 | * set flag outside of loop
|
|---|
| 1422 | */
|
|---|
| 1423 |
|
|---|
| 1424 | GetClassNameA (lpBand->hwndChild, szClassName, 40);
|
|---|
| 1425 | if (!lstrcmpA (szClassName, "ComboBox") ||
|
|---|
| 1426 | !lstrcmpA (szClassName, WC_COMBOBOXEXA)) {
|
|---|
| 1427 | INT nEditHeight, yPos;
|
|---|
| 1428 | RECT rc;
|
|---|
| 1429 |
|
|---|
| 1430 | /* special placement code for combo or comboex box */
|
|---|
| 1431 |
|
|---|
| 1432 |
|
|---|
| 1433 | /* get size of edit line */
|
|---|
| 1434 | GetWindowRect (lpBand->hwndChild, &rc);
|
|---|
| 1435 | nEditHeight = rc.bottom - rc.top;
|
|---|
| 1436 | yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
|
|---|
| 1437 |
|
|---|
| 1438 | /* center combo box inside child area */
|
|---|
| 1439 | TRACE("moving child (Combo(Ex)) %p to (%ld,%d) for (%ld,%d)\n",
|
|---|
| 1440 | lpBand->hwndChild,
|
|---|
| 1441 | lpBand->rcChild.left, yPos,
|
|---|
| 1442 | lpBand->rcChild.right - lpBand->rcChild.left,
|
|---|
| 1443 | nEditHeight);
|
|---|
| 1444 | deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,
|
|---|
| 1445 | lpBand->rcChild.left,
|
|---|
| 1446 | /*lpBand->rcChild.top*/ yPos,
|
|---|
| 1447 | lpBand->rcChild.right - lpBand->rcChild.left,
|
|---|
| 1448 | nEditHeight,
|
|---|
| 1449 | SWP_NOZORDER);
|
|---|
| 1450 | if (!deferpos)
|
|---|
| 1451 | ERR("DeferWindowPos returned NULL\n");
|
|---|
| 1452 | }
|
|---|
| 1453 | else {
|
|---|
| 1454 | TRACE("moving child (Other) %p to (%ld,%ld) for (%ld,%ld)\n",
|
|---|
| 1455 | lpBand->hwndChild,
|
|---|
| 1456 | lpBand->rcChild.left, lpBand->rcChild.top,
|
|---|
| 1457 | lpBand->rcChild.right - lpBand->rcChild.left,
|
|---|
| 1458 | lpBand->rcChild.bottom - lpBand->rcChild.top);
|
|---|
| 1459 | deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,
|
|---|
| 1460 | lpBand->rcChild.left,
|
|---|
| 1461 | lpBand->rcChild.top,
|
|---|
| 1462 | lpBand->rcChild.right - lpBand->rcChild.left,
|
|---|
| 1463 | lpBand->rcChild.bottom - lpBand->rcChild.top,
|
|---|
| 1464 | SWP_NOZORDER);
|
|---|
| 1465 | if (!deferpos)
|
|---|
| 1466 | ERR("DeferWindowPos returned NULL\n");
|
|---|
| 1467 | }
|
|---|
| 1468 | }
|
|---|
| 1469 | }
|
|---|
| 1470 | if (!EndDeferWindowPos(deferpos))
|
|---|
| 1471 | ERR("EndDeferWindowPos returned NULL\n");
|
|---|
| 1472 |
|
|---|
| 1473 | if (infoPtr->DoRedraw)
|
|---|
| 1474 | UpdateWindow (infoPtr->hwndSelf);
|
|---|
| 1475 |
|
|---|
| 1476 | if (infoPtr->fStatus & NTF_HGHTCHG) {
|
|---|
| 1477 | infoPtr->fStatus &= ~NTF_HGHTCHG;
|
|---|
| 1478 | REBAR_Notify (&heightchange, infoPtr, RBN_HEIGHTCHANGE);
|
|---|
| 1479 | }
|
|---|
| 1480 |
|
|---|
| 1481 | /* native (from **1 above) does:
|
|---|
| 1482 | * UpdateWindow(rebar)
|
|---|
| 1483 | * REBAR_ForceResize
|
|---|
| 1484 | * RBN_HEIGHTCHANGE if necessary
|
|---|
| 1485 | * if ret from any EqualRect was 0
|
|---|
| 1486 | * Goto "BeginDeferWindowPos"
|
|---|
| 1487 | */
|
|---|
| 1488 |
|
|---|
| 1489 | }
|
|---|
| 1490 |
|
|---|
| 1491 |
|
|---|
| 1492 | static VOID
|
|---|
| 1493 | REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
|
|---|
| 1494 | /* Function: This routine is resposible for laying out all */
|
|---|
| 1495 | /* the bands in a rebar. It assigns each band to a row and*/
|
|---|
| 1496 | /* determines when to start a new row. */
|
|---|
| 1497 | {
|
|---|
| 1498 | REBAR_BAND *lpBand, *prevBand;
|
|---|
| 1499 | RECT rcClient, rcAdj;
|
|---|
| 1500 | INT initx, inity, x, y, cx, cxsep, mmcy, mcy, clientcx, clientcy;
|
|---|
| 1501 | INT adjcx, adjcy, row, rightx, bottomy, origheight;
|
|---|
| 1502 | UINT i, j, rowstart, origrows, cntonrow;
|
|---|
| 1503 | BOOL dobreak;
|
|---|
| 1504 |
|
|---|
| 1505 | if (!(infoPtr->fStatus & BAND_NEEDS_LAYOUT)) {
|
|---|
| 1506 | TRACE("no layout done. No band changed.\n");
|
|---|
| 1507 | REBAR_DumpBand (infoPtr);
|
|---|
| 1508 | return;
|
|---|
| 1509 | }
|
|---|
| 1510 | infoPtr->fStatus &= ~BAND_NEEDS_LAYOUT;
|
|---|
| 1511 | if (!infoPtr->DoRedraw) infoPtr->fStatus |= BAND_NEEDS_REDRAW;
|
|---|
| 1512 |
|
|---|
| 1513 | GetClientRect (infoPtr->hwndSelf, &rcClient);
|
|---|
| 1514 | TRACE("Client is (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1515 | rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
|
|---|
| 1516 |
|
|---|
| 1517 | if (lpRect) {
|
|---|
| 1518 | rcAdj = *lpRect;
|
|---|
| 1519 | TRACE("adjustment rect is (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1520 | rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom);
|
|---|
| 1521 | }
|
|---|
| 1522 | else {
|
|---|
| 1523 | CopyRect (&rcAdj, &rcClient);
|
|---|
| 1524 | }
|
|---|
| 1525 |
|
|---|
| 1526 | clientcx = rcClient.right - rcClient.left;
|
|---|
| 1527 | clientcy = rcClient.bottom - rcClient.top;
|
|---|
| 1528 | adjcx = rcAdj.right - rcAdj.left;
|
|---|
| 1529 | adjcy = rcAdj.bottom - rcAdj.top;
|
|---|
| 1530 | if (resetclient) {
|
|---|
| 1531 | TRACE("window client rect will be set to adj rect\n");
|
|---|
| 1532 | clientcx = adjcx;
|
|---|
| 1533 | clientcy = adjcy;
|
|---|
| 1534 | }
|
|---|
| 1535 |
|
|---|
| 1536 | if (!infoPtr->DoRedraw && (clientcx == 0) && (clientcy == 0)) {
|
|---|
| 1537 | ERR("no redraw and client is zero, skip layout\n");
|
|---|
| 1538 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 1539 | return;
|
|---|
| 1540 | }
|
|---|
| 1541 |
|
|---|
| 1542 | /* save height of original control */
|
|---|
| 1543 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 1544 | origheight = infoPtr->calcSize.cx;
|
|---|
| 1545 | else
|
|---|
| 1546 | origheight = infoPtr->calcSize.cy;
|
|---|
| 1547 | origrows = infoPtr->uNumRows;
|
|---|
| 1548 |
|
|---|
| 1549 | initx = 0;
|
|---|
| 1550 | inity = 0;
|
|---|
| 1551 |
|
|---|
| 1552 | /* ******* Start Phase 1 - all bands on row at minimum size ******* */
|
|---|
| 1553 |
|
|---|
| 1554 | TRACE("band loop constants, clientcx=%d, clientcy=%d, adjcx=%d, adjcy=%d\n",
|
|---|
| 1555 | clientcx, clientcy, adjcx, adjcy);
|
|---|
| 1556 | x = initx;
|
|---|
| 1557 | y = inity;
|
|---|
| 1558 | row = 1;
|
|---|
| 1559 | cx = 0;
|
|---|
| 1560 | mcy = 0;
|
|---|
| 1561 | rowstart = 0;
|
|---|
| 1562 | prevBand = NULL;
|
|---|
| 1563 | cntonrow = 0;
|
|---|
| 1564 |
|
|---|
| 1565 | for (i = 0; i < infoPtr->uNumBands; i++) {
|
|---|
| 1566 | lpBand = &infoPtr->bands[i];
|
|---|
| 1567 | lpBand->fDraw = 0;
|
|---|
| 1568 | lpBand->iRow = row;
|
|---|
| 1569 |
|
|---|
| 1570 | SetRectEmpty(&lpBand->rcChevron);
|
|---|
| 1571 |
|
|---|
| 1572 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 1573 |
|
|---|
| 1574 | lpBand->rcoldBand = lpBand->rcBand;
|
|---|
| 1575 |
|
|---|
| 1576 | /* Set the offset of the child window */
|
|---|
| 1577 | if ((lpBand->fMask & RBBIM_CHILD) &&
|
|---|
| 1578 | !(lpBand->fStyle & RBBS_FIXEDSIZE)) {
|
|---|
| 1579 | lpBand->offChild.cx = ((lpBand->fStyle & RBBS_CHILDEDGE) ? 4 : 0);
|
|---|
| 1580 | }
|
|---|
| 1581 | lpBand->offChild.cy = ((lpBand->fStyle & RBBS_CHILDEDGE) ? 2 : 0);
|
|---|
| 1582 |
|
|---|
| 1583 | /* separator from previous band */
|
|---|
| 1584 | cxsep = (cntonrow == 0) ? 0 : SEP_WIDTH;
|
|---|
| 1585 | cx = lpBand->lcx;
|
|---|
| 1586 |
|
|---|
| 1587 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 1588 | dobreak = (y + cx + cxsep > adjcy);
|
|---|
| 1589 | else
|
|---|
| 1590 | dobreak = (x + cx + cxsep > adjcx);
|
|---|
| 1591 |
|
|---|
| 1592 | /* This is the check for whether we need to start a new row */
|
|---|
| 1593 | if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) ||
|
|---|
| 1594 | ( ((infoPtr->dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) {
|
|---|
| 1595 |
|
|---|
| 1596 | for (j = rowstart; j < i; j++) {
|
|---|
| 1597 | REBAR_BAND *lpB;
|
|---|
| 1598 | lpB = &infoPtr->bands[j];
|
|---|
| 1599 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1600 | lpB->rcBand.right = lpB->rcBand.left + mcy;
|
|---|
| 1601 | }
|
|---|
| 1602 | else {
|
|---|
| 1603 | lpB->rcBand.bottom = lpB->rcBand.top + mcy;
|
|---|
| 1604 | }
|
|---|
| 1605 | }
|
|---|
| 1606 |
|
|---|
| 1607 | TRACE("P1 Spliting to new row %d on band %u\n", row+1, i);
|
|---|
| 1608 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1609 | y = inity;
|
|---|
| 1610 | x += (mcy + SEP_WIDTH);
|
|---|
| 1611 | }
|
|---|
| 1612 | else {
|
|---|
| 1613 | x = initx;
|
|---|
| 1614 | y += (mcy + SEP_WIDTH);
|
|---|
| 1615 | }
|
|---|
| 1616 |
|
|---|
| 1617 | mcy = 0;
|
|---|
| 1618 | cxsep = 0;
|
|---|
| 1619 | row++;
|
|---|
| 1620 | lpBand->iRow = row;
|
|---|
| 1621 | prevBand = NULL;
|
|---|
| 1622 | rowstart = i;
|
|---|
| 1623 | cntonrow = 0;
|
|---|
| 1624 | }
|
|---|
| 1625 |
|
|---|
| 1626 | if (mcy < lpBand->lcy + REBARSPACE(lpBand))
|
|---|
| 1627 | mcy = lpBand->lcy + REBARSPACE(lpBand);
|
|---|
| 1628 |
|
|---|
| 1629 | /* if boundary rect specified then limit mcy */
|
|---|
| 1630 | if (lpRect) {
|
|---|
| 1631 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1632 | if (x+mcy > adjcx) {
|
|---|
| 1633 | mcy = adjcx - x;
|
|---|
| 1634 | TRACE("P1 row %u limiting mcy=%d, adjcx=%d, x=%d\n",
|
|---|
| 1635 | i, mcy, adjcx, x);
|
|---|
| 1636 | }
|
|---|
| 1637 | }
|
|---|
| 1638 | else {
|
|---|
| 1639 | if (y+mcy > adjcy) {
|
|---|
| 1640 | mcy = adjcy - y;
|
|---|
| 1641 | TRACE("P1 row %u limiting mcy=%d, adjcy=%d, y=%d\n",
|
|---|
| 1642 | i, mcy, adjcy, y);
|
|---|
| 1643 | }
|
|---|
| 1644 | }
|
|---|
| 1645 | }
|
|---|
| 1646 |
|
|---|
| 1647 | TRACE("P1 band %u, row %d, x=%d, y=%d, cxsep=%d, cx=%d\n",
|
|---|
| 1648 | i, row,
|
|---|
| 1649 | x, y, cxsep, cx);
|
|---|
| 1650 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1651 | /* bound the bottom side if we have a bounding rectangle */
|
|---|
| 1652 | rightx = clientcx;
|
|---|
| 1653 | bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx;
|
|---|
| 1654 | lpBand->rcBand.left = x;
|
|---|
| 1655 | lpBand->rcBand.right = x + min(mcy,
|
|---|
| 1656 | lpBand->lcy+REBARSPACE(lpBand));
|
|---|
| 1657 | lpBand->rcBand.top = min(bottomy, y + cxsep);
|
|---|
| 1658 | lpBand->rcBand.bottom = bottomy;
|
|---|
| 1659 | lpBand->uMinHeight = lpBand->lcy;
|
|---|
| 1660 | y = bottomy;
|
|---|
| 1661 | }
|
|---|
| 1662 | else {
|
|---|
| 1663 | /* bound the right side if we have a bounding rectangle */
|
|---|
| 1664 | rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx;
|
|---|
| 1665 | bottomy = clientcy;
|
|---|
| 1666 | lpBand->rcBand.left = min(rightx, x + cxsep);
|
|---|
| 1667 | lpBand->rcBand.right = rightx;
|
|---|
| 1668 | lpBand->rcBand.top = y;
|
|---|
| 1669 | lpBand->rcBand.bottom = y + min(mcy,
|
|---|
| 1670 | lpBand->lcy+REBARSPACE(lpBand));
|
|---|
| 1671 | lpBand->uMinHeight = lpBand->lcy;
|
|---|
| 1672 | x = rightx;
|
|---|
| 1673 | }
|
|---|
| 1674 | TRACE("P1 band %u, row %d, (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1675 | i, row,
|
|---|
| 1676 | lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 1677 | lpBand->rcBand.right, lpBand->rcBand.bottom);
|
|---|
| 1678 | prevBand = lpBand;
|
|---|
| 1679 | cntonrow++;
|
|---|
| 1680 |
|
|---|
| 1681 | } /* for (i = 0; i < infoPtr->uNumBands... */
|
|---|
| 1682 |
|
|---|
| 1683 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 1684 | x += mcy;
|
|---|
| 1685 | else
|
|---|
| 1686 | y += mcy;
|
|---|
| 1687 |
|
|---|
| 1688 | for (j = rowstart; j < infoPtr->uNumBands; j++) {
|
|---|
| 1689 | lpBand = &infoPtr->bands[j];
|
|---|
| 1690 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1691 | lpBand->rcBand.right = lpBand->rcBand.left + mcy;
|
|---|
| 1692 | }
|
|---|
| 1693 | else {
|
|---|
| 1694 | lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;
|
|---|
| 1695 | }
|
|---|
| 1696 | }
|
|---|
| 1697 |
|
|---|
| 1698 | if (infoPtr->uNumBands)
|
|---|
| 1699 | infoPtr->uNumRows = row;
|
|---|
| 1700 |
|
|---|
| 1701 | /* ******* End Phase 1 - all bands on row at minimum size ******* */
|
|---|
| 1702 |
|
|---|
| 1703 |
|
|---|
| 1704 | /* ******* Start Phase 1a - Adjust heights for RBS_VARHEIGHT off ******* */
|
|---|
| 1705 |
|
|---|
| 1706 | mmcy = 0;
|
|---|
| 1707 | if (!(infoPtr->dwStyle & RBS_VARHEIGHT)) {
|
|---|
| 1708 | INT xy;
|
|---|
| 1709 |
|
|---|
| 1710 | /* get the max height of all bands */
|
|---|
| 1711 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 1712 | lpBand = &infoPtr->bands[i];
|
|---|
| 1713 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 1714 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 1715 | mmcy = max(mmcy, lpBand->rcBand.right - lpBand->rcBand.left);
|
|---|
| 1716 | else
|
|---|
| 1717 | mmcy = max(mmcy, lpBand->rcBand.bottom - lpBand->rcBand.top);
|
|---|
| 1718 | }
|
|---|
| 1719 |
|
|---|
| 1720 | /* now adjust all rectangles by using the height found above */
|
|---|
| 1721 | xy = 0;
|
|---|
| 1722 | row = 1;
|
|---|
| 1723 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 1724 | lpBand = &infoPtr->bands[i];
|
|---|
| 1725 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 1726 | if (lpBand->iRow != row)
|
|---|
| 1727 | xy += (mmcy + SEP_WIDTH);
|
|---|
| 1728 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1729 | lpBand->rcBand.left = xy;
|
|---|
| 1730 | lpBand->rcBand.right = xy + mmcy;
|
|---|
| 1731 | }
|
|---|
| 1732 | else {
|
|---|
| 1733 | lpBand->rcBand.top = xy;
|
|---|
| 1734 | lpBand->rcBand.bottom = xy + mmcy;
|
|---|
| 1735 | }
|
|---|
| 1736 | }
|
|---|
| 1737 |
|
|---|
| 1738 | /* set the x/y values to the correct maximum */
|
|---|
| 1739 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 1740 | x = xy + mmcy;
|
|---|
| 1741 | else
|
|---|
| 1742 | y = xy + mmcy;
|
|---|
| 1743 | }
|
|---|
| 1744 |
|
|---|
| 1745 | /* ******* End Phase 1a - Adjust heights for RBS_VARHEIGHT off ******* */
|
|---|
| 1746 |
|
|---|
| 1747 |
|
|---|
| 1748 | /* ******* Start Phase 2 - split rows till adjustment height full ******* */
|
|---|
| 1749 |
|
|---|
| 1750 | /* assumes that the following variables contain: */
|
|---|
| 1751 | /* y/x current height/width of all rows */
|
|---|
| 1752 | if (lpRect) {
|
|---|
| 1753 | INT i, prev_rh, new_rh, adj_rh, prev_idx, current_idx;
|
|---|
| 1754 | REBAR_BAND *prev, *current, *walk;
|
|---|
| 1755 | UINT j;
|
|---|
| 1756 |
|
|---|
| 1757 | /* FIXME: problem # 2 */
|
|---|
| 1758 | if (((infoPtr->dwStyle & CCS_VERT) ?
|
|---|
| 1759 | #if PROBLEM2
|
|---|
| 1760 | (x < adjcx) : (y < adjcy)
|
|---|
| 1761 | #else
|
|---|
| 1762 | (adjcx - x > 5) : (adjcy - y > 4)
|
|---|
| 1763 | #endif
|
|---|
| 1764 | ) &&
|
|---|
| 1765 | (infoPtr->uNumBands > 1)) {
|
|---|
| 1766 | for (i=(INT)infoPtr->uNumBands-2; i>=0; i--) {
|
|---|
| 1767 | TRACE("P2 adjcx=%d, adjcy=%d, x=%d, y=%d\n",
|
|---|
| 1768 | adjcx, adjcy, x, y);
|
|---|
| 1769 |
|
|---|
| 1770 | /* find the current band (starts at i+1) */
|
|---|
| 1771 | current = &infoPtr->bands[i+1];
|
|---|
| 1772 | current_idx = i+1;
|
|---|
| 1773 | while (HIDDENBAND(current)) {
|
|---|
| 1774 | i--;
|
|---|
| 1775 | if (i < 0) break; /* out of bands */
|
|---|
| 1776 | current = &infoPtr->bands[i+1];
|
|---|
| 1777 | current_idx = i+1;
|
|---|
| 1778 | }
|
|---|
| 1779 | if (i < 0) break; /* out of bands */
|
|---|
| 1780 |
|
|---|
| 1781 | /* now find the prev band (starts at i) */
|
|---|
| 1782 | prev = &infoPtr->bands[i];
|
|---|
| 1783 | prev_idx = i;
|
|---|
| 1784 | while (HIDDENBAND(prev)) {
|
|---|
| 1785 | i--;
|
|---|
| 1786 | if (i < 0) break; /* out of bands */
|
|---|
| 1787 | prev = &infoPtr->bands[i];
|
|---|
| 1788 | prev_idx = i;
|
|---|
| 1789 | }
|
|---|
| 1790 | if (i < 0) break; /* out of bands */
|
|---|
| 1791 |
|
|---|
| 1792 | prev_rh = ircBw(prev);
|
|---|
| 1793 | if (prev->iRow == current->iRow) {
|
|---|
| 1794 | new_rh = (infoPtr->dwStyle & RBS_VARHEIGHT) ?
|
|---|
| 1795 | current->lcy + REBARSPACE(current) :
|
|---|
| 1796 | mmcy;
|
|---|
| 1797 | adj_rh = new_rh + SEP_WIDTH;
|
|---|
| 1798 | infoPtr->uNumRows++;
|
|---|
| 1799 | current->fDraw |= NTF_INVALIDATE;
|
|---|
| 1800 | current->iRow++;
|
|---|
| 1801 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1802 | current->rcBand.top = inity;
|
|---|
| 1803 | current->rcBand.bottom = clientcy;
|
|---|
| 1804 | current->rcBand.left += (prev_rh + SEP_WIDTH);
|
|---|
| 1805 | current->rcBand.right = current->rcBand.left + new_rh;
|
|---|
| 1806 | x += adj_rh;
|
|---|
| 1807 | }
|
|---|
| 1808 | else {
|
|---|
| 1809 | current->rcBand.left = initx;
|
|---|
| 1810 | current->rcBand.right = clientcx;
|
|---|
| 1811 | current->rcBand.top += (prev_rh + SEP_WIDTH);
|
|---|
| 1812 | current->rcBand.bottom = current->rcBand.top + new_rh;
|
|---|
| 1813 | y += adj_rh;
|
|---|
| 1814 | }
|
|---|
| 1815 | TRACE("P2 moving band %d to own row at (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1816 | current_idx,
|
|---|
| 1817 | current->rcBand.left, current->rcBand.top,
|
|---|
| 1818 | current->rcBand.right, current->rcBand.bottom);
|
|---|
| 1819 | TRACE("P2 prev band %d at (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1820 | prev_idx,
|
|---|
| 1821 | prev->rcBand.left, prev->rcBand.top,
|
|---|
| 1822 | prev->rcBand.right, prev->rcBand.bottom);
|
|---|
| 1823 | TRACE("P2 values: prev_rh=%d, new_rh=%d, adj_rh=%d\n",
|
|---|
| 1824 | prev_rh, new_rh, adj_rh);
|
|---|
| 1825 | /* for bands below current adjust row # and top/bottom */
|
|---|
| 1826 | for (j = current_idx+1; j<infoPtr->uNumBands; j++) {
|
|---|
| 1827 | walk = &infoPtr->bands[j];
|
|---|
| 1828 | if (HIDDENBAND(walk)) continue;
|
|---|
| 1829 | walk->fDraw |= NTF_INVALIDATE;
|
|---|
| 1830 | walk->iRow++;
|
|---|
| 1831 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1832 | walk->rcBand.left += adj_rh;
|
|---|
| 1833 | walk->rcBand.right += adj_rh;
|
|---|
| 1834 | }
|
|---|
| 1835 | else {
|
|---|
| 1836 | walk->rcBand.top += adj_rh;
|
|---|
| 1837 | walk->rcBand.bottom += adj_rh;
|
|---|
| 1838 | }
|
|---|
| 1839 | }
|
|---|
| 1840 | if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy))
|
|---|
| 1841 | break; /* all done */
|
|---|
| 1842 | }
|
|---|
| 1843 | }
|
|---|
| 1844 | }
|
|---|
| 1845 | }
|
|---|
| 1846 |
|
|---|
| 1847 | /* ******* End Phase 2 - split rows till adjustment height full ******* */
|
|---|
| 1848 |
|
|---|
| 1849 |
|
|---|
| 1850 | /* ******* Start Phase 2a - mark first and last band in each ******* */
|
|---|
| 1851 |
|
|---|
| 1852 | prevBand = NULL;
|
|---|
| 1853 | for (i = 0; i < infoPtr->uNumBands; i++) {
|
|---|
| 1854 | lpBand = &infoPtr->bands[i];
|
|---|
| 1855 | if (HIDDENBAND(lpBand))
|
|---|
| 1856 | continue;
|
|---|
| 1857 | if( !prevBand ) {
|
|---|
| 1858 | lpBand->fDraw |= DRAW_FIRST_IN_ROW;
|
|---|
| 1859 | prevBand = lpBand;
|
|---|
| 1860 | }
|
|---|
| 1861 | else if( prevBand->iRow == lpBand->iRow )
|
|---|
| 1862 | prevBand = lpBand;
|
|---|
| 1863 | else {
|
|---|
| 1864 | prevBand->fDraw |= DRAW_LAST_IN_ROW;
|
|---|
| 1865 | lpBand->fDraw |= DRAW_FIRST_IN_ROW;
|
|---|
| 1866 | prevBand = lpBand;
|
|---|
| 1867 | }
|
|---|
| 1868 | }
|
|---|
| 1869 | if( prevBand )
|
|---|
| 1870 | prevBand->fDraw |= DRAW_LAST_IN_ROW;
|
|---|
| 1871 |
|
|---|
| 1872 | /* ******* End Phase 2a - mark first and last band in each ******* */
|
|---|
| 1873 |
|
|---|
| 1874 |
|
|---|
| 1875 | /* ******* Start Phase 2b - adjust all bands for height full ******* */
|
|---|
| 1876 | /* assumes that the following variables contain: */
|
|---|
| 1877 | /* y/x current height/width of all rows */
|
|---|
| 1878 | /* clientcy/clientcx height/width of client area */
|
|---|
| 1879 |
|
|---|
| 1880 | if (((infoPtr->dwStyle & CCS_VERT) ? clientcx > x : clientcy > y) &&
|
|---|
| 1881 | infoPtr->uNumBands) {
|
|---|
| 1882 | INT diff, i;
|
|---|
| 1883 | UINT j;
|
|---|
| 1884 |
|
|---|
| 1885 | diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y;
|
|---|
| 1886 |
|
|---|
| 1887 | /* iterate backwards thru the rows */
|
|---|
| 1888 | for (i = infoPtr->uNumBands-1; i>=0; i--) {
|
|---|
| 1889 | lpBand = &infoPtr->bands[i];
|
|---|
| 1890 | if(HIDDENBAND(lpBand)) continue;
|
|---|
| 1891 |
|
|---|
| 1892 | /* if row has more than 1 band, ignore it */
|
|---|
| 1893 | if( !(lpBand->fDraw&DRAW_FIRST_IN_ROW) )
|
|---|
| 1894 | continue;
|
|---|
| 1895 | if( !(lpBand->fDraw&DRAW_LAST_IN_ROW) )
|
|---|
| 1896 | continue;
|
|---|
| 1897 |
|
|---|
| 1898 | if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
|
|---|
| 1899 | if (((INT)lpBand->cyMaxChild < 1) ||
|
|---|
| 1900 | ((INT)lpBand->cyIntegral < 1)) {
|
|---|
| 1901 | if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue;
|
|---|
| 1902 | ERR("P2b band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n",
|
|---|
| 1903 | i, lpBand->cyMaxChild, lpBand->cyIntegral);
|
|---|
| 1904 | continue;
|
|---|
| 1905 | }
|
|---|
| 1906 | /* j is now the maximum height/width in the client area */
|
|---|
| 1907 | j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) +
|
|---|
| 1908 | ircBw(lpBand);
|
|---|
| 1909 | if (j > lpBand->cyMaxChild + REBARSPACE(lpBand))
|
|---|
| 1910 | j = lpBand->cyMaxChild + REBARSPACE(lpBand);
|
|---|
| 1911 | diff -= (j - ircBw(lpBand));
|
|---|
| 1912 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 1913 | lpBand->rcBand.right = lpBand->rcBand.left + j;
|
|---|
| 1914 | else
|
|---|
| 1915 | lpBand->rcBand.bottom = lpBand->rcBand.top + j;
|
|---|
| 1916 | TRACE("P2b band %d, row %d changed to (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 1917 | i, lpBand->iRow,
|
|---|
| 1918 | lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 1919 | lpBand->rcBand.right, lpBand->rcBand.bottom);
|
|---|
| 1920 | if (diff <= 0) break;
|
|---|
| 1921 | }
|
|---|
| 1922 | if (diff < 0) {
|
|---|
| 1923 | ERR("P2b allocated more than available, diff=%d\n", diff);
|
|---|
| 1924 | diff = 0;
|
|---|
| 1925 | }
|
|---|
| 1926 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 1927 | x = clientcx - diff;
|
|---|
| 1928 | else
|
|---|
| 1929 | y = clientcy - diff;
|
|---|
| 1930 | }
|
|---|
| 1931 |
|
|---|
| 1932 | /* ******* End Phase 2b - adjust all bands for height full ******* */
|
|---|
| 1933 |
|
|---|
| 1934 |
|
|---|
| 1935 | /* ******* Start Phase 3 - adjust all bands for width full ******* */
|
|---|
| 1936 |
|
|---|
| 1937 | if (infoPtr->uNumBands) {
|
|---|
| 1938 | int startband;
|
|---|
| 1939 |
|
|---|
| 1940 | /* If RBS_BANDBORDERS set then indicate to draw bottom separator */
|
|---|
| 1941 | /* on all bands in all rows but last row. */
|
|---|
| 1942 | /* Also indicate to draw the right separator for each band in */
|
|---|
| 1943 | /* each row but the rightmost band. */
|
|---|
| 1944 | if (infoPtr->dwStyle & RBS_BANDBORDERS) {
|
|---|
| 1945 |
|
|---|
| 1946 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 1947 | lpBand = &infoPtr->bands[i];
|
|---|
| 1948 | if (HIDDENBAND(lpBand))
|
|---|
| 1949 | continue;
|
|---|
| 1950 |
|
|---|
| 1951 | /* not righthand bands */
|
|---|
| 1952 | if( !(lpBand->fDraw & DRAW_LAST_IN_ROW) )
|
|---|
| 1953 | lpBand->fDraw |= DRAW_RIGHTSEP;
|
|---|
| 1954 |
|
|---|
| 1955 | /* not the last row */
|
|---|
| 1956 | if( lpBand->iRow != infoPtr->uNumRows )
|
|---|
| 1957 | lpBand->fDraw |= DRAW_BOTTOMSEP;
|
|---|
| 1958 | }
|
|---|
| 1959 | }
|
|---|
| 1960 |
|
|---|
| 1961 | /* Distribute the extra space on the horizontal and adjust */
|
|---|
| 1962 | /* all bands in row to same height. */
|
|---|
| 1963 | mcy = 0;
|
|---|
| 1964 | startband = -1;
|
|---|
| 1965 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 1966 |
|
|---|
| 1967 | lpBand = &infoPtr->bands[i];
|
|---|
| 1968 |
|
|---|
| 1969 | if( lpBand->fDraw & DRAW_FIRST_IN_ROW )
|
|---|
| 1970 | {
|
|---|
| 1971 | startband = i;
|
|---|
| 1972 | mcy = 0;
|
|---|
| 1973 | }
|
|---|
| 1974 |
|
|---|
| 1975 | if ( (mcy < ircBw(lpBand)) && !HIDDENBAND(lpBand) )
|
|---|
| 1976 | mcy = ircBw(lpBand);
|
|---|
| 1977 |
|
|---|
| 1978 | if( lpBand->fDraw & DRAW_LAST_IN_ROW )
|
|---|
| 1979 | {
|
|---|
| 1980 | TRACE("P3 processing row %d, starting band %d, ending band %d\n",
|
|---|
| 1981 | lpBand->iRow, startband, i);
|
|---|
| 1982 | if( startband < 0 )
|
|---|
| 1983 | ERR("Last band %d with no first, row %d\n", i, lpBand->iRow);
|
|---|
| 1984 |
|
|---|
| 1985 | REBAR_AdjustBands (infoPtr, startband, i,
|
|---|
| 1986 | (infoPtr->dwStyle & CCS_VERT) ?
|
|---|
| 1987 | clientcy : clientcx, mcy);
|
|---|
| 1988 | }
|
|---|
| 1989 | }
|
|---|
| 1990 |
|
|---|
| 1991 | /* Calculate the other rectangles in each band */
|
|---|
| 1992 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 1993 | REBAR_CalcVertBand (infoPtr, 0, infoPtr->uNumBands,
|
|---|
| 1994 | notify);
|
|---|
| 1995 | }
|
|---|
| 1996 | else {
|
|---|
| 1997 | REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands,
|
|---|
| 1998 | notify);
|
|---|
| 1999 | }
|
|---|
| 2000 | }
|
|---|
| 2001 |
|
|---|
| 2002 | /* ******* End Phase 3 - adjust all bands for width full ******* */
|
|---|
| 2003 |
|
|---|
| 2004 | /* now compute size of Rebar itself */
|
|---|
| 2005 | infoPtr->oldSize = infoPtr->calcSize;
|
|---|
| 2006 | if (infoPtr->uNumBands == 0) {
|
|---|
| 2007 | /* we have no bands, so make size the size of client */
|
|---|
| 2008 | x = clientcx;
|
|---|
| 2009 | y = clientcy;
|
|---|
| 2010 | }
|
|---|
| 2011 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 2012 | infoPtr->calcSize.cx = x;
|
|---|
| 2013 | infoPtr->calcSize.cy = clientcy;
|
|---|
| 2014 | TRACE("vert, notify=%d, x=%d, origheight=%d\n",
|
|---|
| 2015 | notify, x, origheight);
|
|---|
| 2016 | if (notify && (x != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;
|
|---|
| 2017 | }
|
|---|
| 2018 | else {
|
|---|
| 2019 | infoPtr->calcSize.cx = clientcx;
|
|---|
| 2020 | infoPtr->calcSize.cy = y;
|
|---|
| 2021 | TRACE("horz, notify=%d, y=%d, origheight=%d\n",
|
|---|
| 2022 | notify, y, origheight);
|
|---|
| 2023 | if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;
|
|---|
| 2024 | }
|
|---|
| 2025 |
|
|---|
| 2026 | REBAR_DumpBand (infoPtr);
|
|---|
| 2027 |
|
|---|
| 2028 | REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands);
|
|---|
| 2029 |
|
|---|
| 2030 | REBAR_ForceResize (infoPtr);
|
|---|
| 2031 | }
|
|---|
| 2032 |
|
|---|
| 2033 |
|
|---|
| 2034 | static VOID
|
|---|
| 2035 | REBAR_ValidateBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
|
|---|
| 2036 | /* Function: This routine evaluates the band specs supplied */
|
|---|
| 2037 | /* by the user and updates the following 5 fields in */
|
|---|
| 2038 | /* the internal band structure: cxHeader, lcx, lcy, hcx, hcy*/
|
|---|
| 2039 | {
|
|---|
| 2040 | UINT header=0;
|
|---|
| 2041 | UINT textheight=0;
|
|---|
| 2042 | UINT i, nonfixed;
|
|---|
| 2043 | REBAR_BAND *tBand;
|
|---|
| 2044 |
|
|---|
| 2045 | lpBand->fStatus = 0;
|
|---|
| 2046 | lpBand->lcx = 0;
|
|---|
| 2047 | lpBand->lcy = 0;
|
|---|
| 2048 | lpBand->ccx = 0;
|
|---|
| 2049 | lpBand->ccy = 0;
|
|---|
| 2050 | lpBand->hcx = 0;
|
|---|
| 2051 | lpBand->hcy = 0;
|
|---|
| 2052 |
|
|---|
| 2053 | /* Data comming in from users into the cx... and cy... fields */
|
|---|
| 2054 | /* may be bad, just garbage, because the user never clears */
|
|---|
| 2055 | /* the fields. RB_{SET|INSERT}BAND{A|W} just passes the data */
|
|---|
| 2056 | /* along if the fields exist in the input area. Here we must */
|
|---|
| 2057 | /* determine if the data is valid. I have no idea how MS does */
|
|---|
| 2058 | /* the validation, but it does because the RB_GETBANDINFO */
|
|---|
| 2059 | /* returns a 0 when I know the sample program passed in an */
|
|---|
| 2060 | /* address. Here I will use the algorithim that if the value */
|
|---|
| 2061 | /* is greater than 65535 then it is bad and replace it with */
|
|---|
| 2062 | /* a zero. Feel free to improve the algorithim. - GA 12/2000 */
|
|---|
| 2063 | if (lpBand->cxMinChild > 65535) lpBand->cxMinChild = 0;
|
|---|
| 2064 | if (lpBand->cyMinChild > 65535) lpBand->cyMinChild = 0;
|
|---|
| 2065 | if (lpBand->cx > 65535) lpBand->cx = 0;
|
|---|
| 2066 | if (lpBand->cyChild > 65535) lpBand->cyChild = 0;
|
|---|
| 2067 | if (lpBand->cyMaxChild > 65535) lpBand->cyMaxChild = 0;
|
|---|
| 2068 | if (lpBand->cyIntegral > 65535) lpBand->cyIntegral = 0;
|
|---|
| 2069 | if (lpBand->cxIdeal > 65535) lpBand->cxIdeal = 0;
|
|---|
| 2070 | if (lpBand->cxHeader > 65535) lpBand->cxHeader = 0;
|
|---|
| 2071 |
|
|---|
| 2072 | /* FIXME: probably should only set NEEDS_LAYOUT flag when */
|
|---|
| 2073 | /* values change. Till then always set it. */
|
|---|
| 2074 | TRACE("setting NEEDS_LAYOUT\n");
|
|---|
| 2075 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 2076 |
|
|---|
| 2077 | /* Header is where the image, text and gripper exist */
|
|---|
| 2078 | /* in the band and preceed the child window. */
|
|---|
| 2079 |
|
|---|
| 2080 | /* count number of non-FIXEDSIZE and non-Hidden bands */
|
|---|
| 2081 | nonfixed = 0;
|
|---|
| 2082 | for (i=0; i<infoPtr->uNumBands; i++){
|
|---|
| 2083 | tBand = &infoPtr->bands[i];
|
|---|
| 2084 | if (!HIDDENBAND(tBand) && !(tBand->fStyle & RBBS_FIXEDSIZE))
|
|---|
| 2085 | nonfixed++;
|
|---|
| 2086 | }
|
|---|
| 2087 |
|
|---|
| 2088 | /* calculate gripper rectangle */
|
|---|
| 2089 | if ( (!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
|
|---|
| 2090 | ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
|
|---|
| 2091 | ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (nonfixed > 1)))
|
|---|
| 2092 | ) {
|
|---|
| 2093 | lpBand->fStatus |= HAS_GRIPPER;
|
|---|
| 2094 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 2095 | if (infoPtr->dwStyle & RBS_VERTICALGRIPPER)
|
|---|
| 2096 | header += (GRIPPER_HEIGHT + REBAR_PRE_GRIPPER);
|
|---|
| 2097 | else
|
|---|
| 2098 | header += (GRIPPER_WIDTH + REBAR_PRE_GRIPPER);
|
|---|
| 2099 | else
|
|---|
| 2100 | header += (REBAR_PRE_GRIPPER + GRIPPER_WIDTH);
|
|---|
| 2101 | /* Always have 4 pixels before anything else */
|
|---|
| 2102 | header += REBAR_ALWAYS_SPACE;
|
|---|
| 2103 | }
|
|---|
| 2104 |
|
|---|
| 2105 | /* image is visible */
|
|---|
| 2106 | if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) {
|
|---|
| 2107 | lpBand->fStatus |= HAS_IMAGE;
|
|---|
| 2108 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 2109 | header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE);
|
|---|
| 2110 | lpBand->lcy = infoPtr->imageSize.cx + 2;
|
|---|
| 2111 | }
|
|---|
| 2112 | else {
|
|---|
| 2113 | header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE);
|
|---|
| 2114 | lpBand->lcy = infoPtr->imageSize.cy + 2;
|
|---|
| 2115 | }
|
|---|
| 2116 | }
|
|---|
| 2117 |
|
|---|
| 2118 | /* text is visible */
|
|---|
| 2119 | if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText) &&
|
|---|
| 2120 | !(lpBand->fStyle & RBBS_HIDETITLE))
|
|---|
| 2121 | {
|
|---|
| 2122 | HDC hdc = GetDC (0);
|
|---|
| 2123 | HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
|
|---|
| 2124 | SIZE size;
|
|---|
| 2125 |
|
|---|
| 2126 | lpBand->fStatus |= HAS_TEXT;
|
|---|
| 2127 | GetTextExtentPoint32W (hdc, lpBand->lpText,
|
|---|
| 2128 | lstrlenW (lpBand->lpText), &size);
|
|---|
| 2129 | header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT));
|
|---|
| 2130 | textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy;
|
|---|
| 2131 |
|
|---|
| 2132 | SelectObject (hdc, hOldFont);
|
|---|
| 2133 | ReleaseDC (0, hdc);
|
|---|
| 2134 | }
|
|---|
| 2135 |
|
|---|
| 2136 | /* if no gripper but either image or text, then leave space */
|
|---|
| 2137 | if ((lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) &&
|
|---|
| 2138 | !(lpBand->fStatus & HAS_GRIPPER)) {
|
|---|
| 2139 | header += REBAR_ALWAYS_SPACE;
|
|---|
| 2140 | }
|
|---|
| 2141 |
|
|---|
| 2142 | /* check if user overrode the header value */
|
|---|
| 2143 | if (!(lpBand->fMask & RBBIM_HEADERSIZE))
|
|---|
| 2144 | lpBand->cxHeader = header;
|
|---|
| 2145 |
|
|---|
| 2146 |
|
|---|
| 2147 | /* Now compute minimum size of child window */
|
|---|
| 2148 | lpBand->offChild.cx = 0;
|
|---|
| 2149 | lpBand->offChild.cy = 0;
|
|---|
| 2150 | lpBand->lcy = textheight;
|
|---|
| 2151 | lpBand->ccy = lpBand->lcy;
|
|---|
| 2152 | if (lpBand->fMask & RBBIM_CHILDSIZE) {
|
|---|
| 2153 | lpBand->lcx = lpBand->cxMinChild;
|
|---|
| 2154 |
|
|---|
| 2155 | /* Set the .cy values for CHILDSIZE case */
|
|---|
| 2156 | lpBand->lcy = max(lpBand->lcy, lpBand->cyMinChild);
|
|---|
| 2157 | lpBand->ccy = lpBand->lcy;
|
|---|
| 2158 | lpBand->hcy = lpBand->lcy;
|
|---|
| 2159 | if (lpBand->cyMaxChild != 0xffffffff) {
|
|---|
| 2160 | lpBand->hcy = lpBand->cyMaxChild;
|
|---|
| 2161 | }
|
|---|
| 2162 | if (lpBand->cyChild != 0xffffffff)
|
|---|
| 2163 | lpBand->ccy = max (lpBand->cyChild, lpBand->lcy);
|
|---|
| 2164 |
|
|---|
| 2165 | TRACE("_CHILDSIZE\n");
|
|---|
| 2166 | }
|
|---|
| 2167 | if (lpBand->fMask & RBBIM_SIZE) {
|
|---|
| 2168 | lpBand->hcx = max (lpBand->cx-lpBand->cxHeader, lpBand->lcx);
|
|---|
| 2169 | TRACE("_SIZE\n");
|
|---|
| 2170 | }
|
|---|
| 2171 | else
|
|---|
| 2172 | lpBand->hcx = lpBand->lcx;
|
|---|
| 2173 | lpBand->ccx = lpBand->hcx;
|
|---|
| 2174 |
|
|---|
| 2175 | /* make ->.cx include header size for _Layout */
|
|---|
| 2176 | lpBand->lcx += lpBand->cxHeader;
|
|---|
| 2177 | lpBand->ccx += lpBand->cxHeader;
|
|---|
| 2178 | lpBand->hcx += lpBand->cxHeader;
|
|---|
| 2179 |
|
|---|
| 2180 | }
|
|---|
| 2181 |
|
|---|
| 2182 | static BOOL
|
|---|
| 2183 | REBAR_CommonSetupBand (HWND hwnd, LPREBARBANDINFOA lprbbi, REBAR_BAND *lpBand)
|
|---|
| 2184 | /* Function: This routine copies the supplied values from */
|
|---|
| 2185 | /* user input (lprbbi) to the internal band structure. */
|
|---|
| 2186 | /* It returns true if something changed and false if not. */
|
|---|
| 2187 | {
|
|---|
| 2188 | BOOL bChanged = FALSE;
|
|---|
| 2189 |
|
|---|
| 2190 | lpBand->fMask |= lprbbi->fMask;
|
|---|
| 2191 |
|
|---|
| 2192 | if( (lprbbi->fMask & RBBIM_STYLE) &&
|
|---|
| 2193 | (lpBand->fStyle != lprbbi->fStyle ) )
|
|---|
| 2194 | {
|
|---|
| 2195 | lpBand->fStyle = lprbbi->fStyle;
|
|---|
| 2196 | bChanged = TRUE;
|
|---|
| 2197 | }
|
|---|
| 2198 |
|
|---|
| 2199 | if( (lprbbi->fMask & RBBIM_COLORS) &&
|
|---|
| 2200 | ( ( lpBand->clrFore != lprbbi->clrFore ) ||
|
|---|
| 2201 | ( lpBand->clrBack != lprbbi->clrBack ) ) )
|
|---|
| 2202 | {
|
|---|
| 2203 | lpBand->clrFore = lprbbi->clrFore;
|
|---|
| 2204 | lpBand->clrBack = lprbbi->clrBack;
|
|---|
| 2205 | bChanged = TRUE;
|
|---|
| 2206 | }
|
|---|
| 2207 |
|
|---|
| 2208 | if( (lprbbi->fMask & RBBIM_IMAGE) &&
|
|---|
| 2209 | ( lpBand->iImage != lprbbi->iImage ) )
|
|---|
| 2210 | {
|
|---|
| 2211 | lpBand->iImage = lprbbi->iImage;
|
|---|
| 2212 | bChanged = TRUE;
|
|---|
| 2213 | }
|
|---|
| 2214 |
|
|---|
| 2215 | if( (lprbbi->fMask & RBBIM_CHILD) &&
|
|---|
| 2216 | (lprbbi->hwndChild != lpBand->hwndChild ) )
|
|---|
| 2217 | {
|
|---|
| 2218 | if (lprbbi->hwndChild) {
|
|---|
| 2219 | lpBand->hwndChild = lprbbi->hwndChild;
|
|---|
| 2220 | lpBand->hwndPrevParent =
|
|---|
| 2221 | SetParent (lpBand->hwndChild, hwnd);
|
|---|
| 2222 | /* below in trace fro WinRAR */
|
|---|
| 2223 | ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL);
|
|---|
| 2224 | /* above in trace fro WinRAR */
|
|---|
| 2225 | }
|
|---|
| 2226 | else {
|
|---|
| 2227 | TRACE("child: %p prev parent: %p\n",
|
|---|
| 2228 | lpBand->hwndChild, lpBand->hwndPrevParent);
|
|---|
| 2229 | lpBand->hwndChild = 0;
|
|---|
| 2230 | lpBand->hwndPrevParent = 0;
|
|---|
| 2231 | }
|
|---|
| 2232 | bChanged = TRUE;
|
|---|
| 2233 | }
|
|---|
| 2234 |
|
|---|
| 2235 | if( (lprbbi->fMask & RBBIM_CHILDSIZE) &&
|
|---|
| 2236 | ( (lpBand->cxMinChild != lprbbi->cxMinChild) ||
|
|---|
| 2237 | (lpBand->cyMinChild != lprbbi->cyMinChild ) ||
|
|---|
| 2238 | ( (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) &&
|
|---|
| 2239 | ( (lpBand->cyChild != lprbbi->cyChild ) ||
|
|---|
| 2240 | (lpBand->cyMaxChild != lprbbi->cyMaxChild ) ||
|
|---|
| 2241 | (lpBand->cyIntegral != lprbbi->cyIntegral ) ) ) ||
|
|---|
| 2242 | ( (lprbbi->cbSize < sizeof (REBARBANDINFOA)) &&
|
|---|
| 2243 | ( (lpBand->cyChild ||
|
|---|
| 2244 | lpBand->cyMaxChild ||
|
|---|
| 2245 | lpBand->cyIntegral ) ) ) ) )
|
|---|
| 2246 | {
|
|---|
| 2247 | lpBand->cxMinChild = lprbbi->cxMinChild;
|
|---|
| 2248 | lpBand->cyMinChild = lprbbi->cyMinChild;
|
|---|
| 2249 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
|
|---|
| 2250 | lpBand->cyChild = lprbbi->cyChild;
|
|---|
| 2251 | lpBand->cyMaxChild = lprbbi->cyMaxChild;
|
|---|
| 2252 | lpBand->cyIntegral = lprbbi->cyIntegral;
|
|---|
| 2253 | }
|
|---|
| 2254 | else { /* special case - these should be zeroed out since */
|
|---|
| 2255 | /* RBBIM_CHILDSIZE added these in WIN32_IE >= 0x0400 */
|
|---|
| 2256 | lpBand->cyChild = 0;
|
|---|
| 2257 | lpBand->cyMaxChild = 0;
|
|---|
| 2258 | lpBand->cyIntegral = 0;
|
|---|
| 2259 | }
|
|---|
| 2260 | bChanged = TRUE;
|
|---|
| 2261 | }
|
|---|
| 2262 |
|
|---|
| 2263 | if( (lprbbi->fMask & RBBIM_SIZE) &&
|
|---|
| 2264 | (lpBand->cx != lprbbi->cx ) )
|
|---|
| 2265 | {
|
|---|
| 2266 | lpBand->cx = lprbbi->cx;
|
|---|
| 2267 | bChanged = TRUE;
|
|---|
| 2268 | }
|
|---|
| 2269 |
|
|---|
| 2270 | if( (lprbbi->fMask & RBBIM_BACKGROUND) &&
|
|---|
| 2271 | ( lpBand->hbmBack != lprbbi->hbmBack ) )
|
|---|
| 2272 | {
|
|---|
| 2273 | lpBand->hbmBack = lprbbi->hbmBack;
|
|---|
| 2274 | bChanged = TRUE;
|
|---|
| 2275 | }
|
|---|
| 2276 |
|
|---|
| 2277 | if( (lprbbi->fMask & RBBIM_ID) &&
|
|---|
| 2278 | (lpBand->wID != lprbbi->wID ) )
|
|---|
| 2279 | {
|
|---|
| 2280 | lpBand->wID = lprbbi->wID;
|
|---|
| 2281 | bChanged = TRUE;
|
|---|
| 2282 | }
|
|---|
| 2283 |
|
|---|
| 2284 | /* check for additional data */
|
|---|
| 2285 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
|
|---|
| 2286 | if( (lprbbi->fMask & RBBIM_IDEALSIZE) &&
|
|---|
| 2287 | ( lpBand->cxIdeal != lprbbi->cxIdeal ) )
|
|---|
| 2288 | {
|
|---|
| 2289 | lpBand->cxIdeal = lprbbi->cxIdeal;
|
|---|
| 2290 | bChanged = TRUE;
|
|---|
| 2291 | }
|
|---|
| 2292 |
|
|---|
| 2293 | if( (lprbbi->fMask & RBBIM_LPARAM) &&
|
|---|
| 2294 | (lpBand->lParam != lprbbi->lParam ) )
|
|---|
| 2295 | {
|
|---|
| 2296 | lpBand->lParam = lprbbi->lParam;
|
|---|
| 2297 | bChanged = TRUE;
|
|---|
| 2298 | }
|
|---|
| 2299 |
|
|---|
| 2300 | if( (lprbbi->fMask & RBBIM_HEADERSIZE) &&
|
|---|
| 2301 | (lpBand->cxHeader != lprbbi->cxHeader ) )
|
|---|
| 2302 | {
|
|---|
| 2303 | lpBand->cxHeader = lprbbi->cxHeader;
|
|---|
| 2304 | bChanged = TRUE;
|
|---|
| 2305 | }
|
|---|
| 2306 | }
|
|---|
| 2307 |
|
|---|
| 2308 | return bChanged;
|
|---|
| 2309 | }
|
|---|
| 2310 |
|
|---|
| 2311 | static LRESULT
|
|---|
| 2312 | REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, RECT *clip)
|
|---|
| 2313 | /* Function: This erases the background rectangle by drawing */
|
|---|
| 2314 | /* each band with its background color (or the default) and */
|
|---|
| 2315 | /* draws each bands right separator if necessary. The row */
|
|---|
| 2316 | /* separators are drawn on the first band of the next row. */
|
|---|
| 2317 | {
|
|---|
| 2318 | REBAR_BAND *lpBand;
|
|---|
| 2319 | UINT i;
|
|---|
| 2320 | INT oldrow;
|
|---|
| 2321 | HDC hdc = (HDC)wParam;
|
|---|
| 2322 | RECT rect;
|
|---|
| 2323 | COLORREF old = CLR_NONE, new;
|
|---|
| 2324 |
|
|---|
| 2325 | oldrow = -1;
|
|---|
| 2326 | for(i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 2327 | lpBand = &infoPtr->bands[i];
|
|---|
| 2328 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 2329 |
|
|---|
| 2330 | /* draw band separator between rows */
|
|---|
| 2331 | if (lpBand->iRow != oldrow) {
|
|---|
| 2332 | oldrow = lpBand->iRow;
|
|---|
| 2333 | if (lpBand->fDraw & DRAW_BOTTOMSEP) {
|
|---|
| 2334 | RECT rcRowSep;
|
|---|
| 2335 | rcRowSep = lpBand->rcBand;
|
|---|
| 2336 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 2337 | rcRowSep.right += SEP_WIDTH_SIZE;
|
|---|
| 2338 | rcRowSep.bottom = infoPtr->calcSize.cy;
|
|---|
| 2339 | DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT);
|
|---|
| 2340 | }
|
|---|
| 2341 | else {
|
|---|
| 2342 | rcRowSep.bottom += SEP_WIDTH_SIZE;
|
|---|
| 2343 | rcRowSep.right = infoPtr->calcSize.cx;
|
|---|
| 2344 | DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM);
|
|---|
| 2345 | }
|
|---|
| 2346 | TRACE ("drawing band separator bottom (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 2347 | rcRowSep.left, rcRowSep.top,
|
|---|
| 2348 | rcRowSep.right, rcRowSep.bottom);
|
|---|
| 2349 | }
|
|---|
| 2350 | }
|
|---|
| 2351 |
|
|---|
| 2352 | /* draw band separator between bands in a row */
|
|---|
| 2353 | if (lpBand->fDraw & DRAW_RIGHTSEP) {
|
|---|
| 2354 | RECT rcSep;
|
|---|
| 2355 | rcSep = lpBand->rcBand;
|
|---|
| 2356 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 2357 | rcSep.bottom += SEP_WIDTH_SIZE;
|
|---|
| 2358 | DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM);
|
|---|
| 2359 | }
|
|---|
| 2360 | else {
|
|---|
| 2361 | rcSep.right += SEP_WIDTH_SIZE;
|
|---|
| 2362 | DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT);
|
|---|
| 2363 | }
|
|---|
| 2364 | TRACE("drawing band separator right (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 2365 | rcSep.left, rcSep.top, rcSep.right, rcSep.bottom);
|
|---|
| 2366 | }
|
|---|
| 2367 |
|
|---|
| 2368 | /* draw the actual background */
|
|---|
| 2369 | if (lpBand->clrBack != CLR_NONE) {
|
|---|
| 2370 | new = (lpBand->clrBack == CLR_DEFAULT) ? infoPtr->clrBtnFace :
|
|---|
| 2371 | lpBand->clrBack;
|
|---|
| 2372 | #if GLATESTING
|
|---|
| 2373 | /* testing only - make background green to see it */
|
|---|
| 2374 | new = RGB(0,128,0);
|
|---|
| 2375 | #endif
|
|---|
| 2376 | }
|
|---|
| 2377 | else {
|
|---|
| 2378 | /* In the absence of documentation for Rebar vs. CLR_NONE,
|
|---|
| 2379 | * we will use the default BtnFace color. Note documentation
|
|---|
| 2380 | * exists for Listview and Imagelist.
|
|---|
| 2381 | */
|
|---|
| 2382 | new = infoPtr->clrBtnFace;
|
|---|
| 2383 | #if GLATESTING
|
|---|
| 2384 | /* testing only - make background green to see it */
|
|---|
| 2385 | new = RGB(0,128,0);
|
|---|
| 2386 | #endif
|
|---|
| 2387 | }
|
|---|
| 2388 | old = SetBkColor (hdc, new);
|
|---|
| 2389 |
|
|---|
| 2390 | rect = lpBand->rcBand;
|
|---|
| 2391 | TRACE("%s background color=0x%06lx, band (%ld,%ld)-(%ld,%ld), clip (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 2392 | (lpBand->clrBack == CLR_NONE) ? "none" :
|
|---|
| 2393 | ((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""),
|
|---|
| 2394 | GetBkColor(hdc),
|
|---|
| 2395 | lpBand->rcBand.left,lpBand->rcBand.top,
|
|---|
| 2396 | lpBand->rcBand.right,lpBand->rcBand.bottom,
|
|---|
| 2397 | clip->left, clip->top,
|
|---|
| 2398 | clip->right, clip->bottom);
|
|---|
| 2399 | ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0);
|
|---|
| 2400 | if (lpBand->clrBack != CLR_NONE)
|
|---|
| 2401 | SetBkColor (hdc, old);
|
|---|
| 2402 | }
|
|---|
| 2403 | return TRUE;
|
|---|
| 2404 | }
|
|---|
| 2405 |
|
|---|
| 2406 | static void
|
|---|
| 2407 | REBAR_InternalHitTest (REBAR_INFO *infoPtr, const LPPOINT lpPt, UINT *pFlags, INT *pBand)
|
|---|
| 2408 | {
|
|---|
| 2409 | REBAR_BAND *lpBand;
|
|---|
| 2410 | RECT rect;
|
|---|
| 2411 | UINT iCount;
|
|---|
| 2412 |
|
|---|
| 2413 | GetClientRect (infoPtr->hwndSelf, &rect);
|
|---|
| 2414 |
|
|---|
| 2415 | *pFlags = RBHT_NOWHERE;
|
|---|
| 2416 | if (PtInRect (&rect, *lpPt))
|
|---|
| 2417 | {
|
|---|
| 2418 | if (infoPtr->uNumBands == 0) {
|
|---|
| 2419 | *pFlags = RBHT_NOWHERE;
|
|---|
| 2420 | if (pBand)
|
|---|
| 2421 | *pBand = -1;
|
|---|
| 2422 | TRACE("NOWHERE\n");
|
|---|
| 2423 | return;
|
|---|
| 2424 | }
|
|---|
| 2425 | else {
|
|---|
| 2426 | /* somewhere inside */
|
|---|
| 2427 | for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
|
|---|
| 2428 | lpBand = &infoPtr->bands[iCount];
|
|---|
| 2429 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 2430 | if (PtInRect (&lpBand->rcBand, *lpPt)) {
|
|---|
| 2431 | if (pBand)
|
|---|
| 2432 | *pBand = iCount;
|
|---|
| 2433 | if (PtInRect (&lpBand->rcGripper, *lpPt)) {
|
|---|
| 2434 | *pFlags = RBHT_GRABBER;
|
|---|
| 2435 | TRACE("ON GRABBER %d\n", iCount);
|
|---|
| 2436 | return;
|
|---|
| 2437 | }
|
|---|
| 2438 | else if (PtInRect (&lpBand->rcCapImage, *lpPt)) {
|
|---|
| 2439 | *pFlags = RBHT_CAPTION;
|
|---|
| 2440 | TRACE("ON CAPTION %d\n", iCount);
|
|---|
| 2441 | return;
|
|---|
| 2442 | }
|
|---|
| 2443 | else if (PtInRect (&lpBand->rcCapText, *lpPt)) {
|
|---|
| 2444 | *pFlags = RBHT_CAPTION;
|
|---|
| 2445 | TRACE("ON CAPTION %d\n", iCount);
|
|---|
| 2446 | return;
|
|---|
| 2447 | }
|
|---|
| 2448 | else if (PtInRect (&lpBand->rcChild, *lpPt)) {
|
|---|
| 2449 | *pFlags = RBHT_CLIENT;
|
|---|
| 2450 | TRACE("ON CLIENT %d\n", iCount);
|
|---|
| 2451 | return;
|
|---|
| 2452 | }
|
|---|
| 2453 | else if (PtInRect (&lpBand->rcChevron, *lpPt)) {
|
|---|
| 2454 | *pFlags = RBHT_CHEVRON;
|
|---|
| 2455 | TRACE("ON CHEVRON %d\n", iCount);
|
|---|
| 2456 | return;
|
|---|
| 2457 | }
|
|---|
| 2458 | else {
|
|---|
| 2459 | *pFlags = RBHT_NOWHERE;
|
|---|
| 2460 | TRACE("NOWHERE %d\n", iCount);
|
|---|
| 2461 | return;
|
|---|
| 2462 | }
|
|---|
| 2463 | }
|
|---|
| 2464 | }
|
|---|
| 2465 |
|
|---|
| 2466 | *pFlags = RBHT_NOWHERE;
|
|---|
| 2467 | if (pBand)
|
|---|
| 2468 | *pBand = -1;
|
|---|
| 2469 |
|
|---|
| 2470 | TRACE("NOWHERE\n");
|
|---|
| 2471 | return;
|
|---|
| 2472 | }
|
|---|
| 2473 | }
|
|---|
| 2474 | else {
|
|---|
| 2475 | *pFlags = RBHT_NOWHERE;
|
|---|
| 2476 | if (pBand)
|
|---|
| 2477 | *pBand = -1;
|
|---|
| 2478 | TRACE("NOWHERE\n");
|
|---|
| 2479 | return;
|
|---|
| 2480 | }
|
|---|
| 2481 | }
|
|---|
| 2482 |
|
|---|
| 2483 |
|
|---|
| 2484 | static INT
|
|---|
| 2485 | REBAR_Shrink (REBAR_INFO *infoPtr, REBAR_BAND *band, INT movement, INT i)
|
|---|
| 2486 | /* Function: This attempts to shrink the given band by the */
|
|---|
| 2487 | /* the amount in "movement". A shrink to the left is indi- */
|
|---|
| 2488 | /* cated by "movement" being negative. "i" is merely the */
|
|---|
| 2489 | /* band index for trace messages. */
|
|---|
| 2490 | {
|
|---|
| 2491 | INT Leadjust, Readjust, avail, ret;
|
|---|
| 2492 |
|
|---|
| 2493 | /* Note: a left drag is indicated by "movement" being negative. */
|
|---|
| 2494 | /* Similarly, a right drag is indicated by "movement" */
|
|---|
| 2495 | /* being positive. "movement" should never be 0, but if */
|
|---|
| 2496 | /* it is then the band does not move. */
|
|---|
| 2497 |
|
|---|
| 2498 | avail = rcBw(band) - band->lcx;
|
|---|
| 2499 |
|
|---|
| 2500 | /* now compute the Left End adjustment factor and Right End */
|
|---|
| 2501 | /* adjustment factor. They may be different if shrinking. */
|
|---|
| 2502 | if (avail <= 0) {
|
|---|
| 2503 | /* if this band is not shrinkable, then just move it */
|
|---|
| 2504 | Leadjust = Readjust = movement;
|
|---|
| 2505 | ret = movement;
|
|---|
| 2506 | }
|
|---|
| 2507 | else {
|
|---|
| 2508 | if (movement < 0) {
|
|---|
| 2509 | /* Drag to left */
|
|---|
| 2510 | if (avail <= abs(movement)) {
|
|---|
| 2511 | Readjust = movement;
|
|---|
| 2512 | Leadjust = movement + avail;
|
|---|
| 2513 | ret = Leadjust;
|
|---|
| 2514 | }
|
|---|
| 2515 | else {
|
|---|
| 2516 | Readjust = movement;
|
|---|
| 2517 | Leadjust = 0;
|
|---|
| 2518 | ret = 0;
|
|---|
| 2519 | }
|
|---|
| 2520 | }
|
|---|
| 2521 | else {
|
|---|
| 2522 | /* Drag to right */
|
|---|
| 2523 | if (avail <= abs(movement)) {
|
|---|
| 2524 | Leadjust = movement;
|
|---|
| 2525 | Readjust = movement - avail;
|
|---|
| 2526 | ret = Readjust;
|
|---|
| 2527 | }
|
|---|
| 2528 | else {
|
|---|
| 2529 | Leadjust = movement;
|
|---|
| 2530 | Readjust = 0;
|
|---|
| 2531 | ret = 0;
|
|---|
| 2532 | }
|
|---|
| 2533 | }
|
|---|
| 2534 | }
|
|---|
| 2535 |
|
|---|
| 2536 | /* Reasonability Check */
|
|---|
| 2537 | if (rcBlt(band) + Leadjust < 0) {
|
|---|
| 2538 | ERR("adjustment will fail, band %d: left=%d, right=%d, move=%d, rtn=%d\n",
|
|---|
| 2539 | i, Leadjust, Readjust, movement, ret);
|
|---|
| 2540 | }
|
|---|
| 2541 |
|
|---|
| 2542 | LEADJ(band, Leadjust);
|
|---|
| 2543 | READJ(band, Readjust);
|
|---|
| 2544 |
|
|---|
| 2545 | TRACE("band %d: left=%d, right=%d, move=%d, rtn=%d, rcBand=(%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 2546 | i, Leadjust, Readjust, movement, ret,
|
|---|
| 2547 | band->rcBand.left, band->rcBand.top,
|
|---|
| 2548 | band->rcBand.right, band->rcBand.bottom);
|
|---|
| 2549 | return ret;
|
|---|
| 2550 | }
|
|---|
| 2551 |
|
|---|
| 2552 |
|
|---|
| 2553 | static void
|
|---|
| 2554 | REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
|
|---|
| 2555 | /* Function: This will implement the functionality of a */
|
|---|
| 2556 | /* Gripper drag within a row. It will not implement "out- */
|
|---|
| 2557 | /* of-row" drags. (They are detected and handled in */
|
|---|
| 2558 | /* REBAR_MouseMove.) */
|
|---|
| 2559 | /* **** FIXME Switching order of bands in a row not **** */
|
|---|
| 2560 | /* **** yet implemented. **** */
|
|---|
| 2561 | {
|
|---|
| 2562 | REBAR_BAND *hitBand, *band, *mindBand, *maxdBand;
|
|---|
| 2563 | RECT newrect;
|
|---|
| 2564 | INT imindBand = -1, imaxdBand, ihitBand, i, movement;
|
|---|
| 2565 | INT RHeaderSum = 0, LHeaderSum = 0;
|
|---|
| 2566 | INT compress;
|
|---|
| 2567 |
|
|---|
| 2568 | /* on first significant mouse movement, issue notify */
|
|---|
| 2569 |
|
|---|
| 2570 | if (!(infoPtr->fStatus & BEGIN_DRAG_ISSUED)) {
|
|---|
| 2571 | if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) {
|
|---|
| 2572 | /* Notify returned TRUE - abort drag */
|
|---|
| 2573 | infoPtr->dragStart.x = 0;
|
|---|
| 2574 | infoPtr->dragStart.y = 0;
|
|---|
| 2575 | infoPtr->dragNow = infoPtr->dragStart;
|
|---|
| 2576 | infoPtr->iGrabbedBand = -1;
|
|---|
| 2577 | ReleaseCapture ();
|
|---|
| 2578 | return ;
|
|---|
| 2579 | }
|
|---|
| 2580 | infoPtr->fStatus |= BEGIN_DRAG_ISSUED;
|
|---|
| 2581 | }
|
|---|
| 2582 |
|
|---|
| 2583 | ihitBand = infoPtr->iGrabbedBand;
|
|---|
| 2584 | hitBand = &infoPtr->bands[ihitBand];
|
|---|
| 2585 | imaxdBand = ihitBand; /* to suppress warning message */
|
|---|
| 2586 |
|
|---|
| 2587 | /* find all the bands in the row of the one whose Gripper was seized */
|
|---|
| 2588 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 2589 | band = &infoPtr->bands[i];
|
|---|
| 2590 | if (HIDDENBAND(band)) continue;
|
|---|
| 2591 | if (band->iRow == hitBand->iRow) {
|
|---|
| 2592 | imaxdBand = i;
|
|---|
| 2593 | if (imindBand == -1) imindBand = i;
|
|---|
| 2594 | /* minimum size of each band is size of header plus */
|
|---|
| 2595 | /* size of minimum child plus offset of child from header plus */
|
|---|
| 2596 | /* a one to separate each band. */
|
|---|
| 2597 | if (i < ihitBand)
|
|---|
| 2598 | LHeaderSum += (band->lcx + SEP_WIDTH);
|
|---|
| 2599 | else
|
|---|
| 2600 | RHeaderSum += (band->lcx + SEP_WIDTH);
|
|---|
| 2601 |
|
|---|
| 2602 | }
|
|---|
| 2603 | }
|
|---|
| 2604 | if (RHeaderSum) RHeaderSum -= SEP_WIDTH; /* no separator afterlast band */
|
|---|
| 2605 |
|
|---|
| 2606 | mindBand = &infoPtr->bands[imindBand];
|
|---|
| 2607 | maxdBand = &infoPtr->bands[imaxdBand];
|
|---|
| 2608 |
|
|---|
| 2609 | if (imindBand == imaxdBand) return; /* nothing to drag agains */
|
|---|
| 2610 | if (imindBand == ihitBand) return; /* first band in row, cant drag */
|
|---|
| 2611 |
|
|---|
| 2612 | /* limit movement to inside adjustable bands - Left */
|
|---|
| 2613 | if ( (ptsmove->x < mindBand->rcBand.left) ||
|
|---|
| 2614 | (ptsmove->x > maxdBand->rcBand.right) ||
|
|---|
| 2615 | (ptsmove->y < mindBand->rcBand.top) ||
|
|---|
| 2616 | (ptsmove->y > maxdBand->rcBand.bottom))
|
|---|
| 2617 | return; /* should swap bands */
|
|---|
| 2618 |
|
|---|
| 2619 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 2620 | movement = ptsmove->y - ((hitBand->rcBand.top+REBAR_PRE_GRIPPER) -
|
|---|
| 2621 | infoPtr->ihitoffset);
|
|---|
| 2622 | else
|
|---|
| 2623 | movement = ptsmove->x - ((hitBand->rcBand.left+REBAR_PRE_GRIPPER) -
|
|---|
| 2624 | infoPtr->ihitoffset);
|
|---|
| 2625 | infoPtr->dragNow = *ptsmove;
|
|---|
| 2626 |
|
|---|
| 2627 | TRACE("before: movement=%d (%d,%d), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n",
|
|---|
| 2628 | movement, ptsmove->x, ptsmove->y, imindBand, ihitBand,
|
|---|
| 2629 | imaxdBand, LHeaderSum, RHeaderSum);
|
|---|
| 2630 | REBAR_DumpBand (infoPtr);
|
|---|
| 2631 |
|
|---|
| 2632 | if (movement < 0) {
|
|---|
| 2633 |
|
|---|
| 2634 | /* *** Drag left/up *** */
|
|---|
| 2635 | compress = rcBlt(hitBand) - rcBlt(mindBand) -
|
|---|
| 2636 | LHeaderSum;
|
|---|
| 2637 | if (compress < abs(movement)) {
|
|---|
| 2638 | TRACE("limiting left drag, was %d changed to %d\n",
|
|---|
| 2639 | movement, -compress);
|
|---|
| 2640 | movement = -compress;
|
|---|
| 2641 | }
|
|---|
| 2642 |
|
|---|
| 2643 | for (i=ihitBand; i>=imindBand; i--) {
|
|---|
| 2644 | band = &infoPtr->bands[i];
|
|---|
| 2645 | if (HIDDENBAND(band)) continue;
|
|---|
| 2646 | if (i == ihitBand) {
|
|---|
| 2647 | LEADJ(band, movement);
|
|---|
| 2648 | }
|
|---|
| 2649 | else
|
|---|
| 2650 | movement = REBAR_Shrink (infoPtr, band, movement, i);
|
|---|
| 2651 | band->ccx = rcBw(band);
|
|---|
| 2652 | }
|
|---|
| 2653 | }
|
|---|
| 2654 | else {
|
|---|
| 2655 | BOOL first = TRUE;
|
|---|
| 2656 |
|
|---|
| 2657 | /* *** Drag right/down *** */
|
|---|
| 2658 | compress = rcBrb(maxdBand) - rcBlt(hitBand) -
|
|---|
| 2659 | RHeaderSum;
|
|---|
| 2660 | if (compress < abs(movement)) {
|
|---|
| 2661 | TRACE("limiting right drag, was %d changed to %d\n",
|
|---|
| 2662 | movement, compress);
|
|---|
| 2663 | movement = compress;
|
|---|
| 2664 | }
|
|---|
| 2665 | for (i=ihitBand-1; i<=imaxdBand; i++) {
|
|---|
| 2666 | band = &infoPtr->bands[i];
|
|---|
| 2667 | if (HIDDENBAND(band)) continue;
|
|---|
| 2668 | if (first) {
|
|---|
| 2669 | first = FALSE;
|
|---|
| 2670 | READJ(band, movement);
|
|---|
| 2671 | }
|
|---|
| 2672 | else
|
|---|
| 2673 | movement = REBAR_Shrink (infoPtr, band, movement, i);
|
|---|
| 2674 | band->ccx = rcBw(band);
|
|---|
| 2675 | }
|
|---|
| 2676 | }
|
|---|
| 2677 |
|
|---|
| 2678 | /* recompute all rectangles */
|
|---|
| 2679 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 2680 | REBAR_CalcVertBand (infoPtr, imindBand, imaxdBand+1,
|
|---|
| 2681 | FALSE);
|
|---|
| 2682 | }
|
|---|
| 2683 | else {
|
|---|
| 2684 | REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1,
|
|---|
| 2685 | FALSE);
|
|---|
| 2686 | }
|
|---|
| 2687 |
|
|---|
| 2688 | TRACE("bands after adjustment, see band # %d, %d\n",
|
|---|
| 2689 | imindBand, imaxdBand);
|
|---|
| 2690 | REBAR_DumpBand (infoPtr);
|
|---|
| 2691 |
|
|---|
| 2692 | SetRect (&newrect,
|
|---|
| 2693 | mindBand->rcBand.left,
|
|---|
| 2694 | mindBand->rcBand.top,
|
|---|
| 2695 | maxdBand->rcBand.right,
|
|---|
| 2696 | maxdBand->rcBand.bottom);
|
|---|
| 2697 |
|
|---|
| 2698 | REBAR_MoveChildWindows (infoPtr, imindBand, imaxdBand+1);
|
|---|
| 2699 |
|
|---|
| 2700 | InvalidateRect (infoPtr->hwndSelf, &newrect, TRUE);
|
|---|
| 2701 | UpdateWindow (infoPtr->hwndSelf);
|
|---|
| 2702 |
|
|---|
| 2703 | }
|
|---|
| 2704 |
|
|---|
| 2705 |
|
|---|
| 2706 |
|
|---|
| 2707 | /* << REBAR_BeginDrag >> */
|
|---|
| 2708 |
|
|---|
| 2709 |
|
|---|
| 2710 | static LRESULT
|
|---|
| 2711 | REBAR_DeleteBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 2712 | {
|
|---|
| 2713 | UINT uBand = (UINT)wParam;
|
|---|
| 2714 | HWND childhwnd = 0;
|
|---|
| 2715 | REBAR_BAND *lpBand;
|
|---|
| 2716 |
|
|---|
| 2717 | if (uBand >= infoPtr->uNumBands)
|
|---|
| 2718 | return FALSE;
|
|---|
| 2719 |
|
|---|
| 2720 | TRACE("deleting band %u!\n", uBand);
|
|---|
| 2721 | lpBand = &infoPtr->bands[uBand];
|
|---|
| 2722 | REBAR_Notify_NMREBAR (infoPtr, uBand, RBN_DELETINGBAND);
|
|---|
| 2723 |
|
|---|
| 2724 | if (infoPtr->uNumBands == 1) {
|
|---|
| 2725 | TRACE(" simple delete!\n");
|
|---|
| 2726 | if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)
|
|---|
| 2727 | childhwnd = lpBand->hwndChild;
|
|---|
| 2728 | Free (infoPtr->bands);
|
|---|
| 2729 | infoPtr->bands = NULL;
|
|---|
| 2730 | infoPtr->uNumBands = 0;
|
|---|
| 2731 | }
|
|---|
| 2732 | else {
|
|---|
| 2733 | REBAR_BAND *oldBands = infoPtr->bands;
|
|---|
| 2734 | TRACE("complex delete! [uBand=%u]\n", uBand);
|
|---|
| 2735 |
|
|---|
| 2736 | if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)
|
|---|
| 2737 | childhwnd = lpBand->hwndChild;
|
|---|
| 2738 |
|
|---|
| 2739 | infoPtr->uNumBands--;
|
|---|
| 2740 | infoPtr->bands = Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
|
|---|
| 2741 | if (uBand > 0) {
|
|---|
| 2742 | memcpy (&infoPtr->bands[0], &oldBands[0],
|
|---|
| 2743 | uBand * sizeof(REBAR_BAND));
|
|---|
| 2744 | }
|
|---|
| 2745 |
|
|---|
| 2746 | if (uBand < infoPtr->uNumBands) {
|
|---|
| 2747 | memcpy (&infoPtr->bands[uBand], &oldBands[uBand+1],
|
|---|
| 2748 | (infoPtr->uNumBands - uBand) * sizeof(REBAR_BAND));
|
|---|
| 2749 | }
|
|---|
| 2750 |
|
|---|
| 2751 | Free (oldBands);
|
|---|
| 2752 | }
|
|---|
| 2753 |
|
|---|
| 2754 | if (childhwnd)
|
|---|
| 2755 | ShowWindow (childhwnd, SW_HIDE);
|
|---|
| 2756 |
|
|---|
| 2757 | REBAR_Notify_NMREBAR (infoPtr, -1, RBN_DELETEDBAND);
|
|---|
| 2758 |
|
|---|
| 2759 | /* if only 1 band left the re-validate to possible eliminate gripper */
|
|---|
| 2760 | if (infoPtr->uNumBands == 1)
|
|---|
| 2761 | REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
|
|---|
| 2762 |
|
|---|
| 2763 | TRACE("setting NEEDS_LAYOUT\n");
|
|---|
| 2764 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 2765 | infoPtr->fStatus |= RESIZE_ANYHOW;
|
|---|
| 2766 | REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
|
|---|
| 2767 |
|
|---|
| 2768 | return TRUE;
|
|---|
| 2769 | }
|
|---|
| 2770 |
|
|---|
| 2771 |
|
|---|
| 2772 | /* << REBAR_DragMove >> */
|
|---|
| 2773 | /* << REBAR_EndDrag >> */
|
|---|
| 2774 |
|
|---|
| 2775 |
|
|---|
| 2776 | static LRESULT
|
|---|
| 2777 | REBAR_GetBandBorders (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 2778 | {
|
|---|
| 2779 | LPRECT lpRect = (LPRECT)lParam;
|
|---|
| 2780 | REBAR_BAND *lpBand;
|
|---|
| 2781 |
|
|---|
| 2782 | if (!lParam)
|
|---|
| 2783 | return 0;
|
|---|
| 2784 | if ((UINT)wParam >= infoPtr->uNumBands)
|
|---|
| 2785 | return 0;
|
|---|
| 2786 |
|
|---|
| 2787 | lpBand = &infoPtr->bands[(UINT)wParam];
|
|---|
| 2788 |
|
|---|
| 2789 | /* FIXME - the following values were determined by experimentation */
|
|---|
| 2790 | /* with the REBAR Control Spy. I have guesses as to what the 4 and */
|
|---|
| 2791 | /* 1 are, but I am not sure. There doesn't seem to be any actual */
|
|---|
| 2792 | /* difference in size of the control area with and without the */
|
|---|
| 2793 | /* style. - GA */
|
|---|
| 2794 | if (infoPtr->dwStyle & RBS_BANDBORDERS) {
|
|---|
| 2795 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 2796 | lpRect->left = 1;
|
|---|
| 2797 | lpRect->top = lpBand->cxHeader + 4;
|
|---|
| 2798 | lpRect->right = 1;
|
|---|
| 2799 | lpRect->bottom = 0;
|
|---|
| 2800 | }
|
|---|
| 2801 | else {
|
|---|
| 2802 | lpRect->left = lpBand->cxHeader + 4;
|
|---|
| 2803 | lpRect->top = 1;
|
|---|
| 2804 | lpRect->right = 0;
|
|---|
| 2805 | lpRect->bottom = 1;
|
|---|
| 2806 | }
|
|---|
| 2807 | }
|
|---|
| 2808 | else {
|
|---|
| 2809 | lpRect->left = lpBand->cxHeader;
|
|---|
| 2810 | }
|
|---|
| 2811 | return 0;
|
|---|
| 2812 | }
|
|---|
| 2813 |
|
|---|
| 2814 |
|
|---|
| 2815 | inline static LRESULT
|
|---|
| 2816 | REBAR_GetBandCount (REBAR_INFO *infoPtr)
|
|---|
| 2817 | {
|
|---|
| 2818 | TRACE("band count %u!\n", infoPtr->uNumBands);
|
|---|
| 2819 |
|
|---|
| 2820 | return infoPtr->uNumBands;
|
|---|
| 2821 | }
|
|---|
| 2822 |
|
|---|
| 2823 |
|
|---|
| 2824 | static LRESULT
|
|---|
| 2825 | REBAR_GetBandInfoA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 2826 | {
|
|---|
| 2827 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
|
|---|
| 2828 | REBAR_BAND *lpBand;
|
|---|
| 2829 |
|
|---|
| 2830 | if (lprbbi == NULL)
|
|---|
| 2831 | return FALSE;
|
|---|
| 2832 | if (lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
|
|---|
| 2833 | return FALSE;
|
|---|
| 2834 | if ((UINT)wParam >= infoPtr->uNumBands)
|
|---|
| 2835 | return FALSE;
|
|---|
| 2836 |
|
|---|
| 2837 | TRACE("index %u\n", (UINT)wParam);
|
|---|
| 2838 |
|
|---|
| 2839 | /* copy band information */
|
|---|
| 2840 | lpBand = &infoPtr->bands[(UINT)wParam];
|
|---|
| 2841 |
|
|---|
| 2842 | if (lprbbi->fMask & RBBIM_STYLE)
|
|---|
| 2843 | lprbbi->fStyle = lpBand->fStyle;
|
|---|
| 2844 |
|
|---|
| 2845 | if (lprbbi->fMask & RBBIM_COLORS) {
|
|---|
| 2846 | lprbbi->clrFore = lpBand->clrFore;
|
|---|
| 2847 | lprbbi->clrBack = lpBand->clrBack;
|
|---|
| 2848 | if (lprbbi->clrBack == CLR_DEFAULT)
|
|---|
| 2849 | lprbbi->clrBack = infoPtr->clrBtnFace;
|
|---|
| 2850 | }
|
|---|
| 2851 |
|
|---|
| 2852 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
|
|---|
| 2853 | if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT))
|
|---|
| 2854 | {
|
|---|
| 2855 | if (!WideCharToMultiByte( CP_ACP, 0, lpBand->lpText, -1,
|
|---|
| 2856 | lprbbi->lpText, lprbbi->cch, NULL, NULL ))
|
|---|
| 2857 | lprbbi->lpText[lprbbi->cch-1] = 0;
|
|---|
| 2858 | }
|
|---|
| 2859 | else
|
|---|
| 2860 | *lprbbi->lpText = 0;
|
|---|
| 2861 | }
|
|---|
| 2862 |
|
|---|
| 2863 | if (lprbbi->fMask & RBBIM_IMAGE) {
|
|---|
| 2864 | if (lpBand->fMask & RBBIM_IMAGE)
|
|---|
| 2865 | lprbbi->iImage = lpBand->iImage;
|
|---|
| 2866 | else
|
|---|
| 2867 | lprbbi->iImage = -1;
|
|---|
| 2868 | }
|
|---|
| 2869 |
|
|---|
| 2870 | if (lprbbi->fMask & RBBIM_CHILD)
|
|---|
| 2871 | lprbbi->hwndChild = lpBand->hwndChild;
|
|---|
| 2872 |
|
|---|
| 2873 | if (lprbbi->fMask & RBBIM_CHILDSIZE) {
|
|---|
| 2874 | lprbbi->cxMinChild = lpBand->cxMinChild;
|
|---|
| 2875 | lprbbi->cyMinChild = lpBand->cyMinChild;
|
|---|
| 2876 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
|
|---|
| 2877 | lprbbi->cyChild = lpBand->cyChild;
|
|---|
| 2878 | lprbbi->cyMaxChild = lpBand->cyMaxChild;
|
|---|
| 2879 | lprbbi->cyIntegral = lpBand->cyIntegral;
|
|---|
| 2880 | }
|
|---|
| 2881 | }
|
|---|
| 2882 |
|
|---|
| 2883 | if (lprbbi->fMask & RBBIM_SIZE)
|
|---|
| 2884 | lprbbi->cx = lpBand->cx;
|
|---|
| 2885 |
|
|---|
| 2886 | if (lprbbi->fMask & RBBIM_BACKGROUND)
|
|---|
| 2887 | lprbbi->hbmBack = lpBand->hbmBack;
|
|---|
| 2888 |
|
|---|
| 2889 | if (lprbbi->fMask & RBBIM_ID)
|
|---|
| 2890 | lprbbi->wID = lpBand->wID;
|
|---|
| 2891 |
|
|---|
| 2892 | /* check for additional data */
|
|---|
| 2893 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
|
|---|
| 2894 | if (lprbbi->fMask & RBBIM_IDEALSIZE)
|
|---|
| 2895 | lprbbi->cxIdeal = lpBand->cxIdeal;
|
|---|
| 2896 |
|
|---|
| 2897 | if (lprbbi->fMask & RBBIM_LPARAM)
|
|---|
| 2898 | lprbbi->lParam = lpBand->lParam;
|
|---|
| 2899 |
|
|---|
| 2900 | if (lprbbi->fMask & RBBIM_HEADERSIZE)
|
|---|
| 2901 | lprbbi->cxHeader = lpBand->cxHeader;
|
|---|
| 2902 | }
|
|---|
| 2903 |
|
|---|
| 2904 | REBAR_DumpBandInfo (lprbbi);
|
|---|
| 2905 |
|
|---|
| 2906 | return TRUE;
|
|---|
| 2907 | }
|
|---|
| 2908 |
|
|---|
| 2909 |
|
|---|
| 2910 | static LRESULT
|
|---|
| 2911 | REBAR_GetBandInfoW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 2912 | {
|
|---|
| 2913 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
|
|---|
| 2914 | REBAR_BAND *lpBand;
|
|---|
| 2915 |
|
|---|
| 2916 | if (lprbbi == NULL)
|
|---|
| 2917 | return FALSE;
|
|---|
| 2918 | if (lprbbi->cbSize < REBARBANDINFOW_V3_SIZE)
|
|---|
| 2919 | return FALSE;
|
|---|
| 2920 | if ((UINT)wParam >= infoPtr->uNumBands)
|
|---|
| 2921 | return FALSE;
|
|---|
| 2922 |
|
|---|
| 2923 | TRACE("index %u\n", (UINT)wParam);
|
|---|
| 2924 |
|
|---|
| 2925 | /* copy band information */
|
|---|
| 2926 | lpBand = &infoPtr->bands[(UINT)wParam];
|
|---|
| 2927 |
|
|---|
| 2928 | if (lprbbi->fMask & RBBIM_STYLE)
|
|---|
| 2929 | lprbbi->fStyle = lpBand->fStyle;
|
|---|
| 2930 |
|
|---|
| 2931 | if (lprbbi->fMask & RBBIM_COLORS) {
|
|---|
| 2932 | lprbbi->clrFore = lpBand->clrFore;
|
|---|
| 2933 | lprbbi->clrBack = lpBand->clrBack;
|
|---|
| 2934 | if (lprbbi->clrBack == CLR_DEFAULT)
|
|---|
| 2935 | lprbbi->clrBack = infoPtr->clrBtnFace;
|
|---|
| 2936 | }
|
|---|
| 2937 |
|
|---|
| 2938 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
|
|---|
| 2939 | if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT))
|
|---|
| 2940 | lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
|
|---|
| 2941 | else
|
|---|
| 2942 | *lprbbi->lpText = 0;
|
|---|
| 2943 | }
|
|---|
| 2944 |
|
|---|
| 2945 | if (lprbbi->fMask & RBBIM_IMAGE) {
|
|---|
| 2946 | if (lpBand->fMask & RBBIM_IMAGE)
|
|---|
| 2947 | lprbbi->iImage = lpBand->iImage;
|
|---|
| 2948 | else
|
|---|
| 2949 | lprbbi->iImage = -1;
|
|---|
| 2950 | }
|
|---|
| 2951 |
|
|---|
| 2952 | if (lprbbi->fMask & RBBIM_CHILD)
|
|---|
| 2953 | lprbbi->hwndChild = lpBand->hwndChild;
|
|---|
| 2954 |
|
|---|
| 2955 | if (lprbbi->fMask & RBBIM_CHILDSIZE) {
|
|---|
| 2956 | lprbbi->cxMinChild = lpBand->cxMinChild;
|
|---|
| 2957 | lprbbi->cyMinChild = lpBand->cyMinChild;
|
|---|
| 2958 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {
|
|---|
| 2959 | lprbbi->cyChild = lpBand->cyChild;
|
|---|
| 2960 | lprbbi->cyMaxChild = lpBand->cyMaxChild;
|
|---|
| 2961 | lprbbi->cyIntegral = lpBand->cyIntegral;
|
|---|
| 2962 | }
|
|---|
| 2963 | }
|
|---|
| 2964 |
|
|---|
| 2965 | if (lprbbi->fMask & RBBIM_SIZE)
|
|---|
| 2966 | lprbbi->cx = lpBand->cx;
|
|---|
| 2967 |
|
|---|
| 2968 | if (lprbbi->fMask & RBBIM_BACKGROUND)
|
|---|
| 2969 | lprbbi->hbmBack = lpBand->hbmBack;
|
|---|
| 2970 |
|
|---|
| 2971 | if (lprbbi->fMask & RBBIM_ID)
|
|---|
| 2972 | lprbbi->wID = lpBand->wID;
|
|---|
| 2973 |
|
|---|
| 2974 | /* check for additional data */
|
|---|
| 2975 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {
|
|---|
| 2976 | if (lprbbi->fMask & RBBIM_IDEALSIZE)
|
|---|
| 2977 | lprbbi->cxIdeal = lpBand->cxIdeal;
|
|---|
| 2978 |
|
|---|
| 2979 | if (lprbbi->fMask & RBBIM_LPARAM)
|
|---|
| 2980 | lprbbi->lParam = lpBand->lParam;
|
|---|
| 2981 |
|
|---|
| 2982 | if (lprbbi->fMask & RBBIM_HEADERSIZE)
|
|---|
| 2983 | lprbbi->cxHeader = lpBand->cxHeader;
|
|---|
| 2984 | }
|
|---|
| 2985 |
|
|---|
| 2986 | REBAR_DumpBandInfo ((LPREBARBANDINFOA)lprbbi);
|
|---|
| 2987 |
|
|---|
| 2988 | return TRUE;
|
|---|
| 2989 | }
|
|---|
| 2990 |
|
|---|
| 2991 |
|
|---|
| 2992 | static LRESULT
|
|---|
| 2993 | REBAR_GetBarHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 2994 | {
|
|---|
| 2995 | INT nHeight;
|
|---|
| 2996 |
|
|---|
| 2997 | nHeight = (infoPtr->dwStyle & CCS_VERT) ? infoPtr->calcSize.cx : infoPtr->calcSize.cy;
|
|---|
| 2998 |
|
|---|
| 2999 | TRACE("height = %d\n", nHeight);
|
|---|
| 3000 |
|
|---|
| 3001 | return nHeight;
|
|---|
| 3002 | }
|
|---|
| 3003 |
|
|---|
| 3004 |
|
|---|
| 3005 | static LRESULT
|
|---|
| 3006 | REBAR_GetBarInfo (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3007 | {
|
|---|
| 3008 | LPREBARINFO lpInfo = (LPREBARINFO)lParam;
|
|---|
| 3009 |
|
|---|
| 3010 | if (lpInfo == NULL)
|
|---|
| 3011 | return FALSE;
|
|---|
| 3012 |
|
|---|
| 3013 | if (lpInfo->cbSize < sizeof (REBARINFO))
|
|---|
| 3014 | return FALSE;
|
|---|
| 3015 |
|
|---|
| 3016 | TRACE("getting bar info!\n");
|
|---|
| 3017 |
|
|---|
| 3018 | if (infoPtr->himl) {
|
|---|
| 3019 | lpInfo->himl = infoPtr->himl;
|
|---|
| 3020 | lpInfo->fMask |= RBIM_IMAGELIST;
|
|---|
| 3021 | }
|
|---|
| 3022 |
|
|---|
| 3023 | return TRUE;
|
|---|
| 3024 | }
|
|---|
| 3025 |
|
|---|
| 3026 |
|
|---|
| 3027 | inline static LRESULT
|
|---|
| 3028 | REBAR_GetBkColor (REBAR_INFO *infoPtr)
|
|---|
| 3029 | {
|
|---|
| 3030 | COLORREF clr = infoPtr->clrBk;
|
|---|
| 3031 |
|
|---|
| 3032 | if (clr == CLR_DEFAULT)
|
|---|
| 3033 | clr = infoPtr->clrBtnFace;
|
|---|
| 3034 |
|
|---|
| 3035 | TRACE("background color 0x%06lx!\n", clr);
|
|---|
| 3036 |
|
|---|
| 3037 | return clr;
|
|---|
| 3038 | }
|
|---|
| 3039 |
|
|---|
| 3040 |
|
|---|
| 3041 | /* << REBAR_GetColorScheme >> */
|
|---|
| 3042 | /* << REBAR_GetDropTarget >> */
|
|---|
| 3043 |
|
|---|
| 3044 |
|
|---|
| 3045 | static LRESULT
|
|---|
| 3046 | REBAR_GetPalette (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3047 | {
|
|---|
| 3048 | FIXME("empty stub!\n");
|
|---|
| 3049 |
|
|---|
| 3050 | return 0;
|
|---|
| 3051 | }
|
|---|
| 3052 |
|
|---|
| 3053 |
|
|---|
| 3054 | static LRESULT
|
|---|
| 3055 | REBAR_GetRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3056 | {
|
|---|
| 3057 | INT iBand = (INT)wParam;
|
|---|
| 3058 | LPRECT lprc = (LPRECT)lParam;
|
|---|
| 3059 | REBAR_BAND *lpBand;
|
|---|
| 3060 |
|
|---|
| 3061 | if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands))
|
|---|
| 3062 | return FALSE;
|
|---|
| 3063 | if (!lprc)
|
|---|
| 3064 | return FALSE;
|
|---|
| 3065 |
|
|---|
| 3066 | lpBand = &infoPtr->bands[iBand];
|
|---|
| 3067 | CopyRect (lprc, &lpBand->rcBand);
|
|---|
| 3068 |
|
|---|
| 3069 | TRACE("band %d, (%ld,%ld)-(%ld,%ld)\n", iBand,
|
|---|
| 3070 | lprc->left, lprc->top, lprc->right, lprc->bottom);
|
|---|
| 3071 |
|
|---|
| 3072 | return TRUE;
|
|---|
| 3073 | }
|
|---|
| 3074 |
|
|---|
| 3075 |
|
|---|
| 3076 | inline static LRESULT
|
|---|
| 3077 | REBAR_GetRowCount (REBAR_INFO *infoPtr)
|
|---|
| 3078 | {
|
|---|
| 3079 | TRACE("%u\n", infoPtr->uNumRows);
|
|---|
| 3080 |
|
|---|
| 3081 | return infoPtr->uNumRows;
|
|---|
| 3082 | }
|
|---|
| 3083 |
|
|---|
| 3084 |
|
|---|
| 3085 | static LRESULT
|
|---|
| 3086 | REBAR_GetRowHeight (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3087 | {
|
|---|
| 3088 | INT iRow = (INT)wParam;
|
|---|
| 3089 | int j = 0, ret = 0;
|
|---|
| 3090 | UINT i;
|
|---|
| 3091 | REBAR_BAND *lpBand;
|
|---|
| 3092 |
|
|---|
| 3093 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 3094 | lpBand = &infoPtr->bands[i];
|
|---|
| 3095 | if (HIDDENBAND(lpBand)) continue;
|
|---|
| 3096 | if (lpBand->iRow != iRow) continue;
|
|---|
| 3097 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 3098 | j = lpBand->rcBand.right - lpBand->rcBand.left;
|
|---|
| 3099 | else
|
|---|
| 3100 | j = lpBand->rcBand.bottom - lpBand->rcBand.top;
|
|---|
| 3101 | if (j > ret) ret = j;
|
|---|
| 3102 | }
|
|---|
| 3103 |
|
|---|
| 3104 | TRACE("row %d, height %d\n", iRow, ret);
|
|---|
| 3105 |
|
|---|
| 3106 | return ret;
|
|---|
| 3107 | }
|
|---|
| 3108 |
|
|---|
| 3109 |
|
|---|
| 3110 | inline static LRESULT
|
|---|
| 3111 | REBAR_GetTextColor (REBAR_INFO *infoPtr)
|
|---|
| 3112 | {
|
|---|
| 3113 | TRACE("text color 0x%06lx!\n", infoPtr->clrText);
|
|---|
| 3114 |
|
|---|
| 3115 | return infoPtr->clrText;
|
|---|
| 3116 | }
|
|---|
| 3117 |
|
|---|
| 3118 |
|
|---|
| 3119 | inline static LRESULT
|
|---|
| 3120 | REBAR_GetToolTips (REBAR_INFO *infoPtr)
|
|---|
| 3121 | {
|
|---|
| 3122 | return (LRESULT)infoPtr->hwndToolTip;
|
|---|
| 3123 | }
|
|---|
| 3124 |
|
|---|
| 3125 |
|
|---|
| 3126 | inline static LRESULT
|
|---|
| 3127 | REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr)
|
|---|
| 3128 | {
|
|---|
| 3129 | TRACE("%s hwnd=%p\n",
|
|---|
| 3130 | infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);
|
|---|
| 3131 |
|
|---|
| 3132 | return infoPtr->bUnicode;
|
|---|
| 3133 | }
|
|---|
| 3134 |
|
|---|
| 3135 |
|
|---|
| 3136 | inline static LRESULT
|
|---|
| 3137 | REBAR_GetVersion (REBAR_INFO *infoPtr)
|
|---|
| 3138 | {
|
|---|
| 3139 | TRACE("version %d\n", infoPtr->iVersion);
|
|---|
| 3140 | return infoPtr->iVersion;
|
|---|
| 3141 | }
|
|---|
| 3142 |
|
|---|
| 3143 |
|
|---|
| 3144 | static LRESULT
|
|---|
| 3145 | REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3146 | {
|
|---|
| 3147 | LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
|
|---|
| 3148 |
|
|---|
| 3149 | if (!lprbht)
|
|---|
| 3150 | return -1;
|
|---|
| 3151 |
|
|---|
| 3152 | REBAR_InternalHitTest (infoPtr, &lprbht->pt, &lprbht->flags, &lprbht->iBand);
|
|---|
| 3153 |
|
|---|
| 3154 | return lprbht->iBand;
|
|---|
| 3155 | }
|
|---|
| 3156 |
|
|---|
| 3157 |
|
|---|
| 3158 | static LRESULT
|
|---|
| 3159 | REBAR_IdToIndex (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3160 | {
|
|---|
| 3161 | UINT i;
|
|---|
| 3162 |
|
|---|
| 3163 | if (infoPtr == NULL)
|
|---|
| 3164 | return -1;
|
|---|
| 3165 |
|
|---|
| 3166 | if (infoPtr->uNumBands < 1)
|
|---|
| 3167 | return -1;
|
|---|
| 3168 |
|
|---|
| 3169 | for (i = 0; i < infoPtr->uNumBands; i++) {
|
|---|
| 3170 | if (infoPtr->bands[i].wID == (UINT)wParam) {
|
|---|
| 3171 | TRACE("id %u is band %u found!\n", (UINT)wParam, i);
|
|---|
| 3172 | return i;
|
|---|
| 3173 | }
|
|---|
| 3174 | }
|
|---|
| 3175 |
|
|---|
| 3176 | TRACE("id %u is not found\n", (UINT)wParam);
|
|---|
| 3177 | return -1;
|
|---|
| 3178 | }
|
|---|
| 3179 |
|
|---|
| 3180 |
|
|---|
| 3181 | static LRESULT
|
|---|
| 3182 | REBAR_InsertBandA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3183 | {
|
|---|
| 3184 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
|
|---|
| 3185 | UINT uIndex = (UINT)wParam;
|
|---|
| 3186 | REBAR_BAND *lpBand;
|
|---|
| 3187 |
|
|---|
| 3188 | if (infoPtr == NULL)
|
|---|
| 3189 | return FALSE;
|
|---|
| 3190 | if (lprbbi == NULL)
|
|---|
| 3191 | return FALSE;
|
|---|
| 3192 | if (lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
|
|---|
| 3193 | return FALSE;
|
|---|
| 3194 |
|
|---|
| 3195 | /* trace the index as signed to see the -1 */
|
|---|
| 3196 | TRACE("insert band at %d!\n", (INT)uIndex);
|
|---|
| 3197 | REBAR_DumpBandInfo (lprbbi);
|
|---|
| 3198 |
|
|---|
| 3199 | if (infoPtr->uNumBands == 0) {
|
|---|
| 3200 | infoPtr->bands = (REBAR_BAND *)Alloc (sizeof (REBAR_BAND));
|
|---|
| 3201 | uIndex = 0;
|
|---|
| 3202 | }
|
|---|
| 3203 | else {
|
|---|
| 3204 | REBAR_BAND *oldBands = infoPtr->bands;
|
|---|
| 3205 | infoPtr->bands =
|
|---|
| 3206 | (REBAR_BAND *)Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
|
|---|
| 3207 | if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
|
|---|
| 3208 | uIndex = infoPtr->uNumBands;
|
|---|
| 3209 |
|
|---|
| 3210 | /* pre insert copy */
|
|---|
| 3211 | if (uIndex > 0) {
|
|---|
| 3212 | memcpy (&infoPtr->bands[0], &oldBands[0],
|
|---|
| 3213 | uIndex * sizeof(REBAR_BAND));
|
|---|
| 3214 | }
|
|---|
| 3215 |
|
|---|
| 3216 | /* post copy */
|
|---|
| 3217 | if (uIndex < infoPtr->uNumBands - 1) {
|
|---|
| 3218 | memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
|
|---|
| 3219 | (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
|
|---|
| 3220 | }
|
|---|
| 3221 |
|
|---|
| 3222 | Free (oldBands);
|
|---|
| 3223 | }
|
|---|
| 3224 |
|
|---|
| 3225 | infoPtr->uNumBands++;
|
|---|
| 3226 |
|
|---|
| 3227 | TRACE("index %u!\n", uIndex);
|
|---|
| 3228 |
|
|---|
| 3229 | /* initialize band (infoPtr->bands[uIndex])*/
|
|---|
| 3230 | lpBand = &infoPtr->bands[uIndex];
|
|---|
| 3231 | lpBand->fMask = 0;
|
|---|
| 3232 | lpBand->fStatus = 0;
|
|---|
| 3233 | lpBand->clrFore = infoPtr->clrText;
|
|---|
| 3234 | lpBand->clrBack = infoPtr->clrBk;
|
|---|
| 3235 | lpBand->hwndChild = 0;
|
|---|
| 3236 | lpBand->hwndPrevParent = 0;
|
|---|
| 3237 |
|
|---|
| 3238 | REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand);
|
|---|
| 3239 | lpBand->lpText = NULL;
|
|---|
| 3240 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
|
|---|
| 3241 | INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 );
|
|---|
| 3242 | if (len > 1) {
|
|---|
| 3243 | lpBand->lpText = (LPWSTR)Alloc (len*sizeof(WCHAR));
|
|---|
| 3244 | MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len );
|
|---|
| 3245 | }
|
|---|
| 3246 | }
|
|---|
| 3247 |
|
|---|
| 3248 | REBAR_ValidateBand (infoPtr, lpBand);
|
|---|
| 3249 | /* On insert of second band, revalidate band 1 to possible add gripper */
|
|---|
| 3250 | if (infoPtr->uNumBands == 2)
|
|---|
| 3251 | REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
|
|---|
| 3252 |
|
|---|
| 3253 | REBAR_DumpBand (infoPtr);
|
|---|
| 3254 |
|
|---|
| 3255 | REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
|
|---|
| 3256 | InvalidateRect(infoPtr->hwndSelf, 0, 1);
|
|---|
| 3257 |
|
|---|
| 3258 | return TRUE;
|
|---|
| 3259 | }
|
|---|
| 3260 |
|
|---|
| 3261 |
|
|---|
| 3262 | static LRESULT
|
|---|
| 3263 | REBAR_InsertBandW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3264 | {
|
|---|
| 3265 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
|
|---|
| 3266 | UINT uIndex = (UINT)wParam;
|
|---|
| 3267 | REBAR_BAND *lpBand;
|
|---|
| 3268 |
|
|---|
| 3269 | if (infoPtr == NULL)
|
|---|
| 3270 | return FALSE;
|
|---|
| 3271 | if (lprbbi == NULL)
|
|---|
| 3272 | return FALSE;
|
|---|
| 3273 | if (lprbbi->cbSize < REBARBANDINFOW_V3_SIZE)
|
|---|
| 3274 | return FALSE;
|
|---|
| 3275 |
|
|---|
| 3276 | /* trace the index as signed to see the -1 */
|
|---|
| 3277 | TRACE("insert band at %d!\n", (INT)uIndex);
|
|---|
| 3278 | REBAR_DumpBandInfo ((LPREBARBANDINFOA)lprbbi);
|
|---|
| 3279 |
|
|---|
| 3280 | if (infoPtr->uNumBands == 0) {
|
|---|
| 3281 | infoPtr->bands = (REBAR_BAND *)Alloc (sizeof (REBAR_BAND));
|
|---|
| 3282 | uIndex = 0;
|
|---|
| 3283 | }
|
|---|
| 3284 | else {
|
|---|
| 3285 | REBAR_BAND *oldBands = infoPtr->bands;
|
|---|
| 3286 | infoPtr->bands =
|
|---|
| 3287 | (REBAR_BAND *)Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
|
|---|
| 3288 | if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
|
|---|
| 3289 | uIndex = infoPtr->uNumBands;
|
|---|
| 3290 |
|
|---|
| 3291 | /* pre insert copy */
|
|---|
| 3292 | if (uIndex > 0) {
|
|---|
| 3293 | memcpy (&infoPtr->bands[0], &oldBands[0],
|
|---|
| 3294 | uIndex * sizeof(REBAR_BAND));
|
|---|
| 3295 | }
|
|---|
| 3296 |
|
|---|
| 3297 | /* post copy */
|
|---|
| 3298 | if (uIndex <= infoPtr->uNumBands - 1) {
|
|---|
| 3299 | memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
|
|---|
| 3300 | (infoPtr->uNumBands - uIndex) * sizeof(REBAR_BAND));
|
|---|
| 3301 | }
|
|---|
| 3302 |
|
|---|
| 3303 | Free (oldBands);
|
|---|
| 3304 | }
|
|---|
| 3305 |
|
|---|
| 3306 | infoPtr->uNumBands++;
|
|---|
| 3307 |
|
|---|
| 3308 | TRACE("index %u!\n", uIndex);
|
|---|
| 3309 |
|
|---|
| 3310 | /* initialize band (infoPtr->bands[uIndex])*/
|
|---|
| 3311 | lpBand = &infoPtr->bands[uIndex];
|
|---|
| 3312 | lpBand->fMask = 0;
|
|---|
| 3313 | lpBand->fStatus = 0;
|
|---|
| 3314 | lpBand->clrFore = infoPtr->clrText;
|
|---|
| 3315 | lpBand->clrBack = infoPtr->clrBk;
|
|---|
| 3316 | lpBand->hwndChild = 0;
|
|---|
| 3317 | lpBand->hwndPrevParent = 0;
|
|---|
| 3318 |
|
|---|
| 3319 | REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand);
|
|---|
| 3320 | lpBand->lpText = NULL;
|
|---|
| 3321 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
|
|---|
| 3322 | INT len = lstrlenW (lprbbi->lpText);
|
|---|
| 3323 | if (len > 0) {
|
|---|
| 3324 | lpBand->lpText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
|
|---|
| 3325 | strcpyW (lpBand->lpText, lprbbi->lpText);
|
|---|
| 3326 | }
|
|---|
| 3327 | }
|
|---|
| 3328 |
|
|---|
| 3329 | REBAR_ValidateBand (infoPtr, lpBand);
|
|---|
| 3330 | /* On insert of second band, revalidate band 1 to possible add gripper */
|
|---|
| 3331 | if (infoPtr->uNumBands == 2)
|
|---|
| 3332 | REBAR_ValidateBand (infoPtr, &infoPtr->bands[uIndex ? 0 : 1]);
|
|---|
| 3333 |
|
|---|
| 3334 | REBAR_DumpBand (infoPtr);
|
|---|
| 3335 |
|
|---|
| 3336 | REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
|
|---|
| 3337 | InvalidateRect(infoPtr->hwndSelf, 0, 1);
|
|---|
| 3338 |
|
|---|
| 3339 | return TRUE;
|
|---|
| 3340 | }
|
|---|
| 3341 |
|
|---|
| 3342 |
|
|---|
| 3343 | static LRESULT
|
|---|
| 3344 | REBAR_MaximizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3345 | {
|
|---|
| 3346 | REBAR_BAND *lpBand;
|
|---|
| 3347 | UINT uBand = (UINT) wParam;
|
|---|
| 3348 |
|
|---|
| 3349 | /* Validate */
|
|---|
| 3350 | if ((infoPtr->uNumBands == 0) ||
|
|---|
| 3351 | ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) {
|
|---|
| 3352 | /* error !!! */
|
|---|
| 3353 | ERR("Illegal MaximizeBand, requested=%d, current band count=%d\n",
|
|---|
| 3354 | (INT)uBand, infoPtr->uNumBands);
|
|---|
| 3355 | return FALSE;
|
|---|
| 3356 | }
|
|---|
| 3357 |
|
|---|
| 3358 | lpBand = &infoPtr->bands[uBand];
|
|---|
| 3359 |
|
|---|
| 3360 | if (lParam && (lpBand->fMask & RBBIM_IDEALSIZE)) {
|
|---|
| 3361 | /* handle setting ideal size */
|
|---|
| 3362 | lpBand->ccx = lpBand->cxIdeal;
|
|---|
| 3363 | }
|
|---|
| 3364 | else {
|
|---|
| 3365 | /* handle setting to max */
|
|---|
| 3366 | FIXME("(uBand = %u fIdeal = %s) case not coded\n",
|
|---|
| 3367 | (UINT)wParam, lParam ? "TRUE" : "FALSE");
|
|---|
| 3368 | return FALSE;
|
|---|
| 3369 | }
|
|---|
| 3370 |
|
|---|
| 3371 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 3372 | REBAR_Layout (infoPtr, 0, TRUE, TRUE);
|
|---|
| 3373 | InvalidateRect (infoPtr->hwndSelf, 0, TRUE);
|
|---|
| 3374 |
|
|---|
| 3375 | return TRUE;
|
|---|
| 3376 |
|
|---|
| 3377 | }
|
|---|
| 3378 |
|
|---|
| 3379 |
|
|---|
| 3380 | static LRESULT
|
|---|
| 3381 | REBAR_MinimizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3382 | {
|
|---|
| 3383 | REBAR_BAND *band, *lpBand;
|
|---|
| 3384 | UINT uBand = (UINT) wParam;
|
|---|
| 3385 | RECT newrect;
|
|---|
| 3386 | INT imindBand, imaxdBand, iprevBand, startBand, endBand;
|
|---|
| 3387 | INT movement, i;
|
|---|
| 3388 |
|
|---|
| 3389 | /* A "minimize" band is equivalent to "dragging" the gripper
|
|---|
| 3390 | * of than band to the right till the band is only the size
|
|---|
| 3391 | * of the cxHeader.
|
|---|
| 3392 | */
|
|---|
| 3393 |
|
|---|
| 3394 | /* Validate */
|
|---|
| 3395 | if ((infoPtr->uNumBands == 0) ||
|
|---|
| 3396 | ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) {
|
|---|
| 3397 | /* error !!! */
|
|---|
| 3398 | ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n",
|
|---|
| 3399 | (INT)uBand, infoPtr->uNumBands);
|
|---|
| 3400 | return FALSE;
|
|---|
| 3401 | }
|
|---|
| 3402 |
|
|---|
| 3403 | /* compute amount of movement and validate */
|
|---|
| 3404 | lpBand = &infoPtr->bands[uBand];
|
|---|
| 3405 |
|
|---|
| 3406 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 3407 | movement = lpBand->rcBand.bottom - lpBand->rcBand.top -
|
|---|
| 3408 | lpBand->cxHeader;
|
|---|
| 3409 | else
|
|---|
| 3410 | movement = lpBand->rcBand.right - lpBand->rcBand.left -
|
|---|
| 3411 | lpBand->cxHeader;
|
|---|
| 3412 | if (movement < 0) {
|
|---|
| 3413 | ERR("something is wrong, band=(%ld,%ld)-(%ld,%ld), cxheader=%d\n",
|
|---|
| 3414 | lpBand->rcBand.left, lpBand->rcBand.top,
|
|---|
| 3415 | lpBand->rcBand.right, lpBand->rcBand.bottom,
|
|---|
| 3416 | lpBand->cxHeader);
|
|---|
| 3417 | return FALSE;
|
|---|
| 3418 | }
|
|---|
| 3419 |
|
|---|
| 3420 | imindBand = -1;
|
|---|
| 3421 | imaxdBand = -1;
|
|---|
| 3422 | iprevBand = -1; /* to suppress warning message */
|
|---|
| 3423 |
|
|---|
| 3424 | /* find the first band in row of the one whose is being minimized */
|
|---|
| 3425 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 3426 | band = &infoPtr->bands[i];
|
|---|
| 3427 | if (HIDDENBAND(band)) continue;
|
|---|
| 3428 | if (band->iRow == lpBand->iRow) {
|
|---|
| 3429 | imaxdBand = i;
|
|---|
| 3430 | if (imindBand == -1) imindBand = i;
|
|---|
| 3431 | }
|
|---|
| 3432 | }
|
|---|
| 3433 |
|
|---|
| 3434 | /* if the selected band is first in row then need to expand */
|
|---|
| 3435 | /* next visible band */
|
|---|
| 3436 | if (imindBand == uBand) {
|
|---|
| 3437 | band = NULL;
|
|---|
| 3438 | movement = -movement;
|
|---|
| 3439 | /* find the first visible band to the right of the selected band */
|
|---|
| 3440 | for (i=uBand+1; i<=imaxdBand; i++) {
|
|---|
| 3441 | band = &infoPtr->bands[i];
|
|---|
| 3442 | if (!HIDDENBAND(band)) {
|
|---|
| 3443 | iprevBand = i;
|
|---|
| 3444 | LEADJ(band, movement);
|
|---|
| 3445 | band->ccx = rcBw(band);
|
|---|
| 3446 | break;
|
|---|
| 3447 | }
|
|---|
| 3448 | }
|
|---|
| 3449 | /* what case is this */
|
|---|
| 3450 | if (iprevBand == -1) {
|
|---|
| 3451 | ERR("no previous visible band\n");
|
|---|
| 3452 | return FALSE;
|
|---|
| 3453 | }
|
|---|
| 3454 | startBand = uBand;
|
|---|
| 3455 | endBand = iprevBand;
|
|---|
| 3456 | SetRect (&newrect,
|
|---|
| 3457 | lpBand->rcBand.left,
|
|---|
| 3458 | lpBand->rcBand.top,
|
|---|
| 3459 | band->rcBand.right,
|
|---|
| 3460 | band->rcBand.bottom);
|
|---|
| 3461 | }
|
|---|
| 3462 | /* otherwise expand previous visible band */
|
|---|
| 3463 | else {
|
|---|
| 3464 | band = NULL;
|
|---|
| 3465 | /* find the first visible band to the left of the selected band */
|
|---|
| 3466 | for (i=uBand-1; i>=imindBand; i--) {
|
|---|
| 3467 | band = &infoPtr->bands[i];
|
|---|
| 3468 | if (!HIDDENBAND(band)) {
|
|---|
| 3469 | iprevBand = i;
|
|---|
| 3470 | READJ(band, movement);
|
|---|
| 3471 | band->ccx = rcBw(band);
|
|---|
| 3472 | break;
|
|---|
| 3473 | }
|
|---|
| 3474 | }
|
|---|
| 3475 | /* what case is this */
|
|---|
| 3476 | if (iprevBand == -1) {
|
|---|
| 3477 | ERR("no previous visible band\n");
|
|---|
| 3478 | return FALSE;
|
|---|
| 3479 | }
|
|---|
| 3480 | startBand = iprevBand;
|
|---|
| 3481 | endBand = uBand;
|
|---|
| 3482 | SetRect (&newrect,
|
|---|
| 3483 | band->rcBand.left,
|
|---|
| 3484 | band->rcBand.top,
|
|---|
| 3485 | lpBand->rcBand.right,
|
|---|
| 3486 | lpBand->rcBand.bottom);
|
|---|
| 3487 | }
|
|---|
| 3488 |
|
|---|
| 3489 | REBAR_Shrink (infoPtr, lpBand, movement, uBand);
|
|---|
| 3490 |
|
|---|
| 3491 | /* recompute all rectangles */
|
|---|
| 3492 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 3493 | REBAR_CalcVertBand (infoPtr, startBand, endBand+1,
|
|---|
| 3494 | FALSE);
|
|---|
| 3495 | }
|
|---|
| 3496 | else {
|
|---|
| 3497 | REBAR_CalcHorzBand (infoPtr, startBand, endBand+1,
|
|---|
| 3498 | FALSE);
|
|---|
| 3499 | }
|
|---|
| 3500 |
|
|---|
| 3501 | TRACE("bands after minimize, see band # %d, %d\n",
|
|---|
| 3502 | startBand, endBand);
|
|---|
| 3503 | REBAR_DumpBand (infoPtr);
|
|---|
| 3504 |
|
|---|
| 3505 | REBAR_MoveChildWindows (infoPtr, startBand, endBand+1);
|
|---|
| 3506 |
|
|---|
| 3507 | InvalidateRect (infoPtr->hwndSelf, &newrect, TRUE);
|
|---|
| 3508 | UpdateWindow (infoPtr->hwndSelf);
|
|---|
| 3509 | return FALSE;
|
|---|
| 3510 | }
|
|---|
| 3511 |
|
|---|
| 3512 |
|
|---|
| 3513 | static LRESULT
|
|---|
| 3514 | REBAR_MoveBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3515 | {
|
|---|
| 3516 | REBAR_BAND *oldBands = infoPtr->bands;
|
|---|
| 3517 | REBAR_BAND holder;
|
|---|
| 3518 | UINT uFrom = (UINT)wParam;
|
|---|
| 3519 | UINT uTo = (UINT)lParam;
|
|---|
| 3520 |
|
|---|
| 3521 | /* Validate */
|
|---|
| 3522 | if ((infoPtr->uNumBands == 0) ||
|
|---|
| 3523 | ((INT)uFrom < 0) || (uFrom >= infoPtr->uNumBands) ||
|
|---|
| 3524 | ((INT)uTo < 0) || (uTo >= infoPtr->uNumBands)) {
|
|---|
| 3525 | /* error !!! */
|
|---|
| 3526 | ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n",
|
|---|
| 3527 | (INT)uFrom, (INT)uTo, infoPtr->uNumBands);
|
|---|
| 3528 | return FALSE;
|
|---|
| 3529 | }
|
|---|
| 3530 |
|
|---|
| 3531 | /* save one to be moved */
|
|---|
| 3532 | memcpy (&holder, &oldBands[uFrom], sizeof(REBAR_BAND));
|
|---|
| 3533 |
|
|---|
| 3534 | /* close up rest of bands (pseudo delete) */
|
|---|
| 3535 | if (uFrom < infoPtr->uNumBands - 1) {
|
|---|
| 3536 | memcpy (&oldBands[uFrom], &oldBands[uFrom+1],
|
|---|
| 3537 | (infoPtr->uNumBands - uFrom - 1) * sizeof(REBAR_BAND));
|
|---|
| 3538 | }
|
|---|
| 3539 |
|
|---|
| 3540 | /* allocate new space and copy rest of bands into it */
|
|---|
| 3541 | infoPtr->bands =
|
|---|
| 3542 | (REBAR_BAND *)Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));
|
|---|
| 3543 |
|
|---|
| 3544 | /* pre insert copy */
|
|---|
| 3545 | if (uTo > 0) {
|
|---|
| 3546 | memcpy (&infoPtr->bands[0], &oldBands[0],
|
|---|
| 3547 | uTo * sizeof(REBAR_BAND));
|
|---|
| 3548 | }
|
|---|
| 3549 |
|
|---|
| 3550 | /* set moved band */
|
|---|
| 3551 | memcpy (&infoPtr->bands[uTo], &holder, sizeof(REBAR_BAND));
|
|---|
| 3552 |
|
|---|
| 3553 | /* post copy */
|
|---|
| 3554 | if (uTo < infoPtr->uNumBands - 1) {
|
|---|
| 3555 | memcpy (&infoPtr->bands[uTo+1], &oldBands[uTo],
|
|---|
| 3556 | (infoPtr->uNumBands - uTo - 1) * sizeof(REBAR_BAND));
|
|---|
| 3557 | }
|
|---|
| 3558 |
|
|---|
| 3559 | Free (oldBands);
|
|---|
| 3560 |
|
|---|
| 3561 | TRACE("moved band %d to index %d\n", uFrom, uTo);
|
|---|
| 3562 | REBAR_DumpBand (infoPtr);
|
|---|
| 3563 |
|
|---|
| 3564 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 3565 | /* **************************************************** */
|
|---|
| 3566 | /* */
|
|---|
| 3567 | /* We do not do a REBAR_Layout here because the native */
|
|---|
| 3568 | /* control does not do that. The actual layout and */
|
|---|
| 3569 | /* repaint is done by the *next* real action, ex.: */
|
|---|
| 3570 | /* RB_INSERTBAND, RB_DELETEBAND, RB_SIZETORECT, etc. */
|
|---|
| 3571 | /* */
|
|---|
| 3572 | /* **************************************************** */
|
|---|
| 3573 |
|
|---|
| 3574 | return TRUE;
|
|---|
| 3575 | }
|
|---|
| 3576 |
|
|---|
| 3577 |
|
|---|
| 3578 | /* return TRUE if two strings are different */
|
|---|
| 3579 | static BOOL
|
|---|
| 3580 | REBAR_strdifW( LPCWSTR a, LPCWSTR b )
|
|---|
| 3581 | {
|
|---|
| 3582 | return ( (a && !b) || (b && !a) || (a && b && lstrcmpW(a, b) ) );
|
|---|
| 3583 | }
|
|---|
| 3584 |
|
|---|
| 3585 | static LRESULT
|
|---|
| 3586 | REBAR_SetBandInfoA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3587 | {
|
|---|
| 3588 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam;
|
|---|
| 3589 | REBAR_BAND *lpBand;
|
|---|
| 3590 | BOOL bChanged;
|
|---|
| 3591 |
|
|---|
| 3592 | if (lprbbi == NULL)
|
|---|
| 3593 | return FALSE;
|
|---|
| 3594 | if (lprbbi->cbSize < REBARBANDINFOA_V3_SIZE)
|
|---|
| 3595 | return FALSE;
|
|---|
| 3596 | if ((UINT)wParam >= infoPtr->uNumBands)
|
|---|
| 3597 | return FALSE;
|
|---|
| 3598 |
|
|---|
| 3599 | TRACE("index %u\n", (UINT)wParam);
|
|---|
| 3600 | REBAR_DumpBandInfo (lprbbi);
|
|---|
| 3601 |
|
|---|
| 3602 | /* set band information */
|
|---|
| 3603 | lpBand = &infoPtr->bands[(UINT)wParam];
|
|---|
| 3604 |
|
|---|
| 3605 | bChanged = REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand);
|
|---|
| 3606 | if (lprbbi->fMask & RBBIM_TEXT) {
|
|---|
| 3607 | LPWSTR wstr = NULL;
|
|---|
| 3608 |
|
|---|
| 3609 | if (lprbbi->lpText)
|
|---|
| 3610 | {
|
|---|
| 3611 | INT len;
|
|---|
| 3612 | len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 );
|
|---|
| 3613 | if (len > 1)
|
|---|
| 3614 | wstr = (LPWSTR)Alloc (len*sizeof(WCHAR));
|
|---|
| 3615 | if (wstr)
|
|---|
| 3616 | MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, wstr, len );
|
|---|
| 3617 | }
|
|---|
| 3618 | if (REBAR_strdifW(lpBand->lpText, wstr)) {
|
|---|
| 3619 | if (lpBand->lpText) {
|
|---|
| 3620 | Free (lpBand->lpText);
|
|---|
| 3621 | lpBand->lpText = NULL;
|
|---|
| 3622 | }
|
|---|
| 3623 | if (wstr) {
|
|---|
| 3624 | lpBand->lpText = wstr;
|
|---|
| 3625 | wstr = NULL;
|
|---|
| 3626 | }
|
|---|
| 3627 | bChanged = TRUE;
|
|---|
| 3628 | }
|
|---|
| 3629 | if (wstr)
|
|---|
| 3630 | Free (wstr);
|
|---|
| 3631 | }
|
|---|
| 3632 |
|
|---|
| 3633 | REBAR_ValidateBand (infoPtr, lpBand);
|
|---|
| 3634 |
|
|---|
| 3635 | REBAR_DumpBand (infoPtr);
|
|---|
| 3636 |
|
|---|
| 3637 | if (bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE))) {
|
|---|
| 3638 | REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
|
|---|
| 3639 | InvalidateRect(infoPtr->hwndSelf, 0, 1);
|
|---|
| 3640 | }
|
|---|
| 3641 |
|
|---|
| 3642 | return TRUE;
|
|---|
| 3643 | }
|
|---|
| 3644 |
|
|---|
| 3645 | static LRESULT
|
|---|
| 3646 | REBAR_SetBandInfoW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3647 | {
|
|---|
| 3648 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam;
|
|---|
| 3649 | REBAR_BAND *lpBand;
|
|---|
| 3650 | BOOL bChanged;
|
|---|
| 3651 |
|
|---|
| 3652 | if (lprbbi == NULL)
|
|---|
| 3653 | return FALSE;
|
|---|
| 3654 | if (lprbbi->cbSize < REBARBANDINFOW_V3_SIZE)
|
|---|
| 3655 | return FALSE;
|
|---|
| 3656 | if ((UINT)wParam >= infoPtr->uNumBands)
|
|---|
| 3657 | return FALSE;
|
|---|
| 3658 |
|
|---|
| 3659 | TRACE("index %u\n", (UINT)wParam);
|
|---|
| 3660 | REBAR_DumpBandInfo ((LPREBARBANDINFOA)lprbbi);
|
|---|
| 3661 |
|
|---|
| 3662 | /* set band information */
|
|---|
| 3663 | lpBand = &infoPtr->bands[(UINT)wParam];
|
|---|
| 3664 |
|
|---|
| 3665 | bChanged = REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand);
|
|---|
| 3666 | if( (lprbbi->fMask & RBBIM_TEXT) &&
|
|---|
| 3667 | REBAR_strdifW( lpBand->lpText, lprbbi->lpText ) ) {
|
|---|
| 3668 | if (lpBand->lpText) {
|
|---|
| 3669 | Free (lpBand->lpText);
|
|---|
| 3670 | lpBand->lpText = NULL;
|
|---|
| 3671 | }
|
|---|
| 3672 | if (lprbbi->lpText) {
|
|---|
| 3673 | INT len = lstrlenW (lprbbi->lpText);
|
|---|
| 3674 | if (len > 0)
|
|---|
| 3675 | {
|
|---|
| 3676 | lpBand->lpText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
|
|---|
| 3677 | strcpyW (lpBand->lpText, lprbbi->lpText);
|
|---|
| 3678 | }
|
|---|
| 3679 | }
|
|---|
| 3680 | bChanged = TRUE;
|
|---|
| 3681 | }
|
|---|
| 3682 |
|
|---|
| 3683 | REBAR_ValidateBand (infoPtr, lpBand);
|
|---|
| 3684 |
|
|---|
| 3685 | REBAR_DumpBand (infoPtr);
|
|---|
| 3686 |
|
|---|
| 3687 | if ( bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) ) {
|
|---|
| 3688 | REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
|
|---|
| 3689 | InvalidateRect(infoPtr->hwndSelf, 0, 1);
|
|---|
| 3690 | }
|
|---|
| 3691 |
|
|---|
| 3692 | return TRUE;
|
|---|
| 3693 | }
|
|---|
| 3694 |
|
|---|
| 3695 |
|
|---|
| 3696 | static LRESULT
|
|---|
| 3697 | REBAR_SetBarInfo (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3698 | {
|
|---|
| 3699 | LPREBARINFO lpInfo = (LPREBARINFO)lParam;
|
|---|
| 3700 | REBAR_BAND *lpBand;
|
|---|
| 3701 | UINT i;
|
|---|
| 3702 |
|
|---|
| 3703 | if (lpInfo == NULL)
|
|---|
| 3704 | return FALSE;
|
|---|
| 3705 |
|
|---|
| 3706 | if (lpInfo->cbSize < sizeof (REBARINFO))
|
|---|
| 3707 | return FALSE;
|
|---|
| 3708 |
|
|---|
| 3709 | TRACE("setting bar info!\n");
|
|---|
| 3710 |
|
|---|
| 3711 | if (lpInfo->fMask & RBIM_IMAGELIST) {
|
|---|
| 3712 | infoPtr->himl = lpInfo->himl;
|
|---|
| 3713 | if (infoPtr->himl) {
|
|---|
| 3714 | INT cx, cy;
|
|---|
| 3715 | ImageList_GetIconSize (infoPtr->himl, &cx, &cy);
|
|---|
| 3716 | infoPtr->imageSize.cx = cx;
|
|---|
| 3717 | infoPtr->imageSize.cy = cy;
|
|---|
| 3718 | }
|
|---|
| 3719 | else {
|
|---|
| 3720 | infoPtr->imageSize.cx = 0;
|
|---|
| 3721 | infoPtr->imageSize.cy = 0;
|
|---|
| 3722 | }
|
|---|
| 3723 | TRACE("new image cx=%ld, cy=%ld\n", infoPtr->imageSize.cx,
|
|---|
| 3724 | infoPtr->imageSize.cy);
|
|---|
| 3725 | }
|
|---|
| 3726 |
|
|---|
| 3727 | /* revalidate all bands to reset flags for images in headers of bands */
|
|---|
| 3728 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 3729 | lpBand = &infoPtr->bands[i];
|
|---|
| 3730 | REBAR_ValidateBand (infoPtr, lpBand);
|
|---|
| 3731 | }
|
|---|
| 3732 |
|
|---|
| 3733 | return TRUE;
|
|---|
| 3734 | }
|
|---|
| 3735 |
|
|---|
| 3736 |
|
|---|
| 3737 | static LRESULT
|
|---|
| 3738 | REBAR_SetBkColor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3739 | {
|
|---|
| 3740 | COLORREF clrTemp;
|
|---|
| 3741 |
|
|---|
| 3742 | clrTemp = infoPtr->clrBk;
|
|---|
| 3743 | infoPtr->clrBk = (COLORREF)lParam;
|
|---|
| 3744 |
|
|---|
| 3745 | TRACE("background color 0x%06lx!\n", infoPtr->clrBk);
|
|---|
| 3746 |
|
|---|
| 3747 | return clrTemp;
|
|---|
| 3748 | }
|
|---|
| 3749 |
|
|---|
| 3750 |
|
|---|
| 3751 | /* << REBAR_SetColorScheme >> */
|
|---|
| 3752 | /* << REBAR_SetPalette >> */
|
|---|
| 3753 |
|
|---|
| 3754 |
|
|---|
| 3755 | static LRESULT
|
|---|
| 3756 | REBAR_SetParent (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3757 | {
|
|---|
| 3758 | HWND hwndTemp = infoPtr->hwndNotify;
|
|---|
| 3759 |
|
|---|
| 3760 | infoPtr->hwndNotify = (HWND)wParam;
|
|---|
| 3761 |
|
|---|
| 3762 | return (LRESULT)hwndTemp;
|
|---|
| 3763 | }
|
|---|
| 3764 |
|
|---|
| 3765 |
|
|---|
| 3766 | static LRESULT
|
|---|
| 3767 | REBAR_SetTextColor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3768 | {
|
|---|
| 3769 | COLORREF clrTemp;
|
|---|
| 3770 |
|
|---|
| 3771 | clrTemp = infoPtr->clrText;
|
|---|
| 3772 | infoPtr->clrText = (COLORREF)lParam;
|
|---|
| 3773 |
|
|---|
| 3774 | TRACE("text color 0x%06lx!\n", infoPtr->clrText);
|
|---|
| 3775 |
|
|---|
| 3776 | return clrTemp;
|
|---|
| 3777 | }
|
|---|
| 3778 |
|
|---|
| 3779 |
|
|---|
| 3780 | /* << REBAR_SetTooltips >> */
|
|---|
| 3781 |
|
|---|
| 3782 |
|
|---|
| 3783 | inline static LRESULT
|
|---|
| 3784 | REBAR_SetUnicodeFormat (REBAR_INFO *infoPtr, WPARAM wParam)
|
|---|
| 3785 | {
|
|---|
| 3786 | BOOL bTemp = infoPtr->bUnicode;
|
|---|
| 3787 |
|
|---|
| 3788 | TRACE("to %s hwnd=%p, was %s\n",
|
|---|
| 3789 | ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf,
|
|---|
| 3790 | (bTemp) ? "TRUE" : "FALSE");
|
|---|
| 3791 |
|
|---|
| 3792 | infoPtr->bUnicode = (BOOL)wParam;
|
|---|
| 3793 |
|
|---|
| 3794 | return bTemp;
|
|---|
| 3795 | }
|
|---|
| 3796 |
|
|---|
| 3797 |
|
|---|
| 3798 | static LRESULT
|
|---|
| 3799 | REBAR_SetVersion (REBAR_INFO *infoPtr, INT iVersion)
|
|---|
| 3800 | {
|
|---|
| 3801 | INT iOldVersion = infoPtr->iVersion;
|
|---|
| 3802 |
|
|---|
| 3803 | if (iVersion > COMCTL32_VERSION)
|
|---|
| 3804 | return -1;
|
|---|
| 3805 |
|
|---|
| 3806 | infoPtr->iVersion = iVersion;
|
|---|
| 3807 |
|
|---|
| 3808 | TRACE("new version %d\n", iVersion);
|
|---|
| 3809 |
|
|---|
| 3810 | return iOldVersion;
|
|---|
| 3811 | }
|
|---|
| 3812 |
|
|---|
| 3813 |
|
|---|
| 3814 | static LRESULT
|
|---|
| 3815 | REBAR_ShowBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3816 | {
|
|---|
| 3817 | REBAR_BAND *lpBand;
|
|---|
| 3818 |
|
|---|
| 3819 | if (((INT)wParam < 0) || ((INT)wParam > infoPtr->uNumBands))
|
|---|
| 3820 | return FALSE;
|
|---|
| 3821 |
|
|---|
| 3822 | lpBand = &infoPtr->bands[(INT)wParam];
|
|---|
| 3823 |
|
|---|
| 3824 | if ((BOOL)lParam) {
|
|---|
| 3825 | TRACE("show band %d\n", (INT)wParam);
|
|---|
| 3826 | lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;
|
|---|
| 3827 | if (IsWindow (lpBand->hwndChild))
|
|---|
| 3828 | ShowWindow (lpBand->hwndChild, SW_SHOW);
|
|---|
| 3829 | }
|
|---|
| 3830 | else {
|
|---|
| 3831 | TRACE("hide band %d\n", (INT)wParam);
|
|---|
| 3832 | lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;
|
|---|
| 3833 | if (IsWindow (lpBand->hwndChild))
|
|---|
| 3834 | ShowWindow (lpBand->hwndChild, SW_HIDE);
|
|---|
| 3835 | }
|
|---|
| 3836 |
|
|---|
| 3837 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 3838 | REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
|
|---|
| 3839 | InvalidateRect(infoPtr->hwndSelf, 0, 1);
|
|---|
| 3840 |
|
|---|
| 3841 | return TRUE;
|
|---|
| 3842 | }
|
|---|
| 3843 |
|
|---|
| 3844 |
|
|---|
| 3845 | static LRESULT
|
|---|
| 3846 | REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3847 | {
|
|---|
| 3848 | LPRECT lpRect = (LPRECT)lParam;
|
|---|
| 3849 | RECT t1;
|
|---|
| 3850 |
|
|---|
| 3851 | if (lpRect == NULL)
|
|---|
| 3852 | return FALSE;
|
|---|
| 3853 |
|
|---|
| 3854 | TRACE("[%ld %ld %ld %ld]\n",
|
|---|
| 3855 | lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
|---|
| 3856 |
|
|---|
| 3857 | /* what is going on???? */
|
|---|
| 3858 | GetWindowRect(infoPtr->hwndSelf, &t1);
|
|---|
| 3859 | TRACE("window rect [%ld %ld %ld %ld]\n",
|
|---|
| 3860 | t1.left, t1.top, t1.right, t1.bottom);
|
|---|
| 3861 | GetClientRect(infoPtr->hwndSelf, &t1);
|
|---|
| 3862 | TRACE("client rect [%ld %ld %ld %ld]\n",
|
|---|
| 3863 | t1.left, t1.top, t1.right, t1.bottom);
|
|---|
| 3864 |
|
|---|
| 3865 | /* force full _Layout processing */
|
|---|
| 3866 | TRACE("setting NEEDS_LAYOUT\n");
|
|---|
| 3867 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 3868 | REBAR_Layout (infoPtr, lpRect, TRUE, FALSE);
|
|---|
| 3869 | InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|---|
| 3870 | return TRUE;
|
|---|
| 3871 | }
|
|---|
| 3872 |
|
|---|
| 3873 |
|
|---|
| 3874 |
|
|---|
| 3875 | static LRESULT
|
|---|
| 3876 | REBAR_Create (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3877 | {
|
|---|
| 3878 | LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam;
|
|---|
| 3879 | RECT wnrc1, clrc1;
|
|---|
| 3880 |
|
|---|
| 3881 | if (TRACE_ON(rebar)) {
|
|---|
| 3882 | GetWindowRect(infoPtr->hwndSelf, &wnrc1);
|
|---|
| 3883 | GetClientRect(infoPtr->hwndSelf, &clrc1);
|
|---|
| 3884 | TRACE("window=(%ld,%ld)-(%ld,%ld) client=(%ld,%ld)-(%ld,%ld) cs=(%d,%d %dx%d)\n",
|
|---|
| 3885 | wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
|
|---|
| 3886 | clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
|
|---|
| 3887 | cs->x, cs->y, cs->cx, cs->cy);
|
|---|
| 3888 | }
|
|---|
| 3889 |
|
|---|
| 3890 | TRACE("created!\n");
|
|---|
| 3891 | return 0;
|
|---|
| 3892 | }
|
|---|
| 3893 |
|
|---|
| 3894 |
|
|---|
| 3895 | static LRESULT
|
|---|
| 3896 | REBAR_Destroy (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3897 | {
|
|---|
| 3898 | REBAR_BAND *lpBand;
|
|---|
| 3899 | UINT i;
|
|---|
| 3900 |
|
|---|
| 3901 |
|
|---|
| 3902 | /* free rebar bands */
|
|---|
| 3903 | if ((infoPtr->uNumBands > 0) && infoPtr->bands) {
|
|---|
| 3904 | /* clean up each band */
|
|---|
| 3905 | for (i = 0; i < infoPtr->uNumBands; i++) {
|
|---|
| 3906 | lpBand = &infoPtr->bands[i];
|
|---|
| 3907 |
|
|---|
| 3908 | /* delete text strings */
|
|---|
| 3909 | if (lpBand->lpText) {
|
|---|
| 3910 | Free (lpBand->lpText);
|
|---|
| 3911 | lpBand->lpText = NULL;
|
|---|
| 3912 | }
|
|---|
| 3913 | /* destroy child window */
|
|---|
| 3914 | DestroyWindow (lpBand->hwndChild);
|
|---|
| 3915 | }
|
|---|
| 3916 |
|
|---|
| 3917 | /* free band array */
|
|---|
| 3918 | Free (infoPtr->bands);
|
|---|
| 3919 | infoPtr->bands = NULL;
|
|---|
| 3920 | }
|
|---|
| 3921 |
|
|---|
| 3922 | DeleteObject (infoPtr->hcurArrow);
|
|---|
| 3923 | DeleteObject (infoPtr->hcurHorz);
|
|---|
| 3924 | DeleteObject (infoPtr->hcurVert);
|
|---|
| 3925 | DeleteObject (infoPtr->hcurDrag);
|
|---|
| 3926 | if(infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont);
|
|---|
| 3927 | SetWindowLongA (infoPtr->hwndSelf, 0, 0);
|
|---|
| 3928 |
|
|---|
| 3929 | /* free rebar info data */
|
|---|
| 3930 | Free (infoPtr);
|
|---|
| 3931 | TRACE("destroyed!\n");
|
|---|
| 3932 | return 0;
|
|---|
| 3933 | }
|
|---|
| 3934 |
|
|---|
| 3935 |
|
|---|
| 3936 | static LRESULT
|
|---|
| 3937 | REBAR_EraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3938 | {
|
|---|
| 3939 | RECT cliprect;
|
|---|
| 3940 |
|
|---|
| 3941 | if (GetClipBox ( (HDC)wParam, &cliprect))
|
|---|
| 3942 | return REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &cliprect);
|
|---|
| 3943 | return 0;
|
|---|
| 3944 | }
|
|---|
| 3945 |
|
|---|
| 3946 |
|
|---|
| 3947 | static LRESULT
|
|---|
| 3948 | REBAR_GetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3949 | {
|
|---|
| 3950 | return (LRESULT)infoPtr->hFont;
|
|---|
| 3951 | }
|
|---|
| 3952 |
|
|---|
| 3953 | static LRESULT
|
|---|
| 3954 | REBAR_PushChevron(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3955 | {
|
|---|
| 3956 | if (wParam >= 0 && (UINT)wParam < infoPtr->uNumBands)
|
|---|
| 3957 | {
|
|---|
| 3958 | NMREBARCHEVRON nmrbc;
|
|---|
| 3959 | REBAR_BAND *lpBand = &infoPtr->bands[wParam];
|
|---|
| 3960 |
|
|---|
| 3961 | TRACE("Pressed chevron on band %d\n", wParam);
|
|---|
| 3962 |
|
|---|
| 3963 | /* redraw chevron in pushed state */
|
|---|
| 3964 | lpBand->fDraw |= DRAW_CHEVRONPUSHED;
|
|---|
| 3965 | RedrawWindow(infoPtr->hwndSelf, &lpBand->rcChevron,0,
|
|---|
| 3966 | RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
|
|---|
| 3967 |
|
|---|
| 3968 | /* notify app so it can display a popup menu or whatever */
|
|---|
| 3969 | nmrbc.uBand = wParam;
|
|---|
| 3970 | nmrbc.wID = lpBand->wID;
|
|---|
| 3971 | nmrbc.lParam = lpBand->lParam;
|
|---|
| 3972 | nmrbc.rc = lpBand->rcChevron;
|
|---|
| 3973 | nmrbc.lParamNM = lParam;
|
|---|
| 3974 | REBAR_Notify((NMHDR*)&nmrbc, infoPtr, RBN_CHEVRONPUSHED);
|
|---|
| 3975 |
|
|---|
| 3976 | /* redraw chevron in previous state */
|
|---|
| 3977 | lpBand->fDraw &= ~DRAW_CHEVRONPUSHED;
|
|---|
| 3978 | InvalidateRect(infoPtr->hwndSelf, &lpBand->rcChevron, TRUE);
|
|---|
| 3979 |
|
|---|
| 3980 | return TRUE;
|
|---|
| 3981 | }
|
|---|
| 3982 | return FALSE;
|
|---|
| 3983 | }
|
|---|
| 3984 |
|
|---|
| 3985 | static LRESULT
|
|---|
| 3986 | REBAR_LButtonDown (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 3987 | {
|
|---|
| 3988 | REBAR_BAND *lpBand;
|
|---|
| 3989 | UINT htFlags;
|
|---|
| 3990 | UINT iHitBand;
|
|---|
| 3991 | POINT ptMouseDown;
|
|---|
| 3992 | ptMouseDown.x = (INT)LOWORD(lParam);
|
|---|
| 3993 | ptMouseDown.y = (INT)HIWORD(lParam);
|
|---|
| 3994 |
|
|---|
| 3995 | REBAR_InternalHitTest(infoPtr, &ptMouseDown, &htFlags, &iHitBand);
|
|---|
| 3996 | lpBand = &infoPtr->bands[iHitBand];
|
|---|
| 3997 |
|
|---|
| 3998 | if (htFlags == RBHT_CHEVRON)
|
|---|
| 3999 | {
|
|---|
| 4000 | REBAR_PushChevron(infoPtr, iHitBand, 0);
|
|---|
| 4001 | }
|
|---|
| 4002 | else if (htFlags == RBHT_GRABBER || htFlags == RBHT_CAPTION)
|
|---|
| 4003 | {
|
|---|
| 4004 | TRACE("Starting drag\n");
|
|---|
| 4005 |
|
|---|
| 4006 | SetCapture (infoPtr->hwndSelf);
|
|---|
| 4007 | infoPtr->iGrabbedBand = iHitBand;
|
|---|
| 4008 |
|
|---|
| 4009 | /* save off the LOWORD and HIWORD of lParam as initial x,y */
|
|---|
| 4010 | infoPtr->dragStart = MAKEPOINTS(lParam);
|
|---|
| 4011 | infoPtr->dragNow = infoPtr->dragStart;
|
|---|
| 4012 | if (infoPtr->dwStyle & CCS_VERT)
|
|---|
| 4013 | infoPtr->ihitoffset = infoPtr->dragStart.y - (lpBand->rcBand.top+REBAR_PRE_GRIPPER);
|
|---|
| 4014 | else
|
|---|
| 4015 | infoPtr->ihitoffset = infoPtr->dragStart.x - (lpBand->rcBand.left+REBAR_PRE_GRIPPER);
|
|---|
| 4016 | }
|
|---|
| 4017 | return 0;
|
|---|
| 4018 | }
|
|---|
| 4019 |
|
|---|
| 4020 | static LRESULT
|
|---|
| 4021 | REBAR_LButtonUp (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4022 | {
|
|---|
| 4023 | if (infoPtr->iGrabbedBand >= 0)
|
|---|
| 4024 | {
|
|---|
| 4025 | NMHDR layout;
|
|---|
| 4026 | RECT rect;
|
|---|
| 4027 |
|
|---|
| 4028 | infoPtr->dragStart.x = 0;
|
|---|
| 4029 | infoPtr->dragStart.y = 0;
|
|---|
| 4030 | infoPtr->dragNow = infoPtr->dragStart;
|
|---|
| 4031 |
|
|---|
| 4032 | ReleaseCapture ();
|
|---|
| 4033 |
|
|---|
| 4034 | if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) {
|
|---|
| 4035 | REBAR_Notify(&layout, infoPtr, RBN_LAYOUTCHANGED);
|
|---|
| 4036 | REBAR_Notify_NMREBAR (infoPtr, infoPtr->iGrabbedBand, RBN_ENDDRAG);
|
|---|
| 4037 | infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED;
|
|---|
| 4038 | }
|
|---|
| 4039 |
|
|---|
| 4040 | infoPtr->iGrabbedBand = -1;
|
|---|
| 4041 |
|
|---|
| 4042 | GetClientRect(infoPtr->hwndSelf, &rect);
|
|---|
| 4043 | InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
|
|---|
| 4044 | }
|
|---|
| 4045 |
|
|---|
| 4046 | return 0;
|
|---|
| 4047 | }
|
|---|
| 4048 |
|
|---|
| 4049 | static LRESULT
|
|---|
| 4050 | REBAR_MouseLeave (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4051 | {
|
|---|
| 4052 | if (infoPtr->ichevronhotBand >= 0)
|
|---|
| 4053 | {
|
|---|
| 4054 | REBAR_BAND *lpChevronBand = &infoPtr->bands[infoPtr->ichevronhotBand];
|
|---|
| 4055 | if (lpChevronBand->fDraw & DRAW_CHEVRONHOT)
|
|---|
| 4056 | {
|
|---|
| 4057 | lpChevronBand->fDraw &= ~DRAW_CHEVRONHOT;
|
|---|
| 4058 | InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
|
|---|
| 4059 | }
|
|---|
| 4060 | }
|
|---|
| 4061 | infoPtr->iOldBand = -1;
|
|---|
| 4062 | infoPtr->ichevronhotBand = -2;
|
|---|
| 4063 |
|
|---|
| 4064 | return TRUE;
|
|---|
| 4065 | }
|
|---|
| 4066 |
|
|---|
| 4067 | static LRESULT
|
|---|
| 4068 | REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4069 | {
|
|---|
| 4070 | REBAR_BAND *lpChevronBand;
|
|---|
| 4071 | POINTS ptsmove;
|
|---|
| 4072 |
|
|---|
| 4073 | ptsmove = MAKEPOINTS(lParam);
|
|---|
| 4074 |
|
|---|
| 4075 | /* if we are currently dragging a band */
|
|---|
| 4076 | if (infoPtr->iGrabbedBand >= 0)
|
|---|
| 4077 | {
|
|---|
| 4078 | REBAR_BAND *band1, *band2;
|
|---|
| 4079 |
|
|---|
| 4080 | if (GetCapture() != infoPtr->hwndSelf)
|
|---|
| 4081 | ERR("We are dragging but haven't got capture?!?\n");
|
|---|
| 4082 |
|
|---|
| 4083 | band1 = &infoPtr->bands[infoPtr->iGrabbedBand-1];
|
|---|
| 4084 | band2 = &infoPtr->bands[infoPtr->iGrabbedBand];
|
|---|
| 4085 |
|
|---|
| 4086 | /* if mouse did not move much, exit */
|
|---|
| 4087 | if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) &&
|
|---|
| 4088 | (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
|
|---|
| 4089 |
|
|---|
| 4090 | /* Test for valid drag case - must not be first band in row */
|
|---|
| 4091 | if (infoPtr->dwStyle & CCS_VERT) {
|
|---|
| 4092 | if ((ptsmove.x < band2->rcBand.left) ||
|
|---|
| 4093 | (ptsmove.x > band2->rcBand.right) ||
|
|---|
| 4094 | ((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) {
|
|---|
| 4095 | FIXME("Cannot drag to other rows yet!!\n");
|
|---|
| 4096 | }
|
|---|
| 4097 | else {
|
|---|
| 4098 | REBAR_HandleLRDrag (infoPtr, &ptsmove);
|
|---|
| 4099 | }
|
|---|
| 4100 | }
|
|---|
| 4101 | else {
|
|---|
| 4102 | if ((ptsmove.y < band2->rcBand.top) ||
|
|---|
| 4103 | (ptsmove.y > band2->rcBand.bottom) ||
|
|---|
| 4104 | ((infoPtr->iGrabbedBand > 0) && (band1->iRow != band2->iRow))) {
|
|---|
| 4105 | FIXME("Cannot drag to other rows yet!!\n");
|
|---|
| 4106 | }
|
|---|
| 4107 | else {
|
|---|
| 4108 | REBAR_HandleLRDrag (infoPtr, &ptsmove);
|
|---|
| 4109 | }
|
|---|
| 4110 | }
|
|---|
| 4111 | }
|
|---|
| 4112 | else
|
|---|
| 4113 | {
|
|---|
| 4114 | POINT ptMove;
|
|---|
| 4115 | INT iHitBand;
|
|---|
| 4116 | UINT htFlags;
|
|---|
| 4117 | TRACKMOUSEEVENT trackinfo;
|
|---|
| 4118 |
|
|---|
| 4119 | ptMove.x = (INT)ptsmove.x;
|
|---|
| 4120 | ptMove.y = (INT)ptsmove.y;
|
|---|
| 4121 | REBAR_InternalHitTest(infoPtr, &ptMove, &htFlags, &iHitBand);
|
|---|
| 4122 |
|
|---|
| 4123 | if (infoPtr->iOldBand >= 0 && infoPtr->iOldBand == infoPtr->ichevronhotBand)
|
|---|
| 4124 | {
|
|---|
| 4125 | lpChevronBand = &infoPtr->bands[infoPtr->ichevronhotBand];
|
|---|
| 4126 | if (lpChevronBand->fDraw & DRAW_CHEVRONHOT)
|
|---|
| 4127 | {
|
|---|
| 4128 | lpChevronBand->fDraw &= ~DRAW_CHEVRONHOT;
|
|---|
| 4129 | InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
|
|---|
| 4130 | }
|
|---|
| 4131 | infoPtr->ichevronhotBand = -2;
|
|---|
| 4132 | }
|
|---|
| 4133 |
|
|---|
| 4134 | if (htFlags == RBHT_CHEVRON)
|
|---|
| 4135 | {
|
|---|
| 4136 | /* fill in the TRACKMOUSEEVENT struct */
|
|---|
| 4137 | trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
|
|---|
| 4138 | trackinfo.dwFlags = TME_QUERY;
|
|---|
| 4139 | trackinfo.hwndTrack = infoPtr->hwndSelf;
|
|---|
| 4140 | trackinfo.dwHoverTime = 0;
|
|---|
| 4141 |
|
|---|
| 4142 | /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */
|
|---|
| 4143 | _TrackMouseEvent(&trackinfo);
|
|---|
| 4144 |
|
|---|
| 4145 | /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
|
|---|
| 4146 | if(!(trackinfo.dwFlags & TME_LEAVE))
|
|---|
| 4147 | {
|
|---|
| 4148 | trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
|
|---|
| 4149 |
|
|---|
| 4150 | /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
|
|---|
| 4151 | /* and can properly deactivate the hot chevron */
|
|---|
| 4152 | _TrackMouseEvent(&trackinfo);
|
|---|
| 4153 | }
|
|---|
| 4154 |
|
|---|
| 4155 | lpChevronBand = &infoPtr->bands[iHitBand];
|
|---|
| 4156 | if (!(lpChevronBand->fDraw & DRAW_CHEVRONHOT))
|
|---|
| 4157 | {
|
|---|
| 4158 | lpChevronBand->fDraw |= DRAW_CHEVRONHOT;
|
|---|
| 4159 | InvalidateRect(infoPtr->hwndSelf, &lpChevronBand->rcChevron, TRUE);
|
|---|
| 4160 | infoPtr->ichevronhotBand = iHitBand;
|
|---|
| 4161 | }
|
|---|
| 4162 | }
|
|---|
| 4163 | infoPtr->iOldBand = iHitBand;
|
|---|
| 4164 | }
|
|---|
| 4165 |
|
|---|
| 4166 | return 0;
|
|---|
| 4167 | }
|
|---|
| 4168 |
|
|---|
| 4169 |
|
|---|
| 4170 | inline static LRESULT
|
|---|
| 4171 | REBAR_NCCalcSize (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4172 | {
|
|---|
| 4173 | if (infoPtr->dwStyle & WS_BORDER) {
|
|---|
| 4174 | InflateRect((LPRECT)lParam, -GetSystemMetrics(SM_CXEDGE),
|
|---|
| 4175 | -GetSystemMetrics(SM_CYEDGE));
|
|---|
| 4176 | }
|
|---|
| 4177 | TRACE("new client=(%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 4178 | ((LPRECT)lParam)->left, ((LPRECT)lParam)->top,
|
|---|
| 4179 | ((LPRECT)lParam)->right, ((LPRECT)lParam)->bottom);
|
|---|
| 4180 | return 0;
|
|---|
| 4181 | }
|
|---|
| 4182 |
|
|---|
| 4183 |
|
|---|
| 4184 | static LRESULT
|
|---|
| 4185 | REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|---|
| 4186 | {
|
|---|
| 4187 | LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam;
|
|---|
| 4188 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
|
|---|
| 4189 | RECT wnrc1, clrc1;
|
|---|
| 4190 | NONCLIENTMETRICSA ncm;
|
|---|
| 4191 | HFONT tfont;
|
|---|
| 4192 | INT i;
|
|---|
| 4193 |
|
|---|
| 4194 | if (infoPtr != NULL) {
|
|---|
| 4195 | ERR("Strange info structure pointer *not* NULL\n");
|
|---|
| 4196 | return FALSE;
|
|---|
| 4197 | }
|
|---|
| 4198 |
|
|---|
| 4199 | if (TRACE_ON(rebar)) {
|
|---|
| 4200 | GetWindowRect(hwnd, &wnrc1);
|
|---|
| 4201 | GetClientRect(hwnd, &clrc1);
|
|---|
| 4202 | TRACE("window=(%ld,%ld)-(%ld,%ld) client=(%ld,%ld)-(%ld,%ld) cs=(%d,%d %dx%d)\n",
|
|---|
| 4203 | wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
|
|---|
| 4204 | clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
|
|---|
| 4205 | cs->x, cs->y, cs->cx, cs->cy);
|
|---|
| 4206 | }
|
|---|
| 4207 |
|
|---|
| 4208 | /* allocate memory for info structure */
|
|---|
| 4209 | infoPtr = (REBAR_INFO *)Alloc (sizeof(REBAR_INFO));
|
|---|
| 4210 | SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
|
|---|
| 4211 |
|
|---|
| 4212 | /* initialize info structure - initial values are 0 */
|
|---|
| 4213 | infoPtr->clrBk = CLR_NONE;
|
|---|
| 4214 | infoPtr->clrText = CLR_NONE;
|
|---|
| 4215 | infoPtr->clrBtnText = GetSysColor (COLOR_BTNTEXT);
|
|---|
| 4216 | infoPtr->clrBtnFace = GetSysColor (COLOR_BTNFACE);
|
|---|
| 4217 | infoPtr->iOldBand = -1;
|
|---|
| 4218 | infoPtr->ichevronhotBand = -2;
|
|---|
| 4219 | infoPtr->iGrabbedBand = -1;
|
|---|
| 4220 | infoPtr->hwndSelf = hwnd;
|
|---|
| 4221 | infoPtr->DoRedraw = TRUE;
|
|---|
| 4222 | infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROWA);
|
|---|
| 4223 | infoPtr->hcurHorz = LoadCursorA (0, (LPSTR)IDC_SIZEWEA);
|
|---|
| 4224 | infoPtr->hcurVert = LoadCursorA (0, (LPSTR)IDC_SIZENSA);
|
|---|
| 4225 | infoPtr->hcurDrag = LoadCursorA (0, (LPSTR)IDC_SIZEA);
|
|---|
| 4226 | infoPtr->bUnicode = IsWindowUnicode (hwnd);
|
|---|
| 4227 | infoPtr->fStatus = CREATE_RUNNING;
|
|---|
| 4228 | infoPtr->hFont = GetStockObject (SYSTEM_FONT);
|
|---|
| 4229 |
|
|---|
| 4230 | /* issue WM_NOTIFYFORMAT to get unicode status of parent */
|
|---|
| 4231 | i = SendMessageA(REBAR_GetNotifyParent (infoPtr),
|
|---|
| 4232 | WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
|
|---|
| 4233 | if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
|
|---|
| 4234 | ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
|
|---|
| 4235 | i);
|
|---|
| 4236 | i = NFR_ANSI;
|
|---|
| 4237 | }
|
|---|
| 4238 | infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
|
|---|
| 4239 |
|
|---|
| 4240 | /* add necessary styles to the requested styles */
|
|---|
| 4241 | infoPtr->dwStyle = cs->style | WS_VISIBLE | CCS_TOP;
|
|---|
| 4242 | SetWindowLongA (hwnd, GWL_STYLE, infoPtr->dwStyle);
|
|---|
| 4243 |
|
|---|
| 4244 | /* get font handle for Caption Font */
|
|---|
| 4245 | ncm.cbSize = sizeof(NONCLIENTMETRICSA);
|
|---|
| 4246 | SystemParametersInfoA (SPI_GETNONCLIENTMETRICS,
|
|---|
| 4247 | ncm.cbSize, &ncm, 0);
|
|---|
| 4248 | /* if the font is bold, set to normal */
|
|---|
| 4249 | if (ncm.lfCaptionFont.lfWeight > FW_NORMAL) {
|
|---|
| 4250 | ncm.lfCaptionFont.lfWeight = FW_NORMAL;
|
|---|
| 4251 | }
|
|---|
| 4252 | tfont = CreateFontIndirectA (&ncm.lfCaptionFont);
|
|---|
| 4253 | if (tfont) {
|
|---|
| 4254 | infoPtr->hFont = infoPtr->hDefaultFont = tfont;
|
|---|
| 4255 | }
|
|---|
| 4256 |
|
|---|
| 4257 | /* native does:
|
|---|
| 4258 | GetSysColor (numerous);
|
|---|
| 4259 | GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE);
|
|---|
| 4260 | *GetStockObject (SYSTEM_FONT);
|
|---|
| 4261 | *SetWindowLong (hwnd, 0, info ptr);
|
|---|
| 4262 | *WM_NOTIFYFORMAT;
|
|---|
| 4263 | *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001);
|
|---|
| 4264 | WS_VISIBLE = 0x10000000;
|
|---|
| 4265 | CCS_TOP = 0x00000001;
|
|---|
| 4266 | *SystemParametersInfo (SPI_GETNONCLIENTMETRICS...);
|
|---|
| 4267 | *CreateFontIndirect (lfCaptionFont from above);
|
|---|
| 4268 | GetDC ();
|
|---|
| 4269 | SelectObject (hdc, fontabove);
|
|---|
| 4270 | GetTextMetrics (hdc, ); guessing is tmHeight
|
|---|
| 4271 | SelectObject (hdc, oldfont);
|
|---|
| 4272 | ReleaseDC ();
|
|---|
| 4273 | GetWindowRect ();
|
|---|
| 4274 | MapWindowPoints (0, parent, rectabove, 2);
|
|---|
| 4275 | GetWindowRect ();
|
|---|
| 4276 | GetClientRect ();
|
|---|
| 4277 | ClientToScreen (clientrect);
|
|---|
| 4278 | SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER);
|
|---|
| 4279 | */
|
|---|
| 4280 | return TRUE;
|
|---|
| 4281 | }
|
|---|
| 4282 |
|
|---|
| 4283 |
|
|---|
| 4284 | static LRESULT
|
|---|
| 4285 | REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4286 | {
|
|---|
| 4287 | NMMOUSE nmmouse;
|
|---|
| 4288 | POINTS shortpt;
|
|---|
| 4289 | POINT clpt, pt;
|
|---|
| 4290 | INT i;
|
|---|
| 4291 | UINT scrap;
|
|---|
| 4292 | LRESULT ret = HTCLIENT;
|
|---|
| 4293 |
|
|---|
| 4294 | /*
|
|---|
| 4295 | * Differences from doc at MSDN (as observed with version 4.71 of
|
|---|
| 4296 | * comctl32.dll
|
|---|
| 4297 | * 1. doc says nmmouse.pt is in screen coord, trace shows client coord.
|
|---|
| 4298 | * 2. if band is not identified .dwItemSpec is 0xffffffff.
|
|---|
| 4299 | * 3. native always seems to return HTCLIENT if notify return is 0.
|
|---|
| 4300 | */
|
|---|
| 4301 |
|
|---|
| 4302 | shortpt = MAKEPOINTS (lParam);
|
|---|
| 4303 | POINTSTOPOINT(pt, shortpt);
|
|---|
| 4304 | clpt = pt;
|
|---|
| 4305 | ScreenToClient (infoPtr->hwndSelf, &clpt);
|
|---|
| 4306 | REBAR_InternalHitTest (infoPtr, &clpt, &scrap,
|
|---|
| 4307 | (INT *)&nmmouse.dwItemSpec);
|
|---|
| 4308 | nmmouse.dwItemData = 0;
|
|---|
| 4309 | nmmouse.pt = clpt;
|
|---|
| 4310 | nmmouse.dwHitInfo = 0;
|
|---|
| 4311 | if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) {
|
|---|
| 4312 | TRACE("notify changed return value from %ld to %d\n",
|
|---|
| 4313 | ret, i);
|
|---|
| 4314 | ret = (LRESULT) i;
|
|---|
| 4315 | }
|
|---|
| 4316 | TRACE("returning %ld, client point (%ld,%ld)\n", ret, clpt.x, clpt.y);
|
|---|
| 4317 | return ret;
|
|---|
| 4318 | }
|
|---|
| 4319 |
|
|---|
| 4320 |
|
|---|
| 4321 | static LRESULT
|
|---|
| 4322 | REBAR_NCPaint (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4323 | {
|
|---|
| 4324 | RECT rcWindow;
|
|---|
| 4325 | HDC hdc;
|
|---|
| 4326 |
|
|---|
| 4327 | if (infoPtr->dwStyle & WS_MINIMIZE)
|
|---|
| 4328 | return 0; /* Nothing to do */
|
|---|
| 4329 |
|
|---|
| 4330 | if (infoPtr->dwStyle & WS_BORDER) {
|
|---|
| 4331 |
|
|---|
| 4332 | /* adjust rectangle and draw the necessary edge */
|
|---|
| 4333 | if (!(hdc = GetDCEx( infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW )))
|
|---|
| 4334 | return 0;
|
|---|
| 4335 | GetWindowRect (infoPtr->hwndSelf, &rcWindow);
|
|---|
| 4336 | OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
|
|---|
| 4337 | TRACE("rect (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 4338 | rcWindow.left, rcWindow.top,
|
|---|
| 4339 | rcWindow.right, rcWindow.bottom);
|
|---|
| 4340 | DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT);
|
|---|
| 4341 | ReleaseDC( infoPtr->hwndSelf, hdc );
|
|---|
| 4342 | }
|
|---|
| 4343 |
|
|---|
| 4344 | return 0;
|
|---|
| 4345 | }
|
|---|
| 4346 |
|
|---|
| 4347 |
|
|---|
| 4348 | static LRESULT
|
|---|
| 4349 | REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4350 | {
|
|---|
| 4351 | INT i;
|
|---|
| 4352 |
|
|---|
| 4353 | if (lParam == NF_REQUERY) {
|
|---|
| 4354 | i = SendMessageA(REBAR_GetNotifyParent (infoPtr),
|
|---|
| 4355 | WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
|
|---|
| 4356 | if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
|
|---|
| 4357 | ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
|
|---|
| 4358 | i);
|
|---|
| 4359 | i = NFR_ANSI;
|
|---|
| 4360 | }
|
|---|
| 4361 | infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
|
|---|
| 4362 | return (LRESULT)i;
|
|---|
| 4363 | }
|
|---|
| 4364 | return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI);
|
|---|
| 4365 | }
|
|---|
| 4366 |
|
|---|
| 4367 |
|
|---|
| 4368 | static LRESULT
|
|---|
| 4369 | REBAR_Paint (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4370 | {
|
|---|
| 4371 | HDC hdc;
|
|---|
| 4372 | PAINTSTRUCT ps;
|
|---|
| 4373 | RECT rc;
|
|---|
| 4374 |
|
|---|
| 4375 | GetClientRect(infoPtr->hwndSelf, &rc);
|
|---|
| 4376 | hdc = wParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : (HDC)wParam;
|
|---|
| 4377 |
|
|---|
| 4378 | TRACE("painting (%ld,%ld)-(%ld,%ld) client (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 4379 | ps.rcPaint.left, ps.rcPaint.top,
|
|---|
| 4380 | ps.rcPaint.right, ps.rcPaint.bottom,
|
|---|
| 4381 | rc.left, rc.top, rc.right, rc.bottom);
|
|---|
| 4382 |
|
|---|
| 4383 | if (ps.fErase) {
|
|---|
| 4384 | /* Erase area of paint if requested */
|
|---|
| 4385 | REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint);
|
|---|
| 4386 | }
|
|---|
| 4387 |
|
|---|
| 4388 | REBAR_Refresh (infoPtr, hdc);
|
|---|
| 4389 | if (!wParam)
|
|---|
| 4390 | EndPaint (infoPtr->hwndSelf, &ps);
|
|---|
| 4391 | return 0;
|
|---|
| 4392 | }
|
|---|
| 4393 |
|
|---|
| 4394 |
|
|---|
| 4395 | static LRESULT
|
|---|
| 4396 | REBAR_SetCursor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4397 | {
|
|---|
| 4398 | POINT pt;
|
|---|
| 4399 | UINT flags;
|
|---|
| 4400 |
|
|---|
| 4401 | TRACE("code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
|
|---|
| 4402 |
|
|---|
| 4403 | GetCursorPos (&pt);
|
|---|
| 4404 | ScreenToClient (infoPtr->hwndSelf, &pt);
|
|---|
| 4405 |
|
|---|
| 4406 | REBAR_InternalHitTest (infoPtr, &pt, &flags, NULL);
|
|---|
| 4407 |
|
|---|
| 4408 | if (flags == RBHT_GRABBER) {
|
|---|
| 4409 | if ((infoPtr->dwStyle & CCS_VERT) &&
|
|---|
| 4410 | !(infoPtr->dwStyle & RBS_VERTICALGRIPPER))
|
|---|
| 4411 | SetCursor (infoPtr->hcurVert);
|
|---|
| 4412 | else
|
|---|
| 4413 | SetCursor (infoPtr->hcurHorz);
|
|---|
| 4414 | }
|
|---|
| 4415 | else if (flags != RBHT_CLIENT)
|
|---|
| 4416 | SetCursor (infoPtr->hcurArrow);
|
|---|
| 4417 |
|
|---|
| 4418 | return 0;
|
|---|
| 4419 | }
|
|---|
| 4420 |
|
|---|
| 4421 |
|
|---|
| 4422 | static LRESULT
|
|---|
| 4423 | REBAR_SetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4424 | {
|
|---|
| 4425 | RECT rcClient;
|
|---|
| 4426 | REBAR_BAND *lpBand;
|
|---|
| 4427 | UINT i;
|
|---|
| 4428 |
|
|---|
| 4429 | infoPtr->hFont = (HFONT)wParam;
|
|---|
| 4430 |
|
|---|
| 4431 | /* revalidate all bands to change sizes of text in headers of bands */
|
|---|
| 4432 | for (i=0; i<infoPtr->uNumBands; i++) {
|
|---|
| 4433 | lpBand = &infoPtr->bands[i];
|
|---|
| 4434 | REBAR_ValidateBand (infoPtr, lpBand);
|
|---|
| 4435 | }
|
|---|
| 4436 |
|
|---|
| 4437 |
|
|---|
| 4438 | if (LOWORD(lParam)) {
|
|---|
| 4439 | GetClientRect (infoPtr->hwndSelf, &rcClient);
|
|---|
| 4440 | REBAR_Layout (infoPtr, &rcClient, FALSE, TRUE);
|
|---|
| 4441 | }
|
|---|
| 4442 |
|
|---|
| 4443 | return 0;
|
|---|
| 4444 | }
|
|---|
| 4445 |
|
|---|
| 4446 |
|
|---|
| 4447 | inline static LRESULT
|
|---|
| 4448 | REBAR_SetRedraw (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4449 | /*****************************************************
|
|---|
| 4450 | *
|
|---|
| 4451 | * Function;
|
|---|
| 4452 | * Handles the WM_SETREDRAW message.
|
|---|
| 4453 | *
|
|---|
| 4454 | * Documentation:
|
|---|
| 4455 | * According to testing V4.71 of COMCTL32 returns the
|
|---|
| 4456 | * *previous* status of the redraw flag (either 0 or -1)
|
|---|
| 4457 | * instead of the MSDN documented value of 0 if handled
|
|---|
| 4458 | *
|
|---|
| 4459 | *****************************************************/
|
|---|
| 4460 | {
|
|---|
| 4461 | BOOL oldredraw = infoPtr->DoRedraw;
|
|---|
| 4462 |
|
|---|
| 4463 | TRACE("set to %s, fStatus=%08x\n",
|
|---|
| 4464 | (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus);
|
|---|
| 4465 | infoPtr->DoRedraw = (BOOL) wParam;
|
|---|
| 4466 | if (wParam) {
|
|---|
| 4467 | if (infoPtr->fStatus & BAND_NEEDS_REDRAW) {
|
|---|
| 4468 | REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands);
|
|---|
| 4469 | REBAR_ForceResize (infoPtr);
|
|---|
| 4470 | InvalidateRect (infoPtr->hwndSelf, 0, TRUE);
|
|---|
| 4471 | }
|
|---|
| 4472 | infoPtr->fStatus &= ~BAND_NEEDS_REDRAW;
|
|---|
| 4473 | }
|
|---|
| 4474 | return (oldredraw) ? -1 : 0;
|
|---|
| 4475 | }
|
|---|
| 4476 |
|
|---|
| 4477 |
|
|---|
| 4478 | static LRESULT
|
|---|
| 4479 | REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4480 | {
|
|---|
| 4481 | RECT rcClient;
|
|---|
| 4482 |
|
|---|
| 4483 | /* auto resize deadlock check */
|
|---|
| 4484 | if (infoPtr->fStatus & AUTO_RESIZE) {
|
|---|
| 4485 | infoPtr->fStatus &= ~AUTO_RESIZE;
|
|---|
| 4486 | TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",
|
|---|
| 4487 | infoPtr->fStatus, lParam);
|
|---|
| 4488 | return 0;
|
|---|
| 4489 | }
|
|---|
| 4490 |
|
|---|
| 4491 | if (infoPtr->fStatus & CREATE_RUNNING) {
|
|---|
| 4492 | /* still in CreateWindow */
|
|---|
| 4493 | RECT rcWin;
|
|---|
| 4494 |
|
|---|
| 4495 | if ((INT)wParam != SIZE_RESTORED) {
|
|---|
| 4496 | ERR("WM_SIZE in create and flags=%08x, lParam=%08lx\n",
|
|---|
| 4497 | wParam, lParam);
|
|---|
| 4498 | }
|
|---|
| 4499 |
|
|---|
| 4500 | TRACE("still in CreateWindow\n");
|
|---|
| 4501 | infoPtr->fStatus &= ~CREATE_RUNNING;
|
|---|
| 4502 | GetWindowRect ( infoPtr->hwndSelf, &rcWin);
|
|---|
| 4503 | TRACE("win rect (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 4504 | rcWin.left, rcWin.top, rcWin.right, rcWin.bottom);
|
|---|
| 4505 |
|
|---|
| 4506 | if ((lParam == 0) && (rcWin.right-rcWin.left == 0) &&
|
|---|
| 4507 | (rcWin.bottom-rcWin.top == 0)) {
|
|---|
| 4508 | /* native control seems to do this */
|
|---|
| 4509 | GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient);
|
|---|
| 4510 | TRACE("sizing rebar, message and client zero, parent client (%ld,%ld)\n",
|
|---|
| 4511 | rcClient.right, rcClient.bottom);
|
|---|
| 4512 | }
|
|---|
| 4513 | else {
|
|---|
| 4514 | INT cx, cy;
|
|---|
| 4515 |
|
|---|
| 4516 | cx = rcWin.right - rcWin.left;
|
|---|
| 4517 | cy = rcWin.bottom - rcWin.top;
|
|---|
| 4518 | if ((cx == LOWORD(lParam)) && (cy == HIWORD(lParam))) {
|
|---|
| 4519 | return 0;
|
|---|
| 4520 | }
|
|---|
| 4521 |
|
|---|
| 4522 | /* do the actual WM_SIZE request */
|
|---|
| 4523 | GetClientRect (infoPtr->hwndSelf, &rcClient);
|
|---|
| 4524 | TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%ld,%ld)\n",
|
|---|
| 4525 | infoPtr->calcSize.cx, infoPtr->calcSize.cy,
|
|---|
| 4526 | LOWORD(lParam), HIWORD(lParam),
|
|---|
| 4527 | rcClient.right, rcClient.bottom);
|
|---|
| 4528 | }
|
|---|
| 4529 | }
|
|---|
| 4530 | else {
|
|---|
| 4531 | if ((INT)wParam != SIZE_RESTORED) {
|
|---|
| 4532 | ERR("WM_SIZE out of create and flags=%08x, lParam=%08lx\n",
|
|---|
| 4533 | wParam, lParam);
|
|---|
| 4534 | }
|
|---|
| 4535 |
|
|---|
| 4536 | /* Handle cases when outside of the CreateWindow process */
|
|---|
| 4537 |
|
|---|
| 4538 | GetClientRect (infoPtr->hwndSelf, &rcClient);
|
|---|
| 4539 | if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) &&
|
|---|
| 4540 | (infoPtr->dwStyle & RBS_AUTOSIZE)) {
|
|---|
| 4541 | /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */
|
|---|
| 4542 | /* native seems to use the current client rect for the size */
|
|---|
| 4543 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 4544 | TRACE("sizing rebar to client (%ld,%ld) size is zero but AUTOSIZE set\n",
|
|---|
| 4545 | rcClient.right, rcClient.bottom);
|
|---|
| 4546 | }
|
|---|
| 4547 | else {
|
|---|
| 4548 | #ifdef __WIN32OS2__
|
|---|
| 4549 | INT width, x, y, height;
|
|---|
| 4550 | RECT parent_rect, rcWin;
|
|---|
| 4551 |
|
|---|
| 4552 | if (!(infoPtr->dwStyle & CCS_NOPARENTALIGN) &&
|
|---|
| 4553 | (HIWORD(lParam) != (rcClient.bottom - rcClient.top) ||
|
|---|
| 4554 | LOWORD(lParam) != (rcClient.right - rcClient.left)))
|
|---|
| 4555 | {
|
|---|
| 4556 | /* Need to resize width to match parent */
|
|---|
| 4557 | GetWindowRect ( infoPtr->hwndSelf, &rcWin);
|
|---|
| 4558 | height = (rcWin.bottom - rcWin.top);
|
|---|
| 4559 |
|
|---|
| 4560 | /* width and height don't apply */
|
|---|
| 4561 | GetClientRect (GetParent(infoPtr->hwndSelf), &parent_rect);
|
|---|
| 4562 | width = parent_rect.right - parent_rect.left;
|
|---|
| 4563 |
|
|---|
| 4564 | TRACE("Rebar: resize to match parent");
|
|---|
| 4565 | REBAR_ForceResize2(infoPtr, width, height);
|
|---|
| 4566 | return 0;
|
|---|
| 4567 | }
|
|---|
| 4568 | #endif
|
|---|
| 4569 | TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%ld,%ld)\n",
|
|---|
| 4570 | infoPtr->calcSize.cx, infoPtr->calcSize.cy,
|
|---|
| 4571 | LOWORD(lParam), HIWORD(lParam),
|
|---|
| 4572 | rcClient.right, rcClient.bottom);
|
|---|
| 4573 | }
|
|---|
| 4574 | }
|
|---|
| 4575 |
|
|---|
| 4576 | if (infoPtr->dwStyle & RBS_AUTOSIZE) {
|
|---|
| 4577 | NMRBAUTOSIZE autosize;
|
|---|
| 4578 |
|
|---|
| 4579 | GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget);
|
|---|
| 4580 | autosize.fChanged = 0; /* ??? */
|
|---|
| 4581 | autosize.rcActual = autosize.rcTarget; /* ??? */
|
|---|
| 4582 | REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE);
|
|---|
| 4583 | TRACE("RBN_AUTOSIZE client=(%ld,%ld), lp=%08lx\n",
|
|---|
| 4584 | autosize.rcTarget.right, autosize.rcTarget.bottom, lParam);
|
|---|
| 4585 | }
|
|---|
| 4586 |
|
|---|
| 4587 | if ((infoPtr->calcSize.cx != rcClient.right) ||
|
|---|
| 4588 | (infoPtr->calcSize.cy != rcClient.bottom))
|
|---|
| 4589 | infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
|
|---|
| 4590 |
|
|---|
| 4591 | REBAR_Layout (infoPtr, &rcClient, TRUE, TRUE);
|
|---|
| 4592 | infoPtr->fStatus &= ~AUTO_RESIZE;
|
|---|
| 4593 |
|
|---|
| 4594 | return 0;
|
|---|
| 4595 | }
|
|---|
| 4596 |
|
|---|
| 4597 |
|
|---|
| 4598 | static LRESULT
|
|---|
| 4599 | REBAR_StyleChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4600 | {
|
|---|
| 4601 | STYLESTRUCT *ss = (STYLESTRUCT *)lParam;
|
|---|
| 4602 |
|
|---|
| 4603 | TRACE("current style=%08lx, styleOld=%08lx, style being set to=%08lx\n",
|
|---|
| 4604 | infoPtr->dwStyle, ss->styleOld, ss->styleNew);
|
|---|
| 4605 | infoPtr->dwStyle = ss->styleNew;
|
|---|
| 4606 |
|
|---|
| 4607 | return FALSE;
|
|---|
| 4608 | }
|
|---|
| 4609 |
|
|---|
| 4610 |
|
|---|
| 4611 | static LRESULT
|
|---|
| 4612 | REBAR_WindowPosChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
|---|
| 4613 | {
|
|---|
| 4614 | WINDOWPOS *lpwp = (WINDOWPOS *)lParam;
|
|---|
| 4615 | LRESULT ret;
|
|---|
| 4616 | RECT rc;
|
|---|
| 4617 |
|
|---|
| 4618 | /* Save the new origin of this window - used by _ForceResize */
|
|---|
| 4619 | infoPtr->origin.x = lpwp->x;
|
|---|
| 4620 | infoPtr->origin.y = lpwp->y;
|
|---|
| 4621 | ret = DefWindowProcA(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED,
|
|---|
| 4622 | wParam, lParam);
|
|---|
| 4623 | GetWindowRect(infoPtr->hwndSelf, &rc);
|
|---|
| 4624 | TRACE("hwnd %p new pos (%ld,%ld)-(%ld,%ld)\n",
|
|---|
| 4625 | infoPtr->hwndSelf, rc.left, rc.top, rc.right, rc.bottom);
|
|---|
| 4626 | return ret;
|
|---|
| 4627 | }
|
|---|
| 4628 |
|
|---|
| 4629 | #ifdef __WIN32OS2__
|
|---|
| 4630 | #ifdef DEBUG
|
|---|
| 4631 | static void dprintfMsg(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|---|
| 4632 | {
|
|---|
| 4633 | char *msg = NULL;
|
|---|
| 4634 |
|
|---|
| 4635 | switch (uMsg)
|
|---|
| 4636 | {
|
|---|
| 4637 | case RB_DELETEBAND:
|
|---|
| 4638 | msg = "RB_DELETEBAND";
|
|---|
| 4639 | break;
|
|---|
| 4640 | case RB_GETBANDBORDERS:
|
|---|
| 4641 | msg = "RB_GETBANDBORDERS";
|
|---|
| 4642 | break;
|
|---|
| 4643 | case RB_GETBANDCOUNT:
|
|---|
| 4644 | msg = "RB_GETBANDCOUNT";
|
|---|
| 4645 | break;
|
|---|
| 4646 | case RB_GETBANDINFO_OLD:
|
|---|
| 4647 | msg = "RB_GETBANDINFO_OLD";
|
|---|
| 4648 | break;
|
|---|
| 4649 | case RB_GETBANDINFOA:
|
|---|
| 4650 | msg = "RB_GETBANDINFOA";
|
|---|
| 4651 | break;
|
|---|
| 4652 | case RB_GETBANDINFOW:
|
|---|
| 4653 | msg = "RB_GETBANDINFOW";
|
|---|
| 4654 | break;
|
|---|
| 4655 | case RB_GETBARHEIGHT:
|
|---|
| 4656 | msg = "RB_GETBARHEIGHT";
|
|---|
| 4657 | break;
|
|---|
| 4658 | case RB_GETBARINFO:
|
|---|
| 4659 | msg = "RB_GETBARINFO";
|
|---|
| 4660 | break;
|
|---|
| 4661 | case RB_GETBKCOLOR:
|
|---|
| 4662 | msg = "RB_GETBKCOLOR";
|
|---|
| 4663 | break;
|
|---|
| 4664 | case RB_GETPALETTE:
|
|---|
| 4665 | msg = "RB_GETPALETTE";
|
|---|
| 4666 | break;
|
|---|
| 4667 | case RB_GETRECT:
|
|---|
| 4668 | msg = "RB_GETRECT";
|
|---|
| 4669 | break;
|
|---|
| 4670 | case RB_GETROWCOUNT:
|
|---|
| 4671 | msg = "RB_GETROWCOUNT";
|
|---|
| 4672 | break;
|
|---|
| 4673 | case RB_GETROWHEIGHT:
|
|---|
| 4674 | msg = "RB_GETROWHEIGHT";
|
|---|
| 4675 | break;
|
|---|
| 4676 | case RB_GETTEXTCOLOR:
|
|---|
| 4677 | msg = "RB_GETTEXTCOLOR";
|
|---|
| 4678 | break;
|
|---|
| 4679 | case RB_GETTOOLTIPS:
|
|---|
| 4680 | msg = "RB_GETTOOLTIPS";
|
|---|
| 4681 | break;
|
|---|
| 4682 | case RB_GETUNICODEFORMAT:
|
|---|
| 4683 | msg = "RB_GETUNICODEFORMAT";
|
|---|
| 4684 | break;
|
|---|
| 4685 | case CCM_GETVERSION:
|
|---|
| 4686 | msg = "CCM_GETVERSION";
|
|---|
| 4687 | break;
|
|---|
| 4688 | case RB_HITTEST:
|
|---|
| 4689 | msg = "RB_HITTEST";
|
|---|
| 4690 | break;
|
|---|
| 4691 | case RB_IDTOINDEX:
|
|---|
| 4692 | msg = "RB_IDTOINDEX";
|
|---|
| 4693 | break;
|
|---|
| 4694 | case RB_INSERTBANDA:
|
|---|
| 4695 | msg = "RB_INSERTBANDA";
|
|---|
| 4696 | break;
|
|---|
| 4697 | case RB_INSERTBANDW:
|
|---|
| 4698 | msg = "RB_INSERTBANDW";
|
|---|
| 4699 | break;
|
|---|
| 4700 | case RB_MAXIMIZEBAND:
|
|---|
| 4701 | msg = "RB_MAXIMIZEBAND";
|
|---|
| 4702 | break;
|
|---|
| 4703 | case RB_MINIMIZEBAND:
|
|---|
| 4704 | msg = "RB_MINIMIZEBAND";
|
|---|
| 4705 | break;
|
|---|
| 4706 | case RB_MOVEBAND:
|
|---|
| 4707 | msg = "RB_MOVEBAND";
|
|---|
| 4708 | break;
|
|---|
| 4709 | case RB_PUSHCHEVRON:
|
|---|
| 4710 | msg = "RB_PUSHCHEVRON";
|
|---|
| 4711 | break;
|
|---|
| 4712 | case RB_SETBANDINFOA:
|
|---|
| 4713 | msg = "RB_SETBANDINFOA";
|
|---|
| 4714 | break;
|
|---|
| 4715 | case RB_SETBANDINFOW:
|
|---|
| 4716 | msg = "RB_SETBANDINFOW";
|
|---|
| 4717 | break;
|
|---|
| 4718 | case RB_SETBARINFO:
|
|---|
| 4719 | msg = "RB_SETBARINFO";
|
|---|
| 4720 | break;
|
|---|
| 4721 | case RB_SETBKCOLOR:
|
|---|
| 4722 | msg = "RB_SETBKCOLOR";
|
|---|
| 4723 | break;
|
|---|
| 4724 | case RB_SETPARENT:
|
|---|
| 4725 | msg = "RB_SETPARENT";
|
|---|
| 4726 | break;
|
|---|
| 4727 | case RB_SETTEXTCOLOR:
|
|---|
| 4728 | msg = "RB_SETTEXTCOLOR";
|
|---|
| 4729 | break;
|
|---|
| 4730 | case RB_SETUNICODEFORMAT:
|
|---|
| 4731 | msg = "RB_SETUNICODEFORMAT";
|
|---|
| 4732 | break;
|
|---|
| 4733 | case CCM_SETVERSION:
|
|---|
| 4734 | msg = "CCM_SETVERSION";
|
|---|
| 4735 | break;
|
|---|
| 4736 | case RB_SHOWBAND:
|
|---|
| 4737 | msg = "RB_SHOWBAND";
|
|---|
| 4738 | break;
|
|---|
| 4739 | case RB_SIZETORECT:
|
|---|
| 4740 | msg = "RB_SIZETORECT";
|
|---|
| 4741 | break;
|
|---|
| 4742 | /* case RB_BEGINDRAG: */
|
|---|
| 4743 | /* case RB_DRAGMOVE: */
|
|---|
| 4744 | /* case RB_ENDDRAG: */
|
|---|
| 4745 | /* case RB_GETCOLORSCHEME: */
|
|---|
| 4746 | /* case RB_GETDROPTARGET: */
|
|---|
| 4747 | /* case RB_SETCOLORSCHEME: */
|
|---|
| 4748 | /* case RB_SETPALETTE: */
|
|---|
| 4749 | /* return REBAR_GetPalette (infoPtr, wParam, lParam); */
|
|---|
| 4750 | /* case RB_SETTOOLTIPS: */
|
|---|
| 4751 |
|
|---|
| 4752 | default:
|
|---|
| 4753 | return;
|
|---|
| 4754 | }
|
|---|
| 4755 | dprintf(("Rebar %x %s %x %x", hwnd, msg, wParam, lParam));
|
|---|
| 4756 | }
|
|---|
| 4757 | #endif
|
|---|
| 4758 | #endif //__WIN32OS2__
|
|---|
| 4759 |
|
|---|
| 4760 | static LRESULT WINAPI
|
|---|
| 4761 | REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|---|
| 4762 | {
|
|---|
| 4763 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
|
|---|
| 4764 |
|
|---|
| 4765 | #if defined(DEBUG) && defined(__WIN32OS2__)
|
|---|
| 4766 | dprintfMsg(hwnd, uMsg, wParam, lParam);
|
|---|
| 4767 | #else
|
|---|
| 4768 | TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
|
|---|
| 4769 | hwnd, uMsg, wParam, lParam);
|
|---|
| 4770 | #endif
|
|---|
| 4771 | if (!infoPtr && (uMsg != WM_NCCREATE))
|
|---|
| 4772 | return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
|---|
| 4773 | switch (uMsg)
|
|---|
| 4774 | {
|
|---|
| 4775 | /* case RB_BEGINDRAG: */
|
|---|
| 4776 |
|
|---|
| 4777 | case RB_DELETEBAND:
|
|---|
| 4778 | return REBAR_DeleteBand (infoPtr, wParam, lParam);
|
|---|
| 4779 |
|
|---|
| 4780 | /* case RB_DRAGMOVE: */
|
|---|
| 4781 | /* case RB_ENDDRAG: */
|
|---|
| 4782 |
|
|---|
| 4783 | case RB_GETBANDBORDERS:
|
|---|
| 4784 | return REBAR_GetBandBorders (infoPtr, wParam, lParam);
|
|---|
| 4785 |
|
|---|
| 4786 | case RB_GETBANDCOUNT:
|
|---|
| 4787 | return REBAR_GetBandCount (infoPtr);
|
|---|
| 4788 |
|
|---|
| 4789 | case RB_GETBANDINFO_OLD:
|
|---|
| 4790 | case RB_GETBANDINFOA:
|
|---|
| 4791 | return REBAR_GetBandInfoA (infoPtr, wParam, lParam);
|
|---|
| 4792 |
|
|---|
| 4793 | case RB_GETBANDINFOW:
|
|---|
| 4794 | return REBAR_GetBandInfoW (infoPtr, wParam, lParam);
|
|---|
| 4795 |
|
|---|
| 4796 | case RB_GETBARHEIGHT:
|
|---|
| 4797 | return REBAR_GetBarHeight (infoPtr, wParam, lParam);
|
|---|
| 4798 |
|
|---|
| 4799 | case RB_GETBARINFO:
|
|---|
| 4800 | return REBAR_GetBarInfo (infoPtr, wParam, lParam);
|
|---|
| 4801 |
|
|---|
| 4802 | case RB_GETBKCOLOR:
|
|---|
| 4803 | return REBAR_GetBkColor (infoPtr);
|
|---|
| 4804 |
|
|---|
| 4805 | /* case RB_GETCOLORSCHEME: */
|
|---|
| 4806 | /* case RB_GETDROPTARGET: */
|
|---|
| 4807 |
|
|---|
| 4808 | case RB_GETPALETTE:
|
|---|
| 4809 | return REBAR_GetPalette (infoPtr, wParam, lParam);
|
|---|
| 4810 |
|
|---|
| 4811 | case RB_GETRECT:
|
|---|
| 4812 | return REBAR_GetRect (infoPtr, wParam, lParam);
|
|---|
| 4813 |
|
|---|
| 4814 | case RB_GETROWCOUNT:
|
|---|
| 4815 | return REBAR_GetRowCount (infoPtr);
|
|---|
| 4816 |
|
|---|
| 4817 | case RB_GETROWHEIGHT:
|
|---|
| 4818 | return REBAR_GetRowHeight (infoPtr, wParam, lParam);
|
|---|
| 4819 |
|
|---|
| 4820 | case RB_GETTEXTCOLOR:
|
|---|
| 4821 | return REBAR_GetTextColor (infoPtr);
|
|---|
| 4822 |
|
|---|
| 4823 | case RB_GETTOOLTIPS:
|
|---|
| 4824 | return REBAR_GetToolTips (infoPtr);
|
|---|
| 4825 |
|
|---|
| 4826 | case RB_GETUNICODEFORMAT:
|
|---|
| 4827 | return REBAR_GetUnicodeFormat (infoPtr);
|
|---|
| 4828 |
|
|---|
| 4829 | case CCM_GETVERSION:
|
|---|
| 4830 | return REBAR_GetVersion (infoPtr);
|
|---|
| 4831 |
|
|---|
| 4832 | case RB_HITTEST:
|
|---|
| 4833 | return REBAR_HitTest (infoPtr, wParam, lParam);
|
|---|
| 4834 |
|
|---|
| 4835 | case RB_IDTOINDEX:
|
|---|
| 4836 | return REBAR_IdToIndex (infoPtr, wParam, lParam);
|
|---|
| 4837 |
|
|---|
| 4838 | case RB_INSERTBANDA:
|
|---|
| 4839 | return REBAR_InsertBandA (infoPtr, wParam, lParam);
|
|---|
| 4840 |
|
|---|
| 4841 | case RB_INSERTBANDW:
|
|---|
| 4842 | return REBAR_InsertBandW (infoPtr, wParam, lParam);
|
|---|
| 4843 |
|
|---|
| 4844 | case RB_MAXIMIZEBAND:
|
|---|
| 4845 | return REBAR_MaximizeBand (infoPtr, wParam, lParam);
|
|---|
| 4846 |
|
|---|
| 4847 | case RB_MINIMIZEBAND:
|
|---|
| 4848 | return REBAR_MinimizeBand (infoPtr, wParam, lParam);
|
|---|
| 4849 |
|
|---|
| 4850 | case RB_MOVEBAND:
|
|---|
| 4851 | return REBAR_MoveBand (infoPtr, wParam, lParam);
|
|---|
| 4852 |
|
|---|
| 4853 | case RB_PUSHCHEVRON:
|
|---|
| 4854 | return REBAR_PushChevron (infoPtr, wParam, lParam);
|
|---|
| 4855 |
|
|---|
| 4856 | case RB_SETBANDINFOA:
|
|---|
| 4857 | return REBAR_SetBandInfoA (infoPtr, wParam, lParam);
|
|---|
| 4858 |
|
|---|
| 4859 | case RB_SETBANDINFOW:
|
|---|
| 4860 | return REBAR_SetBandInfoW (infoPtr, wParam, lParam);
|
|---|
| 4861 |
|
|---|
| 4862 | case RB_SETBARINFO:
|
|---|
| 4863 | return REBAR_SetBarInfo (infoPtr, wParam, lParam);
|
|---|
| 4864 |
|
|---|
| 4865 | case RB_SETBKCOLOR:
|
|---|
| 4866 | return REBAR_SetBkColor (infoPtr, wParam, lParam);
|
|---|
| 4867 |
|
|---|
| 4868 | /* case RB_SETCOLORSCHEME: */
|
|---|
| 4869 | /* case RB_SETPALETTE: */
|
|---|
| 4870 | /* return REBAR_GetPalette (infoPtr, wParam, lParam); */
|
|---|
| 4871 |
|
|---|
| 4872 | case RB_SETPARENT:
|
|---|
| 4873 | return REBAR_SetParent (infoPtr, wParam, lParam);
|
|---|
| 4874 |
|
|---|
| 4875 | case RB_SETTEXTCOLOR:
|
|---|
| 4876 | return REBAR_SetTextColor (infoPtr, wParam, lParam);
|
|---|
| 4877 |
|
|---|
| 4878 | /* case RB_SETTOOLTIPS: */
|
|---|
| 4879 |
|
|---|
| 4880 | case RB_SETUNICODEFORMAT:
|
|---|
| 4881 | return REBAR_SetUnicodeFormat (infoPtr, wParam);
|
|---|
| 4882 |
|
|---|
| 4883 | case CCM_SETVERSION:
|
|---|
| 4884 | return REBAR_SetVersion (infoPtr, (INT)wParam);
|
|---|
| 4885 |
|
|---|
| 4886 | case RB_SHOWBAND:
|
|---|
| 4887 | return REBAR_ShowBand (infoPtr, wParam, lParam);
|
|---|
| 4888 |
|
|---|
| 4889 | case RB_SIZETORECT:
|
|---|
| 4890 | return REBAR_SizeToRect (infoPtr, wParam, lParam);
|
|---|
| 4891 |
|
|---|
| 4892 |
|
|---|
| 4893 | /* Messages passed to parent */
|
|---|
| 4894 | case WM_COMMAND:
|
|---|
| 4895 | case WM_DRAWITEM:
|
|---|
| 4896 | case WM_NOTIFY:
|
|---|
| 4897 | if (infoPtr->NtfUnicode)
|
|---|
| 4898 | return SendMessageW (REBAR_GetNotifyParent (infoPtr),
|
|---|
| 4899 | uMsg, wParam, lParam);
|
|---|
| 4900 | else
|
|---|
| 4901 | return SendMessageA (REBAR_GetNotifyParent (infoPtr),
|
|---|
| 4902 | uMsg, wParam, lParam);
|
|---|
| 4903 |
|
|---|
| 4904 |
|
|---|
| 4905 | /* case WM_CHARTOITEM: supported according to ControlSpy */
|
|---|
| 4906 |
|
|---|
| 4907 | case WM_CREATE:
|
|---|
| 4908 | return REBAR_Create (infoPtr, wParam, lParam);
|
|---|
| 4909 |
|
|---|
| 4910 | case WM_DESTROY:
|
|---|
| 4911 | return REBAR_Destroy (infoPtr, wParam, lParam);
|
|---|
| 4912 |
|
|---|
| 4913 | case WM_ERASEBKGND:
|
|---|
| 4914 | return REBAR_EraseBkGnd (infoPtr, wParam, lParam);
|
|---|
| 4915 |
|
|---|
| 4916 | case WM_GETFONT:
|
|---|
| 4917 | return REBAR_GetFont (infoPtr, wParam, lParam);
|
|---|
| 4918 |
|
|---|
| 4919 | /* case WM_LBUTTONDBLCLK: supported according to ControlSpy */
|
|---|
| 4920 |
|
|---|
| 4921 | case WM_LBUTTONDOWN:
|
|---|
| 4922 | return REBAR_LButtonDown (infoPtr, wParam, lParam);
|
|---|
| 4923 |
|
|---|
| 4924 | case WM_LBUTTONUP:
|
|---|
| 4925 | return REBAR_LButtonUp (infoPtr, wParam, lParam);
|
|---|
| 4926 |
|
|---|
| 4927 | /* case WM_MEASUREITEM: supported according to ControlSpy */
|
|---|
| 4928 |
|
|---|
| 4929 | case WM_MOUSEMOVE:
|
|---|
| 4930 | return REBAR_MouseMove (infoPtr, wParam, lParam);
|
|---|
| 4931 |
|
|---|
| 4932 | case WM_MOUSELEAVE:
|
|---|
| 4933 | return REBAR_MouseLeave (infoPtr, wParam, lParam);
|
|---|
| 4934 |
|
|---|
| 4935 | case WM_NCCALCSIZE:
|
|---|
| 4936 | return REBAR_NCCalcSize (infoPtr, wParam, lParam);
|
|---|
| 4937 |
|
|---|
| 4938 | case WM_NCCREATE:
|
|---|
| 4939 | return REBAR_NCCreate (hwnd, wParam, lParam);
|
|---|
| 4940 |
|
|---|
| 4941 | case WM_NCHITTEST:
|
|---|
| 4942 | return REBAR_NCHitTest (infoPtr, wParam, lParam);
|
|---|
| 4943 |
|
|---|
| 4944 | case WM_NCPAINT:
|
|---|
| 4945 | return REBAR_NCPaint (infoPtr, wParam, lParam);
|
|---|
| 4946 |
|
|---|
| 4947 | case WM_NOTIFYFORMAT:
|
|---|
| 4948 | return REBAR_NotifyFormat (infoPtr, wParam, lParam);
|
|---|
| 4949 |
|
|---|
| 4950 | case WM_PAINT:
|
|---|
| 4951 | return REBAR_Paint (infoPtr, wParam, lParam);
|
|---|
| 4952 |
|
|---|
| 4953 | /* case WM_PALETTECHANGED: supported according to ControlSpy */
|
|---|
| 4954 | /* case WM_PRINTCLIENT: supported according to ControlSpy */
|
|---|
| 4955 | /* case WM_QUERYNEWPALETTE:supported according to ControlSpy */
|
|---|
| 4956 | /* case WM_RBUTTONDOWN: supported according to ControlSpy */
|
|---|
| 4957 | /* case WM_RBUTTONUP: supported according to ControlSpy */
|
|---|
| 4958 |
|
|---|
| 4959 | case WM_SETCURSOR:
|
|---|
| 4960 | return REBAR_SetCursor (infoPtr, wParam, lParam);
|
|---|
| 4961 |
|
|---|
| 4962 | case WM_SETFONT:
|
|---|
| 4963 | return REBAR_SetFont (infoPtr, wParam, lParam);
|
|---|
| 4964 |
|
|---|
| 4965 | case WM_SETREDRAW:
|
|---|
| 4966 | return REBAR_SetRedraw (infoPtr, wParam, lParam);
|
|---|
| 4967 |
|
|---|
| 4968 | case WM_SIZE:
|
|---|
| 4969 | return REBAR_Size (infoPtr, wParam, lParam);
|
|---|
| 4970 |
|
|---|
| 4971 | case WM_STYLECHANGED:
|
|---|
| 4972 | return REBAR_StyleChanged (infoPtr, wParam, lParam);
|
|---|
| 4973 |
|
|---|
| 4974 | /* case WM_SYSCOLORCHANGE: supported according to ControlSpy */
|
|---|
| 4975 | /* "Applications that have brushes using the existing system colors
|
|---|
| 4976 | should delete those brushes and recreate them using the new
|
|---|
| 4977 | system colors." per MSDN */
|
|---|
| 4978 |
|
|---|
| 4979 | /* case WM_VKEYTOITEM: supported according to ControlSpy */
|
|---|
| 4980 | /* case WM_WININICHANGE: */
|
|---|
| 4981 |
|
|---|
| 4982 | case WM_WINDOWPOSCHANGED:
|
|---|
| 4983 | return REBAR_WindowPosChanged (infoPtr, wParam, lParam);
|
|---|
| 4984 |
|
|---|
| 4985 | default:
|
|---|
| 4986 | if ((uMsg >= WM_USER) && (uMsg < WM_APP))
|
|---|
| 4987 | ERR("unknown msg %04x wp=%08x lp=%08lx\n",
|
|---|
| 4988 | uMsg, wParam, lParam);
|
|---|
| 4989 | return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
|---|
| 4990 | }
|
|---|
| 4991 | return 0;
|
|---|
| 4992 | }
|
|---|
| 4993 |
|
|---|
| 4994 |
|
|---|
| 4995 | VOID
|
|---|
| 4996 | REBAR_Register (void)
|
|---|
| 4997 | {
|
|---|
| 4998 | WNDCLASSA wndClass;
|
|---|
| 4999 |
|
|---|
| 5000 | ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
|---|
| 5001 | wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
|
|---|
| 5002 | wndClass.lpfnWndProc = (WNDPROC)REBAR_WindowProc;
|
|---|
| 5003 | wndClass.cbClsExtra = 0;
|
|---|
| 5004 | wndClass.cbWndExtra = sizeof(REBAR_INFO *);
|
|---|
| 5005 | wndClass.hCursor = 0;
|
|---|
| 5006 | wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
|---|
| 5007 | #if GLATESTING
|
|---|
| 5008 | wndClass.hbrBackground = CreateSolidBrush(RGB(0,128,0));
|
|---|
| 5009 | #endif
|
|---|
| 5010 | wndClass.lpszClassName = REBARCLASSNAMEA;
|
|---|
| 5011 |
|
|---|
| 5012 | RegisterClassA (&wndClass);
|
|---|
| 5013 |
|
|---|
| 5014 | mindragx = GetSystemMetrics (SM_CXDRAG);
|
|---|
| 5015 | mindragy = GetSystemMetrics (SM_CYDRAG);
|
|---|
| 5016 |
|
|---|
| 5017 | }
|
|---|
| 5018 |
|
|---|
| 5019 |
|
|---|
| 5020 | VOID
|
|---|
| 5021 | REBAR_Unregister (void)
|
|---|
| 5022 | {
|
|---|
| 5023 | UnregisterClassA (REBARCLASSNAMEA, NULL);
|
|---|
| 5024 | }
|
|---|