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