#include <wx/scrolwin.h>
#endif
+#if wxUSE_SLIDER
+
#include "wx/slider.h"
#include "wx/os2/private.h"
, int nSizeFlags
)
{
- SWP vSwp;
int nXOffset = nX;
int nYOffset = nY;
int nCx; // slider,min,max sizes
int nCy;
int nCyf;
char zBuf[300];
+ wxFont vFont = this->GetFont();
wxGetCharSize( GetHWND()
,&nCx
,&nCy
- ,&this->GetFont()
+ ,&vFont
);
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
int nMaxLen = 0;
::WinQueryWindowText((HWND)m_hStaticMin, 300, zBuf);
- GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &this->GetFont());
+ GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &vFont);
::WinQueryWindowText((HWND)m_hStaticMax, 300, zBuf);
- GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &this->GetFont());
+ GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &vFont);
if (m_hStaticValue)
{
,(LONG)nXOffset - (nMinLen + nCx)
,(LONG)nYOffset
,(LONG)nMinLen
- ,(LONG)nCy
+ ,(LONG)nCyf
,SWP_SIZE | SWP_MOVE
);
nXOffset += nWidth + nCx;
,(LONG)nXOffset
,(LONG)nYOffset
,(LONG)nMaxLen
- ,(LONG)nCy
+ ,(LONG)nCyf
,SWP_ZORDER | SWP_SHOW
);
}
// Now deal with a vertical slider
//
- if (m_lWindowStyle & winSL_LABELS )
+ if (m_windowStyle & wxSL_LABELS )
{
int nMinLen = 0;
int nMaxLen = 0;
::WinQueryWindowText((HWND)m_hStaticMin, 300, zBuf);
- GetTextExtent(zBuf, &lMinLen, &nCyf, NULL, NULL, &this->GetFont());
+ GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &vFont);
::WinQueryWindowText((HWND)m_hStaticMax, 300, zBuf);
- GetTextExtent(zBuf, &lMaxLen, &nCyf, NULL, NULL, &this->GetFont());
+ GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &vFont);
if (m_hStaticValue)
{
- int nNewWidth = (DAWUTL_MAX(nMinLen, nMaxLen));
+ int nNewWidth = (wxMax(nMinLen, nMaxLen));
::WinSetWindowPos( (HWND)m_hStaticValue
,HWND_TOP
, const wxPoint& rPos
, const wxSize& rSize
, long lStyle
-#if wxUSE_VALIDATORS
, const wxValidator& rValidator
-#endif
, const wxString& rsName
)
{
if (m_windowStyle & wxSL_VERTICAL)
lMsStyle = SLS_VERTICAL | SLS_HOMEBOTTOM | WS_VISIBLE | WS_TABSTOP;
else
- lMsStyle = SLS_HORIZONTAL | SLS_HOMELEFT| WS_VISIBLE | WS_TABSTOP;
+ lMsStyle = SLS_HORIZONTAL | SLS_HOMELEFT | WS_VISIBLE | WS_TABSTOP;
if (m_windowStyle & wxCLIP_SIBLINGS)
lMsStyle |= WS_CLIPSIBLINGS;
,(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
}
}
+ SetXComp(0);
+ SetYComp(0);
SetSize( nX
,nY
,nWidth
,(PVOID)&lColor
);
SetValue(nValue);
- delete pTextFont;
- return TRUE;
+ return true;
} // end of wxSlider::Create
void wxSlider::DoSetSize(
int nCurrentX;
int nCurrentY;
char zBuf[300];
+ wxFont vFont = this->GetFont();
//
// Adjust for OS/2's reverse coordinate system
wxGetCharSize( GetHWND()
,&nCx
,&nCy
- ,&this->GetFont()
+ ,&vFont
);
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
int nMaxLen = 0;
::WinQueryWindowText((HWND)m_hStaticMin, 300, zBuf);
- GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &this->GetFont());
+ GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &vFont);
::WinQueryWindowText((HWND)m_hStaticMax, 300, zBuf);
- GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &this->GetFont());
+ GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &vFont);
if (m_hStaticValue)
{
::WinSetWindowPos( (HWND)m_hStaticValue
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset - (nCyf * 1.2)
+ ,(LONG)nYOffset - (LONG)(nCyf * 1.2)
,(LONG)nNewWidth
,(LONG)nValueHeight
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
::WinSetWindowPos( (HWND)m_hStaticMin
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset - (nCyf * 1.2)
+ ,(LONG)nYOffset - (LONG)(nCyf * 1.2)
,(LONG)nMinLen
,(LONG)nCy
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
,(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 * 1.2)
+ ,(LONG)nYOffset - (LONG)(nCyf * 1.2)
,(LONG)nMaxLen
,(LONG)nCy
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
int nMaxLen;
::WinQueryWindowText((HWND)m_hStaticMin, 300, zBuf);
- GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &this->GetFont());
+ GetTextExtent(zBuf, &nMinLen, &nCyf, NULL, NULL, &vFont);
::WinQueryWindowText((HWND)m_hStaticMax, 300, zBuf);
- GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &this->GetFont());
+ GetTextExtent(zBuf, &nMaxLen, &nCyf, NULL, NULL, &vFont);
if (m_hStaticValue)
{
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.
- //
::WinSetWindowPos( (HWND)m_hStaticValue
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset + lHeight
+ ,(LONG)nYOffset + nHeight
,(LONG)nNewWidth
,(LONG)nValueHeight
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
);
- nUsedHeight += nCy;
+ nUsedHeight += nCyf;
}
::WinSetWindowPos( (HWND)m_hStaticMin
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset + lHeight -lCyf
+ ,(LONG)nYOffset + nHeight - nCyf
,(LONG)nMinLen
,(LONG)nCy
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
::WinSetWindowPos( GetHwnd()
,HWND_TOP
,(LONG)nXOffset
- ,(LONG)nYOffset
+ ,(LONG)nYOffset + nCyf
,(LONG)nSliderWidth
,(LONG)nSliderLength
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
);
+ ::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
wxFindMaxSize( m_hStaticValue
,&vRect
);
- *pnWidth = vRect.xRight - vRect.xLeft;
- *pnHeight = vRect.yBottom - vRect.yTop;
+ if (pnWidth)
+ *pnWidth = vRect.xRight - vRect.xLeft;
+ if (pnHeight)
+ *pnHeight = vRect.yTop - vRect.yBottom;
} // end of wxSlider::GetSize
int wxSlider::GetThumbLength() const
break;
default:
- return FALSE;
+ return false;
}
int nPixelRange = SHORT1FROMMR(::WinSendMsg( GetHwnd()
,(MPARAM)0
)
);
- nNewPos = (nPixelPos/m_dPixelToRange);
+ nNewPos = (int)(nPixelPos/m_dPixelToRange);
if (nNewPos > (m_nRangeMax - m_nRangeMin)/2)
nNewPos++;
if ((nNewPos < GetMin()) || (nNewPos > GetMax()))
//
// Out of range - but we did process it
//
- return TRUE;
+ return true;
}
SetValue(nNewPos);
int nTickPos
)
{
- nTickPos *= m_dPixelToRange;
+ nTickPos = (int)(nTickPos * m_dPixelToRange);
::WinSendMsg( GetHwnd()
,SLM_ADDDETENT
,MPFROMSHORT(nTickPos)
::WinSendMsg(GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vWndParams, (MPARAM)0);
for (i = 1; i < (m_nRangeMax - m_nRangeMin)/n; i++)
{
- nPixelPos = i * n * m_dPixelToRange;
+ nPixelPos = (int)(i * n * m_dPixelToRange);
::WinSendMsg( GetHwnd()
,SLM_ADDDETENT
,MPFROMSHORT(nPixelPos)
int nValue
)
{
- int nPixelPos = SHORT1FROMMR(::WinSendMsg( GetHwnd()
- ,SLM_QUERYSLIDERINFO
- ,MPFROM2SHORT( SMA_SLIDERARMPOSITION
- ,SMA_RANGEVALUE
- )
- ,(MPARAM)0
- )
- );
int nPixelRange = SHORT1FROMMR(::WinSendMsg( GetHwnd()
,SLM_QUERYSLIDERINFO
,MPFROM2SHORT( SMA_SHAFTDIMENSIONS
::WinShowWindow((HWND)m_hStaticMin, bShow);
if(m_hStaticMax)
::WinShowWindow((HWND)m_hStaticMax, bShow);
- return TRUE;
+ return true;
} // end of wxSlider::Show
+#endif // wxUSE_SLIDER