add {get,set}-area-selctable to pasetboard%

This commit is contained in:
Matthew Flatt 2015-05-16 09:05:22 -06:00
parent 6dcdb9744f
commit 030a02a53c
3 changed files with 29 additions and 2 deletions

View File

@ -612,6 +612,16 @@ The @racket[x] and @racket[y] arguments are in editor coordinates. If
}
@defmethod[(get-area-selectable)
boolean?]{
Returns whether snips can be selected by dragging a selection box in the
pasteboard's background. By default, area selection
is allowed. See also @method[pasteboard% set-area-selectable].
@history[#:added "1.12"]}
@defmethod[(get-center) (values real? real?)]{
Returns the center of the pasteboard in pasteboard coordinates.
@ -1111,6 +1121,16 @@ See also @method[pasteboard% raise], @method[pasteboard% lower], and
}
@defmethod[(set-area-selectable [allow-drag? any/c])
void?]{
Set whether snips can be selected by dragging a selection box in the
pasteboard's background by event handling in @method[pasteboard%
on-default-event]: a true value allows selection, @racket[#f]
disallows selection. See also @method[pasteboard% get-area-selectable].
@history[#:added "1.12"]}
@defmethod[(set-before [snip (is-a?/c snip%)]
[before (or/c (is-a?/c snip%) #f)])

View File

@ -30,4 +30,4 @@
(define pkg-authors '(mflatt robby))
(define version "1.11")
(define version "1.12")

View File

@ -132,6 +132,7 @@
(define keep-size? #f)
(define dragging? #f)
(define rubberband? #f)
(define can-rubberband? #t)
(define rb-x 0.0)
(define rb-y 0.0)
@ -369,7 +370,8 @@
(unless (send event get-shift-down)
(no-selected))
(set-caret-owner #f)
(set! rubberband? #t)))
(when can-rubberband?
(set! rubberband? #t))))
(set! start-x x)
(set! last-x x)
(set! start-y y)
@ -2041,6 +2043,11 @@
(def/public (set-selection-visible [bool? v])
(set! selection-visible? v))
(def/public (get-area-selectable) can-rubberband?)
(def/public (set-area-selectable [bool? d?])
(set! can-rubberband? d?))
;; ----------------------------------------
(def/public (can-insert? [snip% a] [(make-or-false snip%) b] [real? x] [real? y])