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(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(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
,
123 (WPARAM
)pnmh
->idFrom
, (LPARAM
)pnmh
);
125 TRACE(" <= %ld\n", result
);
130 static inline int notify(TRACKBAR_INFO
*infoPtr
, INT code
)
133 return notify_hdr(infoPtr
, code
, &nmh
);
137 notify_with_scroll (TRACKBAR_INFO
*infoPtr
, UINT code
)
139 BOOL bVert
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_VERT
;
143 return (BOOL
) SendMessageW (infoPtr
->hwndNotify
,
144 bVert
? WM_VSCROLL
: WM_HSCROLL
,
145 (WPARAM
)code
, (LPARAM
)infoPtr
->hwndSelf
);
148 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 (TRACKBAR_INFO
*infoPtr
, int place
,
185 double range
, width
, pos
, offsetthumb
;
187 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
189 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
190 width
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- (offsetthumb
* 2) - 1;
191 pos
= (range
*(place
- infoPtr
->rcChannel
.top
- offsetthumb
)) / width
;
193 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
194 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- (offsetthumb
* 2) - 1;
195 pos
= (range
*(place
- infoPtr
->rcChannel
.left
- offsetthumb
)) / width
;
197 pos
+= infoPtr
->lRangeMin
;
198 if (pos
> infoPtr
->lRangeMax
)
199 pos
= infoPtr
->lRangeMax
;
200 else if (pos
< infoPtr
->lRangeMin
)
201 pos
= infoPtr
->lRangeMin
;
203 TRACE("%.2f\n", pos
);
204 return (LONG
)(pos
+ 0.5);
208 /* return: 0> prev, 0 none, >0 next */
210 TRACKBAR_GetAutoPageDirection (TRACKBAR_INFO
*infoPtr
, POINT clickPoint
)
212 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
215 if (dwStyle
& TBS_VERT
) {
216 pageRect
.top
= infoPtr
->rcChannel
.top
;
217 pageRect
.bottom
= infoPtr
->rcChannel
.bottom
;
218 pageRect
.left
= infoPtr
->rcThumb
.left
;
219 pageRect
.right
= infoPtr
->rcThumb
.right
;
221 pageRect
.top
= infoPtr
->rcThumb
.top
;
222 pageRect
.bottom
= infoPtr
->rcThumb
.bottom
;
223 pageRect
.left
= infoPtr
->rcChannel
.left
;
224 pageRect
.right
= infoPtr
->rcChannel
.right
;
228 if (PtInRect(&pageRect
, clickPoint
))
230 int clickPlace
= (dwStyle
& TBS_VERT
) ? clickPoint
.y
: clickPoint
.x
;
232 LONG clickPos
= TRACKBAR_ConvertPlaceToPosition(infoPtr
, clickPlace
,
234 return clickPos
- infoPtr
->lPos
;
241 TRACKBAR_PageDown (TRACKBAR_INFO
*infoPtr
)
243 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return;
245 infoPtr
->lPos
+= infoPtr
->lPageSize
;
246 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
247 infoPtr
->lPos
= infoPtr
->lRangeMax
;
248 notify_with_scroll (infoPtr
, TB_PAGEDOWN
);
253 TRACKBAR_PageUp (TRACKBAR_INFO
*infoPtr
)
255 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return;
257 infoPtr
->lPos
-= infoPtr
->lPageSize
;
258 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
259 infoPtr
->lPos
= infoPtr
->lRangeMin
;
260 notify_with_scroll (infoPtr
, TB_PAGEUP
);
263 inline static void TRACKBAR_LineUp(TRACKBAR_INFO
*infoPtr
)
265 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return;
266 infoPtr
->lPos
-= infoPtr
->lLineSize
;
267 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
268 infoPtr
->lPos
= infoPtr
->lRangeMin
;
269 notify_with_scroll (infoPtr
, TB_LINEUP
);
272 inline static void TRACKBAR_LineDown(TRACKBAR_INFO
*infoPtr
)
274 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return;
275 infoPtr
->lPos
+= infoPtr
->lLineSize
;
276 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
277 infoPtr
->lPos
= infoPtr
->lRangeMax
;
278 notify_with_scroll (infoPtr
, TB_LINEDOWN
);
282 TRACKBAR_CalcChannel (TRACKBAR_INFO
*infoPtr
)
284 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
285 INT cyChannel
, offsetthumb
, offsetedge
;
286 RECT lpRect
, *channel
= & infoPtr
->rcChannel
;
288 GetClientRect (infoPtr
->hwndSelf
, &lpRect
);
290 offsetthumb
= infoPtr
->uThumbLen
/ 4;
291 offsetedge
= offsetthumb
+ 3;
292 cyChannel
= (dwStyle
& TBS_ENABLESELRANGE
) ? offsetthumb
*3 : 4;
293 if (dwStyle
& TBS_VERT
) {
294 channel
->top
= lpRect
.top
+ offsetedge
;
295 channel
->bottom
= lpRect
.bottom
- offsetedge
;
296 if (dwStyle
& TBS_ENABLESELRANGE
)
297 channel
->left
= lpRect
.left
+ ((infoPtr
->uThumbLen
- cyChannel
+ 2) / 2);
299 channel
->left
= lpRect
.left
+ (infoPtr
->uThumbLen
/ 2) - 1;
300 if (dwStyle
& TBS_BOTH
) {
301 if (dwStyle
& TBS_NOTICKS
)
306 else if (dwStyle
& TBS_TOP
) {
307 if (dwStyle
& TBS_NOTICKS
)
312 channel
->right
= channel
->left
+ cyChannel
;
314 channel
->left
= lpRect
.left
+ offsetedge
;
315 channel
->right
= lpRect
.right
- offsetedge
;
316 if (dwStyle
& TBS_ENABLESELRANGE
)
317 channel
->top
= lpRect
.top
+ ((infoPtr
->uThumbLen
- cyChannel
+ 2) / 2);
319 channel
->top
= lpRect
.top
+ (infoPtr
->uThumbLen
/ 2) - 1;
320 if (dwStyle
& TBS_BOTH
) {
321 if (dwStyle
& TBS_NOTICKS
)
326 else if (dwStyle
& TBS_TOP
) {
327 if (dwStyle
& TBS_NOTICKS
)
332 channel
->bottom
= channel
->top
+ cyChannel
;
337 TRACKBAR_CalcThumb (TRACKBAR_INFO
*infoPtr
, LONG lPos
, RECT
*thumb
)
339 int range
, width
, height
, thumbwidth
;
340 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
343 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
344 thumbwidth
= (infoPtr
->uThumbLen
/ 2) | 1;
346 if (!range
) range
= 1;
348 GetClientRect(infoPtr
->hwndSelf
, &lpRect
);
349 if (dwStyle
& TBS_VERT
)
351 height
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- thumbwidth
;
353 if ((dwStyle
& (TBS_BOTH
| TBS_LEFT
)) && !(dwStyle
& TBS_NOTICKS
))
357 thumb
->right
= thumb
->left
+ infoPtr
->uThumbLen
;
358 thumb
->top
= infoPtr
->rcChannel
.top
+
359 (height
*(lPos
- infoPtr
->lRangeMin
))/range
;
360 thumb
->bottom
= thumb
->top
+ thumbwidth
;
364 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- thumbwidth
;
366 thumb
->left
= infoPtr
->rcChannel
.left
+
367 (width
*(lPos
- infoPtr
->lRangeMin
))/range
;
368 thumb
->right
= thumb
->left
+ thumbwidth
;
369 if ((dwStyle
& (TBS_BOTH
| TBS_TOP
)) && !(dwStyle
& TBS_NOTICKS
))
373 thumb
->bottom
= thumb
->top
+ infoPtr
->uThumbLen
;
378 TRACKBAR_UpdateThumb (TRACKBAR_INFO
*infoPtr
)
380 TRACKBAR_CalcThumb(infoPtr
, infoPtr
->lPos
, &infoPtr
->rcThumb
);
384 TRACKBAR_InvalidateAll(TRACKBAR_INFO
* infoPtr
)
386 InvalidateRect(infoPtr
->hwndSelf
, NULL
, FALSE
);
390 TRACKBAR_InvalidateThumb (TRACKBAR_INFO
*infoPtr
, LONG thumbPos
)
394 TRACKBAR_CalcThumb(infoPtr
, thumbPos
, &rcThumb
);
395 InflateRect(&rcThumb
, 1, 1);
396 InvalidateRect(infoPtr
->hwndSelf
, &rcThumb
, FALSE
);
400 TRACKBAR_InvalidateThumbMove (TRACKBAR_INFO
*infoPtr
, LONG oldPos
, LONG newPos
)
402 TRACKBAR_InvalidateThumb (infoPtr
, oldPos
);
403 if (newPos
!= oldPos
)
404 TRACKBAR_InvalidateThumb (infoPtr
, newPos
);
408 TRACKBAR_HasSelection (TRACKBAR_INFO
*infoPtr
)
410 return infoPtr
->lSelMin
!= infoPtr
->lSelMax
;
414 TRACKBAR_CalcSelection (TRACKBAR_INFO
*infoPtr
)
416 RECT
*selection
= &infoPtr
->rcSelection
;
417 int range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
418 int offsetthumb
, height
, width
;
421 SetRectEmpty (selection
);
423 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_VERT
) {
424 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
425 height
= infoPtr
->rcChannel
.bottom
- infoPtr
->rcChannel
.top
- offsetthumb
*2;
426 selection
->top
= infoPtr
->rcChannel
.top
+ offsetthumb
+
427 (height
*infoPtr
->lSelMin
)/range
;
428 selection
->bottom
= infoPtr
->rcChannel
.top
+ offsetthumb
+
429 (height
*infoPtr
->lSelMax
)/range
;
430 selection
->left
= infoPtr
->rcChannel
.left
+ 3;
431 selection
->right
= infoPtr
->rcChannel
.right
- 3;
433 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
434 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- offsetthumb
*2;
435 selection
->left
= infoPtr
->rcChannel
.left
+ offsetthumb
+
436 (width
*infoPtr
->lSelMin
)/range
;
437 selection
->right
= infoPtr
->rcChannel
.left
+ offsetthumb
+
438 (width
*infoPtr
->lSelMax
)/range
;
439 selection
->top
= infoPtr
->rcChannel
.top
+ 3;
440 selection
->bottom
= infoPtr
->rcChannel
.bottom
- 3;
444 TRACE("selection[left=%ld, top=%ld, right=%ld, bottom=%ld]\n",
445 selection
->left
, selection
->top
, selection
->right
, selection
->bottom
);
449 TRACKBAR_AutoPage (TRACKBAR_INFO
*infoPtr
, POINT clickPoint
)
451 LONG dir
= TRACKBAR_GetAutoPageDirection(infoPtr
, clickPoint
);
452 LONG prevPos
= infoPtr
->lPos
;
454 TRACE("x=%ld, y=%ld, dir=%ld\n", clickPoint
.x
, clickPoint
.y
, dir
);
456 if (dir
> 0 && (infoPtr
->flags
& TB_AUTO_PAGE_RIGHT
))
457 TRACKBAR_PageDown(infoPtr
);
458 else if (dir
< 0 && (infoPtr
->flags
& TB_AUTO_PAGE_LEFT
))
459 TRACKBAR_PageUp(infoPtr
);
462 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
463 TRACKBAR_InvalidateThumbMove (infoPtr
, prevPos
, infoPtr
->lPos
);
468 /* Trackbar drawing code. I like my spaghetti done milanese. */
471 TRACKBAR_DrawChannel (TRACKBAR_INFO
*infoPtr
, HDC hdc
, DWORD dwStyle
)
473 RECT rcChannel
= infoPtr
->rcChannel
;
474 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
478 DrawThemeBackground (theme
, hdc
,
479 (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_VERT
) ?
480 TKP_TRACKVERT
: TKP_TRACK
, TKS_NORMAL
, &rcChannel
, 0);
484 DrawEdge (hdc
, &rcChannel
, EDGE_SUNKEN
, BF_RECT
| BF_ADJUST
);
485 if (dwStyle
& TBS_ENABLESELRANGE
) { /* fill the channel */
486 FillRect (hdc
, &rcChannel
, GetStockObject(WHITE_BRUSH
));
487 if (TRACKBAR_HasSelection(infoPtr
))
488 FillRect (hdc
, &infoPtr
->rcSelection
, GetSysColorBrush(COLOR_HIGHLIGHT
));
494 TRACKBAR_DrawOneTic (TRACKBAR_INFO
*infoPtr
, HDC hdc
, LONG ticPos
, int flags
)
496 int x
, y
, ox
, oy
, range
, side
, indent
= 0, len
= 3;
500 if (flags
& TBS_VERT
) {
501 offsetthumb
= (infoPtr
->rcThumb
.bottom
- infoPtr
->rcThumb
.top
)/2;
502 rcTics
.left
= infoPtr
->rcThumb
.left
- 2;
503 rcTics
.right
= infoPtr
->rcThumb
.right
+ 2;
504 rcTics
.top
= infoPtr
->rcChannel
.top
+ offsetthumb
+ 1;
505 rcTics
.bottom
= infoPtr
->rcChannel
.bottom
- offsetthumb
;
507 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
508 rcTics
.left
= infoPtr
->rcChannel
.left
+ offsetthumb
+ 1;
509 rcTics
.right
= infoPtr
->rcChannel
.right
- offsetthumb
;
510 rcTics
.top
= infoPtr
->rcThumb
.top
- 2;
511 rcTics
.bottom
= infoPtr
->rcThumb
.bottom
+ 2;
514 if (flags
& (TBS_TOP
| TBS_LEFT
)) {
524 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
526 range
= 1; /* to avoid division by zero */
528 if (flags
& TIC_SELECTIONMARK
) {
529 indent
= (flags
& TIC_SELECTIONMARKMIN
) ? -1 : 1;
530 } else if (flags
& TIC_EDGE
) {
534 if (flags
& TBS_VERT
) {
535 int height
= rcTics
.bottom
- rcTics
.top
;
536 y
= rcTics
.top
+ (height
*(ticPos
- infoPtr
->lRangeMin
))/range
;
538 int width
= rcTics
.right
- rcTics
.left
;
539 x
= rcTics
.left
+ (width
*(ticPos
- infoPtr
->lRangeMin
))/range
;
544 MoveToEx(hdc
, x
, y
, 0);
545 if (flags
& TBS_VERT
) x
+= len
* side
;
546 else y
+= len
* side
;
549 if (flags
& TIC_SELECTIONMARK
) {
550 if (flags
& TBS_VERT
) {
555 MoveToEx(hdc
, x
, y
, 0);
556 if (flags
& TBS_VERT
) {
569 TRACKBAR_DrawTic (TRACKBAR_INFO
*infoPtr
, HDC hdc
, LONG ticPos
, int flags
)
571 if ((flags
& (TBS_LEFT
| TBS_TOP
)) || (flags
& TBS_BOTH
))
572 TRACKBAR_DrawOneTic (infoPtr
, hdc
, ticPos
, flags
| TBS_LEFT
);
574 if (!(flags
& (TBS_LEFT
| TBS_TOP
)) || (flags
& TBS_BOTH
))
575 TRACKBAR_DrawOneTic (infoPtr
, hdc
, ticPos
, flags
& ~TBS_LEFT
);
579 TRACKBAR_DrawTics (TRACKBAR_INFO
*infoPtr
, HDC hdc
, DWORD dwStyle
)
582 int ticFlags
= dwStyle
& 0x0f;
583 LOGPEN ticPen
= { PS_SOLID
, {1, 0}, GetSysColor (COLOR_3DDKSHADOW
) };
584 HPEN hOldPen
, hTicPen
;
585 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
589 int part
= (dwStyle
& TBS_VERT
) ? TKP_TICSVERT
: TKP_TICS
;
590 GetThemeColor (theme
, part
, TSS_NORMAL
, TMT_COLOR
, &ticPen
.lopnColor
);
592 /* create the pen to draw the tics with */
593 hTicPen
= CreatePenIndirect(&ticPen
);
594 hOldPen
= hTicPen
? SelectObject(hdc
, hTicPen
) : 0;
596 /* actually draw the tics */
597 for (i
=0; i
<infoPtr
->uNumTics
; i
++)
598 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->tics
[i
], ticFlags
);
600 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lRangeMin
, ticFlags
| TIC_EDGE
);
601 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lRangeMax
, ticFlags
| TIC_EDGE
);
603 if ((dwStyle
& TBS_ENABLESELRANGE
) && TRACKBAR_HasSelection(infoPtr
)) {
604 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lSelMin
,
605 ticFlags
| TIC_SELECTIONMARKMIN
);
606 TRACKBAR_DrawTic (infoPtr
, hdc
, infoPtr
->lSelMax
,
607 ticFlags
| TIC_SELECTIONMARKMAX
);
610 /* clean up the pen, if we created one */
612 SelectObject(hdc
, hOldPen
);
613 DeleteObject(hTicPen
);
618 TRACKBAR_DrawThumb(TRACKBAR_INFO
*infoPtr
, HDC hdc
, DWORD dwStyle
)
622 RECT thumb
= infoPtr
->rcThumb
;
628 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
634 if (dwStyle
& TBS_BOTH
)
635 partId
= (dwStyle
& TBS_VERT
) ? TKP_THUMBVERT
: TKP_THUMB
;
636 else if (dwStyle
& TBS_LEFT
)
637 partId
= (dwStyle
& TBS_VERT
) ? TKP_THUMBLEFT
: TKP_THUMBTOP
;
639 partId
= (dwStyle
& TBS_VERT
) ? TKP_THUMBRIGHT
: TKP_THUMBBOTTOM
;
641 if (dwStyle
& WS_DISABLED
)
642 stateId
= TUS_DISABLED
;
643 else if (infoPtr
->flags
& TB_DRAG_MODE
)
644 stateId
= TUS_PRESSED
;
645 else if (infoPtr
->flags
& TB_THUMB_HOT
)
648 stateId
= TUS_NORMAL
;
650 DrawThemeBackground (theme
, hdc
, partId
, stateId
, &thumb
, 0);
655 fillClr
= infoPtr
->flags
& TB_DRAG_MODE
? COLOR_BTNHILIGHT
: COLOR_BTNFACE
;
656 oldbr
= SelectObject (hdc
, GetSysColorBrush(fillClr
));
657 SetPolyFillMode (hdc
, WINDING
);
659 if (dwStyle
& TBS_BOTH
)
661 points
[0].x
=thumb
.right
;
662 points
[0].y
=thumb
.top
;
663 points
[1].x
=thumb
.right
;
664 points
[1].y
=thumb
.bottom
;
665 points
[2].x
=thumb
.left
;
666 points
[2].y
=thumb
.bottom
;
667 points
[3].x
=thumb
.left
;
668 points
[3].y
=thumb
.top
;
669 points
[4].x
=points
[0].x
;
670 points
[4].y
=points
[0].y
;
676 if (dwStyle
& TBS_VERT
)
678 PointDepth
= (thumb
.bottom
- thumb
.top
) / 2;
679 if (dwStyle
& TBS_LEFT
)
681 points
[0].x
=thumb
.right
;
682 points
[0].y
=thumb
.top
;
683 points
[1].x
=thumb
.right
;
684 points
[1].y
=thumb
.bottom
;
685 points
[2].x
=thumb
.left
+ PointDepth
;
686 points
[2].y
=thumb
.bottom
;
687 points
[3].x
=thumb
.left
;
688 points
[3].y
=(thumb
.bottom
- thumb
.top
) / 2 + thumb
.top
+ 1;
689 points
[4].x
=thumb
.left
+ PointDepth
;
690 points
[4].y
=thumb
.top
;
691 points
[5].x
=points
[0].x
;
692 points
[5].y
=points
[0].y
;
697 points
[0].x
=thumb
.right
;
698 points
[0].y
=(thumb
.bottom
- thumb
.top
) / 2 + thumb
.top
+ 1;
699 points
[1].x
=thumb
.right
- PointDepth
;
700 points
[1].y
=thumb
.bottom
;
701 points
[2].x
=thumb
.left
;
702 points
[2].y
=thumb
.bottom
;
703 points
[3].x
=thumb
.left
;
704 points
[3].y
=thumb
.top
;
705 points
[4].x
=thumb
.right
- PointDepth
;
706 points
[4].y
=thumb
.top
;
707 points
[5].x
=points
[0].x
;
708 points
[5].y
=points
[0].y
;
713 PointDepth
= (thumb
.right
- thumb
.left
) / 2;
714 if (dwStyle
& TBS_TOP
)
716 points
[0].x
=(thumb
.right
- thumb
.left
) / 2 + thumb
.left
+ 1;
717 points
[0].y
=thumb
.top
;
718 points
[1].x
=thumb
.right
;
719 points
[1].y
=thumb
.top
+ PointDepth
;
720 points
[2].x
=thumb
.right
;
721 points
[2].y
=thumb
.bottom
;
722 points
[3].x
=thumb
.left
;
723 points
[3].y
=thumb
.bottom
;
724 points
[4].x
=thumb
.left
;
725 points
[4].y
=thumb
.top
+ PointDepth
;
726 points
[5].x
=points
[0].x
;
727 points
[5].y
=points
[0].y
;
732 points
[0].x
=thumb
.right
;
733 points
[0].y
=thumb
.top
;
734 points
[1].x
=thumb
.right
;
735 points
[1].y
=thumb
.bottom
- PointDepth
;
736 points
[2].x
=(thumb
.right
- thumb
.left
) / 2 + thumb
.left
+ 1;
737 points
[2].y
=thumb
.bottom
;
738 points
[3].x
=thumb
.left
;
739 points
[3].y
=thumb
.bottom
- PointDepth
;
740 points
[4].x
=thumb
.left
;
741 points
[4].y
=thumb
.top
;
742 points
[5].x
=points
[0].x
;
743 points
[5].y
=points
[0].y
;
749 /* Draw the thumb now */
750 Polygon (hdc
, points
, PointCount
);
751 oldpen
= SelectObject(hdc
, GetStockObject(BLACK_PEN
));
752 Polyline(hdc
,points
, BlackUntil
);
753 SelectObject(hdc
, GetStockObject(WHITE_PEN
));
754 Polyline(hdc
, &points
[BlackUntil
-1], PointCount
+1-BlackUntil
);
755 SelectObject(hdc
, oldpen
);
756 SelectObject(hdc
, oldbr
);
761 TRACKBAR_ActivateToolTip (TRACKBAR_INFO
*infoPtr
, BOOL fShow
)
765 if (!infoPtr
->hwndToolTip
) return;
767 ZeroMemory(&ti
, sizeof(ti
));
768 ti
.cbSize
= sizeof(ti
);
769 ti
.hwnd
= infoPtr
->hwndSelf
;
771 SendMessageW (infoPtr
->hwndToolTip
, TTM_TRACKACTIVATE
, fShow
, (LPARAM
)&ti
);
776 TRACKBAR_UpdateToolTip (TRACKBAR_INFO
*infoPtr
)
778 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
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 (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, (LPARAM
)MAKELPARAM(pt
.x
, pt
.y
));
820 TRACKBAR_Refresh (TRACKBAR_INFO
*infoPtr
, HDC hdcDst
)
822 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
825 HBITMAP hOldBmp
= 0, hOffScreenBmp
= 0;
829 if (infoPtr
->flags
& TB_THUMBCHANGED
) {
830 TRACKBAR_UpdateThumb (infoPtr
);
831 if (infoPtr
->flags
& TB_THUMBSIZECHANGED
)
832 TRACKBAR_CalcChannel (infoPtr
);
834 if (infoPtr
->flags
& TB_SELECTIONCHANGED
)
835 TRACKBAR_CalcSelection (infoPtr
);
837 if (infoPtr
->flags
& TB_DRAG_MODE
)
838 TRACKBAR_UpdateToolTip (infoPtr
);
840 infoPtr
->flags
&= ~ (TB_THUMBCHANGED
| TB_SELECTIONCHANGED
);
842 GetClientRect (infoPtr
->hwndSelf
, &rcClient
);
844 /* try to render offscreen, if we fail, carrry onscreen */
845 hdc
= CreateCompatibleDC(hdcDst
);
847 hOffScreenBmp
= CreateCompatibleBitmap(hdcDst
, rcClient
.right
, rcClient
.bottom
);
849 hOldBmp
= SelectObject(hdc
, hOffScreenBmp
);
858 ZeroMemory(&nmcd
, sizeof(nmcd
));
859 nmcd
.hdr
.hwndFrom
= infoPtr
->hwndSelf
;
860 nmcd
.hdr
.idFrom
= GetWindowLongPtrW (infoPtr
->hwndSelf
, GWLP_ID
);
861 nmcd
.hdr
.code
= NM_CUSTOMDRAW
;
864 /* start the paint cycle */
866 gcdrf
= notify_customdraw(infoPtr
, &nmcd
, CDDS_PREPAINT
);
867 if (gcdrf
& CDRF_SKIPDEFAULT
) goto cleanup
;
869 /* Erase backbround */
870 if (gcdrf
== CDRF_DODEFAULT
||
871 notify_customdraw(infoPtr
, &nmcd
, CDDS_PREERASE
) != CDRF_SKIPDEFAULT
) {
872 if (GetWindowTheme (infoPtr
->hwndSelf
))
873 DrawThemeParentBackground (infoPtr
->hwndSelf
, hdc
, &rcClient
);
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
, dwStyle
);
889 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
890 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
895 if (!(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
, dwStyle
);
904 if (icdrf
& CDRF_NOTIFYPOSTPAINT
)
905 notify_customdraw(infoPtr
, &nmcd
, CDDS_ITEMPOSTPAINT
);
910 if (!(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
, dwStyle
);
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 (TRACKBAR_INFO
*infoPtr
)
947 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
948 HWND hwndParent
= GetParent (infoPtr
->hwndSelf
);
949 RECT rcSelf
, rcBuddy
;
952 GetWindowRect (infoPtr
->hwndSelf
, &rcSelf
);
953 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcSelf
, 2);
955 /* align buddy left or above */
956 if (infoPtr
->hwndBuddyLA
) {
957 GetWindowRect (infoPtr
->hwndBuddyLA
, &rcBuddy
);
958 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcBuddy
, 2);
960 if (dwStyle
& TBS_VERT
) {
961 x
= (infoPtr
->rcChannel
.right
+ infoPtr
->rcChannel
.left
) / 2 -
962 (rcBuddy
.right
- rcBuddy
.left
) / 2 + rcSelf
.left
;
963 y
= rcSelf
.top
- (rcBuddy
.bottom
- rcBuddy
.top
);
966 x
= rcSelf
.left
- (rcBuddy
.right
- rcBuddy
.left
);
967 y
= (infoPtr
->rcChannel
.bottom
+ infoPtr
->rcChannel
.top
) / 2 -
968 (rcBuddy
.bottom
- rcBuddy
.top
) / 2 + rcSelf
.top
;
971 SetWindowPos (infoPtr
->hwndBuddyLA
, 0, x
, y
, 0, 0,
972 SWP_NOZORDER
| SWP_NOSIZE
);
976 /* align buddy right or below */
977 if (infoPtr
->hwndBuddyRB
) {
978 GetWindowRect (infoPtr
->hwndBuddyRB
, &rcBuddy
);
979 MapWindowPoints (HWND_DESKTOP
, hwndParent
, (LPPOINT
)&rcBuddy
, 2);
981 if (dwStyle
& TBS_VERT
) {
982 x
= (infoPtr
->rcChannel
.right
+ infoPtr
->rcChannel
.left
) / 2 -
983 (rcBuddy
.right
- rcBuddy
.left
) / 2 + rcSelf
.left
;
988 y
= (infoPtr
->rcChannel
.bottom
+ infoPtr
->rcChannel
.top
) / 2 -
989 (rcBuddy
.bottom
- rcBuddy
.top
) / 2 + rcSelf
.top
;
991 SetWindowPos (infoPtr
->hwndBuddyRB
, 0, x
, y
, 0, 0,
992 SWP_NOZORDER
| SWP_NOSIZE
);
998 TRACKBAR_ClearSel (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
)
1000 infoPtr
->lSelMin
= 0;
1001 infoPtr
->lSelMax
= 0;
1002 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1004 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1011 TRACKBAR_ClearTics (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
)
1013 if (infoPtr
->tics
) {
1014 Free (infoPtr
->tics
);
1015 infoPtr
->tics
= NULL
;
1016 infoPtr
->uNumTics
= 0;
1019 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1025 inline static LRESULT
1026 TRACKBAR_GetChannelRect (TRACKBAR_INFO
*infoPtr
, LPRECT lprc
)
1028 if (lprc
== NULL
) return 0;
1030 lprc
->left
= infoPtr
->rcChannel
.left
;
1031 lprc
->right
= infoPtr
->rcChannel
.right
;
1032 lprc
->bottom
= infoPtr
->rcChannel
.bottom
;
1033 lprc
->top
= infoPtr
->rcChannel
.top
;
1040 TRACKBAR_GetNumTics (TRACKBAR_INFO
*infoPtr
)
1042 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_NOTICKS
)
1045 return infoPtr
->uNumTics
+ 2;
1049 static int comp_tics(const void *ap
, const void *bp
)
1051 const DWORD a
= *(const DWORD
*)ap
;
1052 const DWORD b
= *(const DWORD
*)bp
;
1054 TRACE("(a=%ld, b=%ld)\n", a
, b
);
1055 if (a
< b
) return -1;
1056 if (a
> b
) return 1;
1062 TRACKBAR_GetTic (TRACKBAR_INFO
*infoPtr
, INT iTic
)
1064 if ((iTic
< 0) || (iTic
>= infoPtr
->uNumTics
) || !infoPtr
->tics
)
1067 qsort(infoPtr
->tics
, infoPtr
->uNumTics
, sizeof(DWORD
), comp_tics
);
1068 return infoPtr
->tics
[iTic
];
1073 TRACKBAR_GetTicPos (TRACKBAR_INFO
*infoPtr
, INT iTic
)
1075 LONG range
, width
, pos
, tic
;
1078 if ((iTic
< 0) || (iTic
>= infoPtr
->uNumTics
) || !infoPtr
->tics
)
1081 tic
= TRACKBAR_GetTic (infoPtr
, iTic
);
1082 range
= infoPtr
->lRangeMax
- infoPtr
->lRangeMin
;
1083 if (range
<= 0) range
= 1;
1084 offsetthumb
= (infoPtr
->rcThumb
.right
- infoPtr
->rcThumb
.left
)/2;
1085 width
= infoPtr
->rcChannel
.right
- infoPtr
->rcChannel
.left
- offsetthumb
*2;
1086 pos
= infoPtr
->rcChannel
.left
+ offsetthumb
+ (width
* tic
) / range
;
1093 TRACKBAR_SetBuddy (TRACKBAR_INFO
*infoPtr
, BOOL fLocation
, HWND hwndBuddy
)
1098 /* buddy is left or above */
1099 hwndTemp
= infoPtr
->hwndBuddyLA
;
1100 infoPtr
->hwndBuddyLA
= hwndBuddy
;
1103 /* buddy is right or below */
1104 hwndTemp
= infoPtr
->hwndBuddyRB
;
1105 infoPtr
->hwndBuddyRB
= hwndBuddy
;
1108 TRACKBAR_AlignBuddies (infoPtr
);
1115 TRACKBAR_SetLineSize (TRACKBAR_INFO
*infoPtr
, LONG lLineSize
)
1117 LONG lTemp
= infoPtr
->lLineSize
;
1119 infoPtr
->lLineSize
= lLineSize
;
1126 TRACKBAR_SetPageSize (TRACKBAR_INFO
*infoPtr
, LONG lPageSize
)
1128 LONG lTemp
= infoPtr
->lPageSize
;
1130 infoPtr
->lPageSize
= lPageSize
;
1136 inline static LRESULT
1137 TRACKBAR_SetPos (TRACKBAR_INFO
*infoPtr
, BOOL fPosition
, LONG lPosition
)
1139 LONG oldPos
= infoPtr
->lPos
;
1140 infoPtr
->lPos
= lPosition
;
1142 if (infoPtr
->lPos
< infoPtr
->lRangeMin
)
1143 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1145 if (infoPtr
->lPos
> infoPtr
->lRangeMax
)
1146 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1147 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1149 if (fPosition
) TRACKBAR_InvalidateThumbMove(infoPtr
, oldPos
, lPosition
);
1155 inline static LRESULT
1156 TRACKBAR_SetRange (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lRange
)
1158 infoPtr
->lRangeMin
= (SHORT
)LOWORD(lRange
);
1159 infoPtr
->lRangeMax
= (SHORT
)HIWORD(lRange
);
1161 if (infoPtr
->lPos
< infoPtr
->lRangeMin
) {
1162 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1163 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1166 if (infoPtr
->lPos
> infoPtr
->lRangeMax
) {
1167 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1168 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1171 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1172 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1174 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1180 inline static LRESULT
1181 TRACKBAR_SetRangeMax (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lMax
)
1183 infoPtr
->lRangeMax
= lMax
;
1184 if (infoPtr
->lPos
> infoPtr
->lRangeMax
) {
1185 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1186 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1189 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1190 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1192 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1198 inline static LRESULT
1199 TRACKBAR_SetRangeMin (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lMin
)
1201 infoPtr
->lRangeMin
= lMin
;
1202 if (infoPtr
->lPos
< infoPtr
->lRangeMin
) {
1203 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1204 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1207 infoPtr
->lPageSize
= (infoPtr
->lRangeMax
- infoPtr
->lRangeMin
) / 5;
1208 if (infoPtr
->lPageSize
== 0) infoPtr
->lPageSize
= 1;
1210 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1216 inline static LRESULT
1217 TRACKBAR_SetSel (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lSel
)
1219 if (!GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)
1222 infoPtr
->lSelMin
= (SHORT
)LOWORD(lSel
);
1223 infoPtr
->lSelMax
= (SHORT
)HIWORD(lSel
);
1224 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1226 if (infoPtr
->lSelMin
< infoPtr
->lRangeMin
)
1227 infoPtr
->lSelMin
= infoPtr
->lRangeMin
;
1228 if (infoPtr
->lSelMax
> infoPtr
->lRangeMax
)
1229 infoPtr
->lSelMax
= infoPtr
->lRangeMax
;
1231 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1237 inline static LRESULT
1238 TRACKBAR_SetSelEnd (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lEnd
)
1240 if (!GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)
1243 infoPtr
->lSelMax
= lEnd
;
1244 infoPtr
->flags
|= TB_SELECTIONCHANGED
;
1246 if (infoPtr
->lSelMax
> infoPtr
->lRangeMax
)
1247 infoPtr
->lSelMax
= infoPtr
->lRangeMax
;
1249 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1255 inline static LRESULT
1256 TRACKBAR_SetSelStart (TRACKBAR_INFO
*infoPtr
, BOOL fRedraw
, LONG lStart
)
1258 if (!GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_ENABLESELRANGE
)
1261 infoPtr
->lSelMin
= lStart
;
1262 infoPtr
->flags
|=TB_SELECTIONCHANGED
;
1264 if (infoPtr
->lSelMin
< infoPtr
->lRangeMin
)
1265 infoPtr
->lSelMin
= infoPtr
->lRangeMin
;
1267 if (fRedraw
) TRACKBAR_InvalidateAll(infoPtr
);
1273 inline static LRESULT
1274 TRACKBAR_SetThumbLength (TRACKBAR_INFO
*infoPtr
, UINT iLength
)
1276 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_FIXEDLENGTH
) {
1277 infoPtr
->uThumbLen
= iLength
;
1278 infoPtr
->flags
|= TB_THUMBSIZECHANGED
;
1279 InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1286 inline static LRESULT
1287 TRACKBAR_SetTic (TRACKBAR_INFO
*infoPtr
, LONG lPos
)
1289 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_AUTOTICKS
)
1292 if ((lPos
< infoPtr
->lRangeMin
) || (lPos
> infoPtr
->lRangeMax
))
1295 TRACE("lPos=%ld\n", lPos
);
1297 infoPtr
->uNumTics
++;
1298 infoPtr
->tics
=ReAlloc( infoPtr
->tics
,
1299 (infoPtr
->uNumTics
)*sizeof (DWORD
));
1300 if (!infoPtr
->tics
) {
1301 infoPtr
->uNumTics
= 0;
1302 notify(infoPtr
, NM_OUTOFMEMORY
);
1305 infoPtr
->tics
[infoPtr
->uNumTics
-1] = lPos
;
1307 TRACKBAR_InvalidateAll(infoPtr
);
1313 inline static LRESULT
1314 TRACKBAR_SetTicFreq (TRACKBAR_INFO
*infoPtr
, WORD wFreq
)
1316 if (GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
) & TBS_AUTOTICKS
) {
1317 infoPtr
->uTicFreq
= wFreq
;
1318 TRACKBAR_RecalculateTics (infoPtr
);
1319 TRACKBAR_InvalidateAll(infoPtr
);
1327 TRACKBAR_SetTipSide (TRACKBAR_INFO
*infoPtr
, INT fLocation
)
1329 INT fTemp
= infoPtr
->fLocation
;
1331 infoPtr
->fLocation
= fLocation
;
1337 inline static LRESULT
1338 TRACKBAR_SetToolTips (TRACKBAR_INFO
*infoPtr
, HWND hwndTT
)
1340 infoPtr
->hwndToolTip
= hwndTT
;
1347 TRACKBAR_SetUnicodeFormat (TRACKBAR_INFO
*infoPtr
, BOOL fUnicode
)
1349 BOOL bTemp
= infoPtr
->bUnicode
;
1351 infoPtr
->bUnicode
= fUnicode
;
1358 TRACKBAR_InitializeThumb (TRACKBAR_INFO
*infoPtr
)
1360 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1362 int clientWidth
, clientMetric
;
1364 /* initial thumb length */
1365 clientMetric
= (dwStyle
& TBS_ENABLESELRANGE
) ? 23 : 21;
1366 GetClientRect(infoPtr
->hwndSelf
,&rect
);
1367 if (dwStyle
& TBS_VERT
) {
1368 clientWidth
= rect
.right
- rect
.left
;
1370 clientWidth
= rect
.bottom
- rect
.top
;
1372 if (clientWidth
>= clientMetric
)
1373 infoPtr
->uThumbLen
= clientMetric
;
1375 infoPtr
->uThumbLen
= clientWidth
> 9 ? clientWidth
- 6 : 4;
1377 TRACKBAR_CalcChannel (infoPtr
);
1378 TRACKBAR_UpdateThumb (infoPtr
);
1379 infoPtr
->flags
&= ~TB_SELECTIONCHANGED
;
1386 TRACKBAR_Create (HWND hwnd
, LPCREATESTRUCTW lpcs
)
1388 TRACKBAR_INFO
*infoPtr
;
1391 infoPtr
= (TRACKBAR_INFO
*)Alloc (sizeof(TRACKBAR_INFO
));
1392 if (!infoPtr
) return -1;
1393 SetWindowLongPtrW (hwnd
, 0, (DWORD_PTR
)infoPtr
);
1395 /* set default values */
1396 infoPtr
->hwndSelf
= hwnd
;
1397 infoPtr
->lRangeMin
= 0;
1398 infoPtr
->lRangeMax
= 100;
1399 infoPtr
->lLineSize
= 1;
1400 infoPtr
->lPageSize
= 20;
1401 infoPtr
->lSelMin
= 0;
1402 infoPtr
->lSelMax
= 0;
1404 infoPtr
->fLocation
= -1;
1405 infoPtr
->uNumTics
= 0; /* start and end tic are not included in count*/
1406 infoPtr
->uTicFreq
= 1;
1407 infoPtr
->tics
= NULL
;
1408 infoPtr
->hwndNotify
= lpcs
->hwndParent
;
1410 TRACKBAR_InitializeThumb (infoPtr
);
1412 dwStyle
= GetWindowLongW (hwnd
, GWL_STYLE
);
1414 /* Create tooltip control */
1415 if (dwStyle
& TBS_TOOLTIPS
) {
1417 infoPtr
->hwndToolTip
=
1418 CreateWindowExW (0, TOOLTIPS_CLASSW
, NULL
, 0,
1419 CW_USEDEFAULT
, CW_USEDEFAULT
,
1420 CW_USEDEFAULT
, CW_USEDEFAULT
,
1423 if (infoPtr
->hwndToolTip
) {
1425 ZeroMemory (&ti
, sizeof(ti
));
1426 ti
.cbSize
= sizeof(ti
);
1427 ti
.uFlags
= TTF_IDISHWND
| TTF_TRACK
| TTF_ABSOLUTE
;
1430 SendMessageW (infoPtr
->hwndToolTip
, TTM_ADDTOOLW
, 0, (LPARAM
)&ti
);
1434 OpenThemeData (hwnd
, themeClass
);
1441 TRACKBAR_Destroy (TRACKBAR_INFO
*infoPtr
)
1443 /* delete tooltip control */
1444 if (infoPtr
->hwndToolTip
)
1445 DestroyWindow (infoPtr
->hwndToolTip
);
1448 SetWindowLongPtrW (infoPtr
->hwndSelf
, 0, 0);
1449 CloseThemeData (GetWindowTheme (infoPtr
->hwndSelf
));
1455 TRACKBAR_KillFocus (TRACKBAR_INFO
*infoPtr
, HWND hwndGetFocus
)
1458 infoPtr
->bFocussed
= FALSE
;
1459 TRACKBAR_InvalidateAll(infoPtr
);
1465 TRACKBAR_LButtonDown (TRACKBAR_INFO
*infoPtr
, DWORD fwKeys
, INT x
, INT y
)
1472 SetFocus(infoPtr
->hwndSelf
);
1474 if (PtInRect(&infoPtr
->rcThumb
, clickPoint
)) {
1475 infoPtr
->flags
|= TB_DRAG_MODE
;
1476 SetCapture (infoPtr
->hwndSelf
);
1477 TRACKBAR_UpdateToolTip (infoPtr
);
1478 TRACKBAR_ActivateToolTip (infoPtr
, TRUE
);
1479 TRACKBAR_InvalidateThumb(infoPtr
, infoPtr
->lPos
);
1481 LONG dir
= TRACKBAR_GetAutoPageDirection(infoPtr
, clickPoint
);
1482 if (dir
== 0) return 0;
1483 infoPtr
->flags
|= (dir
< 0) ? TB_AUTO_PAGE_LEFT
: TB_AUTO_PAGE_RIGHT
;
1484 TRACKBAR_AutoPage (infoPtr
, clickPoint
);
1485 SetCapture (infoPtr
->hwndSelf
);
1486 SetTimer(infoPtr
->hwndSelf
, TB_REFRESH_TIMER
, TB_REFRESH_DELAY
, 0);
1494 TRACKBAR_LButtonUp (TRACKBAR_INFO
*infoPtr
, DWORD fwKeys
, INT x
, INT y
)
1496 if (infoPtr
->flags
& TB_DRAG_MODE
) {
1497 notify_with_scroll (infoPtr
, TB_THUMBPOSITION
| (infoPtr
->lPos
<<16));
1498 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1499 infoPtr
->flags
&= ~TB_DRAG_MODE
;
1501 notify(infoPtr
, NM_RELEASEDCAPTURE
);
1502 TRACKBAR_ActivateToolTip(infoPtr
, FALSE
);
1503 TRACKBAR_InvalidateThumb(infoPtr
, infoPtr
->lPos
);
1505 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1506 KillTimer (infoPtr
->hwndSelf
, TB_REFRESH_TIMER
);
1507 infoPtr
->flags
&= ~TB_AUTO_PAGE
;
1508 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1510 notify(infoPtr
, NM_RELEASEDCAPTURE
);
1518 TRACKBAR_CaptureChanged (TRACKBAR_INFO
*infoPtr
)
1520 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1526 TRACKBAR_Paint (TRACKBAR_INFO
*infoPtr
, HDC hdc
)
1529 TRACKBAR_Refresh(infoPtr
, hdc
);
1532 hdc
= BeginPaint (infoPtr
->hwndSelf
, &ps
);
1533 TRACKBAR_Refresh (infoPtr
, hdc
);
1534 EndPaint (infoPtr
->hwndSelf
, &ps
);
1542 TRACKBAR_SetFocus (TRACKBAR_INFO
*infoPtr
, HWND hwndLoseFocus
)
1545 infoPtr
->bFocussed
= TRUE
;
1546 TRACKBAR_InvalidateAll(infoPtr
);
1553 TRACKBAR_Size (TRACKBAR_INFO
*infoPtr
, DWORD fwSizeType
, INT nWidth
, INT nHeight
)
1555 TRACKBAR_InitializeThumb (infoPtr
);
1556 TRACKBAR_AlignBuddies (infoPtr
);
1563 TRACKBAR_Timer (TRACKBAR_INFO
*infoPtr
, INT wTimerID
, TIMERPROC
*tmrpc
)
1565 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1567 if (GetCursorPos(&pt
))
1568 if (ScreenToClient(infoPtr
->hwndSelf
, &pt
))
1569 TRACKBAR_AutoPage(infoPtr
, pt
);
1575 /* update theme after a WM_THEMECHANGED message */
1576 static LRESULT
theme_changed (TRACKBAR_INFO
* infoPtr
)
1578 HTHEME theme
= GetWindowTheme (infoPtr
->hwndSelf
);
1579 CloseThemeData (theme
);
1580 theme
= OpenThemeData (infoPtr
->hwndSelf
, themeClass
);
1586 TRACKBAR_MouseMove (TRACKBAR_INFO
*infoPtr
, DWORD fwKeys
, INT x
, INT y
)
1588 DWORD dwStyle
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1589 INT clickPlace
= (dwStyle
& TBS_VERT
) ? y
: x
;
1590 LONG dragPos
, oldPos
= infoPtr
->lPos
;
1592 TRACE("(x=%d. y=%d)\n", x
, y
);
1594 if (infoPtr
->flags
& TB_AUTO_PAGE
) {
1598 TRACKBAR_AutoPage (infoPtr
, pt
);
1602 if (!(infoPtr
->flags
& TB_DRAG_MODE
))
1604 if (GetWindowTheme (infoPtr
->hwndSelf
))
1606 DWORD oldFlags
= infoPtr
->flags
;
1610 if (PtInRect (&infoPtr
->rcThumb
, pt
))
1612 TRACKMOUSEEVENT tme
;
1613 tme
.cbSize
= sizeof( tme
);
1614 tme
.dwFlags
= TME_LEAVE
;
1615 tme
.hwndTrack
= infoPtr
->hwndSelf
;
1616 TrackMouseEvent( &tme
);
1617 infoPtr
->flags
|= TB_THUMB_HOT
;
1621 TRACKMOUSEEVENT tme
;
1622 tme
.cbSize
= sizeof( tme
);
1623 tme
.dwFlags
= TME_CANCEL
;
1624 tme
.hwndTrack
= infoPtr
->hwndSelf
;
1625 TrackMouseEvent( &tme
);
1626 infoPtr
->flags
&= ~TB_THUMB_HOT
;
1628 if (oldFlags
!= infoPtr
->flags
) InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1633 dragPos
= TRACKBAR_ConvertPlaceToPosition (infoPtr
, clickPlace
,
1634 dwStyle
& TBS_VERT
);
1635 if (dragPos
== oldPos
) return TRUE
;
1637 infoPtr
->lPos
= dragPos
;
1639 infoPtr
->flags
|= TB_THUMBPOSCHANGED
;
1640 notify_with_scroll (infoPtr
, TB_THUMBTRACK
| (infoPtr
->lPos
<<16));
1643 TRACKBAR_InvalidateThumbMove(infoPtr
, oldPos
, dragPos
);
1644 UpdateWindow (infoPtr
->hwndSelf
);
1650 TRACKBAR_KeyDown (TRACKBAR_INFO
*infoPtr
, INT nVirtKey
, DWORD lKeyData
)
1652 DWORD style
= GetWindowLongW (infoPtr
->hwndSelf
, GWL_STYLE
);
1653 BOOL downIsLeft
= style
& TBS_DOWNISLEFT
;
1654 BOOL vert
= style
& TBS_VERT
;
1655 LONG pos
= infoPtr
->lPos
;
1657 TRACE("%x\n", nVirtKey
);
1661 if (!vert
&& downIsLeft
) TRACKBAR_LineDown(infoPtr
);
1662 else TRACKBAR_LineUp(infoPtr
);
1665 if (vert
&& downIsLeft
) TRACKBAR_LineDown(infoPtr
);
1666 else TRACKBAR_LineUp(infoPtr
);
1669 if (!vert
&& downIsLeft
) TRACKBAR_LineUp(infoPtr
);
1670 else TRACKBAR_LineDown(infoPtr
);
1673 if (vert
&& downIsLeft
) TRACKBAR_LineUp(infoPtr
);
1674 else TRACKBAR_LineDown(infoPtr
);
1677 if (!vert
&& downIsLeft
) TRACKBAR_PageUp(infoPtr
);
1678 else TRACKBAR_PageDown(infoPtr
);
1681 if (!vert
&& downIsLeft
) TRACKBAR_PageDown(infoPtr
);
1682 else TRACKBAR_PageUp(infoPtr
);
1685 if (infoPtr
->lPos
== infoPtr
->lRangeMin
) return FALSE
;
1686 infoPtr
->lPos
= infoPtr
->lRangeMin
;
1687 notify_with_scroll (infoPtr
, TB_TOP
);
1690 if (infoPtr
->lPos
== infoPtr
->lRangeMax
) return FALSE
;
1691 infoPtr
->lPos
= infoPtr
->lRangeMax
;
1692 notify_with_scroll (infoPtr
, TB_BOTTOM
);
1696 if (pos
!= infoPtr
->lPos
) {
1697 infoPtr
->flags
|=TB_THUMBPOSCHANGED
;
1698 TRACKBAR_InvalidateThumbMove (infoPtr
, pos
, infoPtr
->lPos
);
1706 TRACKBAR_KeyUp (TRACKBAR_INFO
*infoPtr
, INT nVirtKey
, DWORD lKeyData
)
1717 notify_with_scroll (infoPtr
, TB_ENDTRACK
);
1723 static LRESULT WINAPI
1724 TRACKBAR_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
1726 TRACKBAR_INFO
*infoPtr
= (TRACKBAR_INFO
*)GetWindowLongPtrW (hwnd
, 0);
1728 TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd
, uMsg
, wParam
, lParam
);
1730 if (!infoPtr
&& (uMsg
!= WM_CREATE
))
1731 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
1736 return TRACKBAR_ClearSel (infoPtr
, (BOOL
)wParam
);
1739 return TRACKBAR_ClearTics (infoPtr
, (BOOL
)wParam
);
1742 return (LRESULT
)(wParam
? infoPtr
->hwndBuddyLA
: infoPtr
->hwndBuddyRB
);
1744 case TBM_GETCHANNELRECT
:
1745 return TRACKBAR_GetChannelRect (infoPtr
, (LPRECT
)lParam
);
1747 case TBM_GETLINESIZE
:
1748 return infoPtr
->lLineSize
;
1750 case TBM_GETNUMTICS
:
1751 return TRACKBAR_GetNumTics (infoPtr
);
1753 case TBM_GETPAGESIZE
:
1754 return infoPtr
->lPageSize
;
1757 return infoPtr
->lPos
;
1760 return (LRESULT
)infoPtr
->tics
;
1762 case TBM_GETRANGEMAX
:
1763 return infoPtr
->lRangeMax
;
1765 case TBM_GETRANGEMIN
:
1766 return infoPtr
->lRangeMin
;
1769 return infoPtr
->lSelMax
;
1771 case TBM_GETSELSTART
:
1772 return infoPtr
->lSelMin
;
1774 case TBM_GETTHUMBLENGTH
:
1775 return infoPtr
->uThumbLen
;
1777 case TBM_GETTHUMBRECT
:
1778 return CopyRect((LPRECT
)lParam
, &infoPtr
->rcThumb
);
1781 return TRACKBAR_GetTic (infoPtr
, (INT
)wParam
);
1784 return TRACKBAR_GetTicPos (infoPtr
, (INT
)wParam
);
1786 case TBM_GETTOOLTIPS
:
1787 return (LRESULT
)infoPtr
->hwndToolTip
;
1789 case TBM_GETUNICODEFORMAT
:
1790 return infoPtr
->bUnicode
;
1793 return (LRESULT
) TRACKBAR_SetBuddy(infoPtr
, (BOOL
)wParam
, (HWND
)lParam
);
1795 case TBM_SETLINESIZE
:
1796 return TRACKBAR_SetLineSize (infoPtr
, (LONG
)lParam
);
1798 case TBM_SETPAGESIZE
:
1799 return TRACKBAR_SetPageSize (infoPtr
, (LONG
)lParam
);
1802 return TRACKBAR_SetPos (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1805 return TRACKBAR_SetRange (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1807 case TBM_SETRANGEMAX
:
1808 return TRACKBAR_SetRangeMax (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1810 case TBM_SETRANGEMIN
:
1811 return TRACKBAR_SetRangeMin (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1814 return TRACKBAR_SetSel (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1817 return TRACKBAR_SetSelEnd (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1819 case TBM_SETSELSTART
:
1820 return TRACKBAR_SetSelStart (infoPtr
, (BOOL
)wParam
, (LONG
)lParam
);
1822 case TBM_SETTHUMBLENGTH
:
1823 return TRACKBAR_SetThumbLength (infoPtr
, (UINT
)wParam
);
1826 return TRACKBAR_SetTic (infoPtr
, (LONG
)lParam
);
1828 case TBM_SETTICFREQ
:
1829 return TRACKBAR_SetTicFreq (infoPtr
, (WORD
)wParam
);
1831 case TBM_SETTIPSIDE
:
1832 return TRACKBAR_SetTipSide (infoPtr
, (INT
)wParam
);
1834 case TBM_SETTOOLTIPS
:
1835 return TRACKBAR_SetToolTips (infoPtr
, (HWND
)wParam
);
1837 case TBM_SETUNICODEFORMAT
:
1838 return TRACKBAR_SetUnicodeFormat (infoPtr
, (BOOL
)wParam
);
1841 case WM_CAPTURECHANGED
:
1842 return TRACKBAR_CaptureChanged (infoPtr
);
1845 return TRACKBAR_Create (hwnd
, (LPCREATESTRUCTW
)lParam
);
1848 return TRACKBAR_Destroy (infoPtr
);
1850 /* case WM_ENABLE: */
1856 return DLGC_WANTARROWS
;
1859 return TRACKBAR_KeyDown (infoPtr
, (INT
)wParam
, (DWORD
)lParam
);
1862 return TRACKBAR_KeyUp (infoPtr
, (INT
)wParam
, (DWORD
)lParam
);
1865 return TRACKBAR_KillFocus (infoPtr
, (HWND
)wParam
);
1867 case WM_LBUTTONDOWN
:
1868 return TRACKBAR_LButtonDown (infoPtr
, wParam
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1871 return TRACKBAR_LButtonUp (infoPtr
, wParam
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1874 infoPtr
->flags
&= ~TB_THUMB_HOT
;
1875 InvalidateRect (infoPtr
->hwndSelf
, &infoPtr
->rcThumb
, FALSE
);
1879 return TRACKBAR_MouseMove (infoPtr
, wParam
, (SHORT
)LOWORD(lParam
), (SHORT
)HIWORD(lParam
));
1881 case WM_PRINTCLIENT
:
1883 return TRACKBAR_Paint (infoPtr
, (HDC
)wParam
);
1886 return TRACKBAR_SetFocus (infoPtr
, (HWND
)wParam
);
1889 return TRACKBAR_Size (infoPtr
, wParam
, LOWORD(lParam
), HIWORD(lParam
));
1891 case WM_THEMECHANGED
:
1892 return theme_changed (infoPtr
);
1895 return TRACKBAR_Timer (infoPtr
, (INT
)wParam
, (TIMERPROC
*)lParam
);
1897 case WM_WININICHANGE
:
1898 return TRACKBAR_InitializeThumb (infoPtr
);
1901 if ((uMsg
>= WM_USER
) && (uMsg
< WM_APP
))
1902 ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg
, wParam
, lParam
);
1903 return DefWindowProcW (hwnd
, uMsg
, wParam
, lParam
);
1908 void TRACKBAR_Register (void)
1912 ZeroMemory (&wndClass
, sizeof(WNDCLASSW
));
1913 wndClass
.style
= CS_GLOBALCLASS
;
1914 wndClass
.lpfnWndProc
= TRACKBAR_WindowProc
;
1915 wndClass
.cbClsExtra
= 0;
1916 wndClass
.cbWndExtra
= sizeof(TRACKBAR_INFO
*);
1917 wndClass
.hCursor
= LoadCursorW (0, (LPWSTR
)IDC_ARROW
);
1918 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
1919 wndClass
.lpszClassName
= TRACKBAR_CLASSW
;
1921 RegisterClassW (&wndClass
);
1925 void TRACKBAR_Unregister (void)
1927 UnregisterClassW (TRACKBAR_CLASSW
, NULL
);