1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
25 #include "wx/slider.h"
26 #include "wx/os2/private.h"
28 IMPLEMENT_DYNAMIC_CLASS(wxSlider
, wxControl
)
40 } // end of wxSlider::wxSlider
45 ::WinDestroyWindow((HWND
)m_hStaticMin
);
47 ::WinDestroyWindow((HWND
)m_hStaticMax
);
49 ::WinDestroyWindow((HWND
)m_hStaticValue
);
50 } // end of wxSlider::~wxSlider
52 void wxSlider::AdjustSubControls(
63 int nCx
; // slider,min,max sizes
68 wxGetCharSize( GetHWND()
74 if ((m_windowStyle
& wxSL_VERTICAL
) != wxSL_VERTICAL
)
76 if (m_windowStyle
& wxSL_LABELS
)
81 ::WinQueryWindowText((HWND
)m_hStaticMin
, 300, zBuf
);
82 GetTextExtent(zBuf
, &nMinLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
84 ::WinQueryWindowText((HWND
)m_hStaticMax
, 300, zBuf
);
85 GetTextExtent(zBuf
, &nMaxLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
89 int nNewWidth
= wxMax(nMinLen
, nMaxLen
);
90 int nValueHeight
= nCyf
;
92 ::WinSetWindowPos( (HWND
)m_hStaticValue
94 ,(LONG
)nXOffset
- (nNewWidth
+ nCx
+ nMinLen
+ nCx
)
98 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
101 ::WinSetWindowPos( (HWND
)m_hStaticMin
103 ,(LONG
)nXOffset
- (nMinLen
+ nCx
)
107 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
109 nXOffset
+= nWidth
+ nCx
;
111 ::WinSetWindowPos( (HWND
)m_hStaticMax
117 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
122 // Now deal with a vertical slider -- OS/2 doesn't have vertical sliders
124 } // end of wxSlider::AdjustSubControls
126 void wxSlider::ClearSel()
128 } // end of wxSlider::ClearSel
130 void wxSlider::ClearTicks()
132 } // end of wxSlider::ClearTicks
134 void wxSlider::Command (
135 wxCommandEvent
& rEvent
138 SetValue(rEvent
.GetInt());
139 ProcessCommand(rEvent
);
140 } // end of wxSlider::Command
142 bool wxSlider::ContainsHWND(
146 return ( hWnd
== GetStaticMin() ||
147 hWnd
== GetStaticMax() ||
148 hWnd
== GetEditValue()
150 } // end of wxSlider::ContainsHWND
152 bool wxSlider::Create(
158 , const wxPoint
& rPos
159 , const wxSize
& rSize
162 , const wxValidator
& rValidator
164 , const wxString
& rsName
169 int nWidth
= rSize
.x
;
170 int nHeight
= rSize
.y
;
176 SetValidator(rValidator
);
179 pParent
->AddChild(this);
180 SetBackgroundColour(pParent
->GetBackgroundColour()) ;
181 SetForegroundColour(pParent
->GetForegroundColour()) ;
188 m_windowStyle
= lStyle
;
192 m_windowId
= (int)NewControlId();
196 if (m_windowStyle
& wxCLIP_SIBLINGS
)
197 lMsStyle
|= WS_CLIPSIBLINGS
;
199 if (m_windowStyle
& wxSL_LABELS
)
201 lMsStyle
|= WS_VISIBLE
| SS_TEXT
| DT_VCENTER
;
203 m_hStaticValue
= (WXHWND
)::WinCreateWindow( (HWND
)GetHwndOf(pParent
) // Parent window handle
204 ,WC_STATIC
// Window class
205 ,(PSZ
)NULL
// Initial Text
206 ,(ULONG
)lMsStyle
// Style flags
207 ,0L, 0L, 0L, 0L // Origin -- 0 size
208 ,(HWND
)GetHwndOf(pParent
) // owner window handle (same as parent
209 ,HWND_TOP
// initial z position
210 ,(ULONG
)NewControlId() // Window identifier
211 ,NULL
// no control data
212 ,NULL
// no Presentation parameters
216 // Now create min static control
218 sprintf(wxBuffer
, "%d", nMinValue
);
219 lWstyle
= SS_TEXT
|DT_LEFT
|WS_VISIBLE
;
220 if (m_windowStyle
& wxCLIP_SIBLINGS
)
221 lWstyle
|= WS_CLIPSIBLINGS
;
222 m_hStaticMin
= (WXHWND
)::WinCreateWindow( (HWND
)GetHwndOf(pParent
) // Parent window handle
223 ,WC_STATIC
// Window class
224 ,(PSZ
)wxBuffer
// Initial Text
225 ,(ULONG
)lWstyle
// Style flags
226 ,0L, 0L, 0L, 0L // Origin -- 0 size
227 ,(HWND
)GetHwndOf(pParent
) // owner window handle (same as parent
228 ,HWND_TOP
// initial z position
229 ,(ULONG
)NewControlId() // Window identifier
230 ,NULL
// no control data
231 ,NULL
// no Presentation parameters
238 vSlData
.cbSize
= sizeof(SLDCDATA
);
239 if (m_windowStyle
& wxSL_VERTICAL
)
240 lMsStyle
= SLS_VERTICAL
| WS_VISIBLE
| WS_TABSTOP
;
242 lMsStyle
= SLS_HORIZONTAL
| WS_VISIBLE
| WS_TABSTOP
;
244 if (m_windowStyle
& wxCLIP_SIBLINGS
)
245 lMsStyle
|= WS_CLIPSIBLINGS
;
247 if (m_windowStyle
& wxSL_AUTOTICKS
)
249 vSlData
.usScale1Spacing
= 0;
250 vSlData
.usScale2Spacing
= 0;
253 if (m_windowStyle
& wxSL_LEFT
)
254 lMsStyle
|= SLS_PRIMARYSCALE2
; // if SLS_VERTICAL then SCALE2 is to the left
255 else if (m_windowStyle
& wxSL_RIGHT
)
256 lMsStyle
|= SLS_PRIMARYSCALE1
; // if SLS_VERTICAL then SCALE2 is to the right
257 else if (m_windowStyle
& wxSL_TOP
)
258 lMsStyle
|= SLS_PRIMARYSCALE1
; // if SLS_HORIZONTAL then SCALE1 is to the top
259 else if (m_windowStyle
& wxSL_BOTTOM
)
260 lMsStyle
|= SLS_PRIMARYSCALE2
; // if SLS_HORIZONTAL then SCALE1 is to the bottom
261 else if ( m_windowStyle
& wxSL_BOTH
)
262 lMsStyle
|= SLS_PRIMARYSCALE1
| SLS_PRIMARYSCALE2
;
264 lMsStyle
|= SLS_PRIMARYSCALE2
;
266 m_nPageSize
= ((nMaxValue
- nMinValue
)/10);
267 vSlData
.usScale1Increments
= m_nPageSize
;
268 vSlData
.usScale2Increments
= m_nPageSize
;
270 HWND hScrollBar
= ::WinCreateWindow( (HWND
)GetHwndOf(pParent
) // Parent window handle
271 ,WC_SLIDER
// Window class
272 ,(PSZ
)wxBuffer
// Initial Text
273 ,(ULONG
)lMsStyle
// Style flags
274 ,0L, 0L, 0L, 0L // Origin -- 0 size
275 ,(HWND
)GetHwndOf(pParent
) // owner window handle (same as parent
276 ,HWND_TOP
// initial z position
277 ,(HMENU
)m_windowId
// Window identifier
278 ,&vSlData
// Slider control data
279 ,NULL
// no Presentation parameters
281 m_nRangeMax
= nMaxValue
;
282 m_nRangeMin
= nMinValue
;
285 // Set the size of the ticks ... default to 6 pixels
287 ::WinSendMsg( hScrollBar
289 ,MPFROM2SHORT(SMA_SETALLTICKS
, 6)
293 // Set the position to the initial value
295 ::WinSendMsg( hScrollBar
297 ,MPFROM2SHORT(SMA_SLIDERARMPOSITION
, SMA_RANGEVALUE
)
301 m_hWnd
= (WXHWND
)hScrollBar
;
302 SubclassWin(GetHWND());
303 ::WinSetWindowText((HWND
)m_hWnd
, "");
304 SetFont(pParent
->GetFont());
305 if (m_windowStyle
& wxSL_LABELS
)
308 // Finally, create max value static item
310 sprintf(wxBuffer
, "%d", nMaxValue
);
311 lWstyle
= SS_TEXT
|DT_LEFT
|WS_VISIBLE
;
312 if (m_windowStyle
& wxCLIP_SIBLINGS
)
313 lMsStyle
|= WS_CLIPSIBLINGS
;
314 m_hStaticMax
= (WXHWND
)::WinCreateWindow( (HWND
)GetHwndOf(pParent
) // Parent window handle
315 ,WC_STATIC
// Window class
316 ,(PSZ
)wxBuffer
// Initial Text
317 ,(ULONG
)lWstyle
// Style flags
318 ,0L, 0L, 0L, 0L // Origin -- 0 size
319 ,(HWND
)GetHwndOf(pParent
) // owner window handle (same as parent
320 ,HWND_TOP
// initial z position
321 ,(ULONG
)NewControlId() // Window identifier
322 ,NULL
// no control data
323 ,NULL
// no Presentation parameters
327 if (GetFont().GetResourceHandle())
330 wxOS2SetFont( m_hStaticMin
334 wxOS2SetFont( m_hStaticMax
338 wxOS2SetFont( m_hStaticValue
350 m_nThumbLength
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
352 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
357 ) + 4; // for bordersizes
361 vColour
.Set(wxString("BLACK"));
363 LONG lColor
= (LONG
)vColour
.GetPixel();
365 ::WinSetPresParam( m_hStaticMin
370 ::WinSetPresParam( m_hStaticMax
375 ::WinSetPresParam( m_hStaticValue
380 ::WinSetPresParam( m_hWnd
387 } // end of wxSlider::Create
389 void wxSlider::DoSetSize(
399 int nWidth1
= nWidth
;
400 int nHeight1
= nHeight
;
403 int nCx
; // slider,min,max sizes
411 // Adjust for OS/2's reverse coordinate system
413 wxWindowOS2
* pParent
= (wxWindowOS2
*)GetParent();
415 int nOS2Height
= nHeight
;
422 int nOS2ParentHeight
= GetOS2ParentHeight(pParent
);
424 nYOffset
= nOS2ParentHeight
- (nYOffset
+ nOS2Height
);
426 nY1
= nOS2ParentHeight
- (nY1
+ nOS2Height
);
432 ::WinQueryWindowRect(HWND_DESKTOP
, &vRect
);
433 nYOffset
= vRect
.yTop
- (nYOffset
+ nOS2Height
);
435 nY1
= vRect
.yTop
- (nY1
+ nOS2Height
);
437 m_nSizeFlags
= nSizeFlags
;
439 GetPosition( &nCurrentX
442 if (nX
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
444 if (nY
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
447 AdjustForParentClientOrigin( nX1
451 wxGetCharSize( GetHWND()
457 if ((m_windowStyle
& wxSL_VERTICAL
) != wxSL_VERTICAL
)
459 if (m_windowStyle
& wxSL_LABELS
)
464 ::WinQueryWindowText((HWND
)m_hStaticMin
, 300, zBuf
);
465 GetTextExtent(zBuf
, &nMinLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
466 ::WinQueryWindowText((HWND
)m_hStaticMax
, 300, zBuf
);
467 GetTextExtent(zBuf
, &nMaxLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
471 int nNewWidth
= (wxMax(nMinLen
, nMaxLen
));
472 int nValueHeight
= nCyf
;
474 ::WinSetWindowPos( (HWND
)m_hStaticValue
477 ,(LONG
)nYOffset
- (nCyf
* 1.2)
480 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
482 nXOffset
+= nNewWidth
+ nCx
;
484 ::WinSetWindowPos( (HWND
)m_hStaticMin
487 ,(LONG
)nYOffset
- nCyf
490 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
492 nXOffset
+= nMinLen
+ nCx
;
494 int nSliderLength
= nWidth1
- nXOffset
- nMaxLen
- nCx
;
495 int nSliderHeight
= nHeight1
;
497 if (nSliderHeight
< 0)
501 // Slider must have a minimum/default length/height
503 if (nSliderLength
< 100)
506 ::WinSetWindowPos( GetHwnd()
512 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
514 nXOffset
+= nSliderLength
+ nCx
;
516 ::WinSetWindowPos( (HWND
)m_hStaticMax
519 ,(LONG
)nYOffset
- nCyf
522 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
529 // If we're prepared to use the existing size, then...
531 if (nWidth
== -1 && nHeight
== -1 &&
532 ((nSizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
))
542 ::WinSetWindowPos( GetHwnd()
548 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
554 // Now deal with a vertical slider
558 if (m_windowStyle
& wxSL_LABELS
)
563 ::WinQueryWindowText((HWND
)m_hStaticMin
, 300, zBuf
);
564 GetTextExtent(zBuf
, &nMinLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
565 ::WinQueryWindowText((HWND
)m_hStaticMax
, 300, zBuf
);
566 GetTextExtent(zBuf
, &nMaxLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
569 int nNewWidth
= wxMax(nMinLen
, nMaxLen
);
570 int nValueHeight
= nCyf
;
575 // The height needs to be a bit bigger under Win95 if using native
578 nValueHeight
= (int)(nValueHeight
* 1.5);
579 ::WinSetWindowPos( (HWND
)m_hStaticValue
585 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
587 nYOffset
-= nValueHeight
;
588 nUsedHeight
+= nValueHeight
;
590 ::WinSetWindowPos( (HWND
)m_hStaticMin
596 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
601 int nSliderLength
= nHeight1
- (nUsedHeight
+ (2 * nCy
));
602 int nSliderWidth
= nWidth1
;
604 if (nSliderWidth
< 0)
608 // Slider must have a minimum/default length
610 if (nSliderLength
< 100)
613 ::WinSetWindowPos( (HWND
)m_hStaticMin
619 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
621 nYOffset
-= nSliderLength
;
622 nUsedHeight
+= nSliderLength
;
623 ::WinSetWindowPos( (HWND
)m_hStaticMax
629 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
636 // If we're prepared to use the existing size, then...
638 if (nWidth
== -1 && nHeight
== -1 &&
639 ((nSizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
))
649 ::WinSetWindowPos( GetHwnd()
655 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
659 } // end of void wxSlider::DoSetSize
661 int wxSlider::GetLineSize() const
664 } // end of wxSlider::GetLineSize
666 int wxSlider::GetPageSize() const
669 } // end of wxSlider::GetPageSize
671 void wxSlider::GetPosition(
676 wxWindowOS2
* pParent
= GetParent();
683 wxFindMaxSize( GetHWND()
688 wxFindMaxSize( m_hStaticMin
692 wxFindMaxSize( m_hStaticMax
696 wxFindMaxSize( m_hStaticValue
701 // Since we now have the absolute screen coords,
702 // if there's a parent we must subtract its top left corner
706 vPoint
.x
= vRect
.xLeft
;
707 vPoint
.y
= vRect
.yTop
;
713 ::WinQueryWindowPos((HWND
)pParent
->GetHWND(), &vSwp
);
719 // We may be faking the client origin.
720 // So a window that's really at (0, 30) may appear
721 // (to wxWin apps) to be at (0, 0).
725 wxPoint
vPt(GetParent()->GetClientAreaOrigin());
732 } // end of wxSlider::GetPosition
734 int wxSlider::GetSelEnd() const
737 } // end of wxSlider::GetSelEnd
739 int wxSlider::GetSelStart() const
742 } // end of wxSlider::GetSelStart
744 void wxSlider::GetSize(
756 wxFindMaxSize( GetHWND()
761 wxFindMaxSize( m_hStaticMin
765 wxFindMaxSize( m_hStaticMax
769 wxFindMaxSize( m_hStaticValue
772 *pnWidth
= vRect
.xRight
- vRect
.xLeft
;
773 *pnHeight
= vRect
.yBottom
- vRect
.yTop
;
774 } // end of wxSlider::GetSize
776 int wxSlider::GetThumbLength() const
778 return m_nThumbLength
;
779 } // end of wxSlider::GetThumbLength
781 int wxSlider::GetValue() const
783 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
785 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
791 double dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
793 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
795 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
801 nNewPos
= (int)(nPixelPos
/dPixelToRange
);
802 if (nNewPos
> (m_nRangeMax
- m_nRangeMin
)/2)
805 } // end of wxSlider::GetValue
807 WXHBRUSH
wxSlider::OnCtlColor(
816 return (wxControl::OnCtlColor( hDC
824 } // end of wxSlider::OnCtlColor
826 bool wxSlider::OS2OnScroll(
827 int WXUNUSED(nOrientation
)
833 wxEventType eScrollEvent
= wxEVT_NULL
;
838 if (m_windowStyle
& wxSL_TOP
)
839 eScrollEvent
= wxEVT_SCROLL_TOP
;
840 else if (m_windowStyle
& wxSL_BOTTOM
)
841 eScrollEvent
= wxEVT_SCROLL_BOTTOM
;
844 case SLN_SLIDERTRACK
:
845 eScrollEvent
= wxEVT_SCROLL_THUMBTRACK
;
852 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
854 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
860 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
862 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
864 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
870 nNewPos
= (nPixelPos
/m_dPixelToRange
);
871 if (nNewPos
> (m_nRangeMax
- m_nRangeMin
)/2)
873 if ((nNewPos
< GetMin()) || (nNewPos
> GetMax()))
876 // Out of range - but we did process it
882 wxScrollEvent
vEvent( eScrollEvent
886 vEvent
.SetPosition(nNewPos
);
887 vEvent
.SetEventObject(this);
888 GetEventHandler()->ProcessEvent(vEvent
);
890 wxCommandEvent
vCevent( wxEVT_COMMAND_SLIDER_UPDATED
894 vCevent
.SetInt(nNewPos
);
895 vCevent
.SetEventObject(this);
896 return (GetEventHandler()->ProcessEvent(vCevent
));
897 } // end of wxSlider::OS2OnScroll
899 void wxSlider::SetLineSize(
903 m_nLineSize
= nLineSize
;
904 } // end of wxSlider::SetLineSize
907 void wxSlider::SetPageSize(
911 m_nPageSize
= nPageSize
;
912 } // end of wxSlider::SetPageSize
914 void wxSlider::SetRange(
921 m_nRangeMin
= nMinValue
;
922 m_nRangeMax
= nMaxValue
;
924 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
926 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
932 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
935 wxSprintf(zBuf
, wxT("%d"), m_nRangeMin
);
936 ::WinSetWindowText((HWND
)m_hStaticMin
, zBuf
);
941 wxSprintf(zBuf
, wxT("%d"), m_nRangeMax
);
942 ::WinSetWindowText((HWND
)m_hStaticMax
, zBuf
);
944 } // end of wxSlider::SetRange
946 void wxSlider::SetSelection(
947 int WXUNUSED(nMinPos
)
948 , int WXUNUSED(nMaxPos
)
951 } // end of wxSlider::SetSelection
953 void wxSlider::SetThumbLength(
959 m_nThumbLength
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
961 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
966 ) + 4; // for bordersizes
967 nBreadth
= SHORT2FROMMR(::WinSendMsg( GetHwnd()
969 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
975 ::WinSendMsg( GetHwnd()
977 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
980 ,MPFROM2SHORT(nLen
, nBreadth
)
982 m_nThumbLength
= nLen
+ 4; // Borders
983 } // end of wxSlider::SetThumbLength
985 void wxSlider::SetTick(
989 nTickPos
*= m_dPixelToRange
;
990 ::WinSendMsg( GetHwnd()
992 ,MPFROMSHORT(nTickPos
)
995 } // end of wxSlider::SetTick
997 // For trackbars only
998 void wxSlider::SetTickFreq(
1004 WNDPARAMS vWndParams
;
1008 vSlData
.cbSize
= sizeof(SLDCDATA
);
1009 if (m_windowStyle
& wxSL_AUTOTICKS
)
1011 vSlData
.usScale1Spacing
= 0;
1012 vSlData
.usScale2Spacing
= 0;
1014 vSlData
.usScale1Increments
= (m_nRangeMax
- m_nRangeMin
)/n
;
1015 vSlData
.usScale2Increments
= (m_nRangeMax
- m_nRangeMin
)/n
;
1017 vWndParams
.fsStatus
= WPM_CTLDATA
;
1018 vWndParams
.cchText
= 0L;
1019 vWndParams
.pszText
= NULL
;
1020 vWndParams
.cbPresParams
= 0L;
1021 vWndParams
.pPresParams
= NULL
;
1022 vWndParams
.cbCtlData
= vSlData
.cbSize
;
1023 vWndParams
.pCtlData
= (PVOID
)&vSlData
;
1024 ::WinSendMsg(GetHwnd(), WM_SETWINDOWPARAMS
, (MPARAM
)&vWndParams
, (MPARAM
)0);
1025 for (i
= 1; i
< (m_nRangeMax
- m_nRangeMin
)/n
; i
++)
1027 nPixelPos
= i
* n
* m_dPixelToRange
;
1028 ::WinSendMsg( GetHwnd()
1030 ,MPFROMSHORT(nPixelPos
)
1034 } // end of wxSlider::SetTickFreq
1036 void wxSlider::SetValue(
1040 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1041 ,SLM_QUERYSLIDERINFO
1042 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
1048 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1049 ,SLM_QUERYSLIDERINFO
1050 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
1056 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
1057 int nNewPos
= (int)(nValue
* m_dPixelToRange
);
1059 ::WinSendMsg( GetHwnd()
1061 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
1068 wxSprintf(wxBuffer
, wxT("%d"), nValue
);
1069 ::WinSetWindowText((HWND
)m_hStaticValue
, wxBuffer
);
1071 } // end of wxSlider::SetValue
1073 bool wxSlider::Show(
1077 wxWindowOS2::Show(bShow
);
1079 ::WinShowWindow((HWND
)m_hStaticValue
, bShow
);
1081 ::WinShowWindow((HWND
)m_hStaticMin
, bShow
);
1083 ::WinShowWindow((HWND
)m_hStaticMax
, bShow
);
1085 } // end of wxSlider::Show