348 |
348 |
349 rectangleRelativeTo:superRectangle preferred:prefRect |
349 rectangleRelativeTo:superRectangle preferred:prefRect |
350 "compute the rectangle represented by the receiver, |
350 "compute the rectangle represented by the receiver, |
351 given the superViews rectangle and the views preferredExtent." |
351 given the superViews rectangle and the views preferredExtent." |
352 |
352 |
353 |x1 y1 x2 y2| |
353 |x1 y1 x2 y2 superWidth superHeight| |
354 |
354 |
355 leftOffset isNil ifTrue:[ |
355 leftOffset isNil ifTrue:[ |
356 x1 := 0 |
356 x1 := 0 |
357 ] ifFalse:[ |
357 ] ifFalse:[ |
358 x1 := leftOffset |
358 x1 := leftOffset |
370 bottomOffset isNil ifTrue:[ |
370 bottomOffset isNil ifTrue:[ |
371 y2 := 0 |
371 y2 := 0 |
372 ] ifFalse:[ |
372 ] ifFalse:[ |
373 y2 := bottomOffset |
373 y2 := bottomOffset |
374 ]. |
374 ]. |
|
375 |
375 leftFraction notNil ifTrue:[ |
376 leftFraction notNil ifTrue:[ |
376 x1 := x1 + (superRectangle width * leftFraction) |
377 superWidth := superRectangle width. |
|
378 x1 := x1 + (superWidth * leftFraction) |
377 ]. |
379 ]. |
378 topFraction notNil ifTrue:[ |
380 topFraction notNil ifTrue:[ |
379 y1 := y1 + (superRectangle height * topFraction) |
381 superHeight := superRectangle height. |
|
382 y1 := y1 + (superHeight * topFraction) |
380 ]. |
383 ]. |
381 rightFraction notNil ifTrue:[ |
384 rightFraction notNil ifTrue:[ |
382 x2 := x2 + (superRectangle width * rightFraction) |
385 superWidth isNil ifTrue:[superWidth := superRectangle width]. |
|
386 x2 := x2 + (superWidth * rightFraction) |
383 ]. |
387 ]. |
384 bottomFraction notNil ifTrue:[ |
388 bottomFraction notNil ifTrue:[ |
385 y2 := y2 + (superRectangle height * bottomFraction) |
389 superHeight isNil ifTrue:[superHeight := superRectangle height]. |
|
390 y2 := y2 + (superHeight * bottomFraction) |
386 ]. |
391 ]. |
387 ^ Rectangle left:x1 top:y1 right:x2 bottom:y2 |
392 ^ Rectangle left:x1 top:y1 right:x2 bottom:y2 |
388 |
393 |
389 " |
394 " |
390 |superRect lF| |
395 |superRect lF| |
391 |
396 |
392 superRect := 0@0 corner:100@100. |
397 superRect := 0@0 corner:99@99. |
393 lF := (LayoutFrame new). |
398 lF := (LayoutFrame new). |
394 lF leftFraction:0.25; |
399 lF leftFraction:0.25; |
395 topFraction:0.25; |
400 topFraction:0.25; |
396 rightFraction:0.75; |
401 rightFraction:0.75; |
397 bottomFraction:0.75. |
402 bottomFraction:0.75. |
398 lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) |
403 lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) |
399 " |
404 " |
400 |
405 |
401 "Modified: 8.5.1996 / 20:50:45 / cg" |
406 "Created: 6.3.1997 / 21:07:51 / cg" |
|
407 "Modified: 6.3.1997 / 22:39:58 / cg" |
402 ! ! |
408 ! ! |
403 |
409 |
404 !LayoutFrame class methodsFor:'documentation'! |
410 !LayoutFrame class methodsFor:'documentation'! |
405 |
411 |
406 version |
412 version |
407 ^ '$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.19 1997-03-01 16:27:29 cg Exp $' |
413 ^ '$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.20 1997-03-06 21:40:12 cg Exp $' |
408 ! ! |
414 ! ! |