]> git.saurik.com Git - wxWidgets.git/commitdiff
wxListCtrl selection improved
authorRobert Roebling <robert@roebling.de>
Wed, 29 Jul 1998 08:07:45 +0000 (08:07 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 29 Jul 1998 08:07:45 +0000 (08:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp
user/wxFile/wxFile.cpp
user/wxFile/wxFile.h

index 03ffc62dd6fbac84c2cb8341edb588251e11a830..6c6eba0be62fd2caa61a8ee0053d00522d0d1bb1 100644 (file)
@@ -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))
index 7a3282430bb7d99a1377dd5142bb6fc576f81eb8..5057a46d8e17af415c4709f47d7a77655a8ec9c2 100644 (file)
@@ -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 );
   
index ee5d3ac884eeb2ba23c51286cc7f273062fc2f5e..9337c77db15e6ed8766929de8d534244e94a954f 100644 (file)
@@ -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;