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
)
152 if (infoPtr
->uTicFreq
&& infoPtr
->lRangeMax
>= infoPtr
->lRangeMin
)
153 nrTics
=(infoPtr
->lRangeMax
- infoPtr
->lRangeMin
)/infoPtr
->uTicFreq
;
156 Free (infoPtr
->tics
);
157 infoPtr
->tics
= NULL
;
158 infoPtr
->uNumTics
= 0;
162 if (nrTics
!= infoPtr
->uNumTics
) {
163 infoPtr
->tics
=ReAlloc (infoPtr
->tics
,
164 (nrTics
+1)*sizeof (DWORD
));
165 if (!infoPtr
->tics
) {
166 infoPtr
->uNumTics
= 0;
167 notify(infoPtr
, NM_OUTOFMEMORY
);
170 infoPtr
->uNumTics
= nrTics
;
173 tic
= infoPtr
->lRangeMin
+ infoPtr
->uTicFreq
;
174 for (i
= 0; i
< nrTics
; i
++, tic
+= infoPtr
->uTicFreq
)
175 infoPtr
->tics
[i
] = tic
;
178 /* converts from physical (mouse) position to logical position
179 (in range of trackbar) */
182 TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO
*infoPtr
, int place
, int vertical
)
184 double range
, width
, pos
, offsetthumb
;
186 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
188 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
189 width
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- (offsetthumb
* 2) - 1;
190 pos
= (range
*(place
- infoPtr
->rcChannel
.top
- offsetthumb
)) / width
;
192 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
193 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- (offsetthumb
* 2) - 1;
194 pos
= (range
*(place
- infoPtr
->rcChannel
.left
- offsetthumb
)) / width
;
196 pos
+= infoPtr
->lRangeMin
;
197 if (pos
> infoPtr
->lRangeMax
)
198 pos
= infoPtr
->lRangeMax
;
199 else if (pos
< infoPtr
->lRangeMin
)
200 pos
= infoPtr
->lRangeMin
;
202 TRACE("%.2f\n", pos
);
203 return (LONG
)(pos
+ 0.5);
207 /* return: 0> prev, 0 none, >0 next */
209 TRACKBAR_GetAutoPageDirection (const TRACKBAR_INFO
*infoPtr
, POINT clickPoint
)
211 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
214 if (dwStyle
& TBS_VERT
) {
215 pageRect
.top
= infoPtr
->rcChannel
.top
;
216 pageRect
.bottom
= infoPtr
->rcChannel
.bottom
;
217 pageRect
.left
= infoPtr
->rcThumb
.left
;
218 pageRect
.right
= infoPtr
->rcThumb
.right
;
220 pageRect
.top
= infoPtr
->rcThumb
.top
;
221 pageRect
.bottom
= infoPtr
->rcThumb
.bottom
;
222 pageRect
.left
= infoPtr
->rcChannel
.left
;
223 pageRect
.right
= infoPtr
->rcChannel
.right
;
227 if (PtInRect(&pageRect
, clickPoint
))
229 int clickPlace
= (dwStyle
& TBS_VERT
) ? clickPoint
.y
: clickPoint
.x
;
231 LONG clickPos
= TRACKBAR_ConvertPlaceToPosition(infoPtr
, clickPlace
,
233 return clickPos
- infoPtr
->lPos
;
240 TRACKBAR_PageDown (TRACKBAR_INFO
*infoPtr
)
242 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return;
244 infoPtr
->lPos
+= infoPtr
->lPageSize
;
245 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
246 infoPtr
->lPos
= infoPtr
->lRangeMax
;
247 notify_with_scroll (infoPtr
, TB_PAGEDOWN
);
252 TRACKBAR_PageUp (TRACKBAR_INFO
*infoPtr
)
254 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return;
256 infoPtr
->lPos
-= infoPtr
->lPageSize
;
257 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
258 infoPtr
->lPos
= infoPtr
->lRangeMin
;
259 notify_with_scroll (infoPtr
, TB_PAGEUP
);
262 static inline void TRACKBAR_LineUp(TRACKBAR_INFO
*infoPtr
)
264 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return;
265 infoPtr
->lPos
-= infoPtr
->lLineSize
;
266 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
267 infoPtr
->lPos
= infoPtr
->lRangeMin
;
268 notify_with_scroll (infoPtr
, TB_LINEUP
);
271 static inline void TRACKBAR_LineDown(TRACKBAR_INFO
*infoPtr
)
273 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return;
274 infoPtr
->lPos
+= infoPtr
->lLineSize
;
275 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
276 infoPtr
->lPos
= infoPtr
->lRangeMax
;
277 notify_with_scroll (infoPtr
, TB_LINEDOWN
);
281 TRACKBAR_CalcChannel (TRACKBAR_INFO
*infoPtr
)
283 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
284 INT cyChannel
, offsetthumb
, offsetedge
;
285 RECT lpRect
, *channel
= & infoPtr
->rcChannel
;
287 GetClientRect (infoPtr
->hwndSelf
, &lpRect
);
289 offsetthumb
= infoPtr
->uThumbLen
/ 4;
290 offsetedge
= offsetthumb
+ 3;
291 cyChannel
= (dwStyle
& TBS_ENABLESELRANGE
) ? offsetthumb
*3 : 4;
292 if (dwStyle
& TBS_VERT
) {
293 channel
->top
= lpRect
.top
+ offsetedge
;
294 channel
->bottom
= lpRect
.bottom
- offsetedge
;
295 if (dwStyle
& TBS_ENABLESELRANGE
)
296 channel
->left
= lpRect
.left
+ ((infoPtr
->uThumbLen
- cyChannel
+ 2) / 2);
298 channel
->left
= lpRect
.left
+ (infoPtr
->uThumbLen
/ 2) - 1;
299 if (dwStyle
& TBS_BOTH
) {
300 if (dwStyle
& TBS_NOTICKS
)
305 else if (dwStyle
& TBS_TOP
) {
306 if (dwStyle
& TBS_NOTICKS
)
311 channel
->right
= channel
->left
+ cyChannel
;
313 channel
->left
= lpRect
.left
+ offsetedge
;
314 channel
->right
= lpRect
.right
- offsetedge
;
315 if (dwStyle
& TBS_ENABLESELRANGE
)
316 channel
->top
= lpRect
.top
+ ((infoPtr
->uThumbLen
- cyChannel
+ 2) / 2);
318 channel
->top
= lpRect
.top
+ (infoPtr
->uThumbLen
/ 2) - 1;
319 if (dwStyle
& TBS_BOTH
) {
320 if (dwStyle
& TBS_NOTICKS
)
325 else if (dwStyle
& TBS_TOP
) {
326 if (dwStyle
& TBS_NOTICKS
)
331 channel
->bottom
= channel
->top
+ cyChannel
;
336 TRACKBAR_CalcThumb (const TRACKBAR_INFO
*infoPtr
, LONG lPos
, RECT
*thumb
)
338 int range
, width
, height
, thumbwidth
;
339 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
342 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
343 thumbwidth
= (infoPtr
->uThumbLen
/ 2) | 1;
345 if (!range
) range
= 1;
347 GetClientRect(infoPtr
->hwndSelf
, &lpRect
);
348 if (dwStyle
& TBS_VERT
)
350 height
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- thumbwidth
;
352 if ((dwStyle
& (TBS_BOTH
| TBS_LEFT
)) && !(dwStyle
& TBS_NOTICKS
))
356 thumb
->right
= thumb
->left
+ infoPtr
->uThumbLen
;
357 thumb
->top
= infoPtr
->rcChannel
.top
+
358 (height
*(lPos
- infoPtr
->lRangeMin
))/range
;
359 thumb
->bottom
= thumb
->top
+ thumbwidth
;
363 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- thumbwidth
;
365 thumb
->left
= infoPtr
->rcChannel
.left
+
366 (width
*(lPos
- infoPtr
->lRangeMin
))/range
;
367 thumb
->right
= thumb
->left
+ thumbwidth
;
368 if ((dwStyle
& (TBS_BOTH
| TBS_TOP
)) && !(dwStyle
& TBS_NOTICKS
))
372 thumb
->bottom
= thumb
->top
+ infoPtr
->uThumbLen
;
377 TRACKBAR_UpdateThumb (TRACKBAR_INFO
*infoPtr
)
379 TRACKBAR_CalcThumb(infoPtr
, infoPtr
->lPos
, &infoPtr
->rcThumb
);
383 TRACKBAR_InvalidateAll (const TRACKBAR_INFO
*infoPtr
)
385 InvalidateRect(infoPtr
->hwndSelf
, NULL
, FALSE
);
389 TRACKBAR_InvalidateThumb (const TRACKBAR_INFO
*infoPtr
, LONG thumbPos
)
393 TRACKBAR_CalcThumb(infoPtr
, thumbPos
, &rcThumb
);
394 InflateRect(&rcThumb
, 1, 1);
395 InvalidateRect(infoPtr
->hwndSelf
, &rcThumb
, FALSE
);
399 TRACKBAR_InvalidateThumbMove (const TRACKBAR_INFO
*infoPtr
, LONG oldPos
, LONG newPos
)
401 TRACKBAR_InvalidateThumb (infoPtr
, oldPos
);
402 if (newPos
!= oldPos
)
403 TRACKBAR_InvalidateThumb (infoPtr
, newPos
);
407 TRACKBAR_HasSelection (const TRACKBAR_INFO
*infoPtr
)
409 return infoPtr
->lSelMin
!= infoPtr
->lSelMax
;
413 TRACKBAR_CalcSelection (TRACKBAR_INFO
*infoPtr
)
415 RECT
*selection
= &infoPtr
->rcSelection
;
416 int range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
417 int offsetthumb
, height
, width
;
420 SetRectEmpty (selection
);
422 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_VERT
) {
423 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
424 height
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- offsetthumb
*2;
425 selection
->top
= infoPtr
->rcChannel
.top
+ offsetthumb
+
426 (height
*infoPtr
->lSelMin
)/range
;
427 selection
->bottom
= infoPtr
->rcChannel
.top
+ offsetthumb
+
428 (height
*infoPtr
->lSelMax
)/range
;
429 selection
->left
= infoPtr
->rcChannel
.left
+ 3;
430 selection
->right
= infoPtr
->rcChannel
.right
- 3;
432 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
433 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- offsetthumb
*2;
434 selection
->left
= infoPtr
->rcChannel
.left
+ offsetthumb
+
435 (width
*infoPtr
->lSelMin
)/range
;
436 selection
->right
= infoPtr
->rcChannel
.left
+ offsetthumb
+
437 (width
*infoPtr
->lSelMax
)/range
;
438 selection
->top
= infoPtr
->rcChannel
.top
+ 3;
439 selection
->bottom
= infoPtr
->rcChannel
.bottom
- 3;
443 TRACE("selection[%s]\n", wine_dbgstr_rect(selection
));
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;
827 if (infoPtr
->flags
& TB_THUMBCHANGED
) {
828 TRACKBAR_UpdateThumb (infoPtr
);
829 if (infoPtr
->flags
& TB_THUMBSIZECHANGED
)
830 TRACKBAR_CalcChannel (infoPtr
);
832 if (infoPtr
->flags
& TB_SELECTIONCHANGED
)
833 TRACKBAR_CalcSelection (infoPtr
);
835 if (infoPtr
->flags
& TB_DRAG_MODE
)
836 TRACKBAR_UpdateToolTip (infoPtr
);
838 infoPtr
->flags
&= ~ (TB_THUMBCHANGED
| TB_SELECTIONCHANGED
);
840 GetClientRect (infoPtr
->hwndSelf
, &rcClient
);
842 /* try to render offscreen, if we fail, carrry onscreen */
843 hdc
= CreateCompatibleDC(hdcDst
);
845 hOffScreenBmp
= CreateCompatibleBitmap(hdcDst
, rcClient
.right
, rcClient
.bottom
);
847 hOldBmp
= SelectObject(hdc
, hOffScreenBmp
);
856 ZeroMemory(&nmcd
, sizeof(nmcd
));
857 nmcd
.hdr
.hwndFrom
= infoPtr
->hwndSelf
;
858 nmcd
.hdr
.idFrom
= GetWindowLongPtrW (infoPtr
->hwndSelf
, GWLP_ID
);
859 nmcd
.hdr
.code
= NM_CUSTOMDRAW
;
862 /* start the paint cycle */
864 gcdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_PREPAINT
);
865 if (gcdrf
& CDRF_SKIPDEFAULT
) goto cleanup
;
867 /* Erase background */
868 if (gcdrf
== CDRF_DODEFAULT
||
869 notify_customdraw(infoPtr
, &nmcd
, CDDS_PREERASE
) != CDRF_SKIPDEFAULT
) {
870 if (GetWindowTheme (infoPtr
->hwndSelf
)) {
871 DrawThemeParentBackground (infoPtr
->hwndSelf
, hdc
, 0);
874 FillRect (hdc
, &rcClient
, GetSysColorBrush(COLOR_BTNFACE
));
875 if (gcdrf
!= CDRF_DODEFAULT
)
876 notify_customdraw(infoPtr
, &nmcd
, CDDS_POSTERASE
);
880 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
881 nmcd
.dwItemSpec
= TBCD_CHANNEL
;
882 nmcd
.uItemState
= CDIS_DEFAULT
;
883 nmcd
.rc
= infoPtr
->rcChannel
;
884 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
885 } else icdrf
= CDRF_DODEFAULT
;
886 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
887 TRACKBAR_DrawChannel (infoPtr
, hdc
, dwStyle
);
888 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
889 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
894 if (!(dwStyle
& TBS_NOTICKS
)) {
895 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
896 nmcd
.dwItemSpec
= TBCD_TICS
;
897 nmcd
.uItemState
= CDIS_DEFAULT
;
899 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
900 } else icdrf
= CDRF_DODEFAULT
;
901 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
902 TRACKBAR_DrawTics (infoPtr
, hdc
, dwStyle
);
903 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
904 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
909 if (!(dwStyle
& TBS_NOTHUMB
)) {
910 if (gcdrf
& CDRF_NOTIFYITEMDRAW
) {
911 nmcd
.dwItemSpec
= TBCD_THUMB
;
912 nmcd
.uItemState
= infoPtr
->flags
& TB_DRAG_MODE
? CDIS_HOT
: CDIS_DEFAULT
;
913 nmcd
.rc
= infoPtr
->rcThumb
;
914 icdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPREPAINT
);
915 } else icdrf
= CDRF_DODEFAULT
;
916 if ( !(icdrf
& CDRF_SKIPDEFAULT
) ) {
917 TRACKBAR_DrawThumb(infoPtr
, hdc
, dwStyle
);
918 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
919 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
923 /* draw focus rectangle */
924 if (infoPtr
->bFocussed
) {
925 DrawFocusRect(hdc
, &rcClient
);
928 /* finish up the painting */
929 if (gcdrf
& CDRF_NOTIFYPOSTPAINT
)
930 notify_customdraw(infoPtr
, &nmcd
, CDDS_POSTPAINT
);
933 /* cleanup, if we rendered offscreen */
935 BitBlt(hdcDst
, 0, 0, rcClient
.right
, rcClient
.bottom
, hdc
, 0, 0, SRCCOPY
);
936 SelectObject(hdc
, hOldBmp
);
937 DeleteObject(hOffScreenBmp
);
944 TRACKBAR_AlignBuddies (const TRACKBAR_INFO
*infoPtr
)
946 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
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 (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 (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 (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_NOTICKS
)
1044 if(infoPtr
->uNumTics
== 0)
1047 return infoPtr
->uNumTics
+ 1;
1051 static int comp_tics (const void *ap
, const void *bp
)
1053 const DWORD a
= *(const DWORD
*)ap
;
1054 const DWORD b
= *(const DWORD
*)bp
;
1056 TRACE("(a=%d, b=%d)\n", a
, b
);
1057 if (a
< b
) return -1;
1058 if (a
> b
) return 1;
1064 TRACKBAR_GetTic (const TRACKBAR_INFO
*infoPtr
, INT iTic
)
1066 if ((iTic
< 0) || (iTic
>= infoPtr
->uNumTics
) || !infoPtr
->tics
)
1069 qsort(infoPtr
->tics
, infoPtr
->uNumTics
, sizeof(DWORD
), comp_tics
);
1070 return infoPtr
->tics
[iTic
];
1075 TRACKBAR_GetTicPos (const TRACKBAR_INFO
*infoPtr
, INT iTic
)
1077 LONG range
, width
, pos
, tic
;
1080 if ((iTic
< 0) || (iTic
>= infoPtr
->uNumTics
) || !infoPtr
->tics
)
1083 tic
= TRACKBAR_GetTic (infoPtr
, iTic
);
1084 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
1085 if (range
<= 0) range
= 1;
1086 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
1087 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- offsetthumb
*2;
1088 pos
= infoPtr
->rcChannel
.left
+ offsetthumb
+ (width
* tic
) / range
;
1095 TRACKBAR_SetBuddy (TRACKBAR_INFO
*infoPtr
, BOOL fLocation
, HWND hwndBuddy
)
1100 /* buddy is left or above */
1101 hwndTemp
= infoPtr
->hwndBuddyLA
;
1102 infoPtr
->hwndBuddyLA
= hwndBuddy
;
1105 /* buddy is right or below */
1106 hwndTemp
= infoPtr
->hwndBuddyRB
;
1107 infoPtr
->hwndBuddyRB
= hwndBuddy
;
1110 TRACKBAR_AlignBuddies (infoPtr
);
1117 TRACKBAR_SetLineSize (TRACKBAR_INFO
*infoPtr
, LONG lLineSize
)
1119 LONG lTemp
= infoPtr
->lLineSize
;
1121 infoPtr
->lLineSize
= lLineSize
;
1128 TRACKBAR_SetPageSize (TRACKBAR_INFO
*infoPtr
, LONG lPageSize
)
1130 LONG lTemp
= infoPtr
->lPageSize
;
1132 infoPtr
->lPageSize
= lPageSize
;
1138 static inline LRESULT
1139 TRACKBAR_SetPos (TRACKBAR_INFO
*infoPtr
, BOOL fPosition
, LONG lPosition
)
1141 LONG oldPos
= infoPtr
->lPos
;
1142 infoPtr
->lPos
= lPosition
;
1144 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
1145 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1147 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
1148 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1149 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1151 if (fPosition
) TRACKBAR_InvalidateThumbMove(infoPtr
, oldPos
, lPosition
);
1157 static inline LRESULT
1158 TRACKBAR_SetRange (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lRange
)
1160 infoPtr
->lRangeMin
= (SHORT
)LOWORD(lRange
);
1161 infoPtr
->lRangeMax
= (SHORT
)HIWORD(lRange
);
1163 if (infoPtr
->lPos
< infoPtr
->lRangeMin
) {
1164 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1165 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1168 if (infoPtr
->lPos
> infoPtr
->lRangeMax
) {
1169 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1170 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1173 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1174 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1176 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1182 static inline LRESULT
1183 TRACKBAR_SetRangeMax (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lMax
)
1185 infoPtr
->lRangeMax
= lMax
;
1186 if (infoPtr
->lPos
> infoPtr
->lRangeMax
) {
1187 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1188 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1191 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1192 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1194 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1200 static inline LRESULT
1201 TRACKBAR_SetRangeMin (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lMin
)
1203 infoPtr
->lRangeMin
= lMin
;
1204 if (infoPtr
->lPos
< infoPtr
->lRangeMin
) {
1205 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1206 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1209 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1210 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1212 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1218 static inline LRESULT
1219 TRACKBAR_SetSel (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lSel
)
1221 if (!(GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)){
1222 infoPtr
->lSelMin
= 0;
1223 infoPtr
->lSelMax
= 0;
1227 infoPtr
->lSelMin
= (SHORT
)LOWORD(lSel
);
1228 infoPtr
->lSelMax
= (SHORT
)HIWORD(lSel
);
1229 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1231 if (infoPtr
->lSelMin
< infoPtr
->lRangeMin
)
1232 infoPtr
->lSelMin
= infoPtr
->lRangeMin
;
1233 if (infoPtr
->lSelMax
> infoPtr
->lRangeMax
)
1234 infoPtr
->lSelMax
= infoPtr
->lRangeMax
;
1236 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1242 static inline LRESULT
1243 TRACKBAR_SetSelEnd (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lEnd
)
1245 if (!(GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)){
1246 infoPtr
->lSelMax
= 0;
1250 infoPtr
->lSelMax
= lEnd
;
1251 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1253 if (infoPtr
->lSelMax
> infoPtr
->lRangeMax
)
1254 infoPtr
->lSelMax
= infoPtr
->lRangeMax
;
1256 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1262 static inline LRESULT
1263 TRACKBAR_SetSelStart (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lStart
)
1265 if (!(GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)){
1266 infoPtr
->lSelMin
= 0;
1270 infoPtr
->lSelMin
= lStart
;
1271 infoPtr
->flags
|=TB_SELECTIONCHANGED
;
1273 if (infoPtr
->lSelMin
< infoPtr
->lRangeMin
)
1274 infoPtr
->lSelMin
= infoPtr
->lRangeMin
;
1276 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1282 static inline LRESULT
1283 TRACKBAR_SetThumbLength (TRACKBAR_INFO
*infoPtr
, UINT iLength
)
1285 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_FIXEDLENGTH
) {
1286 infoPtr
->uThumbLen
= iLength
;
1287 infoPtr
->flags
|= TB_THUMBSIZECHANGED
;
1288 InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1295 static inline LRESULT
1296 TRACKBAR_SetTic (TRACKBAR_INFO
*infoPtr
, LONG lPos
)
1298 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_AUTOTICKS
)
1301 if ((lPos
< infoPtr
->lRangeMin
) || (lPos
> infoPtr
->lRangeMax
))
1304 TRACE("lPos=%d\n", lPos
);
1306 infoPtr
->uNumTics
++;
1307 infoPtr
->tics
=ReAlloc( infoPtr
->tics
,
1308 (infoPtr
->uNumTics
)*sizeof (DWORD
));
1309 if (!infoPtr
->tics
) {
1310 infoPtr
->uNumTics
= 0;
1311 notify(infoPtr
, NM_OUTOFMEMORY
);
1314 infoPtr
->tics
[infoPtr
->uNumTics
-1] = lPos
;
1316 TRACKBAR_InvalidateAll(infoPtr
);
1322 static inline LRESULT
1323 TRACKBAR_SetTicFreq (TRACKBAR_INFO
*infoPtr
, WORD wFreq
)
1325 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_AUTOTICKS
) {
1326 infoPtr
->uTicFreq
= wFreq
;
1327 TRACKBAR_RecalculateTics (infoPtr
);
1328 TRACKBAR_InvalidateAll(infoPtr
);
1336 TRACKBAR_SetTipSide (TRACKBAR_INFO
*infoPtr
, INT fLocation
)
1338 INT fTemp
= infoPtr
->fLocation
;
1340 infoPtr
->fLocation
= fLocation
;
1346 static inline LRESULT
1347 TRACKBAR_SetToolTips (TRACKBAR_INFO
*infoPtr
, HWND hwndTT
)
1349 infoPtr
->hwndToolTip
= hwndTT
;
1356 TRACKBAR_SetUnicodeFormat (TRACKBAR_INFO
*infoPtr
, BOOL fUnicode
)
1358 BOOL bTemp
= infoPtr
->bUnicode
;
1360 infoPtr
->bUnicode
= fUnicode
;
1367 TRACKBAR_InitializeThumb (TRACKBAR_INFO
*infoPtr
)
1369 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1371 int clientWidth
, clientMetric
;
1373 /* initial thumb length */
1374 clientMetric
= (dwStyle
& TBS_ENABLESELRANGE
) ? 23 : 21;
1375 GetClientRect(infoPtr
->hwndSelf
,&rect
);
1376 if (dwStyle
& TBS_VERT
) {
1377 clientWidth
= rect
.right
- rect
.left
;
1379 clientWidth
= rect
.bottom
- rect
.top
;
1381 if (clientWidth
>= clientMetric
)
1382 infoPtr
->uThumbLen
= clientMetric
;
1384 infoPtr
->uThumbLen
= clientWidth
> 9 ? clientWidth
- 6 : 4;
1386 TRACKBAR_CalcChannel (infoPtr
);
1387 TRACKBAR_UpdateThumb (infoPtr
);
1388 infoPtr
->flags
&= ~TB_SELECTIONCHANGED
;
1395 TRACKBAR_Create (HWND hwnd
, const CREATESTRUCTW
*lpcs
)
1397 TRACKBAR_INFO
*infoPtr
;
1400 infoPtr
= (TRACKBAR_INFO
*)Alloc (sizeof(TRACKBAR_INFO
));
1401 if (!infoPtr
) return -1;
1402 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
1404 /* set default values */
1405 infoPtr
->hwndSelf
= hwnd
;
1406 infoPtr
->lRangeMin
= 0;
1407 infoPtr
->lRangeMax
= 100;
1408 infoPtr
->lLineSize
= 1;
1409 infoPtr
->lPageSize
= 20;
1410 infoPtr
->lSelMin
= 0;
1411 infoPtr
->lSelMax
= 0;
1413 infoPtr
->fLocation
= -1;
1414 infoPtr
->uNumTics
= 0; /* start and end tic are not included in count*/
1415 infoPtr
->uTicFreq
= 1;
1416 infoPtr
->tics
= NULL
;
1417 infoPtr
->hwndNotify
= lpcs
->hwndParent
;
1419 TRACKBAR_InitializeThumb (infoPtr
);
1421 dwStyle
= GetWindowLongW (hwnd
, GWL_STYLE
);
1423 /* Create tooltip control */
1424 if (dwStyle
& TBS_TOOLTIPS
) {
1426 infoPtr
->hwndToolTip
=
1427 CreateWindowExW (0, TOOLTIPS_CLASSW
, NULL
, WS_POPUP
,
1428 CW_USEDEFAULT
, CW_USEDEFAULT
,
1429 CW_USEDEFAULT
, CW_USEDEFAULT
,
1432 if (infoPtr
->hwndToolTip
) {
1434 ZeroMemory (&ti
, sizeof(ti
));
1435 ti
.cbSize
= sizeof(ti
);
1436 ti
.uFlags
= TTF_IDISHWND
| TTF_TRACK
| TTF_ABSOLUTE
;
1439 SendMessageW (infoPtr
->hwndToolTip
, TTM_ADDTOOLW
, 0, (LPARAM
)&ti
);
1443 OpenThemeData (hwnd
, themeClass
);
1450 TRACKBAR_Destroy (TRACKBAR_INFO
*infoPtr
)
1452 /* delete tooltip control */
1453 if (infoPtr
->hwndToolTip
)
1454 DestroyWindow (infoPtr
->hwndToolTip
);
1456 SetWindowLongPtrW (infoPtr
->hwndSelf
, 0, 0);
1457 CloseThemeData (GetWindowTheme (infoPtr
->hwndSelf
));
1465 TRACKBAR_KillFocus (TRACKBAR_INFO
*infoPtr
)
1468 infoPtr
->bFocussed
= FALSE
;
1469 TRACKBAR_InvalidateAll(infoPtr
);
1475 TRACKBAR_LButtonDown (TRACKBAR_INFO
*infoPtr
, INT x
, INT y
)
1482 SetFocus(infoPtr
->hwndSelf
);
1484 if (PtInRect(&infoPtr
->rcThumb
, clickPoint
)) {
1485 infoPtr
->flags
|= TB_DRAG_MODE
;
1486 SetCapture (infoPtr
->hwndSelf
);
1487 TRACKBAR_UpdateToolTip (infoPtr
);
1488 TRACKBAR_ActivateToolTip (infoPtr
, TRUE
);
1489 TRACKBAR_InvalidateThumb(infoPtr
, infoPtr
->lPos
);
1491 LONG dir
= TRACKBAR_GetAutoPageDirection(infoPtr
, clickPoint
);
1492 if (dir
== 0) return 0;
1493 infoPtr
->flags
|= (dir
< 0) ? TB_AUTO_PAGE_LEFT
: TB_AUTO_PAGE_RIGHT
;
1494 TRACKBAR_AutoPage (infoPtr
, clickPoint
);
1495 SetCapture (infoPtr
->hwndSelf
);
1496 SetTimer(infoPtr
->hwndSelf
, TB_REFRESH_TIMER
, TB_REFRESH_DELAY
, 0);
1504 TRACKBAR_LButtonUp (TRACKBAR_INFO
*infoPtr
)
1506 if (infoPtr
->flags
& TB_DRAG_MODE
) {
1507 notify_with_scroll (infoPtr
, TB_THUMBPOSITION
| (infoPtr
->lPos
<<16));
1508 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1509 infoPtr
->flags
&= ~TB_DRAG_MODE
;
1511 notify(infoPtr
, NM_RELEASEDCAPTURE
);
1512 TRACKBAR_ActivateToolTip(infoPtr
, FALSE
);
1513 TRACKBAR_InvalidateThumb(infoPtr
, infoPtr
->lPos
);
1515 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1516 KillTimer (infoPtr
->hwndSelf
, TB_REFRESH_TIMER
);
1517 infoPtr
->flags
&= ~TB_AUTO_PAGE
;
1518 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1520 notify(infoPtr
, NM_RELEASEDCAPTURE
);
1528 TRACKBAR_CaptureChanged (const TRACKBAR_INFO
*infoPtr
)
1530 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1536 TRACKBAR_Paint (TRACKBAR_INFO
*infoPtr
, HDC hdc
)
1539 TRACKBAR_Refresh(infoPtr
, hdc
);
1542 hdc
= BeginPaint (infoPtr
->hwndSelf
, &ps
);
1543 TRACKBAR_Refresh (infoPtr
, hdc
);
1544 EndPaint (infoPtr
->hwndSelf
, &ps
);
1552 TRACKBAR_SetFocus (TRACKBAR_INFO
*infoPtr
)
1555 infoPtr
->bFocussed
= TRUE
;
1556 TRACKBAR_InvalidateAll(infoPtr
);
1563 TRACKBAR_Size (TRACKBAR_INFO
*infoPtr
)
1565 TRACKBAR_InitializeThumb (infoPtr
);
1566 TRACKBAR_AlignBuddies (infoPtr
);
1573 TRACKBAR_Timer (TRACKBAR_INFO
*infoPtr
)
1575 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1577 if (GetCursorPos(&pt
))
1578 if (ScreenToClient(infoPtr
->hwndSelf
, &pt
))
1579 TRACKBAR_AutoPage(infoPtr
, pt
);
1585 /* update theme after a WM_THEMECHANGED message */
1586 static LRESULT
theme_changed (const TRACKBAR_INFO
* infoPtr
)
1588 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
1589 CloseThemeData (theme
);
1590 theme
= OpenThemeData (infoPtr
->hwndSelf
, themeClass
);
1596 TRACKBAR_MouseMove (TRACKBAR_INFO
*infoPtr
, INT x
, INT y
)
1598 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1599 INT clickPlace
= (dwStyle
& TBS_VERT
) ? y
: x
;
1600 LONG dragPos
, oldPos
= infoPtr
->lPos
;
1602 TRACE("(x=%d. y=%d)\n", x
, y
);
1604 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1608 TRACKBAR_AutoPage (infoPtr
, pt
);
1612 if (!(infoPtr
->flags
& TB_DRAG_MODE
))
1614 if (GetWindowTheme (infoPtr
->hwndSelf
))
1616 DWORD oldFlags
= infoPtr
->flags
;
1620 if (PtInRect (&infoPtr
->rcThumb
, pt
))
1622 TRACKMOUSEEVENT tme
;
1623 tme
.cbSize
= sizeof( tme
);
1624 tme
.dwFlags
= TME_LEAVE
;
1625 tme
.hwndTrack
= infoPtr
->hwndSelf
;
1626 TrackMouseEvent( &tme
);
1627 infoPtr
->flags
|= TB_THUMB_HOT
;
1631 TRACKMOUSEEVENT tme
;
1632 tme
.cbSize
= sizeof( tme
);
1633 tme
.dwFlags
= TME_CANCEL
;
1634 tme
.hwndTrack
= infoPtr
->hwndSelf
;
1635 TrackMouseEvent( &tme
);
1636 infoPtr
->flags
&= ~TB_THUMB_HOT
;
1638 if (oldFlags
!= infoPtr
->flags
) InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1643 dragPos
= TRACKBAR_ConvertPlaceToPosition (infoPtr
, clickPlace
,
1644 dwStyle
& TBS_VERT
);
1645 if (dragPos
== oldPos
) return TRUE
;
1647 infoPtr
->lPos
= dragPos
;
1649 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1650 notify_with_scroll (infoPtr
, TB_THUMBTRACK
| (infoPtr
->lPos
<<16));
1653 TRACKBAR_InvalidateThumbMove(infoPtr
, oldPos
, dragPos
);
1654 UpdateWindow (infoPtr
->hwndSelf
);
1660 TRACKBAR_KeyDown (TRACKBAR_INFO
*infoPtr
, INT nVirtKey
)
1662 DWORD style
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1663 BOOL downIsLeft
= style
& TBS_DOWNISLEFT
;
1664 BOOL vert
= style
& TBS_VERT
;
1665 LONG pos
= infoPtr
->lPos
;
1667 TRACE("%x\n", nVirtKey
);
1671 if (!vert
&& downIsLeft
) TRACKBAR_LineDown(infoPtr
);
1672 else TRACKBAR_LineUp(infoPtr
);
1675 if (vert
&& downIsLeft
) TRACKBAR_LineDown(infoPtr
);
1676 else TRACKBAR_LineUp(infoPtr
);
1679 if (!vert
&& downIsLeft
) TRACKBAR_LineUp(infoPtr
);
1680 else TRACKBAR_LineDown(infoPtr
);
1683 if (vert
&& downIsLeft
) TRACKBAR_LineUp(infoPtr
);
1684 else TRACKBAR_LineDown(infoPtr
);
1687 if (!vert
&& downIsLeft
) TRACKBAR_PageUp(infoPtr
);
1688 else TRACKBAR_PageDown(infoPtr
);
1691 if (!vert
&& downIsLeft
) TRACKBAR_PageDown(infoPtr
);
1692 else TRACKBAR_PageUp(infoPtr
);
1695 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return FALSE
;
1696 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1697 notify_with_scroll (infoPtr
, TB_TOP
);
1700 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return FALSE
;
1701 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1702 notify_with_scroll (infoPtr
, TB_BOTTOM
);
1706 if (pos
!= infoPtr
->lPos
) {
1707 infoPtr
->flags
|=TB_THUMBPOSCHANGED
;
1708 TRACKBAR_InvalidateThumbMove (infoPtr
, pos
, infoPtr
->lPos
);
1716 TRACKBAR_KeyUp (const TRACKBAR_INFO
*infoPtr
, INT nVirtKey
)
1727 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1733 static LRESULT WINAPI
1734 TRACKBAR_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
1736 TRACKBAR_INFO
*infoPtr
= (TRACKBAR_INFO
*)GetWindowLongPtrW (hwnd
, 0);
1738 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hwnd
, uMsg
, wParam
, lParam
);
1740 if (!infoPtr
&& (uMsg
!= WM_CREATE
))
1741 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
1746 return TRACKBAR_ClearSel (infoPtr
, (BOOL
)wParam
);
1749 return TRACKBAR_ClearTics (infoPtr
, (BOOL
)wParam
);
1752 return (LRESULT
)(wParam
? infoPtr
->hwndBuddyLA
: infoPtr
->hwndBuddyRB
);
1754 case TBM_GETCHANNELRECT
:
1755 return TRACKBAR_GetChannelRect (infoPtr
, (LPRECT
)lParam
);
1757 case TBM_GETLINESIZE
:
1758 return infoPtr
->lLineSize
;
1760 case TBM_GETNUMTICS
:
1761 return TRACKBAR_GetNumTics (infoPtr
);
1763 case TBM_GETPAGESIZE
:
1764 return infoPtr
->lPageSize
;
1767 return infoPtr
->lPos
;
1770 return (LRESULT
)infoPtr
->tics
;
1772 case TBM_GETRANGEMAX
:
1773 return infoPtr
->lRangeMax
;
1775 case TBM_GETRANGEMIN
:
1776 return infoPtr
->lRangeMin
;
1779 return infoPtr
->lSelMax
;
1781 case TBM_GETSELSTART
:
1782 return infoPtr
->lSelMin
;
1784 case TBM_GETTHUMBLENGTH
:
1785 return infoPtr
->uThumbLen
;
1787 case TBM_GETTHUMBRECT
:
1788 return CopyRect((LPRECT
)lParam
, &infoPtr
->rcThumb
);
1791 return TRACKBAR_GetTic (infoPtr
, (INT
)wParam
);
1794 return TRACKBAR_GetTicPos (infoPtr
, (INT
)wParam
);
1796 case TBM_GETTOOLTIPS
:
1797 return (LRESULT
)infoPtr
->hwndToolTip
;
1799 case TBM_GETUNICODEFORMAT
:
1800 return infoPtr
->bUnicode
;
1803 return (LRESULT
) TRACKBAR_SetBuddy(infoPtr
, (BOOL
)wParam
, (HWND
)lParam
);
1805 case TBM_SETLINESIZE
:
1806 return TRACKBAR_SetLineSize (infoPtr
, (LONG
)lParam
);
1808 case TBM_SETPAGESIZE
:
1809 return TRACKBAR_SetPageSize (infoPtr
, (LONG
)lParam
);
1812 return TRACKBAR_SetPos (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1815 return TRACKBAR_SetRange (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1817 case TBM_SETRANGEMAX
:
1818 return TRACKBAR_SetRangeMax (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1820 case TBM_SETRANGEMIN
:
1821 return TRACKBAR_SetRangeMin (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1824 return TRACKBAR_SetSel (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1827 return TRACKBAR_SetSelEnd (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1829 case TBM_SETSELSTART
:
1830 return TRACKBAR_SetSelStart (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1832 case TBM_SETTHUMBLENGTH
:
1833 return TRACKBAR_SetThumbLength (infoPtr
, (UINT
)wParam
);
1836 return TRACKBAR_SetTic (infoPtr
, (LONG
)lParam
);
1838 case TBM_SETTICFREQ
:
1839 return TRACKBAR_SetTicFreq (infoPtr
, (WORD
)wParam
);
1841 case TBM_SETTIPSIDE
:
1842 return TRACKBAR_SetTipSide (infoPtr
, (INT
)wParam
);
1844 case TBM_SETTOOLTIPS
:
1845 return TRACKBAR_SetToolTips (infoPtr
, (HWND
)wParam
);
1847 case TBM_SETUNICODEFORMAT
:
1848 return TRACKBAR_SetUnicodeFormat (infoPtr
, (BOOL
)wParam
);
1851 case WM_CAPTURECHANGED
:
1852 return TRACKBAR_CaptureChanged (infoPtr
);
1855 return TRACKBAR_Create (hwnd
, (LPCREATESTRUCTW
)lParam
);
1858 return TRACKBAR_Destroy (infoPtr
);
1860 /* case WM_ENABLE: */
1866 return DLGC_WANTARROWS
;
1869 return TRACKBAR_KeyDown (infoPtr
, (INT
)wParam
);
1872 return TRACKBAR_KeyUp (infoPtr
, (INT
)wParam
);
1875 return TRACKBAR_KillFocus (infoPtr
);
1877 case WM_LBUTTONDOWN
:
1878 return TRACKBAR_LButtonDown (infoPtr
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1881 return TRACKBAR_LButtonUp (infoPtr
);
1884 infoPtr
->flags
&= ~TB_THUMB_HOT
;
1885 InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1889 return TRACKBAR_MouseMove (infoPtr
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1891 case WM_PRINTCLIENT
:
1893 return TRACKBAR_Paint (infoPtr
, (HDC
)wParam
);
1896 return TRACKBAR_SetFocus (infoPtr
);
1899 return TRACKBAR_Size (infoPtr
);
1901 case WM_THEMECHANGED
:
1902 return theme_changed (infoPtr
);
1905 return TRACKBAR_Timer (infoPtr
);
1907 case WM_WININICHANGE
:
1908 return TRACKBAR_InitializeThumb (infoPtr
);
1911 if ((uMsg
>= WM_USER
) && (uMsg
< WM_APP
))
1912 ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg
, wParam
, lParam
);
1913 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
1918 void TRACKBAR_Register (void)
1922 ZeroMemory (&wndClass
, sizeof(WNDCLASSW
));
1923 wndClass
.style
= CS_GLOBALCLASS
;
1924 wndClass
.lpfnWndProc
= TRACKBAR_WindowProc
;
1925 wndClass
.cbClsExtra
= 0;
1926 wndClass
.cbWndExtra
= sizeof(TRACKBAR_INFO
*);
1927 wndClass
.hCursor
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
1928 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
1929 wndClass
.lpszClassName
= TRACKBAR_CLASSW
;
1931 RegisterClassW (&wndClass
);
1935 void TRACKBAR_Unregister (void)
1937 UnregisterClassW (TRACKBAR_CLASSW
, NULL
);