]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/control.cpp
Various layout fixes and such
[wxWidgets.git] / src / gtk1 / control.cpp
index dfbfe4b9c0eba7cf531840269c3c511f5c72f6eb..e638c35d8d3204492cad13e0645c22adac35cb8e 100644 (file)
@@ -92,6 +92,14 @@ wxSize wxControl::DoGetBestSize() const
 void wxControl::PostCreation(const wxSize& size)
 {
     wxWindow::PostCreation();
+
+    // NB: GetBestSize needs to know the style, otherwise it will assume
+    //     default font and if the user uses a different font, determined
+    //     best size will be different (typically, smaller) than the desired
+    //     size. This call ensure that a style is available at the time
+    //     GetBestSize is called.
+    gtk_widget_ensure_style(m_widget);
+    
     InheritAttributes();
     ApplyWidgetStyle();
     SetInitialBestSize(size);
@@ -259,6 +267,21 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustm
     return attr;
 }
 
+void wxControl::ApplyWidgetStyle()
+{
+    GtkRcStyle *style = CreateWidgetStyle();
+    if ( style )
+    {
+        DoApplyWidgetStyle(style);
+        gtk_rc_style_unref(style);
+    }
+}
+
+void wxControl::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+    gtk_widget_modify_style(m_widget, style);
+}
+
 
 #endif // wxUSE_CONTROLS