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
;
148 if ( m_windowStyle
& wxSL_LABELS
)
150 msStyle
|= SS_CENTER
;
153 long valueStyle
= m_windowStyle
& ~wxBORDER_MASK
;
154 valueStyle
|= wxBORDER_SUNKEN
;
155 msStyle
|= MSWGetStyle(valueStyle
, & exStyle
) ;
157 m_staticValue
= (WXHWND
) CreateWindowEx
159 exStyle
, wxT("STATIC"), NULL
,
161 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)NewControlId(),
162 wxGetInstance(), NULL
165 // Now create min static control
167 minLabel
.Printf(wxT("%d"), minValue
);
168 long wstyle
= STATIC_FLAGS
;
169 if ( m_windowStyle
& wxCLIP_SIBLINGS
)
170 wstyle
|= WS_CLIPSIBLINGS
;
171 m_staticMin
= (WXHWND
) CreateWindowEx
173 0, wxT("STATIC"), minLabel
,
175 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)NewControlId(),
176 wxGetInstance(), NULL
182 msStyle
= MSWGetStyle(GetWindowStyle(), & exStyle
) ;
184 wxUnusedVar(msStyle
);
186 if (m_windowStyle
& wxSL_VERTICAL
)
187 msStyle
= TBS_VERT
| WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
;
189 msStyle
= TBS_HORZ
| WS_CHILD
| WS_VISIBLE
| WS_TABSTOP
;
191 if ( m_windowStyle
& wxSL_AUTOTICKS
)
192 msStyle
|= TBS_AUTOTICKS
;
194 if ( m_windowStyle
& wxSL_LEFT
)
196 else if ( m_windowStyle
& wxSL_RIGHT
)
197 msStyle
|= TBS_RIGHT
;
198 else if ( m_windowStyle
& wxSL_TOP
)
200 else if ( m_windowStyle
& wxSL_BOTTOM
)
201 msStyle
|= TBS_BOTTOM
;
202 else if ( m_windowStyle
& wxSL_BOTH
)
204 else if ( ! (m_windowStyle
& wxSL_AUTOTICKS
) )
205 msStyle
|= TBS_NOTICKS
;
207 if ( m_windowStyle
& wxSL_SELRANGE
)
208 msStyle
|= TBS_ENABLESELRANGE
;
210 HWND scroll_bar
= CreateWindowEx
212 exStyle
, TRACKBAR_CLASS
, wxEmptyString
,
214 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)m_windowId
,
215 wxGetInstance(), NULL
218 m_rangeMax
= maxValue
;
219 m_rangeMin
= minValue
;
221 m_pageSize
= (int)((maxValue
-minValue
)/10);
223 ::SendMessage(scroll_bar
, TBM_SETRANGE
, TRUE
, MAKELONG(minValue
, maxValue
));
224 ::SendMessage(scroll_bar
, TBM_SETPOS
, TRUE
, (LPARAM
)value
);
225 ::SendMessage(scroll_bar
, TBM_SETPAGESIZE
, 0, (LPARAM
)m_pageSize
);
227 m_hWnd
= (WXHWND
)scroll_bar
;
229 SubclassWin(GetHWND());
231 ::SetWindowText((HWND
) m_hWnd
, wxEmptyString
);
233 if ( m_windowStyle
& wxSL_LABELS
)
235 // Finally, create max value static item
237 maxLabel
.Printf(wxT("%d"), maxValue
);
238 long wstyle
= STATIC_FLAGS
;
240 if ( m_windowStyle
& wxCLIP_SIBLINGS
)
241 wstyle
|= WS_CLIPSIBLINGS
;
243 m_staticMax
= (WXHWND
) CreateWindowEx
245 0, wxT("STATIC"), maxLabel
,
247 0, 0, 0, 0, (HWND
) parent
->GetHWND(), (HMENU
)NewControlId(),
248 wxGetInstance(), NULL
254 if (GetFont().GetResourceHandle())
257 ::SendMessage((HWND
) m_staticMin
, WM_SETFONT
,
258 (WPARAM
) GetFont().GetResourceHandle(), 0L);
261 ::SendMessage((HWND
) m_staticMax
, WM_SETFONT
,
262 (WPARAM
) GetFont().GetResourceHandle(), 0L);
265 ::SendMessage((HWND
) m_staticValue
, WM_SETFONT
,
266 (WPARAM
) GetFont().GetResourceHandle(), 0L);
271 SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
);
274 // SetInitialBestSize is not called since we don't call MSWCreateControl
275 // for this control, so call SetBestSize here instead.
281 bool wxSlider95::MSWOnScroll(int WXUNUSED(orientation
), WXWORD wParam
,
282 WXWORD
WXUNUSED(pos
), WXHWND control
)
284 wxEventType scrollEvent
;
288 scrollEvent
= wxEVT_SCROLL_TOP
;
292 scrollEvent
= wxEVT_SCROLL_BOTTOM
;
296 scrollEvent
= wxEVT_SCROLL_LINEUP
;
300 scrollEvent
= wxEVT_SCROLL_LINEDOWN
;
304 scrollEvent
= wxEVT_SCROLL_PAGEUP
;
308 scrollEvent
= wxEVT_SCROLL_PAGEDOWN
;
312 scrollEvent
= wxEVT_SCROLL_THUMBTRACK
;
315 case SB_THUMBPOSITION
:
316 scrollEvent
= wxEVT_SCROLL_THUMBRELEASE
;
320 scrollEvent
= wxEVT_SCROLL_ENDSCROLL
;
324 // unknown scroll event?
328 int newPos
= (int) ::SendMessage((HWND
) control
, TBM_GETPOS
, 0, 0);
329 if ( (newPos
< GetMin()) || (newPos
> GetMax()) )
331 // out of range - but we did process it
337 wxScrollEvent
event(scrollEvent
, m_windowId
);
338 event
.SetPosition(newPos
);
339 event
.SetEventObject( this );
340 GetEventHandler()->ProcessEvent(event
);
342 wxCommandEvent
cevent( wxEVT_COMMAND_SLIDER_UPDATED
, GetId() );
343 cevent
.SetInt( newPos
);
344 cevent
.SetEventObject( this );
346 return GetEventHandler()->ProcessEvent( cevent
);
349 wxSlider95::~wxSlider95()
353 ::DestroyWindow((HWND
) m_staticMin
);
354 m_staticMin
= (WXHWND
) NULL
;
359 ::DestroyWindow((HWND
) m_staticMax
);
360 m_staticMax
= (WXHWND
) NULL
;
365 ::DestroyWindow((HWND
) m_staticValue
);
366 m_staticValue
= (WXHWND
) NULL
;
370 int wxSlider95::GetValue() const
372 return ::SendMessage(GetHwnd(), TBM_GETPOS
, 0, 0);
375 void wxSlider95::SetValue(int value
)
377 ::SendMessage(GetHwnd(), TBM_SETPOS
, (WPARAM
)TRUE
, (LPARAM
)value
);
382 str
.Printf(wxT("%d"), value
);
383 ::SetWindowText((HWND
) m_staticValue
, str
);
387 void wxSlider95::DoGetSize(int *width
, int *height
) const
390 rect
.left
= -1; rect
.right
= -1; rect
.top
= -1; rect
.bottom
= -1;
392 wxFindMaxSize(GetHWND(), &rect
);
395 wxFindMaxSize(m_staticMin
, &rect
);
398 wxFindMaxSize(m_staticMax
, &rect
);
401 wxFindMaxSize(m_staticValue
, &rect
);
404 *width
= rect
.right
- rect
.left
;
406 *height
= rect
.bottom
- rect
.top
;
409 void wxSlider95::GetPosition(int *x
, int *y
) const
411 wxWindow
*parent
= GetParent();
413 rect
.left
= -1; rect
.right
= -1; rect
.top
= -1; rect
.bottom
= -1;
415 wxFindMaxSize(GetHWND(), &rect
);
418 wxFindMaxSize(m_staticMin
, &rect
);
420 wxFindMaxSize(m_staticMax
, &rect
);
422 wxFindMaxSize(m_staticValue
, &rect
);
424 // Since we now have the absolute screen coords,
425 // if there's a parent we must subtract its top left corner
430 ::ScreenToClient((HWND
) parent
->GetHWND(), &point
);
432 // We may be faking the client origin.
433 // So a window that's really at (0, 30) may appear
434 // (to wxWin apps) to be at (0, 0).
437 wxPoint
pt(GetParent()->GetClientAreaOrigin());
446 // TODO one day, make sense of all this horros and replace it with a readable
448 void wxSlider95::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
455 int currentX
, currentY
;
456 GetPosition(¤tX
, ¤tY
);
457 if (x
== wxDefaultCoord
&& !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
459 if (y
== wxDefaultCoord
&& !(sizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
462 AdjustForParentClientOrigin(x1
, y1
, sizeFlags
);
469 int cx
; // slider,min,max sizes
473 wxGetCharSize(GetHWND(), &cx
, &cy
, this->GetFont());
475 if ((m_windowStyle
& wxSL_VERTICAL
) != wxSL_VERTICAL
)
477 if ( m_windowStyle
& wxSL_LABELS
)
481 ::GetWindowText((HWND
) m_staticMin
, buf
, 300);
482 GetTextExtent(buf
, &min_len
, &cyf
);
486 ::GetWindowText((HWND
) m_staticMax
, buf
, 300);
487 GetTextExtent(buf
, &max_len
, &cyf
);
490 int new_width
= (int)(wxMax(min_len
, max_len
));
491 int valueHeight
= (int)cyf
;
493 // For some reason, under Win95, the text edit control has
494 // a lot of space before the first character
497 // The height needs to be a bit bigger under Win95 if
498 // using native 3D effects.
499 valueHeight
= (int) (valueHeight
* 1.5) ;
500 ::MoveWindow((HWND
) m_staticValue
, x_offset
, y_offset
,
501 new_width
, valueHeight
, TRUE
);
502 x_offset
+= new_width
+ cx
;
505 ::MoveWindow((HWND
) m_staticMin
, x_offset
, y_offset
,
506 (int) min_len
, cy
, TRUE
);
507 x_offset
+= (int)(min_len
+ cx
);
509 // slider_length = (total width available) - (width used so far)
510 // - (width of max label) - (border)
511 int slider_length
= (int)(w1
- (x_offset
-x
) - max_len
- cx
);
513 int slider_height
= h1
;
514 if (slider_height
< 0 )
517 // Slider must have a minimum/default length/height
518 if (slider_length
< 100)
521 ::MoveWindow(GetHwnd(), x_offset
, y_offset
,
522 slider_length
, slider_height
, TRUE
);
523 x_offset
+= slider_length
+ cx
;
525 ::MoveWindow((HWND
) m_staticMax
, x_offset
, y_offset
,
526 (int) max_len
, cy
, TRUE
);
531 // If we're prepared to use the existing size, then...
534 width
== wxDefaultCoord
535 && height
== wxDefaultCoord
536 && ((sizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
)
547 ::MoveWindow(GetHwnd(), x1
, y1
, w1
, h1
, TRUE
);
552 if ( m_windowStyle
& wxSL_LABELS
)
555 ::GetWindowText((HWND
) m_staticMin
, buf
, 300);
556 GetTextExtent(buf
, &min_len
, &cyf
);
559 ::GetWindowText((HWND
) m_staticMax
, buf
, 300);
560 GetTextExtent(buf
, &max_len
, &cyf
);
564 int new_width
= (int)(wxMax(min_len
, max_len
));
565 int valueHeight
= (int)cyf
;
568 // The height needs to be a bit bigger under Win95 if
569 // using native 3D effects.
570 valueHeight
= (int) (valueHeight
* 1.5) ;
572 ::MoveWindow((HWND
) m_staticValue
, x_offset
, y_offset
,
573 new_width
, valueHeight
, TRUE
);
574 y_offset
+= valueHeight
;
577 ::MoveWindow((HWND
) m_staticMin
, x_offset
, y_offset
,
578 (int) min_len
, cy
, TRUE
);
581 // slider_length = (total height available) - (height used so far)
582 // - (height of max label) - (border)
583 int slider_length
= (int)(h1
- (y_offset
-y
) - cy
- cy
);
585 int slider_width
= w1
;
586 if (slider_width
< 0 )
589 // Slider must have a minimum/default length
590 if (slider_length
< 100)
593 ::MoveWindow(GetHwnd(), x_offset
, y_offset
,
594 slider_width
, slider_length
, TRUE
);
595 y_offset
+= slider_length
;
597 ::MoveWindow((HWND
) m_staticMax
, x_offset
, y_offset
,
598 (int)max_len
, cy
, TRUE
);
603 // If we're prepared to use the existing size, then...
606 width
== wxDefaultCoord
&& height
== wxDefaultCoord
607 && ((sizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
)
618 ::MoveWindow(GetHwnd(), x1
, y1
, w1
, h1
, TRUE
);
624 // A reimplementaion of the mess above changed a bit to just determine the min
625 // size needed. It would certainly be nice to refactor this and DoSetSize
627 wxSize
wxSlider95::DoGetBestSize() const
637 wxGetCharSize(GetHWND(), &cx
, &cy
, this->GetFont());
639 if ( !HasFlag(wxSL_VERTICAL
))
641 rv
= wxSize(100, 20); // default size for the slider itself
643 if (HasFlag(wxSL_LABELS
)) // do we need to add more for the labels?
645 ::GetWindowText((HWND
) m_staticMin
, buf
, 300);
646 GetTextExtent(buf
, &min_len
, &cyf
);
647 rv
.x
+= min_len
+ cx
;
649 ::GetWindowText((HWND
) m_staticMax
, buf
, 300);
650 GetTextExtent(buf
, &max_len
, &cyf
);
651 rv
.x
+= max_len
+ cx
;
655 int new_width
= (int)(wxMax(min_len
, max_len
));
656 int valueHeight
= (int)cyf
;
659 // For some reason, under Win95, the text edit control has
660 // a lot of space before the first character
663 // The height needs to be a bit bigger under Win95 if
664 // using native 3D effects.
665 valueHeight
= (int) (valueHeight
* 1.5) ;
667 rv
.x
+= new_width
+ cx
;
668 rv
.y
= wxMax(valueHeight
, rv
.y
);
672 else // ! wxSL_HORIZONTAL
674 rv
= wxSize(20, 100); // default size for the slider itself
676 if (HasFlag(wxSL_LABELS
)) // do we need to add more for the labels?
678 ::GetWindowText((HWND
) m_staticMin
, buf
, 300);
679 GetTextExtent(buf
, &min_len
, &cyf
);
682 ::GetWindowText((HWND
) m_staticMax
, buf
, 300);
683 GetTextExtent(buf
, &max_len
, &cyf
);
688 int new_width
= (int)(wxMax(min_len
, max_len
));
689 int valueHeight
= (int)cyf
;
692 // The height needs to be a bit bigger under Win95 if
693 // using native 3D effects.
694 valueHeight
= (int) (valueHeight
* 1.5) ;
696 rv
.x
= wxMax(new_width
, rv
.x
);
704 void wxSlider95::SetRange(int minValue
, int maxValue
)
706 m_rangeMin
= minValue
;
707 m_rangeMax
= maxValue
;
709 ::SendMessage(GetHwnd(), TBM_SETRANGE
, TRUE
, MAKELONG(minValue
, maxValue
));
714 wxSprintf(buf
, wxT("%d"), m_rangeMin
);
715 ::SetWindowText((HWND
) m_staticMin
, buf
);
720 wxSprintf(buf
, wxT("%d"), m_rangeMax
);
721 ::SetWindowText((HWND
) m_staticMax
, buf
);
725 WXHBRUSH
wxSlider95::OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
726 WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
729 if ( nCtlColor
== CTLCOLOR_SCROLLBAR
)
732 if ( nCtlColor
!= CTLCOLOR_STATIC
)
735 // Otherwise, it's a static
736 return wxControl::OnCtlColor(pDC
, pWnd
, nCtlColor
, message
, wParam
, lParam
);
739 // For trackbars only
740 void wxSlider95::SetTickFreq(int n
, int pos
)
743 ::SendMessage( GetHwnd(), TBM_SETTICFREQ
, (WPARAM
) n
, (LPARAM
) pos
);
746 void wxSlider95::SetPageSize(int pageSize
)
748 ::SendMessage( GetHwnd(), TBM_SETPAGESIZE
, (WPARAM
) 0, (LPARAM
) pageSize
);
749 m_pageSize
= pageSize
;
752 int wxSlider95::GetPageSize() const
757 void wxSlider95::ClearSel()
759 ::SendMessage( GetHwnd(), TBM_CLEARSEL
, (WPARAM
) TRUE
, (LPARAM
) 0 );
762 void wxSlider95::ClearTicks()
764 ::SendMessage( GetHwnd(), TBM_CLEARTICS
, (WPARAM
) TRUE
, (LPARAM
) 0 );
767 void wxSlider95::SetLineSize(int lineSize
)
769 m_lineSize
= lineSize
;
770 ::SendMessage( GetHwnd(), TBM_SETLINESIZE
, (WPARAM
) 0, (LPARAM
) lineSize
);
773 int wxSlider95::GetLineSize() const
775 return (int) ::SendMessage( GetHwnd(), TBM_GETLINESIZE
,
776 (WPARAM
) 0, (LPARAM
) 0 );
779 int wxSlider95::GetSelEnd() const
781 return (int) ::SendMessage( GetHwnd(), TBM_SETSELEND
,
782 (WPARAM
) 0, (LPARAM
) 0 );
785 int wxSlider95::GetSelStart() const
787 return (int) ::SendMessage( GetHwnd(), TBM_GETSELSTART
,
788 (WPARAM
) 0, (LPARAM
) 0 );
791 void wxSlider95::SetSelection(int minPos
, int maxPos
)
793 ::SendMessage(GetHwnd(), TBM_SETSEL
,
794 (WPARAM
) TRUE
, (LPARAM
) MAKELONG( minPos
, maxPos
) );
797 void wxSlider95::SetThumbLength(int len
)
799 ::SendMessage( GetHwnd(), TBM_SETTHUMBLENGTH
, (WPARAM
) len
, (LPARAM
) 0 );
802 int wxSlider95::GetThumbLength() const
804 return (int) ::SendMessage( GetHwnd(), TBM_GETTHUMBLENGTH
,
805 (WPARAM
) 0, (LPARAM
) 0 );
808 void wxSlider95::SetTick(int tickPos
)
810 ::SendMessage( GetHwnd(), TBM_SETTIC
, (WPARAM
) 0, (LPARAM
) tickPos
);
813 bool wxSlider95::ContainsHWND(WXHWND hWnd
) const
817 hWnd
== GetStaticMin()
818 || hWnd
== GetStaticMax()
819 || hWnd
== GetEditValue()
823 void wxSlider95::Command (wxCommandEvent
& event
)
825 SetValue (event
.GetInt());
826 ProcessCommand (event
);
829 bool wxSlider95::Show(bool show
)
831 wxWindow::Show(show
);
840 ShowWindow((HWND
) m_staticValue
, (BOOL
)cshow
);
843 ShowWindow((HWND
) m_staticMin
, (BOOL
)cshow
);
846 ShowWindow((HWND
) m_staticMax
, (BOOL
)cshow
);
854 #endif // wxUSE_SLIDER