X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b720b24da89b6b60dbabde36f2a995357e3b1497..64ea838d8f4d1853b7d850db93ee565e901d099a:/src/os2/gauge.cpp diff --git a/src/os2/gauge.cpp b/src/os2/gauge.cpp index 05685686b1..80568caaec 100644 --- a/src/os2/gauge.cpp +++ b/src/os2/gauge.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: gauge.cpp +// Name: src/os2/gauge.cpp // Purpose: wxGauge class // Author: David Webster // Modified by: @@ -11,41 +11,36 @@ #include "wx/wxprec.h" +#if wxUSE_GAUGE + +#include "wx/gauge.h" + #ifndef WX_PRECOMP -#include "wx/defs.h" -#include "wx/utils.h" -#include "wx/scrolwin.h" + #include "wx/utils.h" + #include "wx/scrolwin.h" #endif #include "wx/os2/private.h" -#include "wx/gauge.h" static WXFARPROC fnWndProcGauge = (WXFARPROC)NULL; extern void wxAssociateWinWithHandle( HWND hWnd ,wxWindowOS2* pWin ); -IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl) - -MRESULT EXPENTRY wxGaugeWndProc( - HWND hWnd -, UINT uMessage -, MPARAM wParam -, MPARAM lParam -) +MRESULT EXPENTRY wxGaugeWndProc( HWND hWnd, + UINT uMessage, + MPARAM wParam, + MPARAM lParam ) { wxGauge* pGauge = (wxGauge *)::WinQueryWindowULong( hWnd ,QWL_USER ); - wxWindowOS2* pWindow = NULL; - MRESULT rc = (MRESULT)0; - bool bProcessed = FALSE; - HPS hPS; - RECTL vRect; - RECTL vRect2; - RECTL vRect3; - double dPixelToRange = 0.0; - double dRange = 0.0; + HPS hPS; + RECTL vRect; + RECTL vRect2; + RECTL vRect3; + double dPixelToRange = 0.0; + double dRange = 0.0; switch (uMessage ) { @@ -133,25 +128,21 @@ MRESULT EXPENTRY wxGaugeWndProc( ); } // end of wxGaugeWndProc -bool wxGauge::Create( - wxWindowOS2* pParent -, wxWindowID vId -, int nRange -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -#if wxUSE_VALIDATORS -, const wxValidator& rValidator -#endif -, const wxString& rsName -) +bool wxGauge::Create( wxWindowOS2* pParent, + wxWindowID vId, + int nRange, + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + const wxValidator& rValidator, + const wxString& rsName ) { - int nX = rPos.x; - int nY = rPos.y; - int nWidth = rSize.x; - int nHeight = rSize.y; - long lMsStyle = 0L; - SWP vSwp; + int nX = rPos.x; + int nY = rPos.y; + int nWidth = rSize.x; + int nHeight = rSize.y; + long lMsStyle = 0L; + SWP vSwp; SetName(rsName); #if wxUSE_VALIDATORS @@ -159,14 +150,14 @@ bool wxGauge::Create( #endif if (pParent) pParent->AddChild(this); - m_backgroundColour.Set(wxString("LIGHT GREY")); - m_foregroundColour.Set(wxString("NAVY")); + m_backgroundColour.Set(wxString(wxT("LIGHT GREY"))); + m_foregroundColour.Set(wxString(wxT("NAVY"))); m_nRangeMax = nRange; m_nGaugePos = 0; m_windowStyle = lStyle; - if (vId == -1) + if (vId == wxID_ANY) m_windowId = (int)NewControlId(); else m_windowId = vId; @@ -219,9 +210,11 @@ bool wxGauge::Create( ,nWidth ,nHeight ); + m_nWidth = nWidth; // Save for GetBestSize + m_nHeight = nHeight; ::WinShowWindow((HWND)GetHWND(), TRUE); delete pTextFont; - return TRUE; + return true; } // end of wxGauge::Create int wxGauge::GetBezelFace() const @@ -244,12 +237,10 @@ int wxGauge::GetValue() const return m_nGaugePos; } // end of wxGauge::GetValue -bool wxGauge::SetBackgroundColour( - const wxColour& rColour -) +bool wxGauge::SetBackgroundColour( const wxColour& rColour ) { if (!wxControl::SetBackgroundColour(rColour)) - return FALSE; + return false; LONG lColor = (LONG)rColour.GetPixel(); @@ -258,23 +249,19 @@ bool wxGauge::SetBackgroundColour( ,sizeof(LONG) ,(PVOID)&lColor ); - return TRUE; + return true; } // end of wxGauge::SetBackgroundColour -void wxGauge::SetBezelFace( - int WXUNUSED(nWidth) -) +void wxGauge::SetBezelFace( int WXUNUSED(nWidth) ) { } // end of wxGauge::SetBezelFace -bool wxGauge::SetForegroundColour( - const wxColour& rColour -) +bool wxGauge::SetForegroundColour( const wxColour& rColour ) { if (!wxControl::SetForegroundColour(rColour)) - return FALSE; + return false; - LONG lColor = (LONG)rColour.GetPixel(); + LONG lColor = (LONG)rColour.GetPixel(); ::WinSetPresParam( GetHwnd() ,PP_FOREGROUNDCOLOR @@ -282,31 +269,30 @@ bool wxGauge::SetForegroundColour( ,(PVOID)&lColor ); - return TRUE; + return true; } // end of wxGauge::SetForegroundColour -void wxGauge::SetRange( - int nRange -) +void wxGauge::SetRange( int nRange ) { m_nRangeMax = nRange; } // end of wxGauge::SetRange -void wxGauge::SetShadowWidth( - int WXUNUSED(nWidth) -) +void wxGauge::SetShadowWidth( int WXUNUSED(nWidth) ) { } // end of wxGauge::SetShadowWidth -void wxGauge::SetValue( - int nPos -) +void wxGauge::SetValue( int nPos ) { - RECT vRect; + RECT vRect; m_nGaugePos = nPos; ::WinQueryWindowRect(GetHwnd(), &vRect); ::WinInvalidateRect(GetHwnd(), &vRect, FALSE); } // end of wxGauge::SetValue +wxSize wxGauge::DoGetBestSize() const +{ + return wxSize(m_nWidth,m_nHeight); +} +#endif // wxUSE_GAUGE