LinkButtonController.st
author Claus Gittinger <cg@exept.de>
Sun, 15 Sep 2019 18:54:25 +0200
changeset 6148 e3b389204cce
parent 6143 3ed63f769dc5
permissions -rw-r--r--
#FEATURE by exept class: MenuPanel changed: #dispatchEvent:withFocusOn:delegate: info about who delegated the event

"{ Encoding: utf8 }"

"
 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' }"

"{ NameSpace: Smalltalk }"

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|

    button == 1 ifFalse:[
        ^ super buttonPress:button x:x y:y
    ].

    lastX := x.
    lastY := y.

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

buttonRelease:button x:x y:y
    button == 1 ifFalse:[
        ^ super 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$'
! !