30 Splash
This module helps support applications with splash screens like the one in DrRacket.
When this module is invoked, it sets the current-load parameter to a procedure
that counts how many files are loaded (until shutdown-splash is called) and uses
that number to control the gauge along the bottom of the splash screen.
Starts a new splash screen. The splash screen is created in its own, new
eventspace.
The progress gauge at the bottom of the window advances as files are loaded
(monitored via the
current-load parameter).
The
draw-spec determines what the splash window contains.
The
splash-title is used as the title of the window and the
width-default determines
how many progress steps the gauge in the splash screen should
contain if there is no preference saved for the splash screen width.
The splash library uses
get-preference and
put-preferences
to store preferences, using
as the key for the preference. Each time the app starts up, the maximum width
is reset based on the number of files that were loaded that time.
If the draw-spec is a path-string?, then the path is expected to be a file
that contains a bitmap that is drawn as the contents of the splash screen. If draw-spec
is a vector, then the vector’s first element is a procedure that is called to draw
the splash screen and the other two integers are the size of the splash screen, width followed by height.
If the procedure accepts only one argument, then it is called with a dc<%> object where the
drawing should occur. If it accepts 5 arguments, it is called with the dc<%>, as well as
(in order) the current value of the gauge, the maximum value of the gauge, and the width and the height
of the area to draw.
The allow-funny? argument determines if a special gauge is used on Christmas day.
The frame-icon is used just like the value of the parameter frame:current-icon is used,
but for the splash screen.
Stops the splash window’s gauge from advancing. Call this after all of the files have been loaded.
Closes the splash window. Call
shutdown-splash first. You can leave some time between these two
if there is more initialization work to be done where you do not want to count loaded files.
Adds an icon to the splash screen. (DrRacket uses this function to show the tools as they are loaded.)
Returns the splash bitmap unless one has not been set.
Sets the splash bitmap to
bmp and triggers a redrawing of the splash screen. Don’t use this to set
the initial bitmap, use
start-splash instead.
Returns the canvas where the splash screen bitmap is drawn (if there is a bitmap); see
start-splash for how the splash is drawn.
Returns the splash screen’s eventspace.
Returns the callback that is invoked when redrawing the splash screen.
Sets the callback that is invoked when redrawing the splash screen. See
start-splash for
what the arguments are.
Calling this procedure with #f removes the progress bar from the splash screen.
Useful in conjunction with setting your own paint callback for the splash screen that measures
progress in its own way, during drawing. DrRacket uses this on King Kamehameha and Prince
Kuhio day.
Sets a procedure that is called whenever a user types a key with the splash screen as the focus.
Sets a procedure that is called whenever a mouse event happens in the splash canvas.
Sets a procedure that is called each time the splash gauge changes. If the procedure returns a true value (i.e., not #f),
then the splash screen is redrawn. The procedure is called with the current value of the gauge and the maximum value.
The default function is
(lambda (curr tot) #f).
Returns the width of the splash drawing area / bitmap. See
start-splash for the details of the size and how things are drawn.
Returns the width of the splash drawing area / bitmap. See
start-splash for the details of the size and how things are drawn.
Triggers a refresh of the splash, handling the details of double buffering
and doing the drawing on the splash’s
eventspace’s
main thread.