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
->fsState
& TBSTATE_HIDDEN
)
331 if (btnPtr
->fsStyle
& TBSTYLE_SEP
) {
332 if (PtInRect32 (&btnPtr
->rect
, *lpPt
)) {
333 TRACE (toolbar
, " ON SEPARATOR %d!\n", i
);
338 if (PtInRect32 (&btnPtr
->rect
, *lpPt
)) {
339 TRACE (toolbar
, " ON BUTTON %d!\n", i
);
345 TRACE (toolbar
, " NOWHERE!\n");
351 TOOLBAR_GetButtonIndex (TOOLBAR_INFO
*infoPtr
, INT32 idCommand
)
353 TBUTTON_INFO
*btnPtr
;
356 btnPtr
= infoPtr
->buttons
;
357 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
358 if (btnPtr
->idCommand
== idCommand
) {
359 TRACE (toolbar
, "command=%d index=%d\n", idCommand
, i
);
363 TRACE (toolbar
, "no index found for command=%d\n", idCommand
);
369 TOOLBAR_GetCheckedGroupButtonIndex (TOOLBAR_INFO
*infoPtr
, INT32 nIndex
)
371 TBUTTON_INFO
*btnPtr
;
374 if ((nIndex
< 0) || (nIndex
> infoPtr
->nNumButtons
))
377 /* check index button */
378 btnPtr
= &infoPtr
->buttons
[nIndex
];
379 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
380 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
384 /* check previous buttons */
385 nRunIndex
= nIndex
- 1;
386 while (nRunIndex
>= 0) {
387 btnPtr
= &infoPtr
->buttons
[nRunIndex
];
388 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
389 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
397 /* check next buttons */
398 nRunIndex
= nIndex
+ 1;
399 while (nRunIndex
< infoPtr
->nNumButtons
) {
400 btnPtr
= &infoPtr
->buttons
[nRunIndex
];
401 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
402 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
415 TOOLBAR_AddBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
417 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
418 LPTBADDBITMAP lpAddBmp
= (LPTBADDBITMAP
)lParam
;
421 if ((!lpAddBmp
) || ((INT32
)wParam
<= 0))
424 TRACE (toolbar
, "adding %d bitmaps!\n", wParam
);
426 if (!(infoPtr
->himlDef
)) {
427 /* create new default image list */
428 TRACE (toolbar
, "creating default image list!\n");
430 ImageList_Create (infoPtr
->nBitmapWidth
, infoPtr
->nBitmapHeight
,
431 ILC_COLOR
| ILC_MASK
, (INT32
)wParam
, 2);
435 if (!(infoPtr
->himlDis
)) {
436 /* create new disabled image list */
437 TRACE (toolbar
, "creating disabled image list!\n");
439 ImageList_Create (infoPtr
->nBitmapWidth
,
440 infoPtr
->nBitmapHeight
, ILC_COLOR
| ILC_MASK
,
445 /* Add bitmaps to the default image list */
446 if (lpAddBmp
->hInst
== (HINSTANCE32
)0) {
448 ImageList_AddMasked (infoPtr
->himlDef
, (HBITMAP32
)lpAddBmp
->nID
,
449 GetSysColor32 (COLOR_3DFACE
));
451 else if (lpAddBmp
->hInst
== HINST_COMMCTRL
) {
452 /* add internal bitmaps */
453 FIXME (toolbar
, "internal bitmaps not supported!\n");
455 /* Hack to "add" some reserved images within the image list
456 to get the right image indices */
457 nIndex
= ImageList_GetImageCount (infoPtr
->himlDef
);
458 ImageList_SetImageCount (infoPtr
->himlDef
, nIndex
+ (INT32
)wParam
);
462 LoadBitmap32A (lpAddBmp
->hInst
, (LPSTR
)lpAddBmp
->nID
);
464 nIndex
= ImageList_Add (infoPtr
->himlDef
, hBmp
, (HBITMAP32
)0);
466 DeleteObject32 (hBmp
);
470 infoPtr
->nNumBitmaps
+= (INT32
)wParam
;
477 TOOLBAR_AddButtons32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
479 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
480 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
481 INT32 nOldButtons
, nNewButtons
, nAddButtons
, nCount
;
484 TRACE (toolbar
, "adding %d buttons!\n", wParam
);
486 nAddButtons
= (UINT32
)wParam
;
487 nOldButtons
= infoPtr
->nNumButtons
;
488 nNewButtons
= nOldButtons
+ nAddButtons
;
490 if (infoPtr
->nNumButtons
== 0) {
492 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
493 sizeof (TBUTTON_INFO
) * nNewButtons
);
496 TBUTTON_INFO
*oldButtons
= infoPtr
->buttons
;
498 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
499 sizeof (TBUTTON_INFO
) * nNewButtons
);
500 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
501 nOldButtons
* sizeof(TBUTTON_INFO
));
502 HeapFree (GetProcessHeap (), 0, oldButtons
);
505 infoPtr
->nNumButtons
= nNewButtons
;
507 /* insert new button data (bad implementation)*/
508 for (nCount
= 0; nCount
< nAddButtons
; nCount
++) {
509 infoPtr
->buttons
[nOldButtons
+nCount
].iBitmap
= lpTbb
[nCount
].iBitmap
;
510 infoPtr
->buttons
[nOldButtons
+nCount
].idCommand
= lpTbb
[nCount
].idCommand
;
511 infoPtr
->buttons
[nOldButtons
+nCount
].fsState
= lpTbb
[nCount
].fsState
;
512 infoPtr
->buttons
[nOldButtons
+nCount
].fsStyle
= lpTbb
[nCount
].fsStyle
;
513 infoPtr
->buttons
[nOldButtons
+nCount
].dwData
= lpTbb
[nCount
].dwData
;
514 infoPtr
->buttons
[nOldButtons
+nCount
].iString
= lpTbb
[nCount
].iString
;
517 TOOLBAR_CalcToolbar (wndPtr
);
519 hdc
= GetDC32 (wndPtr
->hwndSelf
);
520 TOOLBAR_Refresh (wndPtr
, hdc
);
521 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
527 // << TOOLBAR_AddButtons32W >>
531 TOOLBAR_AddString32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
533 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
539 TRACE (toolbar
, "adding string from resource!\n");
541 len
= LoadString32A ((HINSTANCE32
)wParam
, (UINT32
)lParam
,
544 TRACE (toolbar
, "len=%d \"%s\"\n", len
, szString
);
545 nIndex
= infoPtr
->nNumStrings
;
546 if (infoPtr
->nNumStrings
== 0) {
548 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(char *));
551 char **oldStrings
= infoPtr
->strings
;
553 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
554 sizeof(char *) * (infoPtr
->nNumStrings
+ 1));
555 memcpy (&infoPtr
->strings
[0], &oldStrings
[0],
556 sizeof(char *) * infoPtr
->nNumStrings
);
557 HeapFree (GetProcessHeap (), 0, oldStrings
);
560 infoPtr
->strings
[infoPtr
->nNumStrings
] =
561 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(char)*(len
+1));
562 lstrcpy32A (infoPtr
->strings
[infoPtr
->nNumStrings
], szString
);
563 infoPtr
->nNumStrings
++;
566 char *p
= (char*)lParam
;
569 if (p
== NULL
) return -1;
570 TRACE (toolbar
, "adding string(s) from array!\n");
571 nIndex
= infoPtr
->nNumStrings
;
573 len
= lstrlen32A (p
);
574 TRACE (toolbar
, "len=%d \"%s\"\n", len
, p
);
576 if (infoPtr
->nNumStrings
== 0) {
578 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(char *));
581 char **oldStrings
= infoPtr
->strings
;
583 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
584 sizeof(char *) * (infoPtr
->nNumStrings
+ 1));
585 memcpy (&infoPtr
->strings
[0], &oldStrings
[0],
586 sizeof(char *) * infoPtr
->nNumStrings
);
587 HeapFree (GetProcessHeap (), 0, oldStrings
);
590 infoPtr
->strings
[infoPtr
->nNumStrings
] =
591 HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, sizeof(char)*(len
+1));
592 lstrcpy32A (infoPtr
->strings
[infoPtr
->nNumStrings
], p
);
593 infoPtr
->nNumStrings
++;
603 // << TOOLBAR_AddString32W >>
607 TOOLBAR_AutoSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
609 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
613 UINT32 uPosFlags
= 0;
615 FIXME (toolbar
, "auto size!\n");
617 parent
= GetParent32 (wndPtr
->hwndSelf
);
618 GetClientRect32(parent
, &parent_rect
);
620 if (wndPtr
->dwStyle
& CCS_NORESIZE
) {
621 uPosFlags
|= SWP_NOSIZE
;
626 infoPtr
->nWidth
= parent_rect
.right
- parent_rect
.left
;
627 TOOLBAR_CalcToolbar (wndPtr
);
628 cy
= infoPtr
->nHeight
;
629 cx
= infoPtr
->nWidth
;
632 if (wndPtr
->dwStyle
& CCS_NOPARENTALIGN
)
633 uPosFlags
|= SWP_NOMOVE
;
635 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
))
638 infoPtr
->bAutoSize
= TRUE
;
639 SetWindowPos32 (wndPtr
->hwndSelf
, 0, parent_rect
.left
, parent_rect
.top
,
640 cx
, cy
, uPosFlags
| SWP_NOZORDER
);
647 TOOLBAR_ButtonCount (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
649 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
651 return infoPtr
->nNumButtons
;
656 TOOLBAR_ButtonStructSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
658 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
660 if (infoPtr
== NULL
) {
661 ERR (toolbar
, "(0x%08lx, 0x%08x, 0x%08lx)\n", (DWORD
)wndPtr
, wParam
, lParam
);
662 ERR (toolbar
, "infoPtr == NULL!\n");
666 infoPtr
->dwStructSize
= (DWORD
)wParam
;
673 TOOLBAR_ChangeBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
675 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
676 TBUTTON_INFO
*btnPtr
;
680 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
684 btnPtr
= &infoPtr
->buttons
[nIndex
];
685 btnPtr
->iBitmap
= LOWORD(lParam
);
687 hdc
= GetDC32 (wndPtr
->hwndSelf
);
688 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
689 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
696 TOOLBAR_CheckButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
698 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
699 TBUTTON_INFO
*btnPtr
;
702 INT32 nOldIndex
= -1;
704 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
708 btnPtr
= &infoPtr
->buttons
[nIndex
];
710 if (!(btnPtr
->fsStyle
& TBSTYLE_CHECK
))
713 if (LOWORD(lParam
) == FALSE
)
714 btnPtr
->fsState
&= ~TBSTATE_CHECKED
;
716 if (btnPtr
->fsStyle
& TBSTYLE_GROUP
) {
718 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr
, nIndex
);
719 if (nOldIndex
== nIndex
)
722 infoPtr
->buttons
[nOldIndex
].fsState
&= ~TBSTATE_CHECKED
;
724 btnPtr
->fsState
|= TBSTATE_CHECKED
;
727 hdc
= GetDC32 (wndPtr
->hwndSelf
);
729 TOOLBAR_DrawButton (wndPtr
, &infoPtr
->buttons
[nOldIndex
], hdc
);
730 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
731 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
733 /* FIXME: Send a WM_NOTIFY?? */
740 TOOLBAR_CommandToIndex (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
742 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
744 return TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
749 TOOLBAR_Customize (WND
*wndPtr
)
751 FIXME (toolbar
, "customization not implemented!\n");
758 TOOLBAR_DeleteButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
760 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
761 INT32 nIndex
= (INT32
)wParam
;
763 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
766 if (infoPtr
->nNumButtons
== 1) {
767 TRACE (toolbar
, " simple delete!\n");
768 HeapFree (GetProcessHeap (), 0, infoPtr
->buttons
);
769 infoPtr
->buttons
= NULL
;
770 infoPtr
->nNumButtons
= 0;
773 TBUTTON_INFO
*oldButtons
= infoPtr
->buttons
;
774 TRACE(toolbar
, "complex delete! [nIndex=%d]\n", nIndex
);
776 infoPtr
->nNumButtons
--;
777 infoPtr
->buttons
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
778 sizeof (TBUTTON_INFO
) * infoPtr
->nNumButtons
);
780 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
781 nIndex
* sizeof(TBUTTON_INFO
));
784 if (nIndex
< infoPtr
->nNumButtons
) {
785 memcpy (&infoPtr
->buttons
[nIndex
], &oldButtons
[nIndex
+1],
786 (infoPtr
->nNumButtons
- nIndex
) * sizeof(TBUTTON_INFO
));
789 HeapFree (GetProcessHeap (), 0, oldButtons
);
792 TOOLBAR_CalcToolbar (wndPtr
);
794 InvalidateRect32 (wndPtr
->hwndSelf
, NULL
, TRUE
);
795 UpdateWindow32 (wndPtr
->hwndSelf
);
802 TOOLBAR_EnableButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
804 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
805 TBUTTON_INFO
*btnPtr
;
809 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
813 btnPtr
= &infoPtr
->buttons
[nIndex
];
814 if (LOWORD(lParam
) == FALSE
)
815 btnPtr
->fsState
&= ~(TBSTATE_ENABLED
| TBSTATE_PRESSED
);
817 btnPtr
->fsState
|= TBSTATE_ENABLED
;
819 hdc
= GetDC32 (wndPtr
->hwndSelf
);
820 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
821 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
827 // << TOOLBAR_GetAnchorHighlight >>
831 TOOLBAR_GetBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
833 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
836 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
840 return infoPtr
->buttons
[nIndex
].iBitmap
;
845 TOOLBAR_GetBitmapFlags (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
847 FIXME (toolbar
, "stub!\n");
853 TOOLBAR_GetButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
855 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
856 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
857 INT32 nIndex
= (INT32
)wParam
;
858 TBUTTON_INFO
*btnPtr
;
860 if (infoPtr
== NULL
) return FALSE
;
861 if (lpTbb
== NULL
) return FALSE
;
863 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
866 btnPtr
= &infoPtr
->buttons
[nIndex
];
867 lpTbb
->iBitmap
= btnPtr
->iBitmap
;
868 lpTbb
->idCommand
= btnPtr
->idCommand
;
869 lpTbb
->fsState
= btnPtr
->fsState
;
870 lpTbb
->fsStyle
= btnPtr
->fsStyle
;
871 lpTbb
->dwData
= btnPtr
->dwData
;
872 lpTbb
->iString
= btnPtr
->iString
;
878 // << TOOLBAR_GetButtonInfo >>
882 TOOLBAR_GetButtonSize (WND
*wndPtr
)
884 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
886 return MAKELONG((WORD
)infoPtr
->nButtonWidth
,
887 (WORD
)infoPtr
->nButtonHeight
);
892 TOOLBAR_GetButtonText32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
894 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
895 INT32 nIndex
, nStringIndex
;
897 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
901 nStringIndex
= infoPtr
->buttons
[nIndex
].iString
;
903 TRACE (toolbar
, "index=%d stringIndex=%d\n", nIndex
, nStringIndex
);
905 if ((nStringIndex
< 0) || (nStringIndex
>= infoPtr
->nNumStrings
))
908 if (lParam
== 0) return -1;
910 lstrcpy32A ((LPSTR
)lParam
, (LPSTR
)infoPtr
->strings
[nStringIndex
]);
912 return lstrlen32A ((LPSTR
)infoPtr
->strings
[nStringIndex
]);
916 // << TOOLBAR_GetButtonText32W >>
917 // << TOOLBAR_GetColorScheme >>
921 TOOLBAR_GetDisabledImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
923 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
925 if (wndPtr
->dwStyle
& TBSTYLE_FLAT
)
926 return (LRESULT
)infoPtr
->himlDis
;
932 // << TOOLBAR_GetExtendedStyle >>
936 TOOLBAR_GetHotImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
938 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
940 if (wndPtr
->dwStyle
& TBSTYLE_FLAT
)
941 return (LRESULT
)infoPtr
->himlHot
;
947 // << TOOLBAR_GetHotItem >>
951 TOOLBAR_GetImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
953 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
955 if (wndPtr
->dwStyle
& TBSTYLE_FLAT
)
956 return (LRESULT
)infoPtr
->himlDef
;
962 // << TOOLBAR_GetInsertMark >>
963 // << TOOLBAR_GetInsertMarkColor >>
967 TOOLBAR_GetItemRect (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
969 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
970 TBUTTON_INFO
*btnPtr
;
974 if (infoPtr
== NULL
) return FALSE
;
975 nIndex
= (INT32
)wParam
;
976 btnPtr
= &infoPtr
->buttons
[nIndex
];
977 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
979 lpRect
= (LPRECT32
)lParam
;
980 if (lpRect
== NULL
) return FALSE
;
981 if (btnPtr
->fsState
& TBSTATE_HIDDEN
) return FALSE
;
983 lpRect
->left
= btnPtr
->rect
.left
;
984 lpRect
->right
= btnPtr
->rect
.right
;
985 lpRect
->bottom
= btnPtr
->rect
.bottom
;
986 lpRect
->top
= btnPtr
->rect
.top
;
993 TOOLBAR_GetMaxSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
995 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
996 LPSIZE32 lpSize
= (LPSIZE32
)lParam
;
1004 // << TOOLBAR_GetObject >>
1005 // << TOOLBAR_GetPadding >>
1006 // << TOOLBAR_GetRect >>
1010 TOOLBAR_GetRows (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1012 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1014 if (wndPtr
->dwStyle
& TBSTYLE_WRAPABLE
)
1015 return infoPtr
->nMaxRows
;
1022 TOOLBAR_GetState (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1024 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1027 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1028 if (nIndex
== -1) return -1;
1030 return infoPtr
->buttons
[nIndex
].fsState
;
1035 TOOLBAR_GetStyle (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1037 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1040 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1041 if (nIndex
== -1) return -1;
1043 return infoPtr
->buttons
[nIndex
].fsStyle
;
1047 // << TOOLBAR_GetTextRows >>
1051 TOOLBAR_GetToolTips (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1053 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1055 if (infoPtr
== NULL
) return 0;
1056 return infoPtr
->hwndToolTip
;
1060 // << TOOLBAR_GetUnicodeFormat >>
1064 TOOLBAR_HideButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1066 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1067 TBUTTON_INFO
*btnPtr
;
1070 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1074 btnPtr
= &infoPtr
->buttons
[nIndex
];
1075 if (LOWORD(lParam
) == FALSE
)
1076 btnPtr
->fsState
&= ~TBSTATE_HIDDEN
;
1078 btnPtr
->fsState
|= TBSTATE_HIDDEN
;
1080 TOOLBAR_CalcToolbar (wndPtr
);
1082 InvalidateRect32 (wndPtr
->hwndSelf
, NULL
, TRUE
);
1083 UpdateWindow32 (wndPtr
->hwndSelf
);
1090 TOOLBAR_HitTest (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1092 return TOOLBAR_InternalHitTest (wndPtr
, (LPPOINT32
)lParam
);
1097 TOOLBAR_Indeterminate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1099 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1100 TBUTTON_INFO
*btnPtr
;
1104 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1108 btnPtr
= &infoPtr
->buttons
[nIndex
];
1109 if (LOWORD(lParam
) == FALSE
)
1110 btnPtr
->fsState
&= ~TBSTATE_INDETERMINATE
;
1112 btnPtr
->fsState
|= TBSTATE_INDETERMINATE
;
1114 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1115 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1116 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1123 TOOLBAR_InsertButton32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1125 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1126 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
1127 INT32 nIndex
= (INT32
)wParam
;
1128 TBUTTON_INFO
*oldButtons
;
1131 if (lpTbb
== NULL
) return FALSE
;
1132 if (nIndex
< 0) return FALSE
;
1134 TRACE (toolbar
, "inserting button index=%d\n", nIndex
);
1135 if (nIndex
> infoPtr
->nNumButtons
) {
1136 nIndex
= infoPtr
->nNumButtons
;
1137 TRACE (toolbar
, "adjust index=%d\n", nIndex
);
1140 oldButtons
= infoPtr
->buttons
;
1141 infoPtr
->nNumButtons
++;
1142 infoPtr
->buttons
= HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
1143 sizeof (TBUTTON_INFO
) * infoPtr
->nNumButtons
);
1144 /* pre insert copy */
1146 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
1147 nIndex
* sizeof(TBUTTON_INFO
));
1150 /* insert new button */
1151 infoPtr
->buttons
[nIndex
].iBitmap
= lpTbb
->iBitmap
;
1152 infoPtr
->buttons
[nIndex
].idCommand
= lpTbb
->idCommand
;
1153 infoPtr
->buttons
[nIndex
].fsState
= lpTbb
->fsState
;
1154 infoPtr
->buttons
[nIndex
].fsStyle
= lpTbb
->fsStyle
;
1155 infoPtr
->buttons
[nIndex
].dwData
= lpTbb
->dwData
;
1156 infoPtr
->buttons
[nIndex
].iString
= lpTbb
->iString
;
1158 /* post insert copy */
1159 if (nIndex
< infoPtr
->nNumButtons
- 1) {
1160 memcpy (&infoPtr
->buttons
[nIndex
+1], &oldButtons
[nIndex
],
1161 (infoPtr
->nNumButtons
- nIndex
- 1) * sizeof(TBUTTON_INFO
));
1164 HeapFree (GetProcessHeap (), 0, oldButtons
);
1166 TOOLBAR_CalcToolbar (wndPtr
);
1168 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1169 TOOLBAR_Refresh (wndPtr
, hdc
);
1170 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1176 // << TOOLBAR_InsertButton32W >>
1177 // << TOOLBAR_InsertMarkHitTest >>
1181 TOOLBAR_IsButtonChecked (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1183 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1186 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1190 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_CHECKED
);
1195 TOOLBAR_IsButtonEnabled (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1197 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1200 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1204 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_ENABLED
);
1209 TOOLBAR_IsButtonHidden (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1211 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1214 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1218 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_HIDDEN
);
1223 TOOLBAR_IsButtonHighlighted (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1225 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1228 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1232 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_MARKED
);
1237 TOOLBAR_IsButtonIndeterminate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1239 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1242 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1246 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_INDETERMINATE
);
1251 TOOLBAR_IsButtonPressed (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1253 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1256 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1260 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_PRESSED
);
1264 // << TOOLBAR_LoadImages >>
1265 // << TOOLBAR_MapAccelerator >>
1266 // << TOOLBAR_MarkButton >>
1267 // << TOOLBAR_MoveButton >>
1271 TOOLBAR_PressButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1273 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1274 TBUTTON_INFO
*btnPtr
;
1278 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1282 btnPtr
= &infoPtr
->buttons
[nIndex
];
1283 if (LOWORD(lParam
) == FALSE
)
1284 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
1286 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1288 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1289 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1290 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1296 // << TOOLBAR_ReplaceBitmap >>
1300 TOOLBAR_SaveRestore32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1302 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1303 LPTBSAVEPARAMS32A lpSave
= (LPTBSAVEPARAMS32A
)lParam
;
1305 if (lpSave
== NULL
) return 0;
1307 if ((BOOL32
)wParam
) {
1308 /* save toolbar information */
1309 FIXME (toolbar
, "save to \"%s\" \"%s\"\n",
1310 lpSave
->pszSubKey
, lpSave
->pszValueName
);
1315 /* restore toolbar information */
1317 FIXME (toolbar
, "restore from \"%s\" \"%s\"\n",
1318 lpSave
->pszSubKey
, lpSave
->pszValueName
);
1327 // << TOOLBAR_SaveRestore32W >>
1328 // << TOOLBAR_SetAnchorHighlight >>
1332 TOOLBAR_SetBitmapSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1334 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1336 if ((LOWORD(lParam
) <= 0) || (HIWORD(lParam
)<=0))
1339 infoPtr
->nBitmapWidth
= (INT32
)LOWORD(lParam
);
1340 infoPtr
->nBitmapHeight
= (INT32
)HIWORD(lParam
);
1346 // << TOOLBAR_SetButtonInfo >>
1350 TOOLBAR_SetButtonSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1352 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1354 if ((LOWORD(lParam
) <= 0) || (HIWORD(lParam
)<=0))
1357 infoPtr
->nButtonWidth
= (INT32
)LOWORD(lParam
);
1358 infoPtr
->nButtonHeight
= (INT32
)HIWORD(lParam
);
1364 // << TOOLBAR_SetButtonWidth >>
1368 TOOLBAR_SetCmdId (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1370 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1371 INT32 nIndex
= (INT32
)wParam
;
1373 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
1376 infoPtr
->buttons
[nIndex
].idCommand
= (INT32
)lParam
;
1382 // << TOOLBAR_SetColorScheme >>
1386 TOOLBAR_SetDisabledImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1388 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1389 HIMAGELIST himlTemp
;
1391 if (!(wndPtr
->dwStyle
& TBSTYLE_FLAT
))
1394 himlTemp
= infoPtr
->himlDis
;
1395 infoPtr
->himlDis
= (HIMAGELIST
)lParam
;
1397 /* FIXME: redraw ? */
1399 return (LRESULT
)himlTemp
;
1403 // << TOOLBAR_SetDrawTextFlags >>
1407 TOOLBAR_SetExtendedStyle (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1409 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1412 dwTemp
= infoPtr
->dwExStyle
;
1413 infoPtr
->dwExStyle
= (DWORD
)lParam
;
1415 return (LRESULT
)dwTemp
;
1420 TOOLBAR_SetHotImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1422 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1423 HIMAGELIST himlTemp
;
1425 if (!(wndPtr
->dwStyle
& TBSTYLE_FLAT
))
1428 himlTemp
= infoPtr
->himlHot
;
1429 infoPtr
->himlHot
= (HIMAGELIST
)lParam
;
1431 /* FIXME: redraw ? */
1433 return (LRESULT
)himlTemp
;
1437 // << TOOLBAR_SetHotItem >>
1441 TOOLBAR_SetImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1443 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1444 HIMAGELIST himlTemp
;
1446 if (!(wndPtr
->dwStyle
& TBSTYLE_FLAT
))
1449 himlTemp
= infoPtr
->himlDef
;
1450 infoPtr
->himlDef
= (HIMAGELIST
)lParam
;
1452 /* FIXME: redraw ? */
1454 return (LRESULT
)himlTemp
;
1459 TOOLBAR_SetIndent (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1461 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1464 infoPtr
->nIndent
= (INT32
)wParam
;
1465 TOOLBAR_CalcToolbar (wndPtr
);
1466 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1467 TOOLBAR_Refresh (wndPtr
, hdc
);
1468 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1474 // << TOOLBAR_SetInsertMark >>
1478 TOOLBAR_SetInsertMarkColor (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1480 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1482 infoPtr
->clrInsertMark
= (COLORREF
)lParam
;
1484 /* FIXME : redraw ??*/
1490 // << TOOLBAR_SetMaxTextRows >>
1491 // << TOOLBAR_SetPadding >>
1495 TOOLBAR_SetParent (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1497 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1498 HWND32 hwndOldNotify
;
1500 if (infoPtr
== NULL
) return 0;
1501 hwndOldNotify
= infoPtr
->hwndNotify
;
1502 infoPtr
->hwndNotify
= (HWND32
)wParam
;
1504 return hwndOldNotify
;
1509 TOOLBAR_SetRows (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1511 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1513 FIXME (toolbar
, "support multiple rows!\n");
1520 TOOLBAR_SetState (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1522 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1523 TBUTTON_INFO
*btnPtr
;
1527 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1531 btnPtr
= &infoPtr
->buttons
[nIndex
];
1532 btnPtr
->fsState
= LOWORD(lParam
);
1534 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1535 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1536 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1543 TOOLBAR_SetStyle (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1545 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1546 TBUTTON_INFO
*btnPtr
;
1550 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1554 btnPtr
= &infoPtr
->buttons
[nIndex
];
1555 btnPtr
->fsStyle
= LOWORD(lParam
);
1557 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1558 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1559 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1566 TOOLBAR_SetToolTips (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1568 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1570 if (infoPtr
== NULL
) return 0;
1571 infoPtr
->hwndToolTip
= (HWND32
)wParam
;
1577 TOOLBAR_SetUnicodeFormat (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1579 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1581 FIXME (toolbar
, "hwnd=0x%04x stub!\n", wndPtr
->hwndSelf
);
1588 TOOLBAR_Create (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1590 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1593 /* initialize info structure */
1594 infoPtr
->nButtonHeight
= 22;
1595 infoPtr
->nButtonWidth
= 23;
1596 infoPtr
->nBitmapHeight
= 15;
1597 infoPtr
->nBitmapWidth
= 16;
1599 infoPtr
->nHeight
= infoPtr
->nButtonHeight
+ TOP_BORDER
+ BOTTOM_BORDER
;
1600 infoPtr
->nMaxRows
= 1;
1602 infoPtr
->bCaptured
= 0;
1603 infoPtr
->nButtonDown
= -1;
1604 infoPtr
->nOldHit
= -1;
1606 infoPtr
->hwndNotify
= GetParent32 (wndPtr
->hwndSelf
);
1607 infoPtr
->bTransparent
= (wndPtr
->dwStyle
& TBSTYLE_FLAT
);
1608 infoPtr
->nHotItem
= -1;
1610 SystemParametersInfo32A (SPI_GETICONTITLELOGFONT
, 0, &logFont
, 0);
1611 infoPtr
->hFont
= CreateFontIndirect32A (&logFont
);
1613 if (wndPtr
->dwStyle
& TBSTYLE_TOOLTIPS
) {
1614 /* Create tooltip control */
1615 // infoPtr->hwndToolTip = CreateWindowEx32A (....);
1617 /* Send NM_TOOLTIPSCREATED notification */
1626 TOOLBAR_Destroy (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1628 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1630 /* delete tooltip control */
1631 if (infoPtr
->hwndToolTip
)
1632 DestroyWindow32 (infoPtr
->hwndToolTip
);
1634 /* delete button data */
1635 if (infoPtr
->buttons
)
1636 HeapFree (GetProcessHeap (), 0, infoPtr
->buttons
);
1638 /* delete strings */
1639 if (infoPtr
->strings
) {
1641 for (i
= 0; i
< infoPtr
->nNumStrings
; i
++)
1642 if (infoPtr
->strings
[i
])
1643 HeapFree (GetProcessHeap (), 0, infoPtr
->strings
[i
]);
1645 HeapFree (GetProcessHeap (), 0, infoPtr
->strings
);
1648 /* destroy default image list */
1649 if (infoPtr
->himlDef
)
1650 ImageList_Destroy (infoPtr
->himlDef
);
1652 /* destroy disabled image list */
1653 if (infoPtr
->himlDis
)
1654 ImageList_Destroy (infoPtr
->himlDis
);
1656 /* destroy hot image list */
1657 if (infoPtr
->himlHot
)
1658 ImageList_Destroy (infoPtr
->himlHot
);
1660 /* delete default font */
1662 DeleteObject32 (infoPtr
->hFont
);
1664 /* free toolbar info data */
1665 HeapFree (GetProcessHeap (), 0, infoPtr
);
1672 TOOLBAR_EraseBackground (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1674 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1676 if (infoPtr
->bTransparent
)
1677 return SendMessage32A (GetParent32 (wndPtr
->hwndSelf
), WM_ERASEBKGND
,
1680 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_ERASEBKGND
, wParam
, lParam
);
1685 TOOLBAR_LButtonDblClk (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1687 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1688 TBUTTON_INFO
*btnPtr
;
1693 pt
.x
= (INT32
)LOWORD(lParam
);
1694 pt
.y
= (INT32
)HIWORD(lParam
);
1695 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
1698 btnPtr
= &infoPtr
->buttons
[nHit
];
1699 if (!(btnPtr
->fsState
& TBSTATE_ENABLED
))
1701 SetCapture32 (wndPtr
->hwndSelf
);
1702 infoPtr
->bCaptured
= TRUE
;
1703 infoPtr
->nButtonDown
= nHit
;
1705 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1707 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1708 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1709 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1711 else if (wndPtr
->dwStyle
& CCS_ADJUSTABLE
)
1712 TOOLBAR_Customize (wndPtr
);
1719 TOOLBAR_LButtonDown (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1721 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1722 TBUTTON_INFO
*btnPtr
;
1727 pt
.x
= (INT32
)LOWORD(lParam
);
1728 pt
.y
= (INT32
)HIWORD(lParam
);
1729 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
1732 btnPtr
= &infoPtr
->buttons
[nHit
];
1733 if (!(btnPtr
->fsState
& TBSTATE_ENABLED
))
1736 SetCapture32 (wndPtr
->hwndSelf
);
1737 infoPtr
->bCaptured
= TRUE
;
1738 infoPtr
->nButtonDown
= nHit
;
1739 infoPtr
->nOldHit
= nHit
;
1741 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1743 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1744 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1745 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1754 TOOLBAR_LButtonUp (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1756 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1757 TBUTTON_INFO
*btnPtr
;
1760 INT32 nOldIndex
= -1;
1762 BOOL32 bSendMessage
= TRUE
;
1764 pt
.x
= (INT32
)LOWORD(lParam
);
1765 pt
.y
= (INT32
)HIWORD(lParam
);
1766 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
1768 if ((infoPtr
->bCaptured
) && (infoPtr
->nButtonDown
>= 0)) {
1769 infoPtr
->bCaptured
= FALSE
;
1771 btnPtr
= &infoPtr
->buttons
[infoPtr
->nButtonDown
];
1772 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
1774 if (nHit
== infoPtr
->nButtonDown
) {
1775 if (btnPtr
->fsStyle
& TBSTYLE_CHECK
) {
1776 if (btnPtr
->fsStyle
& TBSTYLE_GROUP
) {
1777 nOldIndex
= TOOLBAR_GetCheckedGroupButtonIndex (infoPtr
,
1778 infoPtr
->nButtonDown
);
1779 if (nOldIndex
== infoPtr
->nButtonDown
)
1780 bSendMessage
= FALSE
;
1781 if ((nOldIndex
!= infoPtr
->nButtonDown
) &&
1783 infoPtr
->buttons
[nOldIndex
].fsState
&= ~TBSTATE_CHECKED
;
1784 btnPtr
->fsState
|= TBSTATE_CHECKED
;
1787 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
1788 btnPtr
->fsState
&= ~TBSTATE_CHECKED
;
1790 btnPtr
->fsState
|= TBSTATE_CHECKED
;
1795 bSendMessage
= FALSE
;
1797 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1798 if (nOldIndex
!= -1)
1799 TOOLBAR_DrawButton (wndPtr
, &infoPtr
->buttons
[nOldIndex
], hdc
);
1800 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1801 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1804 SendMessage32A (infoPtr
->hwndNotify
, WM_COMMAND
,
1805 MAKEWPARAM(btnPtr
->idCommand
, 0),
1806 (LPARAM
)wndPtr
->hwndSelf
);
1808 infoPtr
->nButtonDown
= -1;
1809 infoPtr
->nOldHit
= -1;
1817 TOOLBAR_MouseMove (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1819 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1820 TBUTTON_INFO
*btnPtr
;
1825 pt
.x
= (INT32
)LOWORD(lParam
);
1826 pt
.y
= (INT32
)HIWORD(lParam
);
1827 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
1829 if (infoPtr
->bCaptured
) {
1830 if (infoPtr
->nOldHit
!= nHit
) {
1831 btnPtr
= &infoPtr
->buttons
[infoPtr
->nButtonDown
];
1832 if (infoPtr
->nOldHit
== infoPtr
->nButtonDown
) {
1833 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
1834 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1835 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1836 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1838 else if (nHit
== infoPtr
->nButtonDown
) {
1839 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1840 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1841 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1842 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1845 infoPtr
->nOldHit
= nHit
;
1856 TOOLBAR_NCCalcSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1858 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
)) {
1859 LPRECT32 winRect
= (LPRECT32
)lParam
;
1861 winRect
->bottom
+= 2;
1864 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_NCCALCSIZE
, wParam
, lParam
);
1869 TOOLBAR_NCCreate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1871 TOOLBAR_INFO
*infoPtr
;
1873 /* allocate memory for info structure */
1874 infoPtr
= (TOOLBAR_INFO
*)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
1875 sizeof(TOOLBAR_INFO
));
1876 wndPtr
->wExtra
[0] = (DWORD
)infoPtr
;
1878 if (infoPtr
== NULL
) {
1879 ERR (toolbar
, "could not allocate info memory!\n");
1883 if ((TOOLBAR_INFO
*)wndPtr
->wExtra
[0] != infoPtr
) {
1884 ERR (toolbar
, "pointer assignment error!\n");
1888 /* this is just for security (reliable??)*/
1889 infoPtr
->dwStructSize
= sizeof(TBBUTTON
);
1891 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_NCCREATE
, wParam
, lParam
);
1896 TOOLBAR_NCPaint (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1900 HWND32 hwnd
= wndPtr
->hwndSelf
;
1902 if ( wndPtr
->dwStyle
& WS_MINIMIZE
||
1903 !WIN_IsWindowDrawable( wndPtr
, 0 )) return 0; /* Nothing to do */
1905 DefWindowProc32A (hwnd
, WM_NCPAINT
, wParam
, lParam
);
1907 if (!(hdc
= GetDCEx32( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
))) return 0;
1909 if (ExcludeVisRect( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
1910 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
1911 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
1912 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
1915 ReleaseDC32( hwnd
, hdc
);
1919 if (!(wndPtr
->flags
& WIN_MANAGED
)) {
1920 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
)) {
1921 rect
.left
= wndPtr
->rectClient
.left
;
1922 rect
.top
= wndPtr
->rectClient
.top
- 2;
1923 rect
.right
= wndPtr
->rectClient
.right
;
1925 SelectObject32 ( hdc
, GetSysColorPen32 (COLOR_3DSHADOW
));
1926 MoveToEx32 (hdc
, rect
.left
, rect
.top
, NULL
);
1927 LineTo32 (hdc
, rect
.right
, rect
.top
);
1929 SelectObject32 ( hdc
, GetSysColorPen32 (COLOR_3DHILIGHT
));
1930 MoveToEx32 (hdc
, rect
.left
, rect
.top
, NULL
);
1931 LineTo32 (hdc
, rect
.right
, rect
.top
);
1936 ReleaseDC32( hwnd
, hdc
);
1943 TOOLBAR_Paint (WND
*wndPtr
, WPARAM32 wParam
)
1948 hdc
= wParam
==0 ? BeginPaint32 (wndPtr
->hwndSelf
, &ps
) : (HDC32
)wParam
;
1949 TOOLBAR_Refresh (wndPtr
, hdc
);
1951 EndPaint32 (wndPtr
->hwndSelf
, &ps
);
1957 TOOLBAR_Size (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1959 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1964 UINT32 uPosFlags
= 0;
1966 /* Resize deadlock check */
1967 if (infoPtr
->bAutoSize
) {
1968 infoPtr
->bAutoSize
= FALSE
;
1972 flags
= (INT32
) wParam
;
1974 /* FIXME for flags =
1975 * SIZE_MAXIMIZED, SIZE_MAXSHOW, SIZE_MINIMIZED
1978 TRACE (toolbar
, "sizing toolbar!\n");
1980 if (flags
== SIZE_RESTORED
) {
1981 /* width and height don't apply */
1982 parent
= GetParent32 (wndPtr
->hwndSelf
);
1983 GetClientRect32(parent
, &parent_rect
);
1985 if (wndPtr
->dwStyle
& CCS_NORESIZE
) {
1986 uPosFlags
|= SWP_NOSIZE
;
1989 // infoPtr->nWidth = parent_rect.right - parent_rect.left;
1990 cy
= infoPtr
->nHeight
;
1991 cx
= infoPtr
->nWidth
;
1992 TOOLBAR_CalcToolbar (wndPtr
);
1993 infoPtr
->nWidth
= cx
;
1994 infoPtr
->nHeight
= cy
;
1997 infoPtr
->nWidth
= parent_rect
.right
- parent_rect
.left
;
1998 TOOLBAR_CalcToolbar (wndPtr
);
1999 cy
= infoPtr
->nHeight
;
2000 cx
= infoPtr
->nWidth
;
2003 if (wndPtr
->dwStyle
& CCS_NOPARENTALIGN
) {
2004 uPosFlags
|= SWP_NOMOVE
;
2005 cy
= infoPtr
->nHeight
;
2006 cx
= infoPtr
->nWidth
;
2009 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
))
2012 SetWindowPos32 (wndPtr
->hwndSelf
, 0, parent_rect
.left
, parent_rect
.top
,
2013 cx
, cy
, uPosFlags
| SWP_NOZORDER
);
2025 ToolbarWindowProc (HWND32 hwnd
, UINT32 uMsg
, WPARAM32 wParam
, LPARAM lParam
)
2027 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
2032 return TOOLBAR_AddBitmap (wndPtr
, wParam
, lParam
);
2034 case TB_ADDBUTTONS32A
:
2035 return TOOLBAR_AddButtons32A (wndPtr
, wParam
, lParam
);
2037 // case TB_ADDBUTTONS32W:
2039 case TB_ADDSTRING32A
:
2040 return TOOLBAR_AddString32A (wndPtr
, wParam
, lParam
);
2042 // case TB_ADDSTRING32W:
2045 return TOOLBAR_AutoSize (wndPtr
, wParam
, lParam
);
2047 case TB_BUTTONCOUNT
:
2048 return TOOLBAR_ButtonCount (wndPtr
, wParam
, lParam
);
2050 case TB_BUTTONSTRUCTSIZE
:
2051 return TOOLBAR_ButtonStructSize (wndPtr
, wParam
, lParam
);
2053 case TB_CHANGEBITMAP
:
2054 return TOOLBAR_ChangeBitmap (wndPtr
, wParam
, lParam
);
2056 case TB_CHECKBUTTON
:
2057 return TOOLBAR_CheckButton (wndPtr
, wParam
, lParam
);
2059 case TB_COMMANDTOINDEX
:
2060 return TOOLBAR_CommandToIndex (wndPtr
, wParam
, lParam
);
2063 return TOOLBAR_Customize (wndPtr
);
2065 case TB_DELETEBUTTON
:
2066 return TOOLBAR_DeleteButton (wndPtr
, wParam
, lParam
);
2068 case TB_ENABLEBUTTON
:
2069 return TOOLBAR_EnableButton (wndPtr
, wParam
, lParam
);
2071 // case TB_GETANCHORHIGHLIGHT: /* 4.71 */
2074 return TOOLBAR_GetBitmap (wndPtr
, wParam
, lParam
);
2076 case TB_GETBITMAPFLAGS
:
2077 return TOOLBAR_GetBitmapFlags (wndPtr
, wParam
, lParam
);
2080 return TOOLBAR_GetButton (wndPtr
, wParam
, lParam
);
2082 // case TB_GETBUTTONINFO: /* 4.71 */
2084 case TB_GETBUTTONSIZE
:
2085 return TOOLBAR_GetButtonSize (wndPtr
);
2087 case TB_GETBUTTONTEXT32A
:
2088 return TOOLBAR_GetButtonText32A (wndPtr
, wParam
, lParam
);
2090 // case TB_GETBUTTONTEXT32W:
2091 // case TB_GETCOLORSCHEME: /* 4.71 */
2093 case TB_GETDISABLEDIMAGELIST
:
2094 return TOOLBAR_GetDisabledImageList (wndPtr
, wParam
, lParam
);
2096 // case TB_GETEXTENDEDSTYLE: /* 4.71 */
2098 case TB_GETHOTIMAGELIST
:
2099 return TOOLBAR_GetHotImageList (wndPtr
, wParam
, lParam
);
2101 // case TB_GETHOTITEM: /* 4.71 */
2103 case TB_GETIMAGELIST
:
2104 return TOOLBAR_GetImageList (wndPtr
, wParam
, lParam
);
2106 // case TB_GETINSERTMARK: /* 4.71 */
2107 // case TB_GETINSERTMARKCOLOR: /* 4.71 */
2109 case TB_GETITEMRECT
:
2110 return TOOLBAR_GetItemRect (wndPtr
, wParam
, lParam
);
2113 return TOOLBAR_GetMaxSize (wndPtr
, wParam
, lParam
);
2115 // case TB_GETOBJECT: /* 4.71 */
2116 // case TB_GETPADDING: /* 4.71 */
2117 // case TB_GETRECT: /* 4.70 */
2120 return TOOLBAR_GetRows (wndPtr
, wParam
, lParam
);
2123 return TOOLBAR_GetState (wndPtr
, wParam
, lParam
);
2126 return TOOLBAR_GetStyle (wndPtr
, wParam
, lParam
);
2128 // case TB_GETTEXTROWS: /* 4.70 */
2130 case TB_GETTOOLTIPS
:
2131 return TOOLBAR_GetToolTips (wndPtr
, wParam
, lParam
);
2133 // case TB_GETUNICODEFORMAT:
2136 return TOOLBAR_HideButton (wndPtr
, wParam
, lParam
);
2139 return TOOLBAR_HitTest (wndPtr
, wParam
, lParam
);
2141 case TB_INDETERMINATE
:
2142 return TOOLBAR_Indeterminate (wndPtr
, wParam
, lParam
);
2144 case TB_INSERTBUTTON32A
:
2145 return TOOLBAR_InsertButton32A (wndPtr
, wParam
, lParam
);
2147 // case TB_INSERTBUTTON32W:
2148 // case TB_INSERTMARKHITTEST: /* 4.71 */
2150 case TB_ISBUTTONCHECKED
:
2151 return TOOLBAR_IsButtonChecked (wndPtr
, wParam
, lParam
);
2153 case TB_ISBUTTONENABLED
:
2154 return TOOLBAR_IsButtonEnabled (wndPtr
, wParam
, lParam
);
2156 case TB_ISBUTTONHIDDEN
:
2157 return TOOLBAR_IsButtonHidden (wndPtr
, wParam
, lParam
);
2159 case TB_ISBUTTONHIGHLIGHTED
:
2160 return TOOLBAR_IsButtonHighlighted (wndPtr
, wParam
, lParam
);
2162 case TB_ISBUTTONINDETERMINATE
:
2163 return TOOLBAR_IsButtonIndeterminate (wndPtr
, wParam
, lParam
);
2165 case TB_ISBUTTONPRESSED
:
2166 return TOOLBAR_IsButtonPressed (wndPtr
, wParam
, lParam
);
2168 // case TB_LOADIMAGES: /* 4.70 */
2169 // case TB_MAPACCELERATOR32A: /* 4.71 */
2170 // case TB_MAPACCELERATOR32W: /* 4.71 */
2171 // case TB_MARKBUTTON: /* 4.71 */
2172 // case TB_MOVEBUTTON: /* 4.71 */
2174 case TB_PRESSBUTTON
:
2175 return TOOLBAR_PressButton (wndPtr
, wParam
, lParam
);
2177 // case TB_REPLACEBITMAP:
2179 case TB_SAVERESTORE32A
:
2180 return TOOLBAR_SaveRestore32A (wndPtr
, wParam
, lParam
);
2182 // case TB_SAVERESTORE32W:
2183 // case TB_SETANCHORHIGHLIGHT: /* 4.71 */
2185 case TB_SETBITMAPSIZE
:
2186 return TOOLBAR_SetBitmapSize (wndPtr
, wParam
, lParam
);
2188 // case TB_SETBUTTONINFO: /* 4.71 */
2190 case TB_SETBUTTONSIZE
:
2191 return TOOLBAR_SetButtonSize (wndPtr
, wParam
, lParam
);
2193 // case TB_SETBUTTONWIDTH: /* 4.70 */
2196 return TOOLBAR_SetCmdId (wndPtr
, wParam
, lParam
);
2198 // case TB_SETCOLORSCHEME: /* 4.71 */
2200 case TB_SETDISABLEDIMAGELIST
:
2201 return TOOLBAR_SetDisabledImageList (wndPtr
, wParam
, lParam
);
2203 // case TB_SETDRAWTEXTFLAGS: /* 4.71 */
2205 case TB_SETEXTENDEDSTYLE
:
2206 return TOOLBAR_SetExtendedStyle (wndPtr
, wParam
, lParam
);
2208 case TB_SETHOTIMAGELIST
:
2209 return TOOLBAR_SetHotImageList (wndPtr
, wParam
, lParam
);
2211 // case TB_SETHOTITEM: /* 4.71 */
2213 case TB_SETIMAGELIST
:
2214 return TOOLBAR_SetImageList (wndPtr
, wParam
, lParam
);
2217 return TOOLBAR_SetIndent (wndPtr
, wParam
, lParam
);
2219 // case TB_SETINSERTMARK: /* 4.71 */
2221 case TB_SETINSERTMARKCOLOR
:
2222 return TOOLBAR_SetInsertMarkColor (wndPtr
, wParam
, lParam
);
2224 // case TB_SETMAXTEXTROWS: /* 4.70 */
2225 // case TB_SETPADDING: /* 4.71 */
2228 return TOOLBAR_SetParent (wndPtr
, wParam
, lParam
);
2231 return TOOLBAR_SetRows (wndPtr
, wParam
, lParam
);
2234 return TOOLBAR_SetState (wndPtr
, wParam
, lParam
);
2237 return TOOLBAR_SetStyle (wndPtr
, wParam
, lParam
);
2239 case TB_SETTOOLTIPS
:
2240 return TOOLBAR_SetToolTips (wndPtr
, wParam
, lParam
);
2242 case TB_SETUNICODEFORMAT
:
2243 return TOOLBAR_SetUnicodeFormat (wndPtr
, wParam
, lParam
);
2247 return TOOLBAR_Create (wndPtr
, wParam
, lParam
);
2250 return TOOLBAR_Destroy (wndPtr
, wParam
, lParam
);
2253 return TOOLBAR_EraseBackground (wndPtr
, wParam
, lParam
);
2255 case WM_LBUTTONDBLCLK
:
2256 return TOOLBAR_LButtonDblClk (wndPtr
, wParam
, lParam
);
2258 case WM_LBUTTONDOWN
:
2259 return TOOLBAR_LButtonDown (wndPtr
, wParam
, lParam
);
2262 return TOOLBAR_LButtonUp (wndPtr
, wParam
, lParam
);
2265 return TOOLBAR_MouseMove (wndPtr
, wParam
, lParam
);
2267 // case WM_NCACTIVATE:
2268 // return TOOLBAR_NCActivate (wndPtr, wParam, lParam);
2271 return TOOLBAR_NCCalcSize (wndPtr
, wParam
, lParam
);
2274 return TOOLBAR_NCCreate (wndPtr
, wParam
, lParam
);
2277 return TOOLBAR_NCPaint (wndPtr
, wParam
, lParam
);
2280 // SendMessage32A (GetParent32 (hwnd), uMsg, wParam, lParam);
2283 return TOOLBAR_Paint (wndPtr
, wParam
);
2286 return TOOLBAR_Size (wndPtr
, wParam
, lParam
);
2288 // case WM_SYSCOLORCHANGE:
2290 // case WM_WININICHANGE:
2295 case WM_MEASUREITEM
:
2297 return SendMessage32A (GetParent32 (hwnd
), uMsg
, wParam
, lParam
);
2300 if (uMsg
>= WM_USER
)
2301 ERR (toolbar
, "unknown msg %04x wp=%08x lp=%08lx\n",
2302 uMsg
, wParam
, lParam
);
2303 return DefWindowProc32A (hwnd
, uMsg
, wParam
, lParam
);
2310 TOOLBAR_Register (void)
2312 WNDCLASS32A wndClass
;
2314 if (GlobalFindAtom32A (TOOLBARCLASSNAME32A
)) return;
2316 ZeroMemory (&wndClass
, sizeof(WNDCLASS32A
));
2317 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
2318 wndClass
.lpfnWndProc
= (WNDPROC32
)ToolbarWindowProc
;
2319 wndClass
.cbClsExtra
= 0;
2320 wndClass
.cbWndExtra
= sizeof(TOOLBAR_INFO
*);
2321 wndClass
.hCursor
= LoadCursor32A (0, IDC_ARROW32A
);
2322 wndClass
.hbrBackground
= (HBRUSH32
)(COLOR_3DFACE
+ 1);
2323 wndClass
.lpszClassName
= TOOLBARCLASSNAME32A
;
2325 RegisterClass32A (&wndClass
);