From: Robin Dunn Date: Mon, 9 Jul 2007 18:30:10 +0000 (+0000) Subject: Use a button that has a tree widget as a parent as the widget style X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/621ed8af213b34c54025f04018ad3727a3d47d76 Use a button that has a tree widget as a parent as the widget style 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 --- diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 496908cc70..3fd5b87225 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -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") );