--- a/HierarchicalListView.st Fri Oct 18 08:19:56 2002 +0200
+++ b/HierarchicalListView.st Fri Oct 18 11:08:14 2002 +0200
@@ -984,35 +984,42 @@
!HierarchicalListView methodsFor:'event handling'!
-buttonMultiPress:button x:x y:y
- "handle a button multiPress event
- "
- |lnNr|
-
- enabled ifTrue:[
- ( (button == 1 or:[button == #select])
- and:[(lnNr := self indicatorLineAtX:x y:y) notNil]
- ) ifFalse:[
- super buttonMultiPress:button x:x y:y
- ]
- ]
-!
-
buttonPress:button x:x y:y
"handle a button press event
"
- |lineNr|
+ |line item x0 y0|
enabled ifFalse:[^ self].
- (button == 1 or:[button == #select]) ifTrue:[
- lineNr := self indicatorLineAtX:x y:y.
+ line := self yVisibleToLineNr:y.
+ line notNil ifTrue:[
+ item := list at:line ifAbsent:nil.
+ item notNil ifTrue:[
+ x0 := self xOfStringLevel:(item level).
+
+ x >= x0 ifTrue:[
+ y0 := self yVisibleOfLine:line.
- lineNr notNil ifTrue:[
- self indicatorPressedAt:lineNr.
- ^ self
+ (item processButtonPress:button x:(x - x0) y:(y - y0)) == true ifTrue:[
+ ^ self
+ ].
+ ].
+ ]
+ ] ifFalse:[
+ item := nil
+ ].
+
+ (button == 1 or:[button == #select]) ifTrue:[
+ (item notNil and:[indicatorAction notNil and:[item hasIndicator]]) ifTrue:[
+ x0 := self xOfFigureLevel:(item level - 1).
+
+ (x > x0 and:[(x0 + imageWidth) > x]) ifTrue:[
+ self indicatorPressedAt:line.
+ ^ self
+ ].
].
].
+
super buttonPress:button x:x y:y.
!
@@ -1204,29 +1211,6 @@
^ height max:minLineHeight
!
-indicatorLineAtX:x y:y
- "returns the lineNumber assigned to an indicator at x/y or nil
- "
- |lnNr item x0|
-
- indicatorAction isNil ifTrue:[^ nil]. "/ no action, thus no indicator defined
-
- lnNr := self yVisibleToLineNr:y.
- lnNr isNil ifTrue:[ ^ nil]. "/ y not in a valid line
-
- item := list at:lnNr ifAbsent:nil.
- item isNil ifTrue:[ ^ nil]. "/ no item at line
-
- item hasIndicator ifTrue:[
- x0 := self xOfFigureLevel:(item level - 1).
-
- (x > x0 and:[(x0 + imageWidth) > x]) ifTrue:[
- ^ lnNr
- ]
- ].
- ^ nil
-!
-
smallestLevelBetween:start and:stop
"returns the smallest level between a range
"
@@ -1438,5 +1422,5 @@
!HierarchicalListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.59 2002-10-18 06:19:56 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalListView.st,v 1.60 2002-10-18 09:08:05 ca Exp $'
! !