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