DSVLabelView.st
changeset 3212 cb80f339ddfa
parent 3188 35f40882d508
child 3214 28214ee49bb6
equal deleted inserted replaced
3211:69cc92eb7a77 3212:cb80f339ddfa
   110 opaqueColumnResize:aBoolean
   110 opaqueColumnResize:aBoolean
   111     opaqueColumnResize := aBoolean
   111     opaqueColumnResize := aBoolean
   112 ! !
   112 ! !
   113 
   113 
   114 !DSVLabelView methodsFor:'drawing'!
   114 !DSVLabelView methodsFor:'drawing'!
       
   115 
       
   116 flyByHelpTextAt:aPoint
       
   117     "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)."
       
   118 
       
   119     |colNr col|
       
   120 
       
   121     columns isEmpty ifTrue:[^ nil].
       
   122     colNr := self xVisibleToColNr:aPoint x.
       
   123     colNr ~~ 0 ifTrue:[
       
   124         col := columns at:colNr.
       
   125         ^ col activeHelpText.
       
   126     ].
       
   127     ^ nil
       
   128 
       
   129     "Created: / 26-03-2007 / 13:43:20 / cg"
       
   130 !
   115 
   131 
   116 invalidate
   132 invalidate
   117     (shown) ifTrue:[
   133     (shown) ifTrue:[
   118         super invalidate
   134         super invalidate
   119     ]
   135     ]
   317     (col notNil and:[col isResizeable]) ifTrue:[
   333     (col notNil and:[col isResizeable]) ifTrue:[
   318         x1 := self xVisibleOfColNr:(idx + 1).
   334         x1 := self xVisibleOfColNr:(idx + 1).
   319         (x between:(x1-tabSpacing) and:(x1+tabSpacing))
   335         (x between:(x1-tabSpacing) and:(x1+tabSpacing))
   320         "/ x + tabSpacing > x1 
   336         "/ x + tabSpacing > x1 
   321         ifTrue:[
   337         ifTrue:[
   322             ^ self cursor:handleCursor
   338             self cursor:handleCursor.
       
   339             ^ self
   323         ].
   340         ].
   324     ].
   341     ].
   325 
   342 
   326     self cursor:(Cursor normal)
   343     self cursor:(Cursor normal)
       
   344 
       
   345     "Modified: / 26-03-2007 / 13:36:01 / cg"
   327 !
   346 !
   328 
   347 
   329 buttonPress:button x:x y:y
   348 buttonPress:button x:x y:y
   330     "handle a button press event; checks whether the item under the mouse
   349     "handle a button press event; checks whether the item under the mouse
   331      is selectable. If true, the selection is set to the item.
   350      is selectable. If true, the selection is set to the item.
   336         ^ self
   355         ^ self
   337     ].
   356     ].
   338 
   357 
   339     "/ in the resize area ?
   358     "/ in the resize area ?
   340     idx := self xVisibleToColNr:(x-tabSpacing).
   359     idx := self xVisibleToColNr:(x-tabSpacing).
   341 
       
   342     idx ~~ 0 ifTrue:[
   360     idx ~~ 0 ifTrue:[
   343         col := columns at:idx ifAbsent:nil.
   361         col := columns at:idx.
   344 
       
   345         col isResizeable ifTrue:[
   362         col isResizeable ifTrue:[
   346             x1 := self xVisibleOfColNr:(idx + 1).
   363             x1 := self xVisibleOfColNr:(idx + 1).
   347             (x between:(x1-tabSpacing) and:(x1+tabSpacing))
   364             (x between:(x1-tabSpacing) and:(x1+tabSpacing)) ifTrue:[
   348             ifTrue:[
       
   349                 col := columns at:idx ifAbsent:nil.
   365                 col := columns at:idx ifAbsent:nil.
   350                 self cursor:handleCursor.
   366                 self cursor:handleCursor.
   351 
   367 
   352                 lineDrag := LineDrag new.
   368                 lineDrag := LineDrag new.
   353                 lineDrag column:col
   369                 lineDrag column:col
   357                            minX:(x1 - col width + col minimumRequiredWidth)
   373                            minX:(x1 - col width + col minimumRequiredWidth)
   358                              on:self.
   374                              on:self.
   359                 (opaqueColumnResize ? (UserPreferences current opaqueTableColumnResizing == true)) ifFalse:[
   375                 (opaqueColumnResize ? (UserPreferences current opaqueTableColumnResizing == true)) ifFalse:[
   360                     lineDrag invertLine.
   376                     lineDrag invertLine.
   361                 ].
   377                 ].
   362               ^ self
   378                 ^ self
   363             ]
   379             ]
   364         ]
   380         ]
   365     ].
   381     ].
   366 
   382 
   367     idx := self xVisibleToColNr:x.
   383     idx := self xVisibleToColNr:x.
   368     col := columns at:idx ifAbsent:nil.
   384     idx ~~ 0 ifTrue:[
   369 
   385         col := columns at:idx.
   370     col notNil ifTrue:[
       
   371         col label isSelectable ifTrue:[
   386         col label isSelectable ifTrue:[
   372             self invalidateItemAt:(selection := idx)
   387             self invalidateItemAt:(selection := idx)
   373         ]
   388         ].
   374     ].
   389     ].
   375     self cursor:(Cursor normal).
   390     self cursor:(Cursor normal).
       
   391 
       
   392     "Modified: / 26-03-2007 / 13:35:07 / cg"
   376 !
   393 !
   377 
   394 
   378 buttonRelease:button x:x y:y
   395 buttonRelease:button x:x y:y
   379     "handle a button press event; checks whether the item under the mouse
   396     "handle a button press event; checks whether the item under the mouse
   380      is the selected item. If true, the application is informed.
   397      is the selected item. If true, the application is informed.
   420 
   437 
   421 
   438 
   422 !
   439 !
   423 
   440 
   424 xVisibleToColNr:x
   441 xVisibleToColNr:x
   425     "returns the column number assigned to a physical x or nil
   442     "returns the column number for a physical x position.
   426     "
   443      Returns nil if x is behond the last column."
       
   444 
   427     |x0 x1|
   445     |x0 x1|
   428 
   446 
   429     x1 := self xVisibleOfColNr:1.
   447     x1 := self xVisibleOfColNr:1.
   430 
   448 
   431     columns keysAndValuesDo:[:index :aCol|
   449     columns keysAndValuesDo:[:index :aCol|
   435         (x1 > x and:[x0 < x]) ifTrue:[
   453         (x1 > x and:[x0 < x]) ifTrue:[
   436             ^ index
   454             ^ index
   437         ]
   455         ]
   438     ].
   456     ].
   439     ^ 0
   457     ^ 0
       
   458 
       
   459     "Modified: / 26-03-2007 / 13:32:00 / cg"
   440 ! !
   460 ! !
   441 
   461 
   442 !DSVLabelView methodsFor:'focus handling'!
   462 !DSVLabelView methodsFor:'focus handling'!
   443 
   463 
   444 canTab
   464 canTab
   620 ! !
   640 ! !
   621 
   641 
   622 !DSVLabelView class methodsFor:'documentation'!
   642 !DSVLabelView class methodsFor:'documentation'!
   623 
   643 
   624 version
   644 version
   625     ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.51 2007-03-02 15:45:40 ca Exp $'
   645     ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.52 2007-03-26 11:44:39 cg Exp $'
   626 ! !
   646 ! !