+ if (vId == -1)
+ m_windowId = (int)NewControlId();
+ else
+ m_windowId = vId;
+
+ if (m_windowStyle & wxCLIP_SIBLINGS )
+ lMsStyle |= WS_CLIPSIBLINGS;
+
+ if (m_windowStyle & wxSL_LABELS)
+ {
+ lMsStyle |= WS_VISIBLE | SS_TEXT | DT_VCENTER;
+
+ m_hStaticValue = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
+ ,WC_STATIC // Window class
+ ,(PSZ)NULL // 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
+ ,(ULONG)NewControlId() // Window identifier
+ ,NULL // no control data
+ ,NULL // no Presentation parameters
+ );
+
+ //
+ // Now create min static control
+ //
+ wxSprintf(wxBuffer, wxT("%d"), nMinValue);
+ lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE;
+ if (m_windowStyle & wxCLIP_SIBLINGS)
+ lWstyle |= WS_CLIPSIBLINGS;
+
+ 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 | SLS_HOMEBOTTOM | WS_VISIBLE | WS_TABSTOP;
+ else
+ lMsStyle = SLS_HORIZONTAL | SLS_HOMELEFT | 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;
+ lMsStyle |= SLS_RIBBONSTRIP;
+
+ m_nPageSize = ((nMaxValue - nMinValue)/10);
+ vSlData.usScale1Increments = (USHORT)m_nPageSize;
+ vSlData.usScale2Increments = (USHORT)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_BOTTOM // 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, (USHORT)12)
+ ,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, "");
+
+ SetFont(*wxSMALL_FONT);
+ if (m_windowStyle & wxSL_LABELS)
+ {
+ //
+ // Finally, create max value static item
+ //
+ wxSprintf(wxBuffer, wxT("%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()
+ );
+ }
+ }
+ }
+
+ SetXComp(0);
+ SetYComp(0);
+ 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(wxT("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
+ );
+ vColour.Set(wxString(wxT("BLUE")));
+ lColor = (LONG)vColour.GetPixel();
+ ::WinSetPresParam( m_hWnd
+ ,PP_HILITEBACKGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ SetValue(nValue);
+ return true;
+} // end of wxSlider::Create
+
+void wxSlider::DoSetSize(
+ int nX
+, int nY
+, int nWidth
+, int nHeight
+, int nSizeFlags
+)