LinkButtonController.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 07 Feb 2019 12:16:15 +0000
branchjv
changeset 6065 e880a0b1320b
parent 3665 a335a284cf82
child 6143 3ed63f769dc5
permissions -rw-r--r--
Fix copy & paste in `TerminalView` Fix various copy-paste bugs and weirdnesses, namly: * preserve new lines when copying multi-line contents from terminal view. * preserve cursor position when selecting text both via mouse and via double-click.

"
 COPYRIGHT (c) 2009 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libwidg2' }"

ButtonController subclass:#LinkButtonController
	instanceVariableNames:'lastX lastY'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Support-Controllers'
!

!LinkButtonController class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2009 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    see info in LinkButton
"
! !

!LinkButtonController methodsFor:'accessing'!

lastMousePoint
    lastX isNil ifTrue:[^ nil].
    ^ lastX @ lastY
! !

!LinkButtonController methodsFor:'event handling'!

buttonMotion:buttonState x:x y:y
    lastX := x.
    lastY := y.
    view invalidate.
    super buttonMotion:buttonState x:x y:y.
!

buttonPress:button x:x y:y
    |action|

    lastX := x.
    lastY := y.

    action := view actionAt:(self lastMousePoint).
    action notNil ifTrue:[
        action value.
    ].
!

buttonRelease:button x:x y:y
    lastX := x.
    lastY := y.
    super buttonRelease:button x:x y:y.
!

pointerEnter:buttonState x:x y:y
    lastX := x.
    lastY := y.
    view invalidate.
    super pointerEnter:buttonState x:x y:y.
!

pointerLeave:buttonState 
    lastX := lastY := nil.
    view invalidate.
    super pointerLeave:buttonState.
! !

!LinkButtonController class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg2/LinkButtonController.st,v 1.4 2009-03-09 14:17:12 cg Exp $'
! !