Version: 5.0.1.7
15 Graphics
15.1 GUI Widgets
The bindings in this module are not included in
(planet cce/scheme:7:2/scheme).
15.1.1 Locked Text Fields
These classes and mixins provide text and combo field controls that cannot be
directly edited by the user, but may be updated by other controls.
This mixin updates text field classes to prevent user edits, but allow
programmatic update of the text value. It also sets the undo history length to
a default of 0, as user undo commands are disabled and the history takes up
space.
The mixin adds the undo-history initialization argument to control the
length of the undo history. It defaults to 0 to save space, but may be set
higher.
The mixin inherits all the initialization arguments of its parent class; it does
not override any of them.
Unlocks the text field’s nested editor, calls the parent class’s
set-value, and then re-locks the editor.
15.1.2 Union GUIs
This mixin modifies a container class to display only one of its child areas at
a time, but to leave room to switch to any of them.
This method changes which of the container’s children is displayed. The chosen
child is shown and the previous choice is hidden.
15.2 DrScheme Plugins
The bindings in this module are not included in
(planet cce/scheme:7:2/scheme).
Produces a mixin that overrides
render-value/format to apply
to-sexp to each value before printing it,
and to skip
void? values (pre-transformation) if
show-void? is
#f.
Produces a mixin that augments
capability-value to look up each key in
dict, producing the
corresponding value if the key is found and deferring to
inner
otherwise.
Overrides create-executable to print an
error message in a dialog box.
Overrides front-end/complete-program to
wrap terms from the definition in a module based on the language level’s
definition module. This duplicates the behavior of the HtDP teaching languages,
for instance.
This mixin enables the macro stepper for its language level.
This mixin overrides on-execute to set up
the check-expect test engine to a language level similarly to the HtDP
teaching languages.
This mixin constructs a language level that stores metadata in saved files
allowing DrScheme to automatically switch back to this language level upon
opening them. It overrides get-reader-module, get-metadata,
metadata->settings, and
get-metadata-lines.
The resulting language level uses the reader from reader-module, and is
recognized in files that start with a reader directive for that module path
within the first meta-lines lines. Metadata about the language’s
settings is marshalled between a string and a usable value (based on a default
value) by meta->settings, and between a usable value for a current
module (with a symbolic name) by settings->meta.
15.3 Slideshow Presentations
The bindings in this module are not included in
(planet cce/scheme:7:2/scheme).
15.3.1 Text Formatting
Adds the attributes for bold, italic, superscript, subscript, or small caps
text, respectively, to
current-main-font while running
text.
15.3.2 Pict Colors
Applies color
c to picture
p. Equivalent to
(colorize p c).
These functions apply appropriate colors to picture p.
These functions produce ligher or darker versions of a color.
This contract recognizes color strings, color% instances, and RGB color
lists.
15.3.3 Pict Manipulation
Extends pict’s bounding box to a minimum width and/or
height, placing the original picture in the middle of the space.
15.3.3.1 Conditional Manipulations
These pict transformers all take boolean arguments that determine whether to
transform the pict or leave it unchanged. These transformations can be useful
for staged slides, as the resulting pict always has the same size and shape, and
its contents always appear at the same position, but changing the boolean
argument between slides can control when the transformation occurs.
These functions conditionally show or hide an image, essentially choosing
between
pict and
(ghost pict). The only difference between
the two is the default behavior and the opposite meaning of the
show?
and
hide? booleans. Both functions are provided for mnemonic purposes.
Displays a strikethrough image by putting a line through the middle of
pict if strike? is true; produces pict unchanged
otherwise.
Shades pict to show with ratio of its normal opacity; if
ratio is 1 or shade? is #f, shows
pict unchanged.
15.3.3.2 Conditional Combinations
These pict control flow operators decide which pict of several to use. All
branches are evaluated; the resulting pict is a combination of the pict chosen
by normal conditional flow with ghost applied to all the other picts.
The result is a picture large enough to accomodate each alternative, but showing
only the chosen one. This is useful for staged slides, as the pict chosen may
change with each slide but its size and position will not.
(pict-if maybe-combine test-expr then-expr else-expr) |
|
maybe-combine | | = | | | | | | | | #:combine combine-expr |
|
Chooses either
then-expr or
else-expr based on
test-expr, similarly to
if. Combines the chosen, visible
image with the other, invisible image using
combine-expr, defaulting to
pict-combine.
(pict-cond maybe-combine [test-expr pict-expr] ...) |
|
maybe-combine | | = | | | | | | | | #:combine combine-expr |
|
Chooses a
pict-expr based on the first successful
test-expr,
similarly to
cond. Combines the chosen, visible image with the other,
invisible images using
combine-expr, defaulting to
pict-combine.
(pict-case test-expr maybe-combine [literals pict-expr] ...) |
|
maybe-combine | | = | | | | | | | | #:combine combine-expr |
|
Chooses a
pict-expr based on
test-expr and each list of
literals, similarly to
case. Combines the chosen, visible
image with the other, invisible images using
combine-expr, defaulting
to
pict-combine.
(pict-match test-expr maybe-combine [pattern pict-expr] ...) |
|
maybe-combine | | = | | | | | | | | #:combine combine-expr |
|
Chooses a
pict-expr based on
test-expr and each
pattern, similarly to
match. Combines the chosen, visible
image with the other, invisible images using
combine-expr, defaulting
to
pict-combine.
This syntax parameter determines the default pict combining form used by the
above macros. It defaults to
lbl-superimpose.
Sets
pict-combine to refer to
combine-id within each of the
body terms, which are spliced into the containing context.
15.3.4 Staged Slides
Executes the
body terms once for each stage
name. The terms
may include expressions and mutually recursive definitions. Within the body,
each
name is bound to a number from
1 to the number of stages
in order. Furthermore, during execution
stage is bound to the number
of the current stage and
stage-name is bound to a symbol representing
the
name of the current stage. By comparing
stage to the
numeric value of each
name, or
stage-name to quoted symbols of
the form
'name, the user may compute based on the progression of the
stages.
These keywords are bound during the execution of
staged and should not
be used otherwise.
Within a staged slide, the boolean arguments to hide, show,
strike, and shade can be used to determine in which stages to
perform a transformation. The macros pict-if, pict-cond,
pict-case, and pict-match may also be used to create images
which change naturally between stages.
15.3.5 Tables
Constructs a table containing the given
rows, all of which must be of
the same length. Applies
t to each string in a
row to
construct a pict. The
hgap,
vgap,
halign, and
valign are used to determine the horizontal and vertical gaps and
alignments as in
table (except that every row and column is uniform).
15.3.6 Multiple Columns
Constructs a two-column pict using
one and
two as the two
columns. Sets
current-para-width appropriately in each column.
Appends each
pict vertically with space between them, similarly to the
slide function.
Combines each pict horizontally, aligned at the top, with space in
between.
Computes the width of one column out of
n that takes up a ratio of
r of the available space (according to
current-para-width).