X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b3260bce473ab247edd8ca1d3aee4eb648b4b97e..6ba718d7aee2f519d9146b90424ccec9e2243479:/src/os2/statbox.cpp diff --git a/src/os2/statbox.cpp b/src/os2/statbox.cpp index 61f5db74d6..94d826ec8d 100644 --- a/src/os2/statbox.cpp +++ b/src/os2/statbox.cpp @@ -1,10 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: statbox.cpp +// Name: src/os2/statbox.cpp // Purpose: wxStaticBox // Author: David Webster // Modified by: // Created: ??/??/98 -// RCS-ID: $Id$ // Copyright: (c) David Webster // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,86 +11,73 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/window.h" -#include "wx/os2/private.h" +#include "wx/statbox.h" #ifndef WX_PRECOMP -#include "wx/app.h" -#include "wx/dcclient.h" + #include "wx/app.h" + #include "wx/dcclient.h" + #include "wx/window.h" #endif -#include "wx/statbox.h" - -IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) +#include "wx/os2/private.h" -bool wxStaticBox::Create( - wxWindow* pParent -, wxWindowID vId -, const wxString& rsLabel -, const wxPoint& rPos -, const wxSize& rSize -, long lStyle -, const wxString& rsName -) +bool wxStaticBox::Create( wxWindow* pParent, + wxWindowID vId, + const wxString& rsLabel, + const wxPoint& rPos, + const wxSize& rSize, + long lStyle, + const wxString& rsName ) { - if(!OS2CreateControl( pParent - ,vId - ,rPos - ,rSize - ,lStyle -#if wxUSE_VALIDATORS - ,wxDefaultValidator -#endif - ,rsName - )) + if(!CreateControl( pParent + ,vId + ,rPos + ,rSize + ,lStyle + ,wxDefaultValidator + ,rsName + )) { - return FALSE; + return false; } - wxPoint vPos(0,0); - wxSize vSize(0,0); + wxPoint vPos(0,0); + wxSize vSize(0,0); - if (!OS2CreateControl( "STATIC" + if (!OS2CreateControl( wxT("STATIC") ,SS_GROUPBOX ,vPos ,vSize ,rsLabel )) { - return FALSE; + return false; } - wxColour vColour; - - vColour.Set(wxString("BLACK")); - - LONG lColor = (LONG)vColour.GetPixel(); + // + // To be transparent we should have the same colour as the parent as well + // + SetBackgroundColour(GetParent()->GetBackgroundColour()); + LONG lColor = (LONG)wxBLACK->GetPixel(); ::WinSetPresParam( m_hWnd ,PP_FOREGROUNDCOLOR ,sizeof(LONG) ,(PVOID)&lColor ); - lColor = (LONG)m_backgroundColour.GetPixel(); + lColor = (LONG)m_backgroundColour.GetPixel(); ::WinSetPresParam( m_hWnd ,PP_BACKGROUNDCOLOR ,sizeof(LONG) ,(PVOID)&lColor ); - wxFont* pTextFont = new wxFont( 10 - ,wxMODERN - ,wxNORMAL - ,wxNORMAL - ); - SetFont(*pTextFont); SetSize( rPos.x ,rPos.y ,rSize.x ,rSize.y ); - delete pTextFont; - return TRUE; + return true; } // end of wxStaticBox::Create wxSize wxStaticBox::DoGetBestSize() const @@ -100,14 +86,11 @@ wxSize wxStaticBox::DoGetBestSize() const int nCy; int wBox; - wxGetCharSize( GetHWND() - ,&nCx - ,&nCy - ,(wxFont*)&GetFont() - ); + nCx = GetCharWidth(); + nCy = GetCharHeight(); GetTextExtent( wxGetWindowText(m_hWnd) ,&wBox - ,&nCy + ,NULL ); wBox += 3 * nCx; @@ -118,13 +101,9 @@ wxSize wxStaticBox::DoGetBestSize() const ); } // end of wxStaticBox::DoGetBestSize -MRESULT wxStaticBox::OS2WindowProc( - WXUINT nMsg -, WXWPARAM wParam -, WXLPARAM lParam -) +MRESULT wxStaticBox::OS2WindowProc( WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam ) { return wxControl::OS2WindowProc(nMsg, wParam, lParam); } // end of wxStaticBox::OS2WindowProc - -