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