X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4fe5383d6c6463e16e2d5b6b5fefe311b33e128f..4c5032ccd12366ab53b6c695c621307dd9705531:/src/msw/stattext.cpp diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 38d249d3cb..8c39245ce4 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -30,9 +30,7 @@ #include "wx/msw/private.h" #include -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) -#endif bool wxStaticText::Create(wxWindow *parent, wxWindowID id, const wxString& label, @@ -59,7 +57,10 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, m_windowStyle = style; - long msStyle = WS_CHILD|WS_VISIBLE; + long msStyle = WS_CHILD | WS_VISIBLE; + + if ( m_windowStyle & wxCLIP_SIBLINGS ) + msStyle |= WS_CLIPSIBLINGS; if (m_windowStyle & wxALIGN_CENTRE) msStyle |= SS_CENTER; else if (m_windowStyle & wxALIGN_RIGHT) @@ -88,13 +89,13 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, SubclassWin(m_hWnd); - SetFont(parent->GetFont()); + wxControl::SetFont(parent->GetFont()); SetSize(x, y, width, height); return TRUE; } -wxSize wxStaticText::DoGetBestSize() +wxSize wxStaticText::DoGetBestSize() const { wxString text(wxGetWindowText(GetHWND())); @@ -150,39 +151,22 @@ void wxStaticText::SetLabel(const wxString& label) } } -WXHBRUSH wxStaticText::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam) -{ -/* -#if wxUSE_CTL3D - if ( m_useCtl3D ) - { - HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); - - if (hbrush != (HBRUSH) 0) - return hbrush; - else - return (HBRUSH)MSWDefWindowProc(message, wParam, lParam); - } -#endif -*/ - - if (GetParent()->GetTransparentBackground()) - SetBkMode((HDC) pDC, TRANSPARENT); - else - SetBkMode((HDC) pDC, OPAQUE); - ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); - ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue())); +bool wxStaticText::SetFont(const wxFont& font) +{ + bool ret = wxControl::SetFont(font); - wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID); + // adjust the size of the window to fit to the label unless autoresizing is + // disabled + if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + { + DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); + } - // Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush - // has a zero usage count. -// backgroundBrush->RealizeResource(); - return (WXHBRUSH) backgroundBrush->GetResourceHandle(); + return ret; } + long wxStaticText::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { // Ensure that static items get messages. Some controls don't like this