X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42782237f24807ddb0bae1c84997e29573f5c2df..76e7cfab8fdb0c7862fd07e427af54181717fc62:/src/os2/slider.cpp diff --git a/src/os2/slider.cpp b/src/os2/slider.cpp index 57f0e770c2..5537d730c0 100644 --- a/src/os2/slider.cpp +++ b/src/os2/slider.cpp @@ -4,7 +4,6 @@ // Author: David Webster // Modified by: // Created: 10/15/99 -// RCS-ID: $Id$ // Copyright: (c) David Webster // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,10 +16,10 @@ #endif #ifndef WX_PRECOMP -#include -#include "wx/utils.h" -#include "wx/brush.h" -#include "wx/scrolwin.h" + #include + #include "wx/utils.h" + #include "wx/brush.h" + #include "wx/scrolwin.h" #endif #if wxUSE_SLIDER @@ -28,8 +27,6 @@ #include "wx/slider.h" #include "wx/os2/private.h" -IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl) - wxSlider::wxSlider() { m_hStaticValue = 0L; @@ -232,7 +229,7 @@ bool wxSlider::Create( m_windowStyle = lStyle; m_nTickFreq = 0; - if (vId == -1) + if (vId == wxID_ANY) m_windowId = (int)NewControlId(); else m_windowId = vId; @@ -370,7 +367,7 @@ bool wxSlider::Create( ,NULL // no control data ,NULL // no Presentation parameters ); - if (GetFont().Ok()) + if (GetFont().IsOk()) { if (GetFont().GetResourceHandle()) { @@ -406,11 +403,9 @@ bool wxSlider::Create( ) ) + 4; // for bordersizes - wxColour vColour; - - vColour.Set(wxString(wxT("BLACK"))); + wxColour vColour(*wxBLACK); - LONG lColor = (LONG)vColour.GetPixel(); + LONG lColor = (LONG)vColour.GetPixel(); ::WinSetPresParam( m_hStaticMin ,PP_FOREGROUNDCOLOR @@ -464,27 +459,25 @@ bool wxSlider::Create( return true; } // end of wxSlider::Create -void wxSlider::DoSetSize( - int nX -, int nY -, int nWidth -, int nHeight -, int nSizeFlags -) +void wxSlider::DoSetSize( int nX, + int nY, + int nWidth, + int nHeight, + int nSizeFlags ) { - int nX1 = nX; - int nY1 = nY; - int nWidth1 = nWidth; - int nHeight1 = nHeight; - int nXOffset = nX; - int nYOffset = nY; - int nCx; // slider,min,max sizes - int nCy; - int nCyf; - int nCurrentX; - int nCurrentY; - wxChar zBuf[300]; - wxFont vFont = this->GetFont(); + int nX1 = nX; + int nY1 = nY; + int nWidth1 = nWidth; + int nHeight1 = nHeight; + int nXOffset = nX; + int nYOffset = nY; + int nCx; // slider,min,max sizes + int nCy; + int nCyf; + int nCurrentX; + int nCurrentY; + wxChar zBuf[300]; + wxFont vFont = this->GetFont(); // // Adjust for OS/2's reverse coordinate system @@ -495,29 +488,28 @@ void wxSlider::DoSetSize( if (nOS2Height < 0) nOS2Height = 20; + CacheBestSize(wxSize(nWidth,nOS2Height)); if (pParent) { - int nOS2ParentHeight = GetOS2ParentHeight(pParent); + int nOS2ParentHeight = GetOS2ParentHeight(pParent); nYOffset = nOS2ParentHeight - (nYOffset + nOS2Height); - if (nY != -1) + if (nY != wxDefaultCoord) nY1 = nOS2ParentHeight - (nY1 + nOS2Height); } else { - RECTL vRect; + RECTL vRect; ::WinQueryWindowRect(HWND_DESKTOP, &vRect); nYOffset = vRect.yTop - (nYOffset + nOS2Height); - if (nY != -1) + if (nY != wxDefaultCoord) nY1 = vRect.yTop - (nY1 + nOS2Height); } m_nSizeFlags = nSizeFlags; - GetPosition( &nCurrentX - ,&nCurrentY - ); + GetPosition( &nCurrentX, &nCurrentY ); if (nX == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) nX1 = nCurrentX; if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) @@ -888,7 +880,6 @@ int wxSlider::GetValue() const ) ); double dPixelToRange = (double)(nPixelRange - m_nThumbLength)/(double)(m_nRangeMax - m_nRangeMin); - int nNewPos = 0; int nPixelPos = SHORT1FROMMR(::WinSendMsg( GetHwnd() ,SLM_QUERYSLIDERINFO ,MPFROM2SHORT( SMA_SLIDERARMPOSITION @@ -897,7 +888,7 @@ int wxSlider::GetValue() const ,(MPARAM)0 ) ); - nNewPos = (int)(nPixelPos/dPixelToRange); + int nNewPos = (int)(nPixelPos/dPixelToRange); if (nNewPos > (m_nRangeMax - m_nRangeMin)/2) nNewPos++; return nNewPos; @@ -977,13 +968,13 @@ bool wxSlider::OS2OnScroll( int WXUNUSED(nOrientation), vEvent.SetPosition(nNewPos); vEvent.SetEventObject(this); - GetEventHandler()->ProcessEvent(vEvent); + HandleWindowEvent(vEvent); - wxCommandEvent vCevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() ); + wxCommandEvent vCevent( wxEVT_SLIDER, GetId() ); vCevent.SetInt(nNewPos); vCevent.SetEventObject(this); - return (GetEventHandler()->ProcessEvent(vCevent)); + return (HandleWindowEvent(vCevent)); } // end of wxSlider::OS2OnScroll void wxSlider::SetLineSize( int nLineSize ) @@ -1081,7 +1072,7 @@ void wxSlider::SetTick( } // end of wxSlider::SetTick // For trackbars only -void wxSlider::SetTickFreq( int n, int WXUNUSED(nPos) ) +void wxSlider::DoSetTickFreq( int n ) { SLDCDATA vSlData; WNDPARAMS vWndParams;