+ m_hStaticMin = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
+ ,WC_STATIC // Window class
+ ,(PSZ)wxBuffer // Initial Text
+ ,(ULONG)lWstyle // Style flags
+ ,0L, 0L, 0L, 0L // Origin -- 0 size
+ ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
+ ,HWND_TOP // initial z position
+ ,(ULONG)NewControlId() // Window identifier
+ ,NULL // no control data
+ ,NULL // no Presentation parameters
+ );
+ }
+ lMsStyle = 0;
+
+ SLDCDATA vSlData;
+
+ vSlData.cbSize = sizeof(SLDCDATA);
+ if (m_windowStyle & wxSL_VERTICAL)
+ lMsStyle = SLS_VERTICAL | WS_VISIBLE | WS_TABSTOP;
+ else
+ lMsStyle = SLS_HORIZONTAL | WS_VISIBLE | WS_TABSTOP;
+
+ if (m_windowStyle & wxCLIP_SIBLINGS)
+ lMsStyle |= WS_CLIPSIBLINGS;
+
+ if (m_windowStyle & wxSL_AUTOTICKS)
+ {
+ vSlData.usScale1Spacing = 0;
+ vSlData.usScale2Spacing = 0;
+ }
+
+ if (m_windowStyle & wxSL_LEFT)
+ lMsStyle |= SLS_PRIMARYSCALE2; // if SLS_VERTICAL then SCALE2 is to the left
+ else if (m_windowStyle & wxSL_RIGHT)
+ lMsStyle |= SLS_PRIMARYSCALE1; // if SLS_VERTICAL then SCALE2 is to the right
+ else if (m_windowStyle & wxSL_TOP)
+ lMsStyle |= SLS_PRIMARYSCALE1; // if SLS_HORIZONTAL then SCALE1 is to the top
+ else if (m_windowStyle & wxSL_BOTTOM )
+ lMsStyle |= SLS_PRIMARYSCALE2; // if SLS_HORIZONTAL then SCALE1 is to the bottom
+ else if ( m_windowStyle & wxSL_BOTH )
+ lMsStyle |= SLS_PRIMARYSCALE1 | SLS_PRIMARYSCALE2;
+ else
+ lMsStyle |= SLS_PRIMARYSCALE2;
+
+ m_nPageSize = ((nMaxValue - nMinValue)/10);
+ vSlData.usScale1Increments = m_nPageSize;
+ vSlData.usScale2Increments = m_nPageSize;
+
+ HWND hScrollBar = ::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
+ ,WC_SLIDER // Window class
+ ,(PSZ)wxBuffer // Initial Text
+ ,(ULONG)lMsStyle // Style flags
+ ,0L, 0L, 0L, 0L // Origin -- 0 size
+ ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
+ ,HWND_TOP // initial z position
+ ,(HMENU)m_windowId // Window identifier
+ ,&vSlData // Slider control data
+ ,NULL // no Presentation parameters
+ );
+ m_nRangeMax = nMaxValue;
+ m_nRangeMin = nMinValue;
+
+ //
+ // Set the size of the ticks ... default to 6 pixels
+ //
+ ::WinSendMsg( hScrollBar
+ ,SLM_SETTICKSIZE
+ ,MPFROM2SHORT(SMA_SETALLTICKS, 6)
+ ,NULL
+ );
+ //
+ // Set the position to the initial value
+ //
+ ::WinSendMsg( hScrollBar
+ ,SLM_SETSLIDERINFO
+ ,MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_RANGEVALUE)
+ ,(MPARAM)nValue
+ );
+
+ m_hWnd = (WXHWND)hScrollBar;
+ SubclassWin(GetHWND());
+ ::WinSetWindowText((HWND)m_hWnd, "");
+
+ wxFont* pTextFont = new wxFont( 10
+ ,wxMODERN
+ ,wxNORMAL
+ ,wxNORMAL
+ );
+ SetFont(*pTextFont);
+ if (m_windowStyle & wxSL_LABELS)
+ {
+ //
+ // Finally, create max value static item
+ //
+ sprintf(wxBuffer, "%d", nMaxValue);
+ lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE;
+ if (m_windowStyle & wxCLIP_SIBLINGS)
+ lMsStyle |= WS_CLIPSIBLINGS;
+
+ m_hStaticMax = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
+ ,WC_STATIC // Window class
+ ,(PSZ)wxBuffer // Initial Text
+ ,(ULONG)lWstyle // Style flags
+ ,0L, 0L, 0L, 0L // Origin -- 0 size
+ ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
+ ,HWND_TOP // initial z position
+ ,(ULONG)NewControlId() // Window identifier
+ ,NULL // no control data
+ ,NULL // no Presentation parameters
+ );
+ if (GetFont().Ok())
+ {
+ if (GetFont().GetResourceHandle())
+ {
+ if (m_hStaticMin)
+ wxOS2SetFont( m_hStaticMin
+ ,GetFont()
+ );
+ if (m_hStaticMax)
+ wxOS2SetFont( m_hStaticMax
+ ,GetFont()
+ );
+ if (m_hStaticValue)
+ wxOS2SetFont( m_hStaticValue
+ ,GetFont()
+ );
+ }
+ }
+ }
+
+ SetSize( nX
+ ,nY
+ ,nWidth
+ ,nHeight
+ );
+ m_nThumbLength = SHORT1FROMMR(::WinSendMsg( GetHwnd()
+ ,SLM_QUERYSLIDERINFO
+ ,MPFROM2SHORT( SMA_SLIDERARMDIMENSIONS
+ ,SMA_RANGEVALUE
+ )
+ ,(MPARAM)0
+ )
+ ) + 4; // for bordersizes
+
+ wxColour vColour;
+
+ vColour.Set(wxString("BLACK"));
+
+ LONG lColor = (LONG)vColour.GetPixel();
+
+ ::WinSetPresParam( m_hStaticMin
+ ,PP_FOREGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ ::WinSetPresParam( m_hStaticMax
+ ,PP_FOREGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ ::WinSetPresParam( m_hStaticValue
+ ,PP_FOREGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ ::WinSetPresParam( m_hWnd
+ ,PP_FOREGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ lColor = (LONG)m_backgroundColour.GetPixel();
+ ::WinSetPresParam( m_hStaticMin
+ ,PP_BACKGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ ::WinSetPresParam( m_hStaticMax
+ ,PP_BACKGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ ::WinSetPresParam( m_hStaticValue
+ ,PP_BACKGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ ::WinSetPresParam( m_hWnd
+ ,PP_BACKGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ SetValue(nValue);
+ delete pTextFont;
+ return TRUE;
+} // end of wxSlider::Create
+
+void wxSlider::DoSetSize(
+ int nX
+, int nY
+, int nWidth
+, int nHeight
+, int nSizeFlags
+)