Controls will readjust their size and minsize when SetLabel or SetFont
are called. Fixed up wxStaticText to blend the wxST_NO_AUTOSIZE with this new functionality. Made SetBestSize public under the SetBestFittingSize name. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -33,6 +33,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
|
||||
wxControl::wxControl()
|
||||
{
|
||||
m_needParent = TRUE;
|
||||
m_createComplete = false;
|
||||
}
|
||||
|
||||
bool wxControl::Create( wxWindow *parent,
|
||||
@@ -43,6 +44,7 @@ bool wxControl::Create( wxWindow *parent,
|
||||
const wxValidator& validator,
|
||||
const wxString &name )
|
||||
{
|
||||
m_createComplete = false;
|
||||
bool ret = wxWindow::Create(parent, id, pos, size, style, name);
|
||||
|
||||
#if wxUSE_VALIDATORS
|
||||
@@ -68,6 +70,14 @@ void wxControl::SetLabel( const wxString &label )
|
||||
}
|
||||
}
|
||||
|
||||
void wxControl::PostSetLabel()
|
||||
{
|
||||
// make sure the widget has been created, and that PostCreate has already
|
||||
// been called
|
||||
if (m_widget && m_createComplete && GetAdjustMinSizeFlag())
|
||||
SetBestSize(wxDefaultSize);
|
||||
}
|
||||
|
||||
wxString wxControl::GetLabel() const
|
||||
{
|
||||
return m_label;
|
||||
@@ -103,6 +113,7 @@ void wxControl::PostCreation(const wxSize& size)
|
||||
InheritAttributes();
|
||||
ApplyWidgetStyle();
|
||||
SetInitialBestSize(size);
|
||||
m_createComplete = true;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user