1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSlider95, using the Win95 trackbar control
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "slider95.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
28 #include "wx/slider.h"
33 #include "wx/msw/slider95.h"
34 #include "wx/msw/private.h"
36 #if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__))
40 #if wxUSE_EXTENDED_RTTI
41 WX_DEFINE_FLAGS( wxSliderStyle
)
43 wxBEGIN_FLAGS( wxSliderStyle
)
44 // new style border flags, we put them first to
45 // use them for streaming out
46 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
47 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
48 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
49 wxFLAGS_MEMBER(wxBORDER_RAISED
)
50 wxFLAGS_MEMBER(wxBORDER_STATIC
)
51 wxFLAGS_MEMBER(wxBORDER_NONE
)
53 // old style border flags
54 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
55 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
56 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
57 wxFLAGS_MEMBER(wxRAISED_BORDER
)
58 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
59 wxFLAGS_MEMBER(wxBORDER
)
61 // standard window styles
62 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
63 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
64 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
65 wxFLAGS_MEMBER(wxWANTS_CHARS
)
66 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
67 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
68 wxFLAGS_MEMBER(wxVSCROLL
)
69 wxFLAGS_MEMBER(wxHSCROLL
)
71 wxFLAGS_MEMBER(wxSL_HORIZONTAL
)
72 wxFLAGS_MEMBER(wxSL_VERTICAL
)
73 wxFLAGS_MEMBER(wxSL_AUTOTICKS
)
74 wxFLAGS_MEMBER(wxSL_LABELS
)
75 wxFLAGS_MEMBER(wxSL_LEFT
)
76 wxFLAGS_MEMBER(wxSL_TOP
)
77 wxFLAGS_MEMBER(wxSL_RIGHT
)
78 wxFLAGS_MEMBER(wxSL_BOTTOM
)
79 wxFLAGS_MEMBER(wxSL_BOTH
)
80 wxFLAGS_MEMBER(wxSL_SELRANGE
)
82 wxEND_FLAGS( wxSliderStyle
)
84 IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider95
, wxControl
,"wx/scrolbar.h")
86 wxBEGIN_PROPERTIES_TABLE(wxSlider95
)
87 wxEVENT_RANGE_PROPERTY( Scroll
, wxEVT_SCROLL_TOP
, wxEVT_SCROLL_ENDSCROLL
, wxScrollEvent
)
88 wxEVENT_PROPERTY( Updated
, wxEVT_COMMAND_SLIDER_UPDATED
, wxCommandEvent
)
90 wxPROPERTY( Value
, int , SetValue
, GetValue
, 0, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
91 wxPROPERTY( Minimum
, int , SetMin
, GetMin
, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
92 wxPROPERTY( Maximum
, int , SetMax
, GetMax
, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
93 wxPROPERTY( PageSize
, int , SetPageSize
, GetLineSize
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
94 wxPROPERTY( LineSize
, int , SetLineSize
, GetLineSize
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
95 wxPROPERTY( ThumbLength
, int , SetThumbLength
, GetThumbLength
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
96 wxPROPERTY_FLAGS( WindowStyle
, wxSliderStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
97 wxEND_PROPERTIES_TABLE()
99 wxBEGIN_HANDLERS_TABLE(wxSlider95
)
100 wxEND_HANDLERS_TABLE()
102 wxCONSTRUCTOR_8( wxSlider95
, wxWindow
* , Parent
, wxWindowID
, Id
, int , Value
, int , Minimum
, int , Maximum
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
104 IMPLEMENT_DYNAMIC_CLASS(wxSlider95
, wxControl
)
108 wxSlider95::wxSlider95()
110 m_staticValue
= (WXHWND
) NULL
;
111 m_staticMin
= (WXHWND
) NULL
;
112 m_staticMax
= (WXHWND
) NULL
;
120 bool wxSlider95::Create(wxWindow
*parent
, wxWindowID id
,
121 int value
, int minValue
, int maxValue
,
123 const wxSize
& size
, long style
,
124 const wxValidator
& validator
,
125 const wxString
& name
)
127 // default is no border
128 if ( (style
& wxBORDER_MASK
) == wxBORDER_DEFAULT
)
129 style
|= wxBORDER_NONE
;
131 if ( !CreateBase(parent
, id
, pos
, size
, style
, validator
, name
) )
134 if (parent
) parent
->AddChild(this);
138 m_staticValue
= (WXHWND
) NULL
;;
139 m_staticMin
= (WXHWND
) NULL
;;
140 m_staticMax
= (WXHWND
) NULL
;;
143 m_windowStyle
= style
;
149 if ( m_windowStyle
& wxSL_LABELS
)
151 msStyle
|= SS_CENTER
;
154 long valueStyle
= m_windowStyle
& ~wxBORDER_MASK
;
155 valueStyle
|= wxBORDER_SUNKEN
;
156 msStyle
|= MSWGetStyle(valueStyle
, & exStyle
) ;
158 m_staticValue
= (WXHWND
) CreateWindowEx
160 exStyle
, wxT("STATIC"), NULL
,
162 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)NewControlId(),
163 wxGetInstance(), NULL
166 // Now create min static control
168 minLabel
.Printf(wxT("%d"), minValue
);
169 wstyle
= STATIC_FLAGS
;
170 if ( m_windowStyle
& wxCLIP_SIBLINGS
)
171 msStyle
|= WS_CLIPSIBLINGS
;
172 m_staticMin
= (WXHWND
) CreateWindowEx
174 0, wxT("STATIC"), minLabel
,
176 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)NewControlId(),
177 wxGetInstance(), NULL
183 msStyle
= MSWGetStyle(GetWindowStyle(), & exStyle
) ;
185 if (m_windowStyle
& wxSL_VERTICAL
)
186 msStyle
= TBS_VERT
| WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
;
188 msStyle
= TBS_HORZ
| WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
;
190 if ( m_windowStyle
& wxSL_AUTOTICKS
)
191 msStyle
|= TBS_AUTOTICKS
;
193 if ( m_windowStyle
& wxSL_LEFT
)
195 else if ( m_windowStyle
& wxSL_RIGHT
)
196 msStyle
|= TBS_RIGHT
;
197 else if ( m_windowStyle
& wxSL_TOP
)
199 else if ( m_windowStyle
& wxSL_BOTTOM
)
200 msStyle
|= TBS_BOTTOM
;
201 else if ( m_windowStyle
& wxSL_BOTH
)
203 else if ( ! (m_windowStyle
& wxSL_AUTOTICKS
) )
204 msStyle
|= TBS_NOTICKS
;
206 if ( m_windowStyle
& wxSL_SELRANGE
)
207 msStyle
|= TBS_ENABLESELRANGE
;
209 HWND scroll_bar
= CreateWindowEx
211 exStyle
, TRACKBAR_CLASS
, wxEmptyString
,
213 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
214 wxGetInstance(), NULL
217 m_rangeMax
= maxValue
;
218 m_rangeMin
= minValue
;
220 m_pageSize
= (int)((maxValue
-minValue
)/10);
222 ::SendMessage(scroll_bar
, TBM_SETRANGE
, TRUE
, MAKELONG(minValue
, maxValue
));
223 ::SendMessage(scroll_bar
, TBM_SETPOS
, TRUE
, (LPARAM
)value
);
224 ::SendMessage(scroll_bar
, TBM_SETPAGESIZE
, 0, (LPARAM
)m_pageSize
);
226 m_hWnd
= (WXHWND
)scroll_bar
;
228 SubclassWin(GetHWND());
230 ::SetWindowText((HWND
) m_hWnd
, wxEmptyString
);
232 if ( m_windowStyle
& wxSL_LABELS
)
234 // Finally, create max value static item
236 maxLabel
.Printf(wxT("%d"), maxValue
);
237 wstyle
= STATIC_FLAGS
;
239 if ( m_windowStyle
& wxCLIP_SIBLINGS
)
240 msStyle
|= WS_CLIPSIBLINGS
;
242 m_staticMax
= (WXHWND
) CreateWindowEx
244 0, wxT("STATIC"), maxLabel
,
246 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)NewControlId(),
247 wxGetInstance(), NULL
253 if (GetFont().GetResourceHandle())
256 ::SendMessage((HWND
) m_staticMin
, WM_SETFONT
,
257 (WPARAM
) GetFont().GetResourceHandle(), 0L);
260 ::SendMessage((HWND
) m_staticMax
, WM_SETFONT
,
261 (WPARAM
) GetFont().GetResourceHandle(), 0L);
264 ::SendMessage((HWND
) m_staticValue
, WM_SETFONT
,
265 (WPARAM
) GetFont().GetResourceHandle(), 0L);
270 SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
);
273 // SetInitialBestSize is not called since we don't call MSWCreateControl
274 // for this control, so call SetBestSize here instead.
280 bool wxSlider95::MSWOnScroll(int WXUNUSED(orientation
), WXWORD wParam
,
281 WXWORD
WXUNUSED(pos
), WXHWND control
)
283 wxEventType scrollEvent
;
287 scrollEvent
= wxEVT_SCROLL_TOP
;
291 scrollEvent
= wxEVT_SCROLL_BOTTOM
;
295 scrollEvent
= wxEVT_SCROLL_LINEUP
;
299 scrollEvent
= wxEVT_SCROLL_LINEDOWN
;
303 scrollEvent
= wxEVT_SCROLL_PAGEUP
;
307 scrollEvent
= wxEVT_SCROLL_PAGEDOWN
;
311 scrollEvent
= wxEVT_SCROLL_THUMBTRACK
;
314 case SB_THUMBPOSITION
:
315 scrollEvent
= wxEVT_SCROLL_THUMBRELEASE
;
319 scrollEvent
= wxEVT_SCROLL_ENDSCROLL
;
323 // unknown scroll event?
327 int newPos
= (int) ::SendMessage((HWND
) control
, TBM_GETPOS
, 0, 0);
328 if ( (newPos
< GetMin()) || (newPos
> GetMax()) )
330 // out of range - but we did process it
336 wxScrollEvent
event(scrollEvent
, m_windowId
);
337 event
.SetPosition(newPos
);
338 event
.SetEventObject( this );
339 GetEventHandler()->ProcessEvent(event
);
341 wxCommandEvent
cevent( wxEVT_COMMAND_SLIDER_UPDATED
, GetId() );
342 cevent
.SetInt( newPos
);
343 cevent
.SetEventObject( this );
345 return GetEventHandler()->ProcessEvent( cevent
);
348 wxSlider95::~wxSlider95()
352 ::DestroyWindow((HWND
) m_staticMin
);
353 m_staticMin
= (WXHWND
) NULL
;
358 ::DestroyWindow((HWND
) m_staticMax
);
359 m_staticMax
= (WXHWND
) NULL
;
364 ::DestroyWindow((HWND
) m_staticValue
);
365 m_staticValue
= (WXHWND
) NULL
;
369 int wxSlider95::GetValue() const
371 return ::SendMessage(GetHwnd(), TBM_GETPOS
, 0, 0);
374 void wxSlider95::SetValue(int value
)
376 ::SendMessage(GetHwnd(), TBM_SETPOS
, (WPARAM
)TRUE
, (LPARAM
)value
);
381 str
.Printf(wxT("%d"), value
);
382 ::SetWindowText((HWND
) m_staticValue
, str
);
386 void wxSlider95::DoGetSize(int *width
, int *height
) const
389 rect
.left
= -1; rect
.right
= -1; rect
.top
= -1; rect
.bottom
= -1;
391 wxFindMaxSize(GetHWND(), &rect
);
394 wxFindMaxSize(m_staticMin
, &rect
);
397 wxFindMaxSize(m_staticMax
, &rect
);
400 wxFindMaxSize(m_staticValue
, &rect
);
403 *width
= rect
.right
- rect
.left
;
405 *height
= rect
.bottom
- rect
.top
;
408 void wxSlider95::GetPosition(int *x
, int *y
) const
410 wxWindow
*parent
= GetParent();
412 rect
.left
= -1; rect
.right
= -1; rect
.top
= -1; rect
.bottom
= -1;
414 wxFindMaxSize(GetHWND(), &rect
);
417 wxFindMaxSize(m_staticMin
, &rect
);
419 wxFindMaxSize(m_staticMax
, &rect
);
421 wxFindMaxSize(m_staticValue
, &rect
);
423 // Since we now have the absolute screen coords,
424 // if there's a parent we must subtract its top left corner
429 ::ScreenToClient((HWND
) parent
->GetHWND(), &point
);
431 // We may be faking the client origin.
432 // So a window that's really at (0, 30) may appear
433 // (to wxWin apps) to be at (0, 0).
436 wxPoint
pt(GetParent()->GetClientAreaOrigin());
445 // TODO one day, make sense of all this horros and replace it with a readable
447 void wxSlider95::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
454 int currentX
, currentY
;
455 GetPosition(¤tX
, ¤tY
);
456 if (x
== -1 && !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
458 if (y
== -1 && !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
461 AdjustForParentClientOrigin(x1
, y1
, sizeFlags
);
468 int cx
; // slider,min,max sizes
472 wxGetCharSize(GetHWND(), &cx
, &cy
, this->GetFont());
474 if ((m_windowStyle
& wxSL_VERTICAL
) != wxSL_VERTICAL
)
476 if ( m_windowStyle
& wxSL_LABELS
)
480 ::GetWindowText((HWND
) m_staticMin
, buf
, 300);
481 GetTextExtent(buf
, &min_len
, &cyf
,NULL
,NULL
, & this->GetFont());
485 ::GetWindowText((HWND
) m_staticMax
, buf
, 300);
486 GetTextExtent(buf
, &max_len
, &cyf
,NULL
,NULL
, & this->GetFont());
489 int new_width
= (int)(wxMax(min_len
, max_len
));
490 int valueHeight
= (int)cyf
;
492 // For some reason, under Win95, the text edit control has
493 // a lot of space before the first character
496 // The height needs to be a bit bigger under Win95 if
497 // using native 3D effects.
498 valueHeight
= (int) (valueHeight
* 1.5) ;
499 ::MoveWindow((HWND
) m_staticValue
, x_offset
, y_offset
,
500 new_width
, valueHeight
, TRUE
);
501 x_offset
+= new_width
+ cx
;
504 MoveWindow((HWND
) m_staticMin
, x_offset
, y_offset
,
505 (int) min_len
, cy
, TRUE
);
506 x_offset
+= (int)(min_len
+ cx
);
508 // slider_length = (total width available) - (width used so far)
509 // - (width of max label) - (border)
510 int slider_length
= (int)(w1
- (x_offset
-x
) - max_len
- cx
);
512 int slider_height
= h1
;
513 if (slider_height
< 0 )
516 // Slider must have a minimum/default length/height
517 if (slider_length
< 100)
520 ::MoveWindow(GetHwnd(), x_offset
, y_offset
,
521 slider_length
, slider_height
, TRUE
);
522 x_offset
+= slider_length
+ cx
;
524 MoveWindow((HWND
) m_staticMax
, x_offset
, y_offset
,
525 (int) max_len
, cy
, TRUE
);
530 // If we're prepared to use the existing size, then...
535 && ((sizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
)
546 ::MoveWindow(GetHwnd(), x1
, y1
, w1
, h1
, TRUE
);
551 if ( m_windowStyle
& wxSL_LABELS
)
554 ::GetWindowText((HWND
) m_staticMin
, buf
, 300);
555 GetTextExtent(buf
, &min_len
, &cyf
,NULL
,NULL
, & this->GetFont());
558 ::GetWindowText((HWND
) m_staticMax
, buf
, 300);
559 GetTextExtent(buf
, &max_len
, &cyf
,NULL
,NULL
, & this->GetFont());
563 int new_width
= (int)(wxMax(min_len
, max_len
));
564 int valueHeight
= (int)cyf
;
567 // The height needs to be a bit bigger under Win95 if
568 // using native 3D effects.
569 valueHeight
= (int) (valueHeight
* 1.5) ;
571 ::MoveWindow((HWND
) m_staticValue
, x_offset
, y_offset
,
572 new_width
, valueHeight
, TRUE
);
573 y_offset
+= valueHeight
;
576 ::MoveWindow((HWND
) m_staticMin
, x_offset
, y_offset
,
577 (int) min_len
, cy
, TRUE
);
580 // slider_length = (total height available) - (height used so far)
581 // - (height of max label) - (border)
582 int slider_length
= (int)(h1
- (y_offset
-y
) - cy
- cy
);
584 int slider_width
= w1
;
585 if (slider_width
< 0 )
588 // Slider must have a minimum/default length
589 if (slider_length
< 100)
592 ::MoveWindow(GetHwnd(), x_offset
, y_offset
,
593 slider_width
, slider_length
, TRUE
);
594 y_offset
+= slider_length
;
596 ::MoveWindow((HWND
) m_staticMax
, x_offset
, y_offset
,
597 (int)max_len
, cy
, TRUE
);
602 // If we're prepared to use the existing size, then...
605 width
== -1 && height
== -1
606 && ((sizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
)
617 ::MoveWindow(GetHwnd(), x1
, y1
, w1
, h1
, TRUE
);
623 // A reimplementaion of the mess above changed a bit to just determine the min
624 // size needed. It would certainly be nice to refactor this and DoSetSize
626 wxSize
wxSlider95::DoGetBestSize() const
636 wxGetCharSize(GetHWND(), &cx
, &cy
, this->GetFont());
638 if ( !HasFlag(wxSL_VERTICAL
))
640 rv
= wxSize(100, 20); // default size for the slider itself
642 if (HasFlag(wxSL_LABELS
)) // do we need to add more for the labels?
644 ::GetWindowText((HWND
) m_staticMin
, buf
, 300);
645 GetTextExtent(buf
, &min_len
, &cyf
,NULL
,NULL
, & this->GetFont());
646 rv
.x
+= min_len
+ cx
;
648 ::GetWindowText((HWND
) m_staticMax
, buf
, 300);
649 GetTextExtent(buf
, &max_len
, &cyf
,NULL
,NULL
, & this->GetFont());
650 rv
.x
+= max_len
+ cx
;
654 int new_width
= (int)(wxMax(min_len
, max_len
));
655 int valueHeight
= (int)cyf
;
658 // For some reason, under Win95, the text edit control has
659 // a lot of space before the first character
662 // The height needs to be a bit bigger under Win95 if
663 // using native 3D effects.
664 valueHeight
= (int) (valueHeight
* 1.5) ;
666 rv
.x
+= new_width
+ cx
;
667 rv
.y
= wxMax(valueHeight
, rv
.y
);
671 else // ! wxSL_HORIZONTAL
673 rv
= wxSize(20, 100); // default size for the slider itself
675 if (HasFlag(wxSL_LABELS
)) // do we need to add more for the labels?
677 ::GetWindowText((HWND
) m_staticMin
, buf
, 300);
678 GetTextExtent(buf
, &min_len
, &cyf
,NULL
,NULL
, & this->GetFont());
681 ::GetWindowText((HWND
) m_staticMax
, buf
, 300);
682 GetTextExtent(buf
, &max_len
, &cyf
,NULL
,NULL
, & this->GetFont());
687 int new_width
= (int)(wxMax(min_len
, max_len
));
688 int valueHeight
= (int)cyf
;
691 // The height needs to be a bit bigger under Win95 if
692 // using native 3D effects.
693 valueHeight
= (int) (valueHeight
* 1.5) ;
695 rv
.x
= wxMax(new_width
, rv
.x
);
703 void wxSlider95::SetRange(int minValue
, int maxValue
)
705 m_rangeMin
= minValue
;
706 m_rangeMax
= maxValue
;
708 ::SendMessage(GetHwnd(), TBM_SETRANGE
, TRUE
, MAKELONG(minValue
, maxValue
));
713 wxSprintf(buf
, wxT("%d"), m_rangeMin
);
714 ::SetWindowText((HWND
) m_staticMin
, buf
);
719 wxSprintf(buf
, wxT("%d"), m_rangeMax
);
720 ::SetWindowText((HWND
) m_staticMax
, buf
);
724 WXHBRUSH
wxSlider95::OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
725 WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
728 if ( nCtlColor
== CTLCOLOR_SCROLLBAR
)
731 if ( nCtlColor
!= CTLCOLOR_STATIC
)
734 // Otherwise, it's a static
735 return wxControl::OnCtlColor(pDC
, pWnd
, nCtlColor
, message
, wParam
, lParam
);
738 // For trackbars only
739 void wxSlider95::SetTickFreq(int n
, int pos
)
742 ::SendMessage( GetHwnd(), TBM_SETTICFREQ
, (WPARAM
) n
, (LPARAM
) pos
);
745 void wxSlider95::SetPageSize(int pageSize
)
747 ::SendMessage( GetHwnd(), TBM_SETPAGESIZE
, (WPARAM
) 0, (LPARAM
) pageSize
);
748 m_pageSize
= pageSize
;
751 int wxSlider95::GetPageSize() const
756 void wxSlider95::ClearSel()
758 ::SendMessage( GetHwnd(), TBM_CLEARSEL
, (WPARAM
) TRUE
, (LPARAM
) 0 );
761 void wxSlider95::ClearTicks()
763 ::SendMessage( GetHwnd(), TBM_CLEARTICS
, (WPARAM
) TRUE
, (LPARAM
) 0 );
766 void wxSlider95::SetLineSize(int lineSize
)
768 m_lineSize
= lineSize
;
769 ::SendMessage( GetHwnd(), TBM_SETLINESIZE
, (WPARAM
) 0, (LPARAM
) lineSize
);
772 int wxSlider95::GetLineSize() const
774 return (int) ::SendMessage( GetHwnd(), TBM_GETLINESIZE
,
775 (WPARAM
) 0, (LPARAM
) 0 );
778 int wxSlider95::GetSelEnd() const
780 return (int) ::SendMessage( GetHwnd(), TBM_SETSELEND
,
781 (WPARAM
) 0, (LPARAM
) 0 );
784 int wxSlider95::GetSelStart() const
786 return (int) ::SendMessage( GetHwnd(), TBM_GETSELSTART
,
787 (WPARAM
) 0, (LPARAM
) 0 );
790 void wxSlider95::SetSelection(int minPos
, int maxPos
)
792 ::SendMessage(GetHwnd(), TBM_SETSEL
,
793 (WPARAM
) TRUE
, (LPARAM
) MAKELONG( minPos
, maxPos
) );
796 void wxSlider95::SetThumbLength(int len
)
798 ::SendMessage( GetHwnd(), TBM_SETTHUMBLENGTH
, (WPARAM
) len
, (LPARAM
) 0 );
801 int wxSlider95::GetThumbLength() const
803 return (int) ::SendMessage( GetHwnd(), TBM_GETTHUMBLENGTH
,
804 (WPARAM
) 0, (LPARAM
) 0 );
807 void wxSlider95::SetTick(int tickPos
)
809 ::SendMessage( GetHwnd(), TBM_SETTIC
, (WPARAM
) 0, (LPARAM
) tickPos
);
812 bool wxSlider95::ContainsHWND(WXHWND hWnd
) const
816 hWnd
== GetStaticMin()
817 || hWnd
== GetStaticMax()
818 || hWnd
== GetEditValue()
822 void wxSlider95::Command (wxCommandEvent
& event
)
824 SetValue (event
.GetInt());
825 ProcessCommand (event
);
828 bool wxSlider95::Show(bool show
)
830 wxWindow::Show(show
);
839 ShowWindow((HWND
) m_staticValue
, (BOOL
)cshow
);
842 ShowWindow((HWND
) m_staticMin
, (BOOL
)cshow
);
845 ShowWindow((HWND
) m_staticMax
, (BOOL
)cshow
);
853 #endif // wxUSE_SLIDER