author | Claus Gittinger <cg@exept.de> |
Sun, 03 May 2009 22:34:46 +0200 | |
changeset 2632 | ced2473521b1 |
parent 2618 | fb52a0f3e1e8 |
child 2762 | 80249bee736b |
permissions | -rw-r--r-- |
88 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
93 | 3 |
All Rights Reserved |
88 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1594 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
77 | 14 |
LayoutOrigin subclass:#LayoutFrame |
191 | 15 |
instanceVariableNames:'rightFraction bottomFraction rightOffset bottomOffset' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Graphics-Geometry' |
|
77 | 19 |
! |
20 |
||
88 | 21 |
!LayoutFrame class methodsFor:'documentation'! |
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
93 | 26 |
All Rights Reserved |
88 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
93 | 37 |
documentation |
38 |
" |
|
39 |
This class is provided to make porting of existing ST-80 applications |
|
40 |
easier. Instances can be used to control the geometry of a subview, within |
|
41 |
its superview. Like a layoutOrigin, it controls the origin of a component |
|
42 |
by given fraction and offset dimensions; in addition, the bottom-right |
|
43 |
corner is also controlled by corresponding values. Therefore, the components |
|
44 |
preferredExtent is ignored. |
|
45 |
||
46 |
See also: |
|
219 | 47 |
LayoutOrigin AlignmentOrigin Layout |
93 | 48 |
|
229 | 49 |
Notice: |
50 |
this class was implemented using protocol information |
|
51 |
from alpha testers - it may not be complete or compatible to |
|
52 |
the corresponding ST-80 class. |
|
53 |
If you encounter any incompatibilities, please forward a note |
|
54 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
219 | 55 |
|
56 |
[author:] |
|
57 |
Claus Gittinger |
|
229 | 58 |
|
59 |
[see also:] |
|
60 |
View |
|
61 |
LayoutOrigin AlignmentOrigin Layout |
|
62 |
Rectangle Point |
|
94 | 63 |
" |
93 | 64 |
! |
65 |
||
66 |
examples |
|
67 |
" |
|
229 | 68 |
Although the examples below use a button as component, |
69 |
they work of course with any type of subview .... |
|
70 |
||
93 | 71 |
|
229 | 72 |
arrange for the button to be in 0.25 @ 0.25 -> 0.75 @ 0.75. |
73 |
This is the same as with relative origin/corner. |
|
74 |
[exBegin] |
|
75 |
|top button| |
|
93 | 76 |
|
229 | 77 |
top := StandardSystemView new. |
78 |
top extent:300@300. |
|
93 | 79 |
|
229 | 80 |
button := Button label:'component'. |
81 |
top add:button in:(LayoutFrame new |
|
82 |
leftFraction:0.25; |
|
83 |
topFraction:0.25; |
|
84 |
rightFraction:0.75; |
|
85 |
bottomFraction:0.75). |
|
86 |
||
87 |
top open |
|
88 |
[exEnd] |
|
93 | 89 |
|
90 |
||
91 |
like above, but adds additional offset to the origin: |
|
229 | 92 |
This is the same as with relative origin/corner |
93 |
and setting left & right insets. |
|
94 |
[exBegin] |
|
95 |
|top button| |
|
93 | 96 |
|
229 | 97 |
top := StandardSystemView new. |
98 |
top extent:300@300. |
|
93 | 99 |
|
229 | 100 |
button := Button label:'component'. |
101 |
top add:button in:(LayoutFrame new |
|
102 |
leftFraction:0.25; leftOffset:10; |
|
103 |
topFraction:0.25; topOffset:-20; |
|
104 |
rightFraction:0.75; |
|
105 |
bottomFraction:0.75). |
|
93 | 106 |
|
229 | 107 |
top open |
108 |
[exEnd] |
|
93 | 109 |
|
110 |
||
229 | 111 |
like above, with offsets on all edges, |
112 |
actually simulating a constant inset on all four edges: |
|
113 |
[exBegin] |
|
114 |
|top button| |
|
93 | 115 |
|
229 | 116 |
top := StandardSystemView new. |
117 |
top extent:300@300. |
|
93 | 118 |
|
229 | 119 |
button := Button label:'component'. |
120 |
top add:button in:(LayoutFrame new |
|
121 |
leftFraction:0.0; leftOffset:10; |
|
122 |
topFraction:0.0; topOffset:10; |
|
123 |
rightFraction:1.0; rightOffset:-10; |
|
124 |
bottomFraction:1.0; bottomOffset:-10). |
|
93 | 125 |
|
229 | 126 |
top open |
127 |
[exEnd] |
|
93 | 128 |
" |
88 | 129 |
! ! |
130 |
||
426 | 131 |
!LayoutFrame class methodsFor:'instance creation'! |
132 |
||
2221 | 133 |
inset:pixels |
134 |
"create a new layoutFrame which insets the child by some pixels" |
|
135 |
||
136 |
^ self |
|
137 |
leftFraction:0 offset:pixels |
|
138 |
rightFraction:1 offset:pixels negated |
|
139 |
topFraction:0 offset:pixels |
|
140 |
bottomFraction:1 offset:pixels negated |
|
141 |
! |
|
142 |
||
426 | 143 |
leftFraction:lF offset:lO rightFraction:rF offset:rO topFraction:tF offset:tO bottomFraction:bF offset:bO |
144 |
"create a new layoutFrame" |
|
145 |
||
146 |
^ self new |
|
147 |
leftFraction:lF offset:lO |
|
148 |
rightFraction:rF offset:rO |
|
149 |
topFraction:tF offset:tO |
|
150 |
bottomFraction:bF offset:bO |
|
151 |
||
152 |
||
153 |
||
545
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
154 |
! |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
155 |
|
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
156 |
leftOffset:lO rightOffset:rO topOffset:tO bottomOffset:bO |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
157 |
"create a new layoutFrame" |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
158 |
|
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
159 |
^ self new |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
160 |
leftOffset:lO |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
161 |
rightOffset:rO |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
162 |
topOffset:tO |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
163 |
bottomOffset:bO |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
164 |
|
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
165 |
"Created: 18.4.1997 / 20:14:44 / cg" |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
166 |
! |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
167 |
|
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
168 |
leftOffset:lO topOffset:tO rightOffset:rO bottomOffset:bO |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
169 |
"create a new layoutFrame" |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
170 |
|
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
171 |
^ self leftOffset:lO rightOffset:rO topOffset:tO bottomOffset:bO |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
172 |
|
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
173 |
"Modified: 18.4.1997 / 20:15:23 / cg" |
1795 | 174 |
! |
175 |
||
176 |
origin:origin corner:corner |
|
177 |
"create a new layoutFrame from an oldStyle origin-corner rectangle. |
|
178 |
Added to make migration from Rectangles to LayoutFrames easier." |
|
179 |
||
180 |
|leftFraction leftOffset rightFraction rightOffset |
|
181 |
topFraction topOffset bottomFraction bottomOffset |
|
182 |
orgX orgY cornerX cornerY| |
|
183 |
||
184 |
orgX := origin x. |
|
185 |
orgY := origin y. |
|
186 |
cornerX := corner x. |
|
187 |
cornerY := corner y. |
|
188 |
leftFraction := leftOffset := 0. |
|
189 |
orgX isInteger ifTrue:[ |
|
190 |
leftOffset := orgX |
|
191 |
] ifFalse:[ |
|
192 |
leftFraction := orgX. |
|
193 |
]. |
|
194 |
orgY isInteger ifTrue:[ |
|
195 |
topOffset := orgY |
|
196 |
] ifFalse:[ |
|
197 |
topFraction := orgY. |
|
198 |
]. |
|
199 |
cornerX isInteger ifTrue:[ |
|
200 |
rightOffset := cornerX |
|
201 |
] ifFalse:[ |
|
202 |
rightFraction := cornerX. |
|
203 |
]. |
|
204 |
cornerY isInteger ifTrue:[ |
|
205 |
bottomOffset := cornerY |
|
206 |
] ifFalse:[ |
|
207 |
bottomFraction := cornerY. |
|
208 |
]. |
|
209 |
^ self |
|
210 |
leftFraction:leftFraction offset:leftOffset |
|
211 |
rightFraction:rightFraction offset:rightOffset |
|
212 |
topFraction:topFraction offset:rightOffset |
|
213 |
bottomFraction:bottomFraction offset:bottomOffset |
|
426 | 214 |
! ! |
215 |
||
77 | 216 |
!LayoutFrame methodsFor:'accessing'! |
217 |
||
126 | 218 |
bottomFraction |
2123 | 219 |
"Return the y-coordinate of the bottom of the relative rectangle as a percentage of the height of the reference rectangle." |
126 | 220 |
|
221 |
^ bottomFraction |
|
222 |
! |
|
223 |
||
224 |
bottomFraction:something |
|
2123 | 225 |
"Set the y-coordinate of the bottom of the relative rectangle to be a fraction of the height of the reference rectangle." |
126 | 226 |
|
227 |
bottomFraction := something. |
|
228 |
! |
|
229 |
||
230 |
bottomFraction:something offset:o |
|
2123 | 231 |
"set both bottomFraction and offset" |
77 | 232 |
|
126 | 233 |
bottomFraction := something. |
234 |
bottomOffset := o |
|
235 |
! |
|
236 |
||
275 | 237 |
bottomInset:pixels |
238 |
"set bottomOffset for an inset at the bottom" |
|
239 |
||
240 |
bottomOffset := pixels negated. |
|
241 |
||
242 |
"Created: 26.5.1996 / 17:38:30 / cg" |
|
243 |
! |
|
244 |
||
126 | 245 |
bottomOffset |
246 |
"return bottomOffset" |
|
247 |
||
248 |
^ bottomOffset |
|
249 |
! |
|
250 |
||
251 |
bottomOffset:something |
|
252 |
"set bottomOffset" |
|
253 |
||
254 |
bottomOffset := something. |
|
77 | 255 |
! |
256 |
||
275 | 257 |
horizontalInset:aNumber |
2123 | 258 |
"setup the offsets for insetting horizontally the frame aNumber pixels at all sides" |
275 | 259 |
|
260 |
leftOffset := aNumber. |
|
261 |
rightOffset := aNumber negated. |
|
262 |
||
263 |
"Created: 26.5.1996 / 17:39:35 / cg" |
|
264 |
! |
|
265 |
||
266 |
inset:aNumber |
|
2123 | 267 |
"setup the offsets for insetting the frame aNumber pixels at all sides" |
275 | 268 |
|
269 |
topOffset := leftOffset := aNumber. |
|
270 |
rightOffset := bottomOffset := aNumber negated. |
|
271 |
||
272 |
"Created: 26.5.1996 / 17:36:49 / cg" |
|
273 |
! |
|
274 |
||
425 | 275 |
leftFraction:lF offset:lO rightFraction:rF offset:rO topFraction:tF offset:tO bottomFraction:bF offset:bO |
276 |
"set all fields" |
|
277 |
||
278 |
leftFraction := lF. |
|
279 |
rightFraction := rF. |
|
280 |
topFraction := tF. |
|
281 |
bottomFraction := bF. |
|
282 |
leftOffset := lO. |
|
283 |
rightOffset := rO. |
|
284 |
topOffset := tO. |
|
285 |
bottomOffset := bO. |
|
286 |
||
287 |
! |
|
288 |
||
1597 | 289 |
leftOffset:lO rightOffset:rO |
290 |
"set the horizontal offset fields" |
|
291 |
||
292 |
leftOffset := lO. |
|
293 |
rightOffset := rO. |
|
294 |
! |
|
295 |
||
545
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
296 |
leftOffset:lO rightOffset:rO topOffset:tO bottomOffset:bO |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
297 |
"set all offset fields" |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
298 |
|
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
299 |
leftOffset := lO. |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
300 |
rightOffset := rO. |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
301 |
topOffset := tO. |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
302 |
bottomOffset := bO. |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
303 |
|
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
304 |
"Created: 18.4.1997 / 20:16:08 / cg" |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
305 |
! |
0b9d704baeae
more access & inst-creation methods
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
306 |
|
77 | 307 |
rightFraction |
308 |
"return rightFraction" |
|
309 |
||
310 |
^ rightFraction |
|
311 |
! |
|
312 |
||
126 | 313 |
rightFraction:something |
314 |
"set rightFraction" |
|
77 | 315 |
|
126 | 316 |
rightFraction := something. |
77 | 317 |
! |
318 |
||
319 |
rightFraction:something offset:o |
|
320 |
"set rightFraction and offset" |
|
321 |
||
322 |
rightFraction := something. |
|
323 |
rightOffset := o |
|
324 |
! |
|
325 |
||
275 | 326 |
rightInset:pixels |
327 |
"set rightOffset for an inset at the right" |
|
328 |
||
329 |
rightOffset := pixels negated. |
|
330 |
||
331 |
"Created: 26.5.1996 / 17:38:38 / cg" |
|
332 |
! |
|
333 |
||
126 | 334 |
rightOffset |
335 |
"return rightOffset" |
|
77 | 336 |
|
126 | 337 |
^ rightOffset |
77 | 338 |
! |
339 |
||
126 | 340 |
rightOffset:something |
341 |
"set rightOffset" |
|
342 |
||
343 |
rightOffset := something. |
|
275 | 344 |
! |
345 |
||
1594 | 346 |
topOffset:newTopOffset bottomOffset:newBottomOffset |
347 |
topOffset := newTopOffset. |
|
348 |
bottomOffset := newBottomOffset. |
|
349 |
! |
|
350 |
||
275 | 351 |
verticalInset:aNumber |
352 |
"setup the offsets for insetting vertically the frame aNumber pixels |
|
353 |
at all sides" |
|
354 |
||
355 |
topOffset := aNumber. |
|
356 |
bottomOffset := aNumber negated. |
|
357 |
||
358 |
"Created: 26.5.1996 / 17:39:50 / cg" |
|
126 | 359 |
! ! |
360 |
||
361 |
!LayoutFrame methodsFor:'converting'! |
|
362 |
||
363 |
fromLiteralArrayEncoding:encoding |
|
364 |
"read my values from an encoding. |
|
365 |
The encoding is supposed to be of the form: |
|
366 |
(LayoutFrame orgOffsX relOrgX orgOffsY relOrgY cornOffsX relCornX cornOffsY relCornY) |
|
367 |
This is the reverse to literalArrayEncoding." |
|
77 | 368 |
|
126 | 369 |
leftOffset := encoding at:2. |
370 |
leftFraction := encoding at:3. |
|
371 |
topOffset := encoding at:4. |
|
372 |
topFraction := encoding at:5. |
|
373 |
rightOffset := encoding at:6. |
|
374 |
rightFraction := encoding at:7. |
|
375 |
bottomOffset := encoding at:8. |
|
376 |
bottomFraction := encoding at:9. |
|
377 |
||
378 |
" |
|
379 |
LayoutFrame new fromLiteralArrayEncoding:#(#LayoutFrame 70 0 2 0 0 1 25 0 ) |
|
380 |
#(#LayoutFrame 70 0 2 0 0 1 25 0 ) decodeAsLiteralArray |
|
381 |
" |
|
77 | 382 |
! |
383 |
||
126 | 384 |
literalArrayEncoding |
191 | 385 |
"encode myself as an array, from which a copy of the receiver |
386 |
can be reconstructed with #decodeAsLiteralArray. |
|
126 | 387 |
The encoding is: |
191 | 388 |
(#LayoutOrigin orgOffsX relOrgX orgOffsY relOrgY cornOffsX relCornX cornOffsY relCornY)" |
77 | 389 |
|
126 | 390 |
^ super literalArrayEncoding |
391 |
, (Array |
|
2618
fb52a0f3e1e8
Fix preferred and dynamic preferred sizes
Stefan Vogel <sv@exept.de>
parents:
2221
diff
changeset
|
392 |
with:rightOffset value "take care of blocks (dynamic preferred extent)" |
191 | 393 |
with:rightFraction |
2618
fb52a0f3e1e8
Fix preferred and dynamic preferred sizes
Stefan Vogel <sv@exept.de>
parents:
2221
diff
changeset
|
394 |
with:bottomOffset value |
fb52a0f3e1e8
Fix preferred and dynamic preferred sizes
Stefan Vogel <sv@exept.de>
parents:
2221
diff
changeset
|
395 |
with:bottomFraction) "take care of blocks (dynamic preferred extent)" |
77 | 396 |
|
126 | 397 |
"Modified: 1.9.1995 / 02:43:35 / claus" |
191 | 398 |
"Modified: 22.4.1996 / 13:00:17 / cg" |
77 | 399 |
! ! |
400 |
||
126 | 401 |
!LayoutFrame methodsFor:'initialization'! |
402 |
||
403 |
initialize |
|
404 |
leftOffset := rightOffset := bottomOffset := topOffset := 0. |
|
405 |
leftFraction := topFraction := 0. |
|
468 | 406 |
"/ bottomFraction := rightFraction := 1. |
407 |
bottomFraction := rightFraction := 0. |
|
408 |
||
409 |
"Modified: 1.3.1997 / 16:12:50 / cg" |
|
126 | 410 |
! ! |
77 | 411 |
|
83 | 412 |
!LayoutFrame methodsFor:'printing & storing'! |
413 |
||
414 |
displayString |
|
700 | 415 |
"return a printed representation of the receiver for displaying" |
416 |
||
83 | 417 |
^ (self class name) , '(' |
700 | 418 |
, 'l: ' , leftFraction displayString |
419 |
, '+' , leftOffset displayString |
|
420 |
, ' t: ' , topFraction displayString |
|
421 |
, '+' , topOffset displayString |
|
422 |
, ' r: ' , rightFraction displayString |
|
423 |
, '+' , rightOffset displayString |
|
424 |
, ' b: ' , bottomFraction displayString |
|
425 |
, '+' , bottomOffset displayString |
|
426 |
, ')' |
|
427 |
||
428 |
"Modified: 20.9.1997 / 11:40:14 / cg" |
|
83 | 429 |
! ! |
430 |
||
77 | 431 |
!LayoutFrame methodsFor:'queries'! |
432 |
||
126 | 433 |
corner |
434 |
^ rightFraction asFloat @ bottomFraction asFloat |
|
435 |
! |
|
436 |
||
416 | 437 |
isLayoutFrame |
438 |
"return true, if this is a layoutFrame" |
|
439 |
||
440 |
^ true |
|
441 |
||
442 |
||
443 |
! |
|
444 |
||
949
0eb888b21192
prefRect may now be a valueHolder or block
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
445 |
rectangleRelativeTo:superRectangle preferred:prefRectHolder |
229 | 446 |
"compute the rectangle represented by the receiver, |
447 |
given the superViews rectangle and the views preferredExtent." |
|
448 |
||
498 | 449 |
|x1 y1 x2 y2 superWidth superHeight| |
77 | 450 |
|
1039 | 451 |
x1 := x2 := superRectangle left. |
452 |
y1 := y2 := superRectangle top. |
|
453 |
||
454 |
leftOffset notNil ifTrue:[ |
|
455 |
x1 := x1 + leftOffset value |
|
77 | 456 |
]. |
1039 | 457 |
topOffset notNil ifTrue:[ |
458 |
y1 := y1 + topOffset value |
|
77 | 459 |
]. |
1039 | 460 |
rightOffset notNil ifTrue:[ |
461 |
x2 := x2 + rightOffset value |
|
462 |
]. |
|
463 |
bottomOffset notNil ifTrue:[ |
|
464 |
y2 := y2 + bottomOffset value |
|
77 | 465 |
]. |
498 | 466 |
|
77 | 467 |
leftFraction notNil ifTrue:[ |
498 | 468 |
superWidth := superRectangle width. |
1601 | 469 |
x1 := x1 + (superWidth * leftFraction value) |
77 | 470 |
]. |
471 |
topFraction notNil ifTrue:[ |
|
498 | 472 |
superHeight := superRectangle height. |
1601 | 473 |
y1 := y1 + (superHeight * topFraction value) |
77 | 474 |
]. |
475 |
rightFraction notNil ifTrue:[ |
|
498 | 476 |
superWidth isNil ifTrue:[superWidth := superRectangle width]. |
1601 | 477 |
x2 := x2 + (superWidth * rightFraction value) |
77 | 478 |
]. |
479 |
bottomFraction notNil ifTrue:[ |
|
498 | 480 |
superHeight isNil ifTrue:[superHeight := superRectangle height]. |
1601 | 481 |
y2 := y2 + (superHeight * bottomFraction value) |
77 | 482 |
]. |
242 | 483 |
^ Rectangle left:x1 top:y1 right:x2 bottom:y2 |
83 | 484 |
|
485 |
" |
|
486 |
|superRect lF| |
|
487 |
||
498 | 488 |
superRect := 0@0 corner:99@99. |
83 | 489 |
lF := (LayoutFrame new). |
490 |
lF leftFraction:0.25; |
|
229 | 491 |
topFraction:0.25; |
492 |
rightFraction:0.75; |
|
493 |
bottomFraction:0.75. |
|
83 | 494 |
lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) |
495 |
" |
|
229 | 496 |
|
949
0eb888b21192
prefRect may now be a valueHolder or block
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
497 |
"Created: / 6.3.1997 / 21:07:51 / cg" |
1039 | 498 |
"Modified: / 13.8.1998 / 18:33:59 / cg" |
77 | 499 |
! ! |
100 | 500 |
|
126 | 501 |
!LayoutFrame class methodsFor:'documentation'! |
100 | 502 |
|
126 | 503 |
version |
2618
fb52a0f3e1e8
Fix preferred and dynamic preferred sizes
Stefan Vogel <sv@exept.de>
parents:
2221
diff
changeset
|
504 |
^ '$Header: /cvs/stx/stx/libview2/LayoutFrame.st,v 1.33 2009-03-23 19:48:40 stefan Exp $' |
100 | 505 |
! ! |