]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
corrected redraw problems with native controls
[wxWidgets.git] / src / generic / treectlg.cpp
index 5adea43870cc022433c1c18ffde604e49c989401..e3f8fda4a26881dc7556f62b122d5e63ab771e58 100644 (file)
@@ -44,7 +44,7 @@
 
 class WXDLLEXPORT wxGenericTreeItem;
 
-WX_DEFINE_ARRAY(wxGenericTreeItem *, wxArrayGenericTreeItems);
+WX_DEFINE_EXPORTED_ARRAY(wxGenericTreeItem *, wxArrayGenericTreeItems);
 //WX_DEFINE_OBJARRAY(wxArrayTreeItemIds);
 
 // ----------------------------------------------------------------------------
@@ -1557,7 +1557,7 @@ void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item)
     // We have to call this here because the label in
     // question might just have been added and no screen
     // update taken place.
-    if (m_dirty) wxYield();
+    if (m_dirty) wxYieldIfNeeded();
 
     wxGenericTreeItem *gitem = (wxGenericTreeItem*) item.m_pItem;
 
@@ -2203,7 +2203,7 @@ wxTreeItemId wxGenericTreeCtrl::HitTest(const wxPoint& point, int& flags)
     // We have to call this here because the label in
     // question might just have been added and no screen
     // update taken place.
-    if (m_dirty) wxYield();
+    if (m_dirty) wxYieldIfNeeded();
 
     wxClientDC dc(this);
     PrepareDC(dc);
@@ -2218,7 +2218,10 @@ wxTreeItemId wxGenericTreeCtrl::HitTest(const wxPoint& point, int& flags)
     if (point.y<0) flags|=wxTREE_HITTEST_ABOVE;
     if (point.y>h) flags|=wxTREE_HITTEST_BELOW;
 
-    return m_anchor->HitTest( wxPoint(x, y), this, flags);
+    if (m_anchor)
+        return m_anchor->HitTest( wxPoint(x, y), this, flags);
+    else
+        return wxTreeItemId();
 }
 
 // get the bounding rectangle of the item (or of its label only)
@@ -2260,7 +2263,7 @@ void wxGenericTreeCtrl::Edit( const wxTreeItemId& item )
     // We have to call this here because the label in
     // question might just have been added and no screen
     // update taken place.
-    if (m_dirty) wxYield();
+    if (m_dirty) wxYieldIfNeeded();
 
     wxString s = m_currentEdit->GetText();
     int x = m_currentEdit->GetX();
@@ -2403,7 +2406,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
             // highlight the current drop target if any
             DrawDropEffect(m_dropTarget);
 
-            wxYield();
+            wxYieldIfNeeded();
         }
     }
     else if ( (event.LeftUp() || event.RightUp()) && m_isDragging )
@@ -2434,7 +2437,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
 
         SetCursor(m_oldCursor);
 
-        wxYield();
+        wxYieldIfNeeded();
     }
     else
     {
@@ -2449,7 +2452,9 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
             wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
             nevent.m_item = (long) item;
             nevent.m_code = 0;
-            nevent.m_pointDrag = wxPoint(x, y);
+            CalcScrolledPosition(x, y,
+                                 &nevent.m_pointDrag.x,
+                                 &nevent.m_pointDrag.y);
             nevent.SetEventObject(this);
             GetEventHandler()->ProcessEvent(nevent);
         }
@@ -2502,7 +2507,9 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
                 wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
                 nevent.m_item = (long) item;
                 nevent.m_code = 0;
-                nevent.m_pointDrag = wxPoint(x, y);
+                CalcScrolledPosition(x, y,
+                                     &nevent.m_pointDrag.x,
+                                     &nevent.m_pointDrag.y);
                 nevent.SetEventObject( this );
                 GetEventHandler()->ProcessEvent( nevent );
             }