9.23 snip%
A direct instance of snip% is uninteresting. Useful snips
are defined by instantiating derived subclasses, but this class defines
the basic functionality.
In deriving a new snip class, these methods must be overridden to create a useful snip:
resizeif the snip can be resized by the userpartial-offsetif the snip can contain more than one itemsplitif the snip can contain more than one itemsize-cache-invalidif the snip caches the result toget-extentget-text(not required)find-scroll-step,get-num-scroll-steps, andget-scroll-step-offsetif the snip can contain more than one scroll positionset-unmodifiedif the snip's internal state can be modified by the user, and callmodifiedin the snip's administrator when the state changes the first time
If a snip can contain more than one item, then the snip's count must be maintained as well.
To define a class of snips that can be saved or cut-and-pasted:
Create an instance of
snip-class%, implementing thereadmethod.For each instance of the snip class, set the snip's class object with
set-snipclass.Override the
copymethod.Override the
writemethod.
To define a class of snips that read specially with
open-input-text-editor:
Make your
snip%class implementreadable-snip<%>.Implement the
read-specialmethod.
(make-object snip%)->snip%objectCreates a plain snip of length 1 with the
"Basic"style ofthe-style-list.
Methods
adjust-cursor
blink-caret
can-do-edit-operation? (augmentable only)
copy
do-edit-operation
draw
find-scroll-step
get-admin
get-count
get-extent
get-flags
get-num-scroll-steps
get-scroll-step-offset
get-snipclass
get-style
get-text
get-text!
is-owned?
match?
merge-with
next
on-char
on-event
own-caret
partial-offset
previous
release-from-owner
resize
set-admin
set-count
set-flags
set-snipclass
set-style
set-unmodified
size-cache-invalid
split
write