From 981a80493a7eb930da1792bef310f89e312dd367 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 23 Jan 2009 11:37:54 +0000 Subject: [PATCH] Tried hard to get the selection/focus rectangle drawn right. The GTK+ theme API is beyond repair. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58322 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/renderer.cpp | 15 +++++++++++---- src/gtk/win_gtk.cpp | 7 +++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index a25541fe4c..ce6cc046e0 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -525,6 +525,8 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, const wxRect& rect, int flags ) { + GtkWidget *tree = wxGTKPrivate::GetTreeWidget(); + GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc); wxASSERT_MSG( gdk_window, wxT("cannot use wxRendererNative on wxDC of this type") ); @@ -533,14 +535,15 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, if (win->GetLayoutDirection() == wxLayout_RightToLeft) x_diff = rect.width; - GtkStateType state; + GtkStateType state = GTK_STATE_NORMAL; + if (flags & wxCONTROL_SELECTED) { // the wxCONTROL_FOCUSED state is deduced // directly from the m_wxwindow by GTK+ state = GTK_STATE_SELECTED; - gtk_paint_flat_box( win->m_widget->style, + gtk_paint_flat_box( tree->style, // win->m_widget->style, gdk_window, state, GTK_SHADOW_NONE, @@ -559,7 +562,10 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED)) { - gtk_paint_focus( win->m_widget->style, + if (flags & wxCONTROL_SELECTED) + state = GTK_STATE_SELECTED; + + gtk_paint_focus( tree->style, gdk_window, state, NULL, @@ -569,7 +575,8 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, // Using "treeview-middle" would fix the warning, but the right // edge of the focus rect is not getting erased properly either. // Better to not specify this detail unless the drawing is fixed. - NULL, + // RR: I added that to the Pizza widget class. + "treeview", dc.LogicalToDeviceX(rect.x), dc.LogicalToDeviceY(rect.y), rect.width, diff --git a/src/gtk/win_gtk.cpp b/src/gtk/win_gtk.cpp index acace1f565..980bd28850 100644 --- a/src/gtk/win_gtk.cpp +++ b/src/gtk/win_gtk.cpp @@ -259,6 +259,13 @@ static void class_init(void* g_class, void*) G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); parent_class = GTK_WIDGET_CLASS(g_type_class_peek_parent(g_class)); + + gtk_widget_class_install_style_property (widget_class, + g_param_spec_boolean ("row-ending-details", + "Row Ending details", + "Enable extended row background theming", + FALSE, + G_PARAM_READABLE)); } } // extern "C" -- 2.45.2