]> git.saurik.com Git - wxWidgets.git/commitdiff
Implemented selection using shift left click
authorJulian Smart <julian@anthemion.co.uk>
Wed, 13 Feb 2008 17:18:08 +0000 (17:18 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 13 Feb 2008 17:18:08 +0000 (17:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextctrl.cpp

index 25f71a853dd7a9f03692c6235b7f5d22cb9f84b8..24860a64ad87ec4ecdfe036e01d055cfa81b3a22 100644 (file)
@@ -342,8 +342,6 @@ void wxRichTextCtrl::OnLeftClick(wxMouseEvent& event)
         m_dragging = true;
         CaptureMouse();
 
-        SelectNone();
-
         bool caretAtLineStart = false;
 
         if (hit & wxRICHTEXT_HITTEST_BEFORE)
@@ -359,8 +357,24 @@ void wxRichTextCtrl::OnLeftClick(wxMouseEvent& event)
             position --;
         }
 
+        long oldCaretPos = m_caretPosition;
+
         MoveCaret(position, caretAtLineStart);
         SetDefaultStyleToCursorStyle();
+
+        if (event.ShiftDown())
+        {
+            bool extendSel = false;
+            if (m_selectionRange.GetStart() == -2)
+                extendSel = ExtendSelection(oldCaretPos, m_caretPosition, wxRICHTEXT_SHIFT_DOWN);
+            else
+                extendSel = ExtendSelection(m_caretPosition, m_caretPosition, wxRICHTEXT_SHIFT_DOWN);
+
+            if (extendSel)
+                Refresh(false);
+        }
+        else
+            SelectNone();
     }
 
     event.Skip();