m_indent = 15;
m_spacing = 18;
+#ifdef __WXMAC__
+ // OS X sel item highlight color differs from text highlight color, which is
+ // what wxSYS_COLOUR_HIGHLIGHT returns.
+ RGBColor hilight;
+ GetThemeBrushAsColor(kThemeBrushAlternatePrimaryHighlightColor, 32, true, &hilight);
+ m_hilightBrush = new wxBrush( wxColour(hilight.red, hilight.green, hilight.blue ), wxSOLID );
+#else
m_hilightBrush = new wxBrush
(
wxSystemSettings::GetColour
),
wxSOLID
);
+#endif
+#ifdef __WXMAC__
+ // on Mac, this color also differs from the wxSYS_COLOUR_BTNSHADOW, enough to be noticable.
+ // I don't know if BTNSHADOW is appropriate in other contexts, so I'm just changing it here.
+ GetThemeBrushAsColor(kThemeBrushSecondaryHighlightColor, 32, true, &hilight);
+ m_hilightUnfocusedBrush = new wxBrush( wxColour(hilight.red, hilight.green, hilight.blue ), wxSOLID );
+#else
m_hilightUnfocusedBrush = new wxBrush
(
wxSystemSettings::GetColour
),
wxSOLID
);
-
+#endif
m_imageListButtons = NULL;
m_ownsImageListButtons = false;
style |= wxTR_NO_LINES;
if (major < 10)
style |= wxTR_ROW_LINES;
+
+ if (style == 0 || style & wxTR_DEFAULT_STYLE)
+ style |= wxTR_FULL_ROW_HIGHLIGHT;
+
#endif // __WXMAC__
+#ifdef __WXGTK20__
+ style |= wxTR_NO_LINES;
+#endif
if ( !wxControl::Create( parent, id, pos, size,
style|wxHSCROLL|wxVSCROLL,
}
// and try all the items (stop when we get to the one we started from)
- while ( id != idParent && !GetItemText(id).Lower().StartsWith(prefix) )
+ while (id.IsOk() && id != idParent && !GetItemText(id).Lower().StartsWith(prefix) )
{
id = GetNext(id);
}
+ // If we haven't found the item, id.IsOk() will be false, as per
+ // documentation
}
return id;
{
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
wxCHECK_RET( item, wxT("SelectItem(): invalid tree item") );
+
+ wxTreeEvent event(wxEVT_COMMAND_TREE_SEL_CHANGING, this, item);
+ if ( GetEventHandler()->ProcessEvent( event ) && !event.IsAllowed() )
+ return;
item->SetHilight(false);
RefreshLine(item);
+
+ event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED);
+ GetEventHandler()->ProcessEvent( event );
}
}
if ( item->IsSelected() )
{
-// under mac selections are only a rectangle in case they don't have the focus
-#ifdef __WXMAC__
- if ( !m_hasFocus )
- {
- dc.SetBrush( *wxTRANSPARENT_BRUSH ) ;
- dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) , 1 , wxSOLID ) ) ;
- }
- else
- {
- dc.SetBrush( *m_hilightBrush ) ;
- }
-#else
dc.SetBrush(*(m_hasFocus ? m_hilightBrush : m_hilightUnfocusedBrush));
-#endif
drawItemBackground = true;
}
else
#endif
)
{
+#ifdef __WXMAC__
+ colText = *wxWHITE;
+#else
colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
+#endif
}
else
{