DSVColumnView.st
changeset 1947 1e11b36633b2
parent 1946 0738b9f8c19f
child 1948 9ed8131d94bb
--- a/DSVColumnView.st	Thu Mar 08 14:51:25 2001 +0100
+++ b/DSVColumnView.st	Thu Mar 08 15:44:42 2001 +0100
@@ -1901,10 +1901,12 @@
 buttonPress:button x:x y:y
     "a button was pressed - handle selection here
     "
-    |rowNr colNr menu sz first|
+    |rowNr colNr menu sz first sensor|
 
     self isEnabled ifFalse:[^ self].
 
+    sensor := self sensor.
+
     clickPosition   := nil.
     dragAccessPoint := nil.
     dragIsActive    := false.
@@ -1919,7 +1921,7 @@
          and:[(colNr := self xVisibleToColNr:x) notNil]]
         ) ifTrue:[
             multipleSelectOk ifTrue:[
-                self sensor ctrlDown ifTrue:[
+                sensor ctrlDown ifTrue:[
                     selectedColIndex ~~ 0 ifTrue:[
                         colNr := 0
                     ] ifFalse:[
@@ -1927,7 +1929,8 @@
                             (self isInSelection:rowNr) ifTrue:[
                                 sz == 1 ifTrue:[
                                     self selectColIndex:0 rowIndex:nil.
-                                    ^ self sensor flushMotionEventsFor:self.
+                                    sensor flushMotionEventsFor:self.
+                                    ^ self    
                                 ].
                                 selectedRowIndex remove:rowNr.
                             ] ifFalse:[
@@ -1935,13 +1938,14 @@
                             ].
                             self invalidateRowAt:rowNr.
                             self selectionChanged.
-                          ^ self sensor flushMotionEventsFor:self.
+                            sensor flushMotionEventsFor:self.
+                            ^ self
                         ]
                     ]
                 ] ifFalse:[
                     (     selectedColIndex == 0
                      and:[(first := self firstIndexSelected) ~~ 0
-                     and:[self sensor shiftDown]]
+                     and:[sensor shiftDown]]
                     ) ifTrue:[|step list|
                         list := OrderedCollection new.
                         step := first < rowNr ifTrue:[1] ifFalse:[-1].
@@ -1961,9 +1965,6 @@
         ]
     ].
     super buttonPress:button x:x y:y
-
-
-
 !
 
 buttonRelease:button x:x y:y
@@ -2085,7 +2086,7 @@
     "
     <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
                           #BeginOfText #EndOfText #ScrollUp #ScrollDown
-                          #CursorUp #CursorDown #CursorRight #CursorLeft)>
+                          #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)>
 
     |sensor maxColNr selRowNr selColNr key column isTab listSize hasSelectables|
 
@@ -2101,6 +2102,13 @@
         ^ self characterPress:aKey x:x y:y
     ].
 
+    (aKey == #SelectAll) ifTrue:[
+        multipleSelectOk ifTrue:[
+            self selectAllRows. 
+        ].
+        ^ self
+    ].
+
     aKey == #PreviousPage ifTrue:[^ self pageUp].
     aKey == #NextPage     ifTrue:[^ self pageDown].
     aKey == #HalfPageUp   ifTrue:[^ self halfPageUp].
@@ -2217,9 +2225,6 @@
             ^ self selectColIndex:selColNr rowIndex:selRowNr
         ]
     ].
-
-
-
 !
 
 originChanged:delta
@@ -3131,6 +3136,14 @@
     ^ selectedRowIndex size
 !
 
+selectAllRows
+    1 to:list size do:[:eachRowNr |
+        selectedRowIndex add:eachRowNr.    
+        self invalidateRowAt:eachRowNr.
+    ].
+    self selectionChanged.
+!
+
 selectColIndex:aColNr rowIndex:aRowNr
     "change selection with notification
     "
@@ -3448,5 +3461,5 @@
 !DSVColumnView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.119 2001-03-08 13:51:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.120 2001-03-08 14:44:42 cg Exp $'
 ! !