]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp
Make it possible to tell wxXmlResource which domain to pull
[wxWidgets.git] / wxPython / contrib / gizmos / wxCode / src / treelistctrl.cpp
index c28cf7927e3c78dfb90d4f7b08f927c8400e1729..e0931efa84582ae30a4ba08beadd46398951f724 100644 (file)
@@ -112,7 +112,7 @@ class  wxTreeListHeaderWindow : public wxWindow
 {
 protected:
     wxTreeListMainWindow *m_owner;
-    wxCursor             *m_currentCursor;
+    const wxCursor       *m_currentCursor;
     wxCursor             *m_resizeCursor;
     bool                 m_isDragging;
 
@@ -568,6 +568,8 @@ public:
     // implementation helpers
     void SendDeleteEvent(wxTreeListItem *itemBeingDeleted);
 
+    void DoDirtyProcessing();
+    
     void DrawBorder(const wxTreeItemId& item);
     void DrawLine(const wxTreeItemId& item, bool below);
 
@@ -1197,22 +1199,18 @@ void wxTreeListHeaderWindow::OnEraseBackground( wxEraseEvent& event )
 void wxTreeListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
 {
 #ifdef __WXGTK__
-    wxClientDC real_dc( this );
+    wxClientDC dc( this );
 #else
-    wxPaintDC real_dc( this );
+    wxPaintDC dc( this );
 #endif
 
-    AdjustDC( real_dc );
+    AdjustDC( dc );
 
     // width and height of the entire header window
     int w, h;
     GetClientSize( &w, &h );
     m_owner->CalcUnscrolledPosition(w, 0, &w, NULL);
 
-    // Setup double buffering to eliminate the flicker
-    wxMemoryDC dc;
-    wxBitmap   buffer(w, h);
-    dc.SelectObject(buffer);
     dc.SetBackground(wxBrush(GetBackgroundColour()));
     dc.Clear();
     
@@ -1304,10 +1302,6 @@ void wxTreeListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
             this, dc, wxRect(x, HEADER_OFFSET_Y, more_w, h-2),
             m_parent->IsEnabled() ? 0 : wxCONTROL_DISABLED);
     }
-
-    // Finish up by drawing the buffer to the real dc
-    dc.SelectObject(wxNullBitmap);
-    real_dc.DrawBitmap(buffer, 0, 0, false);
 }
 
 void wxTreeListHeaderWindow::DrawCurrent()
@@ -2926,7 +2920,7 @@ void wxTreeListMainWindow::SelectItem(const wxTreeItemId& itemId,
 
 void wxTreeListMainWindow::SelectAll(bool extended_select)
 {
-    wxCHECK_RET( GetWindowStyleFlag() & wxTR_MULTIPLE, wxT("invalid tree style") );
+    wxCHECK_RET( GetWindowStyleFlag() & wxTR_MULTIPLE, wxT("invalid tree style, must have wxTR_MULTIPLE style to select all items") );
 
     wxTreeEvent event( wxEVT_COMMAND_TREE_SEL_CHANGING, m_owner->GetId() );
     event.SetItem( GetRootItem() );
@@ -2954,6 +2948,7 @@ void wxTreeListMainWindow::SelectAll(bool extended_select)
     wxTreeItemId root = GetRootItem();
     wxTreeListItem *first = (wxTreeListItem *)GetFirstChild (root, cookie).m_pItem;
     wxTreeListItem *last = (wxTreeListItem *)GetLastChild (GetRootItem()).m_pItem;
+    if (!first || !last) return;
     if (TagAllChildrenUntilLast (first, last, true)) return;
     TagNextChildren (first, last, true);
 
@@ -3015,7 +3010,8 @@ void wxTreeListMainWindow::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) wxYieldIfNeeded();
+    if (m_dirty) 
+        DoDirtyProcessing();
 
     wxTreeListItem *gitem = (wxTreeListItem*) item.m_pItem;
 
@@ -4075,7 +4071,8 @@ void wxTreeListMainWindow::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) wxYieldIfNeeded();
+    if (m_dirty) 
+        DoDirtyProcessing();
 
     wxString s = m_currentEdit->GetText(/*ALB*/m_main_column);
     int x = m_currentEdit->GetX() + m_imgWidth2;
@@ -4262,7 +4259,7 @@ void wxTreeListMainWindow::OnMouse( wxMouseEvent &event )
             // highlight the current drop target if any
             DrawDropEffect(m_dropTarget);
 
-            wxYieldIfNeeded();
+            DoDirtyProcessing();
         }
     }
     else if ( (event.LeftUp() || event.RightUp()) && m_isDragging )
@@ -4293,7 +4290,7 @@ void wxTreeListMainWindow::OnMouse( wxMouseEvent &event )
 
         SetCursor(m_oldCursor);
 
-        wxYieldIfNeeded();
+        DoDirtyProcessing();
     }
     else
     {
@@ -4396,6 +4393,11 @@ void wxTreeListMainWindow::OnMouse( wxMouseEvent &event )
 }
 
 void wxTreeListMainWindow::OnIdle( wxIdleEvent &WXUNUSED(event) )
+{
+    DoDirtyProcessing();
+}
+
+void wxTreeListMainWindow::DoDirtyProcessing()
 {
     /* after all changes have been done to the tree control,
      * we actually redraw the tree when everything is over */