]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/control.cpp
Fix compilation of generic message dialog.
[wxWidgets.git] / src / gtk1 / control.cpp
index e638c35d8d3204492cad13e0645c22adac35cb8e..06eaec261b5c85e452f4f956b104a2a643ada318 100644 (file)
@@ -66,6 +66,7 @@ void wxControl::SetLabel( const wxString &label )
         }
         m_label << *pc;
     }
+    InvalidateBestSize();    
 }
 
 wxString wxControl::GetLabel() const
@@ -85,7 +86,9 @@ wxSize wxControl::DoGetBestSize() const
     (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
         (m_widget, &req );
 
-    return wxSize(req.width, req.height);
+    wxSize best(req.width, req.height);
+    CacheBestSize(best);
+    return best;
 }
 
 
@@ -100,7 +103,6 @@ void wxControl::PostCreation(const wxSize& size)
     //     GetBestSize is called.
     gtk_widget_ensure_style(m_widget);
     
-    InheritAttributes();
     ApplyWidgetStyle();
     SetInitialBestSize(size);
 }
@@ -201,7 +203,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
     if ( style && style->font_desc )
     {  
         wxNativeFontInfo info;  
-        info.description = style->font_desc;  
+        info.description = pango_font_description_copy(style->font_desc);
         attr.font = wxFont(info);  
     }  
     else  
@@ -234,9 +236,12 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void),
                                              int state)
 {
     wxVisualAttributes attr;
+    // NB: we need toplevel window so that GTK+ can find the right style
+    GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     GtkWidget* widget = widget_new();
+    gtk_container_add(GTK_CONTAINER(wnd), widget);
     attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state);
-    gtk_widget_destroy(widget);
+    gtk_widget_destroy(wnd);
     return attr;
 }
 
@@ -247,9 +252,12 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gcha
                                              int state)
 {
     wxVisualAttributes attr;
+    // NB: we need toplevel window so that GTK+ can find the right style
+    GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     GtkWidget* widget = widget_new("");
+    gtk_container_add(GTK_CONTAINER(wnd), widget);
     attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state);
-    gtk_widget_destroy(widget);
+    gtk_widget_destroy(wnd);
     return attr;
 }
 
@@ -261,27 +269,14 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustm
                                              int state)
 {
     wxVisualAttributes attr;
+    // NB: we need toplevel window so that GTK+ can find the right style
+    GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     GtkWidget* widget = widget_new(NULL);
+    gtk_container_add(GTK_CONTAINER(wnd), widget);
     attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state);
-    gtk_widget_destroy(widget);
+    gtk_widget_destroy(wnd);
     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