]> git.saurik.com Git - wxWidgets.git/commitdiff
don't call size_request to get best size of a non-native control, it will probably...
authorPaul Cornett <paulcor@bullseye.com>
Sun, 14 Dec 2008 07:39:17 +0000 (07:39 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Sun, 14 Dec 2008 07:39:17 +0000 (07:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/control.cpp

index 302c5018b610551bb0ace968651c71a0ec519eb9..06ca9c1de723bc7a52c05152223cd643af3d1dc9 100644 (file)
@@ -60,13 +60,18 @@ wxSize wxControl::DoGetBestSize() const
     // Do not return any arbitrary default value...
     wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
 
     // Do not return any arbitrary default value...
     wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
 
-    GtkRequisition req;
-    req.width = 2;
-    req.height = 2;
-    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
-        (m_widget, &req );
-
-    wxSize best(req.width, req.height);
+    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;
+        GTK_WIDGET_GET_CLASS(m_widget)->size_request(m_widget, &req);
+        best.Set(req.width, req.height);
+    }
     CacheBestSize(best);
     return best;
 }
     CacheBestSize(best);
     return best;
 }