DSVColumnView.st
changeset 3217 e74188fce7c2
parent 3215 edb9fb9e4931
child 3219 91f015463a3d
equal deleted inserted replaced
3216:18f104700621 3217:e74188fce7c2
  2193 !
  2193 !
  2194 
  2194 
  2195 buttonMultiPress:button x:x y:y
  2195 buttonMultiPress:button x:x y:y
  2196     "a button was pressed twice - handle doubleclick here"
  2196     "a button was pressed twice - handle doubleclick here"
  2197 
  2197 
       
  2198     |selectedCol|
       
  2199 
  2198     buttonMotionAction := buttonReleaseAction := nil.
  2200     buttonMotionAction := buttonReleaseAction := nil.
  2199 
  2201 
  2200     self isEnabled ifFalse:[^ self].
  2202     self isEnabled ifFalse:[^ self].
  2201 
  2203 
  2202     ((button == 1) or:[button == #select]) ifFalse:[
  2204     ((button == 1) or:[button == #select]) ifFalse:[
  2203         ^ super buttonMultiPress:button x:x y:y
  2205         ^ super buttonMultiPress:button x:x y:y
  2204     ].
  2206     ].
  2205     self numberOfSelections == 1 ifTrue:[
  2207     self numberOfSelections == 1 ifTrue:[
  2206         self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[
  2208         self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[
  2207             (     self selectedColIndex == 0
  2209             selectedCol := self selectedColIndex.
  2208               or:[self selectedColIndex == (self xVisibleToColNr:x)]
  2210             ( selectedCol == 0
       
  2211               or:[selectedCol == (self xVisibleToColNr:x)]
  2209             ) ifTrue:[
  2212             ) ifTrue:[
  2210                 self doubleClicked
  2213                 self doubleClicked
  2211             ]
  2214             ]
  2212         ]
  2215         ]
  2213     ]
  2216     ]
       
  2217 
       
  2218     "Modified: / 26-03-2007 / 15:19:04 / cg"
  2214 !
  2219 !
  2215 
  2220 
  2216 buttonPress:button x:x y:y
  2221 buttonPress:button x:x y:y
  2217     "a button was pressed - handle selection here"
  2222     "a button was pressed - handle selection here"
  2218 
  2223 
  2815     |colNr col|
  2820     |colNr col|
  2816 
  2821 
  2817     columnDescriptors isEmpty ifTrue:[^ nil].
  2822     columnDescriptors isEmpty ifTrue:[^ nil].
  2818 
  2823 
  2819     colNr := self xVisibleToColNr:aPoint x.
  2824     colNr := self xVisibleToColNr:aPoint x.
  2820     colNr ~~ 0 ifTrue:[
  2825     colNr notNil ifTrue:[
  2821         col := columnDescriptors at:colNr.
  2826         col := columnDescriptors at:colNr.
  2822         ^ col activeHelpText.
  2827         ^ col activeHelpText.
  2823     ].
  2828     ].
  2824     ^ nil
  2829     ^ nil
  2825 
  2830 
  3206     ].
  3211     ].
  3207     ^ x
  3212     ^ x
  3208 !
  3213 !
  3209 
  3214 
  3210 xVisibleToColNr:x 
  3215 xVisibleToColNr:x 
  3211     "returns the column number assigned to a physical x or nil"
  3216     "returns the column number for a physical x position.
       
  3217      Returns nil if x is behond the last column."
  3212     
  3218     
  3213     |x0|
  3219     |x0|
  3214 
  3220 
  3215     x0 := x + viewOrigin x - margin.
  3221     x0 := x + viewOrigin x - margin.
  3216     columnDescriptors keysAndValuesDo:[:index :aCol | 
  3222     columnDescriptors keysAndValuesDo:[:index :aCol | 
  3217         x0 := x0 - aCol width.
  3223         x0 := x0 - aCol width.
  3218         x0 <= 0 ifTrue:[ ^ index ].
  3224         x0 <= 0 ifTrue:[ ^ index ].
  3219     ].
  3225     ].
  3220     ^ nil.
  3226     ^ nil.
  3221 
  3227 
  3222     "Modified: / 26-03-2007 / 14:45:26 / cg"
  3228     "Modified: / 26-03-2007 / 15:22:01 / cg"
  3223 !
  3229 !
  3224 
  3230 
  3225 yVisibleOfRowNr:aRowNr 
  3231 yVisibleOfRowNr:aRowNr 
  3226     "returns visible y assigned to the row number"
  3232     "returns visible y assigned to the row number"
  3227     
  3233     
  4321 ! !
  4327 ! !
  4322 
  4328 
  4323 !DSVColumnView class methodsFor:'documentation'!
  4329 !DSVColumnView class methodsFor:'documentation'!
  4324 
  4330 
  4325 version
  4331 version
  4326     ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.223 2007-03-26 12:44:55 cg Exp $'
  4332     ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.224 2007-03-26 13:22:21 cg Exp $'
  4327 ! !
  4333 ! !