Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 1 | /* |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2 | * Rebar control rev 5b |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 3 | * |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 4 | * Copyright 1998, 1999 Eric Kohl |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 5 | * |
| 6 | * NOTES |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 7 | * An author is needed! Any volunteers? |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 8 | * I will only improve this control once in a while. |
| 9 | * Eric <ekohl@abo.rhein-zeitung.de> |
| 10 | * |
| 11 | * TODO: |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 12 | * - vertical placement |
| 13 | * - ComboBox and ComboBoxEx placement |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 14 | * - center image |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 15 | * - Layout code. |
| 16 | * - Display code. |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 17 | * - Some messages. |
| 18 | * - All notifications. |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 19 | |
| 20 | * Changes Guy Albertelli <galberte@neo.lrun.com> |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 21 | * rev 2,3,4 |
| 22 | * - Implement initial version of row grouping, row separators, |
| 23 | * text and background colors. Support additional messages. |
| 24 | * Support RBBS_BREAK. Implement ERASEBKGND and improve painting. |
| 25 | * rev 5 |
| 26 | * 1. Support dragging by the Gripper for only left and right drags |
| 27 | * within a row. (5a) |
| 28 | * 2. Implement WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. |
| 29 | * 3. Support RBS_BANDBORDERS. |
| 30 | * 4. Total rewrite of MouseMove code to handle multiple bands in row. (5b) |
| 31 | * 5. Fix drawing bugs. |
| 32 | * |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 33 | * Still to do: |
| 34 | * 1. default row height should be the max height of all visible bands |
| 35 | * 2. Following still not handled: RBBS_FIXEDBMP, RBBS_CHILDEDGE, |
| 36 | * RBBS_VARIABLEHEIGHT, RBBS_USECHEVRON |
| 37 | * 3. GETBANDINFO seems to return correct colors in native but not here. |
| 38 | |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 39 | */ |
| 40 | |
Dimitrie O. Paun | ef7a5c1 | 2000-11-29 00:03:27 +0000 | [diff] [blame] | 41 | #include <stdlib.h> |
Jeff Garzik | c3e1f72 | 1999-02-19 15:42:11 +0000 | [diff] [blame] | 42 | #include <string.h> |
| 43 | |
Marcus Meissner | 3480e4a | 1999-03-16 10:53:11 +0000 | [diff] [blame] | 44 | #include "winbase.h" |
Marcus Meissner | 9f3eb19 | 1999-05-22 11:22:36 +0000 | [diff] [blame] | 45 | #include "wingdi.h" |
Alexandre Julliard | c7e7df8 | 2000-08-14 14:41:19 +0000 | [diff] [blame] | 46 | #include "wine/unicode.h" |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 47 | #include "commctrl.h" |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 48 | #include "debugtools.h" |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 49 | |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 50 | DEFAULT_DEBUG_CHANNEL(rebar); |
| 51 | |
| 52 | typedef struct |
| 53 | { |
| 54 | UINT fStyle; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 55 | UINT fMask; |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 56 | COLORREF clrFore; |
| 57 | COLORREF clrBack; |
| 58 | INT iImage; |
| 59 | HWND hwndChild; |
| 60 | UINT cxMinChild; |
| 61 | UINT cyMinChild; |
| 62 | UINT cx; |
| 63 | HBITMAP hbmBack; |
| 64 | UINT wID; |
| 65 | UINT cyChild; |
| 66 | UINT cyMaxChild; |
| 67 | UINT cyIntegral; |
| 68 | UINT cxIdeal; |
| 69 | LPARAM lParam; |
| 70 | UINT cxHeader; |
| 71 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 72 | UINT lcx; /* minimum cx for band */ |
| 73 | UINT hcx; /* maximum cx for band */ |
| 74 | UINT lcy; /* minimum cy for band */ |
| 75 | UINT hcy; /* maximum cy for band */ |
| 76 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 77 | SIZE offChild; /* x,y offset if child is not FIXEDSIZE */ |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 78 | UINT uMinHeight; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 79 | INT iRow; /* row this band assigned to */ |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 80 | UINT fDraw; /* drawing flags */ |
| 81 | RECT rcBand; /* calculated band rectangle */ |
| 82 | RECT rcGripper; /* calculated gripper rectangle */ |
| 83 | RECT rcCapImage; /* calculated caption image rectangle */ |
| 84 | RECT rcCapText; /* calculated caption text rectangle */ |
| 85 | RECT rcChild; /* calculated child rectangle */ |
| 86 | |
| 87 | LPWSTR lpText; |
| 88 | HWND hwndPrevParent; |
| 89 | } REBAR_BAND; |
| 90 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 91 | /* fDraw flags */ |
| 92 | #define DRAW_GRIPPER 1 |
| 93 | #define DRAW_IMAGE 2 |
| 94 | #define DRAW_TEXT 4 |
| 95 | #define DRAW_CHILD 8 |
| 96 | #define DRAW_SEP 16 |
| 97 | |
| 98 | |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 99 | typedef struct |
| 100 | { |
| 101 | COLORREF clrBk; /* background color */ |
| 102 | COLORREF clrText; /* text color */ |
| 103 | HIMAGELIST himl; /* handle to imagelist */ |
| 104 | UINT uNumBands; /* number of bands in the rebar */ |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 105 | UINT uNumRows; /* number of rows of bands */ |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 106 | HWND hwndToolTip; /* handle to the tool tip control */ |
| 107 | HWND hwndNotify; /* notification window (parent) */ |
| 108 | HFONT hFont; /* handle to the rebar's font */ |
| 109 | SIZE imageSize; /* image size (image list) */ |
| 110 | |
| 111 | SIZE calcSize; /* calculated rebar size */ |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 112 | BOOL bUnicode; /* Unicode flag */ |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 113 | UINT fStatus; /* Status flags (see below) */ |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 114 | HCURSOR hcurArrow; /* handle to the arrow cursor */ |
| 115 | HCURSOR hcurHorz; /* handle to the EW cursor */ |
| 116 | HCURSOR hcurVert; /* handle to the NS cursor */ |
| 117 | HCURSOR hcurDrag; /* handle to the drag cursor */ |
| 118 | INT iVersion; /* version number */ |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 119 | POINTS dragStart; /* x,y of button down */ |
| 120 | POINTS dragNow; /* x,y of this MouseMove */ |
| 121 | INT ihitBand; /* band number of band whose gripper was grabbed */ |
| 122 | INT ihitoffset; /* offset of hotspot from gripper.left */ |
Alexandre Julliard | 70c9e09 | 2000-08-09 00:41:17 +0000 | [diff] [blame] | 123 | |
| 124 | REBAR_BAND *bands; /* pointer to the array of rebar bands */ |
| 125 | } REBAR_INFO; |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 126 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 127 | /* fStatus flags */ |
| 128 | #define BEGIN_DRAG_ISSUED 1 |
| 129 | #define AUTO_RESIZE 2 |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 130 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 131 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 132 | #define GRIPPER_WIDTH 8 |
| 133 | #define GRIPPER_HEIGHT 16 |
| 134 | #define SEP_WIDTH 3 |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 135 | |
Guy L. Albertelli | 3c7df5c | 2000-10-29 01:16:26 +0000 | [diff] [blame] | 136 | /* This is the increment that is used over the band height */ |
| 137 | /* Determined by experiment. */ |
| 138 | #define REBARSPACE 4 |
| 139 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 140 | #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongA (hwnd, 0)) |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 141 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 142 | |
| 143 | /* "constant values" retrieved when DLL was initialized */ |
| 144 | /* FIXME we do this when the classes are registered. */ |
| 145 | static UINT mindragx = 0; |
| 146 | static UINT mindragy = 0; |
| 147 | |
| 148 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 149 | static VOID |
| 150 | REBAR_DumpBandInfo( LPREBARBANDINFOA pB) |
| 151 | { |
| 152 | TRACE("band info: ID=%u, size=%u, style=0x%08x, mask=0x%08x, child=%04x\n", |
| 153 | pB->wID, pB->cbSize, pB->fStyle, pB->fMask, pB->hwndChild); |
| 154 | TRACE("band info: cx=%u, xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", |
| 155 | pB->cx, pB->cxMinChild, |
| 156 | pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); |
| 157 | TRACE("band info: xIdeal=%u, xHeader=%u, lParam=0x%08lx, clrF=0x%06lx, clrB=0x%06lx\n", |
| 158 | pB->cxIdeal, pB->cxHeader, pB->lParam, pB->clrFore, pB->clrBack); |
| 159 | } |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 160 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 161 | static VOID |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 162 | REBAR_DumpBand (HWND hwnd) |
| 163 | { |
| 164 | REBAR_INFO *iP = REBAR_GetInfoPtr (hwnd); |
| 165 | REBAR_BAND *pB; |
| 166 | UINT i; |
| 167 | |
| 168 | if( TRACE_ON(rebar) ) { |
| 169 | |
| 170 | TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", |
| 171 | hwnd, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows, |
| 172 | iP->calcSize.cx, iP->calcSize.cy); |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 173 | TRACE("hwnd=%04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n", |
| 174 | hwnd, iP->fStatus, iP->dragStart.x, iP->dragStart.y, |
| 175 | iP->dragNow.x, iP->dragNow.y, |
| 176 | iP->ihitBand); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 177 | for (i = 0; i < iP->uNumBands; i++) { |
| 178 | pB = &iP->bands[i]; |
| 179 | TRACE("band # %u: ID=%u, mask=0x%08x, style=0x%08x, child=%04x, row=%u\n", |
| 180 | i, pB->wID, pB->fMask, pB->fStyle, pB->hwndChild, pB->iRow); |
| 181 | TRACE("band # %u: xMin=%u, yMin=%u, cx=%u, yChild=%u, yMax=%u, yIntgl=%u, uMinH=%u,\n", |
| 182 | i, pB->cxMinChild, pB->cyMinChild, pB->cx, |
| 183 | pB->cyChild, pB->cyMaxChild, pB->cyIntegral, pB->uMinHeight); |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 184 | TRACE("band # %u: header=%u, lcx=%u, hcx=%u, lcy=%u, hcy=%u, offChild=%ld,%ld\n", |
| 185 | i, pB->cxHeader, pB->lcx, pB->hcx, pB->lcy, pB->hcy, pB->offChild.cx, pB->offChild.cy); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 186 | TRACE("band # %u: fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n", |
| 187 | i, pB->fDraw, |
| 188 | pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom, |
| 189 | pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom); |
| 190 | TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n", |
| 191 | i, |
| 192 | pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom, |
| 193 | pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom, |
| 194 | pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom); |
| 195 | } |
| 196 | |
| 197 | } |
| 198 | } |
| 199 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 200 | static void |
| 201 | REBAR_Notify (HWND hwnd, NMHDR *nmhdr, UINT code) |
| 202 | { |
| 203 | HWND parent, owner; |
| 204 | |
| 205 | parent = GetParent (hwnd); |
| 206 | owner = GetWindow (hwnd, GW_OWNER); |
| 207 | if (owner) parent = owner; |
| 208 | nmhdr->idFrom = GetDlgCtrlID (hwnd); |
| 209 | nmhdr->hwndFrom = hwnd; |
| 210 | nmhdr->code = code; |
| 211 | |
| 212 | SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom, |
| 213 | (LPARAM)nmhdr); |
| 214 | } |
| 215 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 216 | static VOID |
| 217 | REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand, DWORD dwStyle) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 218 | { |
| 219 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 220 | /* draw separator */ |
| 221 | if (lpBand->fDraw & DRAW_SEP) { |
| 222 | RECT rcSep; |
| 223 | if (dwStyle & CCS_VERT) |
| 224 | SetRect (&rcSep, lpBand->rcBand.left-2, lpBand->rcBand.top-SEP_WIDTH, |
| 225 | lpBand->rcBand.right+2, lpBand->rcBand.top-1); |
| 226 | else |
| 227 | SetRect (&rcSep, lpBand->rcBand.left-SEP_WIDTH, lpBand->rcBand.top-2, |
| 228 | lpBand->rcBand.left-1, lpBand->rcBand.bottom+2); |
| 229 | TRACE("drawing band separator (%d,%d)-(%d,%d)\n", |
| 230 | rcSep.left, rcSep.top, rcSep.right, rcSep.bottom); |
| 231 | DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_LEFT | BF_TOP | BF_MIDDLE); |
| 232 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 233 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 234 | /* draw gripper */ |
| 235 | if (lpBand->fDraw & DRAW_GRIPPER) |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 236 | DrawEdge (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 237 | |
| 238 | /* draw caption image */ |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 239 | if (lpBand->fDraw & DRAW_IMAGE) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 240 | POINT pt; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 241 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 242 | /* center image */ |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 243 | pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2; |
| 244 | pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2; |
| 245 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 246 | ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc, |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 247 | pt.x, pt.y, |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 248 | ILD_TRANSPARENT); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 249 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 250 | |
| 251 | /* draw caption text */ |
| 252 | if (lpBand->fDraw & DRAW_TEXT) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 253 | HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); |
| 254 | INT oldBkMode = SetBkMode (hdc, TRANSPARENT); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 255 | COLORREF oldcolor = CLR_NONE; |
| 256 | if (lpBand->clrFore != CLR_NONE) |
| 257 | oldcolor = SetTextColor (hdc, lpBand->clrFore); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 258 | DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 259 | DT_CENTER | DT_VCENTER | DT_SINGLELINE); |
| 260 | if (oldBkMode != TRANSPARENT) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 261 | SetBkMode (hdc, oldBkMode); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 262 | if (lpBand->clrFore != CLR_NONE) |
| 263 | SetTextColor (hdc, oldcolor); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 264 | SelectObject (hdc, hOldFont); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 265 | } |
| 266 | } |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 267 | |
| 268 | |
| 269 | static VOID |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 270 | REBAR_Refresh (HWND hwnd, HDC hdc) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 271 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 272 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 273 | REBAR_BAND *lpBand; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 274 | UINT i, oldrow; |
| 275 | RECT rcRowSep; |
| 276 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 277 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 278 | oldrow = infoPtr->bands[0].iRow; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 279 | for (i = 0; i < infoPtr->uNumBands; i++) { |
| 280 | lpBand = &infoPtr->bands[i]; |
| 281 | |
| 282 | if ((lpBand->fStyle & RBBS_HIDDEN) || |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 283 | ((dwStyle & CCS_VERT) && |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 284 | (lpBand->fStyle & RBBS_NOVERT))) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 285 | continue; |
| 286 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 287 | /* if a new row then draw a separator */ |
| 288 | if (oldrow != lpBand->iRow) { |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 289 | if (dwStyle & RBS_BANDBORDERS) { |
| 290 | if (dwStyle & CCS_VERT) { |
| 291 | SetRect (&rcRowSep, lpBand->rcBand.left-2, 0, |
| 292 | lpBand->rcBand.left-1, infoPtr->calcSize.cy); |
| 293 | } |
| 294 | else { |
| 295 | SetRect (&rcRowSep, 0, lpBand->rcBand.top-2, |
| 296 | infoPtr->calcSize.cx, lpBand->rcBand.top-1); |
| 297 | } |
| 298 | TRACE ("drawing row sep (%d,%d)-(%d,%d)\n", |
| 299 | rcRowSep.left, rcRowSep.top, |
| 300 | rcRowSep.right, rcRowSep.bottom); |
| 301 | DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_TOP|BF_LEFT); |
| 302 | oldrow = lpBand->iRow; |
| 303 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | /* now draw the band */ |
| 307 | REBAR_DrawBand (hdc, infoPtr, lpBand, dwStyle); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 308 | |
| 309 | } |
| 310 | } |
| 311 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 312 | static void |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 313 | REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 314 | INT maxx, INT usedx, INT mcy, DWORD dwStyle) |
| 315 | /* Function: This routine distributes the extra space in a row */ |
| 316 | /* evenly over the adjustable bands in the row. It also makes */ |
| 317 | /* sure that all bands in the row are the same height. */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 318 | { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 319 | REBAR_BAND *lpBand; |
| 320 | UINT i, j; |
| 321 | INT incr, lastx=0; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 322 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 323 | TRACE("start=%u, end=%u, max x=%d, used x=%d, max y=%d\n", |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 324 | rowstart, rowend-1, maxx, usedx, mcy); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 325 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 326 | j = 0; |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 327 | for (i = rowstart; i<rowend; i++) { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 328 | lpBand = &infoPtr->bands[i]; |
| 329 | if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild && |
| 330 | !(lpBand->fStyle & RBBS_FIXEDSIZE)) |
| 331 | j++; |
| 332 | } |
| 333 | if (j) |
| 334 | incr = (maxx-usedx) / j; |
| 335 | else |
| 336 | incr = 0; |
| 337 | |
| 338 | TRACE("adjusting %u of %u bands in row, incr=%d\n", |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 339 | j, rowend-rowstart, incr); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 340 | |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 341 | for (i = rowstart; i<rowend; i++) { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 342 | lpBand = &infoPtr->bands[i]; |
| 343 | if (dwStyle & CCS_VERT) { |
| 344 | lpBand->rcBand.bottom = lastx + |
| 345 | lpBand->rcBand.bottom - lpBand->rcBand.top; |
| 346 | if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild && |
| 347 | !(lpBand->fStyle & RBBS_FIXEDSIZE)) { |
| 348 | /* if a child window exists and not fixed then widen it */ |
| 349 | lpBand->rcBand.bottom += incr; |
| 350 | } |
| 351 | lpBand->rcBand.top = lastx; |
| 352 | lastx = lpBand->rcBand.bottom + 1; |
| 353 | lpBand->rcBand.right = lpBand->rcBand.left + mcy; |
| 354 | } |
| 355 | else { |
| 356 | lpBand->rcBand.right = lastx + |
| 357 | lpBand->rcBand.right - lpBand->rcBand.left; |
| 358 | if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild && |
| 359 | !(lpBand->fStyle & RBBS_FIXEDSIZE)) { |
| 360 | /* if a child window exists and not fixed then widen it */ |
| 361 | lpBand->rcBand.right += incr; |
| 362 | } |
| 363 | lpBand->rcBand.left = lastx; |
| 364 | lastx = lpBand->rcBand.right + 1; |
| 365 | lpBand->rcBand.bottom = lpBand->rcBand.top + mcy; |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | } |
| 370 | |
| 371 | static void |
| 372 | REBAR_CalcHorzBand (HWND hwnd, REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify, DWORD dwStyle) |
| 373 | /* Function: this routine initializes all the rectangles in */ |
| 374 | /* each band in a row to fit in the adjusted rcBand rect. */ |
| 375 | /* *** Supports only Horizontal bars. *** */ |
| 376 | { |
| 377 | REBAR_BAND *lpBand; |
| 378 | UINT i, xoff, yoff; |
| 379 | NMREBARCHILDSIZE rbcz; |
| 380 | HWND parenthwnd; |
| 381 | RECT oldChild; |
| 382 | |
| 383 | rbcz.hdr.hwndFrom = hwnd; |
| 384 | rbcz.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); |
| 385 | /* MS seems to use GetDlgCtrlID() for above GetWindowLong call */ |
| 386 | parenthwnd = GetParent (hwnd); |
| 387 | |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 388 | for(i=rstart; i<rend; i++){ |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 389 | lpBand = &infoPtr->bands[i]; |
| 390 | oldChild = lpBand->rcChild; |
| 391 | |
| 392 | /* set initial gripper rectangle */ |
| 393 | SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top, |
| 394 | lpBand->rcBand.left, lpBand->rcBand.bottom); |
| 395 | |
| 396 | /* calculate gripper rectangle */ |
| 397 | if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) && |
| 398 | (!(lpBand->fStyle & RBBS_FIXEDSIZE)) && |
| 399 | ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || |
| 400 | (infoPtr->uNumBands > 1))) { |
| 401 | lpBand->fDraw |= DRAW_GRIPPER; |
| 402 | lpBand->rcGripper.left += 1; |
| 403 | lpBand->rcGripper.right = lpBand->rcGripper.left + 3; |
| 404 | lpBand->rcGripper.top += 3; |
| 405 | lpBand->rcGripper.bottom -= 3; |
| 406 | |
| 407 | SetRect (&lpBand->rcCapImage, lpBand->rcGripper.left + GRIPPER_WIDTH, |
| 408 | lpBand->rcBand.top, lpBand->rcGripper.left + GRIPPER_WIDTH, |
| 409 | lpBand->rcBand.bottom); |
| 410 | } |
| 411 | else { |
| 412 | SetRect (&lpBand->rcCapImage, lpBand->rcBand.left, lpBand->rcBand.top, |
| 413 | lpBand->rcBand.left, lpBand->rcBand.bottom); |
| 414 | } |
| 415 | |
| 416 | /* image is visible */ |
| 417 | if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) { |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 418 | lpBand->fDraw |= DRAW_IMAGE; |
| 419 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 420 | lpBand->rcCapImage.right += infoPtr->imageSize.cx; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 421 | lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy; |
| 422 | |
| 423 | /* update band height */ |
| 424 | if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) { |
| 425 | lpBand->uMinHeight = infoPtr->imageSize.cy + 2; |
| 426 | lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight; |
| 427 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 428 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 429 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 430 | /* set initial caption text rectangle */ |
| 431 | SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1, |
| 432 | lpBand->rcCapImage.right, lpBand->rcBand.bottom-1); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 433 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 434 | /* text is visible */ |
| 435 | if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText)) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 436 | HDC hdc = GetDC (0); |
| 437 | HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); |
| 438 | SIZE size; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 439 | |
| 440 | lpBand->fDraw |= DRAW_TEXT; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 441 | GetTextExtentPoint32W (hdc, lpBand->lpText, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 442 | lstrlenW (lpBand->lpText), &size); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 443 | lpBand->rcCapText.right += (size.cx + 2); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 444 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 445 | SelectObject (hdc, hOldFont); |
| 446 | ReleaseDC (0, hdc); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | /* set initial child window rectangle if there is a child */ |
| 450 | if (lpBand->fMask & RBBIM_CHILD) { |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 451 | xoff = lpBand->offChild.cx; |
| 452 | yoff = lpBand->offChild.cy; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 453 | SetRect (&lpBand->rcChild, |
| 454 | lpBand->rcBand.left+lpBand->cxHeader+xoff, lpBand->rcBand.top+yoff, |
| 455 | lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff); |
| 456 | } |
| 457 | else { |
| 458 | SetRect (&lpBand->rcChild, |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 459 | lpBand->rcCapText.right, lpBand->rcBand.top, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 460 | lpBand->rcBand.right, lpBand->rcBand.bottom); |
| 461 | } |
| 462 | |
| 463 | #if 1 |
| 464 | /* do notify is child rectangle changed */ |
| 465 | if (notify && !EqualRect (&oldChild, &lpBand->rcChild)) { |
| 466 | TRACE("Child rectangle changed for band %u\n", i); |
| 467 | TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", |
| 468 | oldChild.left, oldChild.top, |
| 469 | oldChild.right, oldChild.bottom, |
| 470 | lpBand->rcChild.left, lpBand->rcChild.top, |
| 471 | lpBand->rcChild.right, lpBand->rcChild.bottom); |
| 472 | rbcz.hdr.code = RBN_CHILDSIZE; |
| 473 | rbcz.uBand = i; |
| 474 | rbcz.wID = lpBand->wID; |
| 475 | rbcz.rcChild = lpBand->rcChild; |
| 476 | rbcz.rcBand = lpBand->rcBand; |
| 477 | SendMessageA (parenthwnd, WM_NOTIFY, (WPARAM) rbcz.hdr.idFrom, |
| 478 | (LPARAM)&rbcz); |
| 479 | if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) { |
| 480 | TRACE("Child rect changed by NOTIFY for band %u\n", i); |
| 481 | TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", |
| 482 | lpBand->rcChild.left, lpBand->rcChild.top, |
| 483 | lpBand->rcChild.right, lpBand->rcChild.bottom, |
| 484 | rbcz.rcChild.left, rbcz.rcChild.top, |
| 485 | rbcz.rcChild.right, rbcz.rcChild.bottom); |
| 486 | } |
| 487 | } |
| 488 | #endif |
| 489 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 490 | } |
| 491 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 492 | } |
| 493 | |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 494 | |
| 495 | static VOID |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 496 | REBAR_CalcVertBand (HWND hwnd, REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify, DWORD dwStyle) |
| 497 | /* Function: this routine initializes all the rectangles in */ |
| 498 | /* each band in a row to fit in the adjusted rcBand rect. */ |
| 499 | /* *** Supports only Vertical bars. *** */ |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 500 | { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 501 | REBAR_BAND *lpBand; |
| 502 | UINT i, xoff, yoff; |
| 503 | NMREBARCHILDSIZE rbcz; |
| 504 | HWND parenthwnd; |
| 505 | RECT oldChild; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 506 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 507 | rbcz.hdr.hwndFrom = hwnd; |
| 508 | rbcz.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); |
| 509 | /* MS seems to use GetDlgCtrlID() for above GetWindowLong call */ |
| 510 | parenthwnd = GetParent (hwnd); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 511 | |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 512 | for(i=rstart; i<rend; i++){ |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 513 | lpBand = &infoPtr->bands[i]; |
| 514 | oldChild = lpBand->rcChild; |
| 515 | |
| 516 | /* set initial gripper rectangle */ |
| 517 | SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top, |
| 518 | lpBand->rcBand.right, lpBand->rcBand.top); |
| 519 | |
| 520 | /* calculate gripper rectangle */ |
| 521 | if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) && |
| 522 | (!(lpBand->fStyle & RBBS_FIXEDSIZE)) && |
| 523 | ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || |
| 524 | (infoPtr->uNumBands > 1))) { |
| 525 | lpBand->fDraw |= DRAW_GRIPPER; |
| 526 | |
| 527 | if (dwStyle & RBS_VERTICALGRIPPER) { |
| 528 | /* vertical gripper */ |
| 529 | lpBand->rcGripper.left += 3; |
| 530 | lpBand->rcGripper.right = lpBand->rcGripper.left + 3; |
| 531 | lpBand->rcGripper.top += 3; |
| 532 | lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT; |
| 533 | |
| 534 | /* initialize Caption image rectangle */ |
| 535 | SetRect (&lpBand->rcCapImage, lpBand->rcBand.left, |
| 536 | lpBand->rcGripper.top + GRIPPER_HEIGHT, |
| 537 | lpBand->rcBand.right, |
| 538 | lpBand->rcGripper.top + GRIPPER_HEIGHT); |
| 539 | } |
| 540 | else { |
| 541 | /* horizontal gripper */ |
| 542 | lpBand->rcGripper.left += 3; |
| 543 | lpBand->rcGripper.right -= 3; |
| 544 | lpBand->rcGripper.top += 3; |
| 545 | lpBand->rcGripper.bottom = lpBand->rcGripper.top + 3; |
| 546 | |
| 547 | /* initialize Caption image rectangle */ |
| 548 | SetRect (&lpBand->rcCapImage, lpBand->rcBand.left, |
| 549 | lpBand->rcGripper.top + GRIPPER_WIDTH, |
| 550 | lpBand->rcBand.right, |
| 551 | lpBand->rcGripper.top + GRIPPER_WIDTH); |
| 552 | } |
| 553 | } |
| 554 | else { |
| 555 | /* initialize Caption image rectangle */ |
| 556 | SetRect (&lpBand->rcCapImage, lpBand->rcBand.left, lpBand->rcBand.top, |
| 557 | lpBand->rcBand.right, lpBand->rcBand.top); |
| 558 | } |
| 559 | |
| 560 | /* image is visible */ |
| 561 | if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) { |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 562 | lpBand->fDraw |= DRAW_IMAGE; |
| 563 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 564 | lpBand->rcCapImage.right += infoPtr->imageSize.cx; |
| 565 | lpBand->rcCapImage.bottom += infoPtr->imageSize.cy; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 566 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 567 | /* update band height */ |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 568 | if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) { |
| 569 | lpBand->uMinHeight = infoPtr->imageSize.cx + 2; |
| 570 | lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight; |
| 571 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 572 | } |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 573 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 574 | /* set initial caption text rectangle */ |
| 575 | lpBand->rcCapText.left = lpBand->rcBand.left + 1; |
| 576 | lpBand->rcCapText.top = lpBand->rcCapImage.bottom; |
| 577 | lpBand->rcCapText.right = lpBand->rcBand.right - 1; |
| 578 | lpBand->rcCapText.bottom = lpBand->rcCapText.top; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 579 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 580 | /* text is visible */ |
| 581 | if (lpBand->lpText) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 582 | HDC hdc = GetDC (0); |
| 583 | HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); |
| 584 | SIZE size; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 585 | |
| 586 | lpBand->fDraw |= DRAW_TEXT; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 587 | GetTextExtentPoint32W (hdc, lpBand->lpText, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 588 | lstrlenW (lpBand->lpText), &size); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 589 | lpBand->rcCapText.bottom += (size.cy + 2); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 590 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 591 | SelectObject (hdc, hOldFont); |
| 592 | ReleaseDC (0, hdc); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 593 | } |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 594 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 595 | /* set initial child window rectangle if there is a child */ |
| 596 | if (lpBand->fMask & RBBIM_CHILD) { |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 597 | yoff = lpBand->offChild.cx; |
| 598 | xoff = lpBand->offChild.cy; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 599 | SetRect (&lpBand->rcChild, |
| 600 | lpBand->rcBand.left+xoff, |
| 601 | lpBand->rcBand.top+lpBand->cxHeader+yoff, |
| 602 | lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff); |
| 603 | } |
| 604 | else { |
| 605 | SetRect (&lpBand->rcChild, |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 606 | lpBand->rcBand.left, lpBand->rcCapText.bottom, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 607 | lpBand->rcBand.right, lpBand->rcBand.top); |
| 608 | } |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 609 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 610 | #if 1 |
| 611 | /* do notify is child rectangle changed */ |
| 612 | if (notify && !EqualRect (&oldChild, &lpBand->rcChild)) { |
| 613 | TRACE("Child rectangle changed for band %u\n", i); |
| 614 | TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", |
| 615 | oldChild.left, oldChild.top, |
| 616 | oldChild.right, oldChild.bottom, |
| 617 | lpBand->rcChild.left, lpBand->rcChild.top, |
| 618 | lpBand->rcChild.right, lpBand->rcChild.bottom); |
| 619 | rbcz.hdr.code = RBN_CHILDSIZE; |
| 620 | rbcz.uBand = i; |
| 621 | rbcz.wID = lpBand->wID; |
| 622 | rbcz.rcChild = lpBand->rcChild; |
| 623 | rbcz.rcBand = lpBand->rcBand; |
| 624 | SendMessageA (parenthwnd, WM_NOTIFY, (WPARAM) rbcz.hdr.idFrom, |
| 625 | (LPARAM)&rbcz); |
| 626 | if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) { |
| 627 | TRACE("Child rect changed by NOTIFY for band %u\n", i); |
| 628 | TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n", |
| 629 | lpBand->rcChild.left, lpBand->rcChild.top, |
| 630 | lpBand->rcChild.right, lpBand->rcChild.bottom, |
| 631 | rbcz.rcChild.left, rbcz.rcChild.top, |
| 632 | rbcz.rcChild.right, rbcz.rcChild.bottom); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 633 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 634 | } |
| 635 | #endif |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 636 | |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 637 | } |
| 638 | } |
| 639 | |
| 640 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 641 | static VOID |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 642 | REBAR_Layout (HWND hwnd, LPRECT lpRect, BOOL notify, BOOL resetclient) |
| 643 | /* Function: This routine is resposible for laying out all */ |
| 644 | /* the bands in a rebar. It assigns each band to a row and*/ |
| 645 | /* determines when to start a new row. */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 646 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 647 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
| 648 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 649 | REBAR_BAND *lpBand; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 650 | RECT rcClient, rcAdj; |
| 651 | INT x, y, cx, cxsep, mcy, clientcx, clientcy, adjcx, adjcy, row, rightx, bottomy; |
| 652 | UINT i, rowstartband; |
| 653 | BOOL dobreak; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 654 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 655 | GetClientRect (hwnd, &rcClient); |
| 656 | TRACE("Client is (%d,%d)-(%d,%d)\n", |
| 657 | rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 658 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 659 | if (lpRect) { |
| 660 | rcAdj = *lpRect; |
| 661 | TRACE("adjustment rect is (%d,%d)-(%d,%d)\n", |
| 662 | rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 663 | } |
| 664 | else { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 665 | CopyRect (&rcAdj, &rcClient); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 666 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 667 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 668 | clientcx = rcClient.right - rcClient.left; |
| 669 | clientcy = rcClient.bottom - rcClient.top; |
| 670 | adjcx = rcAdj.right - rcAdj.left; |
| 671 | adjcy = rcAdj.bottom - rcAdj.top; |
| 672 | if (resetclient) { |
| 673 | TRACE("window client rect will be set to adj rect\n"); |
| 674 | clientcx = adjcx; |
| 675 | clientcy = adjcy; |
| 676 | } |
| 677 | x = 0; |
| 678 | y = 0; |
| 679 | rowstartband = 0; |
| 680 | row = 1; |
| 681 | cx = 0; |
| 682 | mcy = 0; |
| 683 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 684 | for (i = 0; i < infoPtr->uNumBands; i++) { |
| 685 | lpBand = &infoPtr->bands[i]; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 686 | lpBand->fDraw = 0; |
| 687 | lpBand->iRow = row; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 688 | |
| 689 | if ((lpBand->fStyle & RBBS_HIDDEN) || |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 690 | ((dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT))) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 691 | continue; |
| 692 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 693 | cxsep = (x==0) ? 0 : SEP_WIDTH; /* separator from previous band */ |
| 694 | cx = lpBand->cxHeader + /* Header: includes gripper, text, image */ |
| 695 | lpBand->hcx; /* coumpted size of child */ |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 696 | if (dwStyle & CCS_VERT) |
| 697 | dobreak = (y + cx + cxsep > adjcy); |
| 698 | else |
| 699 | dobreak = (x + cx + cxsep > adjcx); |
| 700 | /* This is the check for whether we need to start a new row */ |
Guy L. Albertelli | 8880195 | 2000-10-31 01:49:00 +0000 | [diff] [blame] | 701 | if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) || |
Guy L. Albertelli | 3c7df5c | 2000-10-29 01:16:26 +0000 | [diff] [blame] | 702 | ( ((dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) { |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 703 | INT borders; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 704 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 705 | TRACE("Spliting to new row %d on band %u\n", row+1, i); |
| 706 | borders = (dwStyle & RBS_BANDBORDERS) ? 2 : 0; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 707 | if (dwStyle & CCS_VERT) { |
| 708 | /* first adjust all bands in previous current row to */ |
| 709 | /* redistribute extra x pixels */ |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 710 | REBAR_AdjustBands (infoPtr, rowstartband, i, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 711 | clientcy, y, mcy, dwStyle); |
| 712 | /* calculate band subrectangles and break to new row */ |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 713 | REBAR_CalcVertBand (hwnd, infoPtr, rowstartband, i, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 714 | notify, dwStyle); |
| 715 | y = 0; |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 716 | x += (mcy + borders); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 717 | } |
| 718 | else { |
| 719 | /* first adjust all bands in previous current row to */ |
| 720 | /* redistribute extra x pixels */ |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 721 | REBAR_AdjustBands (infoPtr, rowstartband, i, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 722 | clientcx, x, mcy, dwStyle); |
| 723 | /* calculate band subrectangles and break to new row */ |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 724 | REBAR_CalcHorzBand (hwnd, infoPtr, rowstartband, i, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 725 | notify, dwStyle); |
| 726 | x = 0; |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 727 | y += (mcy + borders); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | /* FIXME: if not RBS_VARHEIGHT then find max */ |
| 731 | mcy = 0; |
| 732 | cxsep = 0; |
| 733 | row++; |
| 734 | rowstartband = i; |
| 735 | lpBand->iRow = row; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 736 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 737 | |
Guy L. Albertelli | 3c7df5c | 2000-10-29 01:16:26 +0000 | [diff] [blame] | 738 | if (mcy < lpBand->lcy + REBARSPACE) mcy = lpBand->lcy + REBARSPACE; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 739 | |
| 740 | /* if boundary rect specified then limit mcy */ |
| 741 | if (lpRect) { |
| 742 | if (dwStyle & CCS_VERT) { |
| 743 | if (x+mcy > adjcx) { |
| 744 | mcy = adjcx - x; |
| 745 | TRACE("row %u limiting mcy=%d, adjcx=%d, x=%d\n", |
| 746 | i, mcy, adjcx, x); |
| 747 | } |
| 748 | } |
| 749 | else { |
| 750 | if (y+mcy > adjcy) { |
| 751 | mcy = adjcy - y; |
| 752 | TRACE("row %u limiting mcy=%d, adjcy=%d, y=%d\n", |
| 753 | i, mcy, adjcy, y); |
| 754 | } |
| 755 | } |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 756 | } |
| 757 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 758 | if (dwStyle & CCS_VERT) { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 759 | /* bound the bottom side if we have a bounding rectangle */ |
| 760 | lpBand->fDraw |= (y==0) ? 0 : DRAW_SEP; |
| 761 | rightx = clientcx; |
| 762 | bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx; |
| 763 | lpBand->rcBand.left = x; |
Guy L. Albertelli | 3c7df5c | 2000-10-29 01:16:26 +0000 | [diff] [blame] | 764 | lpBand->rcBand.right = y + min(mcy, lpBand->lcy+REBARSPACE); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 765 | lpBand->rcBand.top = min(bottomy, y + cxsep); |
| 766 | lpBand->rcBand.bottom = bottomy; |
| 767 | lpBand->uMinHeight = lpBand->lcy; |
| 768 | y = bottomy; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 769 | } |
| 770 | else { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 771 | /* bound the right side if we have a bounding rectangle */ |
| 772 | lpBand->fDraw |= (x==0) ? 0 : DRAW_SEP; |
| 773 | rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx; |
| 774 | bottomy = clientcy; |
| 775 | lpBand->rcBand.left = min(rightx, x + cxsep); |
| 776 | lpBand->rcBand.right = rightx; |
| 777 | lpBand->rcBand.top = y; |
Guy L. Albertelli | 3c7df5c | 2000-10-29 01:16:26 +0000 | [diff] [blame] | 778 | lpBand->rcBand.bottom = y + min(mcy, lpBand->lcy+REBARSPACE); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 779 | lpBand->uMinHeight = lpBand->lcy; |
| 780 | x = rightx; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 781 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 782 | TRACE("band %u, row %d, (%d,%d)-(%d,%d)\n", |
| 783 | i, row, |
| 784 | lpBand->rcBand.left, lpBand->rcBand.top, |
| 785 | lpBand->rcBand.right, lpBand->rcBand.bottom); |
| 786 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 787 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 788 | if (infoPtr->uNumBands) { |
| 789 | infoPtr->uNumRows = row; |
| 790 | |
| 791 | if (dwStyle & CCS_VERT) { |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 792 | REBAR_AdjustBands (infoPtr, rowstartband, infoPtr->uNumBands, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 793 | clientcy, y, mcy, dwStyle); |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 794 | REBAR_CalcVertBand (hwnd, infoPtr, rowstartband, infoPtr->uNumBands, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 795 | notify, dwStyle); |
| 796 | x += mcy; |
| 797 | } |
| 798 | else { |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 799 | REBAR_AdjustBands (infoPtr, rowstartband, infoPtr->uNumBands, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 800 | clientcx, x, mcy, dwStyle); |
Hidenori Takeshima | ce50aa0 | 2000-10-31 01:34:27 +0000 | [diff] [blame] | 801 | REBAR_CalcHorzBand (hwnd, infoPtr, rowstartband, infoPtr->uNumBands, |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 802 | notify, dwStyle); |
| 803 | y += mcy; |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | /* FIXME: if not RBS_VARHEIGHT then find max mcy and adj rect*/ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 808 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 809 | if (dwStyle & CCS_VERT) { |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 810 | infoPtr->calcSize.cx = x; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 811 | infoPtr->calcSize.cy = clientcy; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 812 | } |
| 813 | else { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 814 | infoPtr->calcSize.cx = clientcx; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 815 | infoPtr->calcSize.cy = y; |
| 816 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 817 | REBAR_DumpBand (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 818 | } |
| 819 | |
| 820 | |
| 821 | static VOID |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 822 | REBAR_ForceResize (HWND hwnd) |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 823 | /* Function: This changes the size of the REBAR window to that */ |
| 824 | /* calculated by REBAR_Layout. */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 825 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 826 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 827 | RECT rc; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 828 | |
Gerald Pfeifer | 1b490b4 | 2000-09-24 03:05:11 +0000 | [diff] [blame] | 829 | TRACE( " to [%ld x %ld]!\n", |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 830 | infoPtr->calcSize.cx, infoPtr->calcSize.cy); |
| 831 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 832 | infoPtr->fStatus |= AUTO_RESIZE; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 833 | |
| 834 | rc.left = 0; |
| 835 | rc.top = 0; |
| 836 | rc.right = infoPtr->calcSize.cx; |
| 837 | rc.bottom = infoPtr->calcSize.cy; |
| 838 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 839 | if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) { |
Marcus Meissner | 9f3eb19 | 1999-05-22 11:22:36 +0000 | [diff] [blame] | 840 | InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 841 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 842 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 843 | SetWindowPos (hwnd, 0, 0, 0, |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 844 | rc.right - rc.left, rc.bottom - rc.top, |
| 845 | SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); |
| 846 | } |
| 847 | |
| 848 | |
| 849 | static VOID |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 850 | REBAR_MoveChildWindows (HWND hwnd) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 851 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 852 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 853 | REBAR_BAND *lpBand; |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 854 | CHAR szClassName[40]; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 855 | UINT i; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 856 | |
| 857 | for (i = 0; i < infoPtr->uNumBands; i++) { |
| 858 | lpBand = &infoPtr->bands[i]; |
| 859 | |
| 860 | if (lpBand->fStyle & RBBS_HIDDEN) |
| 861 | continue; |
| 862 | if (lpBand->hwndChild) { |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 863 | TRACE("hwndChild = %x\n", lpBand->hwndChild); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 864 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 865 | GetClassNameA (lpBand->hwndChild, szClassName, 40); |
| 866 | if (!lstrcmpA (szClassName, "ComboBox")) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 867 | INT nEditHeight, yPos; |
| 868 | RECT rc; |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 869 | |
| 870 | /* special placement code for combo box */ |
| 871 | |
| 872 | |
| 873 | /* get size of edit line */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 874 | GetWindowRect (lpBand->hwndChild, &rc); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 875 | nEditHeight = rc.bottom - rc.top; |
| 876 | yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; |
| 877 | |
| 878 | /* center combo box inside child area */ |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 879 | TRACE("moving child %04x to (%d,%d)-(%d,%d)\n", |
| 880 | lpBand->hwndChild, |
| 881 | lpBand->rcChild.left, yPos, |
| 882 | lpBand->rcChild.right - lpBand->rcChild.left, |
| 883 | nEditHeight); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 884 | SetWindowPos (lpBand->hwndChild, HWND_TOP, |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 885 | lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos, |
| 886 | lpBand->rcChild.right - lpBand->rcChild.left, |
| 887 | nEditHeight, |
| 888 | SWP_SHOWWINDOW); |
| 889 | } |
| 890 | #if 0 |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 891 | else if (!lstrcmpA (szClassName, WC_COMBOBOXEXA)) { |
Eric Kohl | 88e9501 | 1999-06-26 11:49:44 +0000 | [diff] [blame] | 892 | INT nEditHeight, yPos; |
| 893 | RECT rc; |
| 894 | HWND hwndEdit; |
| 895 | |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 896 | /* special placement code for extended combo box */ |
| 897 | |
Eric Kohl | 88e9501 | 1999-06-26 11:49:44 +0000 | [diff] [blame] | 898 | /* get size of edit line */ |
| 899 | hwndEdit = SendMessageA (lpBand->hwndChild, CBEM_GETEDITCONTROL, 0, 0); |
| 900 | GetWindowRect (hwndEdit, &rc); |
| 901 | nEditHeight = rc.bottom - rc.top; |
| 902 | yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; |
| 903 | |
| 904 | /* center combo box inside child area */ |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 905 | TRACE("moving child %04x to (%d,%d)-(%d,%d)\n", |
| 906 | lpBand->hwndChild, |
| 907 | lpBand->rcChild.left, yPos, |
| 908 | lpBand->rcChild.right - lpBand->rcChild.left, |
| 909 | nEditHeight); |
Eric Kohl | 88e9501 | 1999-06-26 11:49:44 +0000 | [diff] [blame] | 910 | SetWindowPos (lpBand->hwndChild, HWND_TOP, |
| 911 | lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos, |
| 912 | lpBand->rcChild.right - lpBand->rcChild.left, |
| 913 | nEditHeight, |
| 914 | SWP_SHOWWINDOW); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 915 | |
| 916 | } |
| 917 | #endif |
| 918 | else { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 919 | TRACE("moving child %04x to (%d,%d)-(%d,%d)\n", |
| 920 | lpBand->hwndChild, |
| 921 | lpBand->rcChild.left, lpBand->rcChild.top, |
| 922 | lpBand->rcChild.right - lpBand->rcChild.left, |
| 923 | lpBand->rcChild.bottom - lpBand->rcChild.top); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 924 | SetWindowPos (lpBand->hwndChild, HWND_TOP, |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 925 | lpBand->rcChild.left, lpBand->rcChild.top, |
| 926 | lpBand->rcChild.right - lpBand->rcChild.left, |
| 927 | lpBand->rcChild.bottom - lpBand->rcChild.top, |
| 928 | SWP_SHOWWINDOW); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 929 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 930 | } |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 935 | static VOID |
| 936 | REBAR_ValidateBand (HWND hwnd, REBAR_INFO *infoPtr, REBAR_BAND *lpBand) |
| 937 | /* Function: This routine evaluates the band specs supplied */ |
| 938 | /* by the user and updates the following 5 fields in */ |
| 939 | /* the internal band structure: cxHeader, lcx, lcy, hcx, hcy*/ |
| 940 | { |
| 941 | UINT header=0; |
| 942 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); |
| 943 | |
| 944 | lpBand->lcx = 0; |
| 945 | lpBand->lcy = 0; |
| 946 | lpBand->hcx = 0; |
| 947 | lpBand->hcy = 0; |
| 948 | |
| 949 | /* Header is where the image, text and gripper exist */ |
| 950 | /* in the band and preceed the child window. */ |
| 951 | |
| 952 | /* calculate gripper rectangle */ |
| 953 | if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) && |
| 954 | (!(lpBand->fStyle & RBBS_FIXEDSIZE)) && |
| 955 | ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || |
| 956 | (infoPtr->uNumBands > 1))) { |
| 957 | if (dwStyle & CCS_VERT) |
| 958 | if (dwStyle & RBS_VERTICALGRIPPER) |
| 959 | header += (GRIPPER_HEIGHT + 3); |
| 960 | else |
| 961 | header += (GRIPPER_WIDTH + 3); |
| 962 | else |
| 963 | header += (GRIPPER_WIDTH + 1); |
| 964 | } |
| 965 | |
| 966 | /* image is visible */ |
| 967 | if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) { |
| 968 | if (dwStyle & CCS_VERT) { |
| 969 | header += infoPtr->imageSize.cy; |
| 970 | lpBand->lcy = infoPtr->imageSize.cx + 2; |
| 971 | } |
| 972 | else { |
| 973 | header += infoPtr->imageSize.cx; |
| 974 | lpBand->lcy = infoPtr->imageSize.cy + 2; |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | /* text is visible */ |
| 979 | if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText)) { |
| 980 | HDC hdc = GetDC (0); |
| 981 | HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); |
| 982 | SIZE size; |
| 983 | |
| 984 | GetTextExtentPoint32W (hdc, lpBand->lpText, |
| 985 | lstrlenW (lpBand->lpText), &size); |
| 986 | header += ((dwStyle & CCS_VERT) ? (size.cy + 2) : (size.cx + 2)); |
| 987 | |
| 988 | SelectObject (hdc, hOldFont); |
| 989 | ReleaseDC (0, hdc); |
| 990 | } |
| 991 | |
| 992 | /* check if user overrode the header value */ |
| 993 | if (!(lpBand->fMask & RBBIM_HEADERSIZE)) |
| 994 | lpBand->cxHeader = header; |
| 995 | |
| 996 | |
| 997 | /* Now compute minimum size of child window */ |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 998 | lpBand->offChild.cx = 0; |
| 999 | lpBand->offChild.cy = 0; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1000 | if (lpBand->fMask & RBBIM_CHILDSIZE) { |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 1001 | if (!(lpBand->fStyle & RBBS_FIXEDSIZE)) { |
| 1002 | lpBand->offChild.cx = 4; |
| 1003 | lpBand->offChild.cy = 2; |
| 1004 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1005 | lpBand->lcx = lpBand->cxMinChild; |
| 1006 | lpBand->lcy = lpBand->cyMinChild; |
| 1007 | lpBand->hcy = lpBand->lcy; |
| 1008 | if (lpBand->fStyle & RBBS_VARIABLEHEIGHT) { |
Guy L. Albertelli | 3c7df5c | 2000-10-29 01:16:26 +0000 | [diff] [blame] | 1009 | if (lpBand->cyChild != 0xffffffff) |
| 1010 | lpBand->lcy = max (lpBand->cyChild, lpBand->lcy); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1011 | lpBand->hcy = lpBand->cyMaxChild; |
| 1012 | } |
| 1013 | TRACE("_CHILDSIZE\n"); |
| 1014 | } |
| 1015 | if (lpBand->fMask & RBBIM_SIZE) { |
| 1016 | lpBand->hcx = max (lpBand->cx, lpBand->lcx); |
| 1017 | TRACE("_SIZE\n"); |
| 1018 | } |
| 1019 | else |
| 1020 | lpBand->hcx = lpBand->lcx; |
| 1021 | |
| 1022 | } |
| 1023 | |
| 1024 | static void |
| 1025 | REBAR_CommonSetupBand (HWND hwnd, LPREBARBANDINFOA lprbbi, REBAR_BAND *lpBand) |
| 1026 | /* Function: This routine copies the supplied values from */ |
| 1027 | /* user input (lprbbi) to the internal band structure. */ |
| 1028 | { |
| 1029 | lpBand->fMask |= lprbbi->fMask; |
| 1030 | |
| 1031 | if (lprbbi->fMask & RBBIM_STYLE) |
| 1032 | lpBand->fStyle = lprbbi->fStyle; |
| 1033 | |
| 1034 | if (lprbbi->fMask & RBBIM_COLORS) { |
| 1035 | lpBand->clrFore = lprbbi->clrFore; |
| 1036 | lpBand->clrBack = lprbbi->clrBack; |
| 1037 | } |
| 1038 | |
| 1039 | if (lprbbi->fMask & RBBIM_IMAGE) |
| 1040 | lpBand->iImage = lprbbi->iImage; |
| 1041 | |
| 1042 | if (lprbbi->fMask & RBBIM_CHILD) { |
| 1043 | if (lprbbi->hwndChild) { |
| 1044 | lpBand->hwndChild = lprbbi->hwndChild; |
| 1045 | lpBand->hwndPrevParent = |
| 1046 | SetParent (lpBand->hwndChild, hwnd); |
| 1047 | } |
| 1048 | else { |
| 1049 | TRACE("child: 0x%x prev parent: 0x%x\n", |
| 1050 | lpBand->hwndChild, lpBand->hwndPrevParent); |
| 1051 | lpBand->hwndChild = 0; |
| 1052 | lpBand->hwndPrevParent = 0; |
| 1053 | } |
| 1054 | } |
| 1055 | |
| 1056 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { |
| 1057 | lpBand->cxMinChild = lprbbi->cxMinChild; |
| 1058 | lpBand->cyMinChild = lprbbi->cyMinChild; |
| 1059 | lpBand->cyMaxChild = lprbbi->cyMaxChild; |
| 1060 | lpBand->cyChild = lprbbi->cyChild; |
| 1061 | lpBand->cyIntegral = lprbbi->cyIntegral; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
| 1064 | if (lprbbi->fMask & RBBIM_SIZE) |
| 1065 | lpBand->cx = lprbbi->cx; |
| 1066 | |
| 1067 | if (lprbbi->fMask & RBBIM_BACKGROUND) |
| 1068 | lpBand->hbmBack = lprbbi->hbmBack; |
| 1069 | |
| 1070 | if (lprbbi->fMask & RBBIM_ID) |
| 1071 | lpBand->wID = lprbbi->wID; |
| 1072 | |
| 1073 | /* check for additional data */ |
| 1074 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { |
| 1075 | if (lprbbi->fMask & RBBIM_IDEALSIZE) |
| 1076 | lpBand->cxIdeal = lprbbi->cxIdeal; |
| 1077 | |
| 1078 | if (lprbbi->fMask & RBBIM_LPARAM) |
| 1079 | lpBand->lParam = lprbbi->lParam; |
| 1080 | |
| 1081 | if (lprbbi->fMask & RBBIM_HEADERSIZE) |
| 1082 | lpBand->cxHeader = lprbbi->cxHeader; |
| 1083 | } |
| 1084 | } |
| 1085 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 1086 | static LRESULT |
| 1087 | REBAR_InternalEraseBkGnd (HWND hwnd, WPARAM wParam, LPARAM lParam, RECT *clip) |
| 1088 | /* Function: This erases the background rectangle with the */ |
| 1089 | /* default brush, then with any band that has a different */ |
| 1090 | /* background color. */ |
| 1091 | { |
Dmitry Timoshkov | 77b2185 | 2000-11-15 22:15:52 +0000 | [diff] [blame] | 1092 | HBRUSH hbrBackground = GetClassWord(hwnd, GCW_HBRBACKGROUND); |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 1093 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
| 1094 | RECT eraserect; |
| 1095 | REBAR_BAND *lpBand; |
| 1096 | INT i; |
| 1097 | |
Dmitry Timoshkov | 77b2185 | 2000-11-15 22:15:52 +0000 | [diff] [blame] | 1098 | if (hbrBackground) |
| 1099 | FillRect( (HDC) wParam, clip, hbrBackground); |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 1100 | |
| 1101 | for(i=0; i<infoPtr->uNumBands; i++) { |
| 1102 | lpBand = &infoPtr->bands[i]; |
| 1103 | if (lpBand->clrBack != CLR_NONE) { |
| 1104 | if (IntersectRect (&eraserect, clip, &lpBand->rcBand)) { |
| 1105 | /* draw background */ |
| 1106 | HBRUSH brh = CreateSolidBrush (lpBand->clrBack); |
| 1107 | TRACE("backround color=0x%06lx, rect (%d,%d)-(%d,%d)\n", |
| 1108 | lpBand->clrBack, |
| 1109 | lpBand->rcBand.left,lpBand->rcBand.top, |
| 1110 | lpBand->rcBand.right,lpBand->rcBand.bottom); |
| 1111 | FillRect ( (HDC)wParam, &eraserect, brh); |
| 1112 | DeleteObject (brh); |
| 1113 | } |
| 1114 | } |
| 1115 | } |
| 1116 | return TRUE; |
| 1117 | } |
| 1118 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1119 | static void |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1120 | REBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pBand) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1121 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1122 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1123 | REBAR_BAND *lpBand; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1124 | RECT rect; |
| 1125 | INT iCount; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1126 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1127 | GetClientRect (hwnd, &rect); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1128 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1129 | *pFlags = RBHT_NOWHERE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1130 | if (PtInRect (&rect, *lpPt)) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1131 | { |
| 1132 | if (infoPtr->uNumBands == 0) { |
| 1133 | *pFlags = RBHT_NOWHERE; |
| 1134 | if (pBand) |
| 1135 | *pBand = -1; |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1136 | TRACE("NOWHERE\n"); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1137 | return; |
| 1138 | } |
| 1139 | else { |
| 1140 | /* somewhere inside */ |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 1141 | infoPtr->ihitBand = -1; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1142 | for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) { |
| 1143 | lpBand = &infoPtr->bands[iCount]; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1144 | if (PtInRect (&lpBand->rcBand, *lpPt)) { |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1145 | if (pBand) |
| 1146 | *pBand = iCount; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1147 | if (PtInRect (&lpBand->rcGripper, *lpPt)) { |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1148 | *pFlags = RBHT_GRABBER; |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 1149 | infoPtr->ihitBand = iCount; |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1150 | TRACE("ON GRABBER %d\n", iCount); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1151 | return; |
| 1152 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1153 | else if (PtInRect (&lpBand->rcCapImage, *lpPt)) { |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1154 | *pFlags = RBHT_CAPTION; |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1155 | TRACE("ON CAPTION %d\n", iCount); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1156 | return; |
| 1157 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1158 | else if (PtInRect (&lpBand->rcCapText, *lpPt)) { |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1159 | *pFlags = RBHT_CAPTION; |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1160 | TRACE("ON CAPTION %d\n", iCount); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1161 | return; |
| 1162 | } |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1163 | else if (PtInRect (&lpBand->rcChild, *lpPt)) { |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1164 | *pFlags = RBHT_CLIENT; |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1165 | TRACE("ON CLIENT %d\n", iCount); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1166 | return; |
| 1167 | } |
| 1168 | else { |
| 1169 | *pFlags = RBHT_NOWHERE; |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1170 | TRACE("NOWHERE %d\n", iCount); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1171 | return; |
| 1172 | } |
| 1173 | } |
| 1174 | } |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1175 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1176 | *pFlags = RBHT_NOWHERE; |
| 1177 | if (pBand) |
| 1178 | *pBand = -1; |
| 1179 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1180 | TRACE("NOWHERE\n"); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1181 | return; |
| 1182 | } |
| 1183 | } |
| 1184 | else { |
| 1185 | *pFlags = RBHT_NOWHERE; |
| 1186 | if (pBand) |
| 1187 | *pBand = -1; |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1188 | TRACE("NOWHERE\n"); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1189 | return; |
| 1190 | } |
| 1191 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1192 | TRACE("flags=0x%X\n", *pFlags); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1193 | return; |
| 1194 | } |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1195 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 1196 | #define READJ(b,i) {b->rcChild.right += (i);b->rcBand.right += (i);} |
| 1197 | #define LEADJ(b,i) {b->rcBand.left += (i); \ |
| 1198 | b->rcGripper.left += (i); \ |
| 1199 | b->rcGripper.right += (i); \ |
| 1200 | b->rcCapImage.left += (i); \ |
| 1201 | b->rcCapImage.right += (i); \ |
| 1202 | b->rcCapText.left += (i); \ |
| 1203 | b->rcCapText.right += (i); \ |
| 1204 | b->rcChild.left += (i);} |
| 1205 | |
| 1206 | |
| 1207 | static INT |
| 1208 | REBAR_Shrink (REBAR_BAND *band, INT movement, INT i) |
| 1209 | /* Function: This attempts to shrink the given band by the */ |
| 1210 | /* the amount in "movement". A shrink to the left is indi- */ |
| 1211 | /* cated by "movement" being negative. "i" is merely the */ |
| 1212 | /* band index for trace messages. */ |
| 1213 | { |
| 1214 | INT Leadjust, Readjust, avail, ret; |
| 1215 | |
| 1216 | /* Note: a left drag is indicated by "movement" being negative. */ |
| 1217 | /* Similarly, a right drag is indicated by "movement" */ |
| 1218 | /* being positive. "movement" should never be 0, but if */ |
| 1219 | /* it is then the band does not move. */ |
| 1220 | |
| 1221 | avail = band->rcBand.right - band->rcBand.left - |
| 1222 | band->cxHeader - band->offChild.cx; |
| 1223 | |
| 1224 | /* now compute the Left End adjustment factor and Right End */ |
| 1225 | /* adjustment factor. They may be different if shrinking. */ |
| 1226 | if (avail <= 0) { |
| 1227 | /* if this band is not shrinkable, then just move it */ |
| 1228 | Leadjust = Readjust = movement; |
| 1229 | ret = movement; |
| 1230 | } |
| 1231 | else { |
| 1232 | if (movement < 0) { |
| 1233 | /* Drag to left */ |
| 1234 | if (avail <= abs(movement)) { |
| 1235 | Readjust = movement; |
| 1236 | Leadjust = movement + avail; |
| 1237 | ret = Leadjust; |
| 1238 | } |
| 1239 | else { |
| 1240 | Readjust = movement; |
| 1241 | Leadjust = 0; |
| 1242 | ret = 0; |
| 1243 | } |
| 1244 | } |
| 1245 | else { |
| 1246 | /* Drag to right */ |
| 1247 | if (avail <= abs(movement)) { |
| 1248 | Leadjust = movement; |
| 1249 | Readjust = movement - avail; |
| 1250 | ret = Readjust; |
| 1251 | } |
| 1252 | else { |
| 1253 | Leadjust = movement; |
| 1254 | Readjust = 0; |
| 1255 | ret = 0; |
| 1256 | } |
| 1257 | } |
| 1258 | } |
| 1259 | |
| 1260 | /* Reasonability Check */ |
| 1261 | if (band->rcBand.left+Leadjust < 0) { |
| 1262 | ERR("adjustment will fail, band %d: left=%d, right=%d, move=%d, rtn=%d\n", |
| 1263 | i, Leadjust, Readjust, movement, ret); |
| 1264 | } |
| 1265 | |
| 1266 | LEADJ(band, Leadjust); |
| 1267 | READJ(band, Readjust); |
| 1268 | |
| 1269 | TRACE("band %d: left=%d, right=%d, move=%d, rtn=%d, rcBand=(%d,%d)-(%d,%d)\n", |
| 1270 | i, Leadjust, Readjust, movement, ret, |
| 1271 | band->rcBand.left, band->rcBand.top, |
| 1272 | band->rcBand.right, band->rcBand.bottom); |
| 1273 | return ret; |
| 1274 | } |
| 1275 | |
| 1276 | |
| 1277 | static void |
| 1278 | REBAR_HandleLRDrag (HWND hwnd, REBAR_INFO *infoPtr, POINTS *ptsmove) |
| 1279 | /* Function: This will implement the functionality of a */ |
| 1280 | /* Gripper drag within a row. It will not implement "out- */ |
| 1281 | /* of-row" drags. (They are detected and handled in */ |
| 1282 | /* REBAR_MouseMove.) */ |
| 1283 | /* **** FIXME Vertical rebars not implemented. **** */ |
| 1284 | /* **** FIXME Switching order of bands in a row not **** */ |
| 1285 | /* **** yet implemented. **** */ |
| 1286 | { |
| 1287 | REBAR_BAND *hitBand, *band, *prevband, *mindBand, *maxdBand; |
| 1288 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); |
| 1289 | HDWP deferpos; |
| 1290 | NMREBARCHILDSIZE cs; |
| 1291 | NMREBAR startdrag; |
| 1292 | RECT newrect; |
| 1293 | INT imindBand = -1, imaxdBand, ihitBand, i, movement, tempx; |
| 1294 | INT RHeaderSum = 0, LHeaderSum = 0; |
| 1295 | INT compress; |
| 1296 | |
| 1297 | /* *** FIXME drag does not work for vertical *** */ |
| 1298 | if (dwStyle & CCS_VERT) { |
| 1299 | FIXME("Drag not yet implemented for vertical rebars\n"); |
| 1300 | return; |
| 1301 | } |
| 1302 | |
| 1303 | /* on first significant mouse movement, issue notify */ |
| 1304 | |
| 1305 | if (!(infoPtr->fStatus & BEGIN_DRAG_ISSUED)) { |
| 1306 | startdrag.dwMask = 0; |
| 1307 | startdrag.uBand = -1; |
| 1308 | REBAR_Notify(hwnd, (NMHDR *) &startdrag, RBN_BEGINDRAG); |
| 1309 | infoPtr->fStatus |= BEGIN_DRAG_ISSUED; |
| 1310 | } |
| 1311 | |
| 1312 | ihitBand = infoPtr->ihitBand; |
| 1313 | hitBand = &infoPtr->bands[ihitBand]; |
| 1314 | imaxdBand = ihitBand; /* to suppress warning message */ |
| 1315 | |
| 1316 | /* find all the bands in the row of the one whose Gripper was seized */ |
| 1317 | for (i=0; i<infoPtr->uNumBands; i++) { |
| 1318 | band = &infoPtr->bands[i]; |
| 1319 | if (band->iRow == hitBand->iRow) { |
| 1320 | imaxdBand = i; |
| 1321 | if (imindBand == -1) imindBand = i; |
| 1322 | /* minimum size of each band is size of header plus */ |
| 1323 | /* size of minimum child plus offset of child from header plus */ |
| 1324 | /* a one to separate each band. */ |
| 1325 | if (i < ihitBand) |
| 1326 | LHeaderSum += (band->cxHeader + band->offChild.cx + |
| 1327 | band->lcx + 1); |
| 1328 | else |
| 1329 | RHeaderSum += (band->cxHeader + band->offChild.cx + |
| 1330 | band->lcx + 1); |
| 1331 | |
| 1332 | } |
| 1333 | } |
| 1334 | if (RHeaderSum) RHeaderSum--; /* no separator afterlast band */ |
| 1335 | |
| 1336 | mindBand = &infoPtr->bands[imindBand]; |
| 1337 | maxdBand = &infoPtr->bands[imaxdBand]; |
| 1338 | |
| 1339 | if (imindBand == imaxdBand) return; /* nothing to drag agains */ |
| 1340 | if (imindBand == ihitBand) return; /* first band in row, cant drag */ |
| 1341 | |
| 1342 | /* limit movement to inside adjustable bands - Left */ |
| 1343 | if (ptsmove->x < mindBand->rcBand.left) |
| 1344 | return; /* should swap bands */ |
| 1345 | /* limit movement to inside adjustable bands - Right */ |
| 1346 | if (ptsmove->x > maxdBand->rcBand.right) |
| 1347 | return; /* should swap bands */ |
| 1348 | |
| 1349 | movement = ptsmove->x - (hitBand->rcGripper.left - infoPtr->ihitoffset); |
| 1350 | infoPtr->dragNow = *ptsmove; |
| 1351 | |
| 1352 | TRACE("before: movement=%d (%d,%d), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n", |
| 1353 | movement, ptsmove->x, ptsmove->y, imindBand, ihitBand, |
| 1354 | imaxdBand, LHeaderSum, RHeaderSum); |
| 1355 | REBAR_DumpBand (hwnd); |
| 1356 | |
| 1357 | if (movement < 0) { |
| 1358 | |
| 1359 | /* *** Drag left *** */ |
| 1360 | compress = hitBand->rcBand.left-1 - mindBand->rcBand.left - |
| 1361 | LHeaderSum; |
| 1362 | if (compress < abs(movement)) { |
| 1363 | TRACE("limiting left drag, was %d changed to %d\n", |
| 1364 | movement, -compress); |
| 1365 | movement = -compress; |
| 1366 | } |
| 1367 | for (i=ihitBand; i>=imindBand; i--) { |
| 1368 | band = &infoPtr->bands[i]; |
| 1369 | if (i == ihitBand) { |
| 1370 | prevband = &infoPtr->bands[i-1]; |
| 1371 | if (band->rcBand.left - movement <= prevband->rcBand.right) { |
| 1372 | tempx = movement - (prevband->rcBand.right-band->rcBand.left+1); |
| 1373 | ERR("movement bad. BUG!! was %d, left=%d, right=%d, setting to %d\n", |
| 1374 | movement, band->rcBand.left, prevband->rcBand.right, tempx); |
| 1375 | movement = tempx; |
| 1376 | } |
| 1377 | LEADJ(band, movement) |
| 1378 | } |
| 1379 | else |
| 1380 | movement = REBAR_Shrink (band, movement, i); |
| 1381 | } |
| 1382 | } |
| 1383 | else { |
| 1384 | |
| 1385 | /* *** Drag right *** */ |
| 1386 | compress = maxdBand->rcBand.right - hitBand->rcBand.left - |
| 1387 | RHeaderSum; |
| 1388 | if (compress < abs(movement)) { |
| 1389 | TRACE("limiting right drag, was %d changed to %d\n", |
| 1390 | movement, compress); |
| 1391 | movement = compress; |
| 1392 | } |
| 1393 | for (i=ihitBand-1; i<=imaxdBand; i++) { |
| 1394 | band = &infoPtr->bands[i]; |
| 1395 | if (i == ihitBand-1) { |
| 1396 | READJ(band, movement) |
| 1397 | } |
| 1398 | else |
| 1399 | movement = REBAR_Shrink (band, movement, i); |
| 1400 | } |
| 1401 | } |
| 1402 | |
| 1403 | TRACE("bands after adjustment, see band # %d, %d\n", |
| 1404 | imindBand, imaxdBand); |
| 1405 | REBAR_DumpBand (hwnd); |
| 1406 | |
| 1407 | SetRect (&newrect, |
| 1408 | mindBand->rcBand.left, |
| 1409 | min(mindBand->rcBand.top, maxdBand->rcBand.top), |
| 1410 | maxdBand->rcBand.right, |
| 1411 | max(mindBand->rcBand.bottom, maxdBand->rcBand.bottom)); |
| 1412 | |
| 1413 | if (!(deferpos = BeginDeferWindowPos (4))) { |
| 1414 | ERR("BeginDeferWindowPos returned NULL\n"); |
| 1415 | } |
| 1416 | |
| 1417 | for (i=imindBand; i<=imaxdBand; i++) { |
| 1418 | band = &infoPtr->bands[i]; |
| 1419 | if ((band->fMask & RBBIM_CHILD) && band->hwndChild) { |
| 1420 | cs.uBand = i; |
| 1421 | cs.wID = band->wID; |
| 1422 | cs.rcChild = band->rcChild; |
| 1423 | cs.rcBand = band->rcBand; |
| 1424 | REBAR_Notify (hwnd, (NMHDR *) &cs, RBN_CHILDSIZE); |
| 1425 | deferpos = DeferWindowPos (deferpos, band->hwndChild, HWND_TOP, |
| 1426 | cs.rcChild.left, cs.rcChild.top, |
| 1427 | cs.rcChild.right - cs.rcChild.left, |
| 1428 | cs.rcChild.bottom - cs.rcChild.top, |
| 1429 | SWP_NOZORDER); |
| 1430 | if (!deferpos) { |
| 1431 | ERR("DeferWindowPos returned NULL\n"); |
| 1432 | } |
| 1433 | } |
| 1434 | } |
| 1435 | |
| 1436 | if (!EndDeferWindowPos (deferpos)) { |
| 1437 | ERR("EndDeferWindowPos failed\n"); |
| 1438 | } |
| 1439 | |
| 1440 | InvalidateRect (hwnd, &newrect, TRUE); |
| 1441 | UpdateWindow (hwnd); |
| 1442 | |
| 1443 | } |
| 1444 | #undef READJ |
| 1445 | #undef LEADJ |
| 1446 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1447 | |
| 1448 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 1449 | /* << REBAR_BeginDrag >> */ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1450 | |
| 1451 | |
| 1452 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1453 | REBAR_DeleteBand (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1454 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1455 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1456 | UINT uBand = (UINT)wParam; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1457 | |
| 1458 | if (uBand >= infoPtr->uNumBands) |
| 1459 | return FALSE; |
| 1460 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1461 | TRACE("deleting band %u!\n", uBand); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1462 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1463 | if (infoPtr->uNumBands == 1) { |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1464 | TRACE(" simple delete!\n"); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1465 | COMCTL32_Free (infoPtr->bands); |
| 1466 | infoPtr->bands = NULL; |
| 1467 | infoPtr->uNumBands = 0; |
| 1468 | } |
| 1469 | else { |
| 1470 | REBAR_BAND *oldBands = infoPtr->bands; |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1471 | TRACE("complex delete! [uBand=%u]\n", uBand); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1472 | |
| 1473 | infoPtr->uNumBands--; |
| 1474 | infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands); |
| 1475 | if (uBand > 0) { |
| 1476 | memcpy (&infoPtr->bands[0], &oldBands[0], |
| 1477 | uBand * sizeof(REBAR_BAND)); |
| 1478 | } |
| 1479 | |
| 1480 | if (uBand < infoPtr->uNumBands) { |
| 1481 | memcpy (&infoPtr->bands[uBand], &oldBands[uBand+1], |
| 1482 | (infoPtr->uNumBands - uBand) * sizeof(REBAR_BAND)); |
| 1483 | } |
| 1484 | |
| 1485 | COMCTL32_Free (oldBands); |
| 1486 | } |
| 1487 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1488 | REBAR_Layout (hwnd, NULL, FALSE, FALSE); |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1489 | REBAR_ForceResize (hwnd); |
| 1490 | REBAR_MoveChildWindows (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1491 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1492 | return TRUE; |
| 1493 | } |
| 1494 | |
| 1495 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 1496 | /* << REBAR_DragMove >> */ |
| 1497 | /* << REBAR_EndDrag >> */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1498 | |
| 1499 | |
| 1500 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1501 | REBAR_GetBandBorders (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1502 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1503 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
James Juran | c2a1063 | 1999-01-28 16:33:44 +0000 | [diff] [blame] | 1504 | /* LPRECT32 lpRect = (LPRECT32)lParam; */ |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 1505 | REBAR_BAND *lpBand; |
| 1506 | |
| 1507 | if (!lParam) |
| 1508 | return 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1509 | if ((UINT)wParam >= infoPtr->uNumBands) |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 1510 | return 0; |
| 1511 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1512 | lpBand = &infoPtr->bands[(UINT)wParam]; |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1513 | if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_BANDBORDERS) { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1514 | /*lpRect.left = ??? */ |
| 1515 | /*lpRect.top = ??? */ |
| 1516 | /*lpRect.right = ??? */ |
| 1517 | /*lpRect.bottom = ??? */ |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 1518 | } |
| 1519 | else { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1520 | /*lpRect.left = ??? */ |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 1521 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1522 | FIXME("stub\n"); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1523 | return 0; |
| 1524 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1525 | |
| 1526 | |
Patrik Stridvall | 896889f | 1999-05-08 12:50:36 +0000 | [diff] [blame] | 1527 | inline static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1528 | REBAR_GetBandCount (HWND hwnd) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1529 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1530 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1531 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1532 | TRACE("band count %u!\n", infoPtr->uNumBands); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1533 | |
| 1534 | return infoPtr->uNumBands; |
| 1535 | } |
| 1536 | |
| 1537 | |
| 1538 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1539 | REBAR_GetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1540 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1541 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1542 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1543 | REBAR_BAND *lpBand; |
| 1544 | |
| 1545 | if (lprbbi == NULL) |
| 1546 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1547 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1548 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1549 | if ((UINT)wParam >= infoPtr->uNumBands) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1550 | return FALSE; |
| 1551 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1552 | TRACE("index %u\n", (UINT)wParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1553 | |
| 1554 | /* copy band information */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1555 | lpBand = &infoPtr->bands[(UINT)wParam]; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1556 | |
| 1557 | if (lprbbi->fMask & RBBIM_STYLE) |
| 1558 | lprbbi->fStyle = lpBand->fStyle; |
| 1559 | |
| 1560 | if (lprbbi->fMask & RBBIM_COLORS) { |
| 1561 | lprbbi->clrFore = lpBand->clrFore; |
| 1562 | lprbbi->clrBack = lpBand->clrBack; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1563 | if (lprbbi->clrBack == CLR_NONE) |
| 1564 | lprbbi->clrBack = GetSysColor (COLOR_BTNFACE); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1565 | } |
| 1566 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1567 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { |
| 1568 | if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT)) |
Alexandre Julliard | 24a62ab | 2000-11-28 22:40:56 +0000 | [diff] [blame] | 1569 | { |
| 1570 | if (!WideCharToMultiByte( CP_ACP, 0, lpBand->lpText, -1, |
| 1571 | lprbbi->lpText, lprbbi->cch, NULL, NULL )) |
| 1572 | lprbbi->lpText[lprbbi->cch-1] = 0; |
| 1573 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1574 | else |
| 1575 | *lprbbi->lpText = 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1576 | } |
| 1577 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1578 | if (lprbbi->fMask & RBBIM_IMAGE) { |
| 1579 | if (lpBand->fMask & RBBIM_IMAGE) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1580 | lprbbi->iImage = lpBand->iImage; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1581 | else |
| 1582 | lprbbi->iImage = -1; |
| 1583 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1584 | |
| 1585 | if (lprbbi->fMask & RBBIM_CHILD) |
| 1586 | lprbbi->hwndChild = lpBand->hwndChild; |
| 1587 | |
| 1588 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { |
| 1589 | lprbbi->cxMinChild = lpBand->cxMinChild; |
| 1590 | lprbbi->cyMinChild = lpBand->cyMinChild; |
| 1591 | lprbbi->cyMaxChild = lpBand->cyMaxChild; |
| 1592 | lprbbi->cyChild = lpBand->cyChild; |
| 1593 | lprbbi->cyIntegral = lpBand->cyIntegral; |
| 1594 | } |
| 1595 | |
| 1596 | if (lprbbi->fMask & RBBIM_SIZE) |
| 1597 | lprbbi->cx = lpBand->cx; |
| 1598 | |
| 1599 | if (lprbbi->fMask & RBBIM_BACKGROUND) |
| 1600 | lprbbi->hbmBack = lpBand->hbmBack; |
| 1601 | |
| 1602 | if (lprbbi->fMask & RBBIM_ID) |
| 1603 | lprbbi->wID = lpBand->wID; |
| 1604 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1605 | /* check for additional data */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1606 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1607 | if (lprbbi->fMask & RBBIM_IDEALSIZE) |
| 1608 | lprbbi->cxIdeal = lpBand->cxIdeal; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1609 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1610 | if (lprbbi->fMask & RBBIM_LPARAM) |
| 1611 | lprbbi->lParam = lpBand->lParam; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1612 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1613 | if (lprbbi->fMask & RBBIM_HEADERSIZE) |
| 1614 | lprbbi->cxHeader = lpBand->cxHeader; |
| 1615 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1616 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1617 | REBAR_DumpBandInfo (lprbbi); |
| 1618 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1619 | return TRUE; |
| 1620 | } |
| 1621 | |
| 1622 | |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1623 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1624 | REBAR_GetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1625 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1626 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1627 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1628 | REBAR_BAND *lpBand; |
| 1629 | |
| 1630 | if (lprbbi == NULL) |
| 1631 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1632 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1633 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1634 | if ((UINT)wParam >= infoPtr->uNumBands) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1635 | return FALSE; |
| 1636 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1637 | TRACE("index %u\n", (UINT)wParam); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1638 | |
| 1639 | /* copy band information */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1640 | lpBand = &infoPtr->bands[(UINT)wParam]; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1641 | |
| 1642 | if (lprbbi->fMask & RBBIM_STYLE) |
| 1643 | lprbbi->fStyle = lpBand->fStyle; |
| 1644 | |
| 1645 | if (lprbbi->fMask & RBBIM_COLORS) { |
| 1646 | lprbbi->clrFore = lpBand->clrFore; |
| 1647 | lprbbi->clrBack = lpBand->clrBack; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1648 | if (lprbbi->clrBack == CLR_NONE) |
| 1649 | lprbbi->clrBack = GetSysColor (COLOR_BTNFACE); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1650 | } |
| 1651 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1652 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { |
| 1653 | if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT)) |
| 1654 | lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch); |
| 1655 | else |
| 1656 | *lprbbi->lpText = 0; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1657 | } |
| 1658 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1659 | if (lprbbi->fMask & RBBIM_IMAGE) { |
| 1660 | if (lpBand->fMask & RBBIM_IMAGE) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1661 | lprbbi->iImage = lpBand->iImage; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1662 | else |
| 1663 | lprbbi->iImage = -1; |
| 1664 | } |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1665 | |
| 1666 | if (lprbbi->fMask & RBBIM_CHILD) |
| 1667 | lprbbi->hwndChild = lpBand->hwndChild; |
| 1668 | |
| 1669 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { |
| 1670 | lprbbi->cxMinChild = lpBand->cxMinChild; |
| 1671 | lprbbi->cyMinChild = lpBand->cyMinChild; |
| 1672 | lprbbi->cyMaxChild = lpBand->cyMaxChild; |
| 1673 | lprbbi->cyChild = lpBand->cyChild; |
| 1674 | lprbbi->cyIntegral = lpBand->cyIntegral; |
| 1675 | } |
| 1676 | |
| 1677 | if (lprbbi->fMask & RBBIM_SIZE) |
| 1678 | lprbbi->cx = lpBand->cx; |
| 1679 | |
| 1680 | if (lprbbi->fMask & RBBIM_BACKGROUND) |
| 1681 | lprbbi->hbmBack = lpBand->hbmBack; |
| 1682 | |
| 1683 | if (lprbbi->fMask & RBBIM_ID) |
| 1684 | lprbbi->wID = lpBand->wID; |
| 1685 | |
| 1686 | /* check for additional data */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1687 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1688 | if (lprbbi->fMask & RBBIM_IDEALSIZE) |
| 1689 | lprbbi->cxIdeal = lpBand->cxIdeal; |
| 1690 | |
| 1691 | if (lprbbi->fMask & RBBIM_LPARAM) |
| 1692 | lprbbi->lParam = lpBand->lParam; |
| 1693 | |
| 1694 | if (lprbbi->fMask & RBBIM_HEADERSIZE) |
| 1695 | lprbbi->cxHeader = lpBand->cxHeader; |
| 1696 | } |
| 1697 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1698 | REBAR_DumpBandInfo ((LPREBARBANDINFOA)lprbbi); |
| 1699 | |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1700 | return TRUE; |
| 1701 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1702 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1703 | |
| 1704 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1705 | REBAR_GetBarHeight (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1706 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1707 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1708 | INT nHeight; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1709 | |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 1710 | nHeight = infoPtr->calcSize.cy; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1711 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1712 | TRACE("height = %d\n", nHeight); |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 1713 | |
| 1714 | return nHeight; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1715 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1716 | |
| 1717 | |
| 1718 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1719 | REBAR_GetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1720 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1721 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1722 | LPREBARINFO lpInfo = (LPREBARINFO)lParam; |
| 1723 | |
| 1724 | if (lpInfo == NULL) |
| 1725 | return FALSE; |
| 1726 | |
| 1727 | if (lpInfo->cbSize < sizeof (REBARINFO)) |
| 1728 | return FALSE; |
| 1729 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1730 | TRACE("getting bar info!\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1731 | |
| 1732 | if (infoPtr->himl) { |
| 1733 | lpInfo->himl = infoPtr->himl; |
| 1734 | lpInfo->fMask |= RBIM_IMAGELIST; |
| 1735 | } |
| 1736 | |
| 1737 | return TRUE; |
| 1738 | } |
| 1739 | |
| 1740 | |
Patrik Stridvall | 896889f | 1999-05-08 12:50:36 +0000 | [diff] [blame] | 1741 | inline static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1742 | REBAR_GetBkColor (HWND hwnd) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1743 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1744 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1745 | COLORREF clr = infoPtr->clrBk; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1746 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1747 | if (clr == CLR_NONE) |
| 1748 | clr = GetSysColor (COLOR_BTNFACE); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1749 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1750 | TRACE("background color 0x%06lx!\n", clr); |
| 1751 | |
| 1752 | return clr; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1753 | } |
| 1754 | |
| 1755 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 1756 | /* << REBAR_GetColorScheme >> */ |
| 1757 | /* << REBAR_GetDropTarget >> */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1758 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1759 | |
| 1760 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1761 | REBAR_GetPalette (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1762 | { |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1763 | FIXME("empty stub!\n"); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1764 | |
| 1765 | return 0; |
| 1766 | } |
| 1767 | |
| 1768 | |
| 1769 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1770 | REBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1771 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1772 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1773 | INT iBand = (INT)wParam; |
| 1774 | LPRECT lprc = (LPRECT)lParam; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1775 | REBAR_BAND *lpBand; |
| 1776 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1777 | if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands)) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1778 | return FALSE; |
| 1779 | if (!lprc) |
| 1780 | return FALSE; |
| 1781 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1782 | lpBand = &infoPtr->bands[iBand]; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1783 | CopyRect (lprc, &lpBand->rcBand); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1784 | |
| 1785 | TRACE("band %d, (%d,%d)-(%d,%d)\n", iBand, |
| 1786 | lprc->left, lprc->top, lprc->right, lprc->bottom); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1787 | |
| 1788 | return TRUE; |
| 1789 | } |
| 1790 | |
| 1791 | |
Patrik Stridvall | 896889f | 1999-05-08 12:50:36 +0000 | [diff] [blame] | 1792 | inline static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1793 | REBAR_GetRowCount (HWND hwnd) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1794 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1795 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1796 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1797 | TRACE("%u\n", infoPtr->uNumRows); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1798 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1799 | return infoPtr->uNumRows; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1800 | } |
| 1801 | |
| 1802 | |
| 1803 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1804 | REBAR_GetRowHeight (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1805 | { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1806 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
| 1807 | INT iRow = (INT)wParam; |
| 1808 | int ret = 0; |
| 1809 | int i, j = 0; |
| 1810 | REBAR_BAND *lpBand; |
| 1811 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1812 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1813 | for (i=0; i<infoPtr->uNumBands; i++) { |
| 1814 | lpBand = &infoPtr->bands[i]; |
| 1815 | if (lpBand->iRow != iRow) continue; |
| 1816 | if (dwStyle & CCS_VERT) |
| 1817 | j = lpBand->rcBand.right - lpBand->rcBand.left; |
| 1818 | else |
| 1819 | j = lpBand->rcBand.bottom - lpBand->rcBand.top; |
| 1820 | if (j > ret) ret = j; |
| 1821 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1822 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1823 | TRACE("row %d, height %d\n", iRow, ret); |
| 1824 | |
| 1825 | return ret; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1826 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1827 | |
| 1828 | |
Patrik Stridvall | 896889f | 1999-05-08 12:50:36 +0000 | [diff] [blame] | 1829 | inline static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1830 | REBAR_GetTextColor (HWND hwnd) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1831 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1832 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1833 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1834 | TRACE("text color 0x%06lx!\n", infoPtr->clrText); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1835 | |
| 1836 | return infoPtr->clrText; |
| 1837 | } |
| 1838 | |
| 1839 | |
Patrik Stridvall | 896889f | 1999-05-08 12:50:36 +0000 | [diff] [blame] | 1840 | inline static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1841 | REBAR_GetToolTips (HWND hwnd) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1842 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1843 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1844 | return infoPtr->hwndToolTip; |
| 1845 | } |
| 1846 | |
| 1847 | |
Patrik Stridvall | 896889f | 1999-05-08 12:50:36 +0000 | [diff] [blame] | 1848 | inline static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1849 | REBAR_GetUnicodeFormat (HWND hwnd) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1850 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1851 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1852 | return infoPtr->bUnicode; |
| 1853 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1854 | |
| 1855 | |
Eric Kohl | 70e0969 | 1999-11-23 23:38:22 +0000 | [diff] [blame] | 1856 | inline static LRESULT |
| 1857 | REBAR_GetVersion (HWND hwnd) |
| 1858 | { |
| 1859 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1860 | TRACE("version %d\n", infoPtr->iVersion); |
Eric Kohl | 70e0969 | 1999-11-23 23:38:22 +0000 | [diff] [blame] | 1861 | return infoPtr->iVersion; |
| 1862 | } |
| 1863 | |
| 1864 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1865 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1866 | REBAR_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1867 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1868 | /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1869 | LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; |
| 1870 | |
| 1871 | if (!lprbht) |
| 1872 | return -1; |
| 1873 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1874 | REBAR_InternalHitTest (hwnd, &lprbht->pt, &lprbht->flags, &lprbht->iBand); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1875 | |
| 1876 | return lprbht->iBand; |
| 1877 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1878 | |
| 1879 | |
| 1880 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1881 | REBAR_IdToIndex (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1882 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1883 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1884 | UINT i; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1885 | |
| 1886 | if (infoPtr == NULL) |
| 1887 | return -1; |
| 1888 | |
| 1889 | if (infoPtr->uNumBands < 1) |
| 1890 | return -1; |
| 1891 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1892 | for (i = 0; i < infoPtr->uNumBands; i++) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1893 | if (infoPtr->bands[i].wID == (UINT)wParam) { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1894 | TRACE("id %u is band %u found!\n", (UINT)wParam, i); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1895 | return i; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1896 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1897 | } |
| 1898 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1899 | TRACE("id %u is not found\n", (UINT)wParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1900 | return -1; |
| 1901 | } |
| 1902 | |
| 1903 | |
| 1904 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1905 | REBAR_InsertBandA (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1906 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1907 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1908 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; |
| 1909 | UINT uIndex = (UINT)wParam; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1910 | REBAR_BAND *lpBand; |
| 1911 | |
| 1912 | if (infoPtr == NULL) |
| 1913 | return FALSE; |
| 1914 | if (lprbbi == NULL) |
| 1915 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1916 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1917 | return FALSE; |
| 1918 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1919 | /* trace the index as signed to see the -1 */ |
| 1920 | TRACE("insert band at %d!\n", (INT)uIndex); |
| 1921 | REBAR_DumpBandInfo (lprbbi); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1922 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1923 | if (infoPtr->uNumBands == 0) { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1924 | infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1925 | uIndex = 0; |
| 1926 | } |
| 1927 | else { |
| 1928 | REBAR_BAND *oldBands = infoPtr->bands; |
| 1929 | infoPtr->bands = |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 1930 | (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1931 | if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1932 | uIndex = infoPtr->uNumBands; |
| 1933 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1934 | /* pre insert copy */ |
| 1935 | if (uIndex > 0) { |
| 1936 | memcpy (&infoPtr->bands[0], &oldBands[0], |
| 1937 | uIndex * sizeof(REBAR_BAND)); |
| 1938 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1939 | |
| 1940 | /* post copy */ |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1941 | if (uIndex < infoPtr->uNumBands - 1) { |
| 1942 | memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], |
| 1943 | (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); |
| 1944 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1945 | |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1946 | COMCTL32_Free (oldBands); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1947 | } |
| 1948 | |
| 1949 | infoPtr->uNumBands++; |
| 1950 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 1951 | TRACE("index %u!\n", uIndex); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1952 | |
| 1953 | /* initialize band (infoPtr->bands[uIndex])*/ |
| 1954 | lpBand = &infoPtr->bands[uIndex]; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1955 | lpBand->fMask = 0; |
| 1956 | lpBand->clrFore = infoPtr->clrText; |
| 1957 | lpBand->clrBack = infoPtr->clrBk; |
| 1958 | lpBand->hwndChild = 0; |
| 1959 | lpBand->hwndPrevParent = 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1960 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1961 | REBAR_CommonSetupBand (hwnd, lprbbi, lpBand); |
| 1962 | lpBand->lpText = NULL; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1963 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { |
Alexandre Julliard | 24a62ab | 2000-11-28 22:40:56 +0000 | [diff] [blame] | 1964 | INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 ); |
| 1965 | if (len > 1) { |
| 1966 | lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR)); |
| 1967 | MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len ); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1968 | } |
| 1969 | } |
| 1970 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1971 | REBAR_ValidateBand (hwnd, infoPtr, lpBand); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1972 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1973 | REBAR_DumpBand (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1974 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1975 | REBAR_Layout (hwnd, NULL, FALSE, FALSE); |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1976 | REBAR_ForceResize (hwnd); |
| 1977 | REBAR_MoveChildWindows (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 1978 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1979 | return TRUE; |
| 1980 | } |
| 1981 | |
| 1982 | |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1983 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1984 | REBAR_InsertBandW (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1985 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 1986 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1987 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; |
| 1988 | UINT uIndex = (UINT)wParam; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1989 | REBAR_BAND *lpBand; |
| 1990 | |
| 1991 | if (infoPtr == NULL) |
| 1992 | return FALSE; |
| 1993 | if (lprbbi == NULL) |
| 1994 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1995 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 1996 | return FALSE; |
| 1997 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 1998 | /* trace the index as signed to see the -1 */ |
| 1999 | TRACE("insert band at %d!\n", (INT)uIndex); |
| 2000 | REBAR_DumpBandInfo ((LPREBARBANDINFOA)lprbbi); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2001 | |
| 2002 | if (infoPtr->uNumBands == 0) { |
| 2003 | infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); |
| 2004 | uIndex = 0; |
| 2005 | } |
| 2006 | else { |
| 2007 | REBAR_BAND *oldBands = infoPtr->bands; |
| 2008 | infoPtr->bands = |
| 2009 | (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2010 | if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2011 | uIndex = infoPtr->uNumBands; |
| 2012 | |
| 2013 | /* pre insert copy */ |
| 2014 | if (uIndex > 0) { |
| 2015 | memcpy (&infoPtr->bands[0], &oldBands[0], |
| 2016 | uIndex * sizeof(REBAR_BAND)); |
| 2017 | } |
| 2018 | |
| 2019 | /* post copy */ |
| 2020 | if (uIndex < infoPtr->uNumBands - 1) { |
| 2021 | memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], |
| 2022 | (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); |
| 2023 | } |
| 2024 | |
| 2025 | COMCTL32_Free (oldBands); |
| 2026 | } |
| 2027 | |
| 2028 | infoPtr->uNumBands++; |
| 2029 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2030 | TRACE("index %u!\n", uIndex); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2031 | |
| 2032 | /* initialize band (infoPtr->bands[uIndex])*/ |
| 2033 | lpBand = &infoPtr->bands[uIndex]; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2034 | lpBand->fMask = 0; |
| 2035 | lpBand->clrFore = infoPtr->clrText; |
| 2036 | lpBand->clrBack = infoPtr->clrBk; |
| 2037 | lpBand->hwndChild = 0; |
| 2038 | lpBand->hwndPrevParent = 0; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2039 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2040 | REBAR_CommonSetupBand (hwnd, (LPREBARBANDINFOA)lprbbi, lpBand); |
| 2041 | lpBand->lpText = NULL; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2042 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2043 | INT len = lstrlenW (lprbbi->lpText); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2044 | if (len > 0) { |
| 2045 | lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); |
Alexandre Julliard | c7e7df8 | 2000-08-14 14:41:19 +0000 | [diff] [blame] | 2046 | strcpyW (lpBand->lpText, lprbbi->lpText); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2047 | } |
| 2048 | } |
| 2049 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2050 | REBAR_ValidateBand (hwnd, infoPtr, lpBand); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2051 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2052 | REBAR_DumpBand (hwnd); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2053 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2054 | REBAR_Layout (hwnd, NULL, FALSE, FALSE); |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2055 | REBAR_ForceResize (hwnd); |
| 2056 | REBAR_MoveChildWindows (hwnd); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2057 | |
| 2058 | return TRUE; |
| 2059 | } |
| 2060 | |
| 2061 | |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2062 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2063 | REBAR_MaximizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2064 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2065 | /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2066 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2067 | FIXME("(uBand = %u fIdeal = %s)\n", |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2068 | (UINT)wParam, lParam ? "TRUE" : "FALSE"); |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2069 | |
| 2070 | |
| 2071 | return 0; |
| 2072 | } |
| 2073 | |
| 2074 | |
| 2075 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2076 | REBAR_MinimizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2077 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2078 | /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2079 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2080 | FIXME("(uBand = %u)\n", (UINT)wParam); |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2081 | |
| 2082 | |
| 2083 | return 0; |
| 2084 | } |
| 2085 | |
| 2086 | |
| 2087 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2088 | REBAR_MoveBand (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2089 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2090 | /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2091 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2092 | FIXME("(iFrom = %u iTof = %u)\n", |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2093 | (UINT)wParam, (UINT)lParam); |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2094 | |
| 2095 | |
| 2096 | return FALSE; |
| 2097 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2098 | |
| 2099 | |
| 2100 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2101 | REBAR_SetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2102 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2103 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2104 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2105 | REBAR_BAND *lpBand; |
| 2106 | |
| 2107 | if (lprbbi == NULL) |
| 2108 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2109 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2110 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2111 | if ((UINT)wParam >= infoPtr->uNumBands) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2112 | return FALSE; |
| 2113 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2114 | TRACE("index %u\n", (UINT)wParam); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2115 | REBAR_DumpBandInfo (lprbbi); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2116 | |
| 2117 | /* set band information */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2118 | lpBand = &infoPtr->bands[(UINT)wParam]; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2119 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2120 | REBAR_CommonSetupBand (hwnd, lprbbi, lpBand); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2121 | if (lprbbi->fMask & RBBIM_TEXT) { |
| 2122 | if (lpBand->lpText) { |
| 2123 | COMCTL32_Free (lpBand->lpText); |
| 2124 | lpBand->lpText = NULL; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2125 | } |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2126 | if (lprbbi->lpText) { |
Alexandre Julliard | 24a62ab | 2000-11-28 22:40:56 +0000 | [diff] [blame] | 2127 | INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 ); |
| 2128 | lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR)); |
| 2129 | MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len ); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2130 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2131 | } |
| 2132 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2133 | REBAR_ValidateBand (hwnd, infoPtr, lpBand); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2134 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2135 | REBAR_DumpBand (hwnd); |
| 2136 | |
| 2137 | if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) { |
| 2138 | REBAR_Layout (hwnd, NULL, TRUE, FALSE); |
| 2139 | REBAR_ForceResize (hwnd); |
| 2140 | REBAR_MoveChildWindows (hwnd); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2141 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2142 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2143 | return TRUE; |
| 2144 | } |
| 2145 | |
| 2146 | |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2147 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2148 | REBAR_SetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2149 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2150 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2151 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2152 | REBAR_BAND *lpBand; |
| 2153 | |
| 2154 | if (lprbbi == NULL) |
| 2155 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2156 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2157 | return FALSE; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2158 | if ((UINT)wParam >= infoPtr->uNumBands) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2159 | return FALSE; |
| 2160 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2161 | TRACE("index %u\n", (UINT)wParam); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2162 | REBAR_DumpBandInfo ((LPREBARBANDINFOA)lprbbi); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2163 | |
| 2164 | /* set band information */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2165 | lpBand = &infoPtr->bands[(UINT)wParam]; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2166 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2167 | REBAR_CommonSetupBand (hwnd, (LPREBARBANDINFOA)lprbbi, lpBand); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2168 | if (lprbbi->fMask & RBBIM_TEXT) { |
| 2169 | if (lpBand->lpText) { |
| 2170 | COMCTL32_Free (lpBand->lpText); |
| 2171 | lpBand->lpText = NULL; |
| 2172 | } |
| 2173 | if (lprbbi->lpText) { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2174 | INT len = lstrlenW (lprbbi->lpText); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2175 | lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); |
Alexandre Julliard | c7e7df8 | 2000-08-14 14:41:19 +0000 | [diff] [blame] | 2176 | strcpyW (lpBand->lpText, lprbbi->lpText); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2177 | } |
| 2178 | } |
| 2179 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2180 | REBAR_ValidateBand (hwnd, infoPtr, lpBand); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2181 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2182 | REBAR_DumpBand (hwnd); |
| 2183 | |
| 2184 | if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE)) { |
| 2185 | REBAR_Layout (hwnd, NULL, TRUE, FALSE); |
| 2186 | REBAR_ForceResize (hwnd); |
| 2187 | REBAR_MoveChildWindows (hwnd); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2188 | } |
| 2189 | |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2190 | return TRUE; |
| 2191 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2192 | |
| 2193 | |
| 2194 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2195 | REBAR_SetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2196 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2197 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2198 | LPREBARINFO lpInfo = (LPREBARINFO)lParam; |
| 2199 | |
| 2200 | if (lpInfo == NULL) |
| 2201 | return FALSE; |
| 2202 | |
| 2203 | if (lpInfo->cbSize < sizeof (REBARINFO)) |
| 2204 | return FALSE; |
| 2205 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2206 | TRACE("setting bar info!\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2207 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2208 | if (lpInfo->fMask & RBIM_IMAGELIST) { |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2209 | infoPtr->himl = lpInfo->himl; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2210 | if (infoPtr->himl) { |
Alexandre Julliard | 072dfb5 | 2000-09-25 23:30:56 +0000 | [diff] [blame] | 2211 | INT cx, cy; |
| 2212 | ImageList_GetIconSize (infoPtr->himl, &cx, &cy); |
| 2213 | infoPtr->imageSize.cx = cx; |
| 2214 | infoPtr->imageSize.cy = cy; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2215 | } |
| 2216 | else { |
| 2217 | infoPtr->imageSize.cx = 0; |
| 2218 | infoPtr->imageSize.cy = 0; |
| 2219 | } |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2220 | TRACE("new image cx=%ld, cy=%ld\n", infoPtr->imageSize.cx, |
| 2221 | infoPtr->imageSize.cy); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2222 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2223 | |
| 2224 | return TRUE; |
| 2225 | } |
| 2226 | |
| 2227 | |
| 2228 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2229 | REBAR_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2230 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2231 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2232 | COLORREF clrTemp; |
| 2233 | |
| 2234 | clrTemp = infoPtr->clrBk; |
| 2235 | infoPtr->clrBk = (COLORREF)lParam; |
| 2236 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2237 | TRACE("background color 0x%06lx!\n", infoPtr->clrBk); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2238 | |
| 2239 | return clrTemp; |
| 2240 | } |
| 2241 | |
| 2242 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2243 | /* << REBAR_SetColorScheme >> */ |
| 2244 | /* << REBAR_SetPalette >> */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2245 | |
| 2246 | |
| 2247 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2248 | REBAR_SetParent (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2249 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2250 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2251 | HWND hwndTemp = infoPtr->hwndNotify; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2252 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2253 | infoPtr->hwndNotify = (HWND)wParam; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2254 | |
| 2255 | return (LRESULT)hwndTemp; |
| 2256 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2257 | |
| 2258 | |
| 2259 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2260 | REBAR_SetTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2261 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2262 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2263 | COLORREF clrTemp; |
| 2264 | |
| 2265 | clrTemp = infoPtr->clrText; |
| 2266 | infoPtr->clrText = (COLORREF)lParam; |
| 2267 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2268 | TRACE("text color 0x%06lx!\n", infoPtr->clrText); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2269 | |
| 2270 | return clrTemp; |
| 2271 | } |
| 2272 | |
| 2273 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2274 | /* << REBAR_SetTooltips >> */ |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2275 | |
| 2276 | |
Patrik Stridvall | 896889f | 1999-05-08 12:50:36 +0000 | [diff] [blame] | 2277 | inline static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2278 | REBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam) |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2279 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2280 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2281 | BOOL bTemp = infoPtr->bUnicode; |
| 2282 | infoPtr->bUnicode = (BOOL)wParam; |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2283 | return bTemp; |
| 2284 | } |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2285 | |
| 2286 | |
| 2287 | static LRESULT |
Eric Kohl | 70e0969 | 1999-11-23 23:38:22 +0000 | [diff] [blame] | 2288 | REBAR_SetVersion (HWND hwnd, INT iVersion) |
| 2289 | { |
| 2290 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
| 2291 | INT iOldVersion = infoPtr->iVersion; |
| 2292 | |
| 2293 | if (iVersion > COMCTL32_VERSION) |
| 2294 | return -1; |
| 2295 | |
| 2296 | infoPtr->iVersion = iVersion; |
| 2297 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2298 | TRACE("new version %d\n", iVersion); |
| 2299 | |
Eric Kohl | 70e0969 | 1999-11-23 23:38:22 +0000 | [diff] [blame] | 2300 | return iOldVersion; |
| 2301 | } |
| 2302 | |
| 2303 | |
| 2304 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2305 | REBAR_ShowBand (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2306 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2307 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2308 | REBAR_BAND *lpBand; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2309 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2310 | if (((INT)wParam < 0) || ((INT)wParam > infoPtr->uNumBands)) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2311 | return FALSE; |
| 2312 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2313 | lpBand = &infoPtr->bands[(INT)wParam]; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2314 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2315 | if ((BOOL)lParam) { |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2316 | TRACE("show band %d\n", (INT)wParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2317 | lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2318 | if (IsWindow (lpBand->hwndChild)) |
| 2319 | ShowWindow (lpBand->hwndChild, SW_SHOW); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2320 | } |
| 2321 | else { |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2322 | TRACE("hide band %d\n", (INT)wParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2323 | lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2324 | if (IsWindow (lpBand->hwndChild)) |
| 2325 | ShowWindow (lpBand->hwndChild, SW_SHOW); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2326 | } |
| 2327 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2328 | REBAR_Layout (hwnd, NULL, TRUE, FALSE); |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2329 | REBAR_ForceResize (hwnd); |
| 2330 | REBAR_MoveChildWindows (hwnd); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2331 | |
| 2332 | return TRUE; |
| 2333 | } |
| 2334 | |
| 2335 | |
| 2336 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2337 | REBAR_SizeToRect (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2338 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2339 | LPRECT lpRect = (LPRECT)lParam; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2340 | RECT t1; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2341 | |
| 2342 | if (lpRect == NULL) |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2343 | return FALSE; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2344 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2345 | TRACE("[%d %d %d %d]\n", |
| 2346 | lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2347 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2348 | /* what is going on???? */ |
| 2349 | GetWindowRect(hwnd, &t1); |
| 2350 | TRACE("window rect [%d %d %d %d]\n", |
| 2351 | t1.left, t1.top, t1.right, t1.bottom); |
| 2352 | GetClientRect(hwnd, &t1); |
| 2353 | TRACE("client rect [%d %d %d %d]\n", |
| 2354 | t1.left, t1.top, t1.right, t1.bottom); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2355 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2356 | REBAR_Layout (hwnd, lpRect, TRUE, FALSE); |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2357 | REBAR_ForceResize (hwnd); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2358 | REBAR_MoveChildWindows (hwnd); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2359 | return TRUE; |
| 2360 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2361 | |
| 2362 | |
| 2363 | |
| 2364 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2365 | REBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2366 | { |
| 2367 | REBAR_INFO *infoPtr; |
| 2368 | |
| 2369 | /* allocate memory for info structure */ |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2370 | infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO)); |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2371 | SetWindowLongA (hwnd, 0, (DWORD)infoPtr); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2372 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2373 | /* initialize info structure */ |
Eric Kohl | 70e0969 | 1999-11-23 23:38:22 +0000 | [diff] [blame] | 2374 | infoPtr->iVersion = 0; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2375 | infoPtr->clrBk = CLR_NONE; |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2376 | infoPtr->clrText = GetSysColor (COLOR_BTNTEXT); |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2377 | infoPtr->ihitBand = -1; |
| 2378 | infoPtr->fStatus = 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2379 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2380 | infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA); |
| 2381 | infoPtr->hcurHorz = LoadCursorA (0, IDC_SIZEWEA); |
| 2382 | infoPtr->hcurVert = LoadCursorA (0, IDC_SIZENSA); |
| 2383 | infoPtr->hcurDrag = LoadCursorA (0, IDC_SIZEA); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2384 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2385 | infoPtr->bUnicode = IsWindowUnicode (hwnd); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2386 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2387 | if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_AUTOSIZE) |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2388 | FIXME("style RBS_AUTOSIZE set!\n"); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2389 | |
| 2390 | #if 0 |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2391 | SendMessageA (hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2392 | #endif |
| 2393 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2394 | TRACE("created!\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2395 | return 0; |
| 2396 | } |
| 2397 | |
| 2398 | |
| 2399 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2400 | REBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2401 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2402 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2403 | REBAR_BAND *lpBand; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2404 | INT i; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2405 | |
| 2406 | |
| 2407 | /* free rebar bands */ |
| 2408 | if ((infoPtr->uNumBands > 0) && infoPtr->bands) { |
| 2409 | /* clean up each band */ |
| 2410 | for (i = 0; i < infoPtr->uNumBands; i++) { |
| 2411 | lpBand = &infoPtr->bands[i]; |
| 2412 | |
| 2413 | /* delete text strings */ |
| 2414 | if (lpBand->lpText) { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2415 | COMCTL32_Free (lpBand->lpText); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2416 | lpBand->lpText = NULL; |
| 2417 | } |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 2418 | /* destroy child window */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2419 | DestroyWindow (lpBand->hwndChild); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2420 | } |
| 2421 | |
| 2422 | /* free band array */ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2423 | COMCTL32_Free (infoPtr->bands); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2424 | infoPtr->bands = NULL; |
| 2425 | } |
| 2426 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2427 | DeleteObject (infoPtr->hcurArrow); |
| 2428 | DeleteObject (infoPtr->hcurHorz); |
| 2429 | DeleteObject (infoPtr->hcurVert); |
| 2430 | DeleteObject (infoPtr->hcurDrag); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2431 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2432 | /* free rebar info data */ |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2433 | COMCTL32_Free (infoPtr); |
Gerard Patel | a1b2fc2 | 2000-05-10 01:34:53 +0000 | [diff] [blame] | 2434 | SetWindowLongA (hwnd, 0, 0); |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2435 | TRACE("destroyed!\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2436 | return 0; |
| 2437 | } |
| 2438 | |
| 2439 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2440 | static LRESULT |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2441 | REBAR_EraseBkGnd (HWND hwnd, WPARAM wParam, LPARAM lParam) |
| 2442 | { |
| 2443 | RECT cliprect; |
| 2444 | |
| 2445 | if (GetClipBox ( (HDC)wParam, &cliprect)) |
| 2446 | return REBAR_InternalEraseBkGnd (hwnd, wParam, lParam, &cliprect); |
| 2447 | return 0; |
| 2448 | } |
| 2449 | |
| 2450 | |
| 2451 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2452 | REBAR_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2453 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2454 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2455 | |
| 2456 | return (LRESULT)infoPtr->hFont; |
| 2457 | } |
| 2458 | |
| 2459 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2460 | static LRESULT |
| 2461 | REBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) |
| 2462 | { |
| 2463 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
| 2464 | REBAR_BAND *lpBand; |
| 2465 | |
| 2466 | /* If InternalHitTest did not find a hit on the Gripper, */ |
| 2467 | /* then ignore the button click. */ |
| 2468 | if (infoPtr->ihitBand == -1) return 0; |
| 2469 | |
| 2470 | SetCapture (hwnd); |
| 2471 | |
| 2472 | /* save off the LOWORD and HIWORD of lParam as initial x,y */ |
| 2473 | lpBand = &infoPtr->bands[infoPtr->ihitBand]; |
| 2474 | infoPtr->dragStart = MAKEPOINTS(lParam); |
| 2475 | infoPtr->dragNow = infoPtr->dragStart; |
| 2476 | infoPtr->ihitoffset = infoPtr->dragStart.x - lpBand->rcGripper.left; |
| 2477 | |
| 2478 | return 0; |
| 2479 | } |
| 2480 | |
| 2481 | |
| 2482 | static LRESULT |
| 2483 | REBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) |
| 2484 | { |
| 2485 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
| 2486 | NMHDR layout; |
| 2487 | NMREBAR enddrag; |
| 2488 | RECT rect; |
| 2489 | |
| 2490 | /* If InternalHitTest did not find a hit on the Gripper, */ |
| 2491 | /* then ignore the button click. */ |
| 2492 | if (infoPtr->ihitBand == -1) return 0; |
| 2493 | |
| 2494 | infoPtr->dragStart.x = 0; |
| 2495 | infoPtr->dragStart.y = 0; |
| 2496 | infoPtr->dragNow = infoPtr->dragStart; |
| 2497 | infoPtr->ihitBand = -1; |
| 2498 | |
| 2499 | ReleaseCapture (); |
| 2500 | |
| 2501 | if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) { |
| 2502 | REBAR_Notify(hwnd, (NMHDR *) &layout, RBN_LAYOUTCHANGED); |
| 2503 | |
| 2504 | enddrag.dwMask = 0; |
| 2505 | enddrag.uBand = -1; |
| 2506 | REBAR_Notify(hwnd, (NMHDR *) &enddrag, RBN_ENDDRAG); |
| 2507 | infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED; |
| 2508 | } |
| 2509 | |
| 2510 | GetClientRect(hwnd, &rect); |
| 2511 | InvalidateRect(hwnd, NULL, TRUE); |
| 2512 | |
| 2513 | return 0; |
| 2514 | } |
| 2515 | |
| 2516 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2517 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2518 | REBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2519 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2520 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2521 | REBAR_BAND *band1, *band2; |
| 2522 | POINTS ptsmove; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2523 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2524 | /* Validate entry as hit on Gripper has occured */ |
| 2525 | if (GetCapture() != hwnd) return 0; |
| 2526 | if (infoPtr->ihitBand == -1) return 0; |
| 2527 | |
| 2528 | ptsmove = MAKEPOINTS(lParam); |
| 2529 | |
| 2530 | /* if mouse did not move much, exit */ |
| 2531 | if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) && |
| 2532 | (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0; |
| 2533 | |
| 2534 | band1 = &infoPtr->bands[infoPtr->ihitBand-1]; |
| 2535 | band2 = &infoPtr->bands[infoPtr->ihitBand]; |
| 2536 | |
| 2537 | /* Test for valid drag case - must not be first band in row */ |
| 2538 | if ((ptsmove.y < band2->rcBand.top) || |
| 2539 | (ptsmove.y > band2->rcBand.bottom) || |
| 2540 | ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) { |
| 2541 | FIXME("Cannot drag to other rows yet!!\n"); |
| 2542 | } |
| 2543 | else { |
| 2544 | REBAR_HandleLRDrag (hwnd, infoPtr, &ptsmove); |
| 2545 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2546 | return 0; |
| 2547 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2548 | |
| 2549 | |
Patrik Stridvall | 896889f | 1999-05-08 12:50:36 +0000 | [diff] [blame] | 2550 | inline static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2551 | REBAR_NCCalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2552 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2553 | if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) { |
Marcus Meissner | 9f3eb19 | 1999-05-22 11:22:36 +0000 | [diff] [blame] | 2554 | ((LPRECT)lParam)->left += GetSystemMetrics(SM_CXEDGE); |
| 2555 | ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); |
| 2556 | ((LPRECT)lParam)->right -= GetSystemMetrics(SM_CXEDGE); |
| 2557 | ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2558 | } |
| 2559 | |
Eric Kohl | 1246185 | 1998-11-08 11:31:12 +0000 | [diff] [blame] | 2560 | return 0; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2561 | } |
| 2562 | |
| 2563 | |
| 2564 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2565 | REBAR_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2566 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2567 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); |
| 2568 | RECT rcWindow; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2569 | HDC hdc; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2570 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2571 | if (dwStyle & WS_MINIMIZE) |
| 2572 | return 0; /* Nothing to do */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2573 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2574 | DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2575 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2576 | if (!(hdc = GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2577 | return 0; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2578 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2579 | if (dwStyle & WS_BORDER) { |
| 2580 | GetWindowRect (hwnd, &rcWindow); |
| 2581 | OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); |
| 2582 | DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); |
| 2583 | } |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2584 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2585 | ReleaseDC( hwnd, hdc ); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2586 | |
| 2587 | return 0; |
| 2588 | } |
| 2589 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2590 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2591 | static LRESULT |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2592 | REBAR_Paint (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2593 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2594 | HDC hdc; |
| 2595 | PAINTSTRUCT ps; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2596 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2597 | hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2598 | |
| 2599 | if (ps.fErase) { |
| 2600 | /* Erase area of paint if requested */ |
| 2601 | REBAR_InternalEraseBkGnd (hwnd, wParam, lParam, &ps.rcPaint); |
| 2602 | } |
| 2603 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2604 | REBAR_Refresh (hwnd, hdc); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2605 | if (!wParam) |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2606 | EndPaint (hwnd, &ps); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2607 | return 0; |
| 2608 | } |
| 2609 | |
| 2610 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2611 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2612 | REBAR_SetCursor (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2613 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2614 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
| 2615 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2616 | POINT pt; |
| 2617 | UINT flags; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2618 | |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2619 | TRACE("code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam)); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2620 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2621 | GetCursorPos (&pt); |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2622 | ScreenToClient (hwnd, &pt); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2623 | |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2624 | REBAR_InternalHitTest (hwnd, &pt, &flags, NULL); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2625 | |
| 2626 | if (flags == RBHT_GRABBER) { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2627 | if ((dwStyle & CCS_VERT) && |
| 2628 | !(dwStyle & RBS_VERTICALGRIPPER)) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2629 | SetCursor (infoPtr->hcurVert); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2630 | else |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2631 | SetCursor (infoPtr->hcurHorz); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2632 | } |
| 2633 | else if (flags != RBHT_CLIENT) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2634 | SetCursor (infoPtr->hcurArrow); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2635 | |
| 2636 | return 0; |
| 2637 | } |
| 2638 | |
| 2639 | |
| 2640 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2641 | REBAR_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2642 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2643 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
James Juran | c2a1063 | 1999-01-28 16:33:44 +0000 | [diff] [blame] | 2644 | |
| 2645 | /* TEXTMETRIC32A tm; */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2646 | HFONT hFont /*, hOldFont */; |
James Juran | c2a1063 | 1999-01-28 16:33:44 +0000 | [diff] [blame] | 2647 | /* HDC32 hdc; */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2648 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2649 | infoPtr->hFont = (HFONT)wParam; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2650 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2651 | hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2652 | /* |
| 2653 | hdc = GetDC32 (0); |
| 2654 | hOldFont = SelectObject32 (hdc, hFont); |
| 2655 | GetTextMetrics32A (hdc, &tm); |
| 2656 | infoPtr->nHeight = tm.tmHeight + VERT_BORDER; |
| 2657 | SelectObject32 (hdc, hOldFont); |
| 2658 | ReleaseDC32 (0, hdc); |
| 2659 | */ |
| 2660 | if (lParam) { |
| 2661 | /* |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2662 | REBAR_Layout (hwnd); |
| 2663 | hdc = GetDC32 (hwnd); |
| 2664 | REBAR_Refresh (hwnd, hdc); |
| 2665 | ReleaseDC32 (hwnd, hdc); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2666 | */ |
| 2667 | } |
| 2668 | |
| 2669 | return 0; |
| 2670 | } |
| 2671 | |
| 2672 | static LRESULT |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2673 | REBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2674 | { |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2675 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2676 | RECT rcClient; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2677 | |
| 2678 | /* auto resize deadlock check */ |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2679 | if (infoPtr->fStatus & AUTO_RESIZE) { |
| 2680 | infoPtr->fStatus &= ~AUTO_RESIZE; |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2681 | return 0; |
| 2682 | } |
| 2683 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2684 | GetClientRect (hwnd, &rcClient); |
| 2685 | if ((lParam == 0) && (rcClient.right == 0) && (rcClient.bottom == 0)) { |
| 2686 | /* native control seems to do this */ |
| 2687 | GetClientRect (GetParent(hwnd), &rcClient); |
| 2688 | TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", |
| 2689 | rcClient.right, rcClient.bottom); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2690 | } |
| 2691 | else { |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2692 | TRACE("sizing rebar to (%d,%d), client (%d,%d)\n", |
| 2693 | LOWORD(lParam), HIWORD(lParam), rcClient.right, rcClient.bottom); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2694 | } |
| 2695 | |
Guy L. Albertelli | f82e493 | 2000-10-12 23:09:01 +0000 | [diff] [blame] | 2696 | REBAR_Layout (hwnd, &rcClient, FALSE, TRUE); |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2697 | REBAR_ForceResize (hwnd); |
| 2698 | REBAR_MoveChildWindows (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2699 | |
| 2700 | return 0; |
| 2701 | } |
| 2702 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2703 | |
Patrik Stridvall | 26ffb3c | 1999-07-31 14:41:43 +0000 | [diff] [blame] | 2704 | static LRESULT WINAPI |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2705 | REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2706 | { |
Gerard Patel | a1b2fc2 | 2000-05-10 01:34:53 +0000 | [diff] [blame] | 2707 | TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam); |
| 2708 | if (!REBAR_GetInfoPtr (hwnd) && (uMsg != WM_CREATE)) |
| 2709 | return DefWindowProcA (hwnd, uMsg, wParam, lParam); |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2710 | switch (uMsg) |
| 2711 | { |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2712 | /* case RB_BEGINDRAG: */ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2713 | |
| 2714 | case RB_DELETEBAND: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2715 | return REBAR_DeleteBand (hwnd, wParam, lParam); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 2716 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2717 | /* case RB_DRAGMOVE: */ |
| 2718 | /* case RB_ENDDRAG: */ |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2719 | |
| 2720 | case RB_GETBANDBORDERS: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2721 | return REBAR_GetBandBorders (hwnd, wParam, lParam); |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2722 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2723 | case RB_GETBANDCOUNT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2724 | return REBAR_GetBandCount (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2725 | |
Marcus Meissner | 6ce752c | 2000-11-01 21:35:28 +0000 | [diff] [blame] | 2726 | case RB_GETBANDINFO: /* obsoleted after IE3, but we have to |
| 2727 | support it anyway. */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2728 | case RB_GETBANDINFOA: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2729 | return REBAR_GetBandInfoA (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2730 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2731 | case RB_GETBANDINFOW: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2732 | return REBAR_GetBandInfoW (hwnd, wParam, lParam); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2733 | |
| 2734 | case RB_GETBARHEIGHT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2735 | return REBAR_GetBarHeight (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2736 | |
| 2737 | case RB_GETBARINFO: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2738 | return REBAR_GetBarInfo (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2739 | |
| 2740 | case RB_GETBKCOLOR: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2741 | return REBAR_GetBkColor (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2742 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2743 | /* case RB_GETCOLORSCHEME: */ |
| 2744 | /* case RB_GETDROPTARGET: */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2745 | |
| 2746 | case RB_GETPALETTE: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2747 | return REBAR_GetPalette (hwnd, wParam, lParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2748 | |
| 2749 | case RB_GETRECT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2750 | return REBAR_GetRect (hwnd, wParam, lParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2751 | |
| 2752 | case RB_GETROWCOUNT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2753 | return REBAR_GetRowCount (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2754 | |
| 2755 | case RB_GETROWHEIGHT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2756 | return REBAR_GetRowHeight (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2757 | |
| 2758 | case RB_GETTEXTCOLOR: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2759 | return REBAR_GetTextColor (hwnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2760 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2761 | case RB_GETTOOLTIPS: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2762 | return REBAR_GetToolTips (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2763 | |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2764 | case RB_GETUNICODEFORMAT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2765 | return REBAR_GetUnicodeFormat (hwnd); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2766 | |
Eric Kohl | 70e0969 | 1999-11-23 23:38:22 +0000 | [diff] [blame] | 2767 | case CCM_GETVERSION: |
| 2768 | return REBAR_GetVersion (hwnd); |
| 2769 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2770 | case RB_HITTEST: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2771 | return REBAR_HitTest (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2772 | |
| 2773 | case RB_IDTOINDEX: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2774 | return REBAR_IdToIndex (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2775 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2776 | case RB_INSERTBANDA: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2777 | return REBAR_InsertBandA (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2778 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2779 | case RB_INSERTBANDW: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2780 | return REBAR_InsertBandW (hwnd, wParam, lParam); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2781 | |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2782 | case RB_MAXIMIZEBAND: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2783 | return REBAR_MaximizeBand (hwnd, wParam, lParam); |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2784 | |
| 2785 | case RB_MINIMIZEBAND: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2786 | return REBAR_MinimizeBand (hwnd, wParam, lParam); |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2787 | |
| 2788 | case RB_MOVEBAND: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2789 | return REBAR_MoveBand (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2790 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2791 | case RB_SETBANDINFOA: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2792 | return REBAR_SetBandInfoA (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2793 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2794 | case RB_SETBANDINFOW: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2795 | return REBAR_SetBandInfoW (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2796 | |
| 2797 | case RB_SETBARINFO: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2798 | return REBAR_SetBarInfo (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2799 | |
| 2800 | case RB_SETBKCOLOR: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2801 | return REBAR_SetBkColor (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2802 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2803 | /* case RB_SETCOLORSCHEME: */ |
| 2804 | /* case RB_SETPALETTE: */ |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2805 | /* return REBAR_GetPalette (hwnd, wParam, lParam); */ |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2806 | |
| 2807 | case RB_SETPARENT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2808 | return REBAR_SetParent (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2809 | |
| 2810 | case RB_SETTEXTCOLOR: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2811 | return REBAR_SetTextColor (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2812 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2813 | /* case RB_SETTOOLTIPS: */ |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2814 | |
| 2815 | case RB_SETUNICODEFORMAT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2816 | return REBAR_SetUnicodeFormat (hwnd, wParam); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2817 | |
Eric Kohl | 70e0969 | 1999-11-23 23:38:22 +0000 | [diff] [blame] | 2818 | case CCM_SETVERSION: |
| 2819 | return REBAR_SetVersion (hwnd, (INT)wParam); |
| 2820 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2821 | case RB_SHOWBAND: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2822 | return REBAR_ShowBand (hwnd, wParam, lParam); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2823 | |
| 2824 | case RB_SIZETORECT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2825 | return REBAR_SizeToRect (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2826 | |
| 2827 | |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2828 | case WM_COMMAND: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2829 | return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); |
Eric Kohl | 402fcbc | 1999-01-24 19:05:49 +0000 | [diff] [blame] | 2830 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2831 | case WM_CREATE: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2832 | return REBAR_Create (hwnd, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 2833 | |
| 2834 | case WM_DESTROY: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2835 | return REBAR_Destroy (hwnd, wParam, lParam); |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2836 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2837 | case WM_GETFONT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2838 | return REBAR_GetFont (hwnd, wParam, lParam); |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2839 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2840 | case WM_LBUTTONDOWN: |
| 2841 | return REBAR_LButtonDown (hwnd, wParam, lParam); |
| 2842 | |
| 2843 | case WM_LBUTTONUP: |
| 2844 | return REBAR_LButtonUp (hwnd, wParam, lParam); |
| 2845 | |
| 2846 | case WM_MOUSEMOVE: |
| 2847 | return REBAR_MouseMove (hwnd, wParam, lParam); |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2848 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2849 | case WM_NCCALCSIZE: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2850 | return REBAR_NCCalcSize (hwnd, wParam, lParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2851 | |
| 2852 | case WM_NCPAINT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2853 | return REBAR_NCPaint (hwnd, wParam, lParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2854 | |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2855 | case WM_NOTIFY: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2856 | return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); |
Eric Kohl | 44443b6 | 1998-11-22 18:01:15 +0000 | [diff] [blame] | 2857 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2858 | case WM_PAINT: |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2859 | return REBAR_Paint (hwnd, wParam, lParam); |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2860 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2861 | case WM_SETCURSOR: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2862 | return REBAR_SetCursor (hwnd, wParam, lParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2863 | |
| 2864 | case WM_SETFONT: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2865 | return REBAR_SetFont (hwnd, wParam, lParam); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2866 | |
| 2867 | case WM_SIZE: |
Eric Kohl | cad17ff | 1999-03-12 17:42:50 +0000 | [diff] [blame] | 2868 | return REBAR_Size (hwnd, wParam, lParam); |
Marcus Meissner | 6e9c506 | 2000-11-04 02:54:32 +0000 | [diff] [blame] | 2869 | case WM_DRAWITEM: |
| 2870 | return SendMessageA(GetParent(hwnd),uMsg,wParam,lParam); |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2871 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2872 | /* case WM_TIMER: */ |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2873 | |
Marcus Meissner | 73458b0 | 1998-12-26 12:54:29 +0000 | [diff] [blame] | 2874 | /* case WM_WININICHANGE: */ |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2875 | |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2876 | case WM_ERASEBKGND: |
| 2877 | return REBAR_EraseBkGnd (hwnd, wParam, lParam); |
| 2878 | |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2879 | default: |
| 2880 | if (uMsg >= WM_USER) |
Alexandre Julliard | a099a55 | 1999-06-12 15:45:58 +0000 | [diff] [blame] | 2881 | ERR("unknown msg %04x wp=%08x lp=%08lx\n", |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2882 | uMsg, wParam, lParam); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2883 | return DefWindowProcA (hwnd, uMsg, wParam, lParam); |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2884 | } |
| 2885 | return 0; |
| 2886 | } |
| 2887 | |
| 2888 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2889 | VOID |
Patrik Stridvall | 9e61c1c | 1999-06-12 08:27:49 +0000 | [diff] [blame] | 2890 | REBAR_Register (void) |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2891 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2892 | WNDCLASSA wndClass; |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2893 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2894 | ZeroMemory (&wndClass, sizeof(WNDCLASSA)); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2895 | wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2896 | wndClass.lpfnWndProc = (WNDPROC)REBAR_WindowProc; |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2897 | wndClass.cbClsExtra = 0; |
| 2898 | wndClass.cbWndExtra = sizeof(REBAR_INFO *); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 2899 | wndClass.hCursor = 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2900 | wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); |
| 2901 | wndClass.lpszClassName = REBARCLASSNAMEA; |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2902 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 2903 | RegisterClassA (&wndClass); |
Guy L. Albertelli | 418efdc | 2000-11-13 19:29:16 +0000 | [diff] [blame] | 2904 | |
| 2905 | mindragx = GetSystemMetrics (SM_CXDRAG); |
| 2906 | mindragy = GetSystemMetrics (SM_CYDRAG); |
| 2907 | |
Alexandre Julliard | 642d313 | 1998-07-12 19:29:36 +0000 | [diff] [blame] | 2908 | } |
| 2909 | |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2910 | |
| 2911 | VOID |
Patrik Stridvall | 9e61c1c | 1999-06-12 08:27:49 +0000 | [diff] [blame] | 2912 | REBAR_Unregister (void) |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2913 | { |
Alexandre Julliard | d711ad9 | 2000-02-13 15:10:16 +0000 | [diff] [blame] | 2914 | UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL); |
Eric Kohl | b075ce5 | 1998-10-24 10:47:25 +0000 | [diff] [blame] | 2915 | } |
| 2916 | |