1#lang scribble/doc
2@(require "common.rkt")
3
4@title[#:tag "snip-related-functions"]{Snip Functions}
5
6@defproc[(snip-width [snip (is-a?/c snip%)]) real?]{
7
8The width of a snip in the parent pasteboard.}
9
10@defproc[(snip-height [snip (is-a?/c snip%)]) real?]{
11
12The height of a snip in the parent pasteboard.}
13
14@defproc[(snip-min-width [snip (is-a?/c snip%)]) real?]{
15
16The minimum width of the snip}
17
18@defproc[(snip-min-height [snip (is-a?/c snip%)]) real?]{
19
20The minimum height of the snip.}
21
22@defproc[(snip-parent [snip (is-a?/c snip%)]) (is-a?/c pasteboard%)]{
23
24The pasteboard that contains the snip.}
25
26@defproc[(fold-snip [f ((is-a?/c snip%) any/c . -> . any/c)]
27                    [init-acc any/c]
28                    [snip (is-a?/c snip%)])
29          any/c]{
30
31Applies @racket[f] to all snips in the parent of @racket[snip],
32starting with @racket[snip].}
33
34@defproc[(for-each-snip [f ((is-a?/c snip%) . -> . any/c)]
35                        [first-snip (is-a?/c snip%)]
36                        [more list?] ...)
37         void?]{
38
39Applies the function to each snip in the parent of
40@racket[first-snip], starting with @racket[first-snip]. If
41@racket[more] lists are supplied, they are used for extra arguments to
42@racket[f], just like extra lists provided to @racket[for-each].}
43
44@defproc[(map-snip [f ((is-a?/c snip%) . -> . any/c)]
45                   [first-snip (is-a?/c snip%)]
46                   [more list?] ...)
47         void?]{
48
49Applies the function to each snip in the parent of
50@racket[first-snip], starting with @racket[first-snip], and
51accumulates the results into a list. If @racket[more] lists are
52supplied, they are used for extra arguments to @racket[f], just like
53extra lists provided to @racket[map].}
54
55
56@defproc[(stretchable-width? [snip (is-a?/c snip%)]) boolean?]{
57
58True if the snip can be resized in the X dimension.}
59
60@defproc[(stretchable-height? [snip (is-a?/c snip%)]) boolean?]{
61
62True if the snip can be resized in the Y dimension.}
63