]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/control.cpp
Get/SetValue() and other improvements to the native PalmOS controls.
[wxWidgets.git] / src / gtk1 / control.cpp
index da63b425be45a95111b1360e7057b9470611a828..06eaec261b5c85e452f4f956b104a2a643ada318 100644 (file)
@@ -236,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;
 }
 
@@ -249,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;
 }
 
@@ -263,9 +269,12 @@ 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;
 }