Tried hard to get the selection/focus rectangle drawn right. The GTK+ theme API is...
authorRobert Roebling <robert@roebling.de>
Fri, 23 Jan 2009 11:37:54 +0000 (11:37 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 23 Jan 2009 11:37:54 +0000 (11:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58322 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/renderer.cpp
src/gtk/win_gtk.cpp

index a25541fe4c118406ac6f619fd009fd2647caaf34..ce6cc046e05d72f93f9582fc242cac052f180735 100644 (file)
@@ -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,
index acace1f565d6725678c26bd2d5ccca9b20a850dd..980bd28850ebed996399bbf54ef63841ac602445 100644 (file)
@@ -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"