]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
We need to update the scrollbar even if it's not shown, otherwise it can get stuck...
[wxWidgets.git] / src / generic / treectlg.cpp
index ca9a9565dffd741c14f3561445bc71ed8152bd2e..89df6f6b1954038a6c6f6243cbcb9bb978c1ef38 100644 (file)
@@ -758,6 +758,8 @@ void wxGenericTreeCtrl::Init()
 
     m_findTimer = NULL;
 
+    m_dropEffectAboveItem = false;
+
     m_lastOnSame = false;
 
 #ifdef __WXMAC_CARBON__
@@ -2499,7 +2501,7 @@ void wxGenericTreeCtrl::DrawDropEffect(wxGenericTreeItem *item)
         {
             // draw a line under the drop target because the item will be
             // dropped there
-            DrawLine(item, true /* below */);
+            DrawLine(item, !m_dropEffectAboveItem );
         }
 
         SetCursor(wxCURSOR_BULLSEYE);
@@ -3086,7 +3088,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
             // remember the old cursor because we will change it while
             // dragging
             m_oldCursor = m_cursor;
-            
+
             // in a single selection control, hide the selection temporarily
             if ( !(GetWindowStyleFlag() & wxTR_MULTIPLE) )
             {
@@ -3175,11 +3177,12 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
 
         if ( event.RightDown() )
         {
+            DoSelectItem(item, true, false);
             wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
             nevent.m_item = item;
             nevent.m_pointDrag = CalcScrolledPosition(pt);
             nevent.SetEventObject(this);
-            GetEventHandler()->ProcessEvent(nevent);
+            event.Skip(!GetEventHandler()->ProcessEvent(nevent));
         }
         else if ( event.LeftUp() )
         {
@@ -3561,6 +3564,20 @@ wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 #endif
 }
 
+#if WXWIN_COMPATIBILITY_2_4
+
+int wxGenericTreeCtrl::GetItemSelectedImage(const wxTreeItemId& item) const
+{
+    return GetItemImage(item, wxTreeItemIcon_Selected);
+}
+
+void wxGenericTreeCtrl::SetItemSelectedImage(const wxTreeItemId& item, int image)
+{
+    SetItemImage(item, image, wxTreeItemIcon_Selected);
+}
+
+#endif // WXWIN_COMPATIBILITY_2_4
+
 #if WXWIN_COMPATIBILITY_2_2
 
 wxTreeItemId wxGenericTreeCtrl::GetParent(const wxTreeItemId& item) const