Added a SetFont method that behaves like SetLabel does with respect to
wxST_NO_AUTORESIZE. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9387 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2f10f4238a
commit
486fd225d4
@ -46,6 +46,7 @@ public:
|
||||
|
||||
// accessors
|
||||
void SetLabel(const wxString& label);
|
||||
bool SetFont( const wxFont &font );
|
||||
|
||||
// overriden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
|
@ -86,7 +86,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
SubclassWin(m_hWnd);
|
||||
|
||||
SetFont(parent->GetFont());
|
||||
wxControl::SetFont(parent->GetFont());
|
||||
SetSize(x, y, width, height);
|
||||
|
||||
return TRUE;
|
||||
@ -148,6 +148,22 @@ void wxStaticText::SetLabel(const wxString& label)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user