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
385 lColor
= (LONG
)m_backgroundColour
.GetPixel();
386 ::WinSetPresParam( m_hStaticMin
391 ::WinSetPresParam( m_hStaticMax
396 ::WinSetPresParam( m_hStaticValue
401 ::WinSetPresParam( m_hWnd
408 } // end of wxSlider::Create
410 void wxSlider::DoSetSize(
420 int nWidth1
= nWidth
;
421 int nHeight1
= nHeight
;
424 int nCx
; // slider,min,max sizes
432 // Adjust for OS/2's reverse coordinate system
434 wxWindowOS2
* pParent
= (wxWindowOS2
*)GetParent();
436 int nOS2Height
= nHeight
;
443 int nOS2ParentHeight
= GetOS2ParentHeight(pParent
);
445 nYOffset
= nOS2ParentHeight
- (nYOffset
+ nOS2Height
);
447 nY1
= nOS2ParentHeight
- (nY1
+ nOS2Height
);
453 ::WinQueryWindowRect(HWND_DESKTOP
, &vRect
);
454 nYOffset
= vRect
.yTop
- (nYOffset
+ nOS2Height
);
456 nY1
= vRect
.yTop
- (nY1
+ nOS2Height
);
458 m_nSizeFlags
= nSizeFlags
;
460 GetPosition( &nCurrentX
463 if (nX
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
465 if (nY
== -1 && !(nSizeFlags
& wxSIZE_ALLOW_MINUS_ONE
))
468 AdjustForParentClientOrigin( nX1
472 wxGetCharSize( GetHWND()
478 if ((m_windowStyle
& wxSL_VERTICAL
) != wxSL_VERTICAL
)
480 if (m_windowStyle
& wxSL_LABELS
)
485 ::WinQueryWindowText((HWND
)m_hStaticMin
, 300, zBuf
);
486 GetTextExtent(zBuf
, &nMinLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
487 ::WinQueryWindowText((HWND
)m_hStaticMax
, 300, zBuf
);
488 GetTextExtent(zBuf
, &nMaxLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
492 int nNewWidth
= (wxMax(nMinLen
, nMaxLen
));
493 int nValueHeight
= nCyf
;
495 ::WinSetWindowPos( (HWND
)m_hStaticValue
498 ,(LONG
)nYOffset
- (nCyf
* 1.2)
501 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
503 nXOffset
+= nNewWidth
+ nCx
;
505 ::WinSetWindowPos( (HWND
)m_hStaticMin
508 ,(LONG
)nYOffset
- nCyf
511 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
513 nXOffset
+= nMinLen
+ nCx
;
515 int nSliderLength
= nWidth1
- nXOffset
- nMaxLen
- nCx
;
516 int nSliderHeight
= nHeight1
;
518 if (nSliderHeight
< 0)
522 // Slider must have a minimum/default length/height
524 if (nSliderLength
< 100)
527 ::WinSetWindowPos( GetHwnd()
533 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
535 nXOffset
+= nSliderLength
+ nCx
;
537 ::WinSetWindowPos( (HWND
)m_hStaticMax
540 ,(LONG
)nYOffset
- nCyf
543 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
550 // If we're prepared to use the existing size, then...
552 if (nWidth
== -1 && nHeight
== -1 &&
553 ((nSizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
))
563 ::WinSetWindowPos( GetHwnd()
569 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
575 // Now deal with a vertical slider
579 if (m_windowStyle
& wxSL_LABELS
)
584 ::WinQueryWindowText((HWND
)m_hStaticMin
, 300, zBuf
);
585 GetTextExtent(zBuf
, &nMinLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
586 ::WinQueryWindowText((HWND
)m_hStaticMax
, 300, zBuf
);
587 GetTextExtent(zBuf
, &nMaxLen
, &nCyf
, NULL
, NULL
, &this->GetFont());
590 int nNewWidth
= wxMax(nMinLen
, nMaxLen
);
591 int nValueHeight
= nCyf
;
596 // The height needs to be a bit bigger under Win95 if using native
599 nValueHeight
= (int)(nValueHeight
* 1.5);
600 ::WinSetWindowPos( (HWND
)m_hStaticValue
606 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
608 nYOffset
-= nValueHeight
;
609 nUsedHeight
+= nValueHeight
;
611 ::WinSetWindowPos( (HWND
)m_hStaticMin
617 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
622 int nSliderLength
= nHeight1
- (nUsedHeight
+ (2 * nCy
));
623 int nSliderWidth
= nWidth1
;
625 if (nSliderWidth
< 0)
629 // Slider must have a minimum/default length
631 if (nSliderLength
< 100)
634 ::WinSetWindowPos( (HWND
)m_hStaticMin
640 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
642 nYOffset
-= nSliderLength
;
643 nUsedHeight
+= nSliderLength
;
644 ::WinSetWindowPos( (HWND
)m_hStaticMax
650 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
657 // If we're prepared to use the existing size, then...
659 if (nWidth
== -1 && nHeight
== -1 &&
660 ((nSizeFlags
& wxSIZE_AUTO
) != wxSIZE_AUTO
))
670 ::WinSetWindowPos( GetHwnd()
676 ,SWP_ZORDER
| SWP_SIZE
| SWP_MOVE
| SWP_SHOW
680 } // end of void wxSlider::DoSetSize
682 int wxSlider::GetLineSize() const
685 } // end of wxSlider::GetLineSize
687 int wxSlider::GetPageSize() const
690 } // end of wxSlider::GetPageSize
692 void wxSlider::GetPosition(
697 wxWindowOS2
* pParent
= GetParent();
704 wxFindMaxSize( GetHWND()
709 wxFindMaxSize( m_hStaticMin
713 wxFindMaxSize( m_hStaticMax
717 wxFindMaxSize( m_hStaticValue
722 // Since we now have the absolute screen coords,
723 // if there's a parent we must subtract its top left corner
727 vPoint
.x
= vRect
.xLeft
;
728 vPoint
.y
= vRect
.yTop
;
734 ::WinQueryWindowPos((HWND
)pParent
->GetHWND(), &vSwp
);
740 // We may be faking the client origin.
741 // So a window that's really at (0, 30) may appear
742 // (to wxWin apps) to be at (0, 0).
746 wxPoint
vPt(GetParent()->GetClientAreaOrigin());
753 } // end of wxSlider::GetPosition
755 int wxSlider::GetSelEnd() const
758 } // end of wxSlider::GetSelEnd
760 int wxSlider::GetSelStart() const
763 } // end of wxSlider::GetSelStart
765 void wxSlider::GetSize(
777 wxFindMaxSize( GetHWND()
782 wxFindMaxSize( m_hStaticMin
786 wxFindMaxSize( m_hStaticMax
790 wxFindMaxSize( m_hStaticValue
793 *pnWidth
= vRect
.xRight
- vRect
.xLeft
;
794 *pnHeight
= vRect
.yBottom
- vRect
.yTop
;
795 } // end of wxSlider::GetSize
797 int wxSlider::GetThumbLength() const
799 return m_nThumbLength
;
800 } // end of wxSlider::GetThumbLength
802 int wxSlider::GetValue() const
804 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
806 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
812 double dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
814 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
816 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
822 nNewPos
= (int)(nPixelPos
/dPixelToRange
);
823 if (nNewPos
> (m_nRangeMax
- m_nRangeMin
)/2)
826 } // end of wxSlider::GetValue
828 WXHBRUSH
wxSlider::OnCtlColor(
837 return (wxControl::OnCtlColor( hDC
845 } // end of wxSlider::OnCtlColor
847 bool wxSlider::OS2OnScroll(
848 int WXUNUSED(nOrientation
)
854 wxEventType eScrollEvent
= wxEVT_NULL
;
859 if (m_windowStyle
& wxSL_TOP
)
860 eScrollEvent
= wxEVT_SCROLL_TOP
;
861 else if (m_windowStyle
& wxSL_BOTTOM
)
862 eScrollEvent
= wxEVT_SCROLL_BOTTOM
;
865 case SLN_SLIDERTRACK
:
866 eScrollEvent
= wxEVT_SCROLL_THUMBTRACK
;
873 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
875 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
881 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
883 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
885 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
891 nNewPos
= (nPixelPos
/m_dPixelToRange
);
892 if (nNewPos
> (m_nRangeMax
- m_nRangeMin
)/2)
894 if ((nNewPos
< GetMin()) || (nNewPos
> GetMax()))
897 // Out of range - but we did process it
903 wxScrollEvent
vEvent( eScrollEvent
907 vEvent
.SetPosition(nNewPos
);
908 vEvent
.SetEventObject(this);
909 GetEventHandler()->ProcessEvent(vEvent
);
911 wxCommandEvent
vCevent( wxEVT_COMMAND_SLIDER_UPDATED
915 vCevent
.SetInt(nNewPos
);
916 vCevent
.SetEventObject(this);
917 return (GetEventHandler()->ProcessEvent(vCevent
));
918 } // end of wxSlider::OS2OnScroll
920 void wxSlider::SetLineSize(
924 m_nLineSize
= nLineSize
;
925 } // end of wxSlider::SetLineSize
928 void wxSlider::SetPageSize(
932 m_nPageSize
= nPageSize
;
933 } // end of wxSlider::SetPageSize
935 void wxSlider::SetRange(
942 m_nRangeMin
= nMinValue
;
943 m_nRangeMax
= nMaxValue
;
945 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
947 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
953 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
956 wxSprintf(zBuf
, wxT("%d"), m_nRangeMin
);
957 ::WinSetWindowText((HWND
)m_hStaticMin
, zBuf
);
962 wxSprintf(zBuf
, wxT("%d"), m_nRangeMax
);
963 ::WinSetWindowText((HWND
)m_hStaticMax
, zBuf
);
965 } // end of wxSlider::SetRange
967 void wxSlider::SetSelection(
968 int WXUNUSED(nMinPos
)
969 , int WXUNUSED(nMaxPos
)
972 } // end of wxSlider::SetSelection
974 void wxSlider::SetThumbLength(
980 m_nThumbLength
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
982 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
987 ) + 4; // for bordersizes
988 nBreadth
= SHORT2FROMMR(::WinSendMsg( GetHwnd()
990 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
996 ::WinSendMsg( GetHwnd()
998 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
1001 ,MPFROM2SHORT(nLen
, nBreadth
)
1003 m_nThumbLength
= nLen
+ 4; // Borders
1004 } // end of wxSlider::SetThumbLength
1006 void wxSlider::SetTick(
1010 nTickPos
*= m_dPixelToRange
;
1011 ::WinSendMsg( GetHwnd()
1013 ,MPFROMSHORT(nTickPos
)
1016 } // end of wxSlider::SetTick
1018 // For trackbars only
1019 void wxSlider::SetTickFreq(
1025 WNDPARAMS vWndParams
;
1029 vSlData
.cbSize
= sizeof(SLDCDATA
);
1030 if (m_windowStyle
& wxSL_AUTOTICKS
)
1032 vSlData
.usScale1Spacing
= 0;
1033 vSlData
.usScale2Spacing
= 0;
1035 vSlData
.usScale1Increments
= (m_nRangeMax
- m_nRangeMin
)/n
;
1036 vSlData
.usScale2Increments
= (m_nRangeMax
- m_nRangeMin
)/n
;
1038 vWndParams
.fsStatus
= WPM_CTLDATA
;
1039 vWndParams
.cchText
= 0L;
1040 vWndParams
.pszText
= NULL
;
1041 vWndParams
.cbPresParams
= 0L;
1042 vWndParams
.pPresParams
= NULL
;
1043 vWndParams
.cbCtlData
= vSlData
.cbSize
;
1044 vWndParams
.pCtlData
= (PVOID
)&vSlData
;
1045 ::WinSendMsg(GetHwnd(), WM_SETWINDOWPARAMS
, (MPARAM
)&vWndParams
, (MPARAM
)0);
1046 for (i
= 1; i
< (m_nRangeMax
- m_nRangeMin
)/n
; i
++)
1048 nPixelPos
= i
* n
* m_dPixelToRange
;
1049 ::WinSendMsg( GetHwnd()
1051 ,MPFROMSHORT(nPixelPos
)
1055 } // end of wxSlider::SetTickFreq
1057 void wxSlider::SetValue(
1061 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1062 ,SLM_QUERYSLIDERINFO
1063 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
1069 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1070 ,SLM_QUERYSLIDERINFO
1071 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
1077 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
1078 int nNewPos
= (int)(nValue
* m_dPixelToRange
);
1080 ::WinSendMsg( GetHwnd()
1082 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
1089 wxSprintf(wxBuffer
, wxT("%d"), nValue
);
1090 ::WinSetWindowText((HWND
)m_hStaticValue
, wxBuffer
);
1092 } // end of wxSlider::SetValue
1094 bool wxSlider::Show(
1098 wxWindowOS2::Show(bShow
);
1100 ::WinShowWindow((HWND
)m_hStaticValue
, bShow
);
1102 ::WinShowWindow((HWND
)m_hStaticMin
, bShow
);
1104 ::WinShowWindow((HWND
)m_hStaticMax
, bShow
);
1106 } // end of wxSlider::Show