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
This commit is contained in:
@@ -525,6 +525,8 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win,
|
|||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags )
|
int flags )
|
||||||
{
|
{
|
||||||
|
GtkWidget *tree = wxGTKPrivate::GetTreeWidget();
|
||||||
|
|
||||||
GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc);
|
GdkWindow* gdk_window = wxGetGdkWindowForDC(win, dc);
|
||||||
wxASSERT_MSG( gdk_window,
|
wxASSERT_MSG( gdk_window,
|
||||||
wxT("cannot use wxRendererNative on wxDC of this type") );
|
wxT("cannot use wxRendererNative on wxDC of this type") );
|
||||||
@@ -533,14 +535,15 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win,
|
|||||||
if (win->GetLayoutDirection() == wxLayout_RightToLeft)
|
if (win->GetLayoutDirection() == wxLayout_RightToLeft)
|
||||||
x_diff = rect.width;
|
x_diff = rect.width;
|
||||||
|
|
||||||
GtkStateType state;
|
GtkStateType state = GTK_STATE_NORMAL;
|
||||||
|
|
||||||
if (flags & wxCONTROL_SELECTED)
|
if (flags & wxCONTROL_SELECTED)
|
||||||
{
|
{
|
||||||
// the wxCONTROL_FOCUSED state is deduced
|
// the wxCONTROL_FOCUSED state is deduced
|
||||||
// directly from the m_wxwindow by GTK+
|
// directly from the m_wxwindow by GTK+
|
||||||
state = GTK_STATE_SELECTED;
|
state = GTK_STATE_SELECTED;
|
||||||
|
|
||||||
gtk_paint_flat_box( win->m_widget->style,
|
gtk_paint_flat_box( tree->style, // win->m_widget->style,
|
||||||
gdk_window,
|
gdk_window,
|
||||||
state,
|
state,
|
||||||
GTK_SHADOW_NONE,
|
GTK_SHADOW_NONE,
|
||||||
@@ -559,7 +562,10 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win,
|
|||||||
|
|
||||||
if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED))
|
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,
|
gdk_window,
|
||||||
state,
|
state,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -569,7 +575,8 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win,
|
|||||||
// Using "treeview-middle" would fix the warning, but the right
|
// Using "treeview-middle" would fix the warning, but the right
|
||||||
// edge of the focus rect is not getting erased properly either.
|
// edge of the focus rect is not getting erased properly either.
|
||||||
// Better to not specify this detail unless the drawing is fixed.
|
// 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.LogicalToDeviceX(rect.x),
|
||||||
dc.LogicalToDeviceY(rect.y),
|
dc.LogicalToDeviceY(rect.y),
|
||||||
rect.width,
|
rect.width,
|
||||||
|
@@ -259,6 +259,13 @@ static void class_init(void* g_class, void*)
|
|||||||
G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
|
G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
|
||||||
|
|
||||||
parent_class = GTK_WIDGET_CLASS(g_type_class_peek_parent(g_class));
|
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"
|
} // extern "C"
|
||||||
|
Reference in New Issue
Block a user