1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.54">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #991a13}
15 span
.s1
{font: 18.0px Helvetica
}
16 span
.s2
{color: #0017ad}
17 span
.s3
{color: #4d4d4d}
18 span
.Apple-tab-span
{white-space:pre
}
22 <p class=
"p1"><span class=
"s1"><b>resize
</b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><b>resize behavior for SCView and its subclasses
</b></p>
23 <p class=
"p2"><br></p>
24 <p class=
"p2"><br></p>
25 <p class=
"p1"><b>resize
</b> takes nine different arguments defining the behavior when window is resized. Each view responds relatively to the stretches of its parent view.
</p>
26 <p class=
"p3"><br></p>
27 <p class=
"p2"><br></p>
28 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1 2 3</p>
29 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>4 5 6</p>
30 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>7 8 9</p>
31 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
32 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1 - fixed to left, fixed to top
</p>
33 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2 - horizontally elastic, fixed to top
</p>
34 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>3 - fixed to right, fixed to top
</p>
35 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
36 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>4 - fixed to left, vertically elastic
</p>
37 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>5 - horizontally elastic, vertically elastic
</p>
38 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>6 - fixed to right, vertically elastic
</p>
39 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
40 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>7 - fixed to left, fixed to bottom
</p>
41 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>8 - horizontally elastic, fixed to bottom
</p>
42 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>9 - fixed to right, fixed to bottom
</p>
43 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
44 <p class=
"p2"><br></p>
45 <p class=
"p1"><b>Examples
</b></p>
46 <p class=
"p2"><br></p>
47 <p class=
"p5">// resize behaviours
</p>
48 <p class=
"p5">// use the PopUpMenus to mix resize modes
</p>
50 <p class=
"p4"><span class=
"s2">var
</span> a;
</p>
51 <p class=
"p2"><br></p>
52 <p class=
"p4">a = {
<span class=
"s2">|i|
</span></p>
53 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> w, b, x,k,t,p;
</p>
54 <p class=
"p4"><span class=
"Apple-tab-span"> </span>k=i;
</p>
55 <p class=
"p4"><span class=
"Apple-tab-span"> </span>i = i +
1;
</p>
56 <p class=
"p4"><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>(
<span class=
"s3">"resize:"</span>+i,
<span class=
"s2">Rect
</span>(
10 + (k%
3 *
220),
<span class=
"s2">Window
</span>.screenBounds.height- [
250,
460,
670].at(k/
3),
200,
180));
</p>
57 <p class=
"p4"><span class=
"Apple-tab-span"> </span>b = w.view.bounds;
</p>
58 <p class=
"p4"><span class=
"Apple-tab-span"> </span>x =
<span class=
"s2">CompositeView
</span>(w, w.view.bounds.insetBy(
20,
20))
</p>
59 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.background_(
<span class=
"s2">Color
</span>.rand)
</p>
60 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.resize_(i);
</p>
61 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
62 <p class=
"p4"><span class=
"Apple-tab-span"> </span>y =
<span class=
"s2">CompositeView
</span>(x, x.bounds.moveTo(
0,
0).insetBy(
20,
20))
<span class=
"Apple-converted-space"> </span></p>
63 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.background_(
<span class=
"s2">Color
</span>.rand)
</p>
64 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.resize_(i);
</p>
65 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
66 <p class=
"p4"><span class=
"Apple-tab-span"> </span>y.decorator =
<span class=
"s2">FlowLayout
</span>(y.bounds).gap_(
0.0 @
0.0);
</p>
67 <p class=
"p2"><br></p>
68 <p class=
"p4"><span class=
"Apple-tab-span"> </span>t =
<span class=
"s2">StaticText
</span>(y,
<span class=
"s2">Rect
</span>(
0,
0,
40,
40))
</p>
69 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.background_(
<span class=
"s2">Color
</span>.rand.alpha_(
0.8))
</p>
70 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.resize_(i)
</p>
71 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.string_(i)
</p>
72 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.font_(
<span class=
"s2">Font
</span>(
<span class=
"s3">"Helvetica"</span>,
26));
</p>
73 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
74 <p class=
"p4"><span class=
"Apple-tab-span"> </span>p=
<span class=
"s2">PopUpMenu
</span>(y,
40@
40).items_((
1.
.9).collect(
<span class=
"s2">_
</span>.asString)).value_(i-
1).resize_(i)
</p>
75 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_{
<span class=
"s2">|m|
</span> t.string_((m.value+
1).asString); [p,t].do(
<span class=
"s2">_
</span>.resize_(m.value+
1))};
</p>
76 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
77 <p class=
"p4"><span class=
"Apple-tab-span"> </span>w.front;
</p>
78 <p class=
"p4"><span class=
"Apple-tab-span"> </span>w.onClose = {a.do(
<span class=
"s2">_
</span>.close) };
</p>
79 <p class=
"p2"><br></p>
80 <p class=
"p2"><br></p>
81 <p class=
"p4">} !
9;
</p>
82 <p class=
"p2"><br></p>
84 <p class=
"p2"><br></p>
85 <p class=
"p2"><br></p>
86 <p class=
"p5">// the popupmenu contains the various modes
</p>
87 <p class=
"p2"><br></p>
89 <p class=
"p4">w =
<span class=
"s2">Window
</span>(
<span class=
"s3">"soundfile test"</span>,
<span class=
"s2">Rect
</span>(
200,
200,
720,
250));
</p>
90 <p class=
"p2"><br></p>
91 <p class=
"p2"><br></p>
92 <p class=
"p4">p =
<span class=
"s2">PopUpMenu
</span>(w,
<span class=
"s2">Rect
</span>(
10,
10,
80,
24))
</p>
93 <p class=
"p4"><span class=
"Apple-tab-span"> </span>.items_(
<span class=
"s2">Array
</span>.fill(
9, {
<span class=
"s2">arg
</span> i; (i+
1).asString;}) )
</p>
94 <p class=
"p4"><span class=
"Apple-tab-span"> </span>.action_({
<span class=
"s2">arg
</span> sbs;
</p>
95 <p class=
"p4"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.resize_(sbs.value+
1);
</p>
96 <p class=
"p4"><span class=
"Apple-tab-span"> </span>});
</p>
97 <p class=
"p2"><br></p>
98 <p class=
"p4">f =
<span class=
"s2">SoundFile
</span>.new;
</p>
99 <p class=
"p4">f.openRead(
<span class=
"s3">"sounds/a11wlk01.wav"</span>.absolutePath);
</p>
100 <p class=
"p2"><br></p>
101 <p class=
"p4">a =
<span class=
"s2">SoundFileView
</span>(w,
<span class=
"s2">Rect
</span>(
10,
40,
700,
180))
</p>
102 <p class=
"p4"><span class=
"Apple-tab-span"> </span>.soundfile_(f)
</p>
103 <p class=
"p4"><span class=
"Apple-tab-span"> </span>.readWithTask(
0, f.numFrames, showProgress:
<span class=
"s2">false
</span> )
</p>
104 <p class=
"p4"><span class=
"Apple-tab-span"> </span>.resize_(
1);
</p>
105 <p class=
"p2"><br></p>
106 <p class=
"p4">w.front;
</p>
108 <p class=
"p2"><br></p>