#pragma hdrstop
#endif
+#if wxUSE_STATTEXT
+
#ifndef WX_PRECOMP
#include "wx/event.h"
#include "wx/app.h"
#include "wx/msw/private.h"
#include <stdio.h>
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
-#endif
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
const wxString& label,
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)
SubclassWin(m_hWnd);
- SetFont(parent->GetFont());
+ wxControl::SetFont(parent->GetFont());
SetSize(x, y, width, height);
return TRUE;
}
}
+
+bool wxStaticText::SetFont(const wxFont& font)
+{
+ bool ret = wxControl::SetFont(font);
+
+ // 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);
+ }
+
+ return ret;
+}
+
+
long wxStaticText::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
// Ensure that static items get messages. Some controls don't like this
return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
}
-
+#endif // wxUSE_STATTEXT