]> git.saurik.com Git - wxWidgets.git/blame - src/msw/slider95.cpp
minor Configure / makefiles updates
[wxWidgets.git] / src / msw / slider95.cpp
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
da87a1ca
JS
2// Name: slider95.cpp
3// Purpose: wxSlider95, using the Win95 trackbar control
2bda0e17
KB
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
da87a1ca 13#pragma implementation "slider95.h"
2bda0e17
KB
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#ifndef WX_PRECOMP
24#include <stdio.h>
2bda0e17
KB
25#endif
26
da87a1ca 27#ifdef __WIN95__
2bda0e17 28
da87a1ca
JS
29#include "wx/msw/slider95.h"
30#include "wx/msw/private.h"
2bda0e17
KB
31
32#if defined(__WIN95__) && !defined(__GNUWIN32__)
33#include <commctrl.h>
34#endif
35
36#if !USE_SHARED_LIBRARY
da87a1ca 37IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl)
2bda0e17 38
da87a1ca 39BEGIN_EVENT_TABLE(wxSlider95, wxControl)
ca5e9f67 40#if WXWIN_COMPATIBILITY
da87a1ca 41 EVT_SCROLL(wxSlider95::OnScroll)
2bda0e17 42#endif
ca5e9f67 43END_EVENT_TABLE()
2bda0e17
KB
44
45#endif
46
47// Slider
da87a1ca 48wxSlider95::wxSlider95(void)
2bda0e17
KB
49{
50 m_staticValue = 0;
51 m_staticMin = 0;
52 m_staticMax = 0;
53 m_pageSize = 1;
54 m_lineSize = 1;
55 m_rangeMax = 0;
56 m_rangeMin = 0;
57 m_tickFreq = 0;
58}
59
debe6624
JS
60bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
61 int value, int minValue, int maxValue,
2bda0e17 62 const wxPoint& pos,
debe6624 63 const wxSize& size, long style,
2bda0e17
KB
64 const wxValidator& validator,
65 const wxString& name)
66{
67 SetName(name);
68 SetValidator(validator);
69
70 if (parent) parent->AddChild(this);
fd71308f
JS
71 SetBackgroundColour(parent->GetBackgroundColour()) ;
72 SetForegroundColour(parent->GetForegroundColour()) ;
2bda0e17
KB
73
74 m_staticValue = 0;
75 m_staticMin = 0;
76 m_staticMax = 0;
77 m_pageSize = 1;
78 m_lineSize = 1;
79 m_windowStyle = style;
80 m_tickFreq = 0;
81
82 if ( id == -1 )
83 m_windowId = (int)NewControlId();
84 else
85 m_windowId = id;
86
87 int x = pos.x;
88 int y = pos.y;
89 int width = size.x;
90 int height = size.y;
91
2bda0e17
KB
92 long msStyle ;
93
94 if ( m_windowStyle & wxSL_LABELS )
95 {
96 msStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTER;
97
98 bool want3D;
99 WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
100
101 m_staticValue = (WXHWND) CreateWindowEx(exStyle, "STATIC", NULL,
102 msStyle,
103 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
104 wxGetInstance(), NULL);
105
106 // Now create min static control
107 sprintf(wxBuffer, "%d", minValue);
108 m_staticMin = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer,
109 STATIC_FLAGS,
110 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
111 wxGetInstance(), NULL);
112 }
113
114 msStyle = 0;
115 if (m_windowStyle & wxSL_VERTICAL)
116 msStyle = TBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
117 else
118 msStyle = TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
119
120 if ( m_windowStyle & wxSL_AUTOTICKS )
121 msStyle |= TBS_AUTOTICKS ;
122
123 if ( m_windowStyle & wxSL_LEFT )
124 msStyle |= TBS_LEFT;
125 else if ( m_windowStyle & wxSL_RIGHT )
126 msStyle |= TBS_RIGHT;
127 else if ( m_windowStyle & wxSL_TOP )
128 msStyle |= TBS_TOP;
129 else if ( m_windowStyle & wxSL_BOTTOM )
130 msStyle |= TBS_BOTTOM;
131 else if ( m_windowStyle & wxSL_BOTH )
132 msStyle |= TBS_BOTH;
133 else if ( ! (m_windowStyle & wxSL_AUTOTICKS) )
134 msStyle |= TBS_NOTICKS;
135
136 if ( m_windowStyle & wxSL_SELRANGE )
137 msStyle |= TBS_ENABLESELRANGE ;
138
139 HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), TRACKBAR_CLASS, wxBuffer,
140 msStyle,
141 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
142 wxGetInstance(), NULL);
143
144 m_rangeMax = maxValue;
145 m_rangeMin = minValue;
146
147 m_pageSize = (int)((maxValue-minValue)/10);
148
149 ::SendMessage(scroll_bar, TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue));
150 ::SendMessage(scroll_bar, TBM_SETPOS, TRUE, (LPARAM)value);
151 ::SendMessage(scroll_bar, TBM_SETPAGESIZE, 0, (LPARAM)m_pageSize);
152
153 m_hWnd = (WXHWND)scroll_bar;
154
155 SubclassWin(GetHWND());
156
9c331ded
JS
157 SetWindowText((HWND) m_hWnd, "");
158
c0ed460c 159 SetFont(parent->GetFont());
9c331ded 160
2bda0e17
KB
161 if ( m_windowStyle & wxSL_LABELS )
162 {
163 // Finally, create max value static item
164 sprintf(wxBuffer, "%d", maxValue);
165 m_staticMax = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer,
166 STATIC_FLAGS,
167 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
168 wxGetInstance(), NULL);
169
da87a1ca 170
c0ed460c 171 if (GetFont().Ok())
2bda0e17 172 {
c0ed460c 173 if (GetFont().GetResourceHandle())
2bda0e17
KB
174 {
175 if ( m_staticMin )
176 SendMessage((HWND)m_staticMin,WM_SETFONT,
c0ed460c 177 (WPARAM)GetFont().GetResourceHandle(),0L);
2bda0e17
KB
178 if ( m_staticMax )
179 SendMessage((HWND)m_staticMax,WM_SETFONT,
c0ed460c 180 (WPARAM)GetFont().GetResourceHandle(),0L);
2bda0e17
KB
181 if (m_staticValue)
182 SendMessage((HWND)m_staticValue,WM_SETFONT,
c0ed460c 183 (WPARAM)GetFont().GetResourceHandle(),0L);
2bda0e17
KB
184 }
185 }
186 }
2bda0e17
KB
187
188 SetSize(x, y, width, height);
189 SetValue(value);
190
191 return TRUE;
192}
193
debe6624 194void wxSlider95::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
2bda0e17 195{
2bda0e17 196 int position = 0; // Dummy - not used in this mode
2bda0e17
KB
197
198 int nScrollInc;
7798a18e 199 wxEventType scrollEvent = wxEVT_NULL;
2bda0e17
KB
200 switch ( wParam )
201 {
202 case SB_TOP:
203 nScrollInc = m_rangeMax - position;
204 scrollEvent = wxEVT_SCROLL_TOP;
205 break;
206
207 case SB_BOTTOM:
208 nScrollInc = - position;
209 scrollEvent = wxEVT_SCROLL_BOTTOM;
210 break;
211
212 case SB_LINEUP:
213 nScrollInc = - GetLineSize();
214 scrollEvent = wxEVT_SCROLL_LINEUP;
215 break;
216
217 case SB_LINEDOWN:
218 nScrollInc = GetLineSize();
219 scrollEvent = wxEVT_SCROLL_LINEDOWN;
220 break;
221
222 case SB_PAGEUP:
223 nScrollInc = -GetPageSize();
224 scrollEvent = wxEVT_SCROLL_PAGEUP;
225 break;
226
227 case SB_PAGEDOWN:
228 nScrollInc = GetPageSize();
229 scrollEvent = wxEVT_SCROLL_PAGEDOWN;
230 break;
231
232 case SB_THUMBTRACK:
233 case SB_THUMBPOSITION:
234#ifdef __WIN32__
235 nScrollInc = (signed short)pos - position;
236#else
237 nScrollInc = pos - position;
238#endif
239 scrollEvent = wxEVT_SCROLL_THUMBTRACK;
240 break;
241
242 default:
243 nScrollInc = 0;
244 return;
245 }
246
2bda0e17
KB
247 {
248
2bda0e17 249 int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
2bda0e17
KB
250 if (!(newPos < GetMin() || newPos > GetMax()))
251 {
252 SetValue(newPos);
253
254 wxScrollEvent event(scrollEvent, m_windowId);
255 event.SetPosition(newPos);
256 event.SetEventObject( this );
257 GetEventHandler()->ProcessEvent(event);
258 }
259 }
260}
261
debe6624 262void wxSlider95::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
2bda0e17
KB
263{
264 MSWOnVScroll(wParam, pos, control);
265}
266
da87a1ca 267wxSlider95::~wxSlider95(void)
2bda0e17
KB
268{
269 if (m_staticMin)
270 DestroyWindow((HWND) m_staticMin);
271 if (m_staticMax)
272 DestroyWindow((HWND) m_staticMax);
273 if (m_staticValue)
274 DestroyWindow((HWND) m_staticValue);
275}
276
da87a1ca 277int wxSlider95::GetValue(void) const
2bda0e17 278{
2bda0e17 279 return ::SendMessage((HWND) GetHWND(), TBM_GETPOS, 0, 0);
2bda0e17
KB
280}
281
debe6624 282void wxSlider95::SetValue(int value)
2bda0e17 283{
2bda0e17 284 ::SendMessage((HWND) GetHWND(), TBM_SETPOS, (WPARAM)TRUE, (LPARAM)value);
2bda0e17
KB
285 if (m_staticValue)
286 {
287 sprintf(wxBuffer, "%d", value);
288 SetWindowText((HWND) m_staticValue, wxBuffer);
289 }
290}
291
da87a1ca 292void wxSlider95::GetSize(int *width, int *height) const
2bda0e17
KB
293{
294 RECT rect;
295 rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
296
297 wxFindMaxSize(GetHWND(), &rect);
298
299 if (m_staticMin)
300 wxFindMaxSize(m_staticMin, &rect);
301 if (m_staticMax)
302 wxFindMaxSize(m_staticMax, &rect);
303 if (m_staticValue)
304 wxFindMaxSize(m_staticValue, &rect);
305
306 *width = rect.right - rect.left;
307 *height = rect.bottom - rect.top;
308}
309
da87a1ca 310void wxSlider95::GetPosition(int *x, int *y) const
2bda0e17
KB
311{
312 wxWindow *parent = GetParent();
313 RECT rect;
314 rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
315
316 wxFindMaxSize(GetHWND(), &rect);
317
318 if (m_staticMin)
319 wxFindMaxSize(m_staticMin, &rect);
320 if (m_staticMax)
321 wxFindMaxSize(m_staticMax, &rect);
322 if (m_staticValue)
323 wxFindMaxSize(m_staticValue, &rect);
324
325 // Since we now have the absolute screen coords,
326 // if there's a parent we must subtract its top left corner
327 POINT point;
328 point.x = rect.left;
329 point.y = rect.top;
330 if (parent)
331 ::ScreenToClient((HWND) parent->GetHWND(), &point);
332
81d66cf3
JS
333 // We may be faking the client origin.
334 // So a window that's really at (0, 30) may appear
335 // (to wxWin apps) to be at (0, 0).
336 if (GetParent())
337 {
338 wxPoint pt(GetParent()->GetClientAreaOrigin());
339 point.x -= pt.x;
340 point.y -= pt.y;
341 }
2bda0e17
KB
342 *x = point.x;
343 *y = point.y;
344}
345
debe6624 346void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags)
2bda0e17
KB
347{
348 int x1 = x;
349 int y1 = y;
350 int w1 = width;
351 int h1 = height;
352
353 int currentX, currentY;
354 GetPosition(&currentX, &currentY);
355 if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
356 x1 = currentX;
357 if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
358 y1 = currentY;
359
81d66cf3
JS
360 AdjustForParentClientOrigin(x1, y1, sizeFlags);
361
2bda0e17
KB
362 char buf[300];
363
364 int x_offset = x;
365 int y_offset = y;
366
367 int cx; // slider,min,max sizes
368 int cy;
debe6624 369 int cyf;
2bda0e17 370
c0ed460c 371 wxGetCharSize(GetHWND(), &cx, &cy, & GetFont());
2bda0e17
KB
372
373 if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
374 {
375 if ( m_windowStyle & wxSL_LABELS )
376 {
debe6624 377 int min_len = 0;
2bda0e17
KB
378
379 GetWindowText((HWND) m_staticMin, buf, 300);
c0ed460c 380 GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & GetFont());
2bda0e17 381
debe6624 382 int max_len = 0;
2bda0e17
KB
383
384 GetWindowText((HWND) m_staticMax, buf, 300);
c0ed460c 385 GetTextExtent(buf, &max_len, &cyf,NULL,NULL, & GetFont());
2bda0e17
KB
386 if (m_staticValue)
387 {
388 int new_width = (int)(wxMax(min_len, max_len));
389 int valueHeight = (int)cyf;
390#ifdef __WIN32__
391 // For some reason, under Win95, the text edit control has
392 // a lot of space before the first character
393 new_width += 3*cx;
394#endif
2bda0e17
KB
395 // The height needs to be a bit bigger under Win95 if using native
396 // 3D effects.
397 valueHeight = (int) (valueHeight * 1.5) ;
2bda0e17
KB
398 MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
399 x_offset += new_width + cx;
400 }
401
402 MoveWindow((HWND) m_staticMin, x_offset, y_offset, (int)min_len, cy, TRUE);
403 x_offset += (int)(min_len + cx);
404
405 int slider_length = (int)(w1 - x_offset - max_len - cx);
406
2bda0e17
KB
407 int slider_height = h1;
408 if (slider_height < 0 )
409 slider_height = 20;
2bda0e17
KB
410
411 // Slider must have a minimum/default length/height
412 if (slider_length < 100)
413 slider_length = 100;
414
415 MoveWindow((HWND) GetHWND(), x_offset, y_offset, slider_length, slider_height, TRUE);
416 x_offset += slider_length + cx;
417
418 MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
419 }
420 else
421 {
422 // No labels
9c331ded
JS
423 // If we're prepared to use the existing size, then...
424 if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
425 {
426 GetSize(&w1, &h1);
427 }
2bda0e17
KB
428 if ( w1 < 0 )
429 w1 = 200;
430 if ( h1 < 0 )
431 h1 = 20;
432 MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
433 }
434 }
435 else
436 {
437 if ( m_windowStyle & wxSL_LABELS )
438 {
debe6624 439 int min_len;
2bda0e17 440 GetWindowText((HWND) m_staticMin, buf, 300);
c0ed460c 441 GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & GetFont());
2bda0e17 442
debe6624 443 int max_len;
2bda0e17 444 GetWindowText((HWND) m_staticMax, buf, 300);
c0ed460c 445 GetTextExtent(buf, &max_len, &cyf,NULL,NULL, & GetFont());
2bda0e17
KB
446
447 if (m_staticValue)
448 {
449 int new_width = (int)(wxMax(min_len, max_len));
450 int valueHeight = (int)cyf;
451/*** Suggested change by George Tasker - remove this block...
452#ifdef __WIN32__
453 // For some reason, under Win95, the text edit control has
454 // a lot of space before the first character
455 new_width += 3*cx;
456#endif
457 ... and replace with following line: */
458 new_width += cx;
459
2bda0e17
KB
460 // The height needs to be a bit bigger under Win95 if using native
461 // 3D effects.
462 valueHeight = (int) (valueHeight * 1.5) ;
2bda0e17
KB
463
464 MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
465 y_offset += valueHeight;
466 }
467
468 MoveWindow((HWND) m_staticMin, x_offset, y_offset, (int)min_len, cy, TRUE);
469 y_offset += cy;
470
471 int slider_length = (int)(h1 - y_offset - cy - cy);
da87a1ca 472
2bda0e17
KB
473 int slider_width = w1;
474 if (slider_width < 0 )
475 slider_width = 20;
2bda0e17
KB
476
477 // Slider must have a minimum/default length
478 if (slider_length < 100)
479 slider_length = 100;
480
481 MoveWindow((HWND) GetHWND(), x_offset, y_offset, slider_width, slider_length, TRUE);
482 y_offset += slider_length;
483
484 MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
485 }
486 else
487 {
488 // No labels
9c331ded
JS
489 // If we're prepared to use the existing size, then...
490 if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
491 {
492 GetSize(&w1, &h1);
493 }
2bda0e17
KB
494 if ( w1 < 0 )
495 w1 = 20;
496 if ( h1 < 0 )
497 h1 = 200;
498 MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
499 }
500 }
2bda0e17
KB
501}
502
debe6624 503void wxSlider95::SetRange(int minValue, int maxValue)
2bda0e17
KB
504{
505 m_rangeMin = minValue;
506 m_rangeMax = maxValue;
507
2bda0e17 508 ::SendMessage((HWND) GetHWND(), TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue));
da87a1ca 509
2bda0e17
KB
510 char buf[40];
511 if ( m_staticMin )
512 {
513 sprintf(buf, "%d", m_rangeMin);
514 SetWindowText((HWND) m_staticMin, buf);
515 }
516
517 if ( m_staticMax )
518 {
519 sprintf(buf, "%d", m_rangeMax);
520 SetWindowText((HWND) m_staticMax, buf);
521 }
522}
523
debe6624 524WXHBRUSH wxSlider95::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
2bda0e17
KB
525 WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
526{
527 if ( nCtlColor == CTLCOLOR_SCROLLBAR )
528 return 0;
529
530 // Otherwise, it's a static
531 if (GetParent()->GetTransparentBackground())
532 SetBkMode((HDC) pDC, TRANSPARENT);
533 else
534 SetBkMode((HDC) pDC, OPAQUE);
535
536 ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
537 ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
538
539 wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
2bda0e17
KB
540 return (WXHBRUSH) backgroundBrush->GetResourceHandle();
541}
542
543// For trackbars only
debe6624 544void wxSlider95::SetTickFreq(int n, int pos)
2bda0e17 545{
2bda0e17
KB
546 m_tickFreq = n;
547 ::SendMessage( (HWND) GetHWND(), TBM_SETTICFREQ, (WPARAM) n, (LPARAM) pos );
2bda0e17
KB
548}
549
debe6624 550void wxSlider95::SetPageSize(int pageSize)
2bda0e17 551{
2bda0e17 552 ::SendMessage( (HWND) GetHWND(), TBM_SETPAGESIZE, (WPARAM) 0, (LPARAM) pageSize );
2bda0e17
KB
553 m_pageSize = pageSize;
554}
555
da87a1ca 556int wxSlider95::GetPageSize(void) const
2bda0e17
KB
557{
558 return m_pageSize;
559}
560
da87a1ca 561void wxSlider95::ClearSel(void)
2bda0e17 562{
2bda0e17 563 ::SendMessage( (HWND) GetHWND(), TBM_CLEARSEL, (WPARAM) TRUE, (LPARAM) 0 );
2bda0e17
KB
564}
565
da87a1ca 566void wxSlider95::ClearTicks(void)
2bda0e17 567{
2bda0e17 568 ::SendMessage( (HWND) GetHWND(), TBM_CLEARTICS, (WPARAM) TRUE, (LPARAM) 0 );
2bda0e17
KB
569}
570
debe6624 571void wxSlider95::SetLineSize(int lineSize)
2bda0e17
KB
572{
573 m_lineSize = lineSize;
2bda0e17 574 ::SendMessage( (HWND) GetHWND(), TBM_SETLINESIZE, (WPARAM) 0, (LPARAM) lineSize );
2bda0e17
KB
575}
576
da87a1ca 577int wxSlider95::GetLineSize(void) const
2bda0e17 578{
2bda0e17 579 return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETLINESIZE, (WPARAM) 0, (LPARAM) 0 );
2bda0e17
KB
580}
581
da87a1ca 582int wxSlider95::GetSelEnd(void) const
2bda0e17 583{
2bda0e17 584 return (int) ::SendMessage( (HWND) GetHWND(), TBM_SETSELEND, (WPARAM) 0, (LPARAM) 0 );
2bda0e17
KB
585}
586
da87a1ca 587int wxSlider95::GetSelStart(void) const
2bda0e17 588{
2bda0e17 589 return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETSELSTART, (WPARAM) 0, (LPARAM) 0 );
2bda0e17
KB
590}
591
debe6624 592void wxSlider95::SetSelection(int minPos, int maxPos)
2bda0e17 593{
2bda0e17 594 ::SendMessage( (HWND) GetHWND(), TBM_SETSEL, (WPARAM) TRUE, (LPARAM) MAKELONG( minPos, maxPos) );
2bda0e17
KB
595}
596
debe6624 597void wxSlider95::SetThumbLength(int len)
2bda0e17 598{
2bda0e17 599 ::SendMessage( (HWND) GetHWND(), TBM_SETTHUMBLENGTH, (WPARAM) len, (LPARAM) 0 );
2bda0e17
KB
600}
601
da87a1ca 602int wxSlider95::GetThumbLength(void) const
2bda0e17 603{
2bda0e17 604 return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETTHUMBLENGTH, (WPARAM) 0, (LPARAM) 0 );
2bda0e17
KB
605}
606
debe6624 607void wxSlider95::SetTick(int tickPos)
2bda0e17 608{
2bda0e17 609 ::SendMessage( (HWND) GetHWND(), TBM_SETTIC, (WPARAM) 0, (LPARAM) tickPos );
2bda0e17
KB
610}
611
da87a1ca 612bool wxSlider95::ContainsHWND(WXHWND hWnd) const
2bda0e17
KB
613{
614 return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
615}
616
617#if WXWIN_COMPATIBILITY
618// Backward compatibility
da87a1ca 619void wxSlider95::OnScroll(wxScrollEvent& event)
2bda0e17 620{
7798a18e 621 wxEventType oldEvent = event.GetEventType();
2bda0e17
KB
622 event.SetEventType( wxEVT_COMMAND_SLIDER_UPDATED );
623 if ( !GetEventHandler()->ProcessEvent(event) )
624 {
625 event.SetEventType( oldEvent );
626 if (!GetParent()->GetEventHandler()->ProcessEvent(event))
627 event.Skip();
628 }
629}
630#endif
631
da87a1ca 632void wxSlider95::Command (wxCommandEvent & event)
2bda0e17
KB
633{
634 SetValue (event.GetInt());
635 ProcessCommand (event);
636}
637
debe6624 638bool wxSlider95::Show(bool show)
2bda0e17
KB
639{
640 wxWindow::Show(show);
641
642 int cshow;
643 if (show)
644 cshow = SW_SHOW;
645 else
646 cshow = SW_HIDE;
647
648 if(m_staticValue)
649 ShowWindow((HWND) m_staticValue, (BOOL)cshow);
650 if(m_staticMin)
651 ShowWindow((HWND) m_staticMin, (BOOL)cshow);
652 if(m_staticMax)
653 ShowWindow((HWND) m_staticMax, (BOOL)cshow);
654 return TRUE;
655}
656
da87a1ca
JS
657#endif
658 // __WIN95__
2bda0e17 659