DSVLabelView.st
changeset 3216 18f104700621
parent 3214 28214ee49bb6
child 3324 bdd503be73d1
equal deleted inserted replaced
3215:edb9fb9e4931 3216:18f104700621
   289 buttonMotion:state x:x y:y
   289 buttonMotion:state x:x y:y
   290     "mouse-button was moved;
   290     "mouse-button was moved;
   291      redraw thumb at its new position and, if scroll-mode is asynchronous, 
   291      redraw thumb at its new position and, if scroll-mode is asynchronous, 
   292      the scroll action is performed
   292      the scroll action is performed
   293     "
   293     "
   294     |idx x1 col|
   294     |colNr x1 col|
   295 
   295 
   296     state = 0 ifTrue:[
   296     state = 0 ifTrue:[
   297         lineDrag := nil.
   297         lineDrag := nil.
   298     ].
   298     ].
   299 
   299 
   309         ].
   309         ].
   310         ^ self.
   310         ^ self.
   311     ].
   311     ].
   312 
   312 
   313     "/ in the resize area ?
   313     "/ in the resize area ?
   314     idx := self xVisibleToColNr:(x-tabSpacing).
   314     colNr := self xVisibleToColNr:(x-tabSpacing).
   315     col := columns at:idx ifAbsent:nil.
   315     colNr notNil ifTrue:[
   316 
   316         col := columns at:colNr.
   317     (col notNil and:[col isResizeable]) ifTrue:[
   317 
   318         x1 := self xVisibleOfColNr:(idx + 1).
   318         (col notNil and:[col isResizeable]) ifTrue:[
   319         (x between:(x1-tabSpacing) and:(x1+tabSpacing))
   319             x1 := self xVisibleOfColNr:(colNr + 1).
   320         "/ x + tabSpacing > x1 
   320             (x between:(x1-tabSpacing) and:(x1+tabSpacing))
   321         ifTrue:[
   321             "/ x + tabSpacing > x1 
   322             self cursor:handleCursor.
   322             ifTrue:[
   323             ^ self
   323                 self cursor:handleCursor.
       
   324                 ^ self
       
   325             ].
   324         ].
   326         ].
   325     ].
   327     ].
   326 
       
   327     self cursor:(Cursor normal)
   328     self cursor:(Cursor normal)
   328 
   329 
   329     "Modified: / 26-03-2007 / 13:36:01 / cg"
   330     "Modified: / 26-03-2007 / 15:20:27 / cg"
   330 !
   331 !
   331 
   332 
   332 buttonPress:button x:x y:y
   333 buttonPress:button x:x y:y
   333     "handle a button press event; checks whether the item under the mouse
   334     "handle a button press event; checks whether the item under the mouse
   334      is selectable. If true, the selection is set to the item.
   335      is selectable. If true, the selection is set to the item.
   335     "
   336     "
   336     |x1 idx col|
   337     |x1 colNr col|
   337 
   338 
   338     (enabled and:[shown]) ifFalse:[
   339     (enabled and:[shown]) ifFalse:[
   339         ^ self
   340         ^ self
   340     ].
   341     ].
   341 
   342 
   342     "/ in the resize area ?
   343     "/ in the resize area ?
   343     idx := self xVisibleToColNr:(x-tabSpacing).
   344     colNr := self xVisibleToColNr:(x-tabSpacing).
   344     idx ~~ 0 ifTrue:[
   345     colNr notNil ifTrue:[
   345         col := columns at:idx.
   346         col := columns at:colNr.
   346         col isResizeable ifTrue:[
   347         col isResizeable ifTrue:[
   347             x1 := self xVisibleOfColNr:(idx + 1).
   348             x1 := self xVisibleOfColNr:(colNr + 1).
   348             (x between:(x1-tabSpacing) and:(x1+tabSpacing)) ifTrue:[
   349             (x between:(x1-tabSpacing) and:(x1+tabSpacing)) ifTrue:[
   349                 col := columns at:idx ifAbsent:nil.
   350                 col := columns at:colNr ifAbsent:nil.
   350                 self cursor:handleCursor.
   351                 self cursor:handleCursor.
   351 
   352 
   352                 lineDrag := LineDrag new.
   353                 lineDrag := LineDrag new.
   353                 lineDrag column:col
   354                 lineDrag column:col
   354                               x:x
   355                               x:x
   362                 ^ self
   363                 ^ self
   363             ]
   364             ]
   364         ]
   365         ]
   365     ].
   366     ].
   366 
   367 
   367     idx := self xVisibleToColNr:x.
   368     colNr := self xVisibleToColNr:x.
   368     idx ~~ 0 ifTrue:[
   369     colNr notNil ifTrue:[
   369         col := columns at:idx.
   370         col := columns at:colNr.
   370         col label isSelectable ifTrue:[
   371         col label isSelectable ifTrue:[
   371             self invalidateItemAt:(selection := idx)
   372             self invalidateItemAt:(selection := colNr)
   372         ].
   373         ].
   373     ].
   374     ].
   374     self cursor:(Cursor normal).
   375     self cursor:(Cursor normal).
   375 
   376 
   376     "Modified: / 26-03-2007 / 13:35:07 / cg"
   377     "Modified: / 26-03-2007 / 15:21:00 / cg"
   377 !
   378 !
   378 
   379 
   379 buttonRelease:button x:x y:y
   380 buttonRelease:button x:x y:y
   380     "handle a button press event; checks whether the item under the mouse
   381     "handle a button press event; checks whether the item under the mouse
   381      is the selected item. If true, the application is informed.
   382      is the selected item. If true, the application is informed.
   436 
   437 
   437         (x1 > x and:[x0 < x]) ifTrue:[
   438         (x1 > x and:[x0 < x]) ifTrue:[
   438             ^ index
   439             ^ index
   439         ]
   440         ]
   440     ].
   441     ].
   441     ^ 0
   442     ^ nil
   442 
   443 
   443     "Modified: / 26-03-2007 / 13:32:00 / cg"
   444     "Modified: / 26-03-2007 / 15:21:37 / cg"
   444 ! !
   445 ! !
   445 
   446 
   446 !DSVLabelView methodsFor:'focus handling'!
   447 !DSVLabelView methodsFor:'focus handling'!
   447 
   448 
   448 canTab
   449 canTab
   462 
   463 
   463     |colNr col|
   464     |colNr col|
   464 
   465 
   465     columns isEmpty ifTrue:[^ nil].
   466     columns isEmpty ifTrue:[^ nil].
   466     colNr := self xVisibleToColNr:aPoint x.
   467     colNr := self xVisibleToColNr:aPoint x.
   467     colNr ~~ 0 ifTrue:[
   468     colNr notNil ifTrue:[
   468         col := columns at:colNr.
   469         col := columns at:colNr.
   469         ^ col activeHelpText.
   470         ^ col activeHelpText.
   470     ].
   471     ].
   471     ^ nil
   472     ^ nil
   472 
   473 
   473     "Created: / 26-03-2007 / 13:43:20 / cg"
   474     "Created: / 26-03-2007 / 13:43:20 / cg"
       
   475     "Modified: / 26-03-2007 / 15:21:07 / cg"
   474 ! !
   476 ! !
   475 
   477 
   476 !DSVLabelView methodsFor:'initialization'!
   478 !DSVLabelView methodsFor:'initialization'!
   477 
   479 
   478 initStyle
   480 initStyle
   551 
   553 
   552 xVisibleToSelectionIndex:x
   554 xVisibleToSelectionIndex:x
   553     "returns the column number assigned to a physical x or nil. If
   555     "returns the column number assigned to a physical x or nil. If
   554      the column exists but is not selectable nil is returned.
   556      the column exists but is not selectable nil is returned.
   555     "
   557     "
   556     |index column|
   558 
       
   559     |colNr column|
   557 
   560 
   558     (shown and:[enabled]) ifTrue:[
   561     (shown and:[enabled]) ifTrue:[
   559         (     (index  := dataSet xVisibleToColNr:x)  notNil
   562         ((colNr  := dataSet xVisibleToColNr:x)  notNil
   560          and:[(column := columns at:index ifAbsent:nil) notNil
   563          and:[(column := columns at:colNr) notNil
   561          and:[column label isSelectable]]
   564          and:[column label isSelectable]]
   562         ) ifTrue:[
   565         ) ifTrue:[
   563             ^ index
   566             ^ colNr
   564         ]
   567         ]
   565     ].
   568     ].
   566     ^ nil
   569     ^ nil
       
   570 
       
   571     "Modified: / 26-03-2007 / 15:21:27 / cg"
   567 ! !
   572 ! !
   568 
   573 
   569 !DSVLabelView methodsFor:'scrolling'!
   574 !DSVLabelView methodsFor:'scrolling'!
   570 
   575 
   571 copyFromX:x0 y:y0 toX:x1 y:y1 width:w invalidateX:leftX
   576 copyFromX:x0 y:y0 toX:x1 y:y1 width:w invalidateX:leftX
   642 ! !
   647 ! !
   643 
   648 
   644 !DSVLabelView class methodsFor:'documentation'!
   649 !DSVLabelView class methodsFor:'documentation'!
   645 
   650 
   646 version
   651 version
   647     ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.53 2007-03-26 12:43:54 cg Exp $'
   652     ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.54 2007-03-26 13:22:19 cg Exp $'
   648 ! !
   653 ! !