X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39faaf39b10ed74739a4dc00c683a0319bf8896d..5cb61fed97c78e0399ba18457e45b51f8eb15edf:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 5f9fd71482..15d6603019 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -475,7 +475,7 @@ void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &event ) // We must finish regardless of success, otherwise we'll get // focus problems: Finish(); - + if ( !AcceptChanges() ) m_owner->OnRenameCancelled( m_itemEdited ); } @@ -896,7 +896,8 @@ wxGenericTreeCtrl::GetChildrenCount(const wxTreeItemId& item, void wxGenericTreeCtrl::SetWindowStyle(const long styles) { - if (!HasFlag(wxTR_HIDE_ROOT) && (styles & wxTR_HIDE_ROOT)) + // Do not try to expand the root node if it hasn't been created yet + if (m_anchor && !HasFlag(wxTR_HIDE_ROOT) && (styles & wxTR_HIDE_ROOT)) { // if we will hide the root, make sure children are visible m_anchor->SetHasPlus(); @@ -1931,7 +1932,7 @@ void wxGenericTreeCtrl::SelectItem(const wxTreeItemId& itemId, bool select) { if ( select ) { - DoSelectItem(itemId); + DoSelectItem(itemId, !HasFlag(wxTR_MULTIPLE)); } else // deselect { @@ -2279,12 +2280,14 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) { wxColour colBg; if ( attr && attr->HasBackgroundColour() ) - { - drawItemBackground = true; + { + drawItemBackground = true; colBg = attr->GetBackgroundColour(); - } + } else + { colBg = m_backgroundColour; + } dc.SetBrush(wxBrush(colBg, wxSOLID)); } @@ -3246,7 +3249,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) { // this facilitates multiple-item drag-and-drop - if (item && HasFlag(wxTR_MULTIPLE)) + if ( /* item && */ HasFlag(wxTR_MULTIPLE)) { wxArrayTreeItemIds selections; size_t count = GetSelections(selections);