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
);
80 #define TB_REFRESH_TIMER 1
81 #define TB_REFRESH_DELAY 500
83 #define TOOLTIP_OFFSET 2 /* distance from ctrl edge to tooltip */
85 #define TB_DEFAULTPAGESIZE 20
87 /* Used by TRACKBAR_Refresh to find out which parts of the control
88 need to be recalculated */
90 #define TB_THUMBPOSCHANGED 1
91 #define TB_THUMBSIZECHANGED 2
92 #define TB_THUMBCHANGED (TB_THUMBPOSCHANGED | TB_THUMBSIZECHANGED)
93 #define TB_SELECTIONCHANGED 4
94 #define TB_DRAG_MODE 8 /* we're dragging the slider */
95 #define TB_AUTO_PAGE_LEFT 16
96 #define TB_AUTO_PAGE_RIGHT 32
97 #define TB_AUTO_PAGE (TB_AUTO_PAGE_LEFT | TB_AUTO_PAGE_RIGHT)
98 #define TB_THUMB_HOT 64 /* mouse hovers above thumb */
100 /* helper defines for TRACKBAR_DrawTic */
101 #define TIC_EDGE 0x20
102 #define TIC_SELECTIONMARKMAX 0x80
103 #define TIC_SELECTIONMARKMIN 0x100
104 #define TIC_SELECTIONMARK (TIC_SELECTIONMARKMAX | TIC_SELECTIONMARKMIN)
106 static const WCHAR themeClass
[] = { 'T','r','a','c','k','b','a','r',0 };
109 notify_customdraw (const TRACKBAR_INFO
*infoPtr
, NMCUSTOMDRAW
*pnmcd
, int stage
)
111 pnmcd
->dwDrawStage
= stage
;
112 return SendMessageW (infoPtr
->hwndNotify
, WM_NOTIFY
,
113 pnmcd
->hdr
.idFrom
, (LPARAM
)pnmcd
);
116 static LRESULT
notify_hdr (const TRACKBAR_INFO
*infoPtr
, INT code
, LPNMHDR pnmh
)
120 TRACE("(code=%d)\n", code
);
122 pnmh
->hwndFrom
= infoPtr
->hwndSelf
;
123 pnmh
->idFrom
= GetWindowLongPtrW(infoPtr
->hwndSelf
, GWLP_ID
);
125 result
= SendMessageW(infoPtr
->hwndNotify
, WM_NOTIFY
, pnmh
->idFrom
, (LPARAM
)pnmh
);
127 TRACE(" <= %ld\n", result
);
132 static inline int notify (const TRACKBAR_INFO
*infoPtr
, INT code
)
135 return notify_hdr(infoPtr
, code
, &nmh
);
139 notify_with_scroll (const TRACKBAR_INFO
*infoPtr
, UINT code
)
141 BOOL bVert
= infoPtr
->dwStyle
& TBS_VERT
;
145 return (BOOL
) SendMessageW (infoPtr
->hwndNotify
,
146 bVert
? WM_VSCROLL
: WM_HSCROLL
,
147 (WPARAM
)code
, (LPARAM
)infoPtr
->hwndSelf
);
150 static void TRACKBAR_RecalculateTics (TRACKBAR_INFO
*infoPtr
)
155 if (infoPtr
->uTicFreq
&& infoPtr
->lRangeMax
>= infoPtr
->lRangeMin
) {
156 nrTics
=(infoPtr
->lRangeMax
- infoPtr
->lRangeMin
)/infoPtr
->uTicFreq
;
157 /* don't add extra tic if there's no remainder */
158 if (nrTics
&& ((infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) % infoPtr
->uTicFreq
== 0))
162 Free (infoPtr
->tics
);
163 infoPtr
->tics
= NULL
;
164 infoPtr
->uNumTics
= 0;
168 if (nrTics
!= infoPtr
->uNumTics
) {
169 infoPtr
->tics
=ReAlloc (infoPtr
->tics
,
170 (nrTics
+1)*sizeof (DWORD
));
171 if (!infoPtr
->tics
) {
172 infoPtr
->uNumTics
= 0;
173 notify(infoPtr
, NM_OUTOFMEMORY
);
176 infoPtr
->uNumTics
= nrTics
;
179 tic
= infoPtr
->lRangeMin
+ infoPtr
->uTicFreq
;
180 for (i
= 0; i
< nrTics
; i
++, tic
+= infoPtr
->uTicFreq
)
181 infoPtr
->tics
[i
] = tic
;
184 /* converts from physical (mouse) position to logical position
185 (in range of trackbar) */
188 TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO
*infoPtr
, int place
)
190 double range
, width
, pos
, offsetthumb
;
192 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
193 if (infoPtr
->dwStyle
& TBS_VERT
) {
194 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
195 width
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- (offsetthumb
* 2) - 1;
196 pos
= (range
*(place
- infoPtr
->rcChannel
.top
- offsetthumb
)) / width
;
198 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
199 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- (offsetthumb
* 2) - 1;
200 pos
= (range
*(place
- infoPtr
->rcChannel
.left
- offsetthumb
)) / width
;
202 pos
+= infoPtr
->lRangeMin
;
203 if (pos
> infoPtr
->lRangeMax
)
204 pos
= infoPtr
->lRangeMax
;
205 else if (pos
< infoPtr
->lRangeMin
)
206 pos
= infoPtr
->lRangeMin
;
208 TRACE("%.2f\n", pos
);
209 return (LONG
)(pos
+ 0.5);
213 /* return: 0> prev, 0 none, >0 next */
215 TRACKBAR_GetAutoPageDirection (const TRACKBAR_INFO
*infoPtr
, POINT clickPoint
)
219 if (infoPtr
->dwStyle
& TBS_VERT
) {
220 pageRect
.top
= infoPtr
->rcChannel
.top
;
221 pageRect
.bottom
= infoPtr
->rcChannel
.bottom
;
222 pageRect
.left
= infoPtr
->rcThumb
.left
;
223 pageRect
.right
= infoPtr
->rcThumb
.right
;
225 pageRect
.top
= infoPtr
->rcThumb
.top
;
226 pageRect
.bottom
= infoPtr
->rcThumb
.bottom
;
227 pageRect
.left
= infoPtr
->rcChannel
.left
;
228 pageRect
.right
= infoPtr
->rcChannel
.right
;
232 if (PtInRect(&pageRect
, clickPoint
))
234 int clickPlace
= (infoPtr
->dwStyle
& TBS_VERT
) ? clickPoint
.y
: clickPoint
.x
;
236 LONG clickPos
= TRACKBAR_ConvertPlaceToPosition(infoPtr
, clickPlace
);
238 return clickPos
- infoPtr
->lPos
;
245 TRACKBAR_PageDown (TRACKBAR_INFO
*infoPtr
)
247 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return;
249 infoPtr
->lPos
+= infoPtr
->lPageSize
;
250 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
251 infoPtr
->lPos
= infoPtr
->lRangeMax
;
252 notify_with_scroll (infoPtr
, TB_PAGEDOWN
);
257 TRACKBAR_PageUp (TRACKBAR_INFO
*infoPtr
)
259 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return;
261 infoPtr
->lPos
-= infoPtr
->lPageSize
;
262 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
263 infoPtr
->lPos
= infoPtr
->lRangeMin
;
264 notify_with_scroll (infoPtr
, TB_PAGEUP
);
267 static inline void TRACKBAR_LineUp(TRACKBAR_INFO
*infoPtr
)
269 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return;
270 infoPtr
->lPos
-= infoPtr
->lLineSize
;
271 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
272 infoPtr
->lPos
= infoPtr
->lRangeMin
;
273 notify_with_scroll (infoPtr
, TB_LINEUP
);
276 static inline void TRACKBAR_LineDown(TRACKBAR_INFO
*infoPtr
)
278 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return;
279 infoPtr
->lPos
+= infoPtr
->lLineSize
;
280 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
281 infoPtr
->lPos
= infoPtr
->lRangeMax
;
282 notify_with_scroll (infoPtr
, TB_LINEDOWN
);
286 TRACKBAR_CalcChannel (TRACKBAR_INFO
*infoPtr
)
288 INT cyChannel
, offsetthumb
, offsetedge
;
289 RECT lpRect
, *channel
= & infoPtr
->rcChannel
;
291 GetClientRect (infoPtr
->hwndSelf
, &lpRect
);
293 offsetthumb
= infoPtr
->uThumbLen
/ 4;
294 offsetedge
= offsetthumb
+ 3;
295 cyChannel
= (infoPtr
->dwStyle
& TBS_ENABLESELRANGE
) ? offsetthumb
*3 : 4;
296 if (infoPtr
->dwStyle
& TBS_VERT
) {
297 channel
->top
= lpRect
.top
+ offsetedge
;
298 channel
->bottom
= lpRect
.bottom
- offsetedge
;
299 if (infoPtr
->dwStyle
& TBS_ENABLESELRANGE
)
300 channel
->left
= lpRect
.left
+ ((infoPtr
->uThumbLen
- cyChannel
+ 2) / 2);
302 channel
->left
= lpRect
.left
+ (infoPtr
->uThumbLen
/ 2) - 1;
303 if (infoPtr
->dwStyle
& TBS_BOTH
) {
304 if (infoPtr
->dwStyle
& TBS_NOTICKS
)
309 else if (infoPtr
->dwStyle
& TBS_TOP
) {
310 if (infoPtr
->dwStyle
& TBS_NOTICKS
)
315 channel
->right
= channel
->left
+ cyChannel
;
317 channel
->left
= lpRect
.left
+ offsetedge
;
318 channel
->right
= lpRect
.right
- offsetedge
;
319 if (infoPtr
->dwStyle
& TBS_ENABLESELRANGE
)
320 channel
->top
= lpRect
.top
+ ((infoPtr
->uThumbLen
- cyChannel
+ 2) / 2);
322 channel
->top
= lpRect
.top
+ (infoPtr
->uThumbLen
/ 2) - 1;
323 if (infoPtr
->dwStyle
& TBS_BOTH
) {
324 if (infoPtr
->dwStyle
& TBS_NOTICKS
)
329 else if (infoPtr
->dwStyle
& TBS_TOP
) {
330 if (infoPtr
->dwStyle
& TBS_NOTICKS
)
335 channel
->bottom
= channel
->top
+ cyChannel
;
340 TRACKBAR_CalcThumb (const TRACKBAR_INFO
*infoPtr
, LONG lPos
, RECT
*thumb
)
342 int range
, width
, height
, thumbwidth
;
345 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
346 thumbwidth
= (infoPtr
->uThumbLen
/ 2) | 1;
348 if (!range
) range
= 1;
350 GetClientRect(infoPtr
->hwndSelf
, &lpRect
);
351 if (infoPtr
->dwStyle
& TBS_VERT
)
353 height
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- thumbwidth
;
355 if ((infoPtr
->dwStyle
& (TBS_BOTH
| TBS_LEFT
)) && !(infoPtr
->dwStyle
& TBS_NOTICKS
))
359 thumb
->right
= thumb
->left
+ infoPtr
->uThumbLen
;
360 thumb
->top
= infoPtr
->rcChannel
.top
+
361 (height
*(lPos
- infoPtr
->lRangeMin
))/range
;
362 thumb
->bottom
= thumb
->top
+ thumbwidth
;
366 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- thumbwidth
;
368 thumb
->left
= infoPtr
->rcChannel
.left
+
369 (width
*(lPos
- infoPtr
->lRangeMin
))/range
;
370 thumb
->right
= thumb
->left
+ thumbwidth
;
371 if ((infoPtr
->dwStyle
& (TBS_BOTH
| TBS_TOP
)) && !(infoPtr
->dwStyle
& TBS_NOTICKS
))
375 thumb
->bottom
= thumb
->top
+ infoPtr
->uThumbLen
;
380 TRACKBAR_UpdateThumb (TRACKBAR_INFO
*infoPtr
)
382 TRACKBAR_CalcThumb(infoPtr
, infoPtr
->lPos
, &infoPtr
->rcThumb
);
386 TRACKBAR_InvalidateAll (const TRACKBAR_INFO
*infoPtr
)
388 InvalidateRect(infoPtr
->hwndSelf
, NULL
, FALSE
);
392 TRACKBAR_InvalidateThumb (const TRACKBAR_INFO
*infoPtr
, LONG thumbPos
)
396 TRACKBAR_CalcThumb(infoPtr
, thumbPos
, &rcThumb
);
397 InflateRect(&rcThumb
, 1, 1);
398 InvalidateRect(infoPtr
->hwndSelf
, &rcThumb
, FALSE
);
402 TRACKBAR_InvalidateThumbMove (const TRACKBAR_INFO
*infoPtr
, LONG oldPos
, LONG newPos
)
404 TRACKBAR_InvalidateThumb (infoPtr
, oldPos
);
405 if (newPos
!= oldPos
)
406 TRACKBAR_InvalidateThumb (infoPtr
, newPos
);
410 TRACKBAR_HasSelection (const TRACKBAR_INFO
*infoPtr
)
412 return infoPtr
->lSelMin
!= infoPtr
->lSelMax
;
416 TRACKBAR_CalcSelection (TRACKBAR_INFO
*infoPtr
)
418 RECT
*selection
= &infoPtr
->rcSelection
;
419 int range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
420 int offsetthumb
, height
, width
;
423 SetRectEmpty (selection
);
425 if (infoPtr
->dwStyle
& TBS_VERT
) {
426 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
427 height
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- offsetthumb
*2;
428 selection
->top
= infoPtr
->rcChannel
.top
+ offsetthumb
+
429 (height
*infoPtr
->lSelMin
)/range
;
430 selection
->bottom
= infoPtr
->rcChannel
.top
+ offsetthumb
+
431 (height
*infoPtr
->lSelMax
)/range
;
432 selection
->left
= infoPtr
->rcChannel
.left
+ 3;
433 selection
->right
= infoPtr
->rcChannel
.right
- 3;
435 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
436 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- offsetthumb
*2;
437 selection
->left
= infoPtr
->rcChannel
.left
+ offsetthumb
+
438 (width
*infoPtr
->lSelMin
)/range
;
439 selection
->right
= infoPtr
->rcChannel
.left
+ offsetthumb
+
440 (width
*infoPtr
->lSelMax
)/range
;
441 selection
->top
= infoPtr
->rcChannel
.top
+ 3;
442 selection
->bottom
= infoPtr
->rcChannel
.bottom
- 3;
446 TRACE("selection[%s]\n", wine_dbgstr_rect(selection
));
450 TRACKBAR_AutoPage (TRACKBAR_INFO
*infoPtr
, POINT clickPoint
)
452 LONG dir
= TRACKBAR_GetAutoPageDirection(infoPtr
, clickPoint
);
453 LONG prevPos
= infoPtr
->lPos
;
455 TRACE("x=%d, y=%d, dir=%d\n", clickPoint
.x
, clickPoint
.y
, dir
);
457 if (dir
> 0 && (infoPtr
->flags
& TB_AUTO_PAGE_RIGHT
))
458 TRACKBAR_PageDown(infoPtr
);
459 else if (dir
< 0 && (infoPtr
->flags
& TB_AUTO_PAGE_LEFT
))
460 TRACKBAR_PageUp(infoPtr
);
463 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
464 TRACKBAR_InvalidateThumbMove (infoPtr
, prevPos
, infoPtr
->lPos
);
469 /* Trackbar drawing code. I like my spaghetti done milanese. */
472 TRACKBAR_DrawChannel (const TRACKBAR_INFO
*infoPtr
, HDC hdc
)
474 RECT rcChannel
= infoPtr
->rcChannel
;
475 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
479 DrawThemeBackground (theme
, hdc
,
480 (infoPtr
->dwStyle
& TBS_VERT
) ?
481 TKP_TRACKVERT
: TKP_TRACK
, TKS_NORMAL
, &rcChannel
, 0);
485 DrawEdge (hdc
, &rcChannel
, EDGE_SUNKEN
, BF_RECT
| BF_ADJUST
);
486 if (infoPtr
->dwStyle
& TBS_ENABLESELRANGE
) { /* fill the channel */
487 FillRect (hdc
, &rcChannel
, GetStockObject(WHITE_BRUSH
));
488 if (TRACKBAR_HasSelection(infoPtr
))
489 FillRect (hdc
, &infoPtr
->rcSelection
, GetSysColorBrush(COLOR_HIGHLIGHT
));
495 TRACKBAR_DrawOneTic (const TRACKBAR_INFO
*infoPtr
, HDC hdc
, LONG ticPos
, int flags
)
497 int x
, y
, ox
, oy
, range
, side
, indent
= 0, len
= 3;
501 if (flags
& TBS_VERT
) {
502 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
503 rcTics
.left
= infoPtr
->rcThumb
.left
- 2;
504 rcTics
.right
= infoPtr
->rcThumb
.right
+ 2;
505 rcTics
.top
= infoPtr
->rcChannel
.top
+ offsetthumb
+ 1;
506 rcTics
.bottom
= infoPtr
->rcChannel
.bottom
- offsetthumb
;
508 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
509 rcTics
.left
= infoPtr
->rcChannel
.left
+ offsetthumb
+ 1;
510 rcTics
.right
= infoPtr
->rcChannel
.right
- offsetthumb
;
511 rcTics
.top
= infoPtr
->rcThumb
.top
- 2;
512 rcTics
.bottom
= infoPtr
->rcThumb
.bottom
+ 2;
515 if (flags
& (TBS_TOP
| TBS_LEFT
)) {
525 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
527 range
= 1; /* to avoid division by zero */
529 if (flags
& TIC_SELECTIONMARK
) {
530 indent
= (flags
& TIC_SELECTIONMARKMIN
) ? -1 : 1;
531 } else if (flags
& TIC_EDGE
) {
535 if (flags
& TBS_VERT
) {
536 int height
= rcTics
.bottom
- rcTics
.top
;
537 y
= rcTics
.top
+ (height
*(ticPos
- infoPtr
->lRangeMin
))/range
;
539 int width
= rcTics
.right
- rcTics
.left
;
540 x
= rcTics
.left
+ (width
*(ticPos
- infoPtr
->lRangeMin
))/range
;
545 MoveToEx(hdc
, x
, y
, 0);
546 if (flags
& TBS_VERT
) x
+= len
* side
;
547 else y
+= len
* side
;
550 if (flags
& TIC_SELECTIONMARK
) {
551 if (flags
& TBS_VERT
) {
556 MoveToEx(hdc
, x
, y
, 0);
557 if (flags
& TBS_VERT
) {
570 TRACKBAR_DrawTic (const TRACKBAR_INFO
*infoPtr
, HDC hdc
, LONG ticPos
, int flags
)
572 if ((flags
& (TBS_LEFT
| TBS_TOP
)) || (flags
& TBS_BOTH
))
573 TRACKBAR_DrawOneTic (infoPtr
, hdc
, ticPos
, flags
| TBS_LEFT
);
575 if (!(flags
& (TBS_LEFT
| TBS_TOP
)) || (flags
& TBS_BOTH
))
576 TRACKBAR_DrawOneTic (infoPtr
, hdc
, ticPos
, flags
& ~TBS_LEFT
);
580 TRACKBAR_DrawTics (const TRACKBAR_INFO
*infoPtr
, HDC hdc
)
583 int ticFlags
= infoPtr
->dwStyle
& 0x0f;
584 LOGPEN ticPen
= { PS_SOLID
, {1, 0}, GetSysColor (COLOR_3DDKSHADOW
) };
585 HPEN hOldPen
, hTicPen
;
586 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
590 int part
= (infoPtr
->dwStyle
& TBS_VERT
) ? TKP_TICSVERT
: TKP_TICS
;
591 GetThemeColor (theme
, part
, TSS_NORMAL
, TMT_COLOR
, &ticPen
.lopnColor
);
593 /* create the pen to draw the tics with */
594 hTicPen
= CreatePenIndirect(&ticPen
);
595 hOldPen
= hTicPen
? SelectObject(hdc
, hTicPen
) : 0;
597 /* actually draw the tics */
598 for (i
=0; i
<infoPtr
->uNumTics
; i
++)
599 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->tics
[i
], ticFlags
);
601 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lRangeMin
, ticFlags
| TIC_EDGE
);
602 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lRangeMax
, ticFlags
| TIC_EDGE
);
604 if ((infoPtr
->dwStyle
& TBS_ENABLESELRANGE
) && TRACKBAR_HasSelection(infoPtr
)) {
605 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lSelMin
,
606 ticFlags
| TIC_SELECTIONMARKMIN
);
607 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lSelMax
,
608 ticFlags
| TIC_SELECTIONMARKMAX
);
611 /* clean up the pen, if we created one */
613 SelectObject(hdc
, hOldPen
);
614 DeleteObject(hTicPen
);
619 TRACKBAR_DrawThumb (const TRACKBAR_INFO
*infoPtr
, HDC hdc
)
623 RECT thumb
= infoPtr
->rcThumb
;
629 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
635 if (infoPtr
->dwStyle
& TBS_BOTH
)
636 partId
= (infoPtr
->dwStyle
& TBS_VERT
) ? TKP_THUMBVERT
: TKP_THUMB
;
637 else if (infoPtr
->dwStyle
& TBS_LEFT
)
638 partId
= (infoPtr
->dwStyle
& TBS_VERT
) ? TKP_THUMBLEFT
: TKP_THUMBTOP
;
640 partId
= (infoPtr
->dwStyle
& TBS_VERT
) ? TKP_THUMBRIGHT
: TKP_THUMBBOTTOM
;
642 if (infoPtr
->dwStyle
& WS_DISABLED
)
643 stateId
= TUS_DISABLED
;
644 else if (infoPtr
->flags
& TB_DRAG_MODE
)
645 stateId
= TUS_PRESSED
;
646 else if (infoPtr
->flags
& TB_THUMB_HOT
)
649 stateId
= TUS_NORMAL
;
651 DrawThemeBackground (theme
, hdc
, partId
, stateId
, &thumb
, 0);
656 fillClr
= infoPtr
->flags
& TB_DRAG_MODE
? COLOR_BTNHILIGHT
: COLOR_BTNFACE
;
657 oldbr
= SelectObject (hdc
, GetSysColorBrush(fillClr
));
658 SetPolyFillMode (hdc
, WINDING
);
660 if (infoPtr
->dwStyle
& TBS_BOTH
)
662 points
[0].x
=thumb
.right
;
663 points
[0].y
=thumb
.top
;
664 points
[1].x
=thumb
.right
;
665 points
[1].y
=thumb
.bottom
;
666 points
[2].x
=thumb
.left
;
667 points
[2].y
=thumb
.bottom
;
668 points
[3].x
=thumb
.left
;
669 points
[3].y
=thumb
.top
;
670 points
[4].x
=points
[0].x
;
671 points
[4].y
=points
[0].y
;
677 if (infoPtr
->dwStyle
& TBS_VERT
)
679 PointDepth
= (thumb
.bottom
- thumb
.top
) / 2;
680 if (infoPtr
->dwStyle
& TBS_LEFT
)
682 points
[0].x
=thumb
.right
;
683 points
[0].y
=thumb
.top
;
684 points
[1].x
=thumb
.right
;
685 points
[1].y
=thumb
.bottom
;
686 points
[2].x
=thumb
.left
+ PointDepth
;
687 points
[2].y
=thumb
.bottom
;
688 points
[3].x
=thumb
.left
;
689 points
[3].y
=(thumb
.bottom
- thumb
.top
) / 2 + thumb
.top
+ 1;
690 points
[4].x
=thumb
.left
+ PointDepth
;
691 points
[4].y
=thumb
.top
;
692 points
[5].x
=points
[0].x
;
693 points
[5].y
=points
[0].y
;
698 points
[0].x
=thumb
.right
;
699 points
[0].y
=(thumb
.bottom
- thumb
.top
) / 2 + thumb
.top
+ 1;
700 points
[1].x
=thumb
.right
- PointDepth
;
701 points
[1].y
=thumb
.bottom
;
702 points
[2].x
=thumb
.left
;
703 points
[2].y
=thumb
.bottom
;
704 points
[3].x
=thumb
.left
;
705 points
[3].y
=thumb
.top
;
706 points
[4].x
=thumb
.right
- PointDepth
;
707 points
[4].y
=thumb
.top
;
708 points
[5].x
=points
[0].x
;
709 points
[5].y
=points
[0].y
;
714 PointDepth
= (thumb
.right
- thumb
.left
) / 2;
715 if (infoPtr
->dwStyle
& TBS_TOP
)
717 points
[0].x
=(thumb
.right
- thumb
.left
) / 2 + thumb
.left
+ 1;
718 points
[0].y
=thumb
.top
;
719 points
[1].x
=thumb
.right
;
720 points
[1].y
=thumb
.top
+ PointDepth
;
721 points
[2].x
=thumb
.right
;
722 points
[2].y
=thumb
.bottom
;
723 points
[3].x
=thumb
.left
;
724 points
[3].y
=thumb
.bottom
;
725 points
[4].x
=thumb
.left
;
726 points
[4].y
=thumb
.top
+ PointDepth
;
727 points
[5].x
=points
[0].x
;
728 points
[5].y
=points
[0].y
;
733 points
[0].x
=thumb
.right
;
734 points
[0].y
=thumb
.top
;
735 points
[1].x
=thumb
.right
;
736 points
[1].y
=thumb
.bottom
- PointDepth
;
737 points
[2].x
=(thumb
.right
- thumb
.left
) / 2 + thumb
.left
+ 1;
738 points
[2].y
=thumb
.bottom
;
739 points
[3].x
=thumb
.left
;
740 points
[3].y
=thumb
.bottom
- PointDepth
;
741 points
[4].x
=thumb
.left
;
742 points
[4].y
=thumb
.top
;
743 points
[5].x
=points
[0].x
;
744 points
[5].y
=points
[0].y
;
750 /* Draw the thumb now */
751 Polygon (hdc
, points
, PointCount
);
752 oldpen
= SelectObject(hdc
, GetStockObject(BLACK_PEN
));
753 Polyline(hdc
,points
, BlackUntil
);
754 SelectObject(hdc
, GetStockObject(WHITE_PEN
));
755 Polyline(hdc
, &points
[BlackUntil
-1], PointCount
+1-BlackUntil
);
756 SelectObject(hdc
, oldpen
);
757 SelectObject(hdc
, oldbr
);
762 TRACKBAR_ActivateToolTip (const TRACKBAR_INFO
*infoPtr
, BOOL fShow
)
766 if (!infoPtr
->hwndToolTip
) return;
768 ZeroMemory(&ti
, sizeof(ti
));
769 ti
.cbSize
= sizeof(ti
);
770 ti
.hwnd
= infoPtr
->hwndSelf
;
772 SendMessageW (infoPtr
->hwndToolTip
, TTM_TRACKACTIVATE
, fShow
, (LPARAM
)&ti
);
777 TRACKBAR_UpdateToolTip (const TRACKBAR_INFO
*infoPtr
)
780 static const WCHAR fmt
[] = { '%', 'l', 'd', 0 };
786 if (!infoPtr
->hwndToolTip
) return;
788 ZeroMemory(&ti
, sizeof(ti
));
789 ti
.cbSize
= sizeof(ti
);
790 ti
.hwnd
= infoPtr
->hwndSelf
;
791 ti
.uFlags
= TTF_IDISHWND
| TTF_TRACK
| TTF_ABSOLUTE
;
793 wsprintfW (buf
, fmt
, infoPtr
->lPos
);
795 SendMessageW (infoPtr
->hwndToolTip
, TTM_UPDATETIPTEXTW
, 0, (LPARAM
)&ti
);
797 GetClientRect (infoPtr
->hwndSelf
, &rcClient
);
798 size
= SendMessageW (infoPtr
->hwndToolTip
, TTM_GETBUBBLESIZE
, 0, (LPARAM
)&ti
);
799 if (infoPtr
->dwStyle
& TBS_VERT
) {
800 if (infoPtr
->fLocation
== TBTS_LEFT
)
801 pt
.x
= 0 - LOWORD(size
) - TOOLTIP_OFFSET
;
803 pt
.x
= rcClient
.right
+ TOOLTIP_OFFSET
;
804 pt
.y
= (infoPtr
->rcThumb
.top
+ infoPtr
->rcThumb
.bottom
- HIWORD(size
))/2;
806 if (infoPtr
->fLocation
== TBTS_TOP
)
807 pt
.y
= 0 - HIWORD(size
) - TOOLTIP_OFFSET
;
809 pt
.y
= rcClient
.bottom
+ TOOLTIP_OFFSET
;
810 pt
.x
= (infoPtr
->rcThumb
.left
+ infoPtr
->rcThumb
.right
- LOWORD(size
))/2;
812 ClientToScreen(infoPtr
->hwndSelf
, &pt
);
814 SendMessageW (infoPtr
->hwndToolTip
, TTM_TRACKPOSITION
,
815 0, MAKELPARAM(pt
.x
, pt
.y
));
820 TRACKBAR_Refresh (TRACKBAR_INFO
*infoPtr
, HDC hdcDst
)
824 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 (GetWindowTheme (infoPtr
->hwndSelf
)) {
872 DrawThemeParentBackground (infoPtr
->hwndSelf
, hdc
, 0);
875 FillRect (hdc
, &rcClient
, GetSysColorBrush(COLOR_BTNFACE
));
876 if (gcdrf
!= CDRF_DODEFAULT
)
877 notify_customdraw(infoPtr
, &nmcd
, CDDS_POSTERASE
);
881 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
882 nmcd
.dwItemSpec
= TBCD_CHANNEL
;
883 nmcd
.uItemState
= CDIS_DEFAULT
;
884 nmcd
.rc
= infoPtr
->rcChannel
;
885 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
886 } else icdrf
= CDRF_DODEFAULT
;
887 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
888 TRACKBAR_DrawChannel (infoPtr
, hdc
);
889 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
890 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
895 if (!(infoPtr
->dwStyle
& TBS_NOTICKS
)) {
896 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
897 nmcd
.dwItemSpec
= TBCD_TICS
;
898 nmcd
.uItemState
= CDIS_DEFAULT
;
900 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
901 } else icdrf
= CDRF_DODEFAULT
;
902 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
903 TRACKBAR_DrawTics (infoPtr
, hdc
);
904 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
905 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
910 if (!(infoPtr
->dwStyle
& TBS_NOTHUMB
)) {
911 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
912 nmcd
.dwItemSpec
= TBCD_THUMB
;
913 nmcd
.uItemState
= infoPtr
->flags
& TB_DRAG_MODE
? CDIS_HOT
: CDIS_DEFAULT
;
914 nmcd
.rc
= infoPtr
->rcThumb
;
915 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
916 } else icdrf
= CDRF_DODEFAULT
;
917 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
918 TRACKBAR_DrawThumb(infoPtr
, hdc
);
919 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
920 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
924 /* draw focus rectangle */
925 if (infoPtr
->bFocussed
) {
926 DrawFocusRect(hdc
, &rcClient
);
929 /* finish up the painting */
930 if (gcdrf
& CDRF_NOTIFYPOSTPAINT
)
931 notify_customdraw(infoPtr
, &nmcd
, CDDS_POSTPAINT
);
934 /* cleanup, if we rendered offscreen */
936 BitBlt(hdcDst
, 0, 0, rcClient
.right
, rcClient
.bottom
, hdc
, 0, 0, SRCCOPY
);
937 SelectObject(hdc
, hOldBmp
);
938 DeleteObject(hOffScreenBmp
);
945 TRACKBAR_AlignBuddies (const TRACKBAR_INFO
*infoPtr
)
947 HWND hwndParent
= GetParent (infoPtr
->hwndSelf
);
948 RECT rcSelf
, rcBuddy
;
951 GetWindowRect (infoPtr
->hwndSelf
, &rcSelf
);
952 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcSelf
, 2);
954 /* align buddy left or above */
955 if (infoPtr
->hwndBuddyLA
) {
956 GetWindowRect (infoPtr
->hwndBuddyLA
, &rcBuddy
);
957 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcBuddy
, 2);
959 if (infoPtr
->dwStyle
& TBS_VERT
) {
960 x
= (infoPtr
->rcChannel
.right
+ infoPtr
->rcChannel
.left
) / 2 -
961 (rcBuddy
.right
- rcBuddy
.left
) / 2 + rcSelf
.left
;
962 y
= rcSelf
.top
- (rcBuddy
.bottom
- rcBuddy
.top
);
965 x
= rcSelf
.left
- (rcBuddy
.right
- rcBuddy
.left
);
966 y
= (infoPtr
->rcChannel
.bottom
+ infoPtr
->rcChannel
.top
) / 2 -
967 (rcBuddy
.bottom
- rcBuddy
.top
) / 2 + rcSelf
.top
;
970 SetWindowPos (infoPtr
->hwndBuddyLA
, 0, x
, y
, 0, 0,
971 SWP_NOZORDER
| SWP_NOSIZE
);
975 /* align buddy right or below */
976 if (infoPtr
->hwndBuddyRB
) {
977 GetWindowRect (infoPtr
->hwndBuddyRB
, &rcBuddy
);
978 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcBuddy
, 2);
980 if (infoPtr
->dwStyle
& TBS_VERT
) {
981 x
= (infoPtr
->rcChannel
.right
+ infoPtr
->rcChannel
.left
) / 2 -
982 (rcBuddy
.right
- rcBuddy
.left
) / 2 + rcSelf
.left
;
987 y
= (infoPtr
->rcChannel
.bottom
+ infoPtr
->rcChannel
.top
) / 2 -
988 (rcBuddy
.bottom
- rcBuddy
.top
) / 2 + rcSelf
.top
;
990 SetWindowPos (infoPtr
->hwndBuddyRB
, 0, x
, y
, 0, 0,
991 SWP_NOZORDER
| SWP_NOSIZE
);
997 TRACKBAR_ClearSel (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
)
999 infoPtr
->lSelMin
= 0;
1000 infoPtr
->lSelMax
= 0;
1001 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1003 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1010 TRACKBAR_ClearTics (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
)
1012 if (infoPtr
->tics
) {
1013 Free (infoPtr
->tics
);
1014 infoPtr
->tics
= NULL
;
1015 infoPtr
->uNumTics
= 0;
1018 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1024 static inline LRESULT
1025 TRACKBAR_GetChannelRect (const TRACKBAR_INFO
*infoPtr
, LPRECT lprc
)
1027 if (lprc
== NULL
) return 0;
1029 lprc
->left
= infoPtr
->rcChannel
.left
;
1030 lprc
->right
= infoPtr
->rcChannel
.right
;
1031 lprc
->bottom
= infoPtr
->rcChannel
.bottom
;
1032 lprc
->top
= infoPtr
->rcChannel
.top
;
1039 TRACKBAR_GetNumTics (const TRACKBAR_INFO
*infoPtr
)
1041 if (infoPtr
->dwStyle
& TBS_NOTICKS
) return 0;
1043 return infoPtr
->uNumTics
+ 2;
1047 static int comp_tics (const void *ap
, const void *bp
)
1049 const DWORD a
= *(const DWORD
*)ap
;
1050 const DWORD b
= *(const DWORD
*)bp
;
1052 TRACE("(a=%d, b=%d)\n", a
, b
);
1053 if (a
< b
) return -1;
1054 if (a
> b
) return 1;
1060 TRACKBAR_GetTic (const TRACKBAR_INFO
*infoPtr
, INT iTic
)
1062 if ((iTic
< 0) || (iTic
>= infoPtr
->uNumTics
) || !infoPtr
->tics
)
1065 qsort(infoPtr
->tics
, infoPtr
->uNumTics
, sizeof(DWORD
), comp_tics
);
1066 return infoPtr
->tics
[iTic
];
1071 TRACKBAR_GetTicPos (const TRACKBAR_INFO
*infoPtr
, INT iTic
)
1073 LONG range
, width
, pos
, tic
;
1076 if ((iTic
< 0) || (iTic
>= infoPtr
->uNumTics
) || !infoPtr
->tics
)
1079 tic
= TRACKBAR_GetTic (infoPtr
, iTic
);
1080 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
1081 if (range
<= 0) range
= 1;
1082 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
1083 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- offsetthumb
*2;
1084 pos
= infoPtr
->rcChannel
.left
+ offsetthumb
+ (width
* tic
) / range
;
1091 TRACKBAR_SetBuddy (TRACKBAR_INFO
*infoPtr
, BOOL fLocation
, HWND hwndBuddy
)
1096 /* buddy is left or above */
1097 hwndTemp
= infoPtr
->hwndBuddyLA
;
1098 infoPtr
->hwndBuddyLA
= hwndBuddy
;
1101 /* buddy is right or below */
1102 hwndTemp
= infoPtr
->hwndBuddyRB
;
1103 infoPtr
->hwndBuddyRB
= hwndBuddy
;
1106 TRACKBAR_AlignBuddies (infoPtr
);
1113 TRACKBAR_SetLineSize (TRACKBAR_INFO
*infoPtr
, LONG lLineSize
)
1115 LONG lTemp
= infoPtr
->lLineSize
;
1117 infoPtr
->lLineSize
= lLineSize
;
1124 TRACKBAR_SetPageSize (TRACKBAR_INFO
*infoPtr
, LONG lPageSize
)
1126 LONG lTemp
= infoPtr
->lPageSize
;
1128 if (lPageSize
!= -1)
1129 infoPtr
->lPageSize
= lPageSize
;
1131 infoPtr
->lPageSize
= TB_DEFAULTPAGESIZE
;
1137 static inline LRESULT
1138 TRACKBAR_SetPos (TRACKBAR_INFO
*infoPtr
, BOOL fPosition
, LONG lPosition
)
1140 LONG oldPos
= infoPtr
->lPos
;
1141 infoPtr
->lPos
= lPosition
;
1143 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
1144 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1146 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
1147 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1148 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1150 if (fPosition
&& oldPos
!= lPosition
) TRACKBAR_InvalidateThumbMove(infoPtr
, oldPos
, lPosition
);
1156 static inline LRESULT
1157 TRACKBAR_SetRange (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lRange
)
1159 infoPtr
->lRangeMin
= (SHORT
)LOWORD(lRange
);
1160 infoPtr
->lRangeMax
= (SHORT
)HIWORD(lRange
);
1162 if (infoPtr
->lPos
< infoPtr
->lRangeMin
) {
1163 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1164 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1167 if (infoPtr
->lPos
> infoPtr
->lRangeMax
) {
1168 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1169 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1172 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1173 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1175 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1181 static inline LRESULT
1182 TRACKBAR_SetRangeMax (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lMax
)
1184 infoPtr
->lRangeMax
= lMax
;
1185 if (infoPtr
->lPos
> infoPtr
->lRangeMax
) {
1186 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1187 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1190 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1191 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1193 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1199 static inline LRESULT
1200 TRACKBAR_SetRangeMin (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lMin
)
1202 infoPtr
->lRangeMin
= lMin
;
1203 if (infoPtr
->lPos
< infoPtr
->lRangeMin
) {
1204 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1205 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1208 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1209 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1211 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1217 static inline LRESULT
1218 TRACKBAR_SetSel (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lSel
)
1220 if (!(infoPtr
->dwStyle
& TBS_ENABLESELRANGE
)){
1221 infoPtr
->lSelMin
= 0;
1222 infoPtr
->lSelMax
= 0;
1226 infoPtr
->lSelMin
= (SHORT
)LOWORD(lSel
);
1227 infoPtr
->lSelMax
= (SHORT
)HIWORD(lSel
);
1228 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1230 if (infoPtr
->lSelMin
< infoPtr
->lRangeMin
)
1231 infoPtr
->lSelMin
= infoPtr
->lRangeMin
;
1232 if (infoPtr
->lSelMax
> infoPtr
->lRangeMax
)
1233 infoPtr
->lSelMax
= infoPtr
->lRangeMax
;
1235 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1241 static inline LRESULT
1242 TRACKBAR_SetSelEnd (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lEnd
)
1244 if (!(infoPtr
->dwStyle
& TBS_ENABLESELRANGE
)){
1245 infoPtr
->lSelMax
= 0;
1249 infoPtr
->lSelMax
= lEnd
;
1250 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1252 if (infoPtr
->lSelMax
> infoPtr
->lRangeMax
)
1253 infoPtr
->lSelMax
= infoPtr
->lRangeMax
;
1255 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1261 static inline LRESULT
1262 TRACKBAR_SetSelStart (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lStart
)
1264 if (!(infoPtr
->dwStyle
& TBS_ENABLESELRANGE
)){
1265 infoPtr
->lSelMin
= 0;
1269 infoPtr
->lSelMin
= lStart
;
1270 infoPtr
->flags
|=TB_SELECTIONCHANGED
;
1272 if (infoPtr
->lSelMin
< infoPtr
->lRangeMin
)
1273 infoPtr
->lSelMin
= infoPtr
->lRangeMin
;
1275 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1281 static inline LRESULT
1282 TRACKBAR_SetThumbLength (TRACKBAR_INFO
*infoPtr
, UINT iLength
)
1284 if (infoPtr
->dwStyle
& TBS_FIXEDLENGTH
) {
1285 infoPtr
->uThumbLen
= iLength
;
1286 infoPtr
->flags
|= TB_THUMBSIZECHANGED
;
1287 InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1294 static inline LRESULT
1295 TRACKBAR_SetTic (TRACKBAR_INFO
*infoPtr
, LONG lPos
)
1297 if ((lPos
< infoPtr
->lRangeMin
) || (lPos
> infoPtr
->lRangeMax
))
1300 TRACE("lPos=%d\n", lPos
);
1302 infoPtr
->uNumTics
++;
1303 infoPtr
->tics
=ReAlloc( infoPtr
->tics
,
1304 (infoPtr
->uNumTics
)*sizeof (DWORD
));
1305 if (!infoPtr
->tics
) {
1306 infoPtr
->uNumTics
= 0;
1307 notify(infoPtr
, NM_OUTOFMEMORY
);
1310 infoPtr
->tics
[infoPtr
->uNumTics
-1] = lPos
;
1312 TRACKBAR_InvalidateAll(infoPtr
);
1318 static inline LRESULT
1319 TRACKBAR_SetTicFreq (TRACKBAR_INFO
*infoPtr
, WORD wFreq
)
1321 if (infoPtr
->dwStyle
& TBS_AUTOTICKS
) {
1322 infoPtr
->uTicFreq
= wFreq
;
1323 TRACKBAR_RecalculateTics (infoPtr
);
1324 TRACKBAR_InvalidateAll(infoPtr
);
1332 TRACKBAR_SetTipSide (TRACKBAR_INFO
*infoPtr
, INT fLocation
)
1334 INT fTemp
= infoPtr
->fLocation
;
1336 infoPtr
->fLocation
= fLocation
;
1342 static inline LRESULT
1343 TRACKBAR_SetToolTips (TRACKBAR_INFO
*infoPtr
, HWND hwndTT
)
1345 infoPtr
->hwndToolTip
= hwndTT
;
1352 TRACKBAR_SetUnicodeFormat (TRACKBAR_INFO
*infoPtr
, BOOL fUnicode
)
1354 BOOL bTemp
= infoPtr
->bUnicode
;
1356 infoPtr
->bUnicode
= fUnicode
;
1363 TRACKBAR_InitializeThumb (TRACKBAR_INFO
*infoPtr
)
1366 int clientWidth
, clientMetric
;
1368 /* initial thumb length */
1369 clientMetric
= (infoPtr
->dwStyle
& TBS_ENABLESELRANGE
) ? 23 : 21;
1370 GetClientRect(infoPtr
->hwndSelf
,&rect
);
1371 if (infoPtr
->dwStyle
& TBS_VERT
) {
1372 clientWidth
= rect
.right
- rect
.left
;
1374 clientWidth
= rect
.bottom
- rect
.top
;
1376 if (clientWidth
>= clientMetric
)
1377 infoPtr
->uThumbLen
= clientMetric
;
1379 infoPtr
->uThumbLen
= clientWidth
> 9 ? clientWidth
- 6 : 4;
1381 TRACKBAR_CalcChannel (infoPtr
);
1382 TRACKBAR_UpdateThumb (infoPtr
);
1383 infoPtr
->flags
&= ~TB_SELECTIONCHANGED
;
1390 TRACKBAR_Create (HWND hwnd
, const CREATESTRUCTW
*lpcs
)
1392 TRACKBAR_INFO
*infoPtr
;
1394 infoPtr
= Alloc (sizeof(TRACKBAR_INFO
));
1395 if (!infoPtr
) return -1;
1396 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
1398 /* set default values */
1399 infoPtr
->hwndSelf
= hwnd
;
1400 infoPtr
->dwStyle
= lpcs
->style
;
1401 infoPtr
->lRangeMin
= 0;
1402 infoPtr
->lRangeMax
= 100;
1403 infoPtr
->lLineSize
= 1;
1404 infoPtr
->lPageSize
= TB_DEFAULTPAGESIZE
;
1405 infoPtr
->lSelMin
= 0;
1406 infoPtr
->lSelMax
= 0;
1408 infoPtr
->fLocation
= TBTS_TOP
;
1409 infoPtr
->uNumTics
= 0; /* start and end tic are not included in count*/
1410 infoPtr
->uTicFreq
= 1;
1411 infoPtr
->tics
= NULL
;
1412 infoPtr
->hwndNotify
= lpcs
->hwndParent
;
1414 TRACKBAR_InitializeThumb (infoPtr
);
1416 /* Create tooltip control */
1417 if (infoPtr
->dwStyle
& TBS_TOOLTIPS
) {
1419 infoPtr
->hwndToolTip
=
1420 CreateWindowExW (0, TOOLTIPS_CLASSW
, NULL
, WS_POPUP
,
1421 CW_USEDEFAULT
, CW_USEDEFAULT
,
1422 CW_USEDEFAULT
, CW_USEDEFAULT
,
1425 if (infoPtr
->hwndToolTip
) {
1427 ZeroMemory (&ti
, sizeof(ti
));
1428 ti
.cbSize
= sizeof(ti
);
1429 ti
.uFlags
= TTF_IDISHWND
| TTF_TRACK
| TTF_ABSOLUTE
;
1432 SendMessageW (infoPtr
->hwndToolTip
, TTM_ADDTOOLW
, 0, (LPARAM
)&ti
);
1436 OpenThemeData (hwnd
, themeClass
);
1443 TRACKBAR_Destroy (TRACKBAR_INFO
*infoPtr
)
1445 /* delete tooltip control */
1446 if (infoPtr
->hwndToolTip
)
1447 DestroyWindow (infoPtr
->hwndToolTip
);
1449 Free (infoPtr
->tics
);
1450 infoPtr
->tics
= NULL
;
1452 SetWindowLongPtrW (infoPtr
->hwndSelf
, 0, 0);
1453 CloseThemeData (GetWindowTheme (infoPtr
->hwndSelf
));
1461 TRACKBAR_KillFocus (TRACKBAR_INFO
*infoPtr
)
1464 infoPtr
->bFocussed
= FALSE
;
1465 TRACKBAR_InvalidateAll(infoPtr
);
1471 TRACKBAR_LButtonDown (TRACKBAR_INFO
*infoPtr
, INT x
, INT y
)
1478 SetFocus(infoPtr
->hwndSelf
);
1480 if (PtInRect(&infoPtr
->rcThumb
, clickPoint
)) {
1481 infoPtr
->flags
|= TB_DRAG_MODE
;
1482 SetCapture (infoPtr
->hwndSelf
);
1483 TRACKBAR_UpdateToolTip (infoPtr
);
1484 TRACKBAR_ActivateToolTip (infoPtr
, TRUE
);
1485 TRACKBAR_InvalidateThumb(infoPtr
, infoPtr
->lPos
);
1487 LONG dir
= TRACKBAR_GetAutoPageDirection(infoPtr
, clickPoint
);
1488 if (dir
== 0) return 0;
1489 infoPtr
->flags
|= (dir
< 0) ? TB_AUTO_PAGE_LEFT
: TB_AUTO_PAGE_RIGHT
;
1490 TRACKBAR_AutoPage (infoPtr
, clickPoint
);
1491 SetCapture (infoPtr
->hwndSelf
);
1492 SetTimer(infoPtr
->hwndSelf
, TB_REFRESH_TIMER
, TB_REFRESH_DELAY
, 0);
1500 TRACKBAR_LButtonUp (TRACKBAR_INFO
*infoPtr
)
1502 if (infoPtr
->flags
& TB_DRAG_MODE
) {
1503 notify_with_scroll (infoPtr
, TB_THUMBPOSITION
| (infoPtr
->lPos
<<16));
1504 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1505 infoPtr
->flags
&= ~TB_DRAG_MODE
;
1507 notify(infoPtr
, NM_RELEASEDCAPTURE
);
1508 TRACKBAR_ActivateToolTip(infoPtr
, FALSE
);
1509 TRACKBAR_InvalidateThumb(infoPtr
, infoPtr
->lPos
);
1511 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1512 KillTimer (infoPtr
->hwndSelf
, TB_REFRESH_TIMER
);
1513 infoPtr
->flags
&= ~TB_AUTO_PAGE
;
1514 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1516 notify(infoPtr
, NM_RELEASEDCAPTURE
);
1524 TRACKBAR_CaptureChanged (const TRACKBAR_INFO
*infoPtr
)
1526 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1532 TRACKBAR_Paint (TRACKBAR_INFO
*infoPtr
, HDC hdc
)
1535 TRACKBAR_Refresh(infoPtr
, hdc
);
1538 hdc
= BeginPaint (infoPtr
->hwndSelf
, &ps
);
1539 TRACKBAR_Refresh (infoPtr
, hdc
);
1540 EndPaint (infoPtr
->hwndSelf
, &ps
);
1548 TRACKBAR_SetFocus (TRACKBAR_INFO
*infoPtr
)
1551 infoPtr
->bFocussed
= TRUE
;
1552 TRACKBAR_InvalidateAll(infoPtr
);
1559 TRACKBAR_Size (TRACKBAR_INFO
*infoPtr
)
1561 TRACKBAR_InitializeThumb (infoPtr
);
1562 TRACKBAR_AlignBuddies (infoPtr
);
1568 TRACKBAR_StyleChanged (TRACKBAR_INFO
*infoPtr
, WPARAM wStyleType
,
1569 const STYLESTRUCT
*lpss
)
1571 if (wStyleType
!= GWL_STYLE
) return 0;
1573 infoPtr
->dwStyle
= lpss
->styleNew
;
1579 TRACKBAR_Timer (TRACKBAR_INFO
*infoPtr
)
1581 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1583 if (GetCursorPos(&pt
))
1584 if (ScreenToClient(infoPtr
->hwndSelf
, &pt
))
1585 TRACKBAR_AutoPage(infoPtr
, pt
);
1591 /* update theme after a WM_THEMECHANGED message */
1592 static LRESULT
theme_changed (const TRACKBAR_INFO
* infoPtr
)
1594 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
1595 CloseThemeData (theme
);
1596 OpenThemeData (infoPtr
->hwndSelf
, themeClass
);
1602 TRACKBAR_MouseMove (TRACKBAR_INFO
*infoPtr
, INT x
, INT y
)
1604 INT clickPlace
= (infoPtr
->dwStyle
& TBS_VERT
) ? y
: x
;
1605 LONG dragPos
, oldPos
= infoPtr
->lPos
;
1607 TRACE("(x=%d. y=%d)\n", x
, y
);
1609 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1613 TRACKBAR_AutoPage (infoPtr
, pt
);
1617 if (!(infoPtr
->flags
& TB_DRAG_MODE
))
1619 if (GetWindowTheme (infoPtr
->hwndSelf
))
1621 DWORD oldFlags
= infoPtr
->flags
;
1625 if (PtInRect (&infoPtr
->rcThumb
, pt
))
1627 TRACKMOUSEEVENT tme
;
1628 tme
.cbSize
= sizeof( tme
);
1629 tme
.dwFlags
= TME_LEAVE
;
1630 tme
.hwndTrack
= infoPtr
->hwndSelf
;
1631 TrackMouseEvent( &tme
);
1632 infoPtr
->flags
|= TB_THUMB_HOT
;
1636 TRACKMOUSEEVENT tme
;
1637 tme
.cbSize
= sizeof( tme
);
1638 tme
.dwFlags
= TME_CANCEL
;
1639 tme
.hwndTrack
= infoPtr
->hwndSelf
;
1640 TrackMouseEvent( &tme
);
1641 infoPtr
->flags
&= ~TB_THUMB_HOT
;
1643 if (oldFlags
!= infoPtr
->flags
) InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1648 dragPos
= TRACKBAR_ConvertPlaceToPosition (infoPtr
, clickPlace
);
1650 if (dragPos
== oldPos
) return TRUE
;
1652 infoPtr
->lPos
= dragPos
;
1654 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1655 notify_with_scroll (infoPtr
, TB_THUMBTRACK
| (infoPtr
->lPos
<<16));
1658 TRACKBAR_InvalidateThumbMove(infoPtr
, oldPos
, dragPos
);
1659 UpdateWindow (infoPtr
->hwndSelf
);
1665 TRACKBAR_KeyDown (TRACKBAR_INFO
*infoPtr
, INT nVirtKey
)
1667 BOOL downIsLeft
= infoPtr
->dwStyle
& TBS_DOWNISLEFT
;
1668 BOOL vert
= infoPtr
->dwStyle
& TBS_VERT
;
1669 LONG pos
= infoPtr
->lPos
;
1671 TRACE("%x\n", nVirtKey
);
1675 if (!vert
&& downIsLeft
) TRACKBAR_LineDown(infoPtr
);
1676 else TRACKBAR_LineUp(infoPtr
);
1679 if (vert
&& downIsLeft
) TRACKBAR_LineDown(infoPtr
);
1680 else TRACKBAR_LineUp(infoPtr
);
1683 if (!vert
&& downIsLeft
) TRACKBAR_LineUp(infoPtr
);
1684 else TRACKBAR_LineDown(infoPtr
);
1687 if (vert
&& downIsLeft
) TRACKBAR_LineUp(infoPtr
);
1688 else TRACKBAR_LineDown(infoPtr
);
1691 if (!vert
&& downIsLeft
) TRACKBAR_PageUp(infoPtr
);
1692 else TRACKBAR_PageDown(infoPtr
);
1695 if (!vert
&& downIsLeft
) TRACKBAR_PageDown(infoPtr
);
1696 else TRACKBAR_PageUp(infoPtr
);
1699 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return FALSE
;
1700 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1701 notify_with_scroll (infoPtr
, TB_TOP
);
1704 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return FALSE
;
1705 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1706 notify_with_scroll (infoPtr
, TB_BOTTOM
);
1710 if (pos
!= infoPtr
->lPos
) {
1711 infoPtr
->flags
|=TB_THUMBPOSCHANGED
;
1712 TRACKBAR_InvalidateThumbMove (infoPtr
, pos
, infoPtr
->lPos
);
1720 TRACKBAR_KeyUp (const TRACKBAR_INFO
*infoPtr
, INT nVirtKey
)
1731 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1737 static LRESULT WINAPI
1738 TRACKBAR_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
1740 TRACKBAR_INFO
*infoPtr
= (TRACKBAR_INFO
*)GetWindowLongPtrW (hwnd
, 0);
1742 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hwnd
, uMsg
, wParam
, lParam
);
1744 if (!infoPtr
&& (uMsg
!= WM_CREATE
))
1745 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
1750 return TRACKBAR_ClearSel (infoPtr
, (BOOL
)wParam
);
1753 return TRACKBAR_ClearTics (infoPtr
, (BOOL
)wParam
);
1756 return (LRESULT
)(wParam
? infoPtr
->hwndBuddyLA
: infoPtr
->hwndBuddyRB
);
1758 case TBM_GETCHANNELRECT
:
1759 return TRACKBAR_GetChannelRect (infoPtr
, (LPRECT
)lParam
);
1761 case TBM_GETLINESIZE
:
1762 return infoPtr
->lLineSize
;
1764 case TBM_GETNUMTICS
:
1765 return TRACKBAR_GetNumTics (infoPtr
);
1767 case TBM_GETPAGESIZE
:
1768 return infoPtr
->lPageSize
;
1771 return infoPtr
->lPos
;
1774 return (LRESULT
)infoPtr
->tics
;
1776 case TBM_GETRANGEMAX
:
1777 return infoPtr
->lRangeMax
;
1779 case TBM_GETRANGEMIN
:
1780 return infoPtr
->lRangeMin
;
1783 return infoPtr
->lSelMax
;
1785 case TBM_GETSELSTART
:
1786 return infoPtr
->lSelMin
;
1788 case TBM_GETTHUMBLENGTH
:
1789 return infoPtr
->uThumbLen
;
1791 case TBM_GETTHUMBRECT
:
1792 return CopyRect((LPRECT
)lParam
, &infoPtr
->rcThumb
);
1795 return TRACKBAR_GetTic (infoPtr
, (INT
)wParam
);
1798 return TRACKBAR_GetTicPos (infoPtr
, (INT
)wParam
);
1800 case TBM_GETTOOLTIPS
:
1801 return (LRESULT
)infoPtr
->hwndToolTip
;
1803 case TBM_GETUNICODEFORMAT
:
1804 return infoPtr
->bUnicode
;
1807 return (LRESULT
) TRACKBAR_SetBuddy(infoPtr
, (BOOL
)wParam
, (HWND
)lParam
);
1809 case TBM_SETLINESIZE
:
1810 return TRACKBAR_SetLineSize (infoPtr
, (LONG
)lParam
);
1812 case TBM_SETPAGESIZE
:
1813 return TRACKBAR_SetPageSize (infoPtr
, (LONG
)lParam
);
1816 return TRACKBAR_SetPos (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1819 return TRACKBAR_SetRange (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1821 case TBM_SETRANGEMAX
:
1822 return TRACKBAR_SetRangeMax (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1824 case TBM_SETRANGEMIN
:
1825 return TRACKBAR_SetRangeMin (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1828 return TRACKBAR_SetSel (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1831 return TRACKBAR_SetSelEnd (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1833 case TBM_SETSELSTART
:
1834 return TRACKBAR_SetSelStart (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1836 case TBM_SETTHUMBLENGTH
:
1837 return TRACKBAR_SetThumbLength (infoPtr
, (UINT
)wParam
);
1840 return TRACKBAR_SetTic (infoPtr
, (LONG
)lParam
);
1842 case TBM_SETTICFREQ
:
1843 return TRACKBAR_SetTicFreq (infoPtr
, (WORD
)wParam
);
1845 case TBM_SETTIPSIDE
:
1846 return TRACKBAR_SetTipSide (infoPtr
, (INT
)wParam
);
1848 case TBM_SETTOOLTIPS
:
1849 return TRACKBAR_SetToolTips (infoPtr
, (HWND
)wParam
);
1851 case TBM_SETUNICODEFORMAT
:
1852 return TRACKBAR_SetUnicodeFormat (infoPtr
, (BOOL
)wParam
);
1855 case WM_CAPTURECHANGED
:
1856 return TRACKBAR_CaptureChanged (infoPtr
);
1859 return TRACKBAR_Create (hwnd
, (LPCREATESTRUCTW
)lParam
);
1862 return TRACKBAR_Destroy (infoPtr
);
1864 /* case WM_ENABLE: */
1870 return DLGC_WANTARROWS
;
1873 return TRACKBAR_KeyDown (infoPtr
, (INT
)wParam
);
1876 return TRACKBAR_KeyUp (infoPtr
, (INT
)wParam
);
1879 return TRACKBAR_KillFocus (infoPtr
);
1881 case WM_LBUTTONDOWN
:
1882 return TRACKBAR_LButtonDown (infoPtr
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1885 return TRACKBAR_LButtonUp (infoPtr
);
1888 infoPtr
->flags
&= ~TB_THUMB_HOT
;
1889 InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1893 return TRACKBAR_MouseMove (infoPtr
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1895 case WM_PRINTCLIENT
:
1897 return TRACKBAR_Paint (infoPtr
, (HDC
)wParam
);
1900 return TRACKBAR_SetFocus (infoPtr
);
1903 return TRACKBAR_Size (infoPtr
);
1905 case WM_STYLECHANGED
:
1906 return TRACKBAR_StyleChanged (infoPtr
, wParam
, (LPSTYLESTRUCT
)lParam
);
1908 case WM_THEMECHANGED
:
1909 return theme_changed (infoPtr
);
1912 return TRACKBAR_Timer (infoPtr
);
1914 case WM_WININICHANGE
:
1915 return TRACKBAR_InitializeThumb (infoPtr
);
1918 if ((uMsg
>= WM_USER
) && (uMsg
< WM_APP
) && !COMCTL32_IsReflectedMessage(uMsg
))
1919 ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg
, wParam
, lParam
);
1920 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
1925 void TRACKBAR_Register (void)
1929 ZeroMemory (&wndClass
, sizeof(WNDCLASSW
));
1930 wndClass
.style
= CS_GLOBALCLASS
;
1931 wndClass
.lpfnWndProc
= TRACKBAR_WindowProc
;
1932 wndClass
.cbClsExtra
= 0;
1933 wndClass
.cbWndExtra
= sizeof(TRACKBAR_INFO
*);
1934 wndClass
.hCursor
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
1935 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
1936 wndClass
.lpszClassName
= TRACKBAR_CLASSW
;
1938 RegisterClassW (&wndClass
);
1942 void TRACKBAR_Unregister (void)
1944 UnregisterClassW (TRACKBAR_CLASSW
, NULL
);