added get-pos/text-dc-location method to editor:basic in framework

This commit is contained in:
Robby Findler 2011-06-26 15:47:16 +08:00
parent b333ed92fd
commit f93ff4de26
2 changed files with 12 additions and 4 deletions

View File

@ -52,9 +52,10 @@
#f))
(define/public (get-pos/text event)
(let ([event-x (send event get-x)]
[event-y (send event get-y)]
[on-it? (box #f)])
(get-pos/text-dc-location (send event get-x) (send event get-y)))
(define/public (get-pos/text-dc-location event-x event-y)
(let ([on-it? (box #f)])
(let loop ([editor this])
(let-values ([(x y) (send editor dc-location-to-editor-location event-x event-y)])
(cond

View File

@ -124,6 +124,13 @@
(values (or/c false/c number?)
(or/c false/c (is-a?/c editor<%>)))]{
Calls @method[editor:basic<%> get-pos/text-dc-location] with
the x and y coordinates of @racket[event].
}
@defmethod[(get-pos/text-dc-location [x exact-integer?] [y exact-integer?])
(values (or/c false/c number?)
(or/c false/c (is-a?/c editor<%>)))]{
This method's first result is @racket[#f] when the mouse
event does not correspond to a location in the editor.
@ -132,7 +139,7 @@
otherwise the first result will be @racket[#f].
The @racket[editor<%>] object will always be the nearest
enclosing editor containing the mouse click.
enclosing editor containing the point (@racket[x], @racket[y]).
}
}
@defmixin[editor:basic-mixin (editor<%>) (editor:basic<%>)]{