]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectrl.cpp
I've put live into Vadim's wxNavigationKeyEvent idea
[wxWidgets.git] / src / generic / treectrl.cpp
index ef1742d5c6ad7666496591199b0df606452f68f9..04d3717ec3cf45e27c80eb53b366553f456b07bc 100644 (file)
@@ -140,10 +140,10 @@ private:
 // wxTreeEvent
 // -----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent)
+IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent)
 
 wxTreeEvent::wxTreeEvent( wxEventType commandType, int id )
-           : wxCommandEvent( commandType, id )
+           : wxNotifyEvent( commandType, id )
 {
   m_code = 0;
   m_itemOld = (wxGenericTreeItem *)NULL;
@@ -698,7 +698,7 @@ void wxTreeCtrl::Delete(const wxTreeItemId& itemId)
 
   delete item;
 
-  Refresh();
+  m_dirty = TRUE;
 }
 
 void wxTreeCtrl::DeleteAllItems()
@@ -708,7 +708,7 @@ void wxTreeCtrl::DeleteAllItems()
     delete m_anchor;
     m_anchor = NULL;
 
-    Refresh();
+    m_dirty = TRUE;
   }
 }
 
@@ -716,6 +716,9 @@ void wxTreeCtrl::Expand(const wxTreeItemId& itemId)
 {
   wxGenericTreeItem *item = itemId.m_pItem;
 
+  if ( !item->HasPlus() ) 
+    return;
+  
   if ( item->IsExpanded() )
     return;
 
@@ -1017,6 +1020,7 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
     {
       dc.DrawLine( horizX+20, y, horizX+30, y );
       dc.SetPen( *wxGREY_PEN );
+      dc.SetBrush( *wxWHITE_BRUSH );
       dc.DrawRectangle( horizX+10, y-4, 11, 9 );
       dc.SetPen( *wxBLACK_PEN );
       dc.DrawLine( horizX+13, y, horizX+18, y );
@@ -1108,6 +1112,11 @@ void wxTreeCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
 
 void wxTreeCtrl::OnChar( wxKeyEvent &event )
 {
+  wxTreeEvent te( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
+  te.m_code = event.KeyCode();
+  te.SetEventObject( this );
+  GetEventHandler()->ProcessEvent( te );
+
   if (m_current == 0)
   {
      event.Skip();
@@ -1118,7 +1127,7 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event )
   {
     case '+':
     case WXK_ADD:
-      if (HasChildren(m_current) && !IsExpanded(m_current))
+      if (m_current->HasPlus() && !IsExpanded(m_current))
       {
         Expand(m_current);
       }
@@ -1140,7 +1149,7 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event )
     case ' ':
     case WXK_RETURN:
       {
-        wxTreeEvent event( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
+        wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
         event.m_item = m_current;
         event.m_code = 0;
         event.SetEventObject( this );
@@ -1232,7 +1241,7 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
 
   if ( event.LeftDClick() )
   {
-    wxTreeEvent event( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
+    wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
     event.m_item = item;
     event.m_code = 0;
     event.SetEventObject( this );