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"
23 #include <wx/scrolwin.h>
26 #include "wx/slider.h"
27 #include "wx/os2/private.h"
29 IMPLEMENT_DYNAMIC_CLASS(wxSlider
, wxControl
)
41 } // end of wxSlider::wxSlider
46 ::WinDestroyWindow((HWND
)m_hStaticMin
);
48 ::WinDestroyWindow((HWND
)m_hStaticMax
);
50 ::WinDestroyWindow((HWND
)m_hStaticValue
);
51 } // end of wxSlider::~wxSlider
53 void wxSlider::AdjustSubControls(
64 int nCx
; // slider,min,max sizes
69 wxGetCharSize( GetHWND()
75 if ((m_windowStyle
& wxSL_VERTICAL
) != wxSL_VERTICAL
)
77 if (m_windowStyle
& wxSL_LABELS
)
82 ::WinQueryWindowText((HWND
)m_hStaticMin
, 300, zBuf
);
83 GetTextExtent(zBuf
, &nMinLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
85 ::WinQueryWindowText((HWND
)m_hStaticMax
, 300, zBuf
);
86 GetTextExtent(zBuf
, &nMaxLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
90 int nNewWidth
= wxMax(nMinLen
, nMaxLen
);
91 int nValueHeight
= nCyf
;
93 ::WinSetWindowPos( (HWND
)m_hStaticValue
95 ,(LONG
)nXOffset
- (nNewWidth
+ nCx
+ nMinLen
+ nCx
)
102 ::WinSetWindowPos( (HWND
)m_hStaticMin
104 ,(LONG
)nXOffset
- (nMinLen
+ nCx
)
110 nXOffset
+= nWidth
+ nCx
;
112 ::WinSetWindowPos( (HWND
)m_hStaticMax
118 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
123 // Now deal with a vertical slider -- OS/2 doesn't have vertical sliders
125 } // end of wxSlider::AdjustSubControls
127 void wxSlider::ClearSel()
129 } // end of wxSlider::ClearSel
131 void wxSlider::ClearTicks()
133 } // end of wxSlider::ClearTicks
135 void wxSlider::Command (
136 wxCommandEvent
& rEvent
139 SetValue(rEvent
.GetInt());
140 ProcessCommand(rEvent
);
141 } // end of wxSlider::Command
143 bool wxSlider::ContainsHWND(
147 return ( hWnd
== GetStaticMin() ||
148 hWnd
== GetStaticMax() ||
149 hWnd
== GetEditValue()
151 } // end of wxSlider::ContainsHWND
153 bool wxSlider::Create(
159 , const wxPoint
& rPos
160 , const wxSize
& rSize
163 , const wxValidator
& rValidator
165 , const wxString
& rsName
170 int nWidth
= rSize
.x
;
171 int nHeight
= rSize
.y
;
177 SetValidator(rValidator
);
180 pParent
->AddChild(this);
181 SetBackgroundColour(pParent
->GetBackgroundColour()) ;
182 SetForegroundColour(pParent
->GetForegroundColour()) ;
189 m_windowStyle
= lStyle
;
193 m_windowId
= (int)NewControlId();
197 if (m_windowStyle
& wxCLIP_SIBLINGS
)
198 lMsStyle
|= WS_CLIPSIBLINGS
;
200 if (m_windowStyle
& wxSL_LABELS
)
202 lMsStyle
|= WS_VISIBLE
| SS_TEXT
| DT_VCENTER
;
204 m_hStaticValue
= (WXHWND
)::WinCreateWindow( (HWND
)GetHwndOf(pParent
) // Parent window handle
205 ,WC_STATIC
// Window class
206 ,(PSZ
)NULL
// Initial Text
207 ,(ULONG
)lMsStyle
// Style flags
208 ,0L, 0L, 0L, 0L // Origin -- 0 size
209 ,(HWND
)GetHwndOf(pParent
) // owner window handle (same as parent
210 ,HWND_TOP
// initial z position
211 ,(ULONG
)NewControlId() // Window identifier
212 ,NULL
// no control data
213 ,NULL
// no Presentation parameters
217 // Now create min static control
219 sprintf(wxBuffer
, "%d", nMinValue
);
220 lWstyle
= SS_TEXT
|DT_LEFT
|WS_VISIBLE
;
221 if (m_windowStyle
& wxCLIP_SIBLINGS
)
222 lWstyle
|= WS_CLIPSIBLINGS
;
224 m_hStaticMin
= (WXHWND
)::WinCreateWindow( (HWND
)GetHwndOf(pParent
) // Parent window handle
225 ,WC_STATIC
// Window class
226 ,(PSZ
)wxBuffer
// Initial Text
227 ,(ULONG
)lWstyle
// Style flags
228 ,0L, 0L, 0L, 0L // Origin -- 0 size
229 ,(HWND
)GetHwndOf(pParent
) // owner window handle (same as parent
230 ,HWND_TOP
// initial z position
231 ,(ULONG
)NewControlId() // Window identifier
232 ,NULL
// no control data
233 ,NULL
// no Presentation parameters
240 vSlData
.cbSize
= sizeof(SLDCDATA
);
241 if (m_windowStyle
& wxSL_VERTICAL
)
242 lMsStyle
= SLS_VERTICAL
| WS_VISIBLE
| WS_TABSTOP
;
244 lMsStyle
= SLS_HORIZONTAL
| WS_VISIBLE
| WS_TABSTOP
;
246 if (m_windowStyle
& wxCLIP_SIBLINGS
)
247 lMsStyle
|= WS_CLIPSIBLINGS
;
249 if (m_windowStyle
& wxSL_AUTOTICKS
)
251 vSlData
.usScale1Spacing
= 0;
252 vSlData
.usScale2Spacing
= 0;
255 if (m_windowStyle
& wxSL_LEFT
)
256 lMsStyle
|= SLS_PRIMARYSCALE2
; // if SLS_VERTICAL then SCALE2 is to the left
257 else if (m_windowStyle
& wxSL_RIGHT
)
258 lMsStyle
|= SLS_PRIMARYSCALE1
; // if SLS_VERTICAL then SCALE2 is to the right
259 else if (m_windowStyle
& wxSL_TOP
)
260 lMsStyle
|= SLS_PRIMARYSCALE1
; // if SLS_HORIZONTAL then SCALE1 is to the top
261 else if (m_windowStyle
& wxSL_BOTTOM
)
262 lMsStyle
|= SLS_PRIMARYSCALE2
; // if SLS_HORIZONTAL then SCALE1 is to the bottom
263 else if ( m_windowStyle
& wxSL_BOTH
)
264 lMsStyle
|= SLS_PRIMARYSCALE1
| SLS_PRIMARYSCALE2
;
266 lMsStyle
|= SLS_PRIMARYSCALE2
;
268 m_nPageSize
= ((nMaxValue
- nMinValue
)/10);
269 vSlData
.usScale1Increments
= m_nPageSize
;
270 vSlData
.usScale2Increments
= m_nPageSize
;
272 HWND hScrollBar
= ::WinCreateWindow( (HWND
)GetHwndOf(pParent
) // Parent window handle
273 ,WC_SLIDER
// Window class
274 ,(PSZ
)wxBuffer
// Initial Text
275 ,(ULONG
)lMsStyle
// Style flags
276 ,0L, 0L, 0L, 0L // Origin -- 0 size
277 ,(HWND
)GetHwndOf(pParent
) // owner window handle (same as parent
278 ,HWND_TOP
// initial z position
279 ,(HMENU
)m_windowId
// Window identifier
280 ,&vSlData
// Slider control data
281 ,NULL
// no Presentation parameters
283 m_nRangeMax
= nMaxValue
;
284 m_nRangeMin
= nMinValue
;
287 // Set the size of the ticks ... default to 6 pixels
289 ::WinSendMsg( hScrollBar
291 ,MPFROM2SHORT(SMA_SETALLTICKS
, 6)
295 // Set the position to the initial value
297 ::WinSendMsg( hScrollBar
299 ,MPFROM2SHORT(SMA_SLIDERARMPOSITION
, SMA_RANGEVALUE
)
303 m_hWnd
= (WXHWND
)hScrollBar
;
304 SubclassWin(GetHWND());
305 ::WinSetWindowText((HWND
)m_hWnd
, "");
307 wxFont
* pTextFont
= new wxFont( 10
313 if (m_windowStyle
& wxSL_LABELS
)
316 // Finally, create max value static item
318 sprintf(wxBuffer
, "%d", nMaxValue
);
319 lWstyle
= SS_TEXT
|DT_LEFT
|WS_VISIBLE
;
320 if (m_windowStyle
& wxCLIP_SIBLINGS
)
321 lMsStyle
|= WS_CLIPSIBLINGS
;
323 m_hStaticMax
= (WXHWND
)::WinCreateWindow( (HWND
)GetHwndOf(pParent
) // Parent window handle
324 ,WC_STATIC
// Window class
325 ,(PSZ
)wxBuffer
// Initial Text
326 ,(ULONG
)lWstyle
// Style flags
327 ,0L, 0L, 0L, 0L // Origin -- 0 size
328 ,(HWND
)GetHwndOf(pParent
) // owner window handle (same as parent
329 ,HWND_TOP
// initial z position
330 ,(ULONG
)NewControlId() // Window identifier
331 ,NULL
// no control data
332 ,NULL
// no Presentation parameters
336 if (GetFont().GetResourceHandle())
339 wxOS2SetFont( m_hStaticMin
343 wxOS2SetFont( m_hStaticMax
347 wxOS2SetFont( m_hStaticValue
359 m_nThumbLength
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
361 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
366 ) + 4; // for bordersizes
370 vColour
.Set(wxString("BLACK"));
372 LONG lColor
= (LONG
)vColour
.GetPixel();
374 ::WinSetPresParam( m_hStaticMin
379 ::WinSetPresParam( m_hStaticMax
384 ::WinSetPresParam( m_hStaticValue
389 ::WinSetPresParam( m_hWnd
394 lColor
= (LONG
)m_backgroundColour
.GetPixel();
395 ::WinSetPresParam( m_hStaticMin
400 ::WinSetPresParam( m_hStaticMax
405 ::WinSetPresParam( m_hStaticValue
410 ::WinSetPresParam( m_hWnd
418 } // end of wxSlider::Create
420 void wxSlider::DoSetSize(
430 int nWidth1
= nWidth
;
431 int nHeight1
= nHeight
;
434 int nCx
; // slider,min,max sizes
442 // Adjust for OS/2's reverse coordinate system
444 wxWindowOS2
* pParent
= (wxWindowOS2
*)GetParent();
446 int nOS2Height
= nHeight
;
453 int nOS2ParentHeight
= GetOS2ParentHeight(pParent
);
455 nYOffset
= nOS2ParentHeight
- (nYOffset
+ nOS2Height
);
457 nY1
= nOS2ParentHeight
- (nY1
+ nOS2Height
);
463 ::WinQueryWindowRect(HWND_DESKTOP
, &vRect
);
464 nYOffset
= vRect
.yTop
- (nYOffset
+ nOS2Height
);
466 nY1
= vRect
.yTop
- (nY1
+ nOS2Height
);
468 m_nSizeFlags
= nSizeFlags
;
470 GetPosition( &nCurrentX
473 if (nX
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
475 if (nY
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
478 AdjustForParentClientOrigin( nX1
482 wxGetCharSize( GetHWND()
488 if ((m_windowStyle
& wxSL_VERTICAL
) != wxSL_VERTICAL
)
490 if (m_windowStyle
& wxSL_LABELS
)
495 ::WinQueryWindowText((HWND
)m_hStaticMin
, 300, zBuf
);
496 GetTextExtent(zBuf
, &nMinLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
497 ::WinQueryWindowText((HWND
)m_hStaticMax
, 300, zBuf
);
498 GetTextExtent(zBuf
, &nMaxLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
502 int nNewWidth
= (wxMax(nMinLen
, nMaxLen
));
503 int nValueHeight
= nCyf
;
505 ::WinSetWindowPos( (HWND
)m_hStaticValue
508 ,(LONG
)nYOffset
- (nCyf
* 1.2)
511 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
513 nXOffset
+= nNewWidth
+ nCx
;
515 ::WinSetWindowPos( (HWND
)m_hStaticMin
518 ,(LONG
)nYOffset
- nCyf
521 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
523 nXOffset
+= nMinLen
+ nCx
;
525 int nSliderLength
= nWidth1
- nXOffset
- nMaxLen
- nCx
;
526 int nSliderHeight
= nHeight1
;
528 if (nSliderHeight
< 0)
532 // Slider must have a minimum/default length/height
534 if (nSliderLength
< 100)
537 ::WinSetWindowPos( GetHwnd()
543 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
545 nXOffset
+= nSliderLength
+ nCx
;
547 ::WinSetWindowPos( (HWND
)m_hStaticMax
550 ,(LONG
)nYOffset
- nCyf
553 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
560 // If we're prepared to use the existing size, then...
562 if (nWidth
== -1 && nHeight
== -1 &&
563 ((nSizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
))
573 ::WinSetWindowPos( GetHwnd()
579 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
585 // Now deal with a vertical slider
589 if (m_windowStyle
& wxSL_LABELS
)
594 ::WinQueryWindowText((HWND
)m_hStaticMin
, 300, zBuf
);
595 GetTextExtent(zBuf
, &nMinLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
596 ::WinQueryWindowText((HWND
)m_hStaticMax
, 300, zBuf
);
597 GetTextExtent(zBuf
, &nMaxLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
600 int nNewWidth
= wxMax(nMinLen
, nMaxLen
);
601 int nValueHeight
= nCyf
;
606 // The height needs to be a bit bigger under Win95 if using native
609 nValueHeight
= (int)(nValueHeight
* 1.5);
610 ::WinSetWindowPos( (HWND
)m_hStaticValue
616 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
618 nYOffset
-= nValueHeight
;
619 nUsedHeight
+= nValueHeight
;
621 ::WinSetWindowPos( (HWND
)m_hStaticMin
627 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
632 int nSliderLength
= nHeight1
- (nUsedHeight
+ (2 * nCy
));
633 int nSliderWidth
= nWidth1
;
635 if (nSliderWidth
< 0)
639 // Slider must have a minimum/default length
641 if (nSliderLength
< 100)
644 ::WinSetWindowPos( (HWND
)m_hStaticMin
650 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
652 nYOffset
-= nSliderLength
;
653 nUsedHeight
+= nSliderLength
;
654 ::WinSetWindowPos( (HWND
)m_hStaticMax
660 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
667 // If we're prepared to use the existing size, then...
669 if (nWidth
== -1 && nHeight
== -1 &&
670 ((nSizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
))
680 ::WinSetWindowPos( GetHwnd()
686 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
690 } // end of void wxSlider::DoSetSize
692 int wxSlider::GetLineSize() const
695 } // end of wxSlider::GetLineSize
697 int wxSlider::GetPageSize() const
700 } // end of wxSlider::GetPageSize
702 void wxSlider::GetPosition(
707 wxWindowOS2
* pParent
= GetParent();
714 wxFindMaxSize( GetHWND()
719 wxFindMaxSize( m_hStaticMin
723 wxFindMaxSize( m_hStaticMax
727 wxFindMaxSize( m_hStaticValue
732 // Since we now have the absolute screen coords,
733 // if there's a parent we must subtract its top left corner
737 vPoint
.x
= vRect
.xLeft
;
738 vPoint
.y
= vRect
.yTop
;
744 ::WinQueryWindowPos((HWND
)pParent
->GetHWND(), &vSwp
);
750 // We may be faking the client origin.
751 // So a window that's really at (0, 30) may appear
752 // (to wxWin apps) to be at (0, 0).
756 wxPoint
vPt(GetParent()->GetClientAreaOrigin());
763 } // end of wxSlider::GetPosition
765 int wxSlider::GetSelEnd() const
768 } // end of wxSlider::GetSelEnd
770 int wxSlider::GetSelStart() const
773 } // end of wxSlider::GetSelStart
775 void wxSlider::GetSize(
787 wxFindMaxSize( GetHWND()
792 wxFindMaxSize( m_hStaticMin
796 wxFindMaxSize( m_hStaticMax
800 wxFindMaxSize( m_hStaticValue
803 *pnWidth
= vRect
.xRight
- vRect
.xLeft
;
804 *pnHeight
= vRect
.yBottom
- vRect
.yTop
;
805 } // end of wxSlider::GetSize
807 int wxSlider::GetThumbLength() const
809 return m_nThumbLength
;
810 } // end of wxSlider::GetThumbLength
812 int wxSlider::GetValue() const
814 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
816 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
822 double dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
824 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
826 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
832 nNewPos
= (int)(nPixelPos
/dPixelToRange
);
833 if (nNewPos
> (m_nRangeMax
- m_nRangeMin
)/2)
836 } // end of wxSlider::GetValue
838 WXHBRUSH
wxSlider::OnCtlColor(
847 return (wxControl::OnCtlColor( hDC
855 } // end of wxSlider::OnCtlColor
857 bool wxSlider::OS2OnScroll(
858 int WXUNUSED(nOrientation
)
864 wxEventType eScrollEvent
= wxEVT_NULL
;
869 if (m_windowStyle
& wxSL_TOP
)
870 eScrollEvent
= wxEVT_SCROLL_TOP
;
871 else if (m_windowStyle
& wxSL_BOTTOM
)
872 eScrollEvent
= wxEVT_SCROLL_BOTTOM
;
875 case SLN_SLIDERTRACK
:
876 eScrollEvent
= wxEVT_SCROLL_THUMBTRACK
;
883 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
885 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
891 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
893 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
895 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
901 nNewPos
= (nPixelPos
/m_dPixelToRange
);
902 if (nNewPos
> (m_nRangeMax
- m_nRangeMin
)/2)
904 if ((nNewPos
< GetMin()) || (nNewPos
> GetMax()))
907 // Out of range - but we did process it
913 wxScrollEvent
vEvent( eScrollEvent
917 vEvent
.SetPosition(nNewPos
);
918 vEvent
.SetEventObject(this);
919 GetEventHandler()->ProcessEvent(vEvent
);
921 wxCommandEvent
vCevent( wxEVT_COMMAND_SLIDER_UPDATED
925 vCevent
.SetInt(nNewPos
);
926 vCevent
.SetEventObject(this);
927 return (GetEventHandler()->ProcessEvent(vCevent
));
928 } // end of wxSlider::OS2OnScroll
930 void wxSlider::SetLineSize(
934 m_nLineSize
= nLineSize
;
935 } // end of wxSlider::SetLineSize
938 void wxSlider::SetPageSize(
942 m_nPageSize
= nPageSize
;
943 } // end of wxSlider::SetPageSize
945 void wxSlider::SetRange(
952 m_nRangeMin
= nMinValue
;
953 m_nRangeMax
= nMaxValue
;
955 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
957 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
963 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
966 wxSprintf(zBuf
, wxT("%d"), m_nRangeMin
);
967 ::WinSetWindowText((HWND
)m_hStaticMin
, zBuf
);
972 wxSprintf(zBuf
, wxT("%d"), m_nRangeMax
);
973 ::WinSetWindowText((HWND
)m_hStaticMax
, zBuf
);
975 } // end of wxSlider::SetRange
977 void wxSlider::SetSelection(
978 int WXUNUSED(nMinPos
)
979 , int WXUNUSED(nMaxPos
)
982 } // end of wxSlider::SetSelection
984 void wxSlider::SetThumbLength(
990 m_nThumbLength
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
992 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
997 ) + 4; // for bordersizes
998 nBreadth
= SHORT2FROMMR(::WinSendMsg( GetHwnd()
1000 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
1006 ::WinSendMsg( GetHwnd()
1008 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
1011 ,MPFROM2SHORT(nLen
, nBreadth
)
1013 m_nThumbLength
= nLen
+ 4; // Borders
1014 } // end of wxSlider::SetThumbLength
1016 void wxSlider::SetTick(
1020 nTickPos
*= m_dPixelToRange
;
1021 ::WinSendMsg( GetHwnd()
1023 ,MPFROMSHORT(nTickPos
)
1026 } // end of wxSlider::SetTick
1028 // For trackbars only
1029 void wxSlider::SetTickFreq(
1035 WNDPARAMS vWndParams
;
1039 vSlData
.cbSize
= sizeof(SLDCDATA
);
1040 if (m_windowStyle
& wxSL_AUTOTICKS
)
1042 vSlData
.usScale1Spacing
= 0;
1043 vSlData
.usScale2Spacing
= 0;
1045 vSlData
.usScale1Increments
= (m_nRangeMax
- m_nRangeMin
)/n
;
1046 vSlData
.usScale2Increments
= (m_nRangeMax
- m_nRangeMin
)/n
;
1048 vWndParams
.fsStatus
= WPM_CTLDATA
;
1049 vWndParams
.cchText
= 0L;
1050 vWndParams
.pszText
= NULL
;
1051 vWndParams
.cbPresParams
= 0L;
1052 vWndParams
.pPresParams
= NULL
;
1053 vWndParams
.cbCtlData
= vSlData
.cbSize
;
1054 vWndParams
.pCtlData
= (PVOID
)&vSlData
;
1055 ::WinSendMsg(GetHwnd(), WM_SETWINDOWPARAMS
, (MPARAM
)&vWndParams
, (MPARAM
)0);
1056 for (i
= 1; i
< (m_nRangeMax
- m_nRangeMin
)/n
; i
++)
1058 nPixelPos
= i
* n
* m_dPixelToRange
;
1059 ::WinSendMsg( GetHwnd()
1061 ,MPFROMSHORT(nPixelPos
)
1065 } // end of wxSlider::SetTickFreq
1067 void wxSlider::SetValue(
1071 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1072 ,SLM_QUERYSLIDERINFO
1073 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
1079 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1080 ,SLM_QUERYSLIDERINFO
1081 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
1087 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
1088 int nNewPos
= (int)(nValue
* m_dPixelToRange
);
1090 ::WinSendMsg( GetHwnd()
1092 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
1099 wxSprintf(wxBuffer
, wxT("%d"), nValue
);
1100 ::WinSetWindowText((HWND
)m_hStaticValue
, wxBuffer
);
1102 } // end of wxSlider::SetValue
1104 bool wxSlider::Show(
1108 wxWindowOS2::Show(bShow
);
1110 ::WinShowWindow((HWND
)m_hStaticValue
, bShow
);
1112 ::WinShowWindow((HWND
)m_hStaticMin
, bShow
);
1114 ::WinShowWindow((HWND
)m_hStaticMax
, bShow
);
1116 } // end of wxSlider::Show