4 * Copyright 1998, 1999 Eric Kohl <ekohl@abo.rhein-zeitung.de>
5 * Copyright 1998,1999 Alex Priem <alexp@sci.kun.nl>
10 * - more display code.
11 * - handle dragging slider better
12 * - better tic handling.
13 * - more notifications.
19 -TBM_SETRANGEMAX & TBM_SETRANGEMIN should only change the view of the
20 trackbar, not the actual amount of tics in the list.
21 -TBM_GETTIC & TBM_GETTICPOS shouldn't rely on infoPtr->tics being sorted.
22 - Make drawing code exact match of w95 drawing.
31 #include "debugtools.h"
33 DEFAULT_DEBUG_CHANNEL(trackbar);
36 #define TRACKBAR_GetInfoPtr(wndPtr) ((TRACKBAR_INFO *)GetWindowLongA (hwnd,0))
39 /* Used by TRACKBAR_Refresh to find out which parts of the control
40 need to be recalculated */
42 #define TB_THUMBPOSCHANGED 1
43 #define TB_THUMBSIZECHANGED 2
44 #define TB_THUMBCHANGED (TB_THUMBPOSCHANGED | TB_THUMBPOSCHANGED)
45 #define TB_SELECTIONCHANGED 4
46 #define TB_DRAG_MODE 16 /* we're dragging the slider */
47 #define TB_DRAGPOSVALID 32 /* current Position is in dragPos */
48 #define TB_SHOW_TOOLTIP 64 /* tooltip-style enabled and tooltip on */
50 /* helper defines for TRACKBAR_DrawTic */
51 #define TIC_LEFTEDGE 0x20
52 #define TIC_RIGHTEDGE 0x40
53 #define TIC_EDGE (TIC_LEFTEDGE | TIC_RIGHTEDGE)
54 #define TIC_SELECTIONMARKMAX 0x80
55 #define TIC_SELECTIONMARKMIN 0x100
56 #define TIC_SELECTIONMARK (TIC_SELECTIONMARKMAX | TIC_SELECTIONMARKMIN)
58 static BOOL TRACKBAR_SendNotify (HWND hwnd, UINT code);
60 static void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
64 if (infoPtr->uTicFreq && infoPtr->nRangeMax >= infoPtr->nRangeMin)
65 nrTics=(infoPtr->nRangeMax - infoPtr->nRangeMin)/infoPtr->uTicFreq;
68 COMCTL32_Free (infoPtr->tics);
74 if (nrTics!=infoPtr->uNumTics) {
75 infoPtr->tics=COMCTL32_ReAlloc (infoPtr->tics,
76 (nrTics+1)*sizeof (DWORD));
77 infoPtr->uNumTics=nrTics;
79 infoPtr->uNumTics=nrTics;
80 tic=infoPtr->nRangeMin+infoPtr->uTicFreq;
81 for (i=0; i<nrTics; i++,tic+=infoPtr->uTicFreq)
86 /* converts from physical (mouse) position to logical position
87 (in range of trackbar) */
90 TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place,
93 double range,width,pos;
95 range=infoPtr->nRangeMax - infoPtr->nRangeMin;
97 width=infoPtr->rcChannel.bottom - infoPtr->rcChannel.top;
98 pos=(range*(place - infoPtr->rcChannel.top)) / width;
100 width=infoPtr->rcChannel.right - infoPtr->rcChannel.left;
101 pos=(range*(place - infoPtr->rcChannel.left)) / width;
104 if (pos > infoPtr->nRangeMax)
105 pos = infoPtr->nRangeMax;
106 else if (pos < infoPtr->nRangeMin)
107 pos = infoPtr->nRangeMin;
115 TRACKBAR_CalcChannel (HWND hwnd, TRACKBAR_INFO *infoPtr)
117 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
119 RECT lpRect,*channel = & infoPtr->rcChannel;
121 GetClientRect (hwnd, &lpRect);
123 if (dwStyle & TBS_ENABLESELRANGE)
124 cyChannel = MAX(infoPtr->uThumbLen - 8, 4);
128 if (dwStyle & TBS_VERT) {
129 channel->top = lpRect.top + 8;
130 channel->bottom = lpRect.bottom - 8;
132 if (dwStyle & TBS_BOTH) {
133 channel->left = (lpRect.right - cyChannel) / 2;
134 channel->right = (lpRect.right + cyChannel) / 2;
136 else if (dwStyle & TBS_LEFT) {
137 channel->left = lpRect.left + 10;
138 channel->right = channel->left + cyChannel;
140 else { /* TBS_RIGHT */
141 channel->right = lpRect.right - 10;
142 channel->left = channel->right - cyChannel;
146 channel->left = lpRect.left + 8;
147 channel->right = lpRect.right - 8;
148 if (dwStyle & TBS_BOTH) {
149 channel->top = (lpRect.bottom - cyChannel) / 2;
150 channel->bottom = (lpRect.bottom + cyChannel) / 2;
152 else if (dwStyle & TBS_TOP) {
153 channel->top = lpRect.top + 10;
154 channel->bottom = channel->top + cyChannel;
156 else { /* TBS_BOTTOM */
157 channel->bottom = lpRect.bottom - 10;
158 channel->top = channel->bottom - cyChannel;
164 TRACKBAR_CalcThumb (HWND hwnd, TRACKBAR_INFO *infoPtr)
169 thumb=&infoPtr->rcThumb;
170 range=infoPtr->nRangeMax - infoPtr->nRangeMin;
171 if (!range) return; /* FIXME: may this happen? */
172 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_VERT) {
173 width=infoPtr->rcChannel.bottom - infoPtr->rcChannel.top;
174 thumb->left = infoPtr->rcChannel.left - 1;
175 thumb->right = infoPtr->rcChannel.left + infoPtr->uThumbLen - 8;
176 thumb->top = infoPtr->rcChannel.top +
177 (width*infoPtr->nPos)/range - 5;
178 thumb->bottom = thumb->top + infoPtr->uThumbLen/3;
181 width=infoPtr->rcChannel.right - infoPtr->rcChannel.left;
182 thumb->left = infoPtr->rcChannel.left +
183 (width*infoPtr->nPos)/range - 5;
184 thumb->right = thumb->left + infoPtr->uThumbLen/3;
185 thumb->top = infoPtr->rcChannel.top - 1;
186 thumb->bottom = infoPtr->rcChannel.top + infoPtr->uThumbLen - 8;
191 TRACKBAR_CalcSelection (HWND hwnd, TRACKBAR_INFO *infoPtr)
196 selection= & infoPtr->rcSelection;
197 range=infoPtr->nRangeMax - infoPtr->nRangeMin;
198 width=infoPtr->rcChannel.right - infoPtr->rcChannel.left;
201 SetRectEmpty (selection);
203 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_VERT) {
204 selection->left = infoPtr->rcChannel.left +
205 (width*infoPtr->nSelMin)/range;
206 selection->right = infoPtr->rcChannel.left +
207 (width*infoPtr->nSelMax)/range;
208 selection->top = infoPtr->rcChannel.top + 2;
209 selection->bottom = infoPtr->rcChannel.bottom - 2;
211 selection->top = infoPtr->rcChannel.top +
212 (width*infoPtr->nSelMin)/range;
213 selection->bottom = infoPtr->rcChannel.top +
214 (width*infoPtr->nSelMax)/range;
215 selection->left = infoPtr->rcChannel.left + 2;
216 selection->right = infoPtr->rcChannel.right - 2;
220 /* Trackbar drawing code. I like my spaghetti done milanese. */
222 /* ticPos is in tic-units, not in pixels */
225 TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
226 int flags, COLORREF clrTic)
228 RECT rcChannel=infoPtr->rcChannel;
229 int x,y,width,range,side;
231 range=infoPtr->nRangeMax - infoPtr->nRangeMin;
232 width=rcChannel.right - rcChannel.left;
234 if (flags & TBS_TOP) {
238 y=rcChannel.bottom+2;
242 if (flags & TIC_SELECTIONMARK) {
243 if (flags & TIC_SELECTIONMARKMIN)
244 x=rcChannel.left + (width*ticPos)/range - 1;
246 x=rcChannel.left + (width*ticPos)/range + 1;
248 SetPixel (hdc, x,y+6*side, clrTic);
249 SetPixel (hdc, x,y+7*side, clrTic);
253 if ((ticPos>infoPtr->nRangeMin) && (ticPos<infoPtr->nRangeMax)) {
254 x=rcChannel.left + (width*ticPos)/range;
255 SetPixel (hdc, x,y+5*side, clrTic);
256 SetPixel (hdc, x,y+6*side, clrTic);
257 SetPixel (hdc, x,y+7*side, clrTic);
260 if (flags & TIC_EDGE) {
261 if (flags & TIC_LEFTEDGE)
266 SetPixel (hdc, x,y+5*side, clrTic);
267 SetPixel (hdc, x,y+6*side, clrTic);
268 SetPixel (hdc, x,y+7*side, clrTic);
269 SetPixel (hdc, x,y+8*side, clrTic);
275 TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
276 int flags, COLORREF clrTic)
278 RECT rcChannel=infoPtr->rcChannel;
279 int x,y,width,range,side;
281 range=infoPtr->nRangeMax - infoPtr->nRangeMin;
282 width=rcChannel.bottom - rcChannel.top;
284 if (flags & TBS_TOP) {
293 if (flags & TIC_SELECTIONMARK) {
294 if (flags & TIC_SELECTIONMARKMIN)
295 y=rcChannel.top + (width*ticPos)/range - 1;
297 y=rcChannel.top + (width*ticPos)/range + 1;
299 SetPixel (hdc, x+6*side, y, clrTic);
300 SetPixel (hdc, x+7*side, y, clrTic);
304 if ((ticPos>infoPtr->nRangeMin) && (ticPos<infoPtr->nRangeMax)) {
305 y=rcChannel.top + (width*ticPos)/range;
306 SetPixel (hdc, x+5*side, y, clrTic);
307 SetPixel (hdc, x+6*side, y, clrTic);
308 SetPixel (hdc, x+7*side, y, clrTic);
311 if (flags & TIC_EDGE) {
312 if (flags & TIC_LEFTEDGE)
317 SetPixel (hdc, x+5*side, y, clrTic);
318 SetPixel (hdc, x+6*side, y, clrTic);
319 SetPixel (hdc, x+7*side, y, clrTic);
320 SetPixel (hdc, x+8*side, y, clrTic);
327 TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
328 int flags, COLORREF clrTic)
331 if (flags & TBS_VERT) {
332 if ((flags & TBS_TOP) || (flags & TBS_BOTH))
333 TRACKBAR_DrawVertTic (infoPtr, hdc, ticPos,
334 flags | TBS_TOP , clrTic);
335 if (!(flags & TBS_TOP) || (flags & TBS_BOTH))
336 TRACKBAR_DrawVertTic (infoPtr, hdc, ticPos, flags, clrTic);
340 if ((flags & TBS_TOP) || (flags & TBS_BOTH))
341 TRACKBAR_DrawHorizTic (infoPtr, hdc, ticPos, flags | TBS_TOP , clrTic);
343 if (!(flags & TBS_TOP) || (flags & TBS_BOTH))
344 TRACKBAR_DrawHorizTic (infoPtr, hdc, ticPos, flags, clrTic);
350 TRACKBAR_Refresh (HWND hwnd, HDC hdc)
352 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
353 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
354 RECT rcClient, rcChannel, rcSelection;
358 GetClientRect (hwnd, &rcClient);
359 hBrush = CreateSolidBrush (infoPtr->clrBk);
360 FillRect (hdc, &rcClient, hBrush);
361 DeleteObject (hBrush);
363 if (infoPtr->flags & TB_DRAGPOSVALID) {
364 infoPtr->nPos=infoPtr->dragPos;
365 infoPtr->flags |= TB_THUMBPOSCHANGED;
368 if (infoPtr->flags & TB_THUMBCHANGED) {
369 TRACKBAR_CalcThumb (hwnd, infoPtr);
370 if (infoPtr->flags & TB_THUMBSIZECHANGED)
371 TRACKBAR_CalcChannel (hwnd, infoPtr);
373 if (infoPtr->flags & TB_SELECTIONCHANGED)
374 TRACKBAR_CalcSelection (hwnd, infoPtr);
375 infoPtr->flags &= ~ (TB_THUMBCHANGED | TB_SELECTIONCHANGED |
380 rcChannel = infoPtr->rcChannel;
381 rcSelection= infoPtr->rcSelection;
382 DrawEdge (hdc, &rcChannel, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
384 if (dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
385 HBRUSH hbr = CreateSolidBrush (RGB(255,255,255));
386 FillRect (hdc, &rcChannel, hbr);
387 if (((dwStyle & TBS_VERT) &&
388 (rcSelection.left!=rcSelection.right)) ||
389 ((!(dwStyle & TBS_VERT)) &&
390 (rcSelection.left!=rcSelection.right))) {
391 hbr=CreateSolidBrush (COLOR_HIGHLIGHT);
392 FillRect (hdc, &rcSelection, hbr);
400 if (!(dwStyle & TBS_NOTICKS)) {
401 int ticFlags = dwStyle & 0x0f;
402 COLORREF clrTic=GetSysColor (COLOR_3DDKSHADOW);
404 for (i=0; i<infoPtr->uNumTics; i++)
405 TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->tics[i],
408 TRACKBAR_DrawTics (infoPtr, hdc, 0, ticFlags | TIC_LEFTEDGE, clrTic);
409 TRACKBAR_DrawTics (infoPtr, hdc, 0, ticFlags | TIC_RIGHTEDGE, clrTic);
411 if ((dwStyle & TBS_ENABLESELRANGE) &&
412 (rcSelection.left!=rcSelection.right)) {
413 TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->nSelMin,
414 ticFlags | TIC_SELECTIONMARKMIN, clrTic);
415 TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->nSelMax,
416 ticFlags | TIC_SELECTIONMARKMAX, clrTic);
422 if (!(dwStyle & TBS_NOTHUMB)) {
424 HBRUSH hbr = CreateSolidBrush (COLOR_BTNFACE);
425 RECT thumb = infoPtr->rcThumb;
427 SelectObject (hdc, hbr);
429 if (dwStyle & TBS_BOTH) {
430 FillRect (hdc, &thumb, hbr);
431 DrawEdge (hdc, &thumb, EDGE_RAISED, BF_TOPLEFT);
435 /* first, fill the thumb */
436 /* FIXME: revamp. check for TBS_VERT */
438 SetPolyFillMode (hdc,WINDING);
439 points[0].x=thumb.left;
440 points[0].y=thumb.top;
441 points[1].x=thumb.right - 1;
442 points[1].y=thumb.top;
443 points[2].x=thumb.right - 1;
444 points[2].y=thumb.bottom -2;
445 points[3].x=thumb.left;
446 points[3].y=thumb.bottom -2;
447 points[4].x=points[0].x;
448 points[4].y=points[0].y;
449 Polygon (hdc, points, 5);
451 if (dwStyle & TBS_VERT) {
454 DrawEdge (hdc, &thumb, EDGE_RAISED, BF_TOPLEFT);
461 DrawFocusRect (hdc, &rcClient);
466 TRACKBAR_AlignBuddies (HWND hwnd, TRACKBAR_INFO *infoPtr)
468 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
469 HWND hwndParent = GetParent (hwnd);
470 RECT rcSelf, rcBuddy;
473 GetWindowRect (hwnd, &rcSelf);
474 MapWindowPoints (HWND_DESKTOP, hwndParent, (LPPOINT)&rcSelf, 2);
476 /* align buddy left or above */
477 if (infoPtr->hwndBuddyLA) {
478 GetWindowRect (infoPtr->hwndBuddyLA, &rcBuddy);
479 MapWindowPoints (HWND_DESKTOP, hwndParent, (LPPOINT)&rcBuddy, 2);
481 if (dwStyle & TBS_VERT) {
482 x = (infoPtr->rcChannel.right + infoPtr->rcChannel.left) / 2 -
483 (rcBuddy.right - rcBuddy.left) / 2 + rcSelf.left;
484 y = rcSelf.top - (rcBuddy.bottom - rcBuddy.top);
487 x = rcSelf.left - (rcBuddy.right - rcBuddy.left);
488 y = (infoPtr->rcChannel.bottom + infoPtr->rcChannel.top) / 2 -
489 (rcBuddy.bottom - rcBuddy.top) / 2 + rcSelf.top;
492 SetWindowPos (infoPtr->hwndBuddyLA, 0, x, y, 0, 0,
493 SWP_NOZORDER | SWP_NOSIZE);
497 /* align buddy right or below */
498 if (infoPtr->hwndBuddyRB) {
499 GetWindowRect (infoPtr->hwndBuddyRB, &rcBuddy);
500 MapWindowPoints (HWND_DESKTOP, hwndParent, (LPPOINT)&rcBuddy, 2);
502 if (dwStyle & TBS_VERT) {
503 x = (infoPtr->rcChannel.right + infoPtr->rcChannel.left) / 2 -
504 (rcBuddy.right - rcBuddy.left) / 2 + rcSelf.left;
509 y = (infoPtr->rcChannel.bottom + infoPtr->rcChannel.top) / 2 -
510 (rcBuddy.bottom - rcBuddy.top) / 2 + rcSelf.top;
512 SetWindowPos (infoPtr->hwndBuddyRB, 0, x, y, 0, 0,
513 SWP_NOZORDER | SWP_NOSIZE);
519 TRACKBAR_ClearSel (HWND hwnd, WPARAM wParam, LPARAM lParam)
521 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
523 infoPtr->nSelMin = 0;
524 infoPtr->nSelMax = 0;
525 infoPtr->flags |= TB_SELECTIONCHANGED;
528 InvalidateRect (hwnd, NULL, FALSE);
535 TRACKBAR_ClearTics (HWND hwnd, WPARAM wParam, LPARAM lParam)
537 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
540 COMCTL32_Free (infoPtr->tics);
541 infoPtr->tics = NULL;
542 infoPtr->uNumTics = 0;
546 InvalidateRect (hwnd, NULL, FALSE);
553 TRACKBAR_GetBuddy (HWND hwnd, WPARAM wParam, LPARAM lParam)
555 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
557 if (wParam) /* buddy is left or above */
558 return (LRESULT)infoPtr->hwndBuddyLA;
560 /* buddy is right or below */
561 return (LRESULT) infoPtr->hwndBuddyRB;
566 TRACKBAR_GetChannelRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
568 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
569 LPRECT lprc = (LPRECT)lParam;
574 lprc->left = infoPtr->rcChannel.left;
575 lprc->right = infoPtr->rcChannel.right;
576 lprc->bottom = infoPtr->rcChannel.bottom;
577 lprc->top = infoPtr->rcChannel.top;
584 TRACKBAR_GetLineSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
586 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
588 return infoPtr->nLineSize;
593 TRACKBAR_GetNumTics (HWND hwnd, WPARAM wParam, LPARAM lParam)
595 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
597 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_NOTICKS)
600 return infoPtr->uNumTics+2;
605 TRACKBAR_GetPageSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
607 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
609 return infoPtr->nPageSize;
614 TRACKBAR_GetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
616 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
618 return infoPtr->nPos;
623 TRACKBAR_GetRangeMax (HWND hwnd, WPARAM wParam, LPARAM lParam)
625 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
627 return infoPtr->nRangeMax;
632 TRACKBAR_GetRangeMin (HWND hwnd, WPARAM wParam, LPARAM lParam)
634 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
636 return infoPtr->nRangeMin;
641 TRACKBAR_GetSelEnd (HWND hwnd, WPARAM wParam, LPARAM lParam)
643 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
645 return infoPtr->nSelMax;
650 TRACKBAR_GetSelStart (HWND hwnd, WPARAM wParam, LPARAM lParam)
652 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
654 return infoPtr->nSelMin;
659 TRACKBAR_GetThumbLength (HWND hwnd, WPARAM wParam, LPARAM lParam)
661 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
663 return infoPtr->uThumbLen;
667 TRACKBAR_GetPTics (HWND hwnd)
669 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
671 return (LRESULT) infoPtr->tics;
675 TRACKBAR_GetThumbRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
677 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
678 LPRECT lprc = (LPRECT)lParam;
683 lprc->left = infoPtr->rcThumb.left;
684 lprc->right = infoPtr->rcThumb.right;
685 lprc->bottom = infoPtr->rcThumb.bottom;
686 lprc->top = infoPtr->rcThumb.top;
693 TRACKBAR_GetTic (HWND hwnd, WPARAM wParam, LPARAM lParam)
695 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
699 if ((iTic<0) || (iTic>infoPtr->uNumTics))
702 return (LRESULT) infoPtr->tics[iTic];
708 TRACKBAR_GetTicPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
710 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
711 INT iTic, range, width, pos;
715 if ((iTic<0) || (iTic>infoPtr->uNumTics))
718 range=infoPtr->nRangeMax - infoPtr->nRangeMin;
719 width=infoPtr->rcChannel.right - infoPtr->rcChannel.left;
720 pos=infoPtr->rcChannel.left + (width * infoPtr->tics[iTic]) / range;
723 return (LRESULT) pos;
728 TRACKBAR_GetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
730 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
732 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_TOOLTIPS)
733 return (LRESULT)infoPtr->hwndToolTip;
738 /* case TBM_GETUNICODEFORMAT: */
742 TRACKBAR_SetBuddy (HWND hwnd, WPARAM wParam, LPARAM lParam)
744 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
748 /* buddy is left or above */
749 hwndTemp = infoPtr->hwndBuddyLA;
750 infoPtr->hwndBuddyLA = (HWND)lParam;
752 FIXME("move buddy!\n");
755 /* buddy is right or below */
756 hwndTemp = infoPtr->hwndBuddyRB;
757 infoPtr->hwndBuddyRB = (HWND)lParam;
759 FIXME("move buddy!\n");
762 TRACKBAR_AlignBuddies (hwnd, infoPtr);
764 return (LRESULT)hwndTemp;
769 TRACKBAR_SetLineSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
771 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
772 INT nTemp = infoPtr->nLineSize;
774 infoPtr->nLineSize = (INT)lParam;
781 TRACKBAR_SetPageSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
783 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
784 INT nTemp = infoPtr->nPageSize;
786 infoPtr->nPageSize = (INT)lParam;
793 TRACKBAR_SetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
795 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
797 infoPtr->nPos = (INT)LOWORD(lParam);
799 if (infoPtr->nPos < infoPtr->nRangeMin)
800 infoPtr->nPos = infoPtr->nRangeMin;
802 if (infoPtr->nPos > infoPtr->nRangeMax)
803 infoPtr->nPos = infoPtr->nRangeMax;
804 infoPtr->flags |= TB_THUMBPOSCHANGED;
807 InvalidateRect (hwnd, NULL, FALSE);
814 TRACKBAR_SetRange (HWND hwnd, WPARAM wParam, LPARAM lParam)
816 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
817 infoPtr->nRangeMin = (INT)LOWORD(lParam);
818 infoPtr->nRangeMax = (INT)HIWORD(lParam);
820 if (infoPtr->nPos < infoPtr->nRangeMin) {
821 infoPtr->nPos = infoPtr->nRangeMin;
822 infoPtr->flags |=TB_THUMBPOSCHANGED;
825 if (infoPtr->nPos > infoPtr->nRangeMax) {
826 infoPtr->nPos = infoPtr->nRangeMax;
827 infoPtr->flags |=TB_THUMBPOSCHANGED;
830 infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
831 if (infoPtr->nPageSize == 0)
832 infoPtr->nPageSize = 1;
833 TRACKBAR_RecalculateTics (infoPtr);
836 InvalidateRect (hwnd, NULL, FALSE);
843 TRACKBAR_SetRangeMax (HWND hwnd, WPARAM wParam, LPARAM lParam)
845 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
847 infoPtr->nRangeMax = (INT)lParam;
848 if (infoPtr->nPos > infoPtr->nRangeMax) {
849 infoPtr->nPos = infoPtr->nRangeMax;
850 infoPtr->flags |=TB_THUMBPOSCHANGED;
853 infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
854 if (infoPtr->nPageSize == 0)
855 infoPtr->nPageSize = 1;
856 TRACKBAR_RecalculateTics (infoPtr);
859 InvalidateRect (hwnd, NULL, FALSE);
866 TRACKBAR_SetRangeMin (HWND hwnd, WPARAM wParam, LPARAM lParam)
868 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
870 infoPtr->nRangeMin = (INT)lParam;
871 if (infoPtr->nPos < infoPtr->nRangeMin) {
872 infoPtr->nPos = infoPtr->nRangeMin;
873 infoPtr->flags |=TB_THUMBPOSCHANGED;
876 infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
877 if (infoPtr->nPageSize == 0)
878 infoPtr->nPageSize = 1;
879 TRACKBAR_RecalculateTics (infoPtr);
882 InvalidateRect (hwnd, NULL, FALSE);
889 TRACKBAR_SetTicFreq (HWND hwnd, WPARAM wParam)
891 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
893 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_AUTOTICKS)
894 infoPtr->uTicFreq=(UINT) wParam;
896 TRACKBAR_RecalculateTics (infoPtr);
898 InvalidateRect (hwnd, NULL, FALSE);
905 TRACKBAR_SetSel (HWND hwnd, WPARAM wParam, LPARAM lParam)
907 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
909 infoPtr->nSelMin = (INT)LOWORD(lParam);
910 infoPtr->nSelMax = (INT)HIWORD(lParam);
911 infoPtr->flags |=TB_SELECTIONCHANGED;
913 if (!GetWindowLongA (hwnd, GWL_STYLE) & TBS_ENABLESELRANGE)
916 if (infoPtr->nSelMin < infoPtr->nRangeMin)
917 infoPtr->nSelMin = infoPtr->nRangeMin;
918 if (infoPtr->nSelMax > infoPtr->nRangeMax)
919 infoPtr->nSelMax = infoPtr->nRangeMax;
922 InvalidateRect (hwnd, NULL, FALSE);
930 TRACKBAR_SetSelEnd (HWND hwnd, WPARAM wParam, LPARAM lParam)
932 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
934 if (!GetWindowLongA (hwnd, GWL_STYLE) & TBS_ENABLESELRANGE)
937 infoPtr->nSelMax = (INT)lParam;
938 infoPtr->flags |= TB_SELECTIONCHANGED;
940 if (infoPtr->nSelMax > infoPtr->nRangeMax)
941 infoPtr->nSelMax = infoPtr->nRangeMax;
944 InvalidateRect (hwnd, NULL, FALSE);
951 TRACKBAR_SetSelStart (HWND hwnd, WPARAM wParam, LPARAM lParam)
953 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
955 if (!GetWindowLongA (hwnd, GWL_STYLE) & TBS_ENABLESELRANGE)
958 infoPtr->nSelMin = (INT)lParam;
959 infoPtr->flags |=TB_SELECTIONCHANGED;
961 if (infoPtr->nSelMin < infoPtr->nRangeMin)
962 infoPtr->nSelMin = infoPtr->nRangeMin;
965 InvalidateRect (hwnd, NULL, FALSE);
972 TRACKBAR_SetThumbLength (HWND hwnd, WPARAM wParam, LPARAM lParam)
974 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
976 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_FIXEDLENGTH)
977 infoPtr->uThumbLen = (UINT)wParam;
979 infoPtr->flags |= TB_THUMBSIZECHANGED;
981 InvalidateRect (hwnd, NULL, FALSE);
988 TRACKBAR_SetTic (HWND hwnd, WPARAM wParam, LPARAM lParam)
990 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
991 INT nPos = (INT)lParam;
993 if ((nPos < infoPtr->nRangeMin) || (nPos> infoPtr->nRangeMax))
997 infoPtr->tics=COMCTL32_ReAlloc( infoPtr->tics,
998 (infoPtr->uNumTics)*sizeof (DWORD));
999 infoPtr->tics[infoPtr->uNumTics-1]=nPos;
1001 InvalidateRect (hwnd, NULL, FALSE);
1008 TRACKBAR_SetTipSide (HWND hwnd, WPARAM wParam, LPARAM lParam)
1010 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1011 INT fTemp = infoPtr->fLocation;
1013 infoPtr->fLocation = (INT)wParam;
1020 TRACKBAR_SetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
1022 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1024 infoPtr->hwndToolTip = (HWND)wParam;
1030 /* case TBM_SETUNICODEFORMAT: */
1034 TRACKBAR_InitializeThumb (HWND hwnd)
1036 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1038 infoPtr->uThumbLen = 23; /* initial thumb length */
1040 TRACKBAR_CalcChannel (hwnd,infoPtr);
1041 TRACKBAR_CalcThumb (hwnd, infoPtr);
1042 infoPtr->flags &= ~TB_SELECTIONCHANGED;
1049 TRACKBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
1051 TRACKBAR_INFO *infoPtr;
1053 infoPtr = (TRACKBAR_INFO *)COMCTL32_Alloc (sizeof(TRACKBAR_INFO));
1054 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
1056 /* set default values */
1057 infoPtr->nRangeMin = 0;
1058 infoPtr->nRangeMax = 100;
1059 infoPtr->nLineSize = 1;
1060 infoPtr->nPageSize = 20;
1061 infoPtr->nSelMin = 0;
1062 infoPtr->nSelMax = 0;
1065 infoPtr->uNumTics = 0; /* start and end tic are not included in count*/
1066 infoPtr->uTicFreq = 1;
1067 infoPtr->tics = NULL;
1068 infoPtr->clrBk = GetSysColor (COLOR_BTNFACE);
1069 infoPtr->hwndNotify = GetParent (hwnd);
1071 TRACKBAR_InitializeThumb (hwnd);
1073 /* Create tooltip control */
1074 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_TOOLTIPS) {
1077 infoPtr->hwndToolTip =
1078 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
1079 CW_USEDEFAULT, CW_USEDEFAULT,
1080 CW_USEDEFAULT, CW_USEDEFAULT,
1083 /* Send NM_TOOLTIPSCREATED notification */
1084 if (infoPtr->hwndToolTip) {
1085 NMTOOLTIPSCREATED nmttc;
1087 nmttc.hdr.hwndFrom = hwnd;
1088 nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
1089 nmttc.hdr.code = NM_TOOLTIPSCREATED;
1090 nmttc.hwndToolTips = infoPtr->hwndToolTip;
1092 SendMessageA (GetParent (hwnd), WM_NOTIFY,
1093 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc);
1096 ZeroMemory (&ti, sizeof(TTTOOLINFOA));
1097 ti.cbSize = sizeof(TTTOOLINFOA);
1098 ti.uFlags = TTF_IDISHWND | TTF_TRACK;
1101 ti.lpszText = "Test"; /* LPSTR_TEXTCALLBACK */
1102 SetRectEmpty (&ti.rect);
1104 SendMessageA (infoPtr->hwndToolTip, TTM_ADDTOOLA, 0, (LPARAM)&ti);
1112 TRACKBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
1114 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1116 /* delete tooltip control */
1117 if (infoPtr->hwndToolTip)
1118 DestroyWindow (infoPtr->hwndToolTip);
1120 COMCTL32_Free (infoPtr);
1126 TRACKBAR_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
1128 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1132 infoPtr->bFocus = FALSE;
1133 infoPtr->flags &= ~TB_DRAG_MODE;
1135 InvalidateRect (hwnd, NULL, FALSE);
1142 TRACKBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
1144 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1145 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
1146 int clickPlace,prevPos,vertical;
1151 vertical = dwStyle & TBS_VERT;
1153 clickPlace=(INT)HIWORD(lParam);
1155 clickPlace=(INT)LOWORD(lParam);
1158 (clickPlace>infoPtr->rcThumb.top) &&
1159 (clickPlace<infoPtr->rcThumb.bottom)) ||
1161 (clickPlace>infoPtr->rcThumb.left) &&
1162 (clickPlace<infoPtr->rcThumb.right))) {
1163 infoPtr->flags |= TB_DRAG_MODE;
1164 if (dwStyle & TBS_TOOLTIPS) { /* enable tooltip */
1169 SendMessageA (infoPtr->hwndToolTip, TTM_TRACKPOSITION, 0,
1170 (LPARAM)MAKELPARAM(pt.x, pt.y));
1172 ti.cbSize = sizeof(TTTOOLINFOA);
1174 ti.hwnd = (UINT)hwnd;
1176 infoPtr->flags |= TB_SHOW_TOOLTIP;
1178 SendMessageA (infoPtr->hwndToolTip, TTM_TRACKACTIVATE,
1179 (WPARAM)TRUE, (LPARAM)&ti);
1184 clickPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace, vertical);
1185 prevPos = infoPtr->nPos;
1187 if (clickPos > prevPos) { /* similar to VK_NEXT */
1188 infoPtr->nPos += infoPtr->nPageSize;
1189 if (infoPtr->nPos > infoPtr->nRangeMax)
1190 infoPtr->nPos = infoPtr->nRangeMax;
1191 TRACKBAR_SendNotify (hwnd, TB_PAGEUP);
1193 infoPtr->nPos -= infoPtr->nPageSize; /* similar to VK_PRIOR */
1194 if (infoPtr->nPos < infoPtr->nRangeMin)
1195 infoPtr->nPos = infoPtr->nRangeMin;
1196 TRACKBAR_SendNotify (hwnd, TB_PAGEDOWN);
1199 if (prevPos!=infoPtr->nPos) {
1200 infoPtr->flags |= TB_THUMBPOSCHANGED;
1201 InvalidateRect (hwnd, NULL, FALSE);
1209 TRACKBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
1211 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1213 TRACKBAR_SendNotify (hwnd, TB_ENDTRACK);
1215 if (infoPtr->flags & TB_DRAG_MODE)
1217 infoPtr->flags &= ~TB_DRAG_MODE;
1221 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_TOOLTIPS) { /* disable tooltip */
1224 ti.cbSize = sizeof(TTTOOLINFOA);
1226 ti.hwnd = (UINT)hwnd;
1228 infoPtr->flags &= ~TB_SHOW_TOOLTIP;
1229 SendMessageA (infoPtr->hwndToolTip, TTM_TRACKACTIVATE,
1230 (WPARAM)FALSE, (LPARAM)&ti);
1233 InvalidateRect (hwnd, NULL, FALSE);
1240 TRACKBAR_CaptureChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
1242 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1244 if (infoPtr->flags & TB_DRAGPOSVALID) {
1245 infoPtr->nPos=infoPtr->dragPos;
1246 InvalidateRect (hwnd, NULL, FALSE);
1249 infoPtr->flags &= ~ TB_DRAGPOSVALID;
1251 TRACKBAR_SendNotify (hwnd, TB_ENDTRACK);
1257 TRACKBAR_Paint (HWND hwnd, WPARAM wParam)
1262 hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
1263 TRACKBAR_Refresh (hwnd, hdc);
1265 EndPaint (hwnd, &ps);
1271 TRACKBAR_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
1273 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1276 infoPtr->bFocus = TRUE;
1278 InvalidateRect (hwnd, NULL, FALSE);
1285 TRACKBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
1287 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1289 TRACKBAR_CalcChannel (hwnd, infoPtr);
1290 TRACKBAR_AlignBuddies (hwnd, infoPtr);
1297 TRACKBAR_SendNotify (HWND hwnd, UINT code)
1301 if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_VERT)
1302 return (BOOL) SendMessageA (GetParent (hwnd),
1303 WM_VSCROLL, (WPARAM)code, (LPARAM)hwnd);
1305 return (BOOL) SendMessageA (GetParent (hwnd),
1306 WM_HSCROLL, (WPARAM)code, (LPARAM)hwnd);
1311 TRACKBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
1313 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1314 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
1319 TRACE("%x\n",wParam);
1321 if (dwStyle & TBS_VERT)
1322 clickPlace=(SHORT)HIWORD(lParam);
1324 clickPlace=(SHORT)LOWORD(lParam);
1326 if (!(infoPtr->flags & TB_DRAG_MODE))
1330 dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace,
1331 dwStyle & TBS_VERT);
1332 if (dragPos > ((INT)dragPos) + 0.5)
1333 infoPtr->dragPos = dragPos + 1;
1335 infoPtr->dragPos = dragPos;
1337 infoPtr->flags |= TB_DRAGPOSVALID;
1338 TRACKBAR_SendNotify (hwnd, TB_THUMBTRACK | (infoPtr->nPos<<16));
1340 if (infoPtr->flags & TB_SHOW_TOOLTIP) {
1344 ti.cbSize = sizeof(TTTOOLINFOA);
1348 sprintf (buf,"%d",infoPtr->nPos);
1349 ti.lpszText = (LPSTR) buf;
1352 if (dwStyle & TBS_VERT) {
1353 SendMessageA (infoPtr->hwndToolTip, TTM_TRACKPOSITION,
1354 0, (LPARAM)MAKELPARAM(pt.x+5, pt.y+15));
1356 SendMessageA (infoPtr->hwndToolTip, TTM_TRACKPOSITION,
1357 0, (LPARAM)MAKELPARAM(pt.x+15, pt.y+5));
1359 SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA,
1363 InvalidateRect (hwnd, NULL, FALSE);
1364 UpdateWindow (hwnd);
1371 TRACKBAR_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
1373 TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
1376 TRACE("%x\n",wParam);
1382 if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE;
1383 infoPtr->nPos -= infoPtr->nLineSize;
1384 if (infoPtr->nPos < infoPtr->nRangeMin)
1385 infoPtr->nPos = infoPtr->nRangeMin;
1386 TRACKBAR_SendNotify (hwnd, TB_LINEUP);
1390 if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE;
1391 infoPtr->nPos += infoPtr->nLineSize;
1392 if (infoPtr->nPos > infoPtr->nRangeMax)
1393 infoPtr->nPos = infoPtr->nRangeMax;
1394 TRACKBAR_SendNotify (hwnd, TB_LINEDOWN);
1397 if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE;
1398 infoPtr->nPos += infoPtr->nPageSize;
1399 if (infoPtr->nPos > infoPtr->nRangeMax)
1400 infoPtr->nPos = infoPtr->nRangeMax;
1401 TRACKBAR_SendNotify (hwnd, TB_PAGEUP);
1404 if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE;
1405 infoPtr->nPos -= infoPtr->nPageSize;
1406 if (infoPtr->nPos < infoPtr->nRangeMin)
1407 infoPtr->nPos = infoPtr->nRangeMin;
1408 TRACKBAR_SendNotify (hwnd, TB_PAGEDOWN);
1411 if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE;
1412 infoPtr->nPos = infoPtr->nRangeMin;
1413 TRACKBAR_SendNotify (hwnd, TB_TOP);
1416 if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE;
1417 infoPtr->nPos = infoPtr->nRangeMax;
1418 TRACKBAR_SendNotify (hwnd, TB_BOTTOM);
1422 if (pos!=infoPtr->nPos) {
1423 infoPtr->flags |=TB_THUMBPOSCHANGED;
1424 InvalidateRect (hwnd, NULL, FALSE);
1432 TRACKBAR_KeyUp (HWND hwnd, WPARAM wParam)
1443 TRACKBAR_SendNotify (hwnd, TB_ENDTRACK);
1449 static LRESULT WINAPI
1450 TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
1455 return TRACKBAR_ClearSel (hwnd, wParam, lParam);
1458 return TRACKBAR_ClearTics (hwnd, wParam, lParam);
1461 return TRACKBAR_GetBuddy (hwnd, wParam, lParam);
1463 case TBM_GETCHANNELRECT:
1464 return TRACKBAR_GetChannelRect (hwnd, wParam, lParam);
1466 case TBM_GETLINESIZE:
1467 return TRACKBAR_GetLineSize (hwnd, wParam, lParam);
1469 case TBM_GETNUMTICS:
1470 return TRACKBAR_GetNumTics (hwnd, wParam, lParam);
1472 case TBM_GETPAGESIZE:
1473 return TRACKBAR_GetPageSize (hwnd, wParam, lParam);
1476 return TRACKBAR_GetPos (hwnd, wParam, lParam);
1479 return TRACKBAR_GetPTics (hwnd);
1481 case TBM_GETRANGEMAX:
1482 return TRACKBAR_GetRangeMax (hwnd, wParam, lParam);
1484 case TBM_GETRANGEMIN:
1485 return TRACKBAR_GetRangeMin (hwnd, wParam, lParam);
1488 return TRACKBAR_GetSelEnd (hwnd, wParam, lParam);
1490 case TBM_GETSELSTART:
1491 return TRACKBAR_GetSelStart (hwnd, wParam, lParam);
1493 case TBM_GETTHUMBLENGTH:
1494 return TRACKBAR_GetThumbLength (hwnd, wParam, lParam);
1496 case TBM_GETTHUMBRECT:
1497 return TRACKBAR_GetThumbRect (hwnd, wParam, lParam);
1500 return TRACKBAR_GetTic (hwnd, wParam, lParam);
1503 return TRACKBAR_GetTicPos (hwnd, wParam, lParam);
1505 case TBM_GETTOOLTIPS:
1506 return TRACKBAR_GetToolTips (hwnd, wParam, lParam);
1508 /* case TBM_GETUNICODEFORMAT: */
1511 return TRACKBAR_SetBuddy (hwnd, wParam, lParam);
1513 case TBM_SETLINESIZE:
1514 return TRACKBAR_SetLineSize (hwnd, wParam, lParam);
1516 case TBM_SETPAGESIZE:
1517 return TRACKBAR_SetPageSize (hwnd, wParam, lParam);
1520 return TRACKBAR_SetPos (hwnd, wParam, lParam);
1523 return TRACKBAR_SetRange (hwnd, wParam, lParam);
1525 case TBM_SETRANGEMAX:
1526 return TRACKBAR_SetRangeMax (hwnd, wParam, lParam);
1528 case TBM_SETRANGEMIN:
1529 return TRACKBAR_SetRangeMin (hwnd, wParam, lParam);
1532 return TRACKBAR_SetSel (hwnd, wParam, lParam);
1535 return TRACKBAR_SetSelEnd (hwnd, wParam, lParam);
1537 case TBM_SETSELSTART:
1538 return TRACKBAR_SetSelStart (hwnd, wParam, lParam);
1540 case TBM_SETTHUMBLENGTH:
1541 return TRACKBAR_SetThumbLength (hwnd, wParam, lParam);
1544 return TRACKBAR_SetTic (hwnd, wParam, lParam);
1546 case TBM_SETTICFREQ:
1547 return TRACKBAR_SetTicFreq (hwnd, wParam);
1549 case TBM_SETTIPSIDE:
1550 return TRACKBAR_SetTipSide (hwnd, wParam, lParam);
1552 case TBM_SETTOOLTIPS:
1553 return TRACKBAR_SetToolTips (hwnd, wParam, lParam);
1555 /* case TBM_SETUNICODEFORMAT: */
1558 case WM_CAPTURECHANGED:
1559 return TRACKBAR_CaptureChanged (hwnd, wParam, lParam);
1562 return TRACKBAR_Create (hwnd, wParam, lParam);
1565 return TRACKBAR_Destroy (hwnd, wParam, lParam);
1567 /* case WM_ENABLE: */
1569 /* case WM_ERASEBKGND: */
1573 return DLGC_WANTARROWS;
1576 return TRACKBAR_KeyDown (hwnd, wParam, lParam);
1579 return TRACKBAR_KeyUp (hwnd, wParam);
1582 return TRACKBAR_KillFocus (hwnd, wParam, lParam);
1584 case WM_LBUTTONDOWN:
1585 return TRACKBAR_LButtonDown (hwnd, wParam, lParam);
1588 return TRACKBAR_LButtonUp (hwnd, wParam, lParam);
1591 return TRACKBAR_MouseMove (hwnd, wParam, lParam);
1594 return TRACKBAR_Paint (hwnd, wParam);
1597 return TRACKBAR_SetFocus (hwnd, wParam, lParam);
1600 return TRACKBAR_Size (hwnd, wParam, lParam);
1602 case WM_WININICHANGE:
1603 return TRACKBAR_InitializeThumb (hwnd);
1606 if (uMsg >= WM_USER)
1607 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
1608 uMsg, wParam, lParam);
1609 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
1616 TRACKBAR_Register (void)
1620 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
1621 wndClass.style = CS_GLOBALCLASS;
1622 wndClass.lpfnWndProc = (WNDPROC)TRACKBAR_WindowProc;
1623 wndClass.cbClsExtra = 0;
1624 wndClass.cbWndExtra = sizeof(TRACKBAR_INFO *);
1625 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
1626 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
1627 wndClass.lpszClassName = TRACKBAR_CLASSA;
1629 RegisterClassA (&wndClass);
1634 TRACKBAR_Unregister (void)
1636 UnregisterClassA (TRACKBAR_CLASSA, (HINSTANCE)NULL);