]> git.saurik.com Git - wxWidgets.git/commitdiff
Use a button that has a tree widget as a parent as the widget style
authorRobin Dunn <robin@alldunn.com>
Mon, 9 Jul 2007 18:30:10 +0000 (18:30 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 9 Jul 2007 18:30:10 +0000 (18:30 +0000)
for DrawHeaderButton, as this is apparently how the gtk themes decide
whether to draw a normal button or a column header button.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/renderer.cpp

index 496908cc70bd8d5264785f95515d3490d16cf810..3fd5b8722514eb9cd2148e3d6043d0605de79116 100644 (file)
@@ -97,7 +97,7 @@ public:
 private:
     // FIXME: shouldn't we destroy these windows somewhere?
 
-    // used by DrawHeaderButton and DrawPushButton
+    // used by DrawPushButton and DrawDropArrow
     static GtkWidget *GetButtonWidget();
 
     // used by DrawTreeItemButton()
@@ -105,6 +105,9 @@ private:
 
     // used by DrawCheckBox()
     static GtkWidget *GetCheckButtonWidget();
+
+    // Used by DrawHeaderButton
+    static GtkWidget *GetHeaderButtonWidget();
 };
 
 // ============================================================================
@@ -177,6 +180,26 @@ wxRendererGTK::GetTreeWidget()
     return s_tree;
 }
 
+
+// This one just makes a button be a child of a tree widget.  This is
+// apparently how gtk themes decide to draw column headers differently than
+// normal buttons.
+GtkWidget *
+wxRendererGTK::GetHeaderButtonWidget()
+{
+    static GtkWidget *s_button = NULL;
+
+    if ( !s_button )
+    {
+        GtkWidget* treewidget = GetTreeWidget();
+        s_button = gtk_button_new();
+        gtk_widget_set_parent( s_button, treewidget );
+        gtk_widget_realize( s_button );
+    }
+
+    return s_button;
+}
+
 // ----------------------------------------------------------------------------
 // list/tree controls drawing
 // ----------------------------------------------------------------------------
@@ -190,8 +213,8 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
                                 wxHeaderButtonParams* params)
 {
 
-    GtkWidget *button = GetButtonWidget();
-
+    GtkWidget *button = GetHeaderButtonWidget();
+    
     GdkWindow* gdk_window = dc.GetGDKWindow();
     wxASSERT_MSG( gdk_window,
                   wxT("cannot use wxRendererNative on wxDC of this type") );