4 * Copyright 1998, 1999 Eric Kohl
5 * Copyright 1998, 1999 Alex Priem
6 * Copyright 2002 Dimitrie O. Paun
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 * This code was audited for completeness against the documented features
25 * of Comctl32.dll version 6.0 on Sep. 12, 2002, by Dimitrie O. Paun.
27 * Unless otherwise noted, we believe this code to be complete, as per
28 * the specification mentioned above.
29 * If you discover missing features, or bugs, please note them below.
46 #include "wine/debug.h"
50 WINE_DEFAULT_DEBUG_CHANNEL(trackbar
);
79 #define TB_REFRESH_TIMER 1
80 #define TB_REFRESH_DELAY 500
82 #define TOOLTIP_OFFSET 2 /* distance from ctrl edge to tooltip */
84 /* Used by TRACKBAR_Refresh to find out which parts of the control
85 need to be recalculated */
87 #define TB_THUMBPOSCHANGED 1
88 #define TB_THUMBSIZECHANGED 2
89 #define TB_THUMBCHANGED (TB_THUMBPOSCHANGED | TB_THUMBSIZECHANGED)
90 #define TB_SELECTIONCHANGED 4
91 #define TB_DRAG_MODE 8 /* we're dragging the slider */
92 #define TB_AUTO_PAGE_LEFT 16
93 #define TB_AUTO_PAGE_RIGHT 32
94 #define TB_AUTO_PAGE (TB_AUTO_PAGE_LEFT | TB_AUTO_PAGE_RIGHT)
95 #define TB_THUMB_HOT 64 /* mouse hovers above thumb */
97 /* helper defines for TRACKBAR_DrawTic */
99 #define TIC_SELECTIONMARKMAX 0x80
100 #define TIC_SELECTIONMARKMIN 0x100
101 #define TIC_SELECTIONMARK (TIC_SELECTIONMARKMAX | TIC_SELECTIONMARKMIN)
103 static const WCHAR themeClass
[] = { 'T','r','a','c','k','b','a','r',0 };
106 notify_customdraw (const TRACKBAR_INFO
*infoPtr
, NMCUSTOMDRAW
*pnmcd
, int stage
)
108 pnmcd
->dwDrawStage
= stage
;
109 return SendMessageW (infoPtr
->hwndNotify
, WM_NOTIFY
,
110 pnmcd
->hdr
.idFrom
, (LPARAM
)pnmcd
);
113 static LRESULT
notify_hdr (const TRACKBAR_INFO
*infoPtr
, INT code
, LPNMHDR pnmh
)
117 TRACE("(code=%d)\n", code
);
119 pnmh
->hwndFrom
= infoPtr
->hwndSelf
;
120 pnmh
->idFrom
= GetWindowLongPtrW(infoPtr
->hwndSelf
, GWLP_ID
);
122 result
= SendMessageW(infoPtr
->hwndNotify
, WM_NOTIFY
, pnmh
->idFrom
, (LPARAM
)pnmh
);
124 TRACE(" <= %ld\n", result
);
129 static inline int notify (const TRACKBAR_INFO
*infoPtr
, INT code
)
132 return notify_hdr(infoPtr
, code
, &nmh
);
136 notify_with_scroll (const TRACKBAR_INFO
*infoPtr
, UINT code
)
138 BOOL bVert
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_VERT
;
142 return (BOOL
) SendMessageW (infoPtr
->hwndNotify
,
143 bVert
? WM_VSCROLL
: WM_HSCROLL
,
144 (WPARAM
)code
, (LPARAM
)infoPtr
->hwndSelf
);
147 static void TRACKBAR_RecalculateTics (TRACKBAR_INFO
*infoPtr
)
151 if (infoPtr
->uTicFreq
&& infoPtr
->lRangeMax
>= infoPtr
->lRangeMin
)
152 nrTics
=(infoPtr
->lRangeMax
- infoPtr
->lRangeMin
)/infoPtr
->uTicFreq
;
155 Free (infoPtr
->tics
);
156 infoPtr
->tics
= NULL
;
157 infoPtr
->uNumTics
= 0;
161 if (nrTics
!= infoPtr
->uNumTics
) {
162 infoPtr
->tics
=ReAlloc (infoPtr
->tics
,
163 (nrTics
+1)*sizeof (DWORD
));
164 if (!infoPtr
->tics
) {
165 infoPtr
->uNumTics
= 0;
166 notify(infoPtr
, NM_OUTOFMEMORY
);
169 infoPtr
->uNumTics
= nrTics
;
172 tic
= infoPtr
->lRangeMin
+ infoPtr
->uTicFreq
;
173 for (i
= 0; i
< nrTics
; i
++, tic
+= infoPtr
->uTicFreq
)
174 infoPtr
->tics
[i
] = tic
;
177 /* converts from physical (mouse) position to logical position
178 (in range of trackbar) */
181 TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO
*infoPtr
, int place
, int vertical
)
183 double range
, width
, pos
, offsetthumb
;
185 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
187 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
188 width
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- (offsetthumb
* 2) - 1;
189 pos
= (range
*(place
- infoPtr
->rcChannel
.top
- offsetthumb
)) / width
;
191 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
192 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- (offsetthumb
* 2) - 1;
193 pos
= (range
*(place
- infoPtr
->rcChannel
.left
- offsetthumb
)) / width
;
195 pos
+= infoPtr
->lRangeMin
;
196 if (pos
> infoPtr
->lRangeMax
)
197 pos
= infoPtr
->lRangeMax
;
198 else if (pos
< infoPtr
->lRangeMin
)
199 pos
= infoPtr
->lRangeMin
;
201 TRACE("%.2f\n", pos
);
202 return (LONG
)(pos
+ 0.5);
206 /* return: 0> prev, 0 none, >0 next */
208 TRACKBAR_GetAutoPageDirection (const TRACKBAR_INFO
*infoPtr
, POINT clickPoint
)
210 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
213 if (dwStyle
& TBS_VERT
) {
214 pageRect
.top
= infoPtr
->rcChannel
.top
;
215 pageRect
.bottom
= infoPtr
->rcChannel
.bottom
;
216 pageRect
.left
= infoPtr
->rcThumb
.left
;
217 pageRect
.right
= infoPtr
->rcThumb
.right
;
219 pageRect
.top
= infoPtr
->rcThumb
.top
;
220 pageRect
.bottom
= infoPtr
->rcThumb
.bottom
;
221 pageRect
.left
= infoPtr
->rcChannel
.left
;
222 pageRect
.right
= infoPtr
->rcChannel
.right
;
226 if (PtInRect(&pageRect
, clickPoint
))
228 int clickPlace
= (dwStyle
& TBS_VERT
) ? clickPoint
.y
: clickPoint
.x
;
230 LONG clickPos
= TRACKBAR_ConvertPlaceToPosition(infoPtr
, clickPlace
,
232 return clickPos
- infoPtr
->lPos
;
239 TRACKBAR_PageDown (TRACKBAR_INFO
*infoPtr
)
241 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return;
243 infoPtr
->lPos
+= infoPtr
->lPageSize
;
244 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
245 infoPtr
->lPos
= infoPtr
->lRangeMax
;
246 notify_with_scroll (infoPtr
, TB_PAGEDOWN
);
251 TRACKBAR_PageUp (TRACKBAR_INFO
*infoPtr
)
253 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return;
255 infoPtr
->lPos
-= infoPtr
->lPageSize
;
256 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
257 infoPtr
->lPos
= infoPtr
->lRangeMin
;
258 notify_with_scroll (infoPtr
, TB_PAGEUP
);
261 static inline void TRACKBAR_LineUp(TRACKBAR_INFO
*infoPtr
)
263 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return;
264 infoPtr
->lPos
-= infoPtr
->lLineSize
;
265 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
266 infoPtr
->lPos
= infoPtr
->lRangeMin
;
267 notify_with_scroll (infoPtr
, TB_LINEUP
);
270 static inline void TRACKBAR_LineDown(TRACKBAR_INFO
*infoPtr
)
272 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return;
273 infoPtr
->lPos
+= infoPtr
->lLineSize
;
274 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
275 infoPtr
->lPos
= infoPtr
->lRangeMax
;
276 notify_with_scroll (infoPtr
, TB_LINEDOWN
);
280 TRACKBAR_CalcChannel (TRACKBAR_INFO
*infoPtr
)
282 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
283 INT cyChannel
, offsetthumb
, offsetedge
;
284 RECT lpRect
, *channel
= & infoPtr
->rcChannel
;
286 GetClientRect (infoPtr
->hwndSelf
, &lpRect
);
288 offsetthumb
= infoPtr
->uThumbLen
/ 4;
289 offsetedge
= offsetthumb
+ 3;
290 cyChannel
= (dwStyle
& TBS_ENABLESELRANGE
) ? offsetthumb
*3 : 4;
291 if (dwStyle
& TBS_VERT
) {
292 channel
->top
= lpRect
.top
+ offsetedge
;
293 channel
->bottom
= lpRect
.bottom
- offsetedge
;
294 if (dwStyle
& TBS_ENABLESELRANGE
)
295 channel
->left
= lpRect
.left
+ ((infoPtr
->uThumbLen
- cyChannel
+ 2) / 2);
297 channel
->left
= lpRect
.left
+ (infoPtr
->uThumbLen
/ 2) - 1;
298 if (dwStyle
& TBS_BOTH
) {
299 if (dwStyle
& TBS_NOTICKS
)
304 else if (dwStyle
& TBS_TOP
) {
305 if (dwStyle
& TBS_NOTICKS
)
310 channel
->right
= channel
->left
+ cyChannel
;
312 channel
->left
= lpRect
.left
+ offsetedge
;
313 channel
->right
= lpRect
.right
- offsetedge
;
314 if (dwStyle
& TBS_ENABLESELRANGE
)
315 channel
->top
= lpRect
.top
+ ((infoPtr
->uThumbLen
- cyChannel
+ 2) / 2);
317 channel
->top
= lpRect
.top
+ (infoPtr
->uThumbLen
/ 2) - 1;
318 if (dwStyle
& TBS_BOTH
) {
319 if (dwStyle
& TBS_NOTICKS
)
324 else if (dwStyle
& TBS_TOP
) {
325 if (dwStyle
& TBS_NOTICKS
)
330 channel
->bottom
= channel
->top
+ cyChannel
;
335 TRACKBAR_CalcThumb (const TRACKBAR_INFO
*infoPtr
, LONG lPos
, RECT
*thumb
)
337 int range
, width
, height
, thumbwidth
;
338 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
341 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
342 thumbwidth
= (infoPtr
->uThumbLen
/ 2) | 1;
344 if (!range
) range
= 1;
346 GetClientRect(infoPtr
->hwndSelf
, &lpRect
);
347 if (dwStyle
& TBS_VERT
)
349 height
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- thumbwidth
;
351 if ((dwStyle
& (TBS_BOTH
| TBS_LEFT
)) && !(dwStyle
& TBS_NOTICKS
))
355 thumb
->right
= thumb
->left
+ infoPtr
->uThumbLen
;
356 thumb
->top
= infoPtr
->rcChannel
.top
+
357 (height
*(lPos
- infoPtr
->lRangeMin
))/range
;
358 thumb
->bottom
= thumb
->top
+ thumbwidth
;
362 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- thumbwidth
;
364 thumb
->left
= infoPtr
->rcChannel
.left
+
365 (width
*(lPos
- infoPtr
->lRangeMin
))/range
;
366 thumb
->right
= thumb
->left
+ thumbwidth
;
367 if ((dwStyle
& (TBS_BOTH
| TBS_TOP
)) && !(dwStyle
& TBS_NOTICKS
))
371 thumb
->bottom
= thumb
->top
+ infoPtr
->uThumbLen
;
376 TRACKBAR_UpdateThumb (TRACKBAR_INFO
*infoPtr
)
378 TRACKBAR_CalcThumb(infoPtr
, infoPtr
->lPos
, &infoPtr
->rcThumb
);
382 TRACKBAR_InvalidateAll (const TRACKBAR_INFO
*infoPtr
)
384 InvalidateRect(infoPtr
->hwndSelf
, NULL
, FALSE
);
388 TRACKBAR_InvalidateThumb (const TRACKBAR_INFO
*infoPtr
, LONG thumbPos
)
392 TRACKBAR_CalcThumb(infoPtr
, thumbPos
, &rcThumb
);
393 InflateRect(&rcThumb
, 1, 1);
394 InvalidateRect(infoPtr
->hwndSelf
, &rcThumb
, FALSE
);
398 TRACKBAR_InvalidateThumbMove (const TRACKBAR_INFO
*infoPtr
, LONG oldPos
, LONG newPos
)
400 TRACKBAR_InvalidateThumb (infoPtr
, oldPos
);
401 if (newPos
!= oldPos
)
402 TRACKBAR_InvalidateThumb (infoPtr
, newPos
);
406 TRACKBAR_HasSelection (const TRACKBAR_INFO
*infoPtr
)
408 return infoPtr
->lSelMin
!= infoPtr
->lSelMax
;
412 TRACKBAR_CalcSelection (TRACKBAR_INFO
*infoPtr
)
414 RECT
*selection
= &infoPtr
->rcSelection
;
415 int range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
416 int offsetthumb
, height
, width
;
419 SetRectEmpty (selection
);
421 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_VERT
) {
422 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
423 height
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- offsetthumb
*2;
424 selection
->top
= infoPtr
->rcChannel
.top
+ offsetthumb
+
425 (height
*infoPtr
->lSelMin
)/range
;
426 selection
->bottom
= infoPtr
->rcChannel
.top
+ offsetthumb
+
427 (height
*infoPtr
->lSelMax
)/range
;
428 selection
->left
= infoPtr
->rcChannel
.left
+ 3;
429 selection
->right
= infoPtr
->rcChannel
.right
- 3;
431 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
432 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- offsetthumb
*2;
433 selection
->left
= infoPtr
->rcChannel
.left
+ offsetthumb
+
434 (width
*infoPtr
->lSelMin
)/range
;
435 selection
->right
= infoPtr
->rcChannel
.left
+ offsetthumb
+
436 (width
*infoPtr
->lSelMax
)/range
;
437 selection
->top
= infoPtr
->rcChannel
.top
+ 3;
438 selection
->bottom
= infoPtr
->rcChannel
.bottom
- 3;
442 TRACE("selection[left=%d, top=%d, right=%d, bottom=%d]\n",
443 selection
->left
, selection
->top
, selection
->right
, selection
->bottom
);
447 TRACKBAR_AutoPage (TRACKBAR_INFO
*infoPtr
, POINT clickPoint
)
449 LONG dir
= TRACKBAR_GetAutoPageDirection(infoPtr
, clickPoint
);
450 LONG prevPos
= infoPtr
->lPos
;
452 TRACE("x=%d, y=%d, dir=%d\n", clickPoint
.x
, clickPoint
.y
, dir
);
454 if (dir
> 0 && (infoPtr
->flags
& TB_AUTO_PAGE_RIGHT
))
455 TRACKBAR_PageDown(infoPtr
);
456 else if (dir
< 0 && (infoPtr
->flags
& TB_AUTO_PAGE_LEFT
))
457 TRACKBAR_PageUp(infoPtr
);
460 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
461 TRACKBAR_InvalidateThumbMove (infoPtr
, prevPos
, infoPtr
->lPos
);
466 /* Trackbar drawing code. I like my spaghetti done milanese. */
469 TRACKBAR_DrawChannel (const TRACKBAR_INFO
*infoPtr
, HDC hdc
, DWORD dwStyle
)
471 RECT rcChannel
= infoPtr
->rcChannel
;
472 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
476 DrawThemeBackground (theme
, hdc
,
477 (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_VERT
) ?
478 TKP_TRACKVERT
: TKP_TRACK
, TKS_NORMAL
, &rcChannel
, 0);
482 DrawEdge (hdc
, &rcChannel
, EDGE_SUNKEN
, BF_RECT
| BF_ADJUST
);
483 if (dwStyle
& TBS_ENABLESELRANGE
) { /* fill the channel */
484 FillRect (hdc
, &rcChannel
, GetStockObject(WHITE_BRUSH
));
485 if (TRACKBAR_HasSelection(infoPtr
))
486 FillRect (hdc
, &infoPtr
->rcSelection
, GetSysColorBrush(COLOR_HIGHLIGHT
));
492 TRACKBAR_DrawOneTic (const TRACKBAR_INFO
*infoPtr
, HDC hdc
, LONG ticPos
, int flags
)
494 int x
, y
, ox
, oy
, range
, side
, indent
= 0, len
= 3;
498 if (flags
& TBS_VERT
) {
499 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
500 rcTics
.left
= infoPtr
->rcThumb
.left
- 2;
501 rcTics
.right
= infoPtr
->rcThumb
.right
+ 2;
502 rcTics
.top
= infoPtr
->rcChannel
.top
+ offsetthumb
+ 1;
503 rcTics
.bottom
= infoPtr
->rcChannel
.bottom
- offsetthumb
;
505 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
506 rcTics
.left
= infoPtr
->rcChannel
.left
+ offsetthumb
+ 1;
507 rcTics
.right
= infoPtr
->rcChannel
.right
- offsetthumb
;
508 rcTics
.top
= infoPtr
->rcThumb
.top
- 2;
509 rcTics
.bottom
= infoPtr
->rcThumb
.bottom
+ 2;
512 if (flags
& (TBS_TOP
| TBS_LEFT
)) {
522 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
524 range
= 1; /* to avoid division by zero */
526 if (flags
& TIC_SELECTIONMARK
) {
527 indent
= (flags
& TIC_SELECTIONMARKMIN
) ? -1 : 1;
528 } else if (flags
& TIC_EDGE
) {
532 if (flags
& TBS_VERT
) {
533 int height
= rcTics
.bottom
- rcTics
.top
;
534 y
= rcTics
.top
+ (height
*(ticPos
- infoPtr
->lRangeMin
))/range
;
536 int width
= rcTics
.right
- rcTics
.left
;
537 x
= rcTics
.left
+ (width
*(ticPos
- infoPtr
->lRangeMin
))/range
;
542 MoveToEx(hdc
, x
, y
, 0);
543 if (flags
& TBS_VERT
) x
+= len
* side
;
544 else y
+= len
* side
;
547 if (flags
& TIC_SELECTIONMARK
) {
548 if (flags
& TBS_VERT
) {
553 MoveToEx(hdc
, x
, y
, 0);
554 if (flags
& TBS_VERT
) {
567 TRACKBAR_DrawTic (const TRACKBAR_INFO
*infoPtr
, HDC hdc
, LONG ticPos
, int flags
)
569 if ((flags
& (TBS_LEFT
| TBS_TOP
)) || (flags
& TBS_BOTH
))
570 TRACKBAR_DrawOneTic (infoPtr
, hdc
, ticPos
, flags
| TBS_LEFT
);
572 if (!(flags
& (TBS_LEFT
| TBS_TOP
)) || (flags
& TBS_BOTH
))
573 TRACKBAR_DrawOneTic (infoPtr
, hdc
, ticPos
, flags
& ~TBS_LEFT
);
577 TRACKBAR_DrawTics (const TRACKBAR_INFO
*infoPtr
, HDC hdc
, DWORD dwStyle
)
580 int ticFlags
= dwStyle
& 0x0f;
581 LOGPEN ticPen
= { PS_SOLID
, {1, 0}, GetSysColor (COLOR_3DDKSHADOW
) };
582 HPEN hOldPen
, hTicPen
;
583 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
587 int part
= (dwStyle
& TBS_VERT
) ? TKP_TICSVERT
: TKP_TICS
;
588 GetThemeColor (theme
, part
, TSS_NORMAL
, TMT_COLOR
, &ticPen
.lopnColor
);
590 /* create the pen to draw the tics with */
591 hTicPen
= CreatePenIndirect(&ticPen
);
592 hOldPen
= hTicPen
? SelectObject(hdc
, hTicPen
) : 0;
594 /* actually draw the tics */
595 for (i
=0; i
<infoPtr
->uNumTics
; i
++)
596 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->tics
[i
], ticFlags
);
598 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lRangeMin
, ticFlags
| TIC_EDGE
);
599 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lRangeMax
, ticFlags
| TIC_EDGE
);
601 if ((dwStyle
& TBS_ENABLESELRANGE
) && TRACKBAR_HasSelection(infoPtr
)) {
602 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lSelMin
,
603 ticFlags
| TIC_SELECTIONMARKMIN
);
604 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lSelMax
,
605 ticFlags
| TIC_SELECTIONMARKMAX
);
608 /* clean up the pen, if we created one */
610 SelectObject(hdc
, hOldPen
);
611 DeleteObject(hTicPen
);
616 TRACKBAR_DrawThumb (const TRACKBAR_INFO
*infoPtr
, HDC hdc
, DWORD dwStyle
)
620 RECT thumb
= infoPtr
->rcThumb
;
626 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
632 if (dwStyle
& TBS_BOTH
)
633 partId
= (dwStyle
& TBS_VERT
) ? TKP_THUMBVERT
: TKP_THUMB
;
634 else if (dwStyle
& TBS_LEFT
)
635 partId
= (dwStyle
& TBS_VERT
) ? TKP_THUMBLEFT
: TKP_THUMBTOP
;
637 partId
= (dwStyle
& TBS_VERT
) ? TKP_THUMBRIGHT
: TKP_THUMBBOTTOM
;
639 if (dwStyle
& WS_DISABLED
)
640 stateId
= TUS_DISABLED
;
641 else if (infoPtr
->flags
& TB_DRAG_MODE
)
642 stateId
= TUS_PRESSED
;
643 else if (infoPtr
->flags
& TB_THUMB_HOT
)
646 stateId
= TUS_NORMAL
;
648 DrawThemeBackground (theme
, hdc
, partId
, stateId
, &thumb
, 0);
653 fillClr
= infoPtr
->flags
& TB_DRAG_MODE
? COLOR_BTNHILIGHT
: COLOR_BTNFACE
;
654 oldbr
= SelectObject (hdc
, GetSysColorBrush(fillClr
));
655 SetPolyFillMode (hdc
, WINDING
);
657 if (dwStyle
& TBS_BOTH
)
659 points
[0].x
=thumb
.right
;
660 points
[0].y
=thumb
.top
;
661 points
[1].x
=thumb
.right
;
662 points
[1].y
=thumb
.bottom
;
663 points
[2].x
=thumb
.left
;
664 points
[2].y
=thumb
.bottom
;
665 points
[3].x
=thumb
.left
;
666 points
[3].y
=thumb
.top
;
667 points
[4].x
=points
[0].x
;
668 points
[4].y
=points
[0].y
;
674 if (dwStyle
& TBS_VERT
)
676 PointDepth
= (thumb
.bottom
- thumb
.top
) / 2;
677 if (dwStyle
& TBS_LEFT
)
679 points
[0].x
=thumb
.right
;
680 points
[0].y
=thumb
.top
;
681 points
[1].x
=thumb
.right
;
682 points
[1].y
=thumb
.bottom
;
683 points
[2].x
=thumb
.left
+ PointDepth
;
684 points
[2].y
=thumb
.bottom
;
685 points
[3].x
=thumb
.left
;
686 points
[3].y
=(thumb
.bottom
- thumb
.top
) / 2 + thumb
.top
+ 1;
687 points
[4].x
=thumb
.left
+ PointDepth
;
688 points
[4].y
=thumb
.top
;
689 points
[5].x
=points
[0].x
;
690 points
[5].y
=points
[0].y
;
695 points
[0].x
=thumb
.right
;
696 points
[0].y
=(thumb
.bottom
- thumb
.top
) / 2 + thumb
.top
+ 1;
697 points
[1].x
=thumb
.right
- PointDepth
;
698 points
[1].y
=thumb
.bottom
;
699 points
[2].x
=thumb
.left
;
700 points
[2].y
=thumb
.bottom
;
701 points
[3].x
=thumb
.left
;
702 points
[3].y
=thumb
.top
;
703 points
[4].x
=thumb
.right
- PointDepth
;
704 points
[4].y
=thumb
.top
;
705 points
[5].x
=points
[0].x
;
706 points
[5].y
=points
[0].y
;
711 PointDepth
= (thumb
.right
- thumb
.left
) / 2;
712 if (dwStyle
& TBS_TOP
)
714 points
[0].x
=(thumb
.right
- thumb
.left
) / 2 + thumb
.left
+ 1;
715 points
[0].y
=thumb
.top
;
716 points
[1].x
=thumb
.right
;
717 points
[1].y
=thumb
.top
+ PointDepth
;
718 points
[2].x
=thumb
.right
;
719 points
[2].y
=thumb
.bottom
;
720 points
[3].x
=thumb
.left
;
721 points
[3].y
=thumb
.bottom
;
722 points
[4].x
=thumb
.left
;
723 points
[4].y
=thumb
.top
+ PointDepth
;
724 points
[5].x
=points
[0].x
;
725 points
[5].y
=points
[0].y
;
730 points
[0].x
=thumb
.right
;
731 points
[0].y
=thumb
.top
;
732 points
[1].x
=thumb
.right
;
733 points
[1].y
=thumb
.bottom
- PointDepth
;
734 points
[2].x
=(thumb
.right
- thumb
.left
) / 2 + thumb
.left
+ 1;
735 points
[2].y
=thumb
.bottom
;
736 points
[3].x
=thumb
.left
;
737 points
[3].y
=thumb
.bottom
- PointDepth
;
738 points
[4].x
=thumb
.left
;
739 points
[4].y
=thumb
.top
;
740 points
[5].x
=points
[0].x
;
741 points
[5].y
=points
[0].y
;
747 /* Draw the thumb now */
748 Polygon (hdc
, points
, PointCount
);
749 oldpen
= SelectObject(hdc
, GetStockObject(BLACK_PEN
));
750 Polyline(hdc
,points
, BlackUntil
);
751 SelectObject(hdc
, GetStockObject(WHITE_PEN
));
752 Polyline(hdc
, &points
[BlackUntil
-1], PointCount
+1-BlackUntil
);
753 SelectObject(hdc
, oldpen
);
754 SelectObject(hdc
, oldbr
);
759 TRACKBAR_ActivateToolTip (const TRACKBAR_INFO
*infoPtr
, BOOL fShow
)
763 if (!infoPtr
->hwndToolTip
) return;
765 ZeroMemory(&ti
, sizeof(ti
));
766 ti
.cbSize
= sizeof(ti
);
767 ti
.hwnd
= infoPtr
->hwndSelf
;
769 SendMessageW (infoPtr
->hwndToolTip
, TTM_TRACKACTIVATE
, fShow
, (LPARAM
)&ti
);
774 TRACKBAR_UpdateToolTip (const TRACKBAR_INFO
*infoPtr
)
776 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
778 static const WCHAR fmt
[] = { '%', 'l', 'd', 0 };
784 if (!infoPtr
->hwndToolTip
) return;
786 ZeroMemory(&ti
, sizeof(ti
));
787 ti
.cbSize
= sizeof(ti
);
788 ti
.hwnd
= infoPtr
->hwndSelf
;
789 ti
.uFlags
= TTF_IDISHWND
| TTF_TRACK
| TTF_ABSOLUTE
;
791 wsprintfW (buf
, fmt
, infoPtr
->lPos
);
793 SendMessageW (infoPtr
->hwndToolTip
, TTM_UPDATETIPTEXTW
, 0, (LPARAM
)&ti
);
795 GetClientRect (infoPtr
->hwndSelf
, &rcClient
);
796 size
= SendMessageW (infoPtr
->hwndToolTip
, TTM_GETBUBBLESIZE
, 0, (LPARAM
)&ti
);
797 if (dwStyle
& TBS_VERT
) {
798 if (infoPtr
->fLocation
== TBTS_LEFT
)
799 pt
.x
= 0 - LOWORD(size
) - TOOLTIP_OFFSET
;
801 pt
.x
= rcClient
.right
+ TOOLTIP_OFFSET
;
802 pt
.y
= (infoPtr
->rcThumb
.top
+ infoPtr
->rcThumb
.bottom
- HIWORD(size
))/2;
804 if (infoPtr
->fLocation
== TBTS_TOP
)
805 pt
.y
= 0 - HIWORD(size
) - TOOLTIP_OFFSET
;
807 pt
.y
= rcClient
.bottom
+ TOOLTIP_OFFSET
;
808 pt
.x
= (infoPtr
->rcThumb
.left
+ infoPtr
->rcThumb
.right
- LOWORD(size
))/2;
810 ClientToScreen(infoPtr
->hwndSelf
, &pt
);
812 SendMessageW (infoPtr
->hwndToolTip
, TTM_TRACKPOSITION
,
813 0, MAKELPARAM(pt
.x
, pt
.y
));
818 TRACKBAR_Refresh (TRACKBAR_INFO
*infoPtr
, HDC hdcDst
)
820 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
823 HBITMAP hOldBmp
= 0, hOffScreenBmp
= 0;
828 if (infoPtr
->flags
& TB_THUMBCHANGED
) {
829 TRACKBAR_UpdateThumb (infoPtr
);
830 if (infoPtr
->flags
& TB_THUMBSIZECHANGED
)
831 TRACKBAR_CalcChannel (infoPtr
);
833 if (infoPtr
->flags
& TB_SELECTIONCHANGED
)
834 TRACKBAR_CalcSelection (infoPtr
);
836 if (infoPtr
->flags
& TB_DRAG_MODE
)
837 TRACKBAR_UpdateToolTip (infoPtr
);
839 infoPtr
->flags
&= ~ (TB_THUMBCHANGED
| TB_SELECTIONCHANGED
);
841 GetClientRect (infoPtr
->hwndSelf
, &rcClient
);
843 /* try to render offscreen, if we fail, carrry onscreen */
844 hdc
= CreateCompatibleDC(hdcDst
);
846 hOffScreenBmp
= CreateCompatibleBitmap(hdcDst
, rcClient
.right
, rcClient
.bottom
);
848 hOldBmp
= SelectObject(hdc
, hOffScreenBmp
);
857 ZeroMemory(&nmcd
, sizeof(nmcd
));
858 nmcd
.hdr
.hwndFrom
= infoPtr
->hwndSelf
;
859 nmcd
.hdr
.idFrom
= GetWindowLongPtrW (infoPtr
->hwndSelf
, GWLP_ID
);
860 nmcd
.hdr
.code
= NM_CUSTOMDRAW
;
863 /* start the paint cycle */
865 gcdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_PREPAINT
);
866 if (gcdrf
& CDRF_SKIPDEFAULT
) goto cleanup
;
868 /* Erase background */
869 if (gcdrf
== CDRF_DODEFAULT
||
870 notify_customdraw(infoPtr
, &nmcd
, CDDS_PREERASE
) != CDRF_SKIPDEFAULT
) {
871 if ((theme
= GetWindowTheme (infoPtr
->hwndSelf
))) {
872 DrawThemeBackground (theme
, hdc
,
873 (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_VERT
) ?
874 TKP_TRACKVERT
: TKP_TRACK
, TKS_NORMAL
, &rcClient
, 0);
875 DrawThemeParentBackground (infoPtr
->hwndSelf
, hdc
, &rcClient
);
878 FillRect (hdc
, &rcClient
, GetSysColorBrush(COLOR_BTNFACE
));
879 if (gcdrf
!= CDRF_DODEFAULT
)
880 notify_customdraw(infoPtr
, &nmcd
, CDDS_POSTERASE
);
884 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
885 nmcd
.dwItemSpec
= TBCD_CHANNEL
;
886 nmcd
.uItemState
= CDIS_DEFAULT
;
887 nmcd
.rc
= infoPtr
->rcChannel
;
888 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
889 } else icdrf
= CDRF_DODEFAULT
;
890 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
891 TRACKBAR_DrawChannel (infoPtr
, hdc
, dwStyle
);
892 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
893 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
898 if (!(dwStyle
& TBS_NOTICKS
)) {
899 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
900 nmcd
.dwItemSpec
= TBCD_TICS
;
901 nmcd
.uItemState
= CDIS_DEFAULT
;
903 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
904 } else icdrf
= CDRF_DODEFAULT
;
905 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
906 TRACKBAR_DrawTics (infoPtr
, hdc
, dwStyle
);
907 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
908 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
913 if (!(dwStyle
& TBS_NOTHUMB
)) {
914 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
915 nmcd
.dwItemSpec
= TBCD_THUMB
;
916 nmcd
.uItemState
= infoPtr
->flags
& TB_DRAG_MODE
? CDIS_HOT
: CDIS_DEFAULT
;
917 nmcd
.rc
= infoPtr
->rcThumb
;
918 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
919 } else icdrf
= CDRF_DODEFAULT
;
920 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
921 TRACKBAR_DrawThumb(infoPtr
, hdc
, dwStyle
);
922 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
923 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
927 /* draw focus rectangle */
928 if (infoPtr
->bFocussed
) {
929 DrawFocusRect(hdc
, &rcClient
);
932 /* finish up the painting */
933 if (gcdrf
& CDRF_NOTIFYPOSTPAINT
)
934 notify_customdraw(infoPtr
, &nmcd
, CDDS_POSTPAINT
);
937 /* cleanup, if we rendered offscreen */
939 BitBlt(hdcDst
, 0, 0, rcClient
.right
, rcClient
.bottom
, hdc
, 0, 0, SRCCOPY
);
940 SelectObject(hdc
, hOldBmp
);
941 DeleteObject(hOffScreenBmp
);
948 TRACKBAR_AlignBuddies (const TRACKBAR_INFO
*infoPtr
)
950 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
951 HWND hwndParent
= GetParent (infoPtr
->hwndSelf
);
952 RECT rcSelf
, rcBuddy
;
955 GetWindowRect (infoPtr
->hwndSelf
, &rcSelf
);
956 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcSelf
, 2);
958 /* align buddy left or above */
959 if (infoPtr
->hwndBuddyLA
) {
960 GetWindowRect (infoPtr
->hwndBuddyLA
, &rcBuddy
);
961 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcBuddy
, 2);
963 if (dwStyle
& TBS_VERT
) {
964 x
= (infoPtr
->rcChannel
.right
+ infoPtr
->rcChannel
.left
) / 2 -
965 (rcBuddy
.right
- rcBuddy
.left
) / 2 + rcSelf
.left
;
966 y
= rcSelf
.top
- (rcBuddy
.bottom
- rcBuddy
.top
);
969 x
= rcSelf
.left
- (rcBuddy
.right
- rcBuddy
.left
);
970 y
= (infoPtr
->rcChannel
.bottom
+ infoPtr
->rcChannel
.top
) / 2 -
971 (rcBuddy
.bottom
- rcBuddy
.top
) / 2 + rcSelf
.top
;
974 SetWindowPos (infoPtr
->hwndBuddyLA
, 0, x
, y
, 0, 0,
975 SWP_NOZORDER
| SWP_NOSIZE
);
979 /* align buddy right or below */
980 if (infoPtr
->hwndBuddyRB
) {
981 GetWindowRect (infoPtr
->hwndBuddyRB
, &rcBuddy
);
982 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcBuddy
, 2);
984 if (dwStyle
& TBS_VERT
) {
985 x
= (infoPtr
->rcChannel
.right
+ infoPtr
->rcChannel
.left
) / 2 -
986 (rcBuddy
.right
- rcBuddy
.left
) / 2 + rcSelf
.left
;
991 y
= (infoPtr
->rcChannel
.bottom
+ infoPtr
->rcChannel
.top
) / 2 -
992 (rcBuddy
.bottom
- rcBuddy
.top
) / 2 + rcSelf
.top
;
994 SetWindowPos (infoPtr
->hwndBuddyRB
, 0, x
, y
, 0, 0,
995 SWP_NOZORDER
| SWP_NOSIZE
);
1001 TRACKBAR_ClearSel (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
)
1003 infoPtr
->lSelMin
= 0;
1004 infoPtr
->lSelMax
= 0;
1005 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1007 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1014 TRACKBAR_ClearTics (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
)
1016 if (infoPtr
->tics
) {
1017 Free (infoPtr
->tics
);
1018 infoPtr
->tics
= NULL
;
1019 infoPtr
->uNumTics
= 0;
1022 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1028 static inline LRESULT
1029 TRACKBAR_GetChannelRect (const TRACKBAR_INFO
*infoPtr
, LPRECT lprc
)
1031 if (lprc
== NULL
) return 0;
1033 lprc
->left
= infoPtr
->rcChannel
.left
;
1034 lprc
->right
= infoPtr
->rcChannel
.right
;
1035 lprc
->bottom
= infoPtr
->rcChannel
.bottom
;
1036 lprc
->top
= infoPtr
->rcChannel
.top
;
1043 TRACKBAR_GetNumTics (const TRACKBAR_INFO
*infoPtr
)
1045 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_NOTICKS
)
1048 if(infoPtr
->uNumTics
== 0)
1051 return infoPtr
->uNumTics
+ 1;
1055 static int comp_tics (const void *ap
, const void *bp
)
1057 const DWORD a
= *(const DWORD
*)ap
;
1058 const DWORD b
= *(const DWORD
*)bp
;
1060 TRACE("(a=%d, b=%d)\n", a
, b
);
1061 if (a
< b
) return -1;
1062 if (a
> b
) return 1;
1068 TRACKBAR_GetTic (const TRACKBAR_INFO
*infoPtr
, INT iTic
)
1070 if ((iTic
< 0) || (iTic
>= infoPtr
->uNumTics
) || !infoPtr
->tics
)
1073 qsort(infoPtr
->tics
, infoPtr
->uNumTics
, sizeof(DWORD
), comp_tics
);
1074 return infoPtr
->tics
[iTic
];
1079 TRACKBAR_GetTicPos (const TRACKBAR_INFO
*infoPtr
, INT iTic
)
1081 LONG range
, width
, pos
, tic
;
1084 if ((iTic
< 0) || (iTic
>= infoPtr
->uNumTics
) || !infoPtr
->tics
)
1087 tic
= TRACKBAR_GetTic (infoPtr
, iTic
);
1088 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
1089 if (range
<= 0) range
= 1;
1090 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
1091 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- offsetthumb
*2;
1092 pos
= infoPtr
->rcChannel
.left
+ offsetthumb
+ (width
* tic
) / range
;
1099 TRACKBAR_SetBuddy (TRACKBAR_INFO
*infoPtr
, BOOL fLocation
, HWND hwndBuddy
)
1104 /* buddy is left or above */
1105 hwndTemp
= infoPtr
->hwndBuddyLA
;
1106 infoPtr
->hwndBuddyLA
= hwndBuddy
;
1109 /* buddy is right or below */
1110 hwndTemp
= infoPtr
->hwndBuddyRB
;
1111 infoPtr
->hwndBuddyRB
= hwndBuddy
;
1114 TRACKBAR_AlignBuddies (infoPtr
);
1121 TRACKBAR_SetLineSize (TRACKBAR_INFO
*infoPtr
, LONG lLineSize
)
1123 LONG lTemp
= infoPtr
->lLineSize
;
1125 infoPtr
->lLineSize
= lLineSize
;
1132 TRACKBAR_SetPageSize (TRACKBAR_INFO
*infoPtr
, LONG lPageSize
)
1134 LONG lTemp
= infoPtr
->lPageSize
;
1136 infoPtr
->lPageSize
= lPageSize
;
1142 static inline LRESULT
1143 TRACKBAR_SetPos (TRACKBAR_INFO
*infoPtr
, BOOL fPosition
, LONG lPosition
)
1145 LONG oldPos
= infoPtr
->lPos
;
1146 infoPtr
->lPos
= lPosition
;
1148 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
1149 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1151 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
1152 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1153 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1155 if (fPosition
) TRACKBAR_InvalidateThumbMove(infoPtr
, oldPos
, lPosition
);
1161 static inline LRESULT
1162 TRACKBAR_SetRange (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lRange
)
1164 infoPtr
->lRangeMin
= (SHORT
)LOWORD(lRange
);
1165 infoPtr
->lRangeMax
= (SHORT
)HIWORD(lRange
);
1167 if (infoPtr
->lPos
< infoPtr
->lRangeMin
) {
1168 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1169 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1172 if (infoPtr
->lPos
> infoPtr
->lRangeMax
) {
1173 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1174 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1177 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1178 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1180 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1186 static inline LRESULT
1187 TRACKBAR_SetRangeMax (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lMax
)
1189 infoPtr
->lRangeMax
= lMax
;
1190 if (infoPtr
->lPos
> infoPtr
->lRangeMax
) {
1191 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1192 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1195 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1196 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1198 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1204 static inline LRESULT
1205 TRACKBAR_SetRangeMin (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lMin
)
1207 infoPtr
->lRangeMin
= lMin
;
1208 if (infoPtr
->lPos
< infoPtr
->lRangeMin
) {
1209 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1210 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1213 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1214 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1216 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1222 static inline LRESULT
1223 TRACKBAR_SetSel (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lSel
)
1225 if (!(GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)){
1226 infoPtr
->lSelMin
= 0;
1227 infoPtr
->lSelMax
= 0;
1231 infoPtr
->lSelMin
= (SHORT
)LOWORD(lSel
);
1232 infoPtr
->lSelMax
= (SHORT
)HIWORD(lSel
);
1233 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1235 if (infoPtr
->lSelMin
< infoPtr
->lRangeMin
)
1236 infoPtr
->lSelMin
= infoPtr
->lRangeMin
;
1237 if (infoPtr
->lSelMax
> infoPtr
->lRangeMax
)
1238 infoPtr
->lSelMax
= infoPtr
->lRangeMax
;
1240 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1246 static inline LRESULT
1247 TRACKBAR_SetSelEnd (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lEnd
)
1249 if (!(GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)){
1250 infoPtr
->lSelMax
= 0;
1254 infoPtr
->lSelMax
= lEnd
;
1255 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1257 if (infoPtr
->lSelMax
> infoPtr
->lRangeMax
)
1258 infoPtr
->lSelMax
= infoPtr
->lRangeMax
;
1260 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1266 static inline LRESULT
1267 TRACKBAR_SetSelStart (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lStart
)
1269 if (!(GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)){
1270 infoPtr
->lSelMin
= 0;
1274 infoPtr
->lSelMin
= lStart
;
1275 infoPtr
->flags
|=TB_SELECTIONCHANGED
;
1277 if (infoPtr
->lSelMin
< infoPtr
->lRangeMin
)
1278 infoPtr
->lSelMin
= infoPtr
->lRangeMin
;
1280 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1286 static inline LRESULT
1287 TRACKBAR_SetThumbLength (TRACKBAR_INFO
*infoPtr
, UINT iLength
)
1289 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_FIXEDLENGTH
) {
1290 infoPtr
->uThumbLen
= iLength
;
1291 infoPtr
->flags
|= TB_THUMBSIZECHANGED
;
1292 InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1299 static inline LRESULT
1300 TRACKBAR_SetTic (TRACKBAR_INFO
*infoPtr
, LONG lPos
)
1302 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_AUTOTICKS
)
1305 if ((lPos
< infoPtr
->lRangeMin
) || (lPos
> infoPtr
->lRangeMax
))
1308 TRACE("lPos=%d\n", lPos
);
1310 infoPtr
->uNumTics
++;
1311 infoPtr
->tics
=ReAlloc( infoPtr
->tics
,
1312 (infoPtr
->uNumTics
)*sizeof (DWORD
));
1313 if (!infoPtr
->tics
) {
1314 infoPtr
->uNumTics
= 0;
1315 notify(infoPtr
, NM_OUTOFMEMORY
);
1318 infoPtr
->tics
[infoPtr
->uNumTics
-1] = lPos
;
1320 TRACKBAR_InvalidateAll(infoPtr
);
1326 static inline LRESULT
1327 TRACKBAR_SetTicFreq (TRACKBAR_INFO
*infoPtr
, WORD wFreq
)
1329 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_AUTOTICKS
) {
1330 infoPtr
->uTicFreq
= wFreq
;
1331 TRACKBAR_RecalculateTics (infoPtr
);
1332 TRACKBAR_InvalidateAll(infoPtr
);
1340 TRACKBAR_SetTipSide (TRACKBAR_INFO
*infoPtr
, INT fLocation
)
1342 INT fTemp
= infoPtr
->fLocation
;
1344 infoPtr
->fLocation
= fLocation
;
1350 static inline LRESULT
1351 TRACKBAR_SetToolTips (TRACKBAR_INFO
*infoPtr
, HWND hwndTT
)
1353 infoPtr
->hwndToolTip
= hwndTT
;
1360 TRACKBAR_SetUnicodeFormat (TRACKBAR_INFO
*infoPtr
, BOOL fUnicode
)
1362 BOOL bTemp
= infoPtr
->bUnicode
;
1364 infoPtr
->bUnicode
= fUnicode
;
1371 TRACKBAR_InitializeThumb (TRACKBAR_INFO
*infoPtr
)
1373 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1375 int clientWidth
, clientMetric
;
1377 /* initial thumb length */
1378 clientMetric
= (dwStyle
& TBS_ENABLESELRANGE
) ? 23 : 21;
1379 GetClientRect(infoPtr
->hwndSelf
,&rect
);
1380 if (dwStyle
& TBS_VERT
) {
1381 clientWidth
= rect
.right
- rect
.left
;
1383 clientWidth
= rect
.bottom
- rect
.top
;
1385 if (clientWidth
>= clientMetric
)
1386 infoPtr
->uThumbLen
= clientMetric
;
1388 infoPtr
->uThumbLen
= clientWidth
> 9 ? clientWidth
- 6 : 4;
1390 TRACKBAR_CalcChannel (infoPtr
);
1391 TRACKBAR_UpdateThumb (infoPtr
);
1392 infoPtr
->flags
&= ~TB_SELECTIONCHANGED
;
1399 TRACKBAR_Create (HWND hwnd
, const CREATESTRUCTW
*lpcs
)
1401 TRACKBAR_INFO
*infoPtr
;
1404 infoPtr
= (TRACKBAR_INFO
*)Alloc (sizeof(TRACKBAR_INFO
));
1405 if (!infoPtr
) return -1;
1406 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
1408 /* set default values */
1409 infoPtr
->hwndSelf
= hwnd
;
1410 infoPtr
->lRangeMin
= 0;
1411 infoPtr
->lRangeMax
= 100;
1412 infoPtr
->lLineSize
= 1;
1413 infoPtr
->lPageSize
= 20;
1414 infoPtr
->lSelMin
= 0;
1415 infoPtr
->lSelMax
= 0;
1417 infoPtr
->fLocation
= -1;
1418 infoPtr
->uNumTics
= 0; /* start and end tic are not included in count*/
1419 infoPtr
->uTicFreq
= 1;
1420 infoPtr
->tics
= NULL
;
1421 infoPtr
->hwndNotify
= lpcs
->hwndParent
;
1423 TRACKBAR_InitializeThumb (infoPtr
);
1425 dwStyle
= GetWindowLongW (hwnd
, GWL_STYLE
);
1427 /* Create tooltip control */
1428 if (dwStyle
& TBS_TOOLTIPS
) {
1430 infoPtr
->hwndToolTip
=
1431 CreateWindowExW (0, TOOLTIPS_CLASSW
, NULL
, WS_POPUP
,
1432 CW_USEDEFAULT
, CW_USEDEFAULT
,
1433 CW_USEDEFAULT
, CW_USEDEFAULT
,
1436 if (infoPtr
->hwndToolTip
) {
1438 ZeroMemory (&ti
, sizeof(ti
));
1439 ti
.cbSize
= sizeof(ti
);
1440 ti
.uFlags
= TTF_IDISHWND
| TTF_TRACK
| TTF_ABSOLUTE
;
1443 SendMessageW (infoPtr
->hwndToolTip
, TTM_ADDTOOLW
, 0, (LPARAM
)&ti
);
1447 OpenThemeData (hwnd
, themeClass
);
1454 TRACKBAR_Destroy (TRACKBAR_INFO
*infoPtr
)
1456 /* delete tooltip control */
1457 if (infoPtr
->hwndToolTip
)
1458 DestroyWindow (infoPtr
->hwndToolTip
);
1461 SetWindowLongPtrW (infoPtr
->hwndSelf
, 0, 0);
1462 CloseThemeData (GetWindowTheme (infoPtr
->hwndSelf
));
1468 TRACKBAR_KillFocus (TRACKBAR_INFO
*infoPtr
, HWND hwndGetFocus
)
1471 infoPtr
->bFocussed
= FALSE
;
1472 TRACKBAR_InvalidateAll(infoPtr
);
1478 TRACKBAR_LButtonDown (TRACKBAR_INFO
*infoPtr
, DWORD fwKeys
, INT x
, INT y
)
1485 SetFocus(infoPtr
->hwndSelf
);
1487 if (PtInRect(&infoPtr
->rcThumb
, clickPoint
)) {
1488 infoPtr
->flags
|= TB_DRAG_MODE
;
1489 SetCapture (infoPtr
->hwndSelf
);
1490 TRACKBAR_UpdateToolTip (infoPtr
);
1491 TRACKBAR_ActivateToolTip (infoPtr
, TRUE
);
1492 TRACKBAR_InvalidateThumb(infoPtr
, infoPtr
->lPos
);
1494 LONG dir
= TRACKBAR_GetAutoPageDirection(infoPtr
, clickPoint
);
1495 if (dir
== 0) return 0;
1496 infoPtr
->flags
|= (dir
< 0) ? TB_AUTO_PAGE_LEFT
: TB_AUTO_PAGE_RIGHT
;
1497 TRACKBAR_AutoPage (infoPtr
, clickPoint
);
1498 SetCapture (infoPtr
->hwndSelf
);
1499 SetTimer(infoPtr
->hwndSelf
, TB_REFRESH_TIMER
, TB_REFRESH_DELAY
, 0);
1507 TRACKBAR_LButtonUp (TRACKBAR_INFO
*infoPtr
, DWORD fwKeys
, INT x
, INT y
)
1509 if (infoPtr
->flags
& TB_DRAG_MODE
) {
1510 notify_with_scroll (infoPtr
, TB_THUMBPOSITION
| (infoPtr
->lPos
<<16));
1511 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1512 infoPtr
->flags
&= ~TB_DRAG_MODE
;
1514 notify(infoPtr
, NM_RELEASEDCAPTURE
);
1515 TRACKBAR_ActivateToolTip(infoPtr
, FALSE
);
1516 TRACKBAR_InvalidateThumb(infoPtr
, infoPtr
->lPos
);
1518 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1519 KillTimer (infoPtr
->hwndSelf
, TB_REFRESH_TIMER
);
1520 infoPtr
->flags
&= ~TB_AUTO_PAGE
;
1521 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1523 notify(infoPtr
, NM_RELEASEDCAPTURE
);
1531 TRACKBAR_CaptureChanged (const TRACKBAR_INFO
*infoPtr
)
1533 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1539 TRACKBAR_Paint (TRACKBAR_INFO
*infoPtr
, HDC hdc
)
1542 TRACKBAR_Refresh(infoPtr
, hdc
);
1545 hdc
= BeginPaint (infoPtr
->hwndSelf
, &ps
);
1546 TRACKBAR_Refresh (infoPtr
, hdc
);
1547 EndPaint (infoPtr
->hwndSelf
, &ps
);
1555 TRACKBAR_SetFocus (TRACKBAR_INFO
*infoPtr
, HWND hwndLoseFocus
)
1558 infoPtr
->bFocussed
= TRUE
;
1559 TRACKBAR_InvalidateAll(infoPtr
);
1566 TRACKBAR_Size (TRACKBAR_INFO
*infoPtr
, DWORD fwSizeType
, INT nWidth
, INT nHeight
)
1568 TRACKBAR_InitializeThumb (infoPtr
);
1569 TRACKBAR_AlignBuddies (infoPtr
);
1576 TRACKBAR_Timer (TRACKBAR_INFO
*infoPtr
, INT wTimerID
, const TIMERPROC
*tmrpc
)
1578 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1580 if (GetCursorPos(&pt
))
1581 if (ScreenToClient(infoPtr
->hwndSelf
, &pt
))
1582 TRACKBAR_AutoPage(infoPtr
, pt
);
1588 /* update theme after a WM_THEMECHANGED message */
1589 static LRESULT
theme_changed (const TRACKBAR_INFO
* infoPtr
)
1591 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
1592 CloseThemeData (theme
);
1593 theme
= OpenThemeData (infoPtr
->hwndSelf
, themeClass
);
1599 TRACKBAR_MouseMove (TRACKBAR_INFO
*infoPtr
, DWORD fwKeys
, INT x
, INT y
)
1601 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1602 INT clickPlace
= (dwStyle
& TBS_VERT
) ? y
: x
;
1603 LONG dragPos
, oldPos
= infoPtr
->lPos
;
1605 TRACE("(x=%d. y=%d)\n", x
, y
);
1607 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1611 TRACKBAR_AutoPage (infoPtr
, pt
);
1615 if (!(infoPtr
->flags
& TB_DRAG_MODE
))
1617 if (GetWindowTheme (infoPtr
->hwndSelf
))
1619 DWORD oldFlags
= infoPtr
->flags
;
1623 if (PtInRect (&infoPtr
->rcThumb
, pt
))
1625 TRACKMOUSEEVENT tme
;
1626 tme
.cbSize
= sizeof( tme
);
1627 tme
.dwFlags
= TME_LEAVE
;
1628 tme
.hwndTrack
= infoPtr
->hwndSelf
;
1629 TrackMouseEvent( &tme
);
1630 infoPtr
->flags
|= TB_THUMB_HOT
;
1634 TRACKMOUSEEVENT tme
;
1635 tme
.cbSize
= sizeof( tme
);
1636 tme
.dwFlags
= TME_CANCEL
;
1637 tme
.hwndTrack
= infoPtr
->hwndSelf
;
1638 TrackMouseEvent( &tme
);
1639 infoPtr
->flags
&= ~TB_THUMB_HOT
;
1641 if (oldFlags
!= infoPtr
->flags
) InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1646 dragPos
= TRACKBAR_ConvertPlaceToPosition (infoPtr
, clickPlace
,
1647 dwStyle
& TBS_VERT
);
1648 if (dragPos
== oldPos
) return TRUE
;
1650 infoPtr
->lPos
= dragPos
;
1652 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1653 notify_with_scroll (infoPtr
, TB_THUMBTRACK
| (infoPtr
->lPos
<<16));
1656 TRACKBAR_InvalidateThumbMove(infoPtr
, oldPos
, dragPos
);
1657 UpdateWindow (infoPtr
->hwndSelf
);
1663 TRACKBAR_KeyDown (TRACKBAR_INFO
*infoPtr
, INT nVirtKey
, DWORD lKeyData
)
1665 DWORD style
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1666 BOOL downIsLeft
= style
& TBS_DOWNISLEFT
;
1667 BOOL vert
= style
& TBS_VERT
;
1668 LONG pos
= infoPtr
->lPos
;
1670 TRACE("%x\n", nVirtKey
);
1674 if (!vert
&& downIsLeft
) TRACKBAR_LineDown(infoPtr
);
1675 else TRACKBAR_LineUp(infoPtr
);
1678 if (vert
&& downIsLeft
) TRACKBAR_LineDown(infoPtr
);
1679 else TRACKBAR_LineUp(infoPtr
);
1682 if (!vert
&& downIsLeft
) TRACKBAR_LineUp(infoPtr
);
1683 else TRACKBAR_LineDown(infoPtr
);
1686 if (vert
&& downIsLeft
) TRACKBAR_LineUp(infoPtr
);
1687 else TRACKBAR_LineDown(infoPtr
);
1690 if (!vert
&& downIsLeft
) TRACKBAR_PageUp(infoPtr
);
1691 else TRACKBAR_PageDown(infoPtr
);
1694 if (!vert
&& downIsLeft
) TRACKBAR_PageDown(infoPtr
);
1695 else TRACKBAR_PageUp(infoPtr
);
1698 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return FALSE
;
1699 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1700 notify_with_scroll (infoPtr
, TB_TOP
);
1703 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return FALSE
;
1704 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1705 notify_with_scroll (infoPtr
, TB_BOTTOM
);
1709 if (pos
!= infoPtr
->lPos
) {
1710 infoPtr
->flags
|=TB_THUMBPOSCHANGED
;
1711 TRACKBAR_InvalidateThumbMove (infoPtr
, pos
, infoPtr
->lPos
);
1719 TRACKBAR_KeyUp (const TRACKBAR_INFO
*infoPtr
, INT nVirtKey
, DWORD lKeyData
)
1730 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1736 static LRESULT WINAPI
1737 TRACKBAR_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
1739 TRACKBAR_INFO
*infoPtr
= (TRACKBAR_INFO
*)GetWindowLongPtrW (hwnd
, 0);
1741 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hwnd
, uMsg
, wParam
, lParam
);
1743 if (!infoPtr
&& (uMsg
!= WM_CREATE
))
1744 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
1749 return TRACKBAR_ClearSel (infoPtr
, (BOOL
)wParam
);
1752 return TRACKBAR_ClearTics (infoPtr
, (BOOL
)wParam
);
1755 return (LRESULT
)(wParam
? infoPtr
->hwndBuddyLA
: infoPtr
->hwndBuddyRB
);
1757 case TBM_GETCHANNELRECT
:
1758 return TRACKBAR_GetChannelRect (infoPtr
, (LPRECT
)lParam
);
1760 case TBM_GETLINESIZE
:
1761 return infoPtr
->lLineSize
;
1763 case TBM_GETNUMTICS
:
1764 return TRACKBAR_GetNumTics (infoPtr
);
1766 case TBM_GETPAGESIZE
:
1767 return infoPtr
->lPageSize
;
1770 return infoPtr
->lPos
;
1773 return (LRESULT
)infoPtr
->tics
;
1775 case TBM_GETRANGEMAX
:
1776 return infoPtr
->lRangeMax
;
1778 case TBM_GETRANGEMIN
:
1779 return infoPtr
->lRangeMin
;
1782 return infoPtr
->lSelMax
;
1784 case TBM_GETSELSTART
:
1785 return infoPtr
->lSelMin
;
1787 case TBM_GETTHUMBLENGTH
:
1788 return infoPtr
->uThumbLen
;
1790 case TBM_GETTHUMBRECT
:
1791 return CopyRect((LPRECT
)lParam
, &infoPtr
->rcThumb
);
1794 return TRACKBAR_GetTic (infoPtr
, (INT
)wParam
);
1797 return TRACKBAR_GetTicPos (infoPtr
, (INT
)wParam
);
1799 case TBM_GETTOOLTIPS
:
1800 return (LRESULT
)infoPtr
->hwndToolTip
;
1802 case TBM_GETUNICODEFORMAT
:
1803 return infoPtr
->bUnicode
;
1806 return (LRESULT
) TRACKBAR_SetBuddy(infoPtr
, (BOOL
)wParam
, (HWND
)lParam
);
1808 case TBM_SETLINESIZE
:
1809 return TRACKBAR_SetLineSize (infoPtr
, (LONG
)lParam
);
1811 case TBM_SETPAGESIZE
:
1812 return TRACKBAR_SetPageSize (infoPtr
, (LONG
)lParam
);
1815 return TRACKBAR_SetPos (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1818 return TRACKBAR_SetRange (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1820 case TBM_SETRANGEMAX
:
1821 return TRACKBAR_SetRangeMax (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1823 case TBM_SETRANGEMIN
:
1824 return TRACKBAR_SetRangeMin (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1827 return TRACKBAR_SetSel (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1830 return TRACKBAR_SetSelEnd (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1832 case TBM_SETSELSTART
:
1833 return TRACKBAR_SetSelStart (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1835 case TBM_SETTHUMBLENGTH
:
1836 return TRACKBAR_SetThumbLength (infoPtr
, (UINT
)wParam
);
1839 return TRACKBAR_SetTic (infoPtr
, (LONG
)lParam
);
1841 case TBM_SETTICFREQ
:
1842 return TRACKBAR_SetTicFreq (infoPtr
, (WORD
)wParam
);
1844 case TBM_SETTIPSIDE
:
1845 return TRACKBAR_SetTipSide (infoPtr
, (INT
)wParam
);
1847 case TBM_SETTOOLTIPS
:
1848 return TRACKBAR_SetToolTips (infoPtr
, (HWND
)wParam
);
1850 case TBM_SETUNICODEFORMAT
:
1851 return TRACKBAR_SetUnicodeFormat (infoPtr
, (BOOL
)wParam
);
1854 case WM_CAPTURECHANGED
:
1855 return TRACKBAR_CaptureChanged (infoPtr
);
1858 return TRACKBAR_Create (hwnd
, (LPCREATESTRUCTW
)lParam
);
1861 return TRACKBAR_Destroy (infoPtr
);
1863 /* case WM_ENABLE: */
1869 return DLGC_WANTARROWS
;
1872 return TRACKBAR_KeyDown (infoPtr
, (INT
)wParam
, (DWORD
)lParam
);
1875 return TRACKBAR_KeyUp (infoPtr
, (INT
)wParam
, (DWORD
)lParam
);
1878 return TRACKBAR_KillFocus (infoPtr
, (HWND
)wParam
);
1880 case WM_LBUTTONDOWN
:
1881 return TRACKBAR_LButtonDown (infoPtr
, wParam
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1884 return TRACKBAR_LButtonUp (infoPtr
, wParam
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1887 infoPtr
->flags
&= ~TB_THUMB_HOT
;
1888 InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1892 return TRACKBAR_MouseMove (infoPtr
, wParam
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1894 case WM_PRINTCLIENT
:
1896 return TRACKBAR_Paint (infoPtr
, (HDC
)wParam
);
1899 return TRACKBAR_SetFocus (infoPtr
, (HWND
)wParam
);
1902 return TRACKBAR_Size (infoPtr
, wParam
, LOWORD(lParam
), HIWORD(lParam
));
1904 case WM_THEMECHANGED
:
1905 return theme_changed (infoPtr
);
1908 return TRACKBAR_Timer (infoPtr
, (INT
)wParam
, (TIMERPROC
*)lParam
);
1910 case WM_WININICHANGE
:
1911 return TRACKBAR_InitializeThumb (infoPtr
);
1914 if ((uMsg
>= WM_USER
) && (uMsg
< WM_APP
))
1915 ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg
, wParam
, lParam
);
1916 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
1921 void TRACKBAR_Register (void)
1925 ZeroMemory (&wndClass
, sizeof(WNDCLASSW
));
1926 wndClass
.style
= CS_GLOBALCLASS
;
1927 wndClass
.lpfnWndProc
= TRACKBAR_WindowProc
;
1928 wndClass
.cbClsExtra
= 0;
1929 wndClass
.cbWndExtra
= sizeof(TRACKBAR_INFO
*);
1930 wndClass
.hCursor
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
1931 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
1932 wndClass
.lpszClassName
= TRACKBAR_CLASSW
;
1934 RegisterClassW (&wndClass
);
1938 void TRACKBAR_Unregister (void)
1940 UnregisterClassW (TRACKBAR_CLASSW
, NULL
);