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