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::DoGetSize(
783 } // end of wxSlider::DoGetSize
785 void wxSlider::GetSize(
797 wxFindMaxSize( GetHWND()
802 wxFindMaxSize( m_hStaticMin
806 wxFindMaxSize( m_hStaticMax
810 wxFindMaxSize( m_hStaticValue
813 *pnWidth
= vRect
.xRight
- vRect
.xLeft
;
814 *pnHeight
= vRect
.yBottom
- vRect
.yTop
;
815 } // end of wxSlider::GetSize
817 int wxSlider::GetThumbLength() const
819 return m_nThumbLength
;
820 } // end of wxSlider::GetThumbLength
822 int wxSlider::GetValue() const
824 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
826 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
832 double dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
834 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
836 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
842 nNewPos
= (int)(nPixelPos
/dPixelToRange
);
843 if (nNewPos
> (m_nRangeMax
- m_nRangeMin
)/2)
846 } // end of wxSlider::GetValue
848 WXHBRUSH
wxSlider::OnCtlColor(
857 return (wxControl::OnCtlColor( hDC
865 } // end of wxSlider::OnCtlColor
867 bool wxSlider::OS2OnScroll(
868 int WXUNUSED(nOrientation
)
874 wxEventType eScrollEvent
= wxEVT_NULL
;
879 if (m_windowStyle
& wxSL_TOP
)
880 eScrollEvent
= wxEVT_SCROLL_TOP
;
881 else if (m_windowStyle
& wxSL_BOTTOM
)
882 eScrollEvent
= wxEVT_SCROLL_BOTTOM
;
885 case SLN_SLIDERTRACK
:
886 eScrollEvent
= wxEVT_SCROLL_THUMBTRACK
;
893 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
895 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
901 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
903 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
905 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
911 nNewPos
= (nPixelPos
/m_dPixelToRange
);
912 if (nNewPos
> (m_nRangeMax
- m_nRangeMin
)/2)
914 if ((nNewPos
< GetMin()) || (nNewPos
> GetMax()))
917 // Out of range - but we did process it
923 wxScrollEvent
vEvent( eScrollEvent
927 vEvent
.SetPosition(nNewPos
);
928 vEvent
.SetEventObject(this);
929 GetEventHandler()->ProcessEvent(vEvent
);
931 wxCommandEvent
vCevent( wxEVT_COMMAND_SLIDER_UPDATED
935 vCevent
.SetInt(nNewPos
);
936 vCevent
.SetEventObject(this);
937 return (GetEventHandler()->ProcessEvent(vCevent
));
938 } // end of wxSlider::OS2OnScroll
940 void wxSlider::SetLineSize(
944 m_nLineSize
= nLineSize
;
945 } // end of wxSlider::SetLineSize
948 void wxSlider::SetPageSize(
952 m_nPageSize
= nPageSize
;
953 } // end of wxSlider::SetPageSize
955 void wxSlider::SetRange(
962 m_nRangeMin
= nMinValue
;
963 m_nRangeMax
= nMaxValue
;
965 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
967 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
973 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
976 wxSprintf(zBuf
, wxT("%d"), m_nRangeMin
);
977 ::WinSetWindowText((HWND
)m_hStaticMin
, zBuf
);
982 wxSprintf(zBuf
, wxT("%d"), m_nRangeMax
);
983 ::WinSetWindowText((HWND
)m_hStaticMax
, zBuf
);
985 } // end of wxSlider::SetRange
987 void wxSlider::SetSelection(
988 int WXUNUSED(nMinPos
)
989 , int WXUNUSED(nMaxPos
)
992 } // end of wxSlider::SetSelection
994 void wxSlider::SetThumbLength(
1000 m_nThumbLength
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1001 ,SLM_QUERYSLIDERINFO
1002 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
1007 ) + 4; // for bordersizes
1008 nBreadth
= SHORT2FROMMR(::WinSendMsg( GetHwnd()
1009 ,SLM_QUERYSLIDERINFO
1010 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
1016 ::WinSendMsg( GetHwnd()
1018 ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
1021 ,MPFROM2SHORT(nLen
, nBreadth
)
1023 m_nThumbLength
= nLen
+ 4; // Borders
1024 } // end of wxSlider::SetThumbLength
1026 void wxSlider::SetTick(
1030 nTickPos
*= m_dPixelToRange
;
1031 ::WinSendMsg( GetHwnd()
1033 ,MPFROMSHORT(nTickPos
)
1036 } // end of wxSlider::SetTick
1038 // For trackbars only
1039 void wxSlider::SetTickFreq(
1045 WNDPARAMS vWndParams
;
1049 vSlData
.cbSize
= sizeof(SLDCDATA
);
1050 if (m_windowStyle
& wxSL_AUTOTICKS
)
1052 vSlData
.usScale1Spacing
= 0;
1053 vSlData
.usScale2Spacing
= 0;
1055 vSlData
.usScale1Increments
= (m_nRangeMax
- m_nRangeMin
)/n
;
1056 vSlData
.usScale2Increments
= (m_nRangeMax
- m_nRangeMin
)/n
;
1058 vWndParams
.fsStatus
= WPM_CTLDATA
;
1059 vWndParams
.cchText
= 0L;
1060 vWndParams
.pszText
= NULL
;
1061 vWndParams
.cbPresParams
= 0L;
1062 vWndParams
.pPresParams
= NULL
;
1063 vWndParams
.cbCtlData
= vSlData
.cbSize
;
1064 vWndParams
.pCtlData
= (PVOID
)&vSlData
;
1065 ::WinSendMsg(GetHwnd(), WM_SETWINDOWPARAMS
, (MPARAM
)&vWndParams
, (MPARAM
)0);
1066 for (i
= 1; i
< (m_nRangeMax
- m_nRangeMin
)/n
; i
++)
1068 nPixelPos
= i
* n
* m_dPixelToRange
;
1069 ::WinSendMsg( GetHwnd()
1071 ,MPFROMSHORT(nPixelPos
)
1075 } // end of wxSlider::SetTickFreq
1077 void wxSlider::SetValue(
1081 int nPixelPos
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1082 ,SLM_QUERYSLIDERINFO
1083 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
1089 int nPixelRange
= SHORT1FROMMR(::WinSendMsg( GetHwnd()
1090 ,SLM_QUERYSLIDERINFO
1091 ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
1097 m_dPixelToRange
= (double)(nPixelRange
- m_nThumbLength
)/(double)(m_nRangeMax
- m_nRangeMin
);
1098 int nNewPos
= (int)(nValue
* m_dPixelToRange
);
1100 ::WinSendMsg( GetHwnd()
1102 ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
1109 wxSprintf(wxBuffer
, wxT("%d"), nValue
);
1110 ::WinSetWindowText((HWND
)m_hStaticValue
, wxBuffer
);
1112 } // end of wxSlider::SetValue
1114 bool wxSlider::Show(
1118 wxWindowOS2::Show(bShow
);
1120 ::WinShowWindow((HWND
)m_hStaticValue
, bShow
);
1122 ::WinShowWindow((HWND
)m_hStaticMin
, bShow
);
1124 ::WinShowWindow((HWND
)m_hStaticMax
, bShow
);
1126 } // end of wxSlider::Show