]> git.saurik.com Git - wxWidgets.git/blame - src/msw/slider95.cpp
fix compilation - Stefan see my last commit bundle :)
[wxWidgets.git] / src / msw / slider95.cpp
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
6181cef5 2// Name: msw/slider95.cpp
da87a1ca 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$
6181cef5
VZ
8// Copyright: (c) Julian Smart 1998
9// Vadim Zeitlin 2004
65571936 10// Licence: wxWindows licence
2bda0e17
KB
11/////////////////////////////////////////////////////////////////////////////
12
6181cef5
VZ
13// ============================================================================
14// declarations
15// ============================================================================
16
14f355c2 17#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
da87a1ca 18#pragma implementation "slider95.h"
2bda0e17
KB
19#endif
20
6181cef5
VZ
21// ----------------------------------------------------------------------------
22// headers
23// ----------------------------------------------------------------------------
24
2bda0e17
KB
25// For compilers that support precompilation, includes "wx.h".
26#include "wx/wxprec.h"
27
28#ifdef __BORLANDC__
6181cef5 29 #pragma hdrstop
2bda0e17
KB
30#endif
31
1e6feb95
VZ
32#if wxUSE_SLIDER
33
2bda0e17 34#ifndef WX_PRECOMP
6181cef5 35 #include "wx/brush.h"
2bda0e17
KB
36#endif
37
6181cef5
VZ
38#include "wx/slider.h"
39#include "wx/msw/subwin.h"
2bda0e17 40
6181cef5 41#if !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__))
c42404a5 42 #include <commctrl.h>
2bda0e17
KB
43#endif
44
6181cef5
VZ
45// ----------------------------------------------------------------------------
46// constants
47// ----------------------------------------------------------------------------
48
49// indices of labels in wxSlider95::m_labels
50enum
51{
52 SliderLabel_Min,
53 SliderLabel_Max,
54 SliderLabel_Value,
55 SliderLabel_Last
56};
57
58// the gap between the slider and the labels, in pixels
59static const int HGAP = 5;
60
61// ----------------------------------------------------------------------------
62// XTI
63// ----------------------------------------------------------------------------
64
f0a126fe 65#if wxUSE_EXTENDED_RTTI
bc9fb572
JS
66WX_DEFINE_FLAGS( wxSliderStyle )
67
3ff066a4 68wxBEGIN_FLAGS( wxSliderStyle )
bc9fb572
JS
69 // new style border flags, we put them first to
70 // use them for streaming out
3ff066a4
SC
71 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
72 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
73 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
74 wxFLAGS_MEMBER(wxBORDER_RAISED)
75 wxFLAGS_MEMBER(wxBORDER_STATIC)
76 wxFLAGS_MEMBER(wxBORDER_NONE)
57f4f925 77
bc9fb572 78 // old style border flags
3ff066a4
SC
79 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
80 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
81 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
82 wxFLAGS_MEMBER(wxRAISED_BORDER)
83 wxFLAGS_MEMBER(wxSTATIC_BORDER)
cb0afb26 84 wxFLAGS_MEMBER(wxBORDER)
bc9fb572
JS
85
86 // standard window styles
3ff066a4
SC
87 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
88 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
89 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
90 wxFLAGS_MEMBER(wxWANTS_CHARS)
cb0afb26 91 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
3ff066a4
SC
92 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
93 wxFLAGS_MEMBER(wxVSCROLL)
94 wxFLAGS_MEMBER(wxHSCROLL)
95
96 wxFLAGS_MEMBER(wxSL_HORIZONTAL)
97 wxFLAGS_MEMBER(wxSL_VERTICAL)
98 wxFLAGS_MEMBER(wxSL_AUTOTICKS)
99 wxFLAGS_MEMBER(wxSL_LABELS)
100 wxFLAGS_MEMBER(wxSL_LEFT)
101 wxFLAGS_MEMBER(wxSL_TOP)
102 wxFLAGS_MEMBER(wxSL_RIGHT)
103 wxFLAGS_MEMBER(wxSL_BOTTOM)
104 wxFLAGS_MEMBER(wxSL_BOTH)
105 wxFLAGS_MEMBER(wxSL_SELRANGE)
6bee5ffb 106 wxFLAGS_MEMBER(wxSL_INVERSE)
3ff066a4
SC
107
108wxEND_FLAGS( wxSliderStyle )
bc9fb572 109
f0a126fe
SC
110IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider95, wxControl,"wx/scrolbar.h")
111
3ff066a4
SC
112wxBEGIN_PROPERTIES_TABLE(wxSlider95)
113 wxEVENT_RANGE_PROPERTY( Scroll , wxEVT_SCROLL_TOP , wxEVT_SCROLL_ENDSCROLL , wxScrollEvent )
114 wxEVENT_PROPERTY( Updated , wxEVT_COMMAND_SLIDER_UPDATED , wxCommandEvent )
c5ca409b 115
3ff066a4 116 wxPROPERTY( Value , int , SetValue, GetValue , 0, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
822e690b
WS
117 wxPROPERTY( Minimum , int , SetMin, GetMin, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
118 wxPROPERTY( Maximum , int , SetMax, GetMax, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
119 wxPROPERTY( PageSize , int , SetPageSize, GetLineSize, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
120 wxPROPERTY( LineSize , int , SetLineSize, GetLineSize, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
121 wxPROPERTY( ThumbLength , int , SetThumbLength, GetThumbLength, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
af498247 122 wxPROPERTY_FLAGS( WindowStyle , wxSliderStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
3ff066a4 123wxEND_PROPERTIES_TABLE()
f0a126fe 124
3ff066a4
SC
125wxBEGIN_HANDLERS_TABLE(wxSlider95)
126wxEND_HANDLERS_TABLE()
f0a126fe 127
3ff066a4 128wxCONSTRUCTOR_8( wxSlider95 , wxWindow* , Parent , wxWindowID , Id , int , Value , int , Minimum , int , Maximum , wxPoint , Position , wxSize , Size , long , WindowStyle )
f0a126fe 129#else
bf532053 130IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl)
f0a126fe 131#endif
2bda0e17 132
6181cef5
VZ
133// ============================================================================
134// wxSlider95 implementation
135// ============================================================================
136
137// ----------------------------------------------------------------------------
138// construction
139// ----------------------------------------------------------------------------
140
141void wxSlider95::Init()
2bda0e17 142{
6181cef5
VZ
143 m_labels = NULL;
144
5f605ccf
VZ
145 m_pageSize = 1;
146 m_lineSize = 1;
147 m_rangeMax = 0;
148 m_rangeMin = 0;
149 m_tickFreq = 0;
2bda0e17
KB
150}
151
6181cef5
VZ
152bool
153wxSlider95::Create(wxWindow *parent,
154 wxWindowID id,
155 int value,
156 int minValue,
157 int maxValue,
158 const wxPoint& pos,
159 const wxSize& size,
160 long style,
161 const wxValidator& validator,
162 const wxString& name)
2bda0e17 163{
6181cef5
VZ
164 // initialize everything
165 if ( !CreateControl(parent, id, pos, size, style, validator, name) )
822e690b 166 return false;
2bda0e17 167
6181cef5
VZ
168 // ensure that we have correct values for GetLabelsSize()
169 m_rangeMin = minValue;
170 m_rangeMax = maxValue;
5f605ccf 171
6181cef5
VZ
172 // create the labels first, so that our DoGetBestSize() could take them
173 // into account
174 //
175 // note that we could simply create 3 wxStaticTexts here but it could
176 // result in some observable side effects at wx level (e.g. the parent of
177 // wxSlider would have 3 more children than expected) and so we prefer not
178 // to do it like this
5f605ccf
VZ
179 if ( m_windowStyle & wxSL_LABELS )
180 {
6181cef5
VZ
181 m_labels = new wxSubwindows(SliderLabel_Last);
182
183 HWND hwndParent = GetHwndOf(parent);
184 for ( size_t n = 0; n < SliderLabel_Last; n++ )
185 {
186 (*m_labels)[n] = ::CreateWindow
187 (
188 wxT("STATIC"),
189 NULL,
190 WS_CHILD | WS_VISIBLE | SS_CENTER,
191 0, 0, 0, 0,
192 hwndParent,
193 (HMENU)NewControlId(),
194 wxGetInstance(),
195 NULL
196 );
197 }
198
199 m_labels->SetFont(GetFont());
5f605ccf
VZ
200 }
201
6181cef5
VZ
202 // now create the main control too
203 if ( !MSWCreateControl(TRACKBAR_CLASS, wxEmptyString, pos, size) )
204 return false;
5f605ccf 205
6181cef5
VZ
206 // and initialize everything
207 SetRange(minValue, maxValue);
208 SetValue(value);
209 SetPageSize((maxValue - minValue)/10);
822e690b 210
8a8dcc34
VZ
211 // we need to position the labels correctly if we have them and if
212 // SetSize() hadn't been called before (when best size was determined by
213 // MSWCreateControl()) as in this case they haven't been put in place yet
214 if ( m_labels && size.x != wxDefaultCoord && size.y != wxDefaultCoord )
215 {
216 SetSize(size);
217 }
218
6181cef5
VZ
219 return true;
220}
2bda0e17 221
6181cef5
VZ
222WXDWORD wxSlider95::MSWGetStyle(long style, WXDWORD *exstyle) const
223{
224 WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
b0766406 225
6181cef5
VZ
226 // TBS_HORZ is 0 anyhow, but do mention it explicitly for clarity
227 msStyle |= style & wxSL_VERTICAL ? TBS_VERT : TBS_HORZ;
228
229 if ( style & wxSL_AUTOTICKS )
5f605ccf 230 msStyle |= TBS_AUTOTICKS ;
b0766406 231
6181cef5
VZ
232 // again, TBS_RIGHT is 0 but do include it for clarity
233 if ( style & wxSL_LEFT )
5f605ccf 234 msStyle |= TBS_LEFT;
6181cef5 235 else if ( style & wxSL_RIGHT )
5f605ccf 236 msStyle |= TBS_RIGHT;
6181cef5 237 else if ( style & wxSL_TOP )
5f605ccf 238 msStyle |= TBS_TOP;
6181cef5 239 else if ( style & wxSL_BOTTOM )
5f605ccf 240 msStyle |= TBS_BOTTOM;
6181cef5 241 else if ( style & wxSL_BOTH )
5f605ccf 242 msStyle |= TBS_BOTH;
6181cef5 243 else if ( !(style & wxSL_AUTOTICKS) )
5f605ccf 244 msStyle |= TBS_NOTICKS;
2bda0e17 245
6181cef5 246 if ( style & wxSL_SELRANGE )
5f605ccf 247 msStyle |= TBS_ENABLESELRANGE;
2bda0e17 248
6181cef5
VZ
249 return msStyle;
250}
7a5a5718 251
6181cef5
VZ
252wxSlider95::~wxSlider95()
253{
254 delete m_labels;
2bda0e17
KB
255}
256
6181cef5
VZ
257// ----------------------------------------------------------------------------
258// event handling
259// ----------------------------------------------------------------------------
260
261bool wxSlider95::MSWOnScroll(int WXUNUSED(orientation),
262 WXWORD wParam,
263 WXWORD WXUNUSED(pos),
264 WXHWND control)
2bda0e17 265{
1e6feb95 266 wxEventType scrollEvent;
2bda0e17
KB
267 switch ( wParam )
268 {
a23fd0e1 269 case SB_TOP:
a23fd0e1
VZ
270 scrollEvent = wxEVT_SCROLL_TOP;
271 break;
272
273 case SB_BOTTOM:
a23fd0e1
VZ
274 scrollEvent = wxEVT_SCROLL_BOTTOM;
275 break;
276
277 case SB_LINEUP:
a23fd0e1
VZ
278 scrollEvent = wxEVT_SCROLL_LINEUP;
279 break;
280
281 case SB_LINEDOWN:
a23fd0e1
VZ
282 scrollEvent = wxEVT_SCROLL_LINEDOWN;
283 break;
284
285 case SB_PAGEUP:
a23fd0e1
VZ
286 scrollEvent = wxEVT_SCROLL_PAGEUP;
287 break;
288
289 case SB_PAGEDOWN:
a23fd0e1
VZ
290 scrollEvent = wxEVT_SCROLL_PAGEDOWN;
291 break;
292
293 case SB_THUMBTRACK:
a23fd0e1
VZ
294 scrollEvent = wxEVT_SCROLL_THUMBTRACK;
295 break;
296
e8b669d3
VZ
297 case SB_THUMBPOSITION:
298 scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
299 break;
300
301 case SB_ENDSCROLL:
302 scrollEvent = wxEVT_SCROLL_ENDSCROLL;
303 break;
304
a23fd0e1 305 default:
1e6feb95 306 // unknown scroll event?
822e690b 307 return false;
2bda0e17
KB
308 }
309
01526d4f 310 int newPos = ValueInvertOrNot((int) ::SendMessage((HWND) control, TBM_GETPOS, 0, 0));
a23fd0e1 311 if ( (newPos < GetMin()) || (newPos > GetMax()) )
2bda0e17 312 {
a23fd0e1 313 // out of range - but we did process it
822e690b 314 return true;
a23fd0e1 315 }
2bda0e17 316
a23fd0e1 317 SetValue(newPos);
2bda0e17 318
a23fd0e1
VZ
319 wxScrollEvent event(scrollEvent, m_windowId);
320 event.SetPosition(newPos);
321 event.SetEventObject( this );
322 GetEventHandler()->ProcessEvent(event);
f3a65071 323
a23fd0e1 324 wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
f6bcfd97 325 cevent.SetInt( newPos );
a23fd0e1 326 cevent.SetEventObject( this );
f3a65071 327
a23fd0e1 328 return GetEventHandler()->ProcessEvent( cevent );
2bda0e17
KB
329}
330
6181cef5 331void wxSlider95::Command (wxCommandEvent & event)
2bda0e17 332{
6181cef5
VZ
333 SetValue (event.GetInt());
334 ProcessCommand (event);
2bda0e17
KB
335}
336
6181cef5
VZ
337// ----------------------------------------------------------------------------
338// geometry stuff
339// ----------------------------------------------------------------------------
2bda0e17 340
6181cef5 341wxRect wxSlider95::GetBoundingBox() const
2bda0e17 342{
6181cef5
VZ
343 // take care not to call our own functions which would call us recursively
344 int x, y, w, h;
345 wxSliderBase::DoGetPosition(&x, &y);
346 wxSliderBase::DoGetSize(&w, &h);
5f605ccf 347
6181cef5
VZ
348 wxRect rect(x, y, w, h);
349 if ( m_labels )
b5c45059
RD
350 {
351 wxRect lrect = m_labels->GetBoundingBox();
352 GetParent()->ScreenToClient(&lrect.x, &lrect.y);
353 rect.Union(lrect);
354 }
6181cef5
VZ
355
356 return rect;
5f605ccf
VZ
357}
358
359void wxSlider95::DoGetSize(int *width, int *height) const
2bda0e17 360{
6181cef5 361 wxRect rect = GetBoundingBox();
5f605ccf 362
6819fb9b 363 if ( width )
6181cef5 364 *width = rect.width;
6819fb9b 365 if ( height )
6181cef5 366 *height = rect.height;
2bda0e17
KB
367}
368
6181cef5 369void wxSlider95::DoGetPosition(int *x, int *y) const
2bda0e17 370{
6181cef5 371 wxRect rect = GetBoundingBox();
5f605ccf 372
6181cef5
VZ
373 if ( x )
374 *x = rect.x;
375 if ( y )
376 *y = rect.y;
377}
5f605ccf 378
6181cef5
VZ
379int wxSlider95::GetLabelsSize(int *width) const
380{
381 int cy;
5f605ccf 382
6181cef5
VZ
383 if ( width )
384 {
385 // find the max label width
386 int wLabelMin, wLabelMax;
387 GetTextExtent(Format(m_rangeMin), &wLabelMin, &cy);
388 GetTextExtent(Format(m_rangeMax), &wLabelMax, &cy);
5f605ccf 389
6181cef5
VZ
390 *width = wxMax(wLabelMin, wLabelMax);
391 }
392 else
5f605ccf 393 {
6181cef5 394 cy = GetCharHeight();
5f605ccf
VZ
395 }
396
6181cef5 397 return EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
2bda0e17
KB
398}
399
6181cef5 400void wxSlider95::DoMoveWindow(int x, int y, int width, int height)
2bda0e17 401{
6181cef5
VZ
402 // all complications below are because we need to position the labels,
403 // without them everything is easy
404 if ( !m_labels )
405 {
406 wxSliderBase::DoMoveWindow(x, y, width, height);
407 return;
408 }
2bda0e17 409
8a8dcc34
VZ
410 // be careful to position the slider itself after moving the labels as
411 // otherwise our GetBoundingBox(), which is called from WM_SIZE handler,
412 // would return a wrong result and wrong size would be cached internally
6181cef5
VZ
413 if ( HasFlag(wxSL_VERTICAL) )
414 {
415 int wLabel;
416 int hLabel = GetLabelsSize(&wLabel);
81d66cf3 417
6181cef5 418 int xLabel = HasFlag(wxSL_LEFT) ? x + width - wLabel : x;
2bda0e17 419
6181cef5
VZ
420 // position all labels: min at the top, value in the middle and max at
421 // the bottom
422 ::MoveWindow((*m_labels)[SliderLabel_Min],
423 xLabel, y, wLabel, hLabel, TRUE);
2bda0e17 424
6181cef5
VZ
425 ::MoveWindow((*m_labels)[SliderLabel_Value],
426 xLabel, y + (height - hLabel)/2, wLabel, hLabel, TRUE);
2bda0e17 427
6181cef5
VZ
428 ::MoveWindow((*m_labels)[SliderLabel_Max],
429 xLabel, y + height - hLabel, wLabel, hLabel, TRUE);
8a8dcc34
VZ
430
431 // position the slider itself along the left/right edge
432 ::MoveWindow(GetHwnd(),
433 HasFlag(wxSL_LEFT) ? x : x + wLabel + HGAP,
434 y + hLabel/2,
435 width - wLabel - HGAP,
436 height - hLabel,
437 TRUE);
a23fd0e1 438 }
6181cef5 439 else // horizontal
2bda0e17 440 {
6181cef5
VZ
441 int wLabel;
442 int hLabel = GetLabelsSize(&wLabel);
443
444 int yLabel = HasFlag(wxSL_TOP) ? y + height - hLabel : y;
445
6181cef5
VZ
446 // position all labels: min on the left, value in the middle and max to
447 // the right
448 ::MoveWindow((*m_labels)[SliderLabel_Min],
449 x, yLabel, wLabel, hLabel, TRUE);
450
451 ::MoveWindow((*m_labels)[SliderLabel_Value],
452 x + (width - wLabel)/2, yLabel, wLabel, hLabel, TRUE);
453
454 ::MoveWindow((*m_labels)[SliderLabel_Max],
455 x + width - wLabel, yLabel, wLabel, hLabel, TRUE);
8a8dcc34
VZ
456
457 // position the slider itself along the top/bottom edge
458 ::MoveWindow(GetHwnd(),
459 x,
460 HasFlag(wxSL_TOP) ? y : y + hLabel,
461 width,
462 height - hLabel,
463 TRUE);
a23fd0e1 464 }
2bda0e17
KB
465}
466
7bdfb981
RD
467wxSize wxSlider95::DoGetBestSize() const
468{
6181cef5
VZ
469 // these values are arbitrary
470 static const int length = 100;
471 static const int thickness = 26;
57f4f925 472
6181cef5
VZ
473 wxSize size;
474 if ( HasFlag(wxSL_VERTICAL) )
7bdfb981 475 {
6181cef5
VZ
476 size.x = thickness;
477 size.y = length;
57f4f925 478
6181cef5 479 if ( m_labels )
7bdfb981 480 {
6181cef5
VZ
481 int wLabel;
482 int hLabel = GetLabelsSize(&wLabel);
7bdfb981 483
6181cef5
VZ
484 // account for the labels
485 size.x += HGAP + wLabel;
486
487 // labels are indented relative to the slider itself
488 size.y += hLabel;
7bdfb981
RD
489 }
490 }
6181cef5 491 else // horizontal
7bdfb981 492 {
6181cef5
VZ
493 size.x = length;
494 size.y = thickness;
7bdfb981 495
6181cef5 496 if ( m_labels )
7bdfb981 497 {
6181cef5
VZ
498 // labels add extra height
499 size.y += GetLabelsSize();
7bdfb981
RD
500 }
501 }
6181cef5
VZ
502
503 return size;
7bdfb981
RD
504}
505
6181cef5
VZ
506// ----------------------------------------------------------------------------
507// slider-specific methods
508// ----------------------------------------------------------------------------
509
510int wxSlider95::GetValue() const
511{
01526d4f 512 return ValueInvertOrNot(::SendMessage(GetHwnd(), TBM_GETPOS, 0, 0));
6181cef5
VZ
513}
514
515void wxSlider95::SetValue(int value)
516{
01526d4f 517 ::SendMessage(GetHwnd(), TBM_SETPOS, (WPARAM)TRUE, (LPARAM)ValueInvertOrNot(value));
6181cef5
VZ
518
519 if ( m_labels )
520 {
521 ::SetWindowText((*m_labels)[SliderLabel_Value], Format(value));
522 }
523}
7bdfb981 524
debe6624 525void wxSlider95::SetRange(int minValue, int maxValue)
2bda0e17 526{
5f605ccf
VZ
527 m_rangeMin = minValue;
528 m_rangeMax = maxValue;
529
530 ::SendMessage(GetHwnd(), TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue));
531
6181cef5 532 if ( m_labels )
5f605ccf 533 {
01526d4f
WS
534 ::SetWindowText((*m_labels)[SliderLabel_Min], Format(ValueInvertOrNot(m_rangeMin)));
535 ::SetWindowText((*m_labels)[SliderLabel_Max], Format(ValueInvertOrNot(m_rangeMax)));
5f605ccf 536 }
2bda0e17
KB
537}
538
debe6624 539void wxSlider95::SetTickFreq(int n, int pos)
2bda0e17 540{
6181cef5
VZ
541 m_tickFreq = n;
542 ::SendMessage( GetHwnd(), TBM_SETTICFREQ, (WPARAM) n, (LPARAM) pos );
2bda0e17
KB
543}
544
debe6624 545void wxSlider95::SetPageSize(int pageSize)
2bda0e17 546{
6181cef5
VZ
547 ::SendMessage( GetHwnd(), TBM_SETPAGESIZE, (WPARAM) 0, (LPARAM) pageSize );
548 m_pageSize = pageSize;
2bda0e17
KB
549}
550
bfc6fde4 551int wxSlider95::GetPageSize() const
2bda0e17 552{
6181cef5 553 return m_pageSize;
2bda0e17
KB
554}
555
bfc6fde4 556void wxSlider95::ClearSel()
2bda0e17 557{
6181cef5 558 ::SendMessage(GetHwnd(), TBM_CLEARSEL, (WPARAM) TRUE, (LPARAM) 0);
2bda0e17
KB
559}
560
bfc6fde4 561void wxSlider95::ClearTicks()
2bda0e17 562{
6181cef5 563 ::SendMessage(GetHwnd(), TBM_CLEARTICS, (WPARAM) TRUE, (LPARAM) 0);
2bda0e17
KB
564}
565
debe6624 566void wxSlider95::SetLineSize(int lineSize)
2bda0e17 567{
5f605ccf 568 m_lineSize = lineSize;
6181cef5 569 ::SendMessage(GetHwnd(), TBM_SETLINESIZE, (WPARAM) 0, (LPARAM) lineSize);
2bda0e17
KB
570}
571
bfc6fde4 572int wxSlider95::GetLineSize() const
2bda0e17 573{
6181cef5 574 return (int)::SendMessage(GetHwnd(), TBM_GETLINESIZE, 0, 0);
2bda0e17
KB
575}
576
bfc6fde4 577int wxSlider95::GetSelEnd() const
2bda0e17 578{
6181cef5 579 return (int)::SendMessage(GetHwnd(), TBM_SETSELEND, 0, 0);
2bda0e17
KB
580}
581
bfc6fde4 582int wxSlider95::GetSelStart() const
2bda0e17 583{
6181cef5 584 return (int)::SendMessage(GetHwnd(), TBM_GETSELSTART, 0, 0);
2bda0e17
KB
585}
586
debe6624 587void wxSlider95::SetSelection(int minPos, int maxPos)
2bda0e17 588{
5f605ccf 589 ::SendMessage(GetHwnd(), TBM_SETSEL,
6181cef5
VZ
590 (WPARAM) TRUE /* redraw */,
591 (LPARAM) MAKELONG( minPos, maxPos) );
2bda0e17
KB
592}
593
debe6624 594void wxSlider95::SetThumbLength(int len)
2bda0e17 595{
6181cef5 596 ::SendMessage(GetHwnd(), TBM_SETTHUMBLENGTH, (WPARAM) len, (LPARAM) 0);
2bda0e17
KB
597}
598
bfc6fde4 599int wxSlider95::GetThumbLength() const
2bda0e17 600{
6bee5ffb 601 return (int)::SendMessage( GetHwnd(), TBM_GETTHUMBLENGTH, 0, 0);
2bda0e17
KB
602}
603
debe6624 604void wxSlider95::SetTick(int tickPos)
2bda0e17 605{
6bee5ffb 606 ::SendMessage( GetHwnd(), TBM_SETTIC, (WPARAM) 0, (LPARAM) tickPos );
2bda0e17
KB
607}
608
6181cef5
VZ
609// ----------------------------------------------------------------------------
610// composite control methods
611// ----------------------------------------------------------------------------
612
613WXHWND wxSlider95::GetStaticMin() const
2bda0e17 614{
6181cef5 615 return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Min] : NULL;
2bda0e17
KB
616}
617
6181cef5 618WXHWND wxSlider95::GetStaticMax() const
2bda0e17 619{
6181cef5 620 return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Max] : NULL;
2bda0e17
KB
621}
622
6181cef5 623WXHWND wxSlider95::GetEditValue() const
2bda0e17 624{
6181cef5
VZ
625 return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Value] : NULL;
626}
2bda0e17 627
5b870dc0 628WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxSlider95, wxSliderBase, m_labels)
8a8dcc34 629
1e6feb95 630#endif // wxUSE_SLIDER