Use DrawItemSelectionRect on GTK2 and OS X. Also, use white text when drawing focused under Mac.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3021,24 +3021,34 @@ void wxTreeListMainWindow::PaintItem (wxTreeListItem *item, wxDC& dc) {
|
|||||||
#endif // !__WXMAC__
|
#endif // !__WXMAC__
|
||||||
dc.SetTextForeground (colTextHilight);
|
dc.SetTextForeground (colTextHilight);
|
||||||
}else if (item->IsSelected()) {
|
}else if (item->IsSelected()) {
|
||||||
|
#if defined(__WXGTK2__) || defined(__WXMAC__)
|
||||||
|
int flags = wxCONTROL_SELECTED;
|
||||||
|
if (m_hasFocus)
|
||||||
|
{
|
||||||
|
flags |= wxCONTROL_FOCUSED;
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
dc.SetTextForeground( *wxWHITE );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
wxRendererNative::GetDefault().DrawItemSelectionRect( m_owner, dc, wxRect( 0, item->GetY() + off_h, total_w, total_h - off_h ), flags);
|
||||||
|
#else
|
||||||
if (!m_isDragging && m_hasFocus) {
|
if (!m_isDragging && m_hasFocus) {
|
||||||
dc.SetBrush (*m_hilightBrush);
|
dc.SetBrush (*m_hilightBrush);
|
||||||
#ifndef __WXMAC__ // don't draw rect outline if we already have the background color
|
|
||||||
dc.SetPen (*wxBLACK_PEN);
|
dc.SetPen (*wxBLACK_PEN);
|
||||||
#endif // !__WXMAC__
|
|
||||||
}else{
|
}else{
|
||||||
dc.SetBrush (*m_hilightUnfocusedBrush);
|
dc.SetBrush (*m_hilightUnfocusedBrush);
|
||||||
#ifndef __WXMAC__ // don't draw rect outline if we already have the background color
|
|
||||||
dc.SetPen (*wxTRANSPARENT_PEN);
|
dc.SetPen (*wxTRANSPARENT_PEN);
|
||||||
#endif // !__WXMAC__
|
|
||||||
}
|
}
|
||||||
dc.SetTextForeground (colTextHilight);
|
dc.SetTextForeground (colTextHilight);
|
||||||
|
#endif // defined(__WXGTK2__) || defined(__WXMAC__)
|
||||||
}else if (item == m_curItem) {
|
}else if (item == m_curItem) {
|
||||||
dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
|
dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
|
||||||
}else{
|
}else{
|
||||||
dc.SetTextForeground (colText);
|
dc.SetTextForeground (colText);
|
||||||
}
|
}
|
||||||
|
#if !defined(__WXGTK2__) && !defined(__WXMAC__)
|
||||||
dc.DrawRectangle (0, item->GetY() + off_h, total_w, total_h - off_h);
|
dc.DrawRectangle (0, item->GetY() + off_h, total_w, total_h - off_h);
|
||||||
|
#endif
|
||||||
}else{
|
}else{
|
||||||
dc.SetTextForeground (colText);
|
dc.SetTextForeground (colText);
|
||||||
}
|
}
|
||||||
@@ -3099,24 +3109,34 @@ void wxTreeListMainWindow::PaintItem (wxTreeListItem *item, wxDC& dc) {
|
|||||||
#endif // !__WXMAC__
|
#endif // !__WXMAC__
|
||||||
dc.SetTextForeground (colTextHilight);
|
dc.SetTextForeground (colTextHilight);
|
||||||
}else if (item->IsSelected()) {
|
}else if (item->IsSelected()) {
|
||||||
|
#if defined(__WXGTK2__) || defined(__WXMAC__)
|
||||||
|
int flags = wxCONTROL_SELECTED;
|
||||||
|
if (m_hasFocus)
|
||||||
|
{
|
||||||
|
flags |= wxCONTROL_FOCUSED;
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
dc.SetTextForeground( *wxWHITE );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
wxRendererNative::GetDefault().DrawItemSelectionRect( m_owner, dc, wxRect( 0, item->GetY() + off_h, total_w, total_h - off_h ), flags);
|
||||||
|
#else
|
||||||
if (!m_isDragging && m_hasFocus) {
|
if (!m_isDragging && m_hasFocus) {
|
||||||
dc.SetBrush (*m_hilightBrush);
|
dc.SetBrush (*m_hilightBrush);
|
||||||
#ifndef __WXMAC__ // don't draw rect outline if we already have the background color
|
|
||||||
dc.SetPen (*wxBLACK_PEN);
|
dc.SetPen (*wxBLACK_PEN);
|
||||||
#endif // !__WXMAC__
|
|
||||||
}else{
|
}else{
|
||||||
dc.SetBrush (*m_hilightUnfocusedBrush);
|
dc.SetBrush (*m_hilightUnfocusedBrush);
|
||||||
#ifndef __WXMAC__ // don't draw rect outline if we already have the background color
|
|
||||||
dc.SetPen (*wxTRANSPARENT_PEN);
|
dc.SetPen (*wxTRANSPARENT_PEN);
|
||||||
#endif // !__WXMAC__
|
|
||||||
}
|
}
|
||||||
dc.SetTextForeground (colTextHilight);
|
dc.SetTextForeground (colTextHilight);
|
||||||
|
#endif // defined(__WXGTK2__) || defined(__WXMAC__)
|
||||||
}else if (item == m_curItem) {
|
}else if (item == m_curItem) {
|
||||||
dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
|
dc.SetPen (m_hasFocus? *wxBLACK_PEN: *wxTRANSPARENT_PEN);
|
||||||
}else{
|
}else{
|
||||||
dc.SetTextForeground (colText);
|
dc.SetTextForeground (colText);
|
||||||
}
|
}
|
||||||
|
#if !defined(__WXGTK2__) && !defined(__WXMAC__)
|
||||||
dc.DrawRectangle (text_x, item->GetY() + off_h, text_w, total_h - off_h);
|
dc.DrawRectangle (text_x, item->GetY() + off_h, text_w, total_h - off_h);
|
||||||
|
#endif
|
||||||
}else{
|
}else{
|
||||||
dc.SetTextForeground (colText);
|
dc.SetTextForeground (colText);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user