]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
some compilers don't like statics in inline functions, even if they're const -- repla...
[wxWidgets.git] / src / generic / treectlg.cpp
index 5f9fd71482aaa6cf8bd44d19380808588c8a4c93..15d66030199128a5d72ce56041316250e81c1a77 100644 (file)
@@ -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);