SetInitialBestSize changes for wxMac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27132 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1140,6 +1140,16 @@ protected:
|
||||
// at all.
|
||||
void SetBestSize(const wxSize& size);
|
||||
|
||||
// set the initial window size if none is given (i.e. at least one of the
|
||||
// components of the size passed to ctor/Create() is -1)
|
||||
//
|
||||
// normally just calls SetBestSize() for controls, but can be overridden
|
||||
// not to do it for the controls which have to do some additional
|
||||
// initialization (e.g. add strings to list box) before their best size
|
||||
// can be accurately calculated
|
||||
virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) {}
|
||||
|
||||
|
||||
// more pure virtual functions
|
||||
// ---------------------------
|
||||
|
||||
|
@@ -82,6 +82,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
||||
{
|
||||
Append(choices[i]);
|
||||
}
|
||||
SetBestSize(size); // Needed because it is a wxControlWithItems
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -311,6 +311,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
||||
m_choice->DoAppend( choices[ i ] );
|
||||
}
|
||||
|
||||
SetBestSize(csize); // Needed because it is a wxControlWithItems
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -246,6 +246,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
Append( choices[i] ) ;
|
||||
}
|
||||
|
||||
SetBestSize(size); // Needed because it is a wxControlWithItems
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -92,7 +92,10 @@ void wxStaticText::SetLabel(const wxString& st )
|
||||
&ref );
|
||||
|
||||
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
|
||||
{
|
||||
SetSize( GetBestSize() ) ;
|
||||
SetSizeHints(GetSize());
|
||||
}
|
||||
|
||||
Update() ;
|
||||
}
|
||||
@@ -104,7 +107,10 @@ bool wxStaticText::SetFont(const wxFont& font)
|
||||
if ( ret )
|
||||
{
|
||||
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
|
||||
{
|
||||
SetSize( GetBestSize() );
|
||||
SetSizeHints(GetSize());
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@@ -684,15 +684,7 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size)
|
||||
wxSize new_size = size ;
|
||||
if (!m_macIsUserPane)
|
||||
{
|
||||
wxSize best_size( DoGetBestSize() );
|
||||
|
||||
if (size.x == -1) {
|
||||
new_size.x = best_size.x;
|
||||
}
|
||||
if (size.y == -1) {
|
||||
new_size.y = best_size.y;
|
||||
}
|
||||
SetSize( pos.x, pos.y , new_size.x, new_size.y,wxSIZE_USE_EXISTING );
|
||||
SetInitialBestSize(size);
|
||||
}
|
||||
|
||||
SetCursor( *wxSTANDARD_CURSOR ) ;
|
||||
|
Reference in New Issue
Block a user