4 * Copyright 1998 Eric Kohl
11 * - Fix TB_GETBITMAPFLAGS.
12 * - Fix TB_GETROWS and TB_SETROWS.
13 * - Tooltip support (partially).
15 * - Internal COMMCTL32 bitmaps.
16 * - Fix TOOLBAR_Customize. (Customize dialog.)
19 * - Run tests using Waite Group Windows95 API Bible Volume 2.
20 * The second cdrom contains executables addstr.exe, btncount.exe,
21 * btnstate.exe, butstrsz.exe, chkbtn.exe, chngbmp.exe, customiz.exe,
22 * enablebtn.exe, getbmp.exe, getbtn.exe, getflags.exe, hidebtn.exe,
23 * indetbtn.exe, insbtn.exe, pressbtn.exe, setbtnsz.exe, setcmdid.exe,
24 * setparnt.exe, setrows.exe, toolwnd.exe.
25 * - additional features.
37 #define SEPARATOR_WIDTH 8
38 #define SEPARATOR_HEIGHT 5
40 #define BOTTOM_BORDER 2
44 #define TOOLBAR_GetInfoPtr(wndPtr) ((TOOLBAR_INFO *)wndPtr->wExtra[0])
48 TOOLBAR_DrawFlatSeparator (LPRECT32 lpRect
, HDC32 hdc
)
50 INT32 x
= (lpRect
->left
+ lpRect
->right
) / 2 - 1;
51 INT32 yBottom
= lpRect
->bottom
- 3;
52 INT32 yTop
= lpRect
->top
+ 1;
54 SelectObject32 ( hdc
, GetSysColorPen32 (COLOR_3DSHADOW
));
55 MoveToEx32 (hdc
, x
, yBottom
, NULL
);
56 LineTo32 (hdc
, x
, yTop
);
58 SelectObject32 ( hdc
, GetSysColorPen32 (COLOR_3DHILIGHT
));
59 MoveToEx32 (hdc
, x
, yBottom
, NULL
);
60 LineTo32 (hdc
, x
, yTop
);
65 TOOLBAR_DrawString (TOOLBAR_INFO
*infoPtr
, TBUTTON_INFO
*btnPtr
,
66 HDC32 hdc
, INT32 nState
)
68 RECT32 rcText
= btnPtr
->rect
;
73 if ((btnPtr
->iString
> -1) && (btnPtr
->iString
< infoPtr
->nNumStrings
)) {
75 InflateRect32 (&rcText
, -3, -3);
76 rcText
.top
+= infoPtr
->nBitmapHeight
;
77 if (nState
& (TBSTATE_PRESSED
| TBSTATE_CHECKED
))
78 OffsetRect32 (&rcText
, 1, 1);
80 hOldFont
= SelectObject32 (hdc
, infoPtr
->hFont
);
81 nOldBkMode
= SetBkMode32 (hdc
, TRANSPARENT
);
82 if (!(nState
& TBSTATE_ENABLED
)) {
84 SetTextColor32 (hdc
, GetSysColor32 (COLOR_3DHILIGHT
));
85 OffsetRect32 (&rcText
, 1, 1);
86 DrawText32A (hdc
, infoPtr
->strings
[btnPtr
->iString
], -1, &rcText
,
88 SetTextColor32 (hdc
, GetSysColor32 (COLOR_3DSHADOW
));
89 OffsetRect32 (&rcText
, -1, -1);
90 DrawText32A (hdc
, infoPtr
->strings
[btnPtr
->iString
], -1, &rcText
,
92 SetTextColor32 (hdc
, clrOld
);
94 else if (nState
& TBSTATE_INDETERMINATE
) {
96 SetTextColor32 (hdc
, GetSysColor32 (COLOR_3DSHADOW
));
97 DrawText32A (hdc
, infoPtr
->strings
[btnPtr
->iString
], -1, &rcText
,
99 SetTextColor32 (hdc
, clrOld
);
102 DrawText32A (hdc
, infoPtr
->strings
[btnPtr
->iString
], -1, &rcText
,
105 SelectObject32 (hdc
, hOldFont
);
106 if (nOldBkMode
!= TRANSPARENT
)
107 SetBkMode32 (hdc
, nOldBkMode
);
113 TOOLBAR_DrawButton (WND
*wndPtr
, TBUTTON_INFO
*btnPtr
, HDC32 hdc
)
115 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
116 BOOL32 bFlat
= (wndPtr
->dwStyle
& TBSTYLE_FLAT
);
119 if (btnPtr
->fsState
& TBSTATE_HIDDEN
) return;
122 if (btnPtr
->fsStyle
& TBSTYLE_SEP
) {
123 if ((bFlat
) && (btnPtr
->idCommand
== 0))
124 TOOLBAR_DrawFlatSeparator (&btnPtr
->rect
, hdc
);
129 if (!(btnPtr
->fsState
& TBSTATE_ENABLED
)) {
131 DrawEdge32 (hdc
, &rc
, EDGE_RAISED
,
132 BF_SOFT
| BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
134 // ImageList_Draw (infoPtr->himlDis, btnPtr->iBitmap, hdc,
135 // rc.left+1, rc.top+1, ILD_NORMAL);
136 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
140 /* pressed TBSTYLE_BUTTON */
141 if (btnPtr
->fsState
& TBSTATE_PRESSED
) {
142 DrawEdge32 (hdc
, &rc
, EDGE_SUNKEN
,
143 BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
144 ImageList_Draw (infoPtr
->himlDef
, btnPtr
->iBitmap
, hdc
,
145 rc
.left
+2, rc
.top
+2, ILD_NORMAL
);
146 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
150 /* checked TBSTYLE_CHECK*/
151 if ((btnPtr
->fsStyle
& TBSTYLE_CHECK
) &&
152 (btnPtr
->fsState
& TBSTATE_CHECKED
)) {
154 DrawEdge32 (hdc
, &rc
, EDGE_SUNKEN
,
155 BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
157 hbr
= SelectObject32 (hdc
, CACHE_GetPattern55AABrush ());
158 PatBlt32 (hdc
, rc
.left
, rc
.top
, rc
.right
- rc
.left
,
159 rc
.bottom
- rc
.top
, 0x00FA0089);
160 SelectObject32 (hdc
, hbr
);
161 ImageList_Draw (infoPtr
->himlDef
, btnPtr
->iBitmap
, hdc
,
162 rc
.left
+2, rc
.top
+2, ILD_NORMAL
);
163 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
168 if (btnPtr
->fsState
& TBSTATE_INDETERMINATE
) {
170 DrawEdge32 (hdc
, &rc
, EDGE_RAISED
,
171 BF_SOFT
| BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
173 hbr
= SelectObject32 (hdc
, CACHE_GetPattern55AABrush ());
174 PatBlt32 (hdc
, rc
.left
, rc
.top
, rc
.right
- rc
.left
,
175 rc
.bottom
- rc
.top
, 0x00FA0089);
176 SelectObject32 (hdc
, hbr
);
177 // ImageList_Draw (infoPtr->himlDis, btnPtr->iBitmap, hdc,
178 // rc.left+1, rc.top+1, ILD_NORMAL);
179 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
184 DrawEdge32 (hdc
, &rc
, EDGE_RAISED
,
185 BF_SOFT
| BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
186 ImageList_Draw (infoPtr
->himlDef
, btnPtr
->iBitmap
, hdc
,
187 rc
.left
+1, rc
.top
+1, ILD_NORMAL
);
188 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
193 TOOLBAR_Refresh (WND
*wndPtr
, HDC32 hdc
)
195 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
196 TBUTTON_INFO
*btnPtr
;
200 btnPtr
= infoPtr
->buttons
;
201 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++)
202 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
207 TOOLBAR_CalcStrings (WND
*wndPtr
, LPSIZE32 lpSize
)
209 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
210 TBUTTON_INFO
*btnPtr
;
219 hOldFont
= SelectObject32 (hdc
, infoPtr
->hFont
);
221 btnPtr
= infoPtr
->buttons
;
222 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
223 if (!(btnPtr
->fsState
& TBSTATE_HIDDEN
) &&
224 (btnPtr
->iString
> -1) &&
225 (btnPtr
->iString
< infoPtr
->nNumStrings
)) {
226 LPSTR lpText
= infoPtr
->strings
[btnPtr
->iString
];
227 GetTextExtentPoint32A (hdc
, lpText
, lstrlen32A(lpText
), &sz
);
228 if (sz
.cx
> lpSize
->cx
)
230 if (sz
.cy
> lpSize
->cy
)
235 SelectObject32 (hdc
, hOldFont
);
236 ReleaseDC32 (0, hdc
);
238 TRACE (toolbar
, "string size %d x %d!\n", lpSize
->cx
, lpSize
->cy
);
243 TOOLBAR_CalcToolbar (WND
*wndPtr
)
245 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
246 TBUTTON_INFO
*btnPtr
;
254 TOOLBAR_CalcStrings (wndPtr
, &sizeString
);
256 if (sizeString
.cy
> 0)
257 infoPtr
->nButtonHeight
= sizeString
.cy
+ infoPtr
->nBitmapHeight
+ 6;
259 if (sizeString
.cx
> infoPtr
->nBitmapWidth
)
260 infoPtr
->nButtonWidth
= sizeString
.cx
+ 6;
262 x
= infoPtr
->nIndent
;
264 cx
= infoPtr
->nButtonWidth
;
265 cy
= infoPtr
->nButtonHeight
;
268 btnPtr
= infoPtr
->buttons
;
269 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
272 if (btnPtr
->fsState
& TBSTATE_HIDDEN
)
275 if (btnPtr
->fsStyle
& TBSTYLE_SEP
) {
276 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */
277 /* it is the actual width of the separator. This is used for */
278 /* custom controls in toolbars. */
279 if ((wndPtr
->dwStyle
& TBSTYLE_WRAPABLE
) &&
280 (btnPtr
->fsState
& TBSTATE_WRAP
)) {
283 cx
= infoPtr
->nWidth
;
284 cy
= ((btnPtr
->iBitmap
== 0) ?
285 SEPARATOR_WIDTH
: btnPtr
->iBitmap
) * 2 / 3;
290 cx
= (btnPtr
->iBitmap
== 0) ?
291 SEPARATOR_WIDTH
: btnPtr
->iBitmap
;
294 /* this must be a button */
295 cx
= infoPtr
->nButtonWidth
;
299 btnPtr
->rect
.left
= x
;
300 btnPtr
->rect
.top
= y
;
301 btnPtr
->rect
.right
= x
+ cx
;
302 btnPtr
->rect
.bottom
= y
+ cy
;
307 if (i
< infoPtr
->nNumButtons
)
314 infoPtr
->nHeight
= y
+ cy
+ BOTTOM_BORDER
;
315 TRACE (toolbar
, "toolbar height %d\n", infoPtr
->nHeight
);
320 TOOLBAR_InternalHitTest (WND
*wndPtr
, LPPOINT32 lpPt
)
322 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
323 TBUTTON_INFO
*btnPtr
;
326 btnPtr
= infoPtr
->buttons
;
327 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
328 if (btnPtr
->fsStyle
& TBSTYLE_SEP
) {
329 if (PtInRect32 (&btnPtr
->rect
, *lpPt
)) {
330 TRACE (toolbar
, " ON SEPARATOR %d!\n", i
);
335 if (PtInRect32 (&btnPtr
->rect
, *lpPt
)) {
336 TRACE (toolbar
, " ON BUTTON %d!\n", i
);
342 TRACE (toolbar
, " NOWHERE!\n");
348 TOOLBAR_GetButtonIndex (TOOLBAR_INFO
*infoPtr
, INT32 idCommand
)
350 TBUTTON_INFO
*btnPtr
;
353 btnPtr
= infoPtr
->buttons
;
354 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
355 if (btnPtr
->idCommand
== idCommand
) {
356 TRACE (toolbar
, "command=%d index=%d\n", idCommand
, i
);
360 TRACE (toolbar
, "no index found for command=%d\n", idCommand
);
366 TOOLBAR_GetCheckedGroupButtonIndex (TOOLBAR_INFO
*infoPtr
, INT32 nIndex
)
368 TBUTTON_INFO
*btnPtr
;
371 if ((nIndex
< 0) || (nIndex
> infoPtr
->nNumButtons
))
374 /* check index button */
375 btnPtr
= &infoPtr
->buttons
[nIndex
];
376 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
377 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
381 /* check previous buttons */
382 nRunIndex
= nIndex
- 1;
383 while (nRunIndex
>= 0) {
384 btnPtr
= &infoPtr
->buttons
[nRunIndex
];
385 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
386 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
394 /* check next buttons */
395 nRunIndex
= nIndex
+ 1;
396 while (nRunIndex
< infoPtr
->nNumButtons
) {
397 btnPtr
= &infoPtr
->buttons
[nRunIndex
];
398 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
399 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
412 TOOLBAR_AddBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
414 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
415 LPTBADDBITMAP lpAddBmp
= (LPTBADDBITMAP
)lParam
;
418 if ((!lpAddBmp
) || ((INT32
)wParam
<= 0))
421 TRACE (toolbar
, "adding %d bitmaps!\n", wParam
);
423 if (!(infoPtr
->himlDef
)) {
424 /* create new default image list */
425 TRACE (toolbar
, "creating default image list!\n");
427 ImageList_Create (infoPtr
->nBitmapWidth
, infoPtr
->nBitmapHeight
,
428 ILC_COLOR
| ILC_MASK
, (INT32
)wParam
, 2);
432 if (!(infoPtr
->himlDis
)) {
433 /* create new disabled image list */
434 TRACE (toolbar
, "creating disabled image list!\n");
436 ImageList_Create (infoPtr
->nBitmapWidth
,
437 infoPtr
->nBitmapHeight
, ILC_COLOR
| ILC_MASK
,
442 /* Add bitmaps to the default image list */
443 if (lpAddBmp
->hInst
== (HINSTANCE32
)0) {
445 ImageList_AddMasked (infoPtr
->himlDef
, (HBITMAP32
)lpAddBmp
->nID
,
446 GetSysColor32 (COLOR_3DFACE
));
448 else if (lpAddBmp
->hInst
== HINST_COMMCTRL
) {
449 /* add internal bitmaps */
450 FIXME (toolbar
, "internal bitmaps not supported!\n");
452 /* Hack to "add" some reserved images within the image list
453 to get the right image indices */
454 nIndex
= ImageList_GetImageCount (infoPtr
->himlDef
);
455 ImageList_SetImageCount (infoPtr
->himlDef
, nIndex
+ (INT32
)wParam
);
459 LoadBitmap32A (lpAddBmp
->hInst
, (LPSTR
)lpAddBmp
->nID
);
461 nIndex
= ImageList_Add (infoPtr
->himlDef
, hBmp
, (HBITMAP32
)0);
463 DeleteObject32 (hBmp
);
467 infoPtr
->nNumBitmaps
+= (INT32
)wParam
;
474 TOOLBAR_AddButtons32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
476 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
477 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
478 INT32 nOldButtons
, nNewButtons
, nAddButtons
, nCount
;
481 TRACE (toolbar
, "adding %d buttons!\n", wParam
);
483 nAddButtons
= (UINT32
)wParam
;
484 nOldButtons
= infoPtr
->nNumButtons
;
485 nNewButtons
= nOldButtons
+ nAddButtons
;
487 if (infoPtr
->nNumButtons
== 0) {
489 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
490 sizeof (TBUTTON_INFO
) * nNewButtons
);
493 TBUTTON_INFO
*oldButtons
= infoPtr
->buttons
;
495 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
496 sizeof (TBUTTON_INFO
) * nNewButtons
);
497 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
498 nOldButtons
* sizeof(TBUTTON_INFO
));
499 HeapFree (GetProcessHeap (), 0, oldButtons
);
502 infoPtr
->nNumButtons
= nNewButtons
;
504 /* insert new button data (bad implementation)*/
505 for (nCount
= 0; nCount
< nAddButtons
; nCount
++) {
506 infoPtr
->buttons
[nOldButtons
+nCount
].iBitmap
= lpTbb
[nCount
].iBitmap
;
507 infoPtr
->buttons
[nOldButtons
+nCount
].idCommand
= lpTbb
[nCount
].idCommand
;
508 infoPtr
->buttons
[nOldButtons
+nCount
].fsState
= lpTbb
[nCount
].fsState
;
509 infoPtr
->buttons
[nOldButtons
+nCount
].fsStyle
= lpTbb
[nCount
].fsStyle
;
510 infoPtr
->buttons
[nOldButtons
+nCount
].dwData
= lpTbb
[nCount
].dwData
;
511 infoPtr
->buttons
[nOldButtons
+nCount
].iString
= lpTbb
[nCount
].iString
;
514 TOOLBAR_CalcToolbar (wndPtr
);
516 hdc
= GetDC32 (wndPtr
->hwndSelf
);
517 TOOLBAR_Refresh (wndPtr
, hdc
);
518 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
524 // << TOOLBAR_AddButtons32W >>
528 TOOLBAR_AddString32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
530 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
536 TRACE (toolbar
, "adding string from resource!\n");
538 len
= LoadString32A ((HINSTANCE32
)wParam
, (UINT32
)lParam
,
541 TRACE (toolbar
, "len=%d \"%s\"\n", len
, szString
);
542 nIndex
= infoPtr
->nNumStrings
;
543 if (infoPtr
->nNumStrings
== 0) {
545 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(char *));
548 char **oldStrings
= infoPtr
->strings
;
550 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
551 sizeof(char *) * (infoPtr
->nNumStrings
+ 1));
552 memcpy (&infoPtr
->strings
[0], &oldStrings
[0],
553 sizeof(char *) * infoPtr
->nNumStrings
);
554 HeapFree (GetProcessHeap (), 0, oldStrings
);
557 infoPtr
->strings
[infoPtr
->nNumStrings
] =
558 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(char)*(len
+1));
559 lstrcpy32A (infoPtr
->strings
[infoPtr
->nNumStrings
], szString
);
560 infoPtr
->nNumStrings
++;
563 char *p
= (char*)lParam
;
566 if (p
== NULL
) return -1;
567 TRACE (toolbar
, "adding string(s) from array!\n");
568 nIndex
= infoPtr
->nNumStrings
;
570 len
= lstrlen32A (p
);
571 TRACE (toolbar
, "len=%d \"%s\"\n", len
, p
);
573 if (infoPtr
->nNumStrings
== 0) {
575 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(char *));
578 char **oldStrings
= infoPtr
->strings
;
580 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
581 sizeof(char *) * (infoPtr
->nNumStrings
+ 1));
582 memcpy (&infoPtr
->strings
[0], &oldStrings
[0],
583 sizeof(char *) * infoPtr
->nNumStrings
);
584 HeapFree (GetProcessHeap (), 0, oldStrings
);
587 infoPtr
->strings
[infoPtr
->nNumStrings
] =
588 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(char)*(len
+1));
589 lstrcpy32A (infoPtr
->strings
[infoPtr
->nNumStrings
], p
);
590 infoPtr
->nNumStrings
++;
600 // << TOOLBAR_AddString32W >>
604 TOOLBAR_AutoSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
606 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
610 UINT32 uPosFlags
= 0;
612 FIXME (toolbar
, "auto size!\n");
614 parent
= GetParent32 (wndPtr
->hwndSelf
);
615 GetClientRect32(parent
, &parent_rect
);
617 if (wndPtr
->dwStyle
& CCS_NORESIZE
)
618 uPosFlags
|= SWP_NOSIZE
;
620 infoPtr
->nWidth
= parent_rect
.right
- parent_rect
.left
;
621 TOOLBAR_CalcToolbar (wndPtr
);
622 cy
= infoPtr
->nHeight
;
623 cx
= infoPtr
->nWidth
;
626 if (wndPtr
->dwStyle
& CCS_NOPARENTALIGN
) {
627 uPosFlags
|= SWP_NOMOVE
;
628 // if (wndPtr->dwStyle & (CCS_TOP | CCS_BOTTOM))
629 // cy = (INT32)HIWORD(lParam);
632 if (wndPtr
->dwStyle
& CCS_NORESIZE
) {
633 uPosFlags
|= SWP_NOSIZE
;
634 // cx = (INT32)LOWORD(lParam);
635 // cy = (INT32)HIWORD(lParam);
638 /* FIXME: handle CCS_NOMOVEX and CCS_NOMOVEY */
642 infoPtr
->nWidth
= cx
;
643 infoPtr
->nHeight
= cy
;
645 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
))
648 infoPtr
->bAutoSize
= TRUE
;
649 SetWindowPos32 (wndPtr
->hwndSelf
, 0, parent_rect
.left
, parent_rect
.top
,
650 cx
, cy
, uPosFlags
| SWP_NOZORDER
);
657 TOOLBAR_ButtonCount (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
659 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
661 return infoPtr
->nNumButtons
;
666 TOOLBAR_ButtonStructSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
668 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
670 if (infoPtr
== NULL
) {
671 ERR (toolbar
, "(0x%08lx, 0x%08x, 0x%08lx)\n", (DWORD
)wndPtr
, wParam
, lParam
);
672 ERR (toolbar
, "infoPtr == NULL!\n");
676 infoPtr
->dwStructSize
= (DWORD
)wParam
;
683 TOOLBAR_ChangeBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
685 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
686 TBUTTON_INFO
*btnPtr
;
690 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
694 btnPtr
= &infoPtr
->buttons
[nIndex
];
695 btnPtr
->iBitmap
= LOWORD(lParam
);
697 hdc
= GetDC32 (wndPtr
->hwndSelf
);
698 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
699 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
706 TOOLBAR_CheckButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
708 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
709 TBUTTON_INFO
*btnPtr
;
712 INT32 nOldIndex
= -1;
714 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
718 btnPtr
= &infoPtr
->buttons
[nIndex
];
720 if (!(btnPtr
->fsStyle
& TBSTYLE_CHECK
))
723 if (LOWORD(lParam
) == FALSE
)
724 btnPtr
->fsState
&= ~TBSTATE_CHECKED
;
726 if (btnPtr
->fsStyle
& TBSTYLE_GROUP
) {
728 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr
, nIndex
);
729 if (nOldIndex
== nIndex
)
732 infoPtr
->buttons
[nOldIndex
].fsState
&= ~TBSTATE_CHECKED
;
734 btnPtr
->fsState
|= TBSTATE_CHECKED
;
737 hdc
= GetDC32 (wndPtr
->hwndSelf
);
739 TOOLBAR_DrawButton (wndPtr
, &infoPtr
->buttons
[nOldIndex
], hdc
);
740 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
741 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
743 /* FIXME: Send a WM_NOTIFY?? */
750 TOOLBAR_CommandToIndex (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
752 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
754 return TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
759 TOOLBAR_Customize (WND
*wndPtr
)
761 FIXME (toolbar
, "customization not implemented!\n");
768 TOOLBAR_DeleteButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
770 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
771 INT32 nIndex
= (INT32
)wParam
;
773 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
776 if (infoPtr
->nNumButtons
== 1) {
777 TRACE (toolbar
, " simple delete!\n");
778 HeapFree (GetProcessHeap (), 0, infoPtr
->buttons
);
779 infoPtr
->buttons
= NULL
;
780 infoPtr
->nNumButtons
= 0;
783 TBUTTON_INFO
*oldButtons
= infoPtr
->buttons
;
784 TRACE(toolbar
, "complex delete! [nIndex=%d]\n", nIndex
);
786 infoPtr
->nNumButtons
--;
787 infoPtr
->buttons
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
788 sizeof (TBUTTON_INFO
) * infoPtr
->nNumButtons
);
790 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
791 nIndex
* sizeof(TBUTTON_INFO
));
794 if (nIndex
< infoPtr
->nNumButtons
) {
795 memcpy (&infoPtr
->buttons
[nIndex
], &oldButtons
[nIndex
+1],
796 (infoPtr
->nNumButtons
- nIndex
) * sizeof(TBUTTON_INFO
));
799 HeapFree (GetProcessHeap (), 0, oldButtons
);
802 TOOLBAR_CalcToolbar (wndPtr
);
804 InvalidateRect32 (wndPtr
->hwndSelf
, NULL
, TRUE
);
805 UpdateWindow32 (wndPtr
->hwndSelf
);
812 TOOLBAR_EnableButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
814 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
815 TBUTTON_INFO
*btnPtr
;
819 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
823 btnPtr
= &infoPtr
->buttons
[nIndex
];
824 if (LOWORD(lParam
) == FALSE
)
825 btnPtr
->fsState
&= ~(TBSTATE_ENABLED
| TBSTATE_PRESSED
);
827 btnPtr
->fsState
|= TBSTATE_ENABLED
;
829 hdc
= GetDC32 (wndPtr
->hwndSelf
);
830 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
831 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
837 // << TOOLBAR_GetAnchorHighlight >>
841 TOOLBAR_GetBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
843 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
846 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
850 return infoPtr
->buttons
[nIndex
].iBitmap
;
855 TOOLBAR_GetBitmapFlags (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
857 FIXME (toolbar
, "stub!\n");
863 TOOLBAR_GetButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
865 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
866 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
867 INT32 nIndex
= (INT32
)wParam
;
868 TBUTTON_INFO
*btnPtr
;
870 if (infoPtr
== NULL
) return FALSE
;
871 if (lpTbb
== NULL
) return FALSE
;
873 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
876 btnPtr
= &infoPtr
->buttons
[nIndex
];
877 lpTbb
->iBitmap
= btnPtr
->iBitmap
;
878 lpTbb
->idCommand
= btnPtr
->idCommand
;
879 lpTbb
->fsState
= btnPtr
->fsState
;
880 lpTbb
->fsStyle
= btnPtr
->fsStyle
;
881 lpTbb
->dwData
= btnPtr
->dwData
;
882 lpTbb
->iString
= btnPtr
->iString
;
888 // << TOOLBAR_GetButtonInfo >>
892 TOOLBAR_GetButtonSize (WND
*wndPtr
)
894 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
896 return MAKELONG((WORD
)infoPtr
->nButtonWidth
,
897 (WORD
)infoPtr
->nButtonHeight
);
902 TOOLBAR_GetButtonText32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
904 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
905 INT32 nIndex
, nStringIndex
;
907 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
911 nStringIndex
= infoPtr
->buttons
[nIndex
].iString
;
913 TRACE (toolbar
, "index=%d stringIndex=%d\n", nIndex
, nStringIndex
);
915 if ((nStringIndex
< 0) || (nStringIndex
>= infoPtr
->nNumStrings
))
918 if (lParam
== 0) return -1;
920 lstrcpy32A ((LPSTR
)lParam
, (LPSTR
)infoPtr
->strings
[nStringIndex
]);
922 return lstrlen32A ((LPSTR
)infoPtr
->strings
[nStringIndex
]);
926 // << TOOLBAR_GetButtonText32W >>
927 // << TOOLBAR_GetColorScheme >>
928 // << TOOLBAR_GetDisabledImageList >>
929 // << TOOLBAR_GetExtendedStyle >>
930 // << TOOLBAR_GetHotImageList >>
931 // << TOOLBAR_GetHotItem >>
935 TOOLBAR_GetImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
937 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
938 return (LRESULT
)infoPtr
->himlDef
;
942 // << TOOLBAR_GetInsertMark >>
943 // << TOOLBAR_GetInsertMarkColor >>
947 TOOLBAR_GetItemRect (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
949 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
950 TBUTTON_INFO
*btnPtr
;
954 if (infoPtr
== NULL
) return FALSE
;
955 nIndex
= (INT32
)wParam
;
956 btnPtr
= &infoPtr
->buttons
[nIndex
];
957 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
959 lpRect
= (LPRECT32
)lParam
;
960 if (lpRect
== NULL
) return FALSE
;
961 if (btnPtr
->fsState
& TBSTATE_HIDDEN
) return FALSE
;
963 lpRect
->left
= btnPtr
->rect
.left
;
964 lpRect
->right
= btnPtr
->rect
.right
;
965 lpRect
->bottom
= btnPtr
->rect
.bottom
;
966 lpRect
->top
= btnPtr
->rect
.top
;
972 // << TOOLBAR_GetMaxSize >>
973 // << TOOLBAR_GetObject >>
974 // << TOOLBAR_GetPadding >>
975 // << TOOLBAR_GetRect >>
979 TOOLBAR_GetRows (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
981 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
983 if (wndPtr
->dwStyle
& TBSTYLE_WRAPABLE
)
984 return infoPtr
->nMaxRows
;
991 TOOLBAR_GetState (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
993 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
996 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
997 if (nIndex
== -1) return -1;
999 return infoPtr
->buttons
[nIndex
].fsState
;
1004 TOOLBAR_GetStyle (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1006 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1009 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1010 if (nIndex
== -1) return -1;
1012 return infoPtr
->buttons
[nIndex
].fsStyle
;
1016 // << TOOLBAR_GetTextRows >>
1020 TOOLBAR_GetToolTips (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1022 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1024 if (infoPtr
== NULL
) return 0;
1025 return infoPtr
->hwndToolTip
;
1029 // << TOOLBAR_GetUnicodeFormat >>
1033 TOOLBAR_HideButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1035 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1036 TBUTTON_INFO
*btnPtr
;
1039 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1043 btnPtr
= &infoPtr
->buttons
[nIndex
];
1044 if (LOWORD(lParam
) == FALSE
)
1045 btnPtr
->fsState
&= ~TBSTATE_HIDDEN
;
1047 btnPtr
->fsState
|= TBSTATE_HIDDEN
;
1049 TOOLBAR_CalcToolbar (wndPtr
);
1051 InvalidateRect32 (wndPtr
->hwndSelf
, NULL
, TRUE
);
1052 UpdateWindow32 (wndPtr
->hwndSelf
);
1059 TOOLBAR_HitTest (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1061 return TOOLBAR_InternalHitTest (wndPtr
, (LPPOINT32
)lParam
);
1066 TOOLBAR_Indeterminate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1068 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1069 TBUTTON_INFO
*btnPtr
;
1073 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1077 btnPtr
= &infoPtr
->buttons
[nIndex
];
1078 if (LOWORD(lParam
) == FALSE
)
1079 btnPtr
->fsState
&= ~TBSTATE_INDETERMINATE
;
1081 btnPtr
->fsState
|= TBSTATE_INDETERMINATE
;
1083 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1084 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1085 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1092 TOOLBAR_InsertButton32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1094 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1095 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
1096 INT32 nIndex
= (INT32
)wParam
;
1097 TBUTTON_INFO
*oldButtons
;
1100 if (lpTbb
== NULL
) return FALSE
;
1101 if (nIndex
< 0) return FALSE
;
1103 TRACE (toolbar
, "inserting button index=%d\n", nIndex
);
1104 if (nIndex
> infoPtr
->nNumButtons
) {
1105 nIndex
= infoPtr
->nNumButtons
;
1106 TRACE (toolbar
, "adjust index=%d\n", nIndex
);
1109 oldButtons
= infoPtr
->buttons
;
1110 infoPtr
->nNumButtons
++;
1111 infoPtr
->buttons
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
1112 sizeof (TBUTTON_INFO
) * infoPtr
->nNumButtons
);
1113 /* pre insert copy */
1115 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
1116 nIndex
* sizeof(TBUTTON_INFO
));
1119 /* insert new button */
1120 infoPtr
->buttons
[nIndex
].iBitmap
= lpTbb
->iBitmap
;
1121 infoPtr
->buttons
[nIndex
].idCommand
= lpTbb
->idCommand
;
1122 infoPtr
->buttons
[nIndex
].fsState
= lpTbb
->fsState
;
1123 infoPtr
->buttons
[nIndex
].fsStyle
= lpTbb
->fsStyle
;
1124 infoPtr
->buttons
[nIndex
].dwData
= lpTbb
->dwData
;
1125 infoPtr
->buttons
[nIndex
].iString
= lpTbb
->iString
;
1127 /* post insert copy */
1128 if (nIndex
< infoPtr
->nNumButtons
- 1) {
1129 memcpy (&infoPtr
->buttons
[nIndex
+1], &oldButtons
[nIndex
],
1130 (infoPtr
->nNumButtons
- nIndex
- 1) * sizeof(TBUTTON_INFO
));
1133 HeapFree (GetProcessHeap (), 0, oldButtons
);
1135 TOOLBAR_CalcToolbar (wndPtr
);
1137 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1138 TOOLBAR_Refresh (wndPtr
, hdc
);
1139 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1145 // << TOOLBAR_InsertButton32W >>
1146 // << TOOLBAR_InsertMarkHitTest >>
1150 TOOLBAR_IsButtonChecked (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1152 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1155 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1159 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_CHECKED
);
1164 TOOLBAR_IsButtonEnabled (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1166 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1169 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1173 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_ENABLED
);
1178 TOOLBAR_IsButtonHidden (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1180 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1183 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1187 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_HIDDEN
);
1192 TOOLBAR_IsButtonHighlighted (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1194 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1197 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1201 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_MARKED
);
1206 TOOLBAR_IsButtonIndeterminate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1208 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1211 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1215 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_INDETERMINATE
);
1220 TOOLBAR_IsButtonPressed (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1222 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1225 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1229 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_PRESSED
);
1233 // << TOOLBAR_LoadImages >>
1234 // << TOOLBAR_MapAccelerator >>
1235 // << TOOLBAR_MarkButton >>
1236 // << TOOLBAR_MoveButton >>
1240 TOOLBAR_PressButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1242 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1243 TBUTTON_INFO
*btnPtr
;
1247 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1251 btnPtr
= &infoPtr
->buttons
[nIndex
];
1252 if (LOWORD(lParam
) == FALSE
)
1253 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
1255 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1257 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1258 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1259 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1265 // << TOOLBAR_ReplaceBitmap >>
1269 TOOLBAR_SaveRestore32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1271 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1272 LPTBSAVEPARAMS32A lpSave
= (LPTBSAVEPARAMS32A
)lParam
;
1274 if (lpSave
== NULL
) return 0;
1276 if ((BOOL32
)wParam
) {
1277 /* save toolbar information */
1278 FIXME (toolbar
, "save to \"%s\" \"%s\"\n",
1279 lpSave
->pszSubKey
, lpSave
->pszValueName
);
1284 /* restore toolbar information */
1286 FIXME (toolbar
, "restore from \"%s\" \"%s\"\n",
1287 lpSave
->pszSubKey
, lpSave
->pszValueName
);
1296 // << TOOLBAR_SaveRestore32W >>
1297 // << TOOLBAR_SetAnchorHighlight >>
1301 TOOLBAR_SetBitmapSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1303 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1305 if ((LOWORD(lParam
) <= 0) || (HIWORD(lParam
)<=0))
1308 infoPtr
->nBitmapWidth
= (INT32
)LOWORD(lParam
);
1309 infoPtr
->nBitmapHeight
= (INT32
)HIWORD(lParam
);
1315 // << TOOLBAR_SetButtonInfo >>
1319 TOOLBAR_SetButtonSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1321 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1323 if ((LOWORD(lParam
) <= 0) || (HIWORD(lParam
)<=0))
1326 infoPtr
->nButtonWidth
= (INT32
)LOWORD(lParam
);
1327 infoPtr
->nButtonHeight
= (INT32
)HIWORD(lParam
);
1333 // << TOOLBAR_SetButtonWidth >>
1337 TOOLBAR_SetCmdId (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1339 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1340 INT32 nIndex
= (INT32
)wParam
;
1342 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
1345 infoPtr
->buttons
[nIndex
].idCommand
= (INT32
)lParam
;
1351 // << TOOLBAR_SetColorScheme >>
1352 // << TOOLBAR_SetDisabledImageList >>
1353 // << TOOLBAR_SetDrawTextFlags >>
1354 // << TOOLBAR_SetExtendedStyle >>
1355 // << TOOLBAR_SetHotImageList >>
1356 // << TOOLBAR_SetHotItem >>
1360 TOOLBAR_SetImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1362 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1363 HIMAGELIST himlTemp
;
1365 himlTemp
= infoPtr
->himlDef
;
1366 infoPtr
->himlDef
= (HIMAGELIST
)lParam
;
1368 /* FIXME: redraw ? */
1370 return (LRESULT
)himlTemp
;
1375 TOOLBAR_SetIndent (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1377 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1380 infoPtr
->nIndent
= (INT32
)wParam
;
1381 TOOLBAR_CalcToolbar (wndPtr
);
1382 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1383 TOOLBAR_Refresh (wndPtr
, hdc
);
1384 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1390 // << TOOLBAR_SetInsertMark >>
1394 TOOLBAR_SetInsertMarkColor (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1396 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1398 infoPtr
->clrInsertMark
= (COLORREF
)lParam
;
1400 /* FIXME : redraw ??*/
1406 // << TOOLBAR_SetMaxTextRows >>
1407 // << TOOLBAR_SetPadding >>
1411 TOOLBAR_SetParent (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1413 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1414 HWND32 hwndOldNotify
;
1416 if (infoPtr
== NULL
) return 0;
1417 hwndOldNotify
= infoPtr
->hwndNotify
;
1418 infoPtr
->hwndNotify
= (HWND32
)wParam
;
1420 return hwndOldNotify
;
1425 TOOLBAR_SetRows (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1427 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1429 FIXME (toolbar
, "support multiple rows!\n");
1436 TOOLBAR_SetState (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1438 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1439 TBUTTON_INFO
*btnPtr
;
1443 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1447 btnPtr
= &infoPtr
->buttons
[nIndex
];
1448 btnPtr
->fsState
= LOWORD(lParam
);
1450 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1451 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1452 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1459 TOOLBAR_SetStyle (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1461 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1462 TBUTTON_INFO
*btnPtr
;
1466 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1470 btnPtr
= &infoPtr
->buttons
[nIndex
];
1471 btnPtr
->fsStyle
= LOWORD(lParam
);
1473 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1474 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1475 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1482 TOOLBAR_SetToolTips (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1484 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1486 if (infoPtr
== NULL
) return 0;
1487 infoPtr
->hwndToolTip
= (HWND32
)wParam
;
1493 TOOLBAR_SetUnicodeFormat (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1495 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1497 FIXME (toolbar
, "hwnd=0x%04x stub!\n", wndPtr
->hwndSelf
);
1504 TOOLBAR_Create (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1506 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1509 /* initialize info structure */
1510 infoPtr
->nButtonHeight
= 22;
1511 infoPtr
->nButtonWidth
= 23;
1512 infoPtr
->nBitmapHeight
= 15;
1513 infoPtr
->nBitmapWidth
= 16;
1515 infoPtr
->nHeight
= infoPtr
->nButtonHeight
+ TOP_BORDER
+ BOTTOM_BORDER
;
1516 infoPtr
->nMaxRows
= 1;
1518 infoPtr
->bCaptured
= 0;
1519 infoPtr
->nButtonDown
= -1;
1520 infoPtr
->nOldHit
= -1;
1522 infoPtr
->hwndNotify
= GetParent32 (wndPtr
->hwndSelf
);
1523 infoPtr
->bTransparent
= (wndPtr
->dwStyle
& TBSTYLE_FLAT
);
1524 infoPtr
->nHotItem
= -1;
1526 SystemParametersInfo32A (SPI_GETICONTITLELOGFONT
, 0, &logFont
, 0);
1527 infoPtr
->hFont
= CreateFontIndirect32A (&logFont
);
1534 TOOLBAR_Destroy (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1536 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1538 /* delete tool tip */
1539 if (infoPtr
->hwndToolTip
)
1540 DestroyWindow32 (infoPtr
->hwndToolTip
);
1542 /* delete button data */
1543 if (infoPtr
->buttons
)
1544 HeapFree (GetProcessHeap (), 0, infoPtr
->buttons
);
1546 /* delete strings */
1547 if (infoPtr
->strings
) {
1549 for (i
= 0; i
< infoPtr
->nNumStrings
; i
++)
1550 if (infoPtr
->strings
[i
])
1551 HeapFree (GetProcessHeap (), 0, infoPtr
->strings
[i
]);
1553 HeapFree (GetProcessHeap (), 0, infoPtr
->strings
);
1556 /* destroy default image list */
1557 if (infoPtr
->himlDef
)
1558 ImageList_Destroy (infoPtr
->himlDef
);
1560 /* destroy disabled image list */
1561 if (infoPtr
->himlDis
)
1562 ImageList_Destroy (infoPtr
->himlDis
);
1564 /* destroy hot image list */
1565 if (infoPtr
->himlHot
)
1566 ImageList_Destroy (infoPtr
->himlHot
);
1568 /* delete default font */
1570 DeleteObject32 (infoPtr
->hFont
);
1572 /* free toolbar info data */
1573 HeapFree (GetProcessHeap (), 0, infoPtr
);
1580 TOOLBAR_EraseBackground (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1582 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1584 if (infoPtr
->bTransparent
)
1585 return SendMessage32A (GetParent32 (wndPtr
->hwndSelf
), WM_ERASEBKGND
,
1588 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_ERASEBKGND
, wParam
, lParam
);
1593 TOOLBAR_LButtonDblClk (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1595 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1596 TBUTTON_INFO
*btnPtr
;
1601 pt
.x
= (INT32
)LOWORD(lParam
);
1602 pt
.y
= (INT32
)HIWORD(lParam
);
1603 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
1606 btnPtr
= &infoPtr
->buttons
[nHit
];
1607 if (!(btnPtr
->fsState
& TBSTATE_ENABLED
))
1609 SetCapture32 (wndPtr
->hwndSelf
);
1610 infoPtr
->bCaptured
= TRUE
;
1611 infoPtr
->nButtonDown
= nHit
;
1613 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1615 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1616 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1617 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1619 else if (wndPtr
->dwStyle
& CCS_ADJUSTABLE
)
1620 TOOLBAR_Customize (wndPtr
);
1627 TOOLBAR_LButtonDown (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1629 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1630 TBUTTON_INFO
*btnPtr
;
1635 pt
.x
= (INT32
)LOWORD(lParam
);
1636 pt
.y
= (INT32
)HIWORD(lParam
);
1637 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
1640 btnPtr
= &infoPtr
->buttons
[nHit
];
1641 if (!(btnPtr
->fsState
& TBSTATE_ENABLED
))
1644 SetCapture32 (wndPtr
->hwndSelf
);
1645 infoPtr
->bCaptured
= TRUE
;
1646 infoPtr
->nButtonDown
= nHit
;
1647 infoPtr
->nOldHit
= nHit
;
1649 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1651 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1652 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1653 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1662 TOOLBAR_LButtonUp (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1664 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1665 TBUTTON_INFO
*btnPtr
;
1668 INT32 nOldIndex
= -1;
1670 BOOL32 bSendMessage
= TRUE
;
1672 pt
.x
= (INT32
)LOWORD(lParam
);
1673 pt
.y
= (INT32
)HIWORD(lParam
);
1674 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
1676 if ((infoPtr
->bCaptured
) && (infoPtr
->nButtonDown
>= 0)) {
1677 infoPtr
->bCaptured
= FALSE
;
1679 btnPtr
= &infoPtr
->buttons
[infoPtr
->nButtonDown
];
1680 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
1682 if (nHit
== infoPtr
->nButtonDown
) {
1683 if (btnPtr
->fsStyle
& TBSTYLE_CHECK
) {
1684 if (btnPtr
->fsStyle
& TBSTYLE_GROUP
) {
1685 nOldIndex
= TOOLBAR_GetCheckedGroupButtonIndex (infoPtr
,
1686 infoPtr
->nButtonDown
);
1687 if (nOldIndex
== infoPtr
->nButtonDown
)
1688 bSendMessage
= FALSE
;
1689 if ((nOldIndex
!= infoPtr
->nButtonDown
) &&
1691 infoPtr
->buttons
[nOldIndex
].fsState
&= ~TBSTATE_CHECKED
;
1692 btnPtr
->fsState
|= TBSTATE_CHECKED
;
1695 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
1696 btnPtr
->fsState
&= ~TBSTATE_CHECKED
;
1698 btnPtr
->fsState
|= TBSTATE_CHECKED
;
1703 bSendMessage
= FALSE
;
1705 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1706 if (nOldIndex
!= -1)
1707 TOOLBAR_DrawButton (wndPtr
, &infoPtr
->buttons
[nOldIndex
], hdc
);
1708 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1709 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1712 SendMessage32A (infoPtr
->hwndNotify
, WM_COMMAND
,
1713 MAKEWPARAM(btnPtr
->idCommand
, 0),
1714 (LPARAM
)wndPtr
->hwndSelf
);
1716 infoPtr
->nButtonDown
= -1;
1717 infoPtr
->nOldHit
= -1;
1725 TOOLBAR_MouseMove (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1727 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1728 TBUTTON_INFO
*btnPtr
;
1733 pt
.x
= (INT32
)LOWORD(lParam
);
1734 pt
.y
= (INT32
)HIWORD(lParam
);
1735 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
1737 if (infoPtr
->bCaptured
) {
1738 if (infoPtr
->nOldHit
!= nHit
) {
1739 btnPtr
= &infoPtr
->buttons
[infoPtr
->nButtonDown
];
1740 if (infoPtr
->nOldHit
== infoPtr
->nButtonDown
) {
1741 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
1742 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1743 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1744 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1746 else if (nHit
== infoPtr
->nButtonDown
) {
1747 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1748 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1749 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1750 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1753 infoPtr
->nOldHit
= nHit
;
1764 TOOLBAR_NCCalcSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1766 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
)) {
1767 LPRECT32 winRect
= (LPRECT32
)lParam
;
1769 winRect
->bottom
+= 2;
1772 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_NCCALCSIZE
, wParam
, lParam
);
1777 TOOLBAR_NCCreate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1779 TOOLBAR_INFO
*infoPtr
;
1781 /* allocate memory for info structure */
1782 infoPtr
= (TOOLBAR_INFO
*)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
1783 sizeof(TOOLBAR_INFO
));
1784 wndPtr
->wExtra
[0] = (DWORD
)infoPtr
;
1786 if (infoPtr
== NULL
) {
1787 ERR (toolbar
, "could not allocate info memory!\n");
1791 if ((TOOLBAR_INFO
*)wndPtr
->wExtra
[0] != infoPtr
) {
1792 ERR (toolbar
, "pointer assignment error!\n");
1796 /* this is just for security (reliable??)*/
1797 infoPtr
->dwStructSize
= sizeof(TBBUTTON
);
1799 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_NCCREATE
, wParam
, lParam
);
1804 TOOLBAR_NCPaint (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1808 HWND32 hwnd
= wndPtr
->hwndSelf
;
1810 if ( wndPtr
->dwStyle
& WS_MINIMIZE
||
1811 !WIN_IsWindowDrawable( wndPtr
, 0 )) return 0; /* Nothing to do */
1813 DefWindowProc32A (hwnd
, WM_NCPAINT
, wParam
, lParam
);
1815 if (!(hdc
= GetDCEx32( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
))) return 0;
1817 if (ExcludeVisRect( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
1818 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
1819 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
1820 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
1823 ReleaseDC32( hwnd
, hdc
);
1827 if (!(wndPtr
->flags
& WIN_MANAGED
)) {
1828 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
)) {
1829 rect
.left
= wndPtr
->rectClient
.left
;
1830 rect
.top
= wndPtr
->rectClient
.top
- 2;
1831 rect
.right
= wndPtr
->rectClient
.right
;
1833 SelectObject32 ( hdc
, GetSysColorPen32 (COLOR_3DSHADOW
));
1834 MoveToEx32 (hdc
, rect
.left
, rect
.top
, NULL
);
1835 LineTo32 (hdc
, rect
.right
, rect
.top
);
1837 SelectObject32 ( hdc
, GetSysColorPen32 (COLOR_3DHILIGHT
));
1838 MoveToEx32 (hdc
, rect
.left
, rect
.top
, NULL
);
1839 LineTo32 (hdc
, rect
.right
, rect
.top
);
1844 ReleaseDC32( hwnd
, hdc
);
1851 TOOLBAR_Paint (WND
*wndPtr
, WPARAM32 wParam
)
1856 hdc
= wParam
==0 ? BeginPaint32 (wndPtr
->hwndSelf
, &ps
) : (HDC32
)wParam
;
1857 TOOLBAR_Refresh (wndPtr
, hdc
);
1859 EndPaint32 (wndPtr
->hwndSelf
, &ps
);
1865 TOOLBAR_Size (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1867 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1872 UINT32 uPosFlags
= 0;
1874 if (infoPtr
->bAutoSize
) {
1875 infoPtr
->bAutoSize
= FALSE
;
1879 flags
= (INT32
) wParam
;
1881 /* FIXME for flags =
1882 * SIZE_MAXIMIZED, SIZE_MAXSHOW, SIZE_MINIMIZED
1885 TRACE (toolbar
, "sizing toolbar!\n");
1887 if (flags
== SIZE_RESTORED
) {
1888 /* width and height don't apply */
1889 parent
= GetParent32 (wndPtr
->hwndSelf
);
1890 GetClientRect32(parent
, &parent_rect
);
1892 if (wndPtr
->dwStyle
& CCS_NORESIZE
)
1893 uPosFlags
|= SWP_NOSIZE
;
1895 infoPtr
->nWidth
= parent_rect
.right
- parent_rect
.left
;
1896 TOOLBAR_CalcToolbar (wndPtr
);
1897 cy
= infoPtr
->nHeight
;
1898 cx
= infoPtr
->nWidth
;
1901 if (wndPtr
->dwStyle
& CCS_NOPARENTALIGN
) {
1902 uPosFlags
|= SWP_NOMOVE
;
1903 // if (wndPtr->dwStyle & (CCS_TOP | CCS_BOTTOM))
1904 // cy = (INT32)HIWORD(lParam);
1907 if (wndPtr
->dwStyle
& CCS_NORESIZE
) {
1908 uPosFlags
|= SWP_NOSIZE
;
1909 // cx = (INT32)LOWORD(lParam);
1910 // cy = (INT32)HIWORD(lParam);
1913 /* FIXME: handle CCS_NOMOVEX and CCS_NOMOVEY */
1917 infoPtr
->nWidth
= cx
;
1918 infoPtr
->nHeight
= cy
;
1920 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
))
1923 SetWindowPos32 (wndPtr
->hwndSelf
, 0, parent_rect
.left
, parent_rect
.top
,
1924 cx
, cy
, uPosFlags
| SWP_NOZORDER
);
1936 ToolbarWindowProc (HWND32 hwnd
, UINT32 uMsg
, WPARAM32 wParam
, LPARAM lParam
)
1938 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
1943 return TOOLBAR_AddBitmap (wndPtr
, wParam
, lParam
);
1945 case TB_ADDBUTTONS32A
:
1946 return TOOLBAR_AddButtons32A (wndPtr
, wParam
, lParam
);
1948 // case TB_ADDBUTTONS32W:
1950 case TB_ADDSTRING32A
:
1951 return TOOLBAR_AddString32A (wndPtr
, wParam
, lParam
);
1953 // case TB_ADDSTRING32W:
1956 return TOOLBAR_AutoSize (wndPtr
, wParam
, lParam
);
1958 case TB_BUTTONCOUNT
:
1959 return TOOLBAR_ButtonCount (wndPtr
, wParam
, lParam
);
1961 case TB_BUTTONSTRUCTSIZE
:
1962 return TOOLBAR_ButtonStructSize (wndPtr
, wParam
, lParam
);
1964 case TB_CHANGEBITMAP
:
1965 return TOOLBAR_ChangeBitmap (wndPtr
, wParam
, lParam
);
1967 case TB_CHECKBUTTON
:
1968 return TOOLBAR_CheckButton (wndPtr
, wParam
, lParam
);
1970 case TB_COMMANDTOINDEX
:
1971 return TOOLBAR_CommandToIndex (wndPtr
, wParam
, lParam
);
1974 return TOOLBAR_Customize (wndPtr
);
1976 case TB_DELETEBUTTON
:
1977 return TOOLBAR_DeleteButton (wndPtr
, wParam
, lParam
);
1979 case TB_ENABLEBUTTON
:
1980 return TOOLBAR_EnableButton (wndPtr
, wParam
, lParam
);
1982 // case TB_GETANCHORHIGHLIGHT: /* 4.71 */
1985 return TOOLBAR_GetBitmap (wndPtr
, wParam
, lParam
);
1987 case TB_GETBITMAPFLAGS
:
1988 return TOOLBAR_GetBitmapFlags (wndPtr
, wParam
, lParam
);
1991 return TOOLBAR_GetButton (wndPtr
, wParam
, lParam
);
1993 // case TB_GETBUTTONINFO: /* 4.71 */
1995 case TB_GETBUTTONSIZE
:
1996 return TOOLBAR_GetButtonSize (wndPtr
);
1998 case TB_GETBUTTONTEXT32A
:
1999 return TOOLBAR_GetButtonText32A (wndPtr
, wParam
, lParam
);
2001 // case TB_GETBUTTONTEXT32W:
2002 // case TB_GETCOLORSCHEME: /* 4.71 */
2003 // case TB_GETDISABLEDIMAGELIST: /* 4.70 */
2004 // case TB_GETEXTENDEDSTYLE: /* 4.71 */
2005 // case TB_GETHOTIMAGELIST: /* 4.70 */
2006 // case TB_GETHOTITEM: /* 4.71 */
2008 case TB_GETIMAGELIST
:
2009 return TOOLBAR_GetImageList (wndPtr
, wParam
, lParam
);
2011 // case TB_GETINSERTMARK: /* 4.71 */
2012 // case TB_GETINSERTMARKCOLOR: /* 4.71 */
2014 case TB_GETITEMRECT
:
2015 return TOOLBAR_GetItemRect (wndPtr
, wParam
, lParam
);
2017 // case TB_GETMAXSIZE: /* 4.71 */
2018 // case TB_GETOBJECT: /* 4.71 */
2019 // case TB_GETPADDING: /* 4.71 */
2020 // case TB_GETRECT: /* 4.70 */
2023 return TOOLBAR_GetRows (wndPtr
, wParam
, lParam
);
2026 return TOOLBAR_GetState (wndPtr
, wParam
, lParam
);
2029 return TOOLBAR_GetStyle (wndPtr
, wParam
, lParam
);
2031 // case TB_GETTEXTROWS: /* 4.70 */
2033 case TB_GETTOOLTIPS
:
2034 return TOOLBAR_GetToolTips (wndPtr
, wParam
, lParam
);
2036 // case TB_GETUNICODEFORMAT:
2039 return TOOLBAR_HideButton (wndPtr
, wParam
, lParam
);
2042 return TOOLBAR_HitTest (wndPtr
, wParam
, lParam
);
2044 case TB_INDETERMINATE
:
2045 return TOOLBAR_Indeterminate (wndPtr
, wParam
, lParam
);
2047 case TB_INSERTBUTTON32A
:
2048 return TOOLBAR_InsertButton32A (wndPtr
, wParam
, lParam
);
2050 // case TB_INSERTBUTTON32W:
2051 // case TB_INSERTMARKHITTEST: /* 4.71 */
2053 case TB_ISBUTTONCHECKED
:
2054 return TOOLBAR_IsButtonChecked (wndPtr
, wParam
, lParam
);
2056 case TB_ISBUTTONENABLED
:
2057 return TOOLBAR_IsButtonEnabled (wndPtr
, wParam
, lParam
);
2059 case TB_ISBUTTONHIDDEN
:
2060 return TOOLBAR_IsButtonHidden (wndPtr
, wParam
, lParam
);
2062 case TB_ISBUTTONHIGHLIGHTED
:
2063 return TOOLBAR_IsButtonHighlighted (wndPtr
, wParam
, lParam
);
2065 case TB_ISBUTTONINDETERMINATE
:
2066 return TOOLBAR_IsButtonIndeterminate (wndPtr
, wParam
, lParam
);
2068 case TB_ISBUTTONPRESSED
:
2069 return TOOLBAR_IsButtonPressed (wndPtr
, wParam
, lParam
);
2071 // case TB_LOADIMAGES: /* 4.70 */
2072 // case TB_MAPACCELERATOR32A: /* 4.71 */
2073 // case TB_MAPACCELERATOR32W: /* 4.71 */
2074 // case TB_MARKBUTTON: /* 4.71 */
2075 // case TB_MOVEBUTTON: /* 4.71 */
2077 case TB_PRESSBUTTON
:
2078 return TOOLBAR_PressButton (wndPtr
, wParam
, lParam
);
2080 // case TB_REPLACEBITMAP:
2082 case TB_SAVERESTORE32A
:
2083 return TOOLBAR_SaveRestore32A (wndPtr
, wParam
, lParam
);
2085 // case TB_SAVERESTORE32W:
2086 // case TB_SETANCHORHIGHLIGHT: /* 4.71 */
2088 case TB_SETBITMAPSIZE
:
2089 return TOOLBAR_SetBitmapSize (wndPtr
, wParam
, lParam
);
2091 // case TB_SETBUTTONINFO: /* 4.71 */
2093 case TB_SETBUTTONSIZE
:
2094 return TOOLBAR_SetButtonSize (wndPtr
, wParam
, lParam
);
2096 // case TB_SETBUTTONWIDTH: /* 4.70 */
2099 return TOOLBAR_SetCmdId (wndPtr
, wParam
, lParam
);
2101 // case TB_SETCOLORSCHEME: /* 4.71 */
2102 // case TB_SETDISABLEDIMAGELIST: /* 4.70 */
2103 // case TB_SETDRAWTEXTFLAGS: /* 4.71 */
2104 // case TB_SETEXTENDEDSTYLE: /* 4.71 */
2105 // case TB_SETHOTIMAGELIST: /* 4.70 */
2106 // case TB_SETHOTITEM: /* 4.71 */
2108 case TB_SETIMAGELIST
:
2109 return TOOLBAR_SetImageList (wndPtr
, wParam
, lParam
);
2112 return TOOLBAR_SetIndent (wndPtr
, wParam
, lParam
);
2114 // case TB_SETINSERTMARK: /* 4.71 */
2116 case TB_SETINSERTMARKCOLOR
:
2117 return TOOLBAR_SetInsertMarkColor (wndPtr
, wParam
, lParam
);
2119 // case TB_SETMAXTEXTROWS: /* 4.70 */
2120 // case TB_SETPADDING: /* 4.71 */
2123 return TOOLBAR_SetParent (wndPtr
, wParam
, lParam
);
2126 return TOOLBAR_SetRows (wndPtr
, wParam
, lParam
);
2129 return TOOLBAR_SetState (wndPtr
, wParam
, lParam
);
2132 return TOOLBAR_SetStyle (wndPtr
, wParam
, lParam
);
2134 case TB_SETTOOLTIPS
:
2135 return TOOLBAR_SetToolTips (wndPtr
, wParam
, lParam
);
2137 case TB_SETUNICODEFORMAT
:
2138 return TOOLBAR_SetUnicodeFormat (wndPtr
, wParam
, lParam
);
2141 return TOOLBAR_Create (wndPtr
, wParam
, lParam
);
2144 return TOOLBAR_Destroy (wndPtr
, wParam
, lParam
);
2147 return TOOLBAR_EraseBackground (wndPtr
, wParam
, lParam
);
2149 case WM_LBUTTONDBLCLK
:
2150 return TOOLBAR_LButtonDblClk (wndPtr
, wParam
, lParam
);
2152 case WM_LBUTTONDOWN
:
2153 return TOOLBAR_LButtonDown (wndPtr
, wParam
, lParam
);
2156 return TOOLBAR_LButtonUp (wndPtr
, wParam
, lParam
);
2159 return TOOLBAR_MouseMove (wndPtr
, wParam
, lParam
);
2161 // case WM_NCACTIVATE:
2162 // return TOOLBAR_NCActivate (wndPtr, wParam, lParam);
2165 return TOOLBAR_NCCalcSize (wndPtr
, wParam
, lParam
);
2168 return TOOLBAR_NCCreate (wndPtr
, wParam
, lParam
);
2171 return TOOLBAR_NCPaint (wndPtr
, wParam
, lParam
);
2174 // SendMessage32A (GetParent32 (hwnd), uMsg, wParam, lParam);
2177 return TOOLBAR_Paint (wndPtr
, wParam
);
2180 return TOOLBAR_Size (wndPtr
, wParam
, lParam
);
2182 // case WM_SYSCOLORCHANGE:
2184 // case WM_WININICHANGE:
2189 case WM_MEASUREITEM
:
2191 return SendMessage32A (GetParent32 (hwnd
), uMsg
, wParam
, lParam
);
2194 if (uMsg
>= WM_USER
)
2195 ERR (toolbar
, "unknown msg %04x wp=%08x lp=%08lx\n",
2196 uMsg
, wParam
, lParam
);
2197 return DefWindowProc32A (hwnd
, uMsg
, wParam
, lParam
);
2204 TOOLBAR_Register (void)
2206 WNDCLASS32A wndClass
;
2208 if (GlobalFindAtom32A (TOOLBARCLASSNAME32A
)) return;
2210 ZeroMemory (&wndClass
, sizeof(WNDCLASS32A
));
2211 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
2212 wndClass
.lpfnWndProc
= (WNDPROC32
)ToolbarWindowProc
;
2213 wndClass
.cbClsExtra
= 0;
2214 wndClass
.cbWndExtra
= sizeof(TOOLBAR_INFO
*);
2215 wndClass
.hCursor
= LoadCursor32A (0, IDC_ARROW32A
);
2216 wndClass
.hbrBackground
= (HBRUSH32
)(COLOR_3DFACE
+ 1);
2217 wndClass
.lpszClassName
= TOOLBARCLASSNAME32A
;
2219 RegisterClass32A (&wndClass
);