on-paint in text:delegate-mixin
Provides a way to add arbitrary graphics to an editor's display. This method is called just before and just after every painting of the editor.
The
on-paint method, together with the snips'
draw methods, must be able to draw the entire state of an editor. Never
paint directly into an editor's display canvas except from
within
on-paint or
draw. Instead, put all extra drawing code within
on-paint and call
invalidate-bitmap-cache when part of the display needs to be repainted.
If an
on-paint method uses cached location information, then the cached
information should be recomputed in response to a call of
invalidate-bitmap-cache.
The
on-paint method must not make any assumptions about the state of the drawing
context (e.g., the current pen), except that the clipping region is
already set to something appropriate. Before
on-paint returns, it must restore any drawing context settings that it changes.
The editor is internally locked for writing and reflowing during a call to this method (see also Locks).
( -> void
send a-text:delegate-mixin on-paint before? dc left top right bottom dx dy draw-caret)
before? : boolean
dc : dc<%> object
left : real number
top : real number
right : real number
bottom : real number
dx : real number
dy : real number
draw-caret : symbol in '(no-caret show-inactive-caret show-caret)
The before? argument is #t when the method is called just
before a painting the contents of the editor or #f when it is
called after painting. The left, top, right, and
bottom arguments specify which region of the editor is being
repainted, in editor coordinates. To get the coordinates for
dc, offset editor coordinates by adding (dx, dy).
See Caret for information about draw-caret.
See also
invalidate-bitmap-cache.
Draws a blue region in the delegatee editor that shows where the visible region of the delegate editor is.