]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listctrl.cpp
In DialogEd, changed Close to Destroy to make it shut down properly.
[wxWidgets.git] / src / generic / listctrl.cpp
index 7b63d0044a49becce1e6cf0350914977a228c3d8..c395229e1cf71cef0bd538d69c7ef1035186923d 100644 (file)
@@ -1216,7 +1216,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
         m_lastOnSame = FALSE;
         m_renameTimer->Stop();
     
-        SendNotify( line, wxEVT_COMMAND_LIST_KEY_DOWN );
+        SendNotify( line, wxEVT_COMMAND_LIST_ITEM_ACTIVATED );
     
        return;
     }
@@ -1369,6 +1369,11 @@ void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown )
 
 void wxListMainWindow::OnChar( wxKeyEvent &event )
 {
+  wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
+  le.m_code = event.KeyCode();
+  le.SetEventObject( GetParent() );
+  GetParent()->GetEventHandler()->ProcessEvent( le );
+  
 /*
   if (event.KeyCode() == WXK_TAB)
   {
@@ -1379,7 +1384,12 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
     return;
   }
 */
-  if (!m_current) return;
+  if ( !m_current )
+  {
+      event.Skip();
+      return;
+  }
+
   switch (event.KeyCode())
   {
     case WXK_UP:
@@ -1482,7 +1492,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
     case WXK_RETURN:
     case WXK_EXECUTE:
     {
-      wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
+      wxListEvent le( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, GetParent()->GetId() );
       le.SetEventObject( GetParent() );
       le.m_itemIndex = GetIndexOfLine( m_current );
       m_current->GetItem( 0, le.m_item );
@@ -1913,7 +1923,7 @@ void wxListMainWindow::CalculatePositions( void )
         int y = 1;
         int entireHeight = m_lines.Number() * lineSpacing + 2;
         int scroll_pos = GetScrollPos( wxVERTICAL );
-        SetScrollbars( m_xScroll, m_yScroll, 0, (entireHeight+15-6) / m_yScroll, 0, scroll_pos, TRUE );
+        SetScrollbars( m_xScroll, m_yScroll, 0, (entireHeight+15) / m_yScroll, 0, scroll_pos, TRUE );
         GetClientSize( &clientWidth, &clientHeight );
 
         wxNode* node = m_lines.First();
@@ -1959,11 +1969,11 @@ void wxListMainWindow::CalculatePositions( void )
                 line->GetSize( lineWidth, lineHeight );
                 if (lineWidth > maxWidth) maxWidth = lineWidth;
                 y += lineSpacing;
-                if (y+lineSpacing-7 >= clientHeight) // -7 for earlier "line breaking"
+                if (y+lineSpacing-6 >= clientHeight) // -6 for earlier "line breaking"
                 {
                     y = 5;
-                    x += maxWidth+5;
-                    entireWidth += maxWidth+5;
+                    x += maxWidth+6;
+                    entireWidth += maxWidth+6;
                     maxWidth = 0;
                 }
                 node = node->Next();
@@ -1976,7 +1986,7 @@ void wxListMainWindow::CalculatePositions( void )
                 if (!node) tries = 1;  // everything fits, no second try required
             }
         }
-        m_visibleLines = (clientHeight+7) / (lineSpacing); // +7 for earlier "line breaking"
+        m_visibleLines = (clientHeight+6) / (lineSpacing); // +6 for earlier "line breaking"
        
         int scroll_pos = GetScrollPos( wxHORIZONTAL );
         SetScrollbars( m_xScroll, m_yScroll, (entireWidth+15) / m_xScroll, 0, scroll_pos, 0, TRUE );
@@ -2291,7 +2301,7 @@ bool wxListCtrl::Create( wxWindow *parent, wxWindowID id,
   m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, s );
 
   if (GetWindowStyleFlag() & wxLC_REPORT)
-    m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(size.x,23) );
+    m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(size.x,23), wxTAB_TRAVERSAL );
   else
     m_headerWin = (wxListHeaderWindow *) NULL;
 
@@ -2345,7 +2355,7 @@ void wxListCtrl::SetWindowStyleFlag( long flag )
 //      m_mainWin->SetSize( 0, 24, width, height-24 );
       if (!m_headerWin)
       {
-        m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(width,23) );
+        m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(width,23), wxTAB_TRAVERSAL );
       }
       else
       {
@@ -2586,10 +2596,17 @@ bool wxListCtrl::DeleteAllItems(void)
   return TRUE;
 }
 
-void wxListCtrl::DeleteAllColumns()
+bool wxListCtrl::DeleteAllColumns()
 {
     for ( size_t n = 0; n < m_mainWin->m_columns.GetCount(); n++ )
         DeleteColumn(n);
+       
+   return TRUE;
+}
+
+void wxListCtrl::ClearAll()
+{
+  m_mainWin->DeleteEverything();
 }
 
 bool wxListCtrl::DeleteColumn( int col )