don't call size_request to get best size of a non-native control, it will probably return (0,0)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -60,13 +60,18 @@ wxSize wxControl::DoGetBestSize() const
|
|||||||
// Do not return any arbitrary default value...
|
// Do not return any arbitrary default value...
|
||||||
wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
|
wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
|
||||||
|
|
||||||
|
wxSize best;
|
||||||
|
if (m_wxwindow)
|
||||||
|
{
|
||||||
|
// this is not a native control, size_request is likely to be (0,0)
|
||||||
|
best = wxControlBase::DoGetBestSize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
req.width = 2;
|
GTK_WIDGET_GET_CLASS(m_widget)->size_request(m_widget, &req);
|
||||||
req.height = 2;
|
best.Set(req.width, req.height);
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
|
}
|
||||||
(m_widget, &req );
|
|
||||||
|
|
||||||
wxSize best(req.width, req.height);
|
|
||||||
CacheBestSize(best);
|
CacheBestSize(best);
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user