adjust editor-cavas% refresh to clear border before calling on-paint

svn: r12198

original commit: 51f5d193ddf63d068b7e0038a122028e5f482711
This commit is contained in:
Matthew Flatt 2008-10-31 15:08:21 +00:00
parent b3229d808d
commit aef5b6a799
3 changed files with 20 additions and 5 deletions

View File

@ -728,6 +728,7 @@
set-x-margin
get-y-margin
get-x-margin
clear-margins
scroll-to
set-lazy-refresh
get-lazy-refresh

View File

@ -14,12 +14,17 @@
(define (make-canvas-glue% %) ; implies make-window-glue%
(class100 (make-window-glue% %) (mred proxy . args)
(inherit get-mred get-top-level)
(inherit get-mred get-top-level clear-margins)
(public
[do-on-char (lambda (e) (super on-char e))]
[do-on-event (lambda (e) (super on-event e))]
[do-on-scroll (lambda (e) (super on-scroll e))]
[do-on-paint (lambda () (super on-paint))])
(private
[clear-and-on-paint
(lambda (mred)
(clear-margins)
(send mred on-paint))])
(override
[on-char (entry-point
(lambda (e)
@ -54,9 +59,9 @@
;; Windows circumvented the event queue; delay
(queue-window-callback
this
(lambda () (send mred on-paint)))
(as-exit (lambda () (send mred on-paint))))
(as-exit (lambda () (super on-paint)))))))])
(lambda () (clear-and-on-paint mred)))
(as-exit (lambda () (clear-and-on-paint mred))))
(as-exit (lambda () (clear-margins) (super on-paint)))))))])
(sequence (apply super-init mred proxy args))))
(define wx-canvas%
@ -66,6 +71,7 @@
(private-field
[tabable? #f])
(public
[clear-margins (lambda () (void))]
[on-tab-in (lambda () (send (wx->mred this) on-tab-in))]
[get-tab-focus (lambda () tabable?)]
[set-tab-focus (lambda (v) (set! tabable? v))])

View File

@ -235,7 +235,15 @@ Enables or disables the caret in the @techlink{display}'s editor, if
(on-paint)
void?]{
Repaints the editor.
Repaints the editor, or clears the canvas if no editor is being
displayed.
This method is called after clearing the margin around the editor,
unless the canvas is created with the @scheme['transparent] style, but
the editor area is not automatically cleared. In other words,
@scheme[editor-canvas%] update by default is like @scheme[canvas%]
update with the @scheme['no-autoclear] style, except that the margin
around the editor area is always cleared.
}