X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1cee3f6006e1838fa3d59055233c435e3124d59e..411165f3f40f411d6feba4d13d4934f7fff6cc4f:/src/os2/slider.cpp diff --git a/src/os2/slider.cpp b/src/os2/slider.cpp index cf5d9798f5..574aa25b43 100644 --- a/src/os2/slider.cpp +++ b/src/os2/slider.cpp @@ -104,7 +104,7 @@ void wxSlider::AdjustSubControls( ,(LONG)nXOffset - (nMinLen + nCx) ,(LONG)nYOffset ,(LONG)nMinLen - ,(LONG)nCy + ,(LONG)nCyf ,SWP_SIZE | SWP_MOVE ); nXOffset += nWidth + nCx; @@ -114,14 +114,59 @@ void wxSlider::AdjustSubControls( ,(LONG)nXOffset ,(LONG)nYOffset ,(LONG)nMaxLen - ,(LONG)nCy - ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW + ,(LONG)nCyf + ,SWP_ZORDER | SWP_SHOW + ); + } + } + else + { + // + // Now deal with a vertical slider + // + + if (m_windowStyle & wxSL_LABELS ) + { + int nMinLen = 0; + int nMaxLen = 0; + + ::WinQueryWindowText((HWND)m_hStaticMin, 300, zBuf); + GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &this->GetFont()); + + ::WinQueryWindowText((HWND)m_hStaticMax, 300, zBuf); + GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &this->GetFont()); + + if (m_hStaticValue) + { + int nNewWidth = (wxMax(nMinLen, nMaxLen)); + + ::WinSetWindowPos( (HWND)m_hStaticValue + ,HWND_TOP + ,(LONG)nXOffset + ,(LONG)nYOffset + nHeight + nCyf + ,(LONG)nNewWidth + ,(LONG)nCyf + ,SWP_SIZE | SWP_MOVE + ); + } + ::WinSetWindowPos( (HWND)m_hStaticMax + ,HWND_TOP + ,(LONG)nXOffset + ,(LONG)nYOffset + nHeight + ,(LONG)nMaxLen + ,(LONG)nCyf + ,SWP_SIZE | SWP_MOVE + ); + ::WinSetWindowPos( (HWND)m_hStaticMin + ,HWND_TOP + ,(LONG)nXOffset + ,(LONG)nYOffset - nCyf + ,(LONG)nMinLen + ,(LONG)nCyf + ,SWP_SIZE | SWP_MOVE ); } } - // - // Now deal with a vertical slider -- OS/2 doesn't have vertical sliders - // } // end of wxSlider::AdjustSubControls void wxSlider::ClearSel() @@ -239,9 +284,9 @@ bool wxSlider::Create( vSlData.cbSize = sizeof(SLDCDATA); if (m_windowStyle & wxSL_VERTICAL) - lMsStyle = SLS_VERTICAL | WS_VISIBLE | WS_TABSTOP; + lMsStyle = SLS_VERTICAL | SLS_HOMEBOTTOM | WS_VISIBLE | WS_TABSTOP; else - lMsStyle = SLS_HORIZONTAL | WS_VISIBLE | WS_TABSTOP; + lMsStyle = SLS_HORIZONTAL | SLS_HOMELEFT| WS_VISIBLE | WS_TABSTOP; if (m_windowStyle & wxCLIP_SIBLINGS) lMsStyle |= WS_CLIPSIBLINGS; @@ -264,6 +309,7 @@ bool wxSlider::Create( lMsStyle |= SLS_PRIMARYSCALE1 | SLS_PRIMARYSCALE2; else lMsStyle |= SLS_PRIMARYSCALE2; + lMsStyle |= SLS_RIBBONSTRIP; m_nPageSize = ((nMaxValue - nMinValue)/10); vSlData.usScale1Increments = m_nPageSize; @@ -275,7 +321,7 @@ bool wxSlider::Create( ,(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 + ,HWND_BOTTOM // initial z position ,(HMENU)m_windowId // Window identifier ,&vSlData // Slider control data ,NULL // no Presentation parameters @@ -288,7 +334,7 @@ bool wxSlider::Create( // ::WinSendMsg( hScrollBar ,SLM_SETTICKSIZE - ,MPFROM2SHORT(SMA_SETALLTICKS, 6) + ,MPFROM2SHORT(SMA_SETALLTICKS, (USHORT)12) ,NULL ); // @@ -304,12 +350,7 @@ bool wxSlider::Create( SubclassWin(GetHWND()); ::WinSetWindowText((HWND)m_hWnd, ""); - wxFont* pTextFont = new wxFont( 10 - ,wxMODERN - ,wxNORMAL - ,wxNORMAL - ); - SetFont(*pTextFont); + SetFont(*wxSMALL_FONT); if (m_windowStyle & wxSL_LABELS) { // @@ -351,6 +392,8 @@ bool wxSlider::Create( } } + SetXComp(0); + SetYComp(0); SetSize( nX ,nY ,nWidth @@ -412,8 +455,14 @@ bool wxSlider::Create( ,sizeof(LONG) ,(PVOID)&lColor ); + vColour.Set(wxString("BLUE")); + lColor = (LONG)vColour.GetPixel(); + ::WinSetPresParam( m_hWnd + ,PP_HILITEBACKGROUNDCOLOR + ,sizeof(LONG) + ,(PVOID)&lColor + ); SetValue(nValue); - delete pTextFont; return TRUE; } // end of wxSlider::Create @@ -515,7 +564,7 @@ void wxSlider::DoSetSize( ::WinSetWindowPos( (HWND)m_hStaticMin ,HWND_TOP ,(LONG)nXOffset - ,(LONG)nYOffset - nCyf + ,(LONG)nYOffset - (nCyf * 1.2) ,(LONG)nMinLen ,(LONG)nCy ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW @@ -542,12 +591,20 @@ void wxSlider::DoSetSize( ,(LONG)nSliderHeight ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW ); + ::WinQueryWindowPos(GetHwnd(), GetSwp()); + ::WinSendMsg( GetHwnd() + ,SLM_SETSLIDERINFO + ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS + ,0 + ) + ,MPFROMLONG((ULONG)(nSliderHeight/2)) + ); nXOffset += nSliderLength + nCx; ::WinSetWindowPos( (HWND)m_hStaticMax ,HWND_TOP ,(LONG)nXOffset - ,(LONG)nYOffset - nCyf + ,(LONG)nYOffset - (nCyf * 1.2) ,(LONG)nMaxLen ,(LONG)nCy ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW @@ -600,33 +657,28 @@ void wxSlider::DoSetSize( int nNewWidth = wxMax(nMinLen, nMaxLen); int nValueHeight = nCyf; - nNewWidth += nCx; - // // The height needs to be a bit bigger under Win95 if using native // 3D effects. // - nValueHeight = (int)(nValueHeight * 1.5); ::WinSetWindowPos( (HWND)m_hStaticValue ,HWND_TOP ,(LONG)nXOffset - ,(LONG)nYOffset + ,(LONG)nYOffset + nHeight ,(LONG)nNewWidth ,(LONG)nValueHeight ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW ); - nYOffset -= nValueHeight; - nUsedHeight += nValueHeight; + nUsedHeight += nCyf; } ::WinSetWindowPos( (HWND)m_hStaticMin ,HWND_TOP ,(LONG)nXOffset - ,(LONG)nYOffset + ,(LONG)nYOffset + nHeight - nCyf ,(LONG)nMinLen ,(LONG)nCy ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW ); - nYOffset -= nCy; nUsedHeight += nCy; int nSliderLength = nHeight1 - (nUsedHeight + (2 * nCy)); @@ -641,20 +693,27 @@ void wxSlider::DoSetSize( if (nSliderLength < 100) nSliderLength = 100; - ::WinSetWindowPos( (HWND)m_hStaticMin + ::WinSetWindowPos( GetHwnd() ,HWND_TOP ,(LONG)nXOffset - ,(LONG)nYOffset + ,(LONG)nYOffset + nCyf ,(LONG)nSliderWidth ,(LONG)nSliderLength ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW ); - nYOffset -= nSliderLength; + ::WinQueryWindowPos(GetHwnd(), GetSwp()); + ::WinSendMsg( GetHwnd() + ,SLM_SETSLIDERINFO + ,MPFROM2SHORT( SMA_SHAFTDIMENSIONS + ,0 + ) + ,MPFROMLONG((ULONG)(nSliderWidth/2)) + ); nUsedHeight += nSliderLength; ::WinSetWindowPos( (HWND)m_hStaticMax ,HWND_TOP ,(LONG)nXOffset - ,(LONG)nYOffset + ,(LONG)nYOffset - nCyf ,(LONG)nMaxLen ,(LONG)nCy ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW