From b204641ec9cbea910f1acdeaf156be02f6d2e6ba Mon Sep 17 00:00:00 2001
From: Robert Roebling <robert@roebling.de>
Date: Wed, 29 Jul 1998 08:07:45 +0000
Subject: [PATCH]   wxListCtrl selection improved

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/generic/listctrl.cpp | 63 ++++++++++++++++++++++++++++++++++++++--
 user/wxFile/wxFile.cpp   |  4 +--
 user/wxFile/wxFile.h     |  1 -
 3 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp
index 03ffc62dd6..6c6eba0be6 100644
--- a/src/generic/listctrl.cpp
+++ b/src/generic/listctrl.cpp
@@ -1098,9 +1098,60 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
   {
     m_usedKeys = FALSE;
     wxListLineData *oldCurrent = m_current;
-    m_current = line;
-    if (!event.ShiftDown() || (m_mode & wxLC_SINGLE_SEL)) HilightAll( FALSE );
-    m_current->ReverseHilight();
+    if (m_mode & wxLC_SINGLE_SEL)
+    {
+      m_current = line;
+      HilightAll( FALSE );
+      m_current->ReverseHilight();
+    }
+    else
+    {
+      if (event.ShiftDown())
+      {
+        m_current = line;
+        m_current->ReverseHilight();
+      }
+      else if (event.ControlDown())
+      {
+        m_current = line;
+        int numOfCurrent = -1;
+        node = m_lines.First();
+        while (node)
+        {
+          wxListLineData *test_line = (wxListLineData*)node->Data();
+	  numOfCurrent++;
+	  if (test_line == oldCurrent) break;
+          node = node->Next();
+        };
+        int numOfLine = -1;
+        node = m_lines.First();
+        while (node)
+        {
+          wxListLineData *test_line = (wxListLineData*)node->Data();
+	  numOfLine++;
+	  if (test_line == line) break;
+          node = node->Next();
+        };
+	
+	if (numOfLine < numOfCurrent) 
+	  { int i = numOfLine; numOfLine = numOfCurrent; numOfCurrent = i; }
+	wxNode *node = m_lines.Nth( numOfCurrent );
+	for (int i = 0; i <= numOfLine-numOfCurrent; i++)
+	{
+	  wxListLineData *test_line= (wxListLineData*)node->Data();
+	  test_line->Hilight(TRUE);
+	  RefreshLine( test_line );
+	  node = node->Next();
+	}
+	return;
+      }
+      else 
+      {
+        m_current = line;
+        HilightAll( FALSE );
+        m_current->ReverseHilight();
+      }
+    }
     RefreshLine( m_current );
     if (m_current != oldCurrent)
     {
@@ -1248,6 +1299,12 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
       };
       break;
     };
+    case WXK_SPACE:
+    {
+      m_current->ReverseHilight();
+      RefreshLine( m_current );
+    };
+    break;
     case WXK_INSERT:
     {
       if (!(m_mode & wxLC_SINGLE_SEL))
diff --git a/user/wxFile/wxFile.cpp b/user/wxFile/wxFile.cpp
index 7a3282430b..5057a46d8e 100644
--- a/user/wxFile/wxFile.cpp
+++ b/user/wxFile/wxFile.cpp
@@ -121,7 +121,7 @@ MyFrame::MyFrame(void) :
   SetStatusText( "Welcome", 0 );
   SetStatusText( "wxFile v0.2 by Robert Roebling.", 1 );
   
-  wxToolBar *m_tb = CreateToolBar( ID_TOOLBAR );
+  wxToolBar *m_tb = CreateToolBar();
   m_tb->SetMargins( 2, 2 );
   
   m_tb->AddSeparator();
@@ -148,7 +148,7 @@ MyFrame::MyFrame(void) :
   m_tb->AddSeparator();
   m_tb->AddTool( ID_ABOUT, wxBitmap( help_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "About wxFile" );
   
-  m_tb->Layout();
+  m_tb->Realize();
   
   m_splitter = new wxSplitterWindow( this, -1, wxPoint(0,0), wxSize(400,300), wxSP_3D );
   
diff --git a/user/wxFile/wxFile.h b/user/wxFile/wxFile.h
index ee5d3ac884..9337c77db1 100644
--- a/user/wxFile/wxFile.h
+++ b/user/wxFile/wxFile.h
@@ -62,7 +62,6 @@ class MyFrame: public wxFrame
     void OnTreeSelected( wxTreeEvent &event );
     void OnTreeKeyDown( wxTreeEvent &event );
     
-    wxToolBar          *m_tb;
     wxSplitterWindow   *m_splitter;
     wxFileCtrl         *m_rightFile;
     wxFileCtrl         *m_leftFile;
-- 
2.47.2