add on-goodbye-event

This change requires a coordinated change to the snip-lib pkg and to
the gui-lib package. The docs are in the gui-doc pkg and yet point to
the snip-pkg as the containing pkg, so I updated the version number
for snip-lib and left the version number for gui-lib alone

original commit: 4b92117a9fd6fb638240bc6e57e25bc9de138c53
This commit is contained in:
Robby Findler 2014-07-16 09:32:59 -05:00
parent ea74e9ffe2
commit 5672033374
2 changed files with 29 additions and 2 deletions

View File

@ -377,7 +377,8 @@ following symbols:
@item{@indexed-racket['handles-all-mouse-events] --- this snip can
handle mouse events that touch the snip or that immediately
follow an event that touches the snip, even if the snip does
not have the keyboard focus}
not have the keyboard focus (see also
@method[snip% on-goodbye-event])}
@item{@indexed-racket['width-depends-on-x] --- this snip's display
width depends on the snip's x-@techlink{location} within the
@ -632,6 +633,32 @@ Does nothing.
}}
@defmethod[(on-goodbye-event [dc (is-a?/c dc<%>)]
[x real?]
[y real?]
[editorx real?]
[editory real?]
[event (is-a?/c mouse-event%)])
void?]{
@methspec{
Called to handle an event that is really aimed at another
snip in order to give this snip a chance to clean up
as the mouse moves away. The arguments are the same
as @method[snip% on-event].
This method is called only when the snip has the
@indexed-racket['handles-all-mouse-events] flag set
(see @method[snip% get-flags] and @method[snip% set-flags]).
}
@methimpl{
Calls this object's @racket[_on-event] method
}
@history[#:added "1.1"]}
@defmethod[(own-caret [own-it? any/c])
void?]{

View File

@ -486,7 +486,7 @@
(not (eq? snip prev-mouse-snip)))
(let-boxes ([x 0.0] [y 0.0])
(get-snip-position-and-location prev-mouse-snip #f x y)
(send prev-mouse-snip on-event dc (- x scrollx) (- y scrolly) x y event)))
(send prev-mouse-snip on-goodbye-event dc (- x scrollx) (- y scrolly) x y event)))
(set! prev-mouse-snip #f)
(if (and s-caret-snip (has-flag? (snip->flags s-caret-snip) HANDLES-EVENTS))
(let-boxes ([x 0.0] [y 0.0])