From 8bc0c17afc3a83b625a6109375bf86a126cac69e Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Sun, 19 Nov 2006 06:47:48 +0000 Subject: [PATCH] Migate to the new wxRendererNative::DrawItemSelectionRect function where available, and fix selected text color on Mac. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/wx/lib/customtreectrl.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/wxPython/wx/lib/customtreectrl.py b/wxPython/wx/lib/customtreectrl.py index 8d6ad6b4d4..d987320ca0 100644 --- a/wxPython/wx/lib/customtreectrl.py +++ b/wxPython/wx/lib/customtreectrl.py @@ -4296,7 +4296,12 @@ class CustomTreeCtrl(wx.PyScrolledWindow): elif self._vistaselection: self.DrawVistaRectangle(dc, itemrect, self._hasFocus) else: - dc.DrawRectangleRect(itemrect) + if wx.Platform in ["__WXGTK2__", "__WXMAC__"]: + flags = wx.CONTROL_SELECTED + if self._hasFocus: flags = flags | wx.CONTROL_FOCUSED + wx.RendererNative.Get().DrawItemSelectionRect(self, dc, itemrect, flags) + else: + dc.DrawRectangleRect(itemrect) else: @@ -4324,7 +4329,12 @@ class CustomTreeCtrl(wx.PyScrolledWindow): elif self._vistaselection: self.DrawVistaRectangle(dc, itemrect, self._hasFocus) else: - dc.DrawRectangleRect(itemrect) + if wx.Platform in ["__WXGTK2__", "__WXMAC__"]: + flags = wx.CONTROL_SELECTED + if self._hasFocus: flags = flags | wx.CONTROL_FOCUSED + wx.RendererNative.Get().DrawItemSelectionRect(self, dc, itemrect, flags) + else: + dc.DrawRectangleRect(itemrect) # On GTK+ 2, drawing a 'normal' background is wrong for themes that # don't allow backgrounds to be customized. Not drawing the background, @@ -4382,6 +4392,8 @@ class CustomTreeCtrl(wx.PyScrolledWindow): dc.DrawLabel(item.GetText(), textrect) dc.SetTextForeground(foreground) else: + if wx.Platform == "__WXMAC__" and item.IsSelected() and self._hasFocus: + dc.SetTextForeground(wx.WHITE) dc.DrawLabel(item.GetText(), textrect) wnd = item.GetWindow() -- 2.47.2