Incorporate GTK preferred size into best size for non-native controls
It may be better than the default GetBestSize() result. Fixes best size of wxStaticBox when children are narrower than label, and minimum size for controls using a scrolled window, such as wxTreeCtrl.
This commit is contained in:
parent
3af16cd063
commit
375fd2c630
1 changed files with 3 additions and 7 deletions
|
|
@ -78,15 +78,11 @@ wxSize wxControl::DoGetBestSize() const
|
|||
// Do not return any arbitrary default value...
|
||||
wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
|
||||
|
||||
wxSize best;
|
||||
wxSize best(GTKGetPreferredSize(m_widget));
|
||||
if (m_wxwindow)
|
||||
{
|
||||
// this is not a native control, size_request is likely to be (0,0)
|
||||
best = wxControlBase::DoGetBestSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
best = GTKGetPreferredSize(m_widget);
|
||||
// For non-native controls, GTK preferred size may not be useful
|
||||
best.IncTo(base_type::DoGetBestSize());
|
||||
}
|
||||
|
||||
return best;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue