racket/collects/scribblings/draw/brush-list-class.scrbl
Matthew Flatt 2bdcdbb197 racket/draw, racket/gui: modernize contracts, mostly in documentation
Use `or/c' instead of `one-of/c', `#f' instead of `false/c'.
2012-04-06 18:51:10 -06:00

41 lines
1.6 KiB
Racket

#lang scribble/doc
@(require "common.rkt")
@defclass/title[brush-list% object% ()]{
A @racket[brush-list%] object maintains a list of @racket[brush%]
objects to avoid creating brushes repeatedly. A @racket[brush%]
object in a brush list cannot be mutated.
A global brush list, @racket[the-brush-list], is created
automatically.
@defconstructor[()]{
Creates an empty brush list.
}
@defmethod*[([(find-or-create-brush [color (is-a?/c color%)]
[style (or/c 'transparent 'solid 'opaque
'xor 'hilite 'panel
'bdiagonal-hatch 'crossdiag-hatch
'fdiagonal-hatch 'cross-hatch
'horizontal-hatch 'vertical-hatch)])
(is-a?/c brush%)]
[(find-or-create-brush [color-name string?]
[style (or/c 'transparent 'solid 'opaque
'xor 'hilite 'panel
'bdiagonal-hatch 'crossdiag-hatch
'fdiagonal-hatch 'cross-hatch
'horizontal-hatch 'vertical-hatch)])
(or/c (is-a?/c brush%) #f)])]{
Finds a brush of the given specification, or creates one and adds it
to the list. See @racket[brush%] for a further explanation of the
arguments, which are the same as @racket[brush%]'s initialization
arguments.
}}