4 * Copyright 1998 Eric Kohl
7 * - A little bug in TOOLBAR_DrawMasked()
8 * - Button wrapping (under construction).
12 * - Tooltip support (almost complete).
14 * - Internal COMMCTL32 bitmaps.
15 * - Fix TOOLBAR_SetButtonInfo32A.
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 * - Microsofts controlspy examples.
30 #include "sysmetrics.h"
36 // #define __NEW_WRAP_CODE__
38 #define SEPARATOR_WIDTH 8
39 #define SEPARATOR_HEIGHT 5
41 #define BOTTOM_BORDER 2
45 #define TOOLBAR_GetInfoPtr(wndPtr) ((TOOLBAR_INFO *)wndPtr->wExtra[0])
49 TOOLBAR_DrawFlatSeparator (LPRECT32 lpRect
, HDC32 hdc
)
51 INT32 x
= (lpRect
->left
+ lpRect
->right
) / 2 - 1;
52 INT32 yBottom
= lpRect
->bottom
- 3;
53 INT32 yTop
= lpRect
->top
+ 1;
55 SelectObject32 ( hdc
, GetSysColorPen32 (COLOR_3DSHADOW
));
56 MoveToEx32 (hdc
, x
, yBottom
, NULL
);
57 LineTo32 (hdc
, x
, yTop
);
59 SelectObject32 ( hdc
, GetSysColorPen32 (COLOR_3DHILIGHT
));
60 MoveToEx32 (hdc
, x
, yBottom
, NULL
);
61 LineTo32 (hdc
, x
, yTop
);
66 TOOLBAR_DrawString (TOOLBAR_INFO
*infoPtr
, TBUTTON_INFO
*btnPtr
,
67 HDC32 hdc
, INT32 nState
)
69 RECT32 rcText
= btnPtr
->rect
;
75 if ((btnPtr
->iString
> -1) && (btnPtr
->iString
< infoPtr
->nNumStrings
)) {
76 InflateRect32 (&rcText
, -3, -3);
77 rcText
.top
+= infoPtr
->nBitmapHeight
;
78 if (nState
& (TBSTATE_PRESSED
| TBSTATE_CHECKED
))
79 OffsetRect32 (&rcText
, 1, 1);
81 hOldFont
= SelectObject32 (hdc
, infoPtr
->hFont
);
82 nOldBkMode
= SetBkMode32 (hdc
, TRANSPARENT
);
83 if (!(nState
& TBSTATE_ENABLED
)) {
84 clrOld
= SetTextColor32 (hdc
, GetSysColor32 (COLOR_3DHILIGHT
));
85 OffsetRect32 (&rcText
, 1, 1);
86 DrawText32A (hdc
, infoPtr
->strings
[btnPtr
->iString
], -1,
87 &rcText
, infoPtr
->dwDTFlags
);
88 SetTextColor32 (hdc
, GetSysColor32 (COLOR_3DSHADOW
));
89 OffsetRect32 (&rcText
, -1, -1);
90 DrawText32A (hdc
, infoPtr
->strings
[btnPtr
->iString
], -1,
91 &rcText
, infoPtr
->dwDTFlags
);
93 else if (nState
& TBSTATE_INDETERMINATE
) {
94 clrOld
= SetTextColor32 (hdc
, GetSysColor32 (COLOR_3DSHADOW
));
95 DrawText32A (hdc
, infoPtr
->strings
[btnPtr
->iString
], -1,
96 &rcText
, infoPtr
->dwDTFlags
);
99 clrOld
= SetTextColor32 (hdc
, GetSysColor32 (COLOR_BTNTEXT
));
100 DrawText32A (hdc
, infoPtr
->strings
[btnPtr
->iString
], -1,
101 &rcText
, infoPtr
->dwDTFlags
);
104 SetTextColor32 (hdc
, clrOld
);
105 SelectObject32 (hdc
, hOldFont
);
106 if (nOldBkMode
!= TRANSPARENT
)
107 SetBkMode32 (hdc
, nOldBkMode
);
113 TOOLBAR_DrawPattern (HDC32 hdc
, LPRECT32 lpRect
)
115 HBRUSH32 hbr
= SelectObject32 (hdc
, CACHE_GetPattern55AABrush ());
116 INT32 cx
= lpRect
->right
- lpRect
->left
;
117 INT32 cy
= lpRect
->bottom
- lpRect
->top
;
118 PatBlt32 (hdc
, lpRect
->left
, lpRect
->top
, cx
, cy
, 0x00FA0089);
119 SelectObject32 (hdc
, hbr
);
124 TOOLBAR_DrawMasked (TOOLBAR_INFO
*infoPtr
, TBUTTON_INFO
*btnPtr
,
125 HDC32 hdc
, INT32 x
, INT32 y
)
127 /* FIXME: this function is a hack since it uses image list
128 internals directly */
130 HDC32 hdcImageList
= CreateCompatibleDC32 (0);
131 HDC32 hdcMask
= CreateCompatibleDC32 (0);
132 HIMAGELIST himl
= infoPtr
->himlDef
;
135 /* create new bitmap */
136 hbmMask
= CreateBitmap32 (himl
->cx
, himl
->cy
, 1, 1, NULL
);
137 SelectObject32 (hdcMask
, hbmMask
);
139 /* copy the mask bitmap */
140 SelectObject32 (hdcImageList
, himl
->hbmMask
);
141 SetBkColor32 (hdcImageList
, RGB(255, 255, 255));
142 SetTextColor32 (hdcImageList
, RGB(0, 0, 0));
143 BitBlt32 (hdcMask
, 0, 0, himl
->cx
, himl
->cy
,
144 hdcImageList
, himl
->cx
* btnPtr
->iBitmap
, 0, SRCCOPY
);
147 /* add white mask from image */
148 SelectObject32 (hdcImageList
, himl
->hbmImage
);
149 SetBkColor32 (hdcImageList
, RGB(0, 0, 0));
150 BitBlt32 (hdcMask
, 0, 0, himl
->cx
, himl
->cy
,
151 hdcImageList
, himl
->cx
* btnPtr
->iBitmap
, 0, MERGEPAINT
);
154 /* draw the new mask */
155 SelectObject32 (hdc
, GetSysColorBrush32 (COLOR_3DHILIGHT
));
156 BitBlt32 (hdc
, x
+1, y
+1, himl
->cx
, himl
->cy
,
157 hdcMask
, 0, 0, 0xB8074A);
159 SelectObject32 (hdc
, GetSysColorBrush32 (COLOR_3DSHADOW
));
160 BitBlt32 (hdc
, x
, y
, himl
->cx
, himl
->cy
,
161 hdcMask
, 0, 0, 0xB8074A);
163 DeleteObject32 (hbmMask
);
164 DeleteDC32 (hdcMask
);
165 DeleteDC32 (hdcImageList
);
170 TOOLBAR_DrawButton (WND
*wndPtr
, TBUTTON_INFO
*btnPtr
, HDC32 hdc
)
172 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
173 BOOL32 bFlat
= (wndPtr
->dwStyle
& TBSTYLE_FLAT
);
176 if (btnPtr
->fsState
& TBSTATE_HIDDEN
) return;
179 if (btnPtr
->fsStyle
& TBSTYLE_SEP
) {
180 if ((bFlat
) && (btnPtr
->idCommand
== 0))
181 TOOLBAR_DrawFlatSeparator (&btnPtr
->rect
, hdc
);
186 if (!(btnPtr
->fsState
& TBSTATE_ENABLED
)) {
187 DrawEdge32 (hdc
, &rc
, EDGE_RAISED
,
188 BF_SOFT
| BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
190 TOOLBAR_DrawMasked (infoPtr
, btnPtr
, hdc
, rc
.left
+1, rc
.top
+1);
192 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
196 /* pressed TBSTYLE_BUTTON */
197 if (btnPtr
->fsState
& TBSTATE_PRESSED
) {
198 DrawEdge32 (hdc
, &rc
, EDGE_SUNKEN
,
199 BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
200 ImageList_Draw (infoPtr
->himlDef
, btnPtr
->iBitmap
, hdc
,
201 rc
.left
+2, rc
.top
+2, ILD_NORMAL
);
202 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
206 /* checked TBSTYLE_CHECK*/
207 if ((btnPtr
->fsStyle
& TBSTYLE_CHECK
) &&
208 (btnPtr
->fsState
& TBSTATE_CHECKED
)) {
210 DrawEdge32 (hdc
, &rc
, BDR_SUNKENOUTER
,
211 BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
213 DrawEdge32 (hdc
, &rc
, EDGE_SUNKEN
,
214 BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
216 TOOLBAR_DrawPattern (hdc
, &rc
);
217 ImageList_Draw (infoPtr
->himlDef
, btnPtr
->iBitmap
, hdc
,
218 rc
.left
+2, rc
.top
+2, ILD_NORMAL
);
219 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
224 if (btnPtr
->fsState
& TBSTATE_INDETERMINATE
) {
225 DrawEdge32 (hdc
, &rc
, EDGE_RAISED
,
226 BF_SOFT
| BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
228 TOOLBAR_DrawPattern (hdc
, &rc
);
229 TOOLBAR_DrawMasked (infoPtr
, btnPtr
, hdc
, rc
.left
+1, rc
.top
+1);
230 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
235 DrawEdge32 (hdc
, &rc
, EDGE_RAISED
,
236 BF_SOFT
| BF_RECT
| BF_MIDDLE
| BF_ADJUST
);
237 ImageList_Draw (infoPtr
->himlDef
, btnPtr
->iBitmap
, hdc
,
238 rc
.left
+1, rc
.top
+1, ILD_NORMAL
);
239 TOOLBAR_DrawString (infoPtr
, btnPtr
, hdc
, btnPtr
->fsState
);
244 TOOLBAR_Refresh (WND
*wndPtr
, HDC32 hdc
)
246 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
247 TBUTTON_INFO
*btnPtr
;
251 btnPtr
= infoPtr
->buttons
;
252 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++)
253 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
258 TOOLBAR_CalcStrings (WND
*wndPtr
, LPSIZE32 lpSize
)
260 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
261 TBUTTON_INFO
*btnPtr
;
270 hOldFont
= SelectObject32 (hdc
, infoPtr
->hFont
);
272 btnPtr
= infoPtr
->buttons
;
273 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
274 if (!(btnPtr
->fsState
& TBSTATE_HIDDEN
) &&
275 (btnPtr
->iString
> -1) &&
276 (btnPtr
->iString
< infoPtr
->nNumStrings
)) {
277 LPSTR lpText
= infoPtr
->strings
[btnPtr
->iString
];
278 GetTextExtentPoint32A (hdc
, lpText
, lstrlen32A(lpText
), &sz
);
279 if (sz
.cx
> lpSize
->cx
)
281 if (sz
.cy
> lpSize
->cy
)
286 SelectObject32 (hdc
, hOldFont
);
287 ReleaseDC32 (0, hdc
);
289 TRACE (toolbar
, "string size %d x %d!\n", lpSize
->cx
, lpSize
->cy
);
294 TOOLBAR_CalcToolbar (WND
*wndPtr
)
296 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
297 TBUTTON_INFO
*btnPtr
, *grpPtr
;
305 /* --- end new --- */
307 TOOLBAR_CalcStrings (wndPtr
, &sizeString
);
309 if (sizeString
.cy
> 0)
310 infoPtr
->nButtonHeight
= sizeString
.cy
+ infoPtr
->nBitmapHeight
+ 6;
311 else if (infoPtr
->nButtonHeight
< infoPtr
->nBitmapHeight
+ 6)
312 infoPtr
->nButtonHeight
= infoPtr
->nBitmapHeight
+ 6;
314 if (sizeString
.cx
> infoPtr
->nBitmapWidth
)
315 infoPtr
->nButtonWidth
= sizeString
.cx
+ 6;
316 else if (infoPtr
->nButtonWidth
< infoPtr
->nBitmapWidth
+ 6)
317 infoPtr
->nButtonWidth
= infoPtr
->nBitmapWidth
+ 6;
319 x
= infoPtr
->nIndent
;
321 cx
= infoPtr
->nButtonWidth
;
322 cy
= infoPtr
->nButtonHeight
;
325 /* calculate the size of each button according to it's style */
326 // TOOLBAR_CalcButtons (wndPtr);
328 infoPtr
->rcBound
.top
= y
;
329 infoPtr
->rcBound
.left
= x
;
330 infoPtr
->rcBound
.bottom
= y
+ cy
;
331 infoPtr
->rcBound
.right
= x
;
333 btnPtr
= infoPtr
->buttons
;
334 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
337 if (btnPtr
->fsState
& TBSTATE_HIDDEN
) {
338 SetRectEmpty32 (&btnPtr
->rect
);
342 #ifdef __NEW_WRAP_CODE__
344 if (btnPtr
->fsStyle
& TBSTYLE_SEP
) {
345 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */
346 /* it is the actual width of the separator. This is used for */
347 /* custom controls in toolbars. */
348 if ((wndPtr
->dwStyle
& TBSTYLE_WRAPABLE
) &&
349 (btnPtr
->fsState
& TBSTATE_WRAP
)) {
352 cx
= infoPtr
->nWidth
;
353 cy
= ((btnPtr
->iBitmap
> 0) ?
354 btnPtr
->iBitmap
: SEPARATOR_WIDTH
) * 2 / 3;
359 cx
= (btnPtr
->iBitmap
> 0) ?
360 btnPtr
->iBitmap
: SEPARATOR_WIDTH
;
363 /* this must be a button */
364 cx
= infoPtr
->nButtonWidth
;
368 /* --- begin test --- */
369 if ((i
>= nGrpCount
) && (btnPtr
->fsStyle
& TBSTYLE_GROUP
)) {
370 for (j
= i
, grpX
= x
, nGrpCount
= 0; j
< infoPtr
->nNumButtons
; j
++) {
371 grpPtr
= &infoPtr
->buttons
[j
];
372 if (grpPtr
->fsState
& TBSTATE_HIDDEN
)
377 if ((grpPtr
->fsStyle
& TBSTYLE_SEP
) ||
378 !(grpPtr
->fsStyle
& TBSTYLE_GROUP
) ||
379 (grpX
> infoPtr
->nWidth
)) {
383 else if (grpX
+ x
> infoPtr
->nWidth
) {
391 bWrap
= ((bWrap
|| (x
+ cx
> infoPtr
->nWidth
)) &&
392 (wndPtr
->dwStyle
& TBSTYLE_WRAPABLE
));
396 x
= infoPtr
->nIndent
;
400 SetRect32 (&btnPtr
->rect
, x
, y
, x
+ cx
, y
+ cy
);
402 btnPtr
->nRow
= nRows
;
405 if (btnPtr
->fsState
& TBSTATE_WRAP
) {
407 y
+= (cy
+ SEPARATOR_HEIGHT
);
408 x
= infoPtr
->nIndent
;
411 infoPtr
->nRows
= nRows
+ 1;
413 /* --- end test --- */
415 if (btnPtr
->fsStyle
& TBSTYLE_SEP
) {
416 /* UNDOCUMENTED: If a separator has a non zero bitmap index, */
417 /* it is the actual width of the separator. This is used for */
418 /* custom controls in toolbars. */
419 if ((wndPtr
->dwStyle
& TBSTYLE_WRAPABLE
) &&
420 (btnPtr
->fsState
& TBSTATE_WRAP
)) {
423 cx
= infoPtr
->nWidth
;
424 cy
= ((btnPtr
->iBitmap
> 0) ?
425 btnPtr
->iBitmap
: SEPARATOR_WIDTH
) * 2 / 3;
430 cx
= (btnPtr
->iBitmap
> 0) ?
431 btnPtr
->iBitmap
: SEPARATOR_WIDTH
;
434 /* this must be a button */
435 cx
= infoPtr
->nButtonWidth
;
438 btnPtr
->rect
.left
= x
;
439 btnPtr
->rect
.top
= y
;
440 btnPtr
->rect
.right
= x
+ cx
;
441 btnPtr
->rect
.bottom
= y
+ cy
;
443 if (infoPtr
->rcBound
.left
> x
)
444 infoPtr
->rcBound
.left
= x
;
445 if (infoPtr
->rcBound
.right
< x
+ cx
)
446 infoPtr
->rcBound
.right
= x
+ cx
;
447 if (infoPtr
->rcBound
.bottom
< y
+ cy
)
448 infoPtr
->rcBound
.bottom
= y
+ cy
;
450 if (infoPtr
->hwndToolTip
) {
453 ZeroMemory (&ti
, sizeof(TTTOOLINFO32A
));
454 ti
.cbSize
= sizeof(TTTOOLINFO32A
);
455 ti
.hwnd
= wndPtr
->hwndSelf
;
456 ti
.uId
= btnPtr
->idCommand
;
457 ti
.rect
= btnPtr
->rect
;
458 SendMessage32A (infoPtr
->hwndToolTip
, TTM_NEWTOOLRECT32A
,
465 if (i
< infoPtr
->nNumButtons
)
473 infoPtr
->nHeight
= y
+ cy
+ BOTTOM_BORDER
;
474 TRACE (toolbar
, "toolbar height %d\n", infoPtr
->nHeight
);
479 TOOLBAR_InternalHitTest (WND
*wndPtr
, LPPOINT32 lpPt
)
481 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
482 TBUTTON_INFO
*btnPtr
;
485 btnPtr
= infoPtr
->buttons
;
486 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
487 if (btnPtr
->fsState
& TBSTATE_HIDDEN
)
490 if (btnPtr
->fsStyle
& TBSTYLE_SEP
) {
491 if (PtInRect32 (&btnPtr
->rect
, *lpPt
)) {
492 TRACE (toolbar
, " ON SEPARATOR %d!\n", i
);
497 if (PtInRect32 (&btnPtr
->rect
, *lpPt
)) {
498 TRACE (toolbar
, " ON BUTTON %d!\n", i
);
504 TRACE (toolbar
, " NOWHERE!\n");
510 TOOLBAR_GetButtonIndex (TOOLBAR_INFO
*infoPtr
, INT32 idCommand
)
512 TBUTTON_INFO
*btnPtr
;
515 btnPtr
= infoPtr
->buttons
;
516 for (i
= 0; i
< infoPtr
->nNumButtons
; i
++, btnPtr
++) {
517 if (btnPtr
->idCommand
== idCommand
) {
518 TRACE (toolbar
, "command=%d index=%d\n", idCommand
, i
);
522 TRACE (toolbar
, "no index found for command=%d\n", idCommand
);
528 TOOLBAR_GetCheckedGroupButtonIndex (TOOLBAR_INFO
*infoPtr
, INT32 nIndex
)
530 TBUTTON_INFO
*btnPtr
;
533 if ((nIndex
< 0) || (nIndex
> infoPtr
->nNumButtons
))
536 /* check index button */
537 btnPtr
= &infoPtr
->buttons
[nIndex
];
538 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
539 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
543 /* check previous buttons */
544 nRunIndex
= nIndex
- 1;
545 while (nRunIndex
>= 0) {
546 btnPtr
= &infoPtr
->buttons
[nRunIndex
];
547 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
548 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
556 /* check next buttons */
557 nRunIndex
= nIndex
+ 1;
558 while (nRunIndex
< infoPtr
->nNumButtons
) {
559 btnPtr
= &infoPtr
->buttons
[nRunIndex
];
560 if ((btnPtr
->fsStyle
& TBSTYLE_CHECKGROUP
) == TBSTYLE_CHECKGROUP
) {
561 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
574 TOOLBAR_RelayEvent (HWND32 hwndTip
, HWND32 hwndMsg
, UINT32 uMsg
,
575 WPARAM32 wParam
, LPARAM lParam
)
583 msg
.time
= GetMessageTime ();
584 msg
.pt
.x
= LOWORD(GetMessagePos ());
585 msg
.pt
.y
= HIWORD(GetMessagePos ());
587 SendMessage32A (hwndTip
, TTM_RELAYEVENT
, 0, (LPARAM
)&msg
);
592 TOOLBAR_AddBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
594 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
595 LPTBADDBITMAP lpAddBmp
= (LPTBADDBITMAP
)lParam
;
598 if ((!lpAddBmp
) || ((INT32
)wParam
<= 0))
601 TRACE (toolbar
, "adding %d bitmaps!\n", wParam
);
603 if (!(infoPtr
->himlDef
)) {
604 /* create new default image list */
605 TRACE (toolbar
, "creating default image list!\n");
607 ImageList_Create (infoPtr
->nBitmapWidth
, infoPtr
->nBitmapHeight
,
608 ILC_COLOR
| ILC_MASK
, (INT32
)wParam
, 2);
612 if (!(infoPtr
->himlDis
)) {
613 /* create new disabled image list */
614 TRACE (toolbar
, "creating disabled image list!\n");
616 ImageList_Create (infoPtr
->nBitmapWidth
,
617 infoPtr
->nBitmapHeight
, ILC_COLOR
| ILC_MASK
,
622 /* Add bitmaps to the default image list */
623 if (lpAddBmp
->hInst
== (HINSTANCE32
)0) {
625 ImageList_AddMasked (infoPtr
->himlDef
, (HBITMAP32
)lpAddBmp
->nID
,
628 else if (lpAddBmp
->hInst
== HINST_COMMCTRL
) {
629 /* add internal bitmaps */
630 FIXME (toolbar
, "internal bitmaps not supported!\n");
632 /* Hack to "add" some reserved images within the image list
633 to get the right image indices */
634 nIndex
= ImageList_GetImageCount (infoPtr
->himlDef
);
635 ImageList_SetImageCount (infoPtr
->himlDef
, nIndex
+ (INT32
)wParam
);
639 LoadBitmap32A (lpAddBmp
->hInst
, (LPSTR
)lpAddBmp
->nID
);
641 nIndex
= ImageList_AddMasked (infoPtr
->himlDef
, hBmp
, CLR_DEFAULT
);
643 DeleteObject32 (hBmp
);
647 infoPtr
->nNumBitmaps
+= (INT32
)wParam
;
654 TOOLBAR_AddButtons32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
656 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
657 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
658 INT32 nOldButtons
, nNewButtons
, nAddButtons
, nCount
;
661 TRACE (toolbar
, "adding %d buttons!\n", wParam
);
663 nAddButtons
= (UINT32
)wParam
;
664 nOldButtons
= infoPtr
->nNumButtons
;
665 nNewButtons
= nOldButtons
+ nAddButtons
;
667 if (infoPtr
->nNumButtons
== 0) {
669 COMCTL32_Alloc (sizeof(TBUTTON_INFO
) * nNewButtons
);
672 TBUTTON_INFO
*oldButtons
= infoPtr
->buttons
;
674 COMCTL32_Alloc (sizeof(TBUTTON_INFO
) * nNewButtons
);
675 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
676 nOldButtons
* sizeof(TBUTTON_INFO
));
677 COMCTL32_Free (oldButtons
);
680 infoPtr
->nNumButtons
= nNewButtons
;
682 /* insert new button data */
683 for (nCount
= 0; nCount
< nAddButtons
; nCount
++) {
684 TBUTTON_INFO
*btnPtr
= &infoPtr
->buttons
[nOldButtons
+nCount
];
685 btnPtr
->iBitmap
= lpTbb
[nCount
].iBitmap
;
686 btnPtr
->idCommand
= lpTbb
[nCount
].idCommand
;
687 btnPtr
->fsState
= lpTbb
[nCount
].fsState
;
688 btnPtr
->fsStyle
= lpTbb
[nCount
].fsStyle
;
689 btnPtr
->dwData
= lpTbb
[nCount
].dwData
;
690 btnPtr
->iString
= lpTbb
[nCount
].iString
;
692 if ((infoPtr
->hwndToolTip
) && !(btnPtr
->fsStyle
& TBSTYLE_SEP
)) {
695 ZeroMemory (&ti
, sizeof(TTTOOLINFO32A
));
696 ti
.cbSize
= sizeof (TTTOOLINFO32A
);
697 ti
.hwnd
= wndPtr
->hwndSelf
;
698 ti
.uId
= btnPtr
->idCommand
;
700 ti
.lpszText
= LPSTR_TEXTCALLBACK32A
;
702 SendMessage32A (infoPtr
->hwndToolTip
, TTM_ADDTOOL32A
,
707 TOOLBAR_CalcToolbar (wndPtr
);
709 hdc
= GetDC32 (wndPtr
->hwndSelf
);
710 TOOLBAR_Refresh (wndPtr
, hdc
);
711 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
717 // << TOOLBAR_AddButtons32W >>
721 TOOLBAR_AddString32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
723 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
726 if ((wParam
) && (HIWORD(lParam
) == 0)) {
729 TRACE (toolbar
, "adding string from resource!\n");
731 len
= LoadString32A ((HINSTANCE32
)wParam
, (UINT32
)lParam
,
734 TRACE (toolbar
, "len=%d \"%s\"\n", len
, szString
);
735 nIndex
= infoPtr
->nNumStrings
;
736 if (infoPtr
->nNumStrings
== 0) {
738 COMCTL32_Alloc (sizeof(char *));
741 char **oldStrings
= infoPtr
->strings
;
743 COMCTL32_Alloc (sizeof(char *) * (infoPtr
->nNumStrings
+ 1));
744 memcpy (&infoPtr
->strings
[0], &oldStrings
[0],
745 sizeof(char *) * infoPtr
->nNumStrings
);
746 COMCTL32_Free (oldStrings
);
749 infoPtr
->strings
[infoPtr
->nNumStrings
] =
750 COMCTL32_Alloc (sizeof(char)*(len
+1));
751 lstrcpy32A (infoPtr
->strings
[infoPtr
->nNumStrings
], szString
);
752 infoPtr
->nNumStrings
++;
755 char *p
= (char*)lParam
;
758 if (p
== NULL
) return -1;
759 TRACE (toolbar
, "adding string(s) from array!\n");
760 nIndex
= infoPtr
->nNumStrings
;
762 len
= lstrlen32A (p
);
763 TRACE (toolbar
, "len=%d \"%s\"\n", len
, p
);
765 if (infoPtr
->nNumStrings
== 0) {
767 COMCTL32_Alloc (sizeof(char *));
770 char **oldStrings
= infoPtr
->strings
;
772 COMCTL32_Alloc (sizeof(char *) * (infoPtr
->nNumStrings
+ 1));
773 memcpy (&infoPtr
->strings
[0], &oldStrings
[0],
774 sizeof(char *) * infoPtr
->nNumStrings
);
775 COMCTL32_Free (oldStrings
);
778 infoPtr
->strings
[infoPtr
->nNumStrings
] =
779 COMCTL32_Alloc (sizeof(char)*(len
+1));
780 lstrcpy32A (infoPtr
->strings
[infoPtr
->nNumStrings
], p
);
781 infoPtr
->nNumStrings
++;
791 // << TOOLBAR_AddString32W >>
795 TOOLBAR_AutoSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
797 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
801 UINT32 uPosFlags
= 0;
803 TRACE (toolbar
, "resize forced!\n");
805 parent
= GetParent32 (wndPtr
->hwndSelf
);
806 GetClientRect32(parent
, &parent_rect
);
808 if (wndPtr
->dwStyle
& CCS_NORESIZE
) {
809 uPosFlags
|= (SWP_NOSIZE
| SWP_NOMOVE
);
814 infoPtr
->nWidth
= parent_rect
.right
- parent_rect
.left
;
815 TOOLBAR_CalcToolbar (wndPtr
);
816 cy
= infoPtr
->nHeight
;
817 cx
= infoPtr
->nWidth
;
820 if (wndPtr
->dwStyle
& CCS_NOPARENTALIGN
)
821 uPosFlags
|= SWP_NOMOVE
;
823 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
))
824 cy
+= sysMetrics
[SM_CYEDGE
];
826 infoPtr
->bAutoSize
= TRUE
;
827 SetWindowPos32 (wndPtr
->hwndSelf
, HWND_TOP
, parent_rect
.left
, parent_rect
.top
,
835 TOOLBAR_ButtonCount (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
837 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
839 return infoPtr
->nNumButtons
;
844 TOOLBAR_ButtonStructSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
846 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
848 if (infoPtr
== NULL
) {
849 ERR (toolbar
, "(0x%08lx, 0x%08x, 0x%08lx)\n", (DWORD
)wndPtr
, wParam
, lParam
);
850 ERR (toolbar
, "infoPtr == NULL!\n");
854 infoPtr
->dwStructSize
= (DWORD
)wParam
;
861 TOOLBAR_ChangeBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
863 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
864 TBUTTON_INFO
*btnPtr
;
868 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
872 btnPtr
= &infoPtr
->buttons
[nIndex
];
873 btnPtr
->iBitmap
= LOWORD(lParam
);
875 hdc
= GetDC32 (wndPtr
->hwndSelf
);
876 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
877 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
884 TOOLBAR_CheckButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
886 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
887 TBUTTON_INFO
*btnPtr
;
890 INT32 nOldIndex
= -1;
892 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
896 btnPtr
= &infoPtr
->buttons
[nIndex
];
898 if (!(btnPtr
->fsStyle
& TBSTYLE_CHECK
))
901 if (LOWORD(lParam
) == FALSE
)
902 btnPtr
->fsState
&= ~TBSTATE_CHECKED
;
904 if (btnPtr
->fsStyle
& TBSTYLE_GROUP
) {
906 TOOLBAR_GetCheckedGroupButtonIndex (infoPtr
, nIndex
);
907 if (nOldIndex
== nIndex
)
910 infoPtr
->buttons
[nOldIndex
].fsState
&= ~TBSTATE_CHECKED
;
912 btnPtr
->fsState
|= TBSTATE_CHECKED
;
915 hdc
= GetDC32 (wndPtr
->hwndSelf
);
917 TOOLBAR_DrawButton (wndPtr
, &infoPtr
->buttons
[nOldIndex
], hdc
);
918 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
919 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
921 /* FIXME: Send a WM_NOTIFY?? */
928 TOOLBAR_CommandToIndex (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
930 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
932 return TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
937 TOOLBAR_Customize (WND
*wndPtr
)
939 FIXME (toolbar
, "customization not implemented!\n");
946 TOOLBAR_DeleteButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
948 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
949 INT32 nIndex
= (INT32
)wParam
;
951 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
954 if ((infoPtr
->hwndToolTip
) &&
955 !(infoPtr
->buttons
[nIndex
].fsStyle
& TBSTYLE_SEP
)) {
958 ZeroMemory (&ti
, sizeof(TTTOOLINFO32A
));
959 ti
.cbSize
= sizeof (TTTOOLINFO32A
);
960 ti
.hwnd
= wndPtr
->hwndSelf
;
961 ti
.uId
= infoPtr
->buttons
[nIndex
].idCommand
;
963 SendMessage32A (infoPtr
->hwndToolTip
, TTM_DELTOOL32A
, 0, (LPARAM
)&ti
);
966 if (infoPtr
->nNumButtons
== 1) {
967 TRACE (toolbar
, " simple delete!\n");
968 COMCTL32_Free (infoPtr
->buttons
);
969 infoPtr
->buttons
= NULL
;
970 infoPtr
->nNumButtons
= 0;
973 TBUTTON_INFO
*oldButtons
= infoPtr
->buttons
;
974 TRACE(toolbar
, "complex delete! [nIndex=%d]\n", nIndex
);
976 infoPtr
->nNumButtons
--;
977 infoPtr
->buttons
= COMCTL32_Alloc (sizeof (TBUTTON_INFO
) * infoPtr
->nNumButtons
);
979 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
980 nIndex
* sizeof(TBUTTON_INFO
));
983 if (nIndex
< infoPtr
->nNumButtons
) {
984 memcpy (&infoPtr
->buttons
[nIndex
], &oldButtons
[nIndex
+1],
985 (infoPtr
->nNumButtons
- nIndex
) * sizeof(TBUTTON_INFO
));
988 COMCTL32_Free (oldButtons
);
991 TOOLBAR_CalcToolbar (wndPtr
);
993 InvalidateRect32 (wndPtr
->hwndSelf
, NULL
, TRUE
);
994 UpdateWindow32 (wndPtr
->hwndSelf
);
1001 TOOLBAR_EnableButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1003 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1004 TBUTTON_INFO
*btnPtr
;
1008 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1012 btnPtr
= &infoPtr
->buttons
[nIndex
];
1013 if (LOWORD(lParam
) == FALSE
)
1014 btnPtr
->fsState
&= ~(TBSTATE_ENABLED
| TBSTATE_PRESSED
);
1016 btnPtr
->fsState
|= TBSTATE_ENABLED
;
1018 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1019 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1020 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1026 // << TOOLBAR_GetAnchorHighlight >>
1030 TOOLBAR_GetBitmap (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1032 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1035 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1039 return infoPtr
->buttons
[nIndex
].iBitmap
;
1043 static __inline__ LRESULT
1044 TOOLBAR_GetBitmapFlags (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1046 return (GetDeviceCaps32 (0, LOGPIXELSX
) >= 120) ? TBBF_LARGE
: 0;
1051 TOOLBAR_GetButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1053 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1054 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
1055 INT32 nIndex
= (INT32
)wParam
;
1056 TBUTTON_INFO
*btnPtr
;
1058 if (infoPtr
== NULL
) return FALSE
;
1059 if (lpTbb
== NULL
) return FALSE
;
1061 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
1064 btnPtr
= &infoPtr
->buttons
[nIndex
];
1065 lpTbb
->iBitmap
= btnPtr
->iBitmap
;
1066 lpTbb
->idCommand
= btnPtr
->idCommand
;
1067 lpTbb
->fsState
= btnPtr
->fsState
;
1068 lpTbb
->fsStyle
= btnPtr
->fsStyle
;
1069 lpTbb
->dwData
= btnPtr
->dwData
;
1070 lpTbb
->iString
= btnPtr
->iString
;
1077 TOOLBAR_GetButtonInfo32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1079 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1080 LPTBBUTTONINFO32A lpTbInfo
= (LPTBBUTTONINFO32A
)lParam
;
1081 TBUTTON_INFO
*btnPtr
;
1084 if (infoPtr
== NULL
) return -1;
1085 if (lpTbInfo
== NULL
) return -1;
1086 if (lpTbInfo
->cbSize
< sizeof(LPTBBUTTONINFO32A
)) return -1;
1088 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1092 btnPtr
= &infoPtr
->buttons
[nIndex
];
1094 if (lpTbInfo
->dwMask
& TBIF_COMMAND
)
1095 lpTbInfo
->idCommand
= btnPtr
->idCommand
;
1096 if (lpTbInfo
->dwMask
& TBIF_IMAGE
)
1097 lpTbInfo
->iImage
= btnPtr
->iBitmap
;
1098 if (lpTbInfo
->dwMask
& TBIF_LPARAM
)
1099 lpTbInfo
->lParam
= btnPtr
->dwData
;
1100 if (lpTbInfo
->dwMask
& TBIF_SIZE
)
1101 lpTbInfo
->cx
= (WORD
)(btnPtr
->rect
.right
- btnPtr
->rect
.left
);
1102 if (lpTbInfo
->dwMask
& TBIF_STATE
)
1103 lpTbInfo
->fsState
= btnPtr
->fsState
;
1104 if (lpTbInfo
->dwMask
& TBIF_STYLE
)
1105 lpTbInfo
->fsStyle
= btnPtr
->fsStyle
;
1106 if (lpTbInfo
->dwMask
& TBIF_TEXT
) {
1107 if ((btnPtr
->iString
>= 0) || (btnPtr
->iString
< infoPtr
->nNumStrings
))
1108 lstrcpyn32A (lpTbInfo
->pszText
,
1109 (LPSTR
)infoPtr
->strings
[btnPtr
->iString
],
1117 // << TOOLBAR_GetButtonInfo32W >>
1121 TOOLBAR_GetButtonSize (WND
*wndPtr
)
1123 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1125 return MAKELONG((WORD
)infoPtr
->nButtonWidth
,
1126 (WORD
)infoPtr
->nButtonHeight
);
1131 TOOLBAR_GetButtonText32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1133 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1134 INT32 nIndex
, nStringIndex
;
1136 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1140 nStringIndex
= infoPtr
->buttons
[nIndex
].iString
;
1142 TRACE (toolbar
, "index=%d stringIndex=%d\n", nIndex
, nStringIndex
);
1144 if ((nStringIndex
< 0) || (nStringIndex
>= infoPtr
->nNumStrings
))
1147 if (lParam
== 0) return -1;
1149 lstrcpy32A ((LPSTR
)lParam
, (LPSTR
)infoPtr
->strings
[nStringIndex
]);
1151 return lstrlen32A ((LPSTR
)infoPtr
->strings
[nStringIndex
]);
1155 // << TOOLBAR_GetButtonText32W >>
1156 // << TOOLBAR_GetColorScheme >>
1160 TOOLBAR_GetDisabledImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1162 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1164 if (wndPtr
->dwStyle
& TBSTYLE_FLAT
)
1165 return (LRESULT
)infoPtr
->himlDis
;
1171 __inline__
static LRESULT
1172 TOOLBAR_GetExtendedStyle (WND
*wndPtr
)
1174 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1176 return infoPtr
->dwExStyle
;
1181 TOOLBAR_GetHotImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1183 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1185 if (wndPtr
->dwStyle
& TBSTYLE_FLAT
)
1186 return (LRESULT
)infoPtr
->himlHot
;
1192 // << TOOLBAR_GetHotItem >>
1196 TOOLBAR_GetImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1198 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1200 if (wndPtr
->dwStyle
& TBSTYLE_FLAT
)
1201 return (LRESULT
)infoPtr
->himlDef
;
1207 // << TOOLBAR_GetInsertMark >>
1208 // << TOOLBAR_GetInsertMarkColor >>
1212 TOOLBAR_GetItemRect (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1214 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1215 TBUTTON_INFO
*btnPtr
;
1219 if (infoPtr
== NULL
) return FALSE
;
1220 nIndex
= (INT32
)wParam
;
1221 btnPtr
= &infoPtr
->buttons
[nIndex
];
1222 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
1224 lpRect
= (LPRECT32
)lParam
;
1225 if (lpRect
== NULL
) return FALSE
;
1226 if (btnPtr
->fsState
& TBSTATE_HIDDEN
) return FALSE
;
1228 lpRect
->left
= btnPtr
->rect
.left
;
1229 lpRect
->right
= btnPtr
->rect
.right
;
1230 lpRect
->bottom
= btnPtr
->rect
.bottom
;
1231 lpRect
->top
= btnPtr
->rect
.top
;
1238 TOOLBAR_GetMaxSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1240 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1241 LPSIZE32 lpSize
= (LPSIZE32
)lParam
;
1246 lpSize
->cx
= infoPtr
->rcBound
.right
- infoPtr
->rcBound
.left
;
1247 lpSize
->cy
= infoPtr
->rcBound
.bottom
- infoPtr
->rcBound
.top
;
1249 TRACE (toolbar
, "maximum size %d x %d\n",
1250 infoPtr
->rcBound
.right
- infoPtr
->rcBound
.left
,
1251 infoPtr
->rcBound
.bottom
- infoPtr
->rcBound
.top
);
1257 // << TOOLBAR_GetObject >>
1258 // << TOOLBAR_GetPadding >>
1262 TOOLBAR_GetRect (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1264 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1265 TBUTTON_INFO
*btnPtr
;
1269 if (infoPtr
== NULL
) return FALSE
;
1270 nIndex
= (INT32
)wParam
;
1271 btnPtr
= &infoPtr
->buttons
[nIndex
];
1272 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
1274 lpRect
= (LPRECT32
)lParam
;
1275 if (lpRect
== NULL
) return FALSE
;
1277 lpRect
->left
= btnPtr
->rect
.left
;
1278 lpRect
->right
= btnPtr
->rect
.right
;
1279 lpRect
->bottom
= btnPtr
->rect
.bottom
;
1280 lpRect
->top
= btnPtr
->rect
.top
;
1287 TOOLBAR_GetRows (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1289 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1291 if (wndPtr
->dwStyle
& TBSTYLE_WRAPABLE
)
1292 return infoPtr
->nRows
;
1299 TOOLBAR_GetState (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1301 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1304 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1305 if (nIndex
== -1) return -1;
1307 return infoPtr
->buttons
[nIndex
].fsState
;
1312 TOOLBAR_GetStyle (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1314 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1317 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1318 if (nIndex
== -1) return -1;
1320 return infoPtr
->buttons
[nIndex
].fsStyle
;
1325 TOOLBAR_GetTextRows (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1327 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1329 if (infoPtr
== NULL
)
1332 return infoPtr
->nMaxTextRows
;
1337 TOOLBAR_GetToolTips (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1339 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1341 if (infoPtr
== NULL
) return 0;
1342 return infoPtr
->hwndToolTip
;
1347 TOOLBAR_GetUnicodeFormat (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1349 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1351 TRACE (toolbar
, "%s hwnd=0x%04x stub!\n",
1352 infoPtr
->bUnicode
? "TRUE" : "FALSE", wndPtr
->hwndSelf
);
1354 return infoPtr
->bUnicode
;
1359 TOOLBAR_HideButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1361 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1362 TBUTTON_INFO
*btnPtr
;
1365 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1369 btnPtr
= &infoPtr
->buttons
[nIndex
];
1370 if (LOWORD(lParam
) == FALSE
)
1371 btnPtr
->fsState
&= ~TBSTATE_HIDDEN
;
1373 btnPtr
->fsState
|= TBSTATE_HIDDEN
;
1375 TOOLBAR_CalcToolbar (wndPtr
);
1377 InvalidateRect32 (wndPtr
->hwndSelf
, NULL
, TRUE
);
1378 UpdateWindow32 (wndPtr
->hwndSelf
);
1384 __inline__
static LRESULT
1385 TOOLBAR_HitTest (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1387 return TOOLBAR_InternalHitTest (wndPtr
, (LPPOINT32
)lParam
);
1392 TOOLBAR_Indeterminate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1394 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1395 TBUTTON_INFO
*btnPtr
;
1399 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1403 btnPtr
= &infoPtr
->buttons
[nIndex
];
1404 if (LOWORD(lParam
) == FALSE
)
1405 btnPtr
->fsState
&= ~TBSTATE_INDETERMINATE
;
1407 btnPtr
->fsState
|= TBSTATE_INDETERMINATE
;
1409 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1410 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1411 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1418 TOOLBAR_InsertButton32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1420 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1421 LPTBBUTTON lpTbb
= (LPTBBUTTON
)lParam
;
1422 INT32 nIndex
= (INT32
)wParam
;
1423 TBUTTON_INFO
*oldButtons
;
1426 if (lpTbb
== NULL
) return FALSE
;
1427 if (nIndex
< 0) return FALSE
;
1429 TRACE (toolbar
, "inserting button index=%d\n", nIndex
);
1430 if (nIndex
> infoPtr
->nNumButtons
) {
1431 nIndex
= infoPtr
->nNumButtons
;
1432 TRACE (toolbar
, "adjust index=%d\n", nIndex
);
1435 oldButtons
= infoPtr
->buttons
;
1436 infoPtr
->nNumButtons
++;
1437 infoPtr
->buttons
= COMCTL32_Alloc (sizeof (TBUTTON_INFO
) * infoPtr
->nNumButtons
);
1438 /* pre insert copy */
1440 memcpy (&infoPtr
->buttons
[0], &oldButtons
[0],
1441 nIndex
* sizeof(TBUTTON_INFO
));
1444 /* insert new button */
1445 infoPtr
->buttons
[nIndex
].iBitmap
= lpTbb
->iBitmap
;
1446 infoPtr
->buttons
[nIndex
].idCommand
= lpTbb
->idCommand
;
1447 infoPtr
->buttons
[nIndex
].fsState
= lpTbb
->fsState
;
1448 infoPtr
->buttons
[nIndex
].fsStyle
= lpTbb
->fsStyle
;
1449 infoPtr
->buttons
[nIndex
].dwData
= lpTbb
->dwData
;
1450 infoPtr
->buttons
[nIndex
].iString
= lpTbb
->iString
;
1452 if ((infoPtr
->hwndToolTip
) && !(lpTbb
->fsStyle
& TBSTYLE_SEP
)) {
1455 ZeroMemory (&ti
, sizeof(TTTOOLINFO32A
));
1456 ti
.cbSize
= sizeof (TTTOOLINFO32A
);
1457 ti
.hwnd
= wndPtr
->hwndSelf
;
1458 ti
.uId
= lpTbb
->idCommand
;
1460 ti
.lpszText
= LPSTR_TEXTCALLBACK32A
;
1462 SendMessage32A (infoPtr
->hwndToolTip
, TTM_ADDTOOL32A
,
1466 /* post insert copy */
1467 if (nIndex
< infoPtr
->nNumButtons
- 1) {
1468 memcpy (&infoPtr
->buttons
[nIndex
+1], &oldButtons
[nIndex
],
1469 (infoPtr
->nNumButtons
- nIndex
- 1) * sizeof(TBUTTON_INFO
));
1472 COMCTL32_Free (oldButtons
);
1474 TOOLBAR_CalcToolbar (wndPtr
);
1476 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1477 TOOLBAR_Refresh (wndPtr
, hdc
);
1478 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1484 // << TOOLBAR_InsertButton32W >>
1485 // << TOOLBAR_InsertMarkHitTest >>
1489 TOOLBAR_IsButtonChecked (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1491 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1494 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1498 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_CHECKED
);
1503 TOOLBAR_IsButtonEnabled (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1505 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1508 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1512 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_ENABLED
);
1517 TOOLBAR_IsButtonHidden (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1519 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1522 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1526 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_HIDDEN
);
1531 TOOLBAR_IsButtonHighlighted (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1533 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1536 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1540 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_MARKED
);
1545 TOOLBAR_IsButtonIndeterminate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1547 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1550 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1554 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_INDETERMINATE
);
1559 TOOLBAR_IsButtonPressed (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1561 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1564 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1568 return (infoPtr
->buttons
[nIndex
].fsState
& TBSTATE_PRESSED
);
1572 // << TOOLBAR_LoadImages >>
1573 // << TOOLBAR_MapAccelerator >>
1574 // << TOOLBAR_MarkButton >>
1575 // << TOOLBAR_MoveButton >>
1579 TOOLBAR_PressButton (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1581 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1582 TBUTTON_INFO
*btnPtr
;
1586 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1590 btnPtr
= &infoPtr
->buttons
[nIndex
];
1591 if (LOWORD(lParam
) == FALSE
)
1592 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
1594 btnPtr
->fsState
|= TBSTATE_PRESSED
;
1596 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1597 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1598 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1604 // << TOOLBAR_ReplaceBitmap >>
1608 TOOLBAR_SaveRestore32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1611 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1612 LPTBSAVEPARAMS32A lpSave
= (LPTBSAVEPARAMS32A
)lParam
;
1614 if (lpSave
== NULL
) return 0;
1616 if ((BOOL32
)wParam
) {
1617 /* save toolbar information */
1618 FIXME (toolbar
, "save to \"%s\" \"%s\"\n",
1619 lpSave
->pszSubKey
, lpSave
->pszValueName
);
1624 /* restore toolbar information */
1626 FIXME (toolbar
, "restore from \"%s\" \"%s\"\n",
1627 lpSave
->pszSubKey
, lpSave
->pszValueName
);
1637 // << TOOLBAR_SaveRestore32W >>
1638 // << TOOLBAR_SetAnchorHighlight >>
1642 TOOLBAR_SetBitmapSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1644 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1646 if ((LOWORD(lParam
) <= 0) || (HIWORD(lParam
)<=0))
1649 infoPtr
->nBitmapWidth
= (INT32
)LOWORD(lParam
);
1650 infoPtr
->nBitmapHeight
= (INT32
)HIWORD(lParam
);
1657 TOOLBAR_SetButtonInfo32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1659 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1660 LPTBBUTTONINFO32A lptbbi
= (LPTBBUTTONINFO32A
)lParam
;
1661 TBUTTON_INFO
*btnPtr
;
1666 if (lptbbi
->cbSize
< sizeof(LPTBBUTTONINFO32A
))
1669 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1673 btnPtr
= &infoPtr
->buttons
[nIndex
];
1674 if (lptbbi
->dwMask
& TBIF_COMMAND
)
1675 btnPtr
->idCommand
= lptbbi
->idCommand
;
1676 if (lptbbi
->dwMask
& TBIF_IMAGE
)
1677 btnPtr
->iBitmap
= lptbbi
->iImage
;
1678 if (lptbbi
->dwMask
& TBIF_LPARAM
)
1679 btnPtr
->dwData
= lptbbi
->lParam
;
1680 // if (lptbbi->dwMask & TBIF_SIZE)
1681 // btnPtr->cx = lptbbi->cx;
1682 if (lptbbi
->dwMask
& TBIF_STATE
)
1683 btnPtr
->fsState
= lptbbi
->fsState
;
1684 if (lptbbi
->dwMask
& TBIF_STYLE
)
1685 btnPtr
->fsStyle
= lptbbi
->fsStyle
;
1687 if (lptbbi
->dwMask
& TBIF_TEXT
) {
1688 if ((btnPtr
->iString
>= 0) ||
1689 (btnPtr
->iString
< infoPtr
->nNumStrings
)) {
1691 CHAR
**lpString
= &infoPtr
->strings
[btnPtr
->iString
];
1692 INT32 len
= lstrlen32A (lptbbi
->pszText
);
1693 *lpString
= COMCTL32_ReAlloc (lpString
, sizeof(char)*(len
+1));
1696 /* this is the ultimate sollution */
1697 // Str_SetPtrA (&infoPtr->strings[btnPtr->iString], lptbbi->pszText);
1705 // << TOOLBAR_SetButtonInfo32W >>
1709 TOOLBAR_SetButtonSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1711 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1713 if ((LOWORD(lParam
) <= 0) || (HIWORD(lParam
)<=0))
1716 infoPtr
->nButtonWidth
= (INT32
)LOWORD(lParam
);
1717 infoPtr
->nButtonHeight
= (INT32
)HIWORD(lParam
);
1724 TOOLBAR_SetButtonWidth (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1726 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1728 if (infoPtr
== NULL
)
1731 infoPtr
->cxMin
= (INT32
)LOWORD(lParam
);
1732 infoPtr
->cxMax
= (INT32
)HIWORD(lParam
);
1739 TOOLBAR_SetCmdId (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1741 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1742 INT32 nIndex
= (INT32
)wParam
;
1744 if ((nIndex
< 0) || (nIndex
>= infoPtr
->nNumButtons
))
1747 infoPtr
->buttons
[nIndex
].idCommand
= (INT32
)lParam
;
1749 if (infoPtr
->hwndToolTip
) {
1751 FIXME (toolbar
, "change tool tip!\n");
1759 // << TOOLBAR_SetColorScheme >>
1763 TOOLBAR_SetDisabledImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1765 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1766 HIMAGELIST himlTemp
;
1768 if (!(wndPtr
->dwStyle
& TBSTYLE_FLAT
))
1771 himlTemp
= infoPtr
->himlDis
;
1772 infoPtr
->himlDis
= (HIMAGELIST
)lParam
;
1774 /* FIXME: redraw ? */
1776 return (LRESULT
)himlTemp
;
1781 TOOLBAR_SetDrawTextFlags (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1783 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1786 dwTemp
= infoPtr
->dwDTFlags
;
1787 infoPtr
->dwDTFlags
=
1788 (infoPtr
->dwDTFlags
& (DWORD
)wParam
) | (DWORD
)lParam
;
1790 return (LRESULT
)dwTemp
;
1795 TOOLBAR_SetExtendedStyle (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1797 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1800 dwTemp
= infoPtr
->dwExStyle
;
1801 infoPtr
->dwExStyle
= (DWORD
)lParam
;
1803 return (LRESULT
)dwTemp
;
1808 TOOLBAR_SetHotImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1810 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1811 HIMAGELIST himlTemp
;
1813 if (!(wndPtr
->dwStyle
& TBSTYLE_FLAT
))
1816 himlTemp
= infoPtr
->himlHot
;
1817 infoPtr
->himlHot
= (HIMAGELIST
)lParam
;
1819 /* FIXME: redraw ? */
1821 return (LRESULT
)himlTemp
;
1825 // << TOOLBAR_SetHotItem >>
1829 TOOLBAR_SetImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1831 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1832 HIMAGELIST himlTemp
;
1834 if (!(wndPtr
->dwStyle
& TBSTYLE_FLAT
))
1837 himlTemp
= infoPtr
->himlDef
;
1838 infoPtr
->himlDef
= (HIMAGELIST
)lParam
;
1840 /* FIXME: redraw ? */
1842 return (LRESULT
)himlTemp
;
1847 TOOLBAR_SetIndent (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1849 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1852 infoPtr
->nIndent
= (INT32
)wParam
;
1853 TOOLBAR_CalcToolbar (wndPtr
);
1854 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1855 TOOLBAR_Refresh (wndPtr
, hdc
);
1856 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1862 // << TOOLBAR_SetInsertMark >>
1866 TOOLBAR_SetInsertMarkColor (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1868 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1870 infoPtr
->clrInsertMark
= (COLORREF
)lParam
;
1872 /* FIXME : redraw ??*/
1879 TOOLBAR_SetMaxTextRows (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1881 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1883 if (infoPtr
== NULL
)
1886 infoPtr
->nMaxTextRows
= (INT32
)wParam
;
1892 // << TOOLBAR_SetPadding >>
1896 TOOLBAR_SetParent (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1898 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1899 HWND32 hwndOldNotify
;
1901 if (infoPtr
== NULL
) return 0;
1902 hwndOldNotify
= infoPtr
->hwndNotify
;
1903 infoPtr
->hwndNotify
= (HWND32
)wParam
;
1905 return hwndOldNotify
;
1910 TOOLBAR_SetRows (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1912 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1913 LPRECT32 lprc
= (LPRECT32
)lParam
;
1916 if (LOWORD(wParam
) > 1) {
1918 FIXME (toolbar
, "multiple rows not supported!\n");
1922 /* recalculate toolbar */
1923 TOOLBAR_CalcToolbar (wndPtr
);
1925 /* return bounding rectangle */
1927 lprc
->left
= infoPtr
->rcBound
.left
;
1928 lprc
->right
= infoPtr
->rcBound
.right
;
1929 lprc
->top
= infoPtr
->rcBound
.top
;
1930 lprc
->bottom
= infoPtr
->rcBound
.bottom
;
1933 /* repaint toolbar */
1934 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1935 TOOLBAR_Refresh (wndPtr
, hdc
);
1936 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1943 TOOLBAR_SetState (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1945 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1946 TBUTTON_INFO
*btnPtr
;
1950 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1954 btnPtr
= &infoPtr
->buttons
[nIndex
];
1955 btnPtr
->fsState
= LOWORD(lParam
);
1957 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1958 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1959 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1966 TOOLBAR_SetStyle (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1968 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1969 TBUTTON_INFO
*btnPtr
;
1973 nIndex
= TOOLBAR_GetButtonIndex (infoPtr
, (INT32
)wParam
);
1977 btnPtr
= &infoPtr
->buttons
[nIndex
];
1978 btnPtr
->fsStyle
= LOWORD(lParam
);
1980 hdc
= GetDC32 (wndPtr
->hwndSelf
);
1981 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
1982 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
1984 if (infoPtr
->hwndToolTip
) {
1986 FIXME (toolbar
, "change tool tip!\n");
1994 __inline__
static LRESULT
1995 TOOLBAR_SetToolTips (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
1997 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
1999 if (infoPtr
== NULL
) return 0;
2000 infoPtr
->hwndToolTip
= (HWND32
)wParam
;
2006 TOOLBAR_SetUnicodeFormat (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2008 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2011 TRACE (toolbar
, "%s hwnd=0x%04x stub!\n",
2012 ((BOOL32
)wParam
) ? "TRUE" : "FALSE", wndPtr
->hwndSelf
);
2014 bTemp
= infoPtr
->bUnicode
;
2015 infoPtr
->bUnicode
= (BOOL32
)wParam
;
2022 TOOLBAR_Create (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2024 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2027 /* initialize info structure */
2028 infoPtr
->nButtonHeight
= 22;
2029 infoPtr
->nButtonWidth
= 23;
2030 infoPtr
->nBitmapHeight
= 15;
2031 infoPtr
->nBitmapWidth
= 16;
2033 infoPtr
->nHeight
= infoPtr
->nButtonHeight
+ TOP_BORDER
+ BOTTOM_BORDER
;
2035 infoPtr
->nMaxTextRows
= 1;
2036 infoPtr
->cxMin
= -1;
2037 infoPtr
->cxMax
= -1;
2039 infoPtr
->bCaptured
= FALSE
;
2040 infoPtr
->bUnicode
= FALSE
;
2041 infoPtr
->nButtonDown
= -1;
2042 infoPtr
->nOldHit
= -1;
2044 infoPtr
->hwndNotify
= GetParent32 (wndPtr
->hwndSelf
);
2045 infoPtr
->bTransparent
= (wndPtr
->dwStyle
& TBSTYLE_FLAT
);
2046 infoPtr
->nHotItem
= -1;
2047 infoPtr
->dwDTFlags
= DT_CENTER
;
2049 SystemParametersInfo32A (SPI_GETICONTITLELOGFONT
, 0, &logFont
, 0);
2050 infoPtr
->hFont
= CreateFontIndirect32A (&logFont
);
2052 if (wndPtr
->dwStyle
& TBSTYLE_TOOLTIPS
) {
2053 /* Create tooltip control */
2054 infoPtr
->hwndToolTip
=
2055 CreateWindowEx32A (0, TOOLTIPS_CLASS32A
, NULL
, TTS_ALWAYSTIP
,
2056 CW_USEDEFAULT32
, CW_USEDEFAULT32
,
2057 CW_USEDEFAULT32
, CW_USEDEFAULT32
,
2058 wndPtr
->hwndSelf
, 0, 0, 0);
2060 /* Send NM_TOOLTIPSCREATED notification */
2061 if (infoPtr
->hwndToolTip
) {
2062 NMTOOLTIPSCREATED nmttc
;
2064 nmttc
.hdr
.hwndFrom
= wndPtr
->hwndSelf
;
2065 nmttc
.hdr
.idFrom
= wndPtr
->wIDmenu
;
2066 nmttc
.hdr
.code
= NM_TOOLTIPSCREATED
;
2067 nmttc
.hwndToolTips
= infoPtr
->hwndToolTip
;
2069 SendMessage32A (infoPtr
->hwndNotify
, WM_NOTIFY
,
2070 (WPARAM32
)wndPtr
->wIDmenu
, (LPARAM
)&nmttc
);
2079 TOOLBAR_Destroy (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2081 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2083 /* delete tooltip control */
2084 if (infoPtr
->hwndToolTip
)
2085 DestroyWindow32 (infoPtr
->hwndToolTip
);
2087 /* delete button data */
2088 if (infoPtr
->buttons
)
2089 COMCTL32_Free (infoPtr
->buttons
);
2091 /* delete strings */
2092 if (infoPtr
->strings
) {
2094 for (i
= 0; i
< infoPtr
->nNumStrings
; i
++)
2095 if (infoPtr
->strings
[i
])
2096 COMCTL32_Free (infoPtr
->strings
[i
]);
2098 COMCTL32_Free (infoPtr
->strings
);
2101 /* destroy default image list */
2102 if (infoPtr
->himlDef
)
2103 ImageList_Destroy (infoPtr
->himlDef
);
2105 /* destroy disabled image list */
2106 if (infoPtr
->himlDis
)
2107 ImageList_Destroy (infoPtr
->himlDis
);
2109 /* destroy hot image list */
2110 if (infoPtr
->himlHot
)
2111 ImageList_Destroy (infoPtr
->himlHot
);
2113 /* delete default font */
2115 DeleteObject32 (infoPtr
->hFont
);
2117 /* free toolbar info data */
2118 COMCTL32_Free (infoPtr
);
2125 TOOLBAR_EraseBackground (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2127 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2129 if (infoPtr
->bTransparent
)
2130 return SendMessage32A (GetParent32 (wndPtr
->hwndSelf
), WM_ERASEBKGND
,
2133 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_ERASEBKGND
, wParam
, lParam
);
2138 TOOLBAR_LButtonDblClk (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2140 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2141 TBUTTON_INFO
*btnPtr
;
2146 pt
.x
= (INT32
)LOWORD(lParam
);
2147 pt
.y
= (INT32
)HIWORD(lParam
);
2148 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
2151 btnPtr
= &infoPtr
->buttons
[nHit
];
2152 if (!(btnPtr
->fsState
& TBSTATE_ENABLED
))
2154 SetCapture32 (wndPtr
->hwndSelf
);
2155 infoPtr
->bCaptured
= TRUE
;
2156 infoPtr
->nButtonDown
= nHit
;
2158 btnPtr
->fsState
|= TBSTATE_PRESSED
;
2160 hdc
= GetDC32 (wndPtr
->hwndSelf
);
2161 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
2162 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
2164 else if (wndPtr
->dwStyle
& CCS_ADJUSTABLE
)
2165 TOOLBAR_Customize (wndPtr
);
2172 TOOLBAR_LButtonDown (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2174 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2175 TBUTTON_INFO
*btnPtr
;
2180 if (infoPtr
->hwndToolTip
)
2181 TOOLBAR_RelayEvent (infoPtr
->hwndToolTip
, wndPtr
->hwndSelf
,
2182 WM_LBUTTONDOWN
, wParam
, lParam
);
2184 pt
.x
= (INT32
)LOWORD(lParam
);
2185 pt
.y
= (INT32
)HIWORD(lParam
);
2186 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
2189 btnPtr
= &infoPtr
->buttons
[nHit
];
2190 if (!(btnPtr
->fsState
& TBSTATE_ENABLED
))
2193 SetCapture32 (wndPtr
->hwndSelf
);
2194 infoPtr
->bCaptured
= TRUE
;
2195 infoPtr
->nButtonDown
= nHit
;
2196 infoPtr
->nOldHit
= nHit
;
2198 btnPtr
->fsState
|= TBSTATE_PRESSED
;
2200 hdc
= GetDC32 (wndPtr
->hwndSelf
);
2201 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
2202 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
2210 TOOLBAR_LButtonUp (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2212 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2213 TBUTTON_INFO
*btnPtr
;
2216 INT32 nOldIndex
= -1;
2218 BOOL32 bSendMessage
= TRUE
;
2220 if (infoPtr
->hwndToolTip
)
2221 TOOLBAR_RelayEvent (infoPtr
->hwndToolTip
, wndPtr
->hwndSelf
,
2222 WM_LBUTTONUP
, wParam
, lParam
);
2224 pt
.x
= (INT32
)LOWORD(lParam
);
2225 pt
.y
= (INT32
)HIWORD(lParam
);
2226 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
2228 if ((infoPtr
->bCaptured
) && (infoPtr
->nButtonDown
>= 0)) {
2229 infoPtr
->bCaptured
= FALSE
;
2231 btnPtr
= &infoPtr
->buttons
[infoPtr
->nButtonDown
];
2232 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
2234 if (nHit
== infoPtr
->nButtonDown
) {
2235 if (btnPtr
->fsStyle
& TBSTYLE_CHECK
) {
2236 if (btnPtr
->fsStyle
& TBSTYLE_GROUP
) {
2237 nOldIndex
= TOOLBAR_GetCheckedGroupButtonIndex (infoPtr
,
2238 infoPtr
->nButtonDown
);
2239 if (nOldIndex
== infoPtr
->nButtonDown
)
2240 bSendMessage
= FALSE
;
2241 if ((nOldIndex
!= infoPtr
->nButtonDown
) &&
2243 infoPtr
->buttons
[nOldIndex
].fsState
&= ~TBSTATE_CHECKED
;
2244 btnPtr
->fsState
|= TBSTATE_CHECKED
;
2247 if (btnPtr
->fsState
& TBSTATE_CHECKED
)
2248 btnPtr
->fsState
&= ~TBSTATE_CHECKED
;
2250 btnPtr
->fsState
|= TBSTATE_CHECKED
;
2255 bSendMessage
= FALSE
;
2257 hdc
= GetDC32 (wndPtr
->hwndSelf
);
2258 if (nOldIndex
!= -1)
2259 TOOLBAR_DrawButton (wndPtr
, &infoPtr
->buttons
[nOldIndex
], hdc
);
2260 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
2261 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
2264 SendMessage32A (infoPtr
->hwndNotify
, WM_COMMAND
,
2265 MAKEWPARAM(btnPtr
->idCommand
, 0),
2266 (LPARAM
)wndPtr
->hwndSelf
);
2268 infoPtr
->nButtonDown
= -1;
2269 infoPtr
->nOldHit
= -1;
2277 TOOLBAR_MouseMove (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2279 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2280 TBUTTON_INFO
*btnPtr
;
2285 if (infoPtr
->hwndToolTip
)
2286 TOOLBAR_RelayEvent (infoPtr
->hwndToolTip
, wndPtr
->hwndSelf
,
2287 WM_MOUSEMOVE
, wParam
, lParam
);
2289 pt
.x
= (INT32
)LOWORD(lParam
);
2290 pt
.y
= (INT32
)HIWORD(lParam
);
2291 nHit
= TOOLBAR_InternalHitTest (wndPtr
, &pt
);
2293 if (infoPtr
->bCaptured
) {
2294 if (infoPtr
->nOldHit
!= nHit
) {
2295 btnPtr
= &infoPtr
->buttons
[infoPtr
->nButtonDown
];
2296 if (infoPtr
->nOldHit
== infoPtr
->nButtonDown
) {
2297 btnPtr
->fsState
&= ~TBSTATE_PRESSED
;
2298 hdc
= GetDC32 (wndPtr
->hwndSelf
);
2299 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
2300 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
2302 else if (nHit
== infoPtr
->nButtonDown
) {
2303 btnPtr
->fsState
|= TBSTATE_PRESSED
;
2304 hdc
= GetDC32 (wndPtr
->hwndSelf
);
2305 TOOLBAR_DrawButton (wndPtr
, btnPtr
, hdc
);
2306 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
2309 infoPtr
->nOldHit
= nHit
;
2316 __inline__
static LRESULT
2317 TOOLBAR_NCActivate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2319 // if (wndPtr->dwStyle & CCS_NODIVIDER)
2320 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_NCACTIVATE
,
2323 // return TOOLBAR_NCPaint (wndPtr, wParam, lParam);
2327 __inline__
static LRESULT
2328 TOOLBAR_NCCalcSize (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2330 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
))
2331 ((LPRECT32
)lParam
)->top
+= sysMetrics
[SM_CYEDGE
];
2333 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_NCCALCSIZE
, wParam
, lParam
);
2338 TOOLBAR_NCCreate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2340 TOOLBAR_INFO
*infoPtr
;
2342 /* allocate memory for info structure */
2343 infoPtr
= (TOOLBAR_INFO
*)COMCTL32_Alloc (sizeof(TOOLBAR_INFO
));
2344 wndPtr
->wExtra
[0] = (DWORD
)infoPtr
;
2346 if (infoPtr
== NULL
) {
2347 ERR (toolbar
, "could not allocate info memory!\n");
2351 if ((TOOLBAR_INFO
*)wndPtr
->wExtra
[0] != infoPtr
) {
2352 ERR (toolbar
, "pointer assignment error!\n");
2357 infoPtr
->dwStructSize
= sizeof(TBBUTTON
);
2359 /* fix instance handle, if the toolbar was created by CreateToolbarEx() */
2360 if (!wndPtr
->hInstance
)
2361 wndPtr
->hInstance
= wndPtr
->parent
->hInstance
;
2363 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_NCCREATE
, wParam
, lParam
);
2368 TOOLBAR_NCPaint (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2370 HWND32 hwnd
= wndPtr
->hwndSelf
;
2373 if ( wndPtr
->dwStyle
& WS_MINIMIZE
||
2374 !WIN_IsWindowDrawable( wndPtr
, 0 )) return 0; /* Nothing to do */
2376 DefWindowProc32A (hwnd
, WM_NCPAINT
, wParam
, lParam
);
2378 if (!(hdc
= GetDCEx32( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
))) return 0;
2380 if (ExcludeVisRect( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
2381 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
2382 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
2383 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
2385 ReleaseDC32( hwnd
, hdc
);
2389 if (!(wndPtr
->flags
& WIN_MANAGED
) && !(wndPtr
->dwStyle
& CCS_NODIVIDER
))
2390 DrawEdge32 (hdc
, &wndPtr
->rectWindow
, EDGE_ETCHED
, BF_TOP
);
2392 ReleaseDC32( hwnd
, hdc
);
2398 __inline__
static LRESULT
2399 TOOLBAR_Notify (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2401 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2402 LPNMHDR lpnmh
= (LPNMHDR
)lParam
;
2404 TRACE (toolbar
, "passing WM_NOTIFY!\n");
2406 if ((infoPtr
->hwndToolTip
) && (lpnmh
->hwndFrom
== infoPtr
->hwndToolTip
)) {
2407 SendMessage32A (infoPtr
->hwndNotify
, WM_NOTIFY
, wParam
, lParam
);
2410 if (lpnmh
->code
== TTN_GETDISPINFO32A
) {
2411 LPNMTTDISPINFO32A lpdi
= (LPNMTTDISPINFO32A
)lParam
;
2413 FIXME (toolbar
, "retrieving ASCII string\n");
2416 else if (lpnmh
->code
== TTN_GETDISPINFO32W
) {
2417 LPNMTTDISPINFO32W lpdi
= (LPNMTTDISPINFO32W
)lParam
;
2419 FIXME (toolbar
, "retrieving UNICODE string\n");
2430 TOOLBAR_Paint (WND
*wndPtr
, WPARAM32 wParam
)
2435 hdc
= wParam
==0 ? BeginPaint32 (wndPtr
->hwndSelf
, &ps
) : (HDC32
)wParam
;
2436 TOOLBAR_Refresh (wndPtr
, hdc
);
2438 EndPaint32 (wndPtr
->hwndSelf
, &ps
);
2444 TOOLBAR_Size (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2446 TOOLBAR_INFO
*infoPtr
= TOOLBAR_GetInfoPtr(wndPtr
);
2451 UINT32 uPosFlags
= 0;
2453 /* Resize deadlock check */
2454 if (infoPtr
->bAutoSize
) {
2455 infoPtr
->bAutoSize
= FALSE
;
2459 flags
= (INT32
) wParam
;
2461 /* FIXME for flags =
2462 * SIZE_MAXIMIZED, SIZE_MAXSHOW, SIZE_MINIMIZED
2465 TRACE (toolbar
, "sizing toolbar!\n");
2467 if (flags
== SIZE_RESTORED
) {
2468 /* width and height don't apply */
2469 parent
= GetParent32 (wndPtr
->hwndSelf
);
2470 GetClientRect32(parent
, &parent_rect
);
2472 if (wndPtr
->dwStyle
& CCS_NORESIZE
) {
2473 uPosFlags
|= (SWP_NOSIZE
| SWP_NOMOVE
);
2476 // infoPtr->nWidth = parent_rect.right - parent_rect.left;
2477 cy
= infoPtr
->nHeight
;
2478 cx
= infoPtr
->nWidth
;
2479 TOOLBAR_CalcToolbar (wndPtr
);
2480 infoPtr
->nWidth
= cx
;
2481 infoPtr
->nHeight
= cy
;
2484 infoPtr
->nWidth
= parent_rect
.right
- parent_rect
.left
;
2485 TOOLBAR_CalcToolbar (wndPtr
);
2486 cy
= infoPtr
->nHeight
;
2487 cx
= infoPtr
->nWidth
;
2490 if (wndPtr
->dwStyle
& CCS_NOPARENTALIGN
) {
2491 uPosFlags
|= SWP_NOMOVE
;
2492 cy
= infoPtr
->nHeight
;
2493 cx
= infoPtr
->nWidth
;
2496 if (!(wndPtr
->dwStyle
& CCS_NODIVIDER
))
2497 cy
+= sysMetrics
[SM_CYEDGE
];
2499 SetWindowPos32 (wndPtr
->hwndSelf
, 0, parent_rect
.left
, parent_rect
.top
,
2500 cx
, cy
, uPosFlags
| SWP_NOZORDER
);
2507 TOOLBAR_StyleChanged (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
2511 TOOLBAR_AutoSize (wndPtr
, wParam
, lParam
);
2513 hdc
= GetDC32 (wndPtr
->hwndSelf
);
2514 TOOLBAR_Refresh (wndPtr
, hdc
);
2515 ReleaseDC32 (wndPtr
->hwndSelf
, hdc
);
2523 ToolbarWindowProc (HWND32 hwnd
, UINT32 uMsg
, WPARAM32 wParam
, LPARAM lParam
)
2525 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
2530 return TOOLBAR_AddBitmap (wndPtr
, wParam
, lParam
);
2532 case TB_ADDBUTTONS32A
:
2533 return TOOLBAR_AddButtons32A (wndPtr
, wParam
, lParam
);
2535 // case TB_ADDBUTTONS32W:
2537 case TB_ADDSTRING32A
:
2538 return TOOLBAR_AddString32A (wndPtr
, wParam
, lParam
);
2540 // case TB_ADDSTRING32W:
2543 return TOOLBAR_AutoSize (wndPtr
, wParam
, lParam
);
2545 case TB_BUTTONCOUNT
:
2546 return TOOLBAR_ButtonCount (wndPtr
, wParam
, lParam
);
2548 case TB_BUTTONSTRUCTSIZE
:
2549 return TOOLBAR_ButtonStructSize (wndPtr
, wParam
, lParam
);
2551 case TB_CHANGEBITMAP
:
2552 return TOOLBAR_ChangeBitmap (wndPtr
, wParam
, lParam
);
2554 case TB_CHECKBUTTON
:
2555 return TOOLBAR_CheckButton (wndPtr
, wParam
, lParam
);
2557 case TB_COMMANDTOINDEX
:
2558 return TOOLBAR_CommandToIndex (wndPtr
, wParam
, lParam
);
2561 return TOOLBAR_Customize (wndPtr
);
2563 case TB_DELETEBUTTON
:
2564 return TOOLBAR_DeleteButton (wndPtr
, wParam
, lParam
);
2566 case TB_ENABLEBUTTON
:
2567 return TOOLBAR_EnableButton (wndPtr
, wParam
, lParam
);
2569 // case TB_GETANCHORHIGHLIGHT: /* 4.71 */
2572 return TOOLBAR_GetBitmap (wndPtr
, wParam
, lParam
);
2574 case TB_GETBITMAPFLAGS
:
2575 return TOOLBAR_GetBitmapFlags (wndPtr
, wParam
, lParam
);
2578 return TOOLBAR_GetButton (wndPtr
, wParam
, lParam
);
2580 case TB_GETBUTTONINFO32A
:
2581 return TOOLBAR_GetButtonInfo32A (wndPtr
, wParam
, lParam
);
2583 // case TB_GETBUTTONINFO32W: /* 4.71 */
2585 case TB_GETBUTTONSIZE
:
2586 return TOOLBAR_GetButtonSize (wndPtr
);
2588 case TB_GETBUTTONTEXT32A
:
2589 return TOOLBAR_GetButtonText32A (wndPtr
, wParam
, lParam
);
2591 // case TB_GETBUTTONTEXT32W:
2592 // case TB_GETCOLORSCHEME: /* 4.71 */
2594 case TB_GETDISABLEDIMAGELIST
:
2595 return TOOLBAR_GetDisabledImageList (wndPtr
, wParam
, lParam
);
2597 case TB_GETEXTENDEDSTYLE
:
2598 return TOOLBAR_GetExtendedStyle (wndPtr
);
2600 case TB_GETHOTIMAGELIST
:
2601 return TOOLBAR_GetHotImageList (wndPtr
, wParam
, lParam
);
2603 // case TB_GETHOTITEM: /* 4.71 */
2605 case TB_GETIMAGELIST
:
2606 return TOOLBAR_GetImageList (wndPtr
, wParam
, lParam
);
2608 // case TB_GETINSERTMARK: /* 4.71 */
2609 // case TB_GETINSERTMARKCOLOR: /* 4.71 */
2611 case TB_GETITEMRECT
:
2612 return TOOLBAR_GetItemRect (wndPtr
, wParam
, lParam
);
2615 return TOOLBAR_GetMaxSize (wndPtr
, wParam
, lParam
);
2617 // case TB_GETOBJECT: /* 4.71 */
2618 // case TB_GETPADDING: /* 4.71 */
2621 return TOOLBAR_GetRect (wndPtr
, wParam
, lParam
);
2624 return TOOLBAR_GetRows (wndPtr
, wParam
, lParam
);
2627 return TOOLBAR_GetState (wndPtr
, wParam
, lParam
);
2630 return TOOLBAR_GetStyle (wndPtr
, wParam
, lParam
);
2632 case TB_GETTEXTROWS
:
2633 return TOOLBAR_GetTextRows (wndPtr
, wParam
, lParam
);
2635 case TB_GETTOOLTIPS
:
2636 return TOOLBAR_GetToolTips (wndPtr
, wParam
, lParam
);
2638 case TB_GETUNICODEFORMAT
:
2639 return TOOLBAR_GetUnicodeFormat (wndPtr
, wParam
, lParam
);
2642 return TOOLBAR_HideButton (wndPtr
, wParam
, lParam
);
2645 return TOOLBAR_HitTest (wndPtr
, wParam
, lParam
);
2647 case TB_INDETERMINATE
:
2648 return TOOLBAR_Indeterminate (wndPtr
, wParam
, lParam
);
2650 case TB_INSERTBUTTON32A
:
2651 return TOOLBAR_InsertButton32A (wndPtr
, wParam
, lParam
);
2653 // case TB_INSERTBUTTON32W:
2654 // case TB_INSERTMARKHITTEST: /* 4.71 */
2656 case TB_ISBUTTONCHECKED
:
2657 return TOOLBAR_IsButtonChecked (wndPtr
, wParam
, lParam
);
2659 case TB_ISBUTTONENABLED
:
2660 return TOOLBAR_IsButtonEnabled (wndPtr
, wParam
, lParam
);
2662 case TB_ISBUTTONHIDDEN
:
2663 return TOOLBAR_IsButtonHidden (wndPtr
, wParam
, lParam
);
2665 case TB_ISBUTTONHIGHLIGHTED
:
2666 return TOOLBAR_IsButtonHighlighted (wndPtr
, wParam
, lParam
);
2668 case TB_ISBUTTONINDETERMINATE
:
2669 return TOOLBAR_IsButtonIndeterminate (wndPtr
, wParam
, lParam
);
2671 case TB_ISBUTTONPRESSED
:
2672 return TOOLBAR_IsButtonPressed (wndPtr
, wParam
, lParam
);
2674 // case TB_LOADIMAGES: /* 4.70 */
2675 // case TB_MAPACCELERATOR32A: /* 4.71 */
2676 // case TB_MAPACCELERATOR32W: /* 4.71 */
2677 // case TB_MARKBUTTON: /* 4.71 */
2678 // case TB_MOVEBUTTON: /* 4.71 */
2680 case TB_PRESSBUTTON
:
2681 return TOOLBAR_PressButton (wndPtr
, wParam
, lParam
);
2683 // case TB_REPLACEBITMAP:
2685 case TB_SAVERESTORE32A
:
2686 return TOOLBAR_SaveRestore32A (wndPtr
, wParam
, lParam
);
2688 // case TB_SAVERESTORE32W:
2689 // case TB_SETANCHORHIGHLIGHT: /* 4.71 */
2691 case TB_SETBITMAPSIZE
:
2692 return TOOLBAR_SetBitmapSize (wndPtr
, wParam
, lParam
);
2694 case TB_SETBUTTONINFO32A
:
2695 return TOOLBAR_SetButtonInfo32A (wndPtr
, wParam
, lParam
);
2697 // case TB_SETBUTTONINFO32W: /* 4.71 */
2699 case TB_SETBUTTONSIZE
:
2700 return TOOLBAR_SetButtonSize (wndPtr
, wParam
, lParam
);
2702 case TB_SETBUTTONWIDTH
:
2703 return TOOLBAR_SetButtonWidth (wndPtr
, wParam
, lParam
);
2706 return TOOLBAR_SetCmdId (wndPtr
, wParam
, lParam
);
2708 // case TB_SETCOLORSCHEME: /* 4.71 */
2710 case TB_SETDISABLEDIMAGELIST
:
2711 return TOOLBAR_SetDisabledImageList (wndPtr
, wParam
, lParam
);
2713 case TB_SETDRAWTEXTFLAGS
:
2714 return TOOLBAR_SetDrawTextFlags (wndPtr
, wParam
, lParam
);
2716 case TB_SETEXTENDEDSTYLE
:
2717 return TOOLBAR_SetExtendedStyle (wndPtr
, wParam
, lParam
);
2719 case TB_SETHOTIMAGELIST
:
2720 return TOOLBAR_SetHotImageList (wndPtr
, wParam
, lParam
);
2722 // case TB_SETHOTITEM: /* 4.71 */
2724 case TB_SETIMAGELIST
:
2725 return TOOLBAR_SetImageList (wndPtr
, wParam
, lParam
);
2728 return TOOLBAR_SetIndent (wndPtr
, wParam
, lParam
);
2730 // case TB_SETINSERTMARK: /* 4.71 */
2732 case TB_SETINSERTMARKCOLOR
:
2733 return TOOLBAR_SetInsertMarkColor (wndPtr
, wParam
, lParam
);
2735 case TB_SETMAXTEXTROWS
:
2736 return TOOLBAR_SetMaxTextRows (wndPtr
, wParam
, lParam
);
2738 // case TB_SETPADDING: /* 4.71 */
2741 return TOOLBAR_SetParent (wndPtr
, wParam
, lParam
);
2744 return TOOLBAR_SetRows (wndPtr
, wParam
, lParam
);
2747 return TOOLBAR_SetState (wndPtr
, wParam
, lParam
);
2750 return TOOLBAR_SetStyle (wndPtr
, wParam
, lParam
);
2752 case TB_SETTOOLTIPS
:
2753 return TOOLBAR_SetToolTips (wndPtr
, wParam
, lParam
);
2755 case TB_SETUNICODEFORMAT
:
2756 return TOOLBAR_SetUnicodeFormat (wndPtr
, wParam
, lParam
);
2762 return TOOLBAR_Create (wndPtr
, wParam
, lParam
);
2765 return TOOLBAR_Destroy (wndPtr
, wParam
, lParam
);
2768 return TOOLBAR_EraseBackground (wndPtr
, wParam
, lParam
);
2772 // case WM_KILLFOCUS:
2774 case WM_LBUTTONDBLCLK
:
2775 return TOOLBAR_LButtonDblClk (wndPtr
, wParam
, lParam
);
2777 case WM_LBUTTONDOWN
:
2778 return TOOLBAR_LButtonDown (wndPtr
, wParam
, lParam
);
2781 return TOOLBAR_LButtonUp (wndPtr
, wParam
, lParam
);
2784 return TOOLBAR_MouseMove (wndPtr
, wParam
, lParam
);
2787 return TOOLBAR_NCActivate (wndPtr
, wParam
, lParam
);
2790 return TOOLBAR_NCCalcSize (wndPtr
, wParam
, lParam
);
2793 return TOOLBAR_NCCreate (wndPtr
, wParam
, lParam
);
2796 return TOOLBAR_NCPaint (wndPtr
, wParam
, lParam
);
2799 return TOOLBAR_Notify (wndPtr
, wParam
, lParam
);
2801 // case WM_NOTIFYFORMAT:
2804 return TOOLBAR_Paint (wndPtr
, wParam
);
2807 return TOOLBAR_Size (wndPtr
, wParam
, lParam
);
2809 case WM_STYLECHANGED
:
2810 return TOOLBAR_StyleChanged (wndPtr
, wParam
, lParam
);
2812 // case WM_SYSCOLORCHANGE:
2814 // case WM_WININICHANGE:
2819 case WM_MEASUREITEM
:
2821 return SendMessage32A (GetParent32 (hwnd
), uMsg
, wParam
, lParam
);
2824 if (uMsg
>= WM_USER
)
2825 ERR (toolbar
, "unknown msg %04x wp=%08x lp=%08lx\n",
2826 uMsg
, wParam
, lParam
);
2827 return DefWindowProc32A (hwnd
, uMsg
, wParam
, lParam
);
2833 void TOOLBAR_Register (void)
2835 WNDCLASS32A wndClass
;
2837 if (GlobalFindAtom32A (TOOLBARCLASSNAME32A
)) return;
2839 ZeroMemory (&wndClass
, sizeof(WNDCLASS32A
));
2840 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
2841 wndClass
.lpfnWndProc
= (WNDPROC32
)ToolbarWindowProc
;
2842 wndClass
.cbClsExtra
= 0;
2843 wndClass
.cbWndExtra
= sizeof(TOOLBAR_INFO
*);
2844 wndClass
.hCursor
= LoadCursor32A (0, IDC_ARROW32A
);
2845 wndClass
.hbrBackground
= (HBRUSH32
)(COLOR_3DFACE
+ 1);
2846 wndClass
.lpszClassName
= TOOLBARCLASSNAME32A
;
2848 RegisterClass32A (&wndClass
);