| 1 | /* $Id: rebar.cpp,v 1.2 2000-03-18 16:17:27 cbratschi Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Rebar control | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright 1998, 1999 Eric Kohl | 
|---|
| 6 | * Copyright 1999 Achim Hasenmueller | 
|---|
| 7 | * Copyright 1999 Christoph Bratschi | 
|---|
| 8 | * | 
|---|
| 9 | * NOTES | 
|---|
| 10 | *   An author is needed! Any volunteers? | 
|---|
| 11 | *   I will only improve this control once in a while. | 
|---|
| 12 | *     Eric <ekohl@abo.rhein-zeitung.de> | 
|---|
| 13 | * | 
|---|
| 14 | * TODO: | 
|---|
| 15 | *   - vertical placement | 
|---|
| 16 | *   - ComboBox and ComboBoxEx placement | 
|---|
| 17 | *   - center image | 
|---|
| 18 | *   - Layout code. | 
|---|
| 19 | *   - Display code. | 
|---|
| 20 | *   - Some messages. | 
|---|
| 21 | *   - All notifications. | 
|---|
| 22 | */ | 
|---|
| 23 |  | 
|---|
| 24 | /* WINE 991212 */ | 
|---|
| 25 |  | 
|---|
| 26 | #include <string.h> | 
|---|
| 27 |  | 
|---|
| 28 | #include "winbase.h" | 
|---|
| 29 | #include "wingdi.h" | 
|---|
| 30 | #include "commctrl.h" | 
|---|
| 31 | #include "ccbase.h" | 
|---|
| 32 | #include "rebar.h" | 
|---|
| 33 | #include "comctl32.h" | 
|---|
| 34 |  | 
|---|
| 35 |  | 
|---|
| 36 | /* fDraw flags */ | 
|---|
| 37 | #define DRAW_GRIPPER    1 | 
|---|
| 38 | #define DRAW_IMAGE      2 | 
|---|
| 39 | #define DRAW_TEXT       4 | 
|---|
| 40 | #define DRAW_CHILD      8 | 
|---|
| 41 |  | 
|---|
| 42 | #define GRIPPER_WIDTH   13 | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 | #define REBAR_GetInfoPtr(hwnd) ((REBAR_INFO*)getInfoPtr(hwnd)) | 
|---|
| 46 |  | 
|---|
| 47 |  | 
|---|
| 48 | static VOID | 
|---|
| 49 | REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand) | 
|---|
| 50 | { | 
|---|
| 51 |  | 
|---|
| 52 | DrawEdge (hdc, &lpBand->rcBand, BDR_RAISEDINNER, BF_MIDDLE); | 
|---|
| 53 |  | 
|---|
| 54 | /* draw background */ | 
|---|
| 55 |  | 
|---|
| 56 | /* draw gripper */ | 
|---|
| 57 | if (lpBand->fDraw & DRAW_GRIPPER) | 
|---|
| 58 | DrawEdge (hdc, &lpBand->rcGripper, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE); | 
|---|
| 59 |  | 
|---|
| 60 | /* draw caption image */ | 
|---|
| 61 | if (lpBand->fDraw & DRAW_IMAGE) { | 
|---|
| 62 | /* FIXME: center image */ | 
|---|
| 63 | POINT pt; | 
|---|
| 64 |  | 
|---|
| 65 | pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2; | 
|---|
| 66 | pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2; | 
|---|
| 67 |  | 
|---|
| 68 | ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc, | 
|---|
| 69 | /*                      lpBand->rcCapImage.left, lpBand->rcCapImage.top, */ | 
|---|
| 70 | pt.x, pt.y, | 
|---|
| 71 | ILD_TRANSPARENT); | 
|---|
| 72 | } | 
|---|
| 73 |  | 
|---|
| 74 | /* draw caption text */ | 
|---|
| 75 | if (lpBand->fDraw & DRAW_TEXT) { | 
|---|
| 76 | HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); | 
|---|
| 77 | INT oldBkMode = SetBkMode (hdc, TRANSPARENT); | 
|---|
| 78 | DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, | 
|---|
| 79 | DT_CENTER | DT_VCENTER | DT_SINGLELINE); | 
|---|
| 80 | if (oldBkMode != TRANSPARENT) | 
|---|
| 81 | SetBkMode (hdc, oldBkMode); | 
|---|
| 82 | SelectObject (hdc, hOldFont); | 
|---|
| 83 | } | 
|---|
| 84 | } | 
|---|
| 85 |  | 
|---|
| 86 |  | 
|---|
| 87 | static VOID | 
|---|
| 88 | REBAR_Refresh (HWND hwnd, HDC hdc) | 
|---|
| 89 | { | 
|---|
| 90 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 91 | REBAR_BAND *lpBand; | 
|---|
| 92 | UINT i; | 
|---|
| 93 |  | 
|---|
| 94 | for (i = 0; i < infoPtr->uNumBands; i++) { | 
|---|
| 95 | lpBand = &infoPtr->bands[i]; | 
|---|
| 96 |  | 
|---|
| 97 | if ((lpBand->fStyle & RBBS_HIDDEN) || | 
|---|
| 98 | ((GetWindowLongA (hwnd, GWL_STYLE) & CCS_VERT) && | 
|---|
| 99 | (lpBand->fStyle & RBBS_NOVERT))) | 
|---|
| 100 | continue; | 
|---|
| 101 |  | 
|---|
| 102 | REBAR_DrawBand (hdc, infoPtr, lpBand); | 
|---|
| 103 |  | 
|---|
| 104 | } | 
|---|
| 105 | } | 
|---|
| 106 |  | 
|---|
| 107 |  | 
|---|
| 108 | static VOID | 
|---|
| 109 | REBAR_CalcHorzBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand) | 
|---|
| 110 | { | 
|---|
| 111 | lpBand->fDraw = 0; | 
|---|
| 112 |  | 
|---|
| 113 | /* set initial caption image rectangle */ | 
|---|
| 114 | SetRect (&lpBand->rcCapImage, 0, 0, 0, 0); | 
|---|
| 115 |  | 
|---|
| 116 | /* image is visible */ | 
|---|
| 117 | if ((lpBand->iImage > -1) && (infoPtr->himl)) { | 
|---|
| 118 | lpBand->fDraw |= DRAW_IMAGE; | 
|---|
| 119 |  | 
|---|
| 120 | lpBand->rcCapImage.right  = lpBand->rcCapImage.left + infoPtr->imageSize.cx; | 
|---|
| 121 | lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy; | 
|---|
| 122 |  | 
|---|
| 123 | /* update band height */ | 
|---|
| 124 | if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) { | 
|---|
| 125 | lpBand->uMinHeight = infoPtr->imageSize.cy + 2; | 
|---|
| 126 | lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight; | 
|---|
| 127 | } | 
|---|
| 128 | } | 
|---|
| 129 |  | 
|---|
| 130 | /* set initial caption text rectangle */ | 
|---|
| 131 | lpBand->rcCapText.left   = lpBand->rcCapImage.right; | 
|---|
| 132 | lpBand->rcCapText.top    = lpBand->rcBand.top + 1; | 
|---|
| 133 | lpBand->rcCapText.right  = lpBand->rcCapText.left; | 
|---|
| 134 | lpBand->rcCapText.bottom = lpBand->rcBand.bottom - 1; | 
|---|
| 135 |  | 
|---|
| 136 | /* text is visible */ | 
|---|
| 137 | if (lpBand->lpText) { | 
|---|
| 138 | HDC hdc = GetDC (0); | 
|---|
| 139 | HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); | 
|---|
| 140 | SIZE size; | 
|---|
| 141 |  | 
|---|
| 142 | lpBand->fDraw |= DRAW_TEXT; | 
|---|
| 143 | GetTextExtentPoint32W (hdc, lpBand->lpText, | 
|---|
| 144 | lstrlenW (lpBand->lpText), &size); | 
|---|
| 145 | lpBand->rcCapText.right += size.cx; | 
|---|
| 146 |  | 
|---|
| 147 | SelectObject (hdc, hOldFont); | 
|---|
| 148 | ReleaseDC (0, hdc); | 
|---|
| 149 | } | 
|---|
| 150 |  | 
|---|
| 151 | /* set initial child window rectangle */ | 
|---|
| 152 | if (lpBand->fStyle & RBBS_FIXEDSIZE) { | 
|---|
| 153 | lpBand->rcChild.left   = lpBand->rcCapText.right; | 
|---|
| 154 | lpBand->rcChild.top    = lpBand->rcBand.top; | 
|---|
| 155 | lpBand->rcChild.right  = lpBand->rcBand.right; | 
|---|
| 156 | lpBand->rcChild.bottom = lpBand->rcBand.bottom; | 
|---|
| 157 | } | 
|---|
| 158 | else { | 
|---|
| 159 | lpBand->rcChild.left   = lpBand->rcCapText.right + 4; | 
|---|
| 160 | lpBand->rcChild.top    = lpBand->rcBand.top + 2; | 
|---|
| 161 | lpBand->rcChild.right  = lpBand->rcBand.right - 4; | 
|---|
| 162 | lpBand->rcChild.bottom = lpBand->rcBand.bottom - 2; | 
|---|
| 163 | } | 
|---|
| 164 |  | 
|---|
| 165 | /* calculate gripper rectangle */ | 
|---|
| 166 | if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) && | 
|---|
| 167 | (!(lpBand->fStyle & RBBS_FIXEDSIZE)) && | 
|---|
| 168 | ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || | 
|---|
| 169 | (infoPtr->uNumBands > 1))) { | 
|---|
| 170 | lpBand->fDraw |= DRAW_GRIPPER; | 
|---|
| 171 | lpBand->rcGripper.left   = lpBand->rcBand.left + 3; | 
|---|
| 172 | lpBand->rcGripper.right  = lpBand->rcGripper.left + 3; | 
|---|
| 173 | lpBand->rcGripper.top    = lpBand->rcBand.top + 3; | 
|---|
| 174 | lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3; | 
|---|
| 175 |  | 
|---|
| 176 | /* move caption rectangles */ | 
|---|
| 177 | OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0); | 
|---|
| 178 | OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0); | 
|---|
| 179 |  | 
|---|
| 180 | /* adjust child rectangle */ | 
|---|
| 181 | lpBand->rcChild.left += GRIPPER_WIDTH; | 
|---|
| 182 | } | 
|---|
| 183 |  | 
|---|
| 184 |  | 
|---|
| 185 | } | 
|---|
| 186 |  | 
|---|
| 187 |  | 
|---|
| 188 | static VOID | 
|---|
| 189 | REBAR_CalcVertBand (HWND hwnd, REBAR_INFO *infoPtr, REBAR_BAND *lpBand) | 
|---|
| 190 | { | 
|---|
| 191 | lpBand->fDraw = 0; | 
|---|
| 192 |  | 
|---|
| 193 | /* set initial caption image rectangle */ | 
|---|
| 194 | SetRect (&lpBand->rcCapImage, 0, 0, 0, 0); | 
|---|
| 195 |  | 
|---|
| 196 | /* image is visible */ | 
|---|
| 197 | if ((lpBand->iImage > -1) && (infoPtr->himl)) { | 
|---|
| 198 | lpBand->fDraw |= DRAW_IMAGE; | 
|---|
| 199 |  | 
|---|
| 200 | lpBand->rcCapImage.right  = lpBand->rcCapImage.left + infoPtr->imageSize.cx; | 
|---|
| 201 | lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy; | 
|---|
| 202 |  | 
|---|
| 203 | /* update band width */ | 
|---|
| 204 | if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) { | 
|---|
| 205 | lpBand->uMinHeight = infoPtr->imageSize.cx + 2; | 
|---|
| 206 | lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight; | 
|---|
| 207 | } | 
|---|
| 208 | } | 
|---|
| 209 |  | 
|---|
| 210 | /* set initial caption text rectangle */ | 
|---|
| 211 | lpBand->rcCapText.left   = lpBand->rcBand.left + 1; | 
|---|
| 212 | lpBand->rcCapText.top    = lpBand->rcCapImage.bottom; | 
|---|
| 213 | lpBand->rcCapText.right  = lpBand->rcBand.right - 1; | 
|---|
| 214 | lpBand->rcCapText.bottom = lpBand->rcCapText.top; | 
|---|
| 215 |  | 
|---|
| 216 | /* text is visible */ | 
|---|
| 217 | if (lpBand->lpText) { | 
|---|
| 218 | HDC hdc = GetDC (0); | 
|---|
| 219 | HFONT hOldFont = SelectObject (hdc, infoPtr->hFont); | 
|---|
| 220 | SIZE size; | 
|---|
| 221 |  | 
|---|
| 222 | lpBand->fDraw |= DRAW_TEXT; | 
|---|
| 223 | GetTextExtentPoint32W (hdc, lpBand->lpText, | 
|---|
| 224 | lstrlenW (lpBand->lpText), &size); | 
|---|
| 225 | /*      lpBand->rcCapText.right += size.cx; */ | 
|---|
| 226 | lpBand->rcCapText.bottom += size.cy; | 
|---|
| 227 |  | 
|---|
| 228 | SelectObject (hdc, hOldFont); | 
|---|
| 229 | ReleaseDC (0, hdc); | 
|---|
| 230 | } | 
|---|
| 231 |  | 
|---|
| 232 | /* set initial child window rectangle */ | 
|---|
| 233 | if (lpBand->fStyle & RBBS_FIXEDSIZE) { | 
|---|
| 234 | lpBand->rcChild.left   = lpBand->rcBand.left; | 
|---|
| 235 | lpBand->rcChild.top    = lpBand->rcCapText.bottom; | 
|---|
| 236 | lpBand->rcChild.right  = lpBand->rcBand.right; | 
|---|
| 237 | lpBand->rcChild.bottom = lpBand->rcBand.bottom; | 
|---|
| 238 | } | 
|---|
| 239 | else { | 
|---|
| 240 | lpBand->rcChild.left   = lpBand->rcBand.left + 2; | 
|---|
| 241 | lpBand->rcChild.top    = lpBand->rcCapText.bottom + 4; | 
|---|
| 242 | lpBand->rcChild.right  = lpBand->rcBand.right - 2; | 
|---|
| 243 | lpBand->rcChild.bottom = lpBand->rcBand.bottom - 4; | 
|---|
| 244 | } | 
|---|
| 245 |  | 
|---|
| 246 | /* calculate gripper rectangle */ | 
|---|
| 247 | if ((!(lpBand->fStyle & RBBS_NOGRIPPER)) && | 
|---|
| 248 | (!(lpBand->fStyle & RBBS_FIXEDSIZE)) && | 
|---|
| 249 | ((lpBand->fStyle & RBBS_GRIPPERALWAYS) || | 
|---|
| 250 | (infoPtr->uNumBands > 1))) { | 
|---|
| 251 | lpBand->fDraw |= DRAW_GRIPPER; | 
|---|
| 252 |  | 
|---|
| 253 | if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_VERTICALGRIPPER) { | 
|---|
| 254 | /* adjust band width */ | 
|---|
| 255 | lpBand->rcBand.right += GRIPPER_WIDTH; | 
|---|
| 256 | lpBand->uMinHeight += GRIPPER_WIDTH; | 
|---|
| 257 |  | 
|---|
| 258 | lpBand->rcGripper.left   = lpBand->rcBand.left + 3; | 
|---|
| 259 | lpBand->rcGripper.right  = lpBand->rcGripper.left + 3; | 
|---|
| 260 | lpBand->rcGripper.top    = lpBand->rcBand.top + 3; | 
|---|
| 261 | lpBand->rcGripper.bottom = lpBand->rcBand.bottom - 3; | 
|---|
| 262 |  | 
|---|
| 263 | /* move caption rectangles */ | 
|---|
| 264 | OffsetRect (&lpBand->rcCapImage, GRIPPER_WIDTH, 0); | 
|---|
| 265 | OffsetRect (&lpBand->rcCapText, GRIPPER_WIDTH, 0); | 
|---|
| 266 |  | 
|---|
| 267 | /* adjust child rectangle */ | 
|---|
| 268 | lpBand->rcChild.left += GRIPPER_WIDTH; | 
|---|
| 269 | } | 
|---|
| 270 | else { | 
|---|
| 271 | lpBand->rcGripper.left   = lpBand->rcBand.left + 3; | 
|---|
| 272 | lpBand->rcGripper.right  = lpBand->rcBand.right - 3; | 
|---|
| 273 | lpBand->rcGripper.top    = lpBand->rcBand.top + 3; | 
|---|
| 274 | lpBand->rcGripper.bottom = lpBand->rcGripper.top + 3; | 
|---|
| 275 |  | 
|---|
| 276 | /* move caption rectangles */ | 
|---|
| 277 | OffsetRect (&lpBand->rcCapImage, 0, GRIPPER_WIDTH); | 
|---|
| 278 | OffsetRect (&lpBand->rcCapText, 0, GRIPPER_WIDTH); | 
|---|
| 279 |  | 
|---|
| 280 | /* adjust child rectangle */ | 
|---|
| 281 | lpBand->rcChild.top += GRIPPER_WIDTH; | 
|---|
| 282 | } | 
|---|
| 283 | } | 
|---|
| 284 | } | 
|---|
| 285 |  | 
|---|
| 286 |  | 
|---|
| 287 | static VOID | 
|---|
| 288 | REBAR_Layout (HWND hwnd, LPRECT lpRect) | 
|---|
| 289 | { | 
|---|
| 290 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 291 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); | 
|---|
| 292 | REBAR_BAND *lpBand; | 
|---|
| 293 | RECT rcClient; | 
|---|
| 294 | INT x, y, cx, cy; | 
|---|
| 295 | UINT i; | 
|---|
| 296 |  | 
|---|
| 297 | if (lpRect) | 
|---|
| 298 | rcClient = *lpRect; | 
|---|
| 299 | else | 
|---|
| 300 | GetClientRect (hwnd, &rcClient); | 
|---|
| 301 |  | 
|---|
| 302 | x = 0; | 
|---|
| 303 | y = 0; | 
|---|
| 304 |  | 
|---|
| 305 | if (dwStyle & CCS_VERT) { | 
|---|
| 306 | cx = 20;    /* FIXME: fixed height */ | 
|---|
| 307 | cy = rcClient.bottom - rcClient.top; | 
|---|
| 308 | } | 
|---|
| 309 | else { | 
|---|
| 310 | cx = rcClient.right - rcClient.left; | 
|---|
| 311 | cy = 20;    /* FIXME: fixed height */ | 
|---|
| 312 | } | 
|---|
| 313 |  | 
|---|
| 314 | for (i = 0; i < infoPtr->uNumBands; i++) { | 
|---|
| 315 | lpBand = &infoPtr->bands[i]; | 
|---|
| 316 |  | 
|---|
| 317 | if ((lpBand->fStyle & RBBS_HIDDEN) || | 
|---|
| 318 | ((dwStyle & CCS_VERT) && (lpBand->fStyle & RBBS_NOVERT))) | 
|---|
| 319 | continue; | 
|---|
| 320 |  | 
|---|
| 321 |  | 
|---|
| 322 | if (dwStyle & CCS_VERT) { | 
|---|
| 323 | if (lpBand->fStyle & RBBS_VARIABLEHEIGHT) | 
|---|
| 324 | cx = lpBand->cyMaxChild; | 
|---|
| 325 | else if (lpBand->fStyle & RBBIM_CHILDSIZE) | 
|---|
| 326 | cx = lpBand->cyMinChild; | 
|---|
| 327 | else | 
|---|
| 328 | cx = 20; /* FIXME */ | 
|---|
| 329 |  | 
|---|
| 330 | lpBand->rcBand.left   = x; | 
|---|
| 331 | lpBand->rcBand.right  = x + cx; | 
|---|
| 332 | lpBand->rcBand.top    = y; | 
|---|
| 333 | lpBand->rcBand.bottom = y + cy; | 
|---|
| 334 | lpBand->uMinHeight = cx; | 
|---|
| 335 | } | 
|---|
| 336 | else { | 
|---|
| 337 | if (lpBand->fStyle & RBBS_VARIABLEHEIGHT) | 
|---|
| 338 | cy = lpBand->cyMaxChild; | 
|---|
| 339 | else if (lpBand->fStyle & RBBIM_CHILDSIZE) | 
|---|
| 340 | cy = lpBand->cyMinChild; | 
|---|
| 341 | else { | 
|---|
| 342 | //                cy = 20; /* FIXME */ | 
|---|
| 343 | cy = 36; //SvL: Better size of AbiWord (FIXME) | 
|---|
| 344 | } | 
|---|
| 345 |  | 
|---|
| 346 | lpBand->rcBand.left   = x; | 
|---|
| 347 | lpBand->rcBand.right  = x + cx; | 
|---|
| 348 | lpBand->rcBand.top    = y; | 
|---|
| 349 | lpBand->rcBand.bottom = y + cy; | 
|---|
| 350 | lpBand->uMinHeight = cy; | 
|---|
| 351 | } | 
|---|
| 352 |  | 
|---|
| 353 | if (dwStyle & CCS_VERT) { | 
|---|
| 354 | REBAR_CalcVertBand (hwnd, infoPtr, lpBand); | 
|---|
| 355 | x += lpBand->uMinHeight; | 
|---|
| 356 | } | 
|---|
| 357 | else { | 
|---|
| 358 | REBAR_CalcHorzBand (infoPtr, lpBand); | 
|---|
| 359 | y += lpBand->uMinHeight; | 
|---|
| 360 | } | 
|---|
| 361 | } | 
|---|
| 362 |  | 
|---|
| 363 | if (dwStyle & CCS_VERT) { | 
|---|
| 364 | infoPtr->calcSize.cx = x; | 
|---|
| 365 | infoPtr->calcSize.cy = rcClient.bottom - rcClient.top; | 
|---|
| 366 | } | 
|---|
| 367 | else { | 
|---|
| 368 | infoPtr->calcSize.cx = rcClient.right - rcClient.left; | 
|---|
| 369 | infoPtr->calcSize.cy = y; | 
|---|
| 370 | } | 
|---|
| 371 | } | 
|---|
| 372 |  | 
|---|
| 373 |  | 
|---|
| 374 | static VOID | 
|---|
| 375 | REBAR_ForceResize (HWND hwnd) | 
|---|
| 376 | { | 
|---|
| 377 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 378 | RECT rc; | 
|---|
| 379 |  | 
|---|
| 380 | //    TRACE (rebar, " to [%d x %d]!\n", | 
|---|
| 381 | //         infoPtr->calcSize.cx, infoPtr->calcSize.cy); | 
|---|
| 382 |  | 
|---|
| 383 | infoPtr->bAutoResize = TRUE; | 
|---|
| 384 |  | 
|---|
| 385 | rc.left = 0; | 
|---|
| 386 | rc.top = 0; | 
|---|
| 387 | rc.right  = infoPtr->calcSize.cx; | 
|---|
| 388 | rc.bottom = infoPtr->calcSize.cy; | 
|---|
| 389 |  | 
|---|
| 390 | if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) { | 
|---|
| 391 | InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); | 
|---|
| 392 | } | 
|---|
| 393 |  | 
|---|
| 394 | SetWindowPos (hwnd, 0, 0, 0, | 
|---|
| 395 | rc.right - rc.left, rc.bottom - rc.top, | 
|---|
| 396 | SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW); | 
|---|
| 397 | } | 
|---|
| 398 |  | 
|---|
| 399 |  | 
|---|
| 400 | static VOID | 
|---|
| 401 | REBAR_MoveChildWindows (HWND hwnd) | 
|---|
| 402 | { | 
|---|
| 403 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 404 | REBAR_BAND *lpBand; | 
|---|
| 405 | CHAR szClassName[40]; | 
|---|
| 406 | UINT i; | 
|---|
| 407 |  | 
|---|
| 408 | for (i = 0; i < infoPtr->uNumBands; i++) { | 
|---|
| 409 | lpBand = &infoPtr->bands[i]; | 
|---|
| 410 |  | 
|---|
| 411 | if (lpBand->fStyle & RBBS_HIDDEN) | 
|---|
| 412 | continue; | 
|---|
| 413 | if (lpBand->hwndChild) { | 
|---|
| 414 | //          TRACE (rebar, "hwndChild = %x\n", lpBand->hwndChild); | 
|---|
| 415 |  | 
|---|
| 416 | GetClassNameA (lpBand->hwndChild, szClassName, 40); | 
|---|
| 417 | if (!lstrcmpA (szClassName, "ComboBox")) { | 
|---|
| 418 | INT nEditHeight, yPos; | 
|---|
| 419 | RECT rc; | 
|---|
| 420 |  | 
|---|
| 421 | /* special placement code for combo box */ | 
|---|
| 422 |  | 
|---|
| 423 |  | 
|---|
| 424 | /* get size of edit line */ | 
|---|
| 425 | GetWindowRect (lpBand->hwndChild, &rc); | 
|---|
| 426 | nEditHeight = rc.bottom - rc.top; | 
|---|
| 427 | yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; | 
|---|
| 428 |  | 
|---|
| 429 | /* center combo box inside child area */ | 
|---|
| 430 | SetWindowPos (lpBand->hwndChild, HWND_TOP, | 
|---|
| 431 | lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos, | 
|---|
| 432 | lpBand->rcChild.right - lpBand->rcChild.left, | 
|---|
| 433 | nEditHeight, | 
|---|
| 434 | SWP_SHOWWINDOW); | 
|---|
| 435 | } | 
|---|
| 436 | #if 0 | 
|---|
| 437 | else if (!lstrcmpA (szClassName, WC_COMBOBOXEXA)) { | 
|---|
| 438 | INT nEditHeight, yPos; | 
|---|
| 439 | RECT rc; | 
|---|
| 440 | HWND hwndEdit; | 
|---|
| 441 |  | 
|---|
| 442 | /* special placement code for extended combo box */ | 
|---|
| 443 |  | 
|---|
| 444 | /* get size of edit line */ | 
|---|
| 445 | hwndEdit = SendMessageA (lpBand->hwndChild, CBEM_GETEDITCONTROL, 0, 0); | 
|---|
| 446 | GetWindowRect (hwndEdit, &rc); | 
|---|
| 447 | nEditHeight = rc.bottom - rc.top; | 
|---|
| 448 | yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2; | 
|---|
| 449 |  | 
|---|
| 450 | /* center combo box inside child area */ | 
|---|
| 451 | SetWindowPos (lpBand->hwndChild, HWND_TOP, | 
|---|
| 452 | lpBand->rcChild.left, /*lpBand->rcChild.top*/ yPos, | 
|---|
| 453 | lpBand->rcChild.right - lpBand->rcChild.left, | 
|---|
| 454 | nEditHeight, | 
|---|
| 455 | SWP_SHOWWINDOW); | 
|---|
| 456 |  | 
|---|
| 457 | } | 
|---|
| 458 | #endif | 
|---|
| 459 | else { | 
|---|
| 460 | SetWindowPos (lpBand->hwndChild, HWND_TOP, | 
|---|
| 461 | lpBand->rcChild.left, lpBand->rcChild.top, | 
|---|
| 462 | lpBand->rcChild.right - lpBand->rcChild.left, | 
|---|
| 463 | lpBand->rcChild.bottom - lpBand->rcChild.top, | 
|---|
| 464 | SWP_SHOWWINDOW); | 
|---|
| 465 | } | 
|---|
| 466 | } | 
|---|
| 467 | } | 
|---|
| 468 | } | 
|---|
| 469 |  | 
|---|
| 470 |  | 
|---|
| 471 | static void | 
|---|
| 472 | REBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt, UINT *pFlags, INT *pBand) | 
|---|
| 473 | { | 
|---|
| 474 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 475 | REBAR_BAND *lpBand; | 
|---|
| 476 | RECT rect; | 
|---|
| 477 | INT  iCount; | 
|---|
| 478 |  | 
|---|
| 479 | GetClientRect (hwnd, &rect); | 
|---|
| 480 |  | 
|---|
| 481 | *pFlags = RBHT_NOWHERE; | 
|---|
| 482 | if (PtInRect (&rect, *lpPt)) | 
|---|
| 483 | { | 
|---|
| 484 | if (infoPtr->uNumBands == 0) { | 
|---|
| 485 | *pFlags = RBHT_NOWHERE; | 
|---|
| 486 | if (pBand) | 
|---|
| 487 | *pBand = -1; | 
|---|
| 488 | //          TRACE (rebar, "NOWHERE\n"); | 
|---|
| 489 | return; | 
|---|
| 490 | } | 
|---|
| 491 | else { | 
|---|
| 492 | /* somewhere inside */ | 
|---|
| 493 | for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) { | 
|---|
| 494 | lpBand = &infoPtr->bands[iCount]; | 
|---|
| 495 | if (PtInRect (&lpBand->rcBand, *lpPt)) { | 
|---|
| 496 | if (pBand) | 
|---|
| 497 | *pBand = iCount; | 
|---|
| 498 | if (PtInRect (&lpBand->rcGripper, *lpPt)) { | 
|---|
| 499 | *pFlags = RBHT_GRABBER; | 
|---|
| 500 | //                      TRACE (rebar, "ON GRABBER %d\n", iCount); | 
|---|
| 501 | return; | 
|---|
| 502 | } | 
|---|
| 503 | else if (PtInRect (&lpBand->rcCapImage, *lpPt)) { | 
|---|
| 504 | *pFlags = RBHT_CAPTION; | 
|---|
| 505 | //                      TRACE (rebar, "ON CAPTION %d\n", iCount); | 
|---|
| 506 | return; | 
|---|
| 507 | } | 
|---|
| 508 | else if (PtInRect (&lpBand->rcCapText, *lpPt)) { | 
|---|
| 509 | *pFlags = RBHT_CAPTION; | 
|---|
| 510 | //                      TRACE (rebar, "ON CAPTION %d\n", iCount); | 
|---|
| 511 | return; | 
|---|
| 512 | } | 
|---|
| 513 | else if (PtInRect (&lpBand->rcChild, *lpPt)) { | 
|---|
| 514 | *pFlags = RBHT_CLIENT; | 
|---|
| 515 | //                      TRACE (rebar, "ON CLIENT %d\n", iCount); | 
|---|
| 516 | return; | 
|---|
| 517 | } | 
|---|
| 518 | else { | 
|---|
| 519 | *pFlags = RBHT_NOWHERE; | 
|---|
| 520 | //                      TRACE (rebar, "NOWHERE %d\n", iCount); | 
|---|
| 521 | return; | 
|---|
| 522 | } | 
|---|
| 523 | } | 
|---|
| 524 | } | 
|---|
| 525 |  | 
|---|
| 526 | *pFlags = RBHT_NOWHERE; | 
|---|
| 527 | if (pBand) | 
|---|
| 528 | *pBand = -1; | 
|---|
| 529 |  | 
|---|
| 530 | //          TRACE (rebar, "NOWHERE\n"); | 
|---|
| 531 | return; | 
|---|
| 532 | } | 
|---|
| 533 | } | 
|---|
| 534 | else { | 
|---|
| 535 | *pFlags = RBHT_NOWHERE; | 
|---|
| 536 | if (pBand) | 
|---|
| 537 | *pBand = -1; | 
|---|
| 538 | //      TRACE (rebar, "NOWHERE\n"); | 
|---|
| 539 | return; | 
|---|
| 540 | } | 
|---|
| 541 |  | 
|---|
| 542 | //    TRACE (rebar, "flags=0x%X\n", *pFlags); | 
|---|
| 543 | return; | 
|---|
| 544 | } | 
|---|
| 545 |  | 
|---|
| 546 |  | 
|---|
| 547 |  | 
|---|
| 548 | /* << REBAR_BeginDrag >> */ | 
|---|
| 549 |  | 
|---|
| 550 |  | 
|---|
| 551 | static LRESULT | 
|---|
| 552 | REBAR_DeleteBand (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 553 | { | 
|---|
| 554 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 555 | UINT uBand = (UINT)wParam; | 
|---|
| 556 |  | 
|---|
| 557 | if (uBand >= infoPtr->uNumBands) | 
|---|
| 558 | return FALSE; | 
|---|
| 559 |  | 
|---|
| 560 | //    TRACE (rebar, "deleting band %u!\n", uBand); | 
|---|
| 561 |  | 
|---|
| 562 | if (infoPtr->uNumBands == 1) { | 
|---|
| 563 | //      TRACE (rebar, " simple delete!\n"); | 
|---|
| 564 | COMCTL32_Free (infoPtr->bands); | 
|---|
| 565 | infoPtr->bands = NULL; | 
|---|
| 566 | infoPtr->uNumBands = 0; | 
|---|
| 567 | } | 
|---|
| 568 | else { | 
|---|
| 569 | REBAR_BAND *oldBands = infoPtr->bands; | 
|---|
| 570 | //        TRACE(rebar, "complex delete! [uBand=%u]\n", uBand); | 
|---|
| 571 |  | 
|---|
| 572 | infoPtr->uNumBands--; | 
|---|
| 573 | infoPtr->bands = (REBAR_BAND*)COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands); | 
|---|
| 574 | if (uBand > 0) { | 
|---|
| 575 | memcpy (&infoPtr->bands[0], &oldBands[0], | 
|---|
| 576 | uBand * sizeof(REBAR_BAND)); | 
|---|
| 577 | } | 
|---|
| 578 |  | 
|---|
| 579 | if (uBand < infoPtr->uNumBands) { | 
|---|
| 580 | memcpy (&infoPtr->bands[uBand], &oldBands[uBand+1], | 
|---|
| 581 | (infoPtr->uNumBands - uBand) * sizeof(REBAR_BAND)); | 
|---|
| 582 | } | 
|---|
| 583 |  | 
|---|
| 584 | COMCTL32_Free (oldBands); | 
|---|
| 585 | } | 
|---|
| 586 |  | 
|---|
| 587 | REBAR_Layout (hwnd, NULL); | 
|---|
| 588 | REBAR_ForceResize (hwnd); | 
|---|
| 589 | REBAR_MoveChildWindows (hwnd); | 
|---|
| 590 |  | 
|---|
| 591 | return TRUE; | 
|---|
| 592 | } | 
|---|
| 593 |  | 
|---|
| 594 |  | 
|---|
| 595 | /* << REBAR_DragMove >> */ | 
|---|
| 596 | /* << REBAR_EndDrag >> */ | 
|---|
| 597 |  | 
|---|
| 598 |  | 
|---|
| 599 | static LRESULT | 
|---|
| 600 | REBAR_GetBandBorders (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 601 | { | 
|---|
| 602 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 603 | /* LPRECT32 lpRect = (LPRECT32)lParam; */ | 
|---|
| 604 | REBAR_BAND *lpBand; | 
|---|
| 605 |  | 
|---|
| 606 | if (!lParam) | 
|---|
| 607 | return 0; | 
|---|
| 608 | if ((UINT)wParam >= infoPtr->uNumBands) | 
|---|
| 609 | return 0; | 
|---|
| 610 |  | 
|---|
| 611 | lpBand = &infoPtr->bands[(UINT)wParam]; | 
|---|
| 612 | if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_BANDBORDERS) { | 
|---|
| 613 |  | 
|---|
| 614 | } | 
|---|
| 615 | else { | 
|---|
| 616 |  | 
|---|
| 617 | } | 
|---|
| 618 |  | 
|---|
| 619 | return 0; | 
|---|
| 620 | } | 
|---|
| 621 |  | 
|---|
| 622 |  | 
|---|
| 623 | static LRESULT | 
|---|
| 624 | REBAR_GetBandCount (HWND hwnd) | 
|---|
| 625 | { | 
|---|
| 626 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 627 |  | 
|---|
| 628 | //    TRACE (rebar, "band count %u!\n", infoPtr->uNumBands); | 
|---|
| 629 |  | 
|---|
| 630 | return infoPtr->uNumBands; | 
|---|
| 631 | } | 
|---|
| 632 |  | 
|---|
| 633 |  | 
|---|
| 634 | static LRESULT | 
|---|
| 635 | REBAR_GetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 636 | { | 
|---|
| 637 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 638 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; | 
|---|
| 639 | REBAR_BAND *lpBand; | 
|---|
| 640 |  | 
|---|
| 641 | if (lprbbi == NULL) | 
|---|
| 642 | return FALSE; | 
|---|
| 643 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) | 
|---|
| 644 | return FALSE; | 
|---|
| 645 | if ((UINT)wParam >= infoPtr->uNumBands) | 
|---|
| 646 | return FALSE; | 
|---|
| 647 |  | 
|---|
| 648 | //    TRACE (rebar, "index %u\n", (UINT)wParam); | 
|---|
| 649 |  | 
|---|
| 650 | /* copy band information */ | 
|---|
| 651 | lpBand = &infoPtr->bands[(UINT)wParam]; | 
|---|
| 652 |  | 
|---|
| 653 | if (lprbbi->fMask & RBBIM_STYLE) | 
|---|
| 654 | lprbbi->fStyle = lpBand->fStyle; | 
|---|
| 655 |  | 
|---|
| 656 | if (lprbbi->fMask & RBBIM_COLORS) { | 
|---|
| 657 | lprbbi->clrFore = lpBand->clrFore; | 
|---|
| 658 | lprbbi->clrBack = lpBand->clrBack; | 
|---|
| 659 | } | 
|---|
| 660 |  | 
|---|
| 661 | if ((lprbbi->fMask & RBBIM_TEXT) && | 
|---|
| 662 | (lprbbi->lpText) && (lpBand->lpText)) { | 
|---|
| 663 | lstrcpynWtoA (lprbbi->lpText, lpBand->lpText,lprbbi->cch); | 
|---|
| 664 | } | 
|---|
| 665 |  | 
|---|
| 666 | if (lprbbi->fMask & RBBIM_IMAGE) | 
|---|
| 667 | lprbbi->iImage = lpBand->iImage; | 
|---|
| 668 |  | 
|---|
| 669 | if (lprbbi->fMask & RBBIM_CHILD) | 
|---|
| 670 | lprbbi->hwndChild = lpBand->hwndChild; | 
|---|
| 671 |  | 
|---|
| 672 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { | 
|---|
| 673 | lprbbi->cxMinChild = lpBand->cxMinChild; | 
|---|
| 674 | lprbbi->cyMinChild = lpBand->cyMinChild; | 
|---|
| 675 | lprbbi->cyMaxChild = lpBand->cyMaxChild; | 
|---|
| 676 | lprbbi->cyChild    = lpBand->cyChild; | 
|---|
| 677 | lprbbi->cyIntegral = lpBand->cyIntegral; | 
|---|
| 678 | } | 
|---|
| 679 |  | 
|---|
| 680 | if (lprbbi->fMask & RBBIM_SIZE) | 
|---|
| 681 | lprbbi->cx = lpBand->cx; | 
|---|
| 682 |  | 
|---|
| 683 | if (lprbbi->fMask & RBBIM_BACKGROUND) | 
|---|
| 684 | lprbbi->hbmBack = lpBand->hbmBack; | 
|---|
| 685 |  | 
|---|
| 686 | if (lprbbi->fMask & RBBIM_ID) | 
|---|
| 687 | lprbbi->wID = lpBand->wID; | 
|---|
| 688 |  | 
|---|
| 689 | /* check for additional data */ | 
|---|
| 690 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { | 
|---|
| 691 | if (lprbbi->fMask & RBBIM_IDEALSIZE) | 
|---|
| 692 | lprbbi->cxIdeal = lpBand->cxIdeal; | 
|---|
| 693 |  | 
|---|
| 694 | if (lprbbi->fMask & RBBIM_LPARAM) | 
|---|
| 695 | lprbbi->lParam = lpBand->lParam; | 
|---|
| 696 |  | 
|---|
| 697 | if (lprbbi->fMask & RBBIM_HEADERSIZE) | 
|---|
| 698 | lprbbi->cxHeader = lpBand->cxHeader; | 
|---|
| 699 | } | 
|---|
| 700 |  | 
|---|
| 701 | return TRUE; | 
|---|
| 702 | } | 
|---|
| 703 |  | 
|---|
| 704 |  | 
|---|
| 705 | static LRESULT | 
|---|
| 706 | REBAR_GetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 707 | { | 
|---|
| 708 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 709 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; | 
|---|
| 710 | REBAR_BAND *lpBand; | 
|---|
| 711 |  | 
|---|
| 712 | if (lprbbi == NULL) | 
|---|
| 713 | return FALSE; | 
|---|
| 714 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) | 
|---|
| 715 | return FALSE; | 
|---|
| 716 | if ((UINT)wParam >= infoPtr->uNumBands) | 
|---|
| 717 | return FALSE; | 
|---|
| 718 |  | 
|---|
| 719 | //    TRACE (rebar, "index %u\n", (UINT)wParam); | 
|---|
| 720 |  | 
|---|
| 721 | /* copy band information */ | 
|---|
| 722 | lpBand = &infoPtr->bands[(UINT)wParam]; | 
|---|
| 723 |  | 
|---|
| 724 | if (lprbbi->fMask & RBBIM_STYLE) | 
|---|
| 725 | lprbbi->fStyle = lpBand->fStyle; | 
|---|
| 726 |  | 
|---|
| 727 | if (lprbbi->fMask & RBBIM_COLORS) { | 
|---|
| 728 | lprbbi->clrFore = lpBand->clrFore; | 
|---|
| 729 | lprbbi->clrBack = lpBand->clrBack; | 
|---|
| 730 | } | 
|---|
| 731 |  | 
|---|
| 732 | if ((lprbbi->fMask & RBBIM_TEXT) && | 
|---|
| 733 | (lprbbi->lpText) && (lpBand->lpText)) { | 
|---|
| 734 | lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch); | 
|---|
| 735 | } | 
|---|
| 736 |  | 
|---|
| 737 | if (lprbbi->fMask & RBBIM_IMAGE) | 
|---|
| 738 | lprbbi->iImage = lpBand->iImage; | 
|---|
| 739 |  | 
|---|
| 740 | if (lprbbi->fMask & RBBIM_CHILD) | 
|---|
| 741 | lprbbi->hwndChild = lpBand->hwndChild; | 
|---|
| 742 |  | 
|---|
| 743 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { | 
|---|
| 744 | lprbbi->cxMinChild = lpBand->cxMinChild; | 
|---|
| 745 | lprbbi->cyMinChild = lpBand->cyMinChild; | 
|---|
| 746 | lprbbi->cyMaxChild = lpBand->cyMaxChild; | 
|---|
| 747 | lprbbi->cyChild    = lpBand->cyChild; | 
|---|
| 748 | lprbbi->cyIntegral = lpBand->cyIntegral; | 
|---|
| 749 | } | 
|---|
| 750 |  | 
|---|
| 751 | if (lprbbi->fMask & RBBIM_SIZE) | 
|---|
| 752 | lprbbi->cx = lpBand->cx; | 
|---|
| 753 |  | 
|---|
| 754 | if (lprbbi->fMask & RBBIM_BACKGROUND) | 
|---|
| 755 | lprbbi->hbmBack = lpBand->hbmBack; | 
|---|
| 756 |  | 
|---|
| 757 | if (lprbbi->fMask & RBBIM_ID) | 
|---|
| 758 | lprbbi->wID = lpBand->wID; | 
|---|
| 759 |  | 
|---|
| 760 | /* check for additional data */ | 
|---|
| 761 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { | 
|---|
| 762 | if (lprbbi->fMask & RBBIM_IDEALSIZE) | 
|---|
| 763 | lprbbi->cxIdeal = lpBand->cxIdeal; | 
|---|
| 764 |  | 
|---|
| 765 | if (lprbbi->fMask & RBBIM_LPARAM) | 
|---|
| 766 | lprbbi->lParam = lpBand->lParam; | 
|---|
| 767 |  | 
|---|
| 768 | if (lprbbi->fMask & RBBIM_HEADERSIZE) | 
|---|
| 769 | lprbbi->cxHeader = lpBand->cxHeader; | 
|---|
| 770 | } | 
|---|
| 771 |  | 
|---|
| 772 | return TRUE; | 
|---|
| 773 | } | 
|---|
| 774 |  | 
|---|
| 775 |  | 
|---|
| 776 | static LRESULT | 
|---|
| 777 | REBAR_GetBarHeight (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 778 | { | 
|---|
| 779 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 780 | INT nHeight; | 
|---|
| 781 |  | 
|---|
| 782 | REBAR_Layout (hwnd, NULL); | 
|---|
| 783 | nHeight = infoPtr->calcSize.cy; | 
|---|
| 784 |  | 
|---|
| 785 | if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) | 
|---|
| 786 | nHeight += (2 * GetSystemMetrics(SM_CYEDGE)); | 
|---|
| 787 |  | 
|---|
| 788 |  | 
|---|
| 789 | //    FIXME (rebar, "height = %d\n", nHeight); | 
|---|
| 790 |  | 
|---|
| 791 | return nHeight; | 
|---|
| 792 | } | 
|---|
| 793 |  | 
|---|
| 794 |  | 
|---|
| 795 | static LRESULT | 
|---|
| 796 | REBAR_GetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 797 | { | 
|---|
| 798 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 799 | LPREBARINFO lpInfo = (LPREBARINFO)lParam; | 
|---|
| 800 |  | 
|---|
| 801 | if (lpInfo == NULL) | 
|---|
| 802 | return FALSE; | 
|---|
| 803 |  | 
|---|
| 804 | if (lpInfo->cbSize < sizeof (REBARINFO)) | 
|---|
| 805 | return FALSE; | 
|---|
| 806 |  | 
|---|
| 807 | //    TRACE (rebar, "getting bar info!\n"); | 
|---|
| 808 |  | 
|---|
| 809 | if (infoPtr->himl) { | 
|---|
| 810 | lpInfo->himl = infoPtr->himl; | 
|---|
| 811 | lpInfo->fMask |= RBIM_IMAGELIST; | 
|---|
| 812 | } | 
|---|
| 813 |  | 
|---|
| 814 | return TRUE; | 
|---|
| 815 | } | 
|---|
| 816 |  | 
|---|
| 817 |  | 
|---|
| 818 | static LRESULT | 
|---|
| 819 | REBAR_GetBkColor (HWND hwnd) | 
|---|
| 820 | { | 
|---|
| 821 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 822 |  | 
|---|
| 823 | //    TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk); | 
|---|
| 824 |  | 
|---|
| 825 | return infoPtr->clrBk; | 
|---|
| 826 | } | 
|---|
| 827 |  | 
|---|
| 828 |  | 
|---|
| 829 | /* << REBAR_GetColorScheme >> */ | 
|---|
| 830 | /* << REBAR_GetDropTarget >> */ | 
|---|
| 831 |  | 
|---|
| 832 |  | 
|---|
| 833 | static LRESULT | 
|---|
| 834 | REBAR_GetPalette (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 835 | { | 
|---|
| 836 | //    FIXME (rebar, "empty stub!\n"); | 
|---|
| 837 |  | 
|---|
| 838 | return 0; | 
|---|
| 839 | } | 
|---|
| 840 |  | 
|---|
| 841 |  | 
|---|
| 842 | static LRESULT | 
|---|
| 843 | REBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 844 | { | 
|---|
| 845 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 846 | INT iBand = (INT)wParam; | 
|---|
| 847 | LPRECT lprc = (LPRECT)lParam; | 
|---|
| 848 | REBAR_BAND *lpBand; | 
|---|
| 849 |  | 
|---|
| 850 | if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands)) | 
|---|
| 851 | return FALSE; | 
|---|
| 852 | if (!lprc) | 
|---|
| 853 | return FALSE; | 
|---|
| 854 |  | 
|---|
| 855 | //    TRACE (rebar, "band %d\n", iBand); | 
|---|
| 856 |  | 
|---|
| 857 | lpBand = &infoPtr->bands[iBand]; | 
|---|
| 858 | CopyRect (lprc, &lpBand->rcBand); | 
|---|
| 859 | /* | 
|---|
| 860 | lprc->left   = lpBand->rcBand.left; | 
|---|
| 861 | lprc->top    = lpBand->rcBand.top; | 
|---|
| 862 | lprc->right  = lpBand->rcBand.right; | 
|---|
| 863 | lprc->bottom = lpBand->rcBand.bottom; | 
|---|
| 864 | */ | 
|---|
| 865 |  | 
|---|
| 866 | return TRUE; | 
|---|
| 867 | } | 
|---|
| 868 |  | 
|---|
| 869 |  | 
|---|
| 870 | static LRESULT | 
|---|
| 871 | REBAR_GetRowCount (HWND hwnd) | 
|---|
| 872 | { | 
|---|
| 873 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 874 |  | 
|---|
| 875 | //    FIXME (rebar, "%u : semi stub!\n", infoPtr->uNumBands); | 
|---|
| 876 |  | 
|---|
| 877 | return infoPtr->uNumBands; | 
|---|
| 878 | } | 
|---|
| 879 |  | 
|---|
| 880 |  | 
|---|
| 881 | static LRESULT | 
|---|
| 882 | REBAR_GetRowHeight (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 883 | { | 
|---|
| 884 | /*    REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ | 
|---|
| 885 |  | 
|---|
| 886 | //    FIXME (rebar, "-- height = 20: semi stub!\n"); | 
|---|
| 887 |  | 
|---|
| 888 | return 20; | 
|---|
| 889 | } | 
|---|
| 890 |  | 
|---|
| 891 |  | 
|---|
| 892 | static LRESULT | 
|---|
| 893 | REBAR_GetTextColor (HWND hwnd) | 
|---|
| 894 | { | 
|---|
| 895 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 896 |  | 
|---|
| 897 | //    TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText); | 
|---|
| 898 |  | 
|---|
| 899 | return infoPtr->clrText; | 
|---|
| 900 | } | 
|---|
| 901 |  | 
|---|
| 902 |  | 
|---|
| 903 | static LRESULT | 
|---|
| 904 | REBAR_GetToolTips (HWND hwnd) | 
|---|
| 905 | { | 
|---|
| 906 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 907 | return infoPtr->hwndToolTip; | 
|---|
| 908 | } | 
|---|
| 909 |  | 
|---|
| 910 |  | 
|---|
| 911 | static LRESULT | 
|---|
| 912 | REBAR_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 913 | { | 
|---|
| 914 | /* REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ | 
|---|
| 915 | LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; | 
|---|
| 916 |  | 
|---|
| 917 | if (!lprbht) | 
|---|
| 918 | return -1; | 
|---|
| 919 |  | 
|---|
| 920 | REBAR_InternalHitTest (hwnd, &lprbht->pt, &lprbht->flags, &lprbht->iBand); | 
|---|
| 921 |  | 
|---|
| 922 | return lprbht->iBand; | 
|---|
| 923 | } | 
|---|
| 924 |  | 
|---|
| 925 |  | 
|---|
| 926 | static LRESULT | 
|---|
| 927 | REBAR_IdToIndex (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 928 | { | 
|---|
| 929 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 930 | UINT i; | 
|---|
| 931 |  | 
|---|
| 932 | if (infoPtr == NULL) | 
|---|
| 933 | return -1; | 
|---|
| 934 |  | 
|---|
| 935 | if (infoPtr->uNumBands < 1) | 
|---|
| 936 | return -1; | 
|---|
| 937 |  | 
|---|
| 938 | //    TRACE (rebar, "id %u\n", (UINT)wParam); | 
|---|
| 939 |  | 
|---|
| 940 | for (i = 0; i < infoPtr->uNumBands; i++) { | 
|---|
| 941 | if (infoPtr->bands[i].wID == (UINT)wParam) { | 
|---|
| 942 | //          TRACE (rebar, "band %u found!\n", i); | 
|---|
| 943 | return i; | 
|---|
| 944 | } | 
|---|
| 945 | } | 
|---|
| 946 |  | 
|---|
| 947 | //    TRACE (rebar, "no band found!\n"); | 
|---|
| 948 | return -1; | 
|---|
| 949 | } | 
|---|
| 950 |  | 
|---|
| 951 |  | 
|---|
| 952 | static LRESULT | 
|---|
| 953 | REBAR_InsertBandA (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 954 | { | 
|---|
| 955 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 956 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; | 
|---|
| 957 | UINT uIndex = (UINT)wParam; | 
|---|
| 958 | REBAR_BAND *lpBand; | 
|---|
| 959 |  | 
|---|
| 960 | if (infoPtr == NULL) | 
|---|
| 961 | return FALSE; | 
|---|
| 962 | if (lprbbi == NULL) | 
|---|
| 963 | return FALSE; | 
|---|
| 964 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) | 
|---|
| 965 | return FALSE; | 
|---|
| 966 |  | 
|---|
| 967 | //    TRACE (rebar, "insert band at %u!\n", uIndex); | 
|---|
| 968 |  | 
|---|
| 969 | if (infoPtr->uNumBands == 0) { | 
|---|
| 970 | infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); | 
|---|
| 971 | uIndex = 0; | 
|---|
| 972 | } | 
|---|
| 973 | else { | 
|---|
| 974 | REBAR_BAND *oldBands = infoPtr->bands; | 
|---|
| 975 | infoPtr->bands = | 
|---|
| 976 | (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); | 
|---|
| 977 | if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) | 
|---|
| 978 | uIndex = infoPtr->uNumBands; | 
|---|
| 979 |  | 
|---|
| 980 | /* pre insert copy */ | 
|---|
| 981 | if (uIndex > 0) { | 
|---|
| 982 | memcpy (&infoPtr->bands[0], &oldBands[0], | 
|---|
| 983 | uIndex * sizeof(REBAR_BAND)); | 
|---|
| 984 | } | 
|---|
| 985 |  | 
|---|
| 986 | /* post copy */ | 
|---|
| 987 | if (uIndex < infoPtr->uNumBands - 1) { | 
|---|
| 988 | memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], | 
|---|
| 989 | (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); | 
|---|
| 990 | } | 
|---|
| 991 |  | 
|---|
| 992 | COMCTL32_Free (oldBands); | 
|---|
| 993 | } | 
|---|
| 994 |  | 
|---|
| 995 | infoPtr->uNumBands++; | 
|---|
| 996 |  | 
|---|
| 997 | //    TRACE (rebar, "index %u!\n", uIndex); | 
|---|
| 998 |  | 
|---|
| 999 | /* initialize band (infoPtr->bands[uIndex])*/ | 
|---|
| 1000 | lpBand = &infoPtr->bands[uIndex]; | 
|---|
| 1001 |  | 
|---|
| 1002 | if (lprbbi->fMask & RBBIM_STYLE) | 
|---|
| 1003 | lpBand->fStyle = lprbbi->fStyle; | 
|---|
| 1004 |  | 
|---|
| 1005 | if (lprbbi->fMask & RBBIM_COLORS) { | 
|---|
| 1006 | lpBand->clrFore = lprbbi->clrFore; | 
|---|
| 1007 | lpBand->clrBack = lprbbi->clrBack; | 
|---|
| 1008 | } | 
|---|
| 1009 | else { | 
|---|
| 1010 | lpBand->clrFore = CLR_NONE; | 
|---|
| 1011 | lpBand->clrBack = CLR_NONE; | 
|---|
| 1012 | } | 
|---|
| 1013 |  | 
|---|
| 1014 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { | 
|---|
| 1015 | INT len = lstrlenA (lprbbi->lpText); | 
|---|
| 1016 | if (len > 0) { | 
|---|
| 1017 | lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); | 
|---|
| 1018 | lstrcpyAtoW (lpBand->lpText, lprbbi->lpText); | 
|---|
| 1019 | } | 
|---|
| 1020 | } | 
|---|
| 1021 |  | 
|---|
| 1022 | if (lprbbi->fMask & RBBIM_IMAGE) | 
|---|
| 1023 | lpBand->iImage = lprbbi->iImage; | 
|---|
| 1024 | else | 
|---|
| 1025 | lpBand->iImage = -1; | 
|---|
| 1026 |  | 
|---|
| 1027 | if (lprbbi->fMask & RBBIM_CHILD) { | 
|---|
| 1028 | //      TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild); | 
|---|
| 1029 | lpBand->hwndChild = lprbbi->hwndChild; | 
|---|
| 1030 | lpBand->hwndPrevParent = | 
|---|
| 1031 | SetParent (lpBand->hwndChild, hwnd); | 
|---|
| 1032 | } | 
|---|
| 1033 |  | 
|---|
| 1034 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { | 
|---|
| 1035 | lpBand->cxMinChild = lprbbi->cxMinChild; | 
|---|
| 1036 | lpBand->cyMinChild = lprbbi->cyMinChild; | 
|---|
| 1037 | lpBand->cyMaxChild = lprbbi->cyMaxChild; | 
|---|
| 1038 | lpBand->cyChild    = lprbbi->cyChild; | 
|---|
| 1039 | lpBand->cyIntegral = lprbbi->cyIntegral; | 
|---|
| 1040 | } | 
|---|
| 1041 | else { | 
|---|
| 1042 | lpBand->cxMinChild = -1; | 
|---|
| 1043 | lpBand->cyMinChild = -1; | 
|---|
| 1044 | lpBand->cyMaxChild = -1; | 
|---|
| 1045 | lpBand->cyChild    = -1; | 
|---|
| 1046 | lpBand->cyIntegral = -1; | 
|---|
| 1047 | } | 
|---|
| 1048 |  | 
|---|
| 1049 | if (lprbbi->fMask & RBBIM_SIZE) | 
|---|
| 1050 | lpBand->cx = lprbbi->cx; | 
|---|
| 1051 | else | 
|---|
| 1052 | lpBand->cx = -1; | 
|---|
| 1053 |  | 
|---|
| 1054 | if (lprbbi->fMask & RBBIM_BACKGROUND) | 
|---|
| 1055 | lpBand->hbmBack = lprbbi->hbmBack; | 
|---|
| 1056 |  | 
|---|
| 1057 | if (lprbbi->fMask & RBBIM_ID) | 
|---|
| 1058 | lpBand->wID = lprbbi->wID; | 
|---|
| 1059 |  | 
|---|
| 1060 | /* check for additional data */ | 
|---|
| 1061 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { | 
|---|
| 1062 | if (lprbbi->fMask & RBBIM_IDEALSIZE) | 
|---|
| 1063 | lpBand->cxIdeal = lprbbi->cxIdeal; | 
|---|
| 1064 |  | 
|---|
| 1065 | if (lprbbi->fMask & RBBIM_LPARAM) | 
|---|
| 1066 | lpBand->lParam = lprbbi->lParam; | 
|---|
| 1067 |  | 
|---|
| 1068 | if (lprbbi->fMask & RBBIM_HEADERSIZE) | 
|---|
| 1069 | lpBand->cxHeader = lprbbi->cxHeader; | 
|---|
| 1070 | } | 
|---|
| 1071 |  | 
|---|
| 1072 |  | 
|---|
| 1073 | REBAR_Layout (hwnd, NULL); | 
|---|
| 1074 | REBAR_ForceResize (hwnd); | 
|---|
| 1075 | REBAR_MoveChildWindows (hwnd); | 
|---|
| 1076 |  | 
|---|
| 1077 | return TRUE; | 
|---|
| 1078 | } | 
|---|
| 1079 |  | 
|---|
| 1080 |  | 
|---|
| 1081 | static LRESULT | 
|---|
| 1082 | REBAR_InsertBandW (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1083 | { | 
|---|
| 1084 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1085 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; | 
|---|
| 1086 | UINT uIndex = (UINT)wParam; | 
|---|
| 1087 | REBAR_BAND *lpBand; | 
|---|
| 1088 |  | 
|---|
| 1089 | if (infoPtr == NULL) | 
|---|
| 1090 | return FALSE; | 
|---|
| 1091 | if (lprbbi == NULL) | 
|---|
| 1092 | return FALSE; | 
|---|
| 1093 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) | 
|---|
| 1094 | return FALSE; | 
|---|
| 1095 |  | 
|---|
| 1096 | //    TRACE (rebar, "insert band at %u!\n", uIndex); | 
|---|
| 1097 |  | 
|---|
| 1098 | if (infoPtr->uNumBands == 0) { | 
|---|
| 1099 | infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND)); | 
|---|
| 1100 | uIndex = 0; | 
|---|
| 1101 | } | 
|---|
| 1102 | else { | 
|---|
| 1103 | REBAR_BAND *oldBands = infoPtr->bands; | 
|---|
| 1104 | infoPtr->bands = | 
|---|
| 1105 | (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); | 
|---|
| 1106 | if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands)) | 
|---|
| 1107 | uIndex = infoPtr->uNumBands; | 
|---|
| 1108 |  | 
|---|
| 1109 | /* pre insert copy */ | 
|---|
| 1110 | if (uIndex > 0) { | 
|---|
| 1111 | memcpy (&infoPtr->bands[0], &oldBands[0], | 
|---|
| 1112 | uIndex * sizeof(REBAR_BAND)); | 
|---|
| 1113 | } | 
|---|
| 1114 |  | 
|---|
| 1115 | /* post copy */ | 
|---|
| 1116 | if (uIndex < infoPtr->uNumBands - 1) { | 
|---|
| 1117 | memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], | 
|---|
| 1118 | (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); | 
|---|
| 1119 | } | 
|---|
| 1120 |  | 
|---|
| 1121 | COMCTL32_Free (oldBands); | 
|---|
| 1122 | } | 
|---|
| 1123 |  | 
|---|
| 1124 | infoPtr->uNumBands++; | 
|---|
| 1125 |  | 
|---|
| 1126 | //    TRACE (rebar, "index %u!\n", uIndex); | 
|---|
| 1127 |  | 
|---|
| 1128 | /* initialize band (infoPtr->bands[uIndex])*/ | 
|---|
| 1129 | lpBand = &infoPtr->bands[uIndex]; | 
|---|
| 1130 |  | 
|---|
| 1131 | if (lprbbi->fMask & RBBIM_STYLE) | 
|---|
| 1132 | lpBand->fStyle = lprbbi->fStyle; | 
|---|
| 1133 |  | 
|---|
| 1134 | if (lprbbi->fMask & RBBIM_COLORS) { | 
|---|
| 1135 | lpBand->clrFore = lprbbi->clrFore; | 
|---|
| 1136 | lpBand->clrBack = lprbbi->clrBack; | 
|---|
| 1137 | } | 
|---|
| 1138 | else { | 
|---|
| 1139 | lpBand->clrFore = CLR_NONE; | 
|---|
| 1140 | lpBand->clrBack = CLR_NONE; | 
|---|
| 1141 | } | 
|---|
| 1142 |  | 
|---|
| 1143 | if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { | 
|---|
| 1144 | INT len = lstrlenW (lprbbi->lpText); | 
|---|
| 1145 | if (len > 0) { | 
|---|
| 1146 | lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); | 
|---|
| 1147 | lstrcpyW (lpBand->lpText, lprbbi->lpText); | 
|---|
| 1148 | } | 
|---|
| 1149 | } | 
|---|
| 1150 |  | 
|---|
| 1151 | if (lprbbi->fMask & RBBIM_IMAGE) | 
|---|
| 1152 | lpBand->iImage = lprbbi->iImage; | 
|---|
| 1153 | else | 
|---|
| 1154 | lpBand->iImage = -1; | 
|---|
| 1155 |  | 
|---|
| 1156 | if (lprbbi->fMask & RBBIM_CHILD) { | 
|---|
| 1157 | //      TRACE (rebar, "hwndChild = %x\n", lprbbi->hwndChild); | 
|---|
| 1158 | lpBand->hwndChild = lprbbi->hwndChild; | 
|---|
| 1159 | lpBand->hwndPrevParent = | 
|---|
| 1160 | SetParent (lpBand->hwndChild, hwnd); | 
|---|
| 1161 | } | 
|---|
| 1162 |  | 
|---|
| 1163 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { | 
|---|
| 1164 | lpBand->cxMinChild = lprbbi->cxMinChild; | 
|---|
| 1165 | lpBand->cyMinChild = lprbbi->cyMinChild; | 
|---|
| 1166 | lpBand->cyMaxChild = lprbbi->cyMaxChild; | 
|---|
| 1167 | lpBand->cyChild    = lprbbi->cyChild; | 
|---|
| 1168 | lpBand->cyIntegral = lprbbi->cyIntegral; | 
|---|
| 1169 | } | 
|---|
| 1170 | else { | 
|---|
| 1171 | lpBand->cxMinChild = -1; | 
|---|
| 1172 | lpBand->cyMinChild = -1; | 
|---|
| 1173 | lpBand->cyMaxChild = -1; | 
|---|
| 1174 | lpBand->cyChild    = -1; | 
|---|
| 1175 | lpBand->cyIntegral = -1; | 
|---|
| 1176 | } | 
|---|
| 1177 |  | 
|---|
| 1178 | if (lprbbi->fMask & RBBIM_SIZE) | 
|---|
| 1179 | lpBand->cx = lprbbi->cx; | 
|---|
| 1180 | else | 
|---|
| 1181 | lpBand->cx = -1; | 
|---|
| 1182 |  | 
|---|
| 1183 | if (lprbbi->fMask & RBBIM_BACKGROUND) | 
|---|
| 1184 | lpBand->hbmBack = lprbbi->hbmBack; | 
|---|
| 1185 |  | 
|---|
| 1186 | if (lprbbi->fMask & RBBIM_ID) | 
|---|
| 1187 | lpBand->wID = lprbbi->wID; | 
|---|
| 1188 |  | 
|---|
| 1189 | /* check for additional data */ | 
|---|
| 1190 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) { | 
|---|
| 1191 | if (lprbbi->fMask & RBBIM_IDEALSIZE) | 
|---|
| 1192 | lpBand->cxIdeal = lprbbi->cxIdeal; | 
|---|
| 1193 |  | 
|---|
| 1194 | if (lprbbi->fMask & RBBIM_LPARAM) | 
|---|
| 1195 | lpBand->lParam = lprbbi->lParam; | 
|---|
| 1196 |  | 
|---|
| 1197 | if (lprbbi->fMask & RBBIM_HEADERSIZE) | 
|---|
| 1198 | lpBand->cxHeader = lprbbi->cxHeader; | 
|---|
| 1199 | } | 
|---|
| 1200 |  | 
|---|
| 1201 |  | 
|---|
| 1202 | REBAR_Layout (hwnd, NULL); | 
|---|
| 1203 | REBAR_ForceResize (hwnd); | 
|---|
| 1204 | REBAR_MoveChildWindows (hwnd); | 
|---|
| 1205 |  | 
|---|
| 1206 | return TRUE; | 
|---|
| 1207 | } | 
|---|
| 1208 |  | 
|---|
| 1209 |  | 
|---|
| 1210 | static LRESULT | 
|---|
| 1211 | REBAR_MaximizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1212 | { | 
|---|
| 1213 | /*    REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ | 
|---|
| 1214 |  | 
|---|
| 1215 | //    FIXME (rebar, "(uBand = %u fIdeal = %s)\n", | 
|---|
| 1216 | //         (UINT)wParam, lParam ? "TRUE" : "FALSE"); | 
|---|
| 1217 |  | 
|---|
| 1218 |  | 
|---|
| 1219 | return 0; | 
|---|
| 1220 | } | 
|---|
| 1221 |  | 
|---|
| 1222 |  | 
|---|
| 1223 | static LRESULT | 
|---|
| 1224 | REBAR_MinimizeBand (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1225 | { | 
|---|
| 1226 | /*    REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ | 
|---|
| 1227 |  | 
|---|
| 1228 | //    FIXME (rebar, "(uBand = %u)\n", (UINT)wParam); | 
|---|
| 1229 |  | 
|---|
| 1230 |  | 
|---|
| 1231 | return 0; | 
|---|
| 1232 | } | 
|---|
| 1233 |  | 
|---|
| 1234 |  | 
|---|
| 1235 | static LRESULT | 
|---|
| 1236 | REBAR_MoveBand (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1237 | { | 
|---|
| 1238 | /*    REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); */ | 
|---|
| 1239 |  | 
|---|
| 1240 | //    FIXME (rebar, "(iFrom = %u iTof = %u)\n", | 
|---|
| 1241 | //         (UINT)wParam, (UINT)lParam); | 
|---|
| 1242 |  | 
|---|
| 1243 |  | 
|---|
| 1244 | return FALSE; | 
|---|
| 1245 | } | 
|---|
| 1246 |  | 
|---|
| 1247 |  | 
|---|
| 1248 | static LRESULT | 
|---|
| 1249 | REBAR_SetBandInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1250 | { | 
|---|
| 1251 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1252 | LPREBARBANDINFOA lprbbi = (LPREBARBANDINFOA)lParam; | 
|---|
| 1253 | REBAR_BAND *lpBand; | 
|---|
| 1254 |  | 
|---|
| 1255 | if (lprbbi == NULL) | 
|---|
| 1256 | return FALSE; | 
|---|
| 1257 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA) | 
|---|
| 1258 | return FALSE; | 
|---|
| 1259 | if ((UINT)wParam >= infoPtr->uNumBands) | 
|---|
| 1260 | return FALSE; | 
|---|
| 1261 |  | 
|---|
| 1262 | //    TRACE (rebar, "index %u\n", (UINT)wParam); | 
|---|
| 1263 |  | 
|---|
| 1264 | /* set band information */ | 
|---|
| 1265 | lpBand = &infoPtr->bands[(UINT)wParam]; | 
|---|
| 1266 |  | 
|---|
| 1267 | if (lprbbi->fMask & RBBIM_STYLE) | 
|---|
| 1268 | lpBand->fStyle = lprbbi->fStyle; | 
|---|
| 1269 |  | 
|---|
| 1270 | if (lprbbi->fMask & RBBIM_COLORS) { | 
|---|
| 1271 | lpBand->clrFore = lprbbi->clrFore; | 
|---|
| 1272 | lpBand->clrBack = lprbbi->clrBack; | 
|---|
| 1273 | } | 
|---|
| 1274 |  | 
|---|
| 1275 | if (lprbbi->fMask & RBBIM_TEXT) { | 
|---|
| 1276 | if (lpBand->lpText) { | 
|---|
| 1277 | COMCTL32_Free (lpBand->lpText); | 
|---|
| 1278 | lpBand->lpText = NULL; | 
|---|
| 1279 | } | 
|---|
| 1280 | if (lprbbi->lpText) { | 
|---|
| 1281 | INT len = lstrlenA (lprbbi->lpText); | 
|---|
| 1282 | lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); | 
|---|
| 1283 | lstrcpyAtoW (lpBand->lpText, lprbbi->lpText); | 
|---|
| 1284 | } | 
|---|
| 1285 | } | 
|---|
| 1286 |  | 
|---|
| 1287 | if (lprbbi->fMask & RBBIM_IMAGE) | 
|---|
| 1288 | lpBand->iImage = lprbbi->iImage; | 
|---|
| 1289 |  | 
|---|
| 1290 | if (lprbbi->fMask & RBBIM_CHILD) { | 
|---|
| 1291 | if (lprbbi->hwndChild) { | 
|---|
| 1292 | lpBand->hwndChild = lprbbi->hwndChild; | 
|---|
| 1293 | lpBand->hwndPrevParent = | 
|---|
| 1294 | SetParent (lpBand->hwndChild, hwnd); | 
|---|
| 1295 | } | 
|---|
| 1296 | else { | 
|---|
| 1297 | //          TRACE (rebar, "child: 0x%x  prev parent: 0x%x\n", | 
|---|
| 1298 | //                 lpBand->hwndChild, lpBand->hwndPrevParent); | 
|---|
| 1299 | lpBand->hwndChild = 0; | 
|---|
| 1300 | lpBand->hwndPrevParent = 0; | 
|---|
| 1301 | } | 
|---|
| 1302 | } | 
|---|
| 1303 |  | 
|---|
| 1304 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { | 
|---|
| 1305 | lpBand->cxMinChild = lprbbi->cxMinChild; | 
|---|
| 1306 | lpBand->cyMinChild = lprbbi->cyMinChild; | 
|---|
| 1307 | lpBand->cyMaxChild = lprbbi->cyMaxChild; | 
|---|
| 1308 | lpBand->cyChild    = lprbbi->cyChild; | 
|---|
| 1309 | lpBand->cyIntegral = lprbbi->cyIntegral; | 
|---|
| 1310 | } | 
|---|
| 1311 |  | 
|---|
| 1312 | if (lprbbi->fMask & RBBIM_SIZE) | 
|---|
| 1313 | lpBand->cx = lprbbi->cx; | 
|---|
| 1314 |  | 
|---|
| 1315 | if (lprbbi->fMask & RBBIM_BACKGROUND) | 
|---|
| 1316 | lpBand->hbmBack = lprbbi->hbmBack; | 
|---|
| 1317 |  | 
|---|
| 1318 | if (lprbbi->fMask & RBBIM_ID) | 
|---|
| 1319 | lpBand->wID = lprbbi->wID; | 
|---|
| 1320 |  | 
|---|
| 1321 | /* check for additional data */ | 
|---|
| 1322 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) { | 
|---|
| 1323 | if (lprbbi->fMask & RBBIM_IDEALSIZE) | 
|---|
| 1324 | lpBand->cxIdeal = lprbbi->cxIdeal; | 
|---|
| 1325 |  | 
|---|
| 1326 | if (lprbbi->fMask & RBBIM_LPARAM) | 
|---|
| 1327 | lpBand->lParam = lprbbi->lParam; | 
|---|
| 1328 |  | 
|---|
| 1329 | if (lprbbi->fMask & RBBIM_HEADERSIZE) | 
|---|
| 1330 | lpBand->cxHeader = lprbbi->cxHeader; | 
|---|
| 1331 | } | 
|---|
| 1332 |  | 
|---|
| 1333 | REBAR_Layout (hwnd, NULL); | 
|---|
| 1334 | REBAR_ForceResize (hwnd); | 
|---|
| 1335 | REBAR_MoveChildWindows (hwnd); | 
|---|
| 1336 |  | 
|---|
| 1337 | return TRUE; | 
|---|
| 1338 | } | 
|---|
| 1339 |  | 
|---|
| 1340 |  | 
|---|
| 1341 | static LRESULT | 
|---|
| 1342 | REBAR_SetBandInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1343 | { | 
|---|
| 1344 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1345 | LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; | 
|---|
| 1346 | REBAR_BAND *lpBand; | 
|---|
| 1347 |  | 
|---|
| 1348 | if (lprbbi == NULL) | 
|---|
| 1349 | return FALSE; | 
|---|
| 1350 | if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW) | 
|---|
| 1351 | return FALSE; | 
|---|
| 1352 | if ((UINT)wParam >= infoPtr->uNumBands) | 
|---|
| 1353 | return FALSE; | 
|---|
| 1354 |  | 
|---|
| 1355 | //    TRACE (rebar, "index %u\n", (UINT)wParam); | 
|---|
| 1356 |  | 
|---|
| 1357 | /* set band information */ | 
|---|
| 1358 | lpBand = &infoPtr->bands[(UINT)wParam]; | 
|---|
| 1359 |  | 
|---|
| 1360 | if (lprbbi->fMask & RBBIM_STYLE) | 
|---|
| 1361 | lpBand->fStyle = lprbbi->fStyle; | 
|---|
| 1362 |  | 
|---|
| 1363 | if (lprbbi->fMask & RBBIM_COLORS) { | 
|---|
| 1364 | lpBand->clrFore = lprbbi->clrFore; | 
|---|
| 1365 | lpBand->clrBack = lprbbi->clrBack; | 
|---|
| 1366 | } | 
|---|
| 1367 |  | 
|---|
| 1368 | if (lprbbi->fMask & RBBIM_TEXT) { | 
|---|
| 1369 | if (lpBand->lpText) { | 
|---|
| 1370 | COMCTL32_Free (lpBand->lpText); | 
|---|
| 1371 | lpBand->lpText = NULL; | 
|---|
| 1372 | } | 
|---|
| 1373 | if (lprbbi->lpText) { | 
|---|
| 1374 | INT len = lstrlenW (lprbbi->lpText); | 
|---|
| 1375 | lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); | 
|---|
| 1376 | lstrcpyW (lpBand->lpText, lprbbi->lpText); | 
|---|
| 1377 | } | 
|---|
| 1378 | } | 
|---|
| 1379 |  | 
|---|
| 1380 | if (lprbbi->fMask & RBBIM_IMAGE) | 
|---|
| 1381 | lpBand->iImage = lprbbi->iImage; | 
|---|
| 1382 |  | 
|---|
| 1383 | if (lprbbi->fMask & RBBIM_CHILD) { | 
|---|
| 1384 | if (lprbbi->hwndChild) { | 
|---|
| 1385 | lpBand->hwndChild = lprbbi->hwndChild; | 
|---|
| 1386 | lpBand->hwndPrevParent = | 
|---|
| 1387 | SetParent (lpBand->hwndChild, hwnd); | 
|---|
| 1388 | } | 
|---|
| 1389 | else { | 
|---|
| 1390 | //          TRACE (rebar, "child: 0x%x  prev parent: 0x%x\n", | 
|---|
| 1391 | //                 lpBand->hwndChild, lpBand->hwndPrevParent); | 
|---|
| 1392 | lpBand->hwndChild = 0; | 
|---|
| 1393 | lpBand->hwndPrevParent = 0; | 
|---|
| 1394 | } | 
|---|
| 1395 | } | 
|---|
| 1396 |  | 
|---|
| 1397 | if (lprbbi->fMask & RBBIM_CHILDSIZE) { | 
|---|
| 1398 | lpBand->cxMinChild = lprbbi->cxMinChild; | 
|---|
| 1399 | lpBand->cyMinChild = lprbbi->cyMinChild; | 
|---|
| 1400 | lpBand->cyMaxChild = lprbbi->cyMaxChild; | 
|---|
| 1401 | lpBand->cyChild    = lprbbi->cyChild; | 
|---|
| 1402 | lpBand->cyIntegral = lprbbi->cyIntegral; | 
|---|
| 1403 | } | 
|---|
| 1404 |  | 
|---|
| 1405 | if (lprbbi->fMask & RBBIM_SIZE) | 
|---|
| 1406 | lpBand->cx = lprbbi->cx; | 
|---|
| 1407 |  | 
|---|
| 1408 | if (lprbbi->fMask & RBBIM_BACKGROUND) | 
|---|
| 1409 | lpBand->hbmBack = lprbbi->hbmBack; | 
|---|
| 1410 |  | 
|---|
| 1411 | if (lprbbi->fMask & RBBIM_ID) | 
|---|
| 1412 | lpBand->wID = lprbbi->wID; | 
|---|
| 1413 |  | 
|---|
| 1414 | /* check for additional data */ | 
|---|
| 1415 | if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) { | 
|---|
| 1416 | if (lprbbi->fMask & RBBIM_IDEALSIZE) | 
|---|
| 1417 | lpBand->cxIdeal = lprbbi->cxIdeal; | 
|---|
| 1418 |  | 
|---|
| 1419 | if (lprbbi->fMask & RBBIM_LPARAM) | 
|---|
| 1420 | lpBand->lParam = lprbbi->lParam; | 
|---|
| 1421 |  | 
|---|
| 1422 | if (lprbbi->fMask & RBBIM_HEADERSIZE) | 
|---|
| 1423 | lpBand->cxHeader = lprbbi->cxHeader; | 
|---|
| 1424 | } | 
|---|
| 1425 |  | 
|---|
| 1426 | REBAR_Layout (hwnd, NULL); | 
|---|
| 1427 | REBAR_ForceResize (hwnd); | 
|---|
| 1428 | REBAR_MoveChildWindows (hwnd); | 
|---|
| 1429 |  | 
|---|
| 1430 | return TRUE; | 
|---|
| 1431 | } | 
|---|
| 1432 |  | 
|---|
| 1433 |  | 
|---|
| 1434 | static LRESULT | 
|---|
| 1435 | REBAR_SetBarInfo (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1436 | { | 
|---|
| 1437 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1438 | LPREBARINFO lpInfo = (LPREBARINFO)lParam; | 
|---|
| 1439 |  | 
|---|
| 1440 | if (lpInfo == NULL) | 
|---|
| 1441 | return FALSE; | 
|---|
| 1442 |  | 
|---|
| 1443 | if (lpInfo->cbSize < sizeof (REBARINFO)) | 
|---|
| 1444 | return FALSE; | 
|---|
| 1445 |  | 
|---|
| 1446 | //    TRACE (rebar, "setting bar info!\n"); | 
|---|
| 1447 |  | 
|---|
| 1448 | if (lpInfo->fMask & RBIM_IMAGELIST) { | 
|---|
| 1449 | infoPtr->himl = lpInfo->himl; | 
|---|
| 1450 | if (infoPtr->himl) { | 
|---|
| 1451 | ImageList_GetIconSize (infoPtr->himl, &infoPtr->imageSize.cx, | 
|---|
| 1452 | &infoPtr->imageSize.cy); | 
|---|
| 1453 | } | 
|---|
| 1454 | else { | 
|---|
| 1455 | infoPtr->imageSize.cx = 0; | 
|---|
| 1456 | infoPtr->imageSize.cy = 0; | 
|---|
| 1457 | } | 
|---|
| 1458 | } | 
|---|
| 1459 |  | 
|---|
| 1460 | return TRUE; | 
|---|
| 1461 | } | 
|---|
| 1462 |  | 
|---|
| 1463 |  | 
|---|
| 1464 | static LRESULT | 
|---|
| 1465 | REBAR_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1466 | { | 
|---|
| 1467 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1468 | COLORREF clrTemp; | 
|---|
| 1469 |  | 
|---|
| 1470 | clrTemp = infoPtr->clrBk; | 
|---|
| 1471 | infoPtr->clrBk = (COLORREF)lParam; | 
|---|
| 1472 |  | 
|---|
| 1473 | //    TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk); | 
|---|
| 1474 |  | 
|---|
| 1475 | return clrTemp; | 
|---|
| 1476 | } | 
|---|
| 1477 |  | 
|---|
| 1478 |  | 
|---|
| 1479 | /* << REBAR_SetColorScheme >> */ | 
|---|
| 1480 | /* << REBAR_SetPalette >> */ | 
|---|
| 1481 |  | 
|---|
| 1482 |  | 
|---|
| 1483 | static LRESULT | 
|---|
| 1484 | REBAR_SetParent (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1485 | { | 
|---|
| 1486 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1487 | HWND hwndTemp = infoPtr->header.hwndNotify; | 
|---|
| 1488 |  | 
|---|
| 1489 | infoPtr->header.hwndNotify = (HWND)wParam; | 
|---|
| 1490 |  | 
|---|
| 1491 | return (LRESULT)hwndTemp; | 
|---|
| 1492 | } | 
|---|
| 1493 |  | 
|---|
| 1494 |  | 
|---|
| 1495 | static LRESULT | 
|---|
| 1496 | REBAR_SetTextColor (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1497 | { | 
|---|
| 1498 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1499 | COLORREF clrTemp; | 
|---|
| 1500 |  | 
|---|
| 1501 | clrTemp = infoPtr->clrText; | 
|---|
| 1502 | infoPtr->clrText = (COLORREF)lParam; | 
|---|
| 1503 |  | 
|---|
| 1504 | //    TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText); | 
|---|
| 1505 |  | 
|---|
| 1506 | return clrTemp; | 
|---|
| 1507 | } | 
|---|
| 1508 |  | 
|---|
| 1509 |  | 
|---|
| 1510 | /* << REBAR_SetTooltips >> */ | 
|---|
| 1511 |  | 
|---|
| 1512 |  | 
|---|
| 1513 | static LRESULT | 
|---|
| 1514 | REBAR_ShowBand (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1515 | { | 
|---|
| 1516 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1517 | REBAR_BAND *lpBand; | 
|---|
| 1518 |  | 
|---|
| 1519 | if (((INT)wParam < 0) || ((INT)wParam > infoPtr->uNumBands)) | 
|---|
| 1520 | return FALSE; | 
|---|
| 1521 |  | 
|---|
| 1522 | lpBand = &infoPtr->bands[(INT)wParam]; | 
|---|
| 1523 |  | 
|---|
| 1524 | if ((BOOL)lParam) { | 
|---|
| 1525 | //      TRACE (rebar, "show band %d\n", (INT)wParam); | 
|---|
| 1526 | lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN; | 
|---|
| 1527 | if (IsWindow (lpBand->hwndChild)) | 
|---|
| 1528 | ShowWindow (lpBand->hwndChild, SW_SHOW); | 
|---|
| 1529 | } | 
|---|
| 1530 | else { | 
|---|
| 1531 | //      TRACE (rebar, "hide band %d\n", (INT)wParam); | 
|---|
| 1532 | lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN; | 
|---|
| 1533 | if (IsWindow (lpBand->hwndChild)) | 
|---|
| 1534 | ShowWindow (lpBand->hwndChild, SW_SHOW); | 
|---|
| 1535 | } | 
|---|
| 1536 |  | 
|---|
| 1537 | REBAR_Layout (hwnd, NULL); | 
|---|
| 1538 | REBAR_ForceResize (hwnd); | 
|---|
| 1539 | REBAR_MoveChildWindows (hwnd); | 
|---|
| 1540 |  | 
|---|
| 1541 | return TRUE; | 
|---|
| 1542 | } | 
|---|
| 1543 |  | 
|---|
| 1544 |  | 
|---|
| 1545 | static LRESULT | 
|---|
| 1546 | REBAR_SizeToRect (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1547 | { | 
|---|
| 1548 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1549 | LPRECT lpRect = (LPRECT)lParam; | 
|---|
| 1550 |  | 
|---|
| 1551 | if (lpRect == NULL) | 
|---|
| 1552 | return FALSE; | 
|---|
| 1553 |  | 
|---|
| 1554 | //    FIXME (rebar, "layout change not implemented!\n"); | 
|---|
| 1555 | //    FIXME (rebar, "[%d %d %d %d]\n", | 
|---|
| 1556 | //         lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); | 
|---|
| 1557 |  | 
|---|
| 1558 | #if 0 | 
|---|
| 1559 | SetWindowPos (hwnd, 0, lpRect->left, lpRect->top, | 
|---|
| 1560 | lpRect->right - lpRect->left, lpRect->bottom - lpRect->top, | 
|---|
| 1561 | SWP_NOZORDER); | 
|---|
| 1562 | #endif | 
|---|
| 1563 |  | 
|---|
| 1564 | infoPtr->calcSize.cx = lpRect->right - lpRect->left; | 
|---|
| 1565 | infoPtr->calcSize.cy = lpRect->bottom - lpRect->top; | 
|---|
| 1566 |  | 
|---|
| 1567 | REBAR_ForceResize (hwnd); | 
|---|
| 1568 | return TRUE; | 
|---|
| 1569 | } | 
|---|
| 1570 |  | 
|---|
| 1571 |  | 
|---|
| 1572 |  | 
|---|
| 1573 | static LRESULT | 
|---|
| 1574 | REBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1575 | { | 
|---|
| 1576 | REBAR_INFO *infoPtr; | 
|---|
| 1577 |  | 
|---|
| 1578 | /* allocate memory for info structure */ | 
|---|
| 1579 | infoPtr = (REBAR_INFO*)initControl(hwnd,sizeof(REBAR_INFO)); | 
|---|
| 1580 |  | 
|---|
| 1581 | /* initialize info structure */ | 
|---|
| 1582 | infoPtr->clrBk = CLR_NONE; | 
|---|
| 1583 | infoPtr->clrText = RGB(0, 0, 0); | 
|---|
| 1584 |  | 
|---|
| 1585 | infoPtr->bAutoResize = FALSE; | 
|---|
| 1586 | infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA); | 
|---|
| 1587 | infoPtr->hcurHorz  = LoadCursorA (0, IDC_SIZEWEA); | 
|---|
| 1588 | infoPtr->hcurVert  = LoadCursorA (0, IDC_SIZENSA); | 
|---|
| 1589 | infoPtr->hcurDrag  = LoadCursorA (0, IDC_SIZEA); | 
|---|
| 1590 |  | 
|---|
| 1591 | //    if (GetWindowLongA (hwnd, GWL_STYLE) & RBS_AUTOSIZE) | 
|---|
| 1592 | //      FIXME (rebar, "style RBS_AUTOSIZE set!\n"); | 
|---|
| 1593 |  | 
|---|
| 1594 | return 0; | 
|---|
| 1595 | } | 
|---|
| 1596 |  | 
|---|
| 1597 |  | 
|---|
| 1598 | static LRESULT | 
|---|
| 1599 | REBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1600 | { | 
|---|
| 1601 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1602 | REBAR_BAND *lpBand; | 
|---|
| 1603 | INT i; | 
|---|
| 1604 |  | 
|---|
| 1605 |  | 
|---|
| 1606 | /* free rebar bands */ | 
|---|
| 1607 | if ((infoPtr->uNumBands > 0) && infoPtr->bands) { | 
|---|
| 1608 | /* clean up each band */ | 
|---|
| 1609 | for (i = 0; i < infoPtr->uNumBands; i++) { | 
|---|
| 1610 | lpBand = &infoPtr->bands[i]; | 
|---|
| 1611 |  | 
|---|
| 1612 | /* delete text strings */ | 
|---|
| 1613 | if (lpBand->lpText) { | 
|---|
| 1614 | COMCTL32_Free (lpBand->lpText); | 
|---|
| 1615 | lpBand->lpText = NULL; | 
|---|
| 1616 | } | 
|---|
| 1617 | /* destroy child window */ | 
|---|
| 1618 | DestroyWindow (lpBand->hwndChild); | 
|---|
| 1619 | } | 
|---|
| 1620 |  | 
|---|
| 1621 | /* free band array */ | 
|---|
| 1622 | COMCTL32_Free (infoPtr->bands); | 
|---|
| 1623 | infoPtr->bands = NULL; | 
|---|
| 1624 | } | 
|---|
| 1625 |  | 
|---|
| 1626 |  | 
|---|
| 1627 |  | 
|---|
| 1628 |  | 
|---|
| 1629 | DeleteObject (infoPtr->hcurArrow); | 
|---|
| 1630 | DeleteObject (infoPtr->hcurHorz); | 
|---|
| 1631 | DeleteObject (infoPtr->hcurVert); | 
|---|
| 1632 | DeleteObject (infoPtr->hcurDrag); | 
|---|
| 1633 |  | 
|---|
| 1634 |  | 
|---|
| 1635 |  | 
|---|
| 1636 |  | 
|---|
| 1637 | /* free rebar info data */ | 
|---|
| 1638 | doneControl(hwnd); | 
|---|
| 1639 |  | 
|---|
| 1640 | return 0; | 
|---|
| 1641 | } | 
|---|
| 1642 |  | 
|---|
| 1643 |  | 
|---|
| 1644 | static LRESULT | 
|---|
| 1645 | REBAR_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1646 | { | 
|---|
| 1647 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1648 |  | 
|---|
| 1649 | return (LRESULT)infoPtr->hFont; | 
|---|
| 1650 | } | 
|---|
| 1651 |  | 
|---|
| 1652 |  | 
|---|
| 1653 | #if 0 | 
|---|
| 1654 | static LRESULT | 
|---|
| 1655 | REBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1656 | { | 
|---|
| 1657 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1658 |  | 
|---|
| 1659 | return 0; | 
|---|
| 1660 | } | 
|---|
| 1661 | #endif | 
|---|
| 1662 |  | 
|---|
| 1663 |  | 
|---|
| 1664 | static LRESULT | 
|---|
| 1665 | REBAR_NCCalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1666 | { | 
|---|
| 1667 | if (GetWindowLongA (hwnd, GWL_STYLE) & WS_BORDER) { | 
|---|
| 1668 | ((LPRECT)lParam)->left   += GetSystemMetrics(SM_CXEDGE); | 
|---|
| 1669 | ((LPRECT)lParam)->top    += GetSystemMetrics(SM_CYEDGE); | 
|---|
| 1670 | ((LPRECT)lParam)->right  -= GetSystemMetrics(SM_CXEDGE); | 
|---|
| 1671 | ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE); | 
|---|
| 1672 | } | 
|---|
| 1673 |  | 
|---|
| 1674 | return 0; | 
|---|
| 1675 | } | 
|---|
| 1676 |  | 
|---|
| 1677 |  | 
|---|
| 1678 | static LRESULT | 
|---|
| 1679 | REBAR_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1680 | { | 
|---|
| 1681 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); | 
|---|
| 1682 | RECT rcWindow; | 
|---|
| 1683 | HDC hdc; | 
|---|
| 1684 |  | 
|---|
| 1685 | if (dwStyle & WS_MINIMIZE) | 
|---|
| 1686 | return 0; /* Nothing to do */ | 
|---|
| 1687 |  | 
|---|
| 1688 | DefWindowProcA (hwnd, WM_NCPAINT, wParam, lParam); | 
|---|
| 1689 |  | 
|---|
| 1690 | if (!(hdc = GetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) | 
|---|
| 1691 | return 0; | 
|---|
| 1692 |  | 
|---|
| 1693 | if (dwStyle & WS_BORDER) { | 
|---|
| 1694 | GetWindowRect (hwnd, &rcWindow); | 
|---|
| 1695 | OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top); | 
|---|
| 1696 | DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); | 
|---|
| 1697 | } | 
|---|
| 1698 |  | 
|---|
| 1699 | ReleaseDC( hwnd, hdc ); | 
|---|
| 1700 |  | 
|---|
| 1701 | return 0; | 
|---|
| 1702 | } | 
|---|
| 1703 |  | 
|---|
| 1704 |  | 
|---|
| 1705 | static LRESULT | 
|---|
| 1706 | REBAR_Paint (HWND hwnd, WPARAM wParam) | 
|---|
| 1707 | { | 
|---|
| 1708 | HDC hdc; | 
|---|
| 1709 | PAINTSTRUCT ps; | 
|---|
| 1710 |  | 
|---|
| 1711 | hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; | 
|---|
| 1712 | REBAR_Refresh (hwnd, hdc); | 
|---|
| 1713 | if (!wParam) | 
|---|
| 1714 | EndPaint (hwnd, &ps); | 
|---|
| 1715 | return 0; | 
|---|
| 1716 | } | 
|---|
| 1717 |  | 
|---|
| 1718 |  | 
|---|
| 1719 | static LRESULT | 
|---|
| 1720 | REBAR_SetCursor (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1721 | { | 
|---|
| 1722 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1723 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); | 
|---|
| 1724 | POINT pt; | 
|---|
| 1725 | UINT  flags; | 
|---|
| 1726 |  | 
|---|
| 1727 | //    TRACE (rebar, "code=0x%X  id=0x%X\n", LOWORD(lParam), HIWORD(lParam)); | 
|---|
| 1728 |  | 
|---|
| 1729 | GetCursorPos (&pt); | 
|---|
| 1730 | ScreenToClient (hwnd, &pt); | 
|---|
| 1731 |  | 
|---|
| 1732 | REBAR_InternalHitTest (hwnd, &pt, &flags, NULL); | 
|---|
| 1733 |  | 
|---|
| 1734 | if (flags == RBHT_GRABBER) { | 
|---|
| 1735 | if ((dwStyle & CCS_VERT) && | 
|---|
| 1736 | !(dwStyle & RBS_VERTICALGRIPPER)) | 
|---|
| 1737 | SetCursor (infoPtr->hcurVert); | 
|---|
| 1738 | else | 
|---|
| 1739 | SetCursor (infoPtr->hcurHorz); | 
|---|
| 1740 | } | 
|---|
| 1741 | else if (flags != RBHT_CLIENT) | 
|---|
| 1742 | SetCursor (infoPtr->hcurArrow); | 
|---|
| 1743 | //CB: else not handled -> cursor not changed | 
|---|
| 1744 |  | 
|---|
| 1745 | return TRUE; | 
|---|
| 1746 | } | 
|---|
| 1747 |  | 
|---|
| 1748 |  | 
|---|
| 1749 | static LRESULT | 
|---|
| 1750 | REBAR_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1751 | { | 
|---|
| 1752 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1753 |  | 
|---|
| 1754 | /* TEXTMETRIC32A tm; */ | 
|---|
| 1755 | HFONT hFont /*, hOldFont */; | 
|---|
| 1756 | /* HDC32 hdc; */ | 
|---|
| 1757 |  | 
|---|
| 1758 | infoPtr->hFont = (HFONT)wParam; | 
|---|
| 1759 |  | 
|---|
| 1760 | hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT); | 
|---|
| 1761 | /* | 
|---|
| 1762 | hdc = GetDC32 (0); | 
|---|
| 1763 | hOldFont = SelectObject32 (hdc, hFont); | 
|---|
| 1764 | GetTextMetrics32A (hdc, &tm); | 
|---|
| 1765 | infoPtr->nHeight = tm.tmHeight + VERT_BORDER; | 
|---|
| 1766 | SelectObject32 (hdc, hOldFont); | 
|---|
| 1767 | ReleaseDC32 (0, hdc); | 
|---|
| 1768 | */ | 
|---|
| 1769 | if (lParam) { | 
|---|
| 1770 | /* | 
|---|
| 1771 | REBAR_Layout (hwnd); | 
|---|
| 1772 | hdc = GetDC32 (hwnd); | 
|---|
| 1773 | REBAR_Refresh (hwnd, hdc); | 
|---|
| 1774 | ReleaseDC32 (hwnd, hdc); | 
|---|
| 1775 | */ | 
|---|
| 1776 | } | 
|---|
| 1777 |  | 
|---|
| 1778 | return 0; | 
|---|
| 1779 | } | 
|---|
| 1780 |  | 
|---|
| 1781 | static LRESULT | 
|---|
| 1782 | REBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam) | 
|---|
| 1783 | { | 
|---|
| 1784 | REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); | 
|---|
| 1785 | /* DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); */ | 
|---|
| 1786 | RECT rcParent; | 
|---|
| 1787 | /* INT32 x, y, cx, cy; */ | 
|---|
| 1788 |  | 
|---|
| 1789 | /* auto resize deadlock check */ | 
|---|
| 1790 | if (infoPtr->bAutoResize) { | 
|---|
| 1791 | infoPtr->bAutoResize = FALSE; | 
|---|
| 1792 | return 0; | 
|---|
| 1793 | } | 
|---|
| 1794 |  | 
|---|
| 1795 | //    TRACE (rebar, "sizing rebar!\n"); | 
|---|
| 1796 |  | 
|---|
| 1797 | /* get parent rectangle */ | 
|---|
| 1798 | GetClientRect (GetParent (hwnd), &rcParent); | 
|---|
| 1799 | /* | 
|---|
| 1800 | REBAR_Layout (hwnd, &rcParent); | 
|---|
| 1801 |  | 
|---|
| 1802 | if (dwStyle & CCS_VERT) { | 
|---|
| 1803 | if (dwStyle & CCS_LEFT == CCS_LEFT) { | 
|---|
| 1804 | x = rcParent.left; | 
|---|
| 1805 | y = rcParent.top; | 
|---|
| 1806 | cx = infoPtr->calcSize.cx; | 
|---|
| 1807 | cy = infoPtr->calcSize.cy; | 
|---|
| 1808 | } | 
|---|
| 1809 | else { | 
|---|
| 1810 | x = rcParent.right - infoPtr->calcSize.cx; | 
|---|
| 1811 | y = rcParent.top; | 
|---|
| 1812 | cx = infoPtr->calcSize.cx; | 
|---|
| 1813 | cy = infoPtr->calcSize.cy; | 
|---|
| 1814 | } | 
|---|
| 1815 | } | 
|---|
| 1816 | else { | 
|---|
| 1817 | if (dwStyle & CCS_TOP) { | 
|---|
| 1818 | x = rcParent.left; | 
|---|
| 1819 | y = rcParent.top; | 
|---|
| 1820 | cx = infoPtr->calcSize.cx; | 
|---|
| 1821 | cy = infoPtr->calcSize.cy; | 
|---|
| 1822 | } | 
|---|
| 1823 | else { | 
|---|
| 1824 | x = rcParent.left; | 
|---|
| 1825 | y = rcParent.bottom - infoPtr->calcSize.cy; | 
|---|
| 1826 | cx = infoPtr->calcSize.cx; | 
|---|
| 1827 | cy = infoPtr->calcSize.cy; | 
|---|
| 1828 | } | 
|---|
| 1829 | } | 
|---|
| 1830 |  | 
|---|
| 1831 | SetWindowPos32 (hwnd, 0, x, y, cx, cy, | 
|---|
| 1832 | SWP_NOZORDER | SWP_SHOWWINDOW); | 
|---|
| 1833 | */ | 
|---|
| 1834 | REBAR_Layout (hwnd, NULL); | 
|---|
| 1835 | REBAR_ForceResize (hwnd); | 
|---|
| 1836 | REBAR_MoveChildWindows (hwnd); | 
|---|
| 1837 |  | 
|---|
| 1838 | return 0; | 
|---|
| 1839 | } | 
|---|
| 1840 |  | 
|---|
| 1841 |  | 
|---|
| 1842 | static LRESULT WINAPI | 
|---|
| 1843 | REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) | 
|---|
| 1844 | { | 
|---|
| 1845 | switch (uMsg) | 
|---|
| 1846 | { | 
|---|
| 1847 | /*      case RB_BEGINDRAG: */ | 
|---|
| 1848 |  | 
|---|
| 1849 | case RB_DELETEBAND: | 
|---|
| 1850 | return REBAR_DeleteBand (hwnd, wParam, lParam); | 
|---|
| 1851 |  | 
|---|
| 1852 | /*      case RB_DRAGMOVE: */ | 
|---|
| 1853 | /*      case RB_ENDDRAG: */ | 
|---|
| 1854 |  | 
|---|
| 1855 | case RB_GETBANDBORDERS: | 
|---|
| 1856 | return REBAR_GetBandBorders (hwnd, wParam, lParam); | 
|---|
| 1857 |  | 
|---|
| 1858 | case RB_GETBANDCOUNT: | 
|---|
| 1859 | return REBAR_GetBandCount (hwnd); | 
|---|
| 1860 |  | 
|---|
| 1861 | /*      case RB_GETBANDINFO32:  */ /* outdated, just for compatibility */ | 
|---|
| 1862 |  | 
|---|
| 1863 | case RB_GETBANDINFOA: | 
|---|
| 1864 | return REBAR_GetBandInfoA (hwnd, wParam, lParam); | 
|---|
| 1865 |  | 
|---|
| 1866 | case RB_GETBANDINFOW: | 
|---|
| 1867 | return REBAR_GetBandInfoW (hwnd, wParam, lParam); | 
|---|
| 1868 |  | 
|---|
| 1869 | case RB_GETBARHEIGHT: | 
|---|
| 1870 | return REBAR_GetBarHeight (hwnd, wParam, lParam); | 
|---|
| 1871 |  | 
|---|
| 1872 | case RB_GETBARINFO: | 
|---|
| 1873 | return REBAR_GetBarInfo (hwnd, wParam, lParam); | 
|---|
| 1874 |  | 
|---|
| 1875 | case RB_GETBKCOLOR: | 
|---|
| 1876 | return REBAR_GetBkColor (hwnd); | 
|---|
| 1877 |  | 
|---|
| 1878 | /*      case RB_GETCOLORSCHEME: */ | 
|---|
| 1879 | /*      case RB_GETDROPTARGET: */ | 
|---|
| 1880 |  | 
|---|
| 1881 | case RB_GETPALETTE: | 
|---|
| 1882 | return REBAR_GetPalette (hwnd, wParam, lParam); | 
|---|
| 1883 |  | 
|---|
| 1884 | case RB_GETRECT: | 
|---|
| 1885 | return REBAR_GetRect (hwnd, wParam, lParam); | 
|---|
| 1886 |  | 
|---|
| 1887 | case RB_GETROWCOUNT: | 
|---|
| 1888 | return REBAR_GetRowCount (hwnd); | 
|---|
| 1889 |  | 
|---|
| 1890 | case RB_GETROWHEIGHT: | 
|---|
| 1891 | return REBAR_GetRowHeight (hwnd, wParam, lParam); | 
|---|
| 1892 |  | 
|---|
| 1893 | case RB_GETTEXTCOLOR: | 
|---|
| 1894 | return REBAR_GetTextColor (hwnd); | 
|---|
| 1895 |  | 
|---|
| 1896 | case RB_GETTOOLTIPS: | 
|---|
| 1897 | return REBAR_GetToolTips (hwnd); | 
|---|
| 1898 |  | 
|---|
| 1899 | case RB_HITTEST: | 
|---|
| 1900 | return REBAR_HitTest (hwnd, wParam, lParam); | 
|---|
| 1901 |  | 
|---|
| 1902 | case RB_IDTOINDEX: | 
|---|
| 1903 | return REBAR_IdToIndex (hwnd, wParam, lParam); | 
|---|
| 1904 |  | 
|---|
| 1905 | case RB_INSERTBANDA: | 
|---|
| 1906 | return REBAR_InsertBandA (hwnd, wParam, lParam); | 
|---|
| 1907 |  | 
|---|
| 1908 | case RB_INSERTBANDW: | 
|---|
| 1909 | return REBAR_InsertBandW (hwnd, wParam, lParam); | 
|---|
| 1910 |  | 
|---|
| 1911 | case RB_MAXIMIZEBAND: | 
|---|
| 1912 | return REBAR_MaximizeBand (hwnd, wParam, lParam); | 
|---|
| 1913 |  | 
|---|
| 1914 | case RB_MINIMIZEBAND: | 
|---|
| 1915 | return REBAR_MinimizeBand (hwnd, wParam, lParam); | 
|---|
| 1916 |  | 
|---|
| 1917 | case RB_MOVEBAND: | 
|---|
| 1918 | return REBAR_MoveBand (hwnd, wParam, lParam); | 
|---|
| 1919 |  | 
|---|
| 1920 | case RB_SETBANDINFOA: | 
|---|
| 1921 | return REBAR_SetBandInfoA (hwnd, wParam, lParam); | 
|---|
| 1922 |  | 
|---|
| 1923 | case RB_SETBANDINFOW: | 
|---|
| 1924 | return REBAR_SetBandInfoW (hwnd, wParam, lParam); | 
|---|
| 1925 |  | 
|---|
| 1926 | case RB_SETBARINFO: | 
|---|
| 1927 | return REBAR_SetBarInfo (hwnd, wParam, lParam); | 
|---|
| 1928 |  | 
|---|
| 1929 | case RB_SETBKCOLOR: | 
|---|
| 1930 | return REBAR_SetBkColor (hwnd, wParam, lParam); | 
|---|
| 1931 |  | 
|---|
| 1932 | /*      case RB_SETCOLORSCHEME: */ | 
|---|
| 1933 | /*      case RB_SETPALETTE: */ | 
|---|
| 1934 | /*          return REBAR_GetPalette (hwnd, wParam, lParam); */ | 
|---|
| 1935 |  | 
|---|
| 1936 | case RB_SETPARENT: | 
|---|
| 1937 | return REBAR_SetParent (hwnd, wParam, lParam); | 
|---|
| 1938 |  | 
|---|
| 1939 | case RB_SETTEXTCOLOR: | 
|---|
| 1940 | return REBAR_SetTextColor (hwnd, wParam, lParam); | 
|---|
| 1941 |  | 
|---|
| 1942 | /*      case RB_SETTOOLTIPS: */ | 
|---|
| 1943 |  | 
|---|
| 1944 | case RB_SHOWBAND: | 
|---|
| 1945 | return REBAR_ShowBand (hwnd, wParam, lParam); | 
|---|
| 1946 |  | 
|---|
| 1947 | case RB_SIZETORECT: | 
|---|
| 1948 | return REBAR_SizeToRect (hwnd, wParam, lParam); | 
|---|
| 1949 |  | 
|---|
| 1950 |  | 
|---|
| 1951 | case WM_COMMAND: | 
|---|
| 1952 | return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); | 
|---|
| 1953 |  | 
|---|
| 1954 | case WM_CREATE: | 
|---|
| 1955 | return REBAR_Create (hwnd, wParam, lParam); | 
|---|
| 1956 |  | 
|---|
| 1957 | case WM_DESTROY: | 
|---|
| 1958 | return REBAR_Destroy (hwnd, wParam, lParam); | 
|---|
| 1959 |  | 
|---|
| 1960 | case WM_GETFONT: | 
|---|
| 1961 | return REBAR_GetFont (hwnd, wParam, lParam); | 
|---|
| 1962 |  | 
|---|
| 1963 | /*      case WM_MOUSEMOVE: */ | 
|---|
| 1964 | /*          return REBAR_MouseMove (hwnd, wParam, lParam); */ | 
|---|
| 1965 |  | 
|---|
| 1966 | case WM_NCCALCSIZE: | 
|---|
| 1967 | return REBAR_NCCalcSize (hwnd, wParam, lParam); | 
|---|
| 1968 |  | 
|---|
| 1969 | case WM_NCPAINT: | 
|---|
| 1970 | return REBAR_NCPaint (hwnd, wParam, lParam); | 
|---|
| 1971 |  | 
|---|
| 1972 | case WM_NOTIFY: | 
|---|
| 1973 | return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); | 
|---|
| 1974 |  | 
|---|
| 1975 | case WM_PAINT: | 
|---|
| 1976 | return REBAR_Paint (hwnd, wParam); | 
|---|
| 1977 |  | 
|---|
| 1978 | case WM_SETCURSOR: | 
|---|
| 1979 | return REBAR_SetCursor (hwnd, wParam, lParam); | 
|---|
| 1980 |  | 
|---|
| 1981 | case WM_SETFONT: | 
|---|
| 1982 | return REBAR_SetFont (hwnd, wParam, lParam); | 
|---|
| 1983 |  | 
|---|
| 1984 | case WM_SIZE: | 
|---|
| 1985 | return REBAR_Size (hwnd, wParam, lParam); | 
|---|
| 1986 |  | 
|---|
| 1987 | /*      case WM_TIMER: */ | 
|---|
| 1988 |  | 
|---|
| 1989 | /*      case WM_WININICHANGE: */ | 
|---|
| 1990 |  | 
|---|
| 1991 | default: | 
|---|
| 1992 | //          if (uMsg >= WM_USER) | 
|---|
| 1993 | //              ERR (rebar, "unknown msg %04x wp=%08x lp=%08lx\n", | 
|---|
| 1994 | //                   uMsg, wParam, lParam); | 
|---|
| 1995 | return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); | 
|---|
| 1996 | } | 
|---|
| 1997 | return 0; | 
|---|
| 1998 | } | 
|---|
| 1999 |  | 
|---|
| 2000 |  | 
|---|
| 2001 | VOID | 
|---|
| 2002 | REBAR_Register (VOID) | 
|---|
| 2003 | { | 
|---|
| 2004 | WNDCLASSA wndClass; | 
|---|
| 2005 |  | 
|---|
| 2006 | ZeroMemory (&wndClass, sizeof(WNDCLASSA)); | 
|---|
| 2007 | wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS; | 
|---|
| 2008 | wndClass.lpfnWndProc   = (WNDPROC)REBAR_WindowProc; | 
|---|
| 2009 | wndClass.cbClsExtra    = 0; | 
|---|
| 2010 | wndClass.cbWndExtra    = sizeof(REBAR_INFO *); | 
|---|
| 2011 | wndClass.hCursor       = 0; | 
|---|
| 2012 | wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); | 
|---|
| 2013 | wndClass.lpszClassName = REBARCLASSNAMEA; | 
|---|
| 2014 |  | 
|---|
| 2015 | RegisterClassA (&wndClass); | 
|---|
| 2016 | } | 
|---|
| 2017 |  | 
|---|
| 2018 |  | 
|---|
| 2019 | VOID | 
|---|
| 2020 | REBAR_Unregister (VOID) | 
|---|
| 2021 | { | 
|---|
| 2022 | UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL); | 
|---|
| 2023 | } | 
|---|
| 2024 |  | 
|---|