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