UILayoutTool.st
changeset 3235 62205b199fc6
parent 3234 de4008994329
child 3239 d6d4d8ed0421
equal deleted inserted replaced
3234:de4008994329 3235:62205b199fc6
  1133                             bits:(ByteArray 
  1133                             bits:(ByteArray 
  1134                                         fromPackedString:'??????????<_>@?0A>@C0@O@A>@O<A?8??????????<b');
  1134                                         fromPackedString:'??????????<_>@?0A>@C0@O@A>@O<A?8??????????<b');
  1135                             yourself);
  1135                             yourself);
  1136                 yourself
  1136                 yourself
  1137         ]
  1137         ]
       
  1138 ! !
       
  1139 
       
  1140 !UILayoutTool::AnyLayout methodsFor:'accessing'!
       
  1141 
       
  1142 aspectValueOr0For:aspectName
       
  1143     "common helper - fetches the aspect value; if it is nil, return 0."
       
  1144 
       
  1145     ^ self aspectValueOr:0 for:aspectName
  1138 ! !
  1146 ! !
  1139 
  1147 
  1140 !UILayoutTool::AlignmentOrigin class methodsFor:'help specs'!
  1148 !UILayoutTool::AlignmentOrigin class methodsFor:'help specs'!
  1141 
  1149 
  1142 helpSpec
  1150 helpSpec
  1418     |layout|
  1426     |layout|
  1419 
  1427 
  1420     layout  := (Smalltalk at:#AlignmentOrigin) new.
  1428     layout  := (Smalltalk at:#AlignmentOrigin) new.
  1421 
  1429 
  1422     layout 
  1430     layout 
  1423         leftFraction:(((self aspectFor:#leftFraction) value) ? 0)
  1431         leftFraction:(self aspectValueOr0For:#leftFraction)
  1424               offset:(((self aspectFor:#leftOffset)   value) ? 0)
  1432         offset:(self aspectValueOr0For:#leftOffset)
  1425         topFraction:(((self aspectFor:#topFraction)  value) ? 0)
  1433         topFraction:(self aspectValueOr0For:#topFraction)
  1426              offset:(((self aspectFor:#topOffset)    value) ? 0).
  1434         offset:(self aspectValueOr0For:#topOffset).
  1427 
  1435 
  1428     layout 
  1436     layout 
  1429         leftAlignmentFraction:(((self aspectFor:#leftAlignmentFraction) value) ? 0)
  1437         leftAlignmentFraction:(self aspectValueOr0For:#leftAlignmentFraction)
  1430         topAlignmentFraction:(((self aspectFor:#topAlignmentFraction)  value) ? 0).
  1438         topAlignmentFraction:(self aspectValueOr0For:#topAlignmentFraction).
  1431 
  1439 
  1432   ^ layout
  1440   ^ layout
  1433 ! !
  1441 ! !
  1434 
  1442 
  1435 !UILayoutTool::AlignmentOrigin methodsFor:'alignment'!
  1443 !UILayoutTool::AlignmentOrigin methodsFor:'alignment'!
  1720 !
  1728 !
  1721 
  1729 
  1722 layout
  1730 layout
  1723     "returns the current extent"
  1731     "returns the current extent"
  1724 
  1732 
  1725     ^ (((self aspectFor:#leftOffset) value) ? 0) @ (((self aspectFor:#topOffset)  value) ? 0)
  1733     ^ (self aspectValueOr0For:#leftOffset) @ (self aspectValueOr0For:#topOffset)
  1726 ! !
  1734 ! !
  1727 
  1735 
  1728 !UILayoutTool::Extent methodsFor:'aspects'!
  1736 !UILayoutTool::Extent methodsFor:'aspects'!
  1729 
  1737 
  1730 commonExtentsSpec
  1738 commonExtentsSpec
  3051     |layout|
  3059     |layout|
  3052 
  3060 
  3053     layout  := (Smalltalk at:LayoutFrame) new.
  3061     layout  := (Smalltalk at:LayoutFrame) new.
  3054 
  3062 
  3055     layout 
  3063     layout 
  3056         leftFraction:(((self aspectFor:#leftFraction)   value) ? 0)
  3064         leftFraction:(self aspectValueOr0For:#leftFraction)
  3057               offset:(((self aspectFor:#leftOffset)     value) ? 0)
  3065             offset:(self aspectValueOr0For:#leftOffset)
  3058         rightFraction:(((self aspectFor:#rightFraction)  value) ? 0)
  3066         rightFraction:(self aspectValueOr0For:#rightFraction)
  3059               offset:(((self aspectFor:#rightOffset)    value) ? 0)
  3067             offset:(self aspectValueOr0For:#rightOffset)
  3060         topFraction:(((self aspectFor:#topFraction)    value) ? 0)
  3068         topFraction:(self aspectValueOr0For:#topFraction)
  3061               offset:(((self aspectFor:#topOffset)      value) ? 0)
  3069             offset:(self aspectValueOr0For:#topOffset)
  3062         bottomFraction:(((self aspectFor:#bottomFraction) value) ? 0)
  3070         bottomFraction:(self aspectValueOr0For:#bottomFraction)
  3063               offset:(((self aspectFor:#bottomOffset)   value) ? 0).
  3071             offset:(self aspectValueOr0For:#bottomOffset).
  3064 
  3072 
  3065   ^ layout
  3073   ^ layout
  3066 ! !
  3074 ! !
  3067 
  3075 
  3068 !UILayoutTool::LayoutFrame methodsFor:'common frames'!
  3076 !UILayoutTool::LayoutFrame methodsFor:'common frames'!
  3288     |layout|
  3296     |layout|
  3289 
  3297 
  3290     layout  := (Smalltalk at:#LayoutOrigin) new.
  3298     layout  := (Smalltalk at:#LayoutOrigin) new.
  3291 
  3299 
  3292     layout 
  3300     layout 
  3293         leftFraction:(((self aspectFor:#leftFraction) value) ? 0)
  3301         leftFraction:(self aspectValueOr0For:#leftFraction)
  3294               offset:(((self aspectFor:#leftOffset)   value) ? 0)
  3302             offset:(self aspectValueOr0For:#leftOffset)
  3295         topFraction:(((self aspectFor:#topFraction)  value) ? 0)
  3303         topFraction:(self aspectValueOr0For:#topFraction)
  3296              offset:(((self aspectFor:#topOffset)    value) ? 0).
  3304             offset:(self aspectValueOr0For:#topOffset).
  3297 
  3305 
  3298   ^ layout
  3306   ^ layout
  3299 ! !
  3307 ! !
  3300 
  3308 
  3301 !UILayoutTool::Point class methodsFor:'interface specs'!
  3309 !UILayoutTool::Point class methodsFor:'interface specs'!
  3356 !
  3364 !
  3357 
  3365 
  3358 layout
  3366 layout
  3359     "returns current layout as point
  3367     "returns current layout as point
  3360     "
  3368     "
  3361   ^ (((self aspectFor:#leftOffset) value) ? 0) 
  3369   ^ (self aspectValueOr0For:#leftOffset) @ (self aspectValueOr0For:#topOffset)
  3362     @ 
       
  3363     (((self aspectFor:#topOffset)  value) ? 0)
       
  3364 ! !
  3370 ! !
  3365 
  3371 
  3366 !UILayoutTool::Rectangle class methodsFor:'interface specs'!
  3372 !UILayoutTool::Rectangle class methodsFor:'interface specs'!
  3367 
  3373 
  3368 windowSpec
  3374 windowSpec
  3478 
  3484 
  3479 layout
  3485 layout
  3480     "returns current layout as rectangle"
  3486     "returns current layout as rectangle"
  3481 
  3487 
  3482     ^ (Smalltalk at:#Rectangle) 
  3488     ^ (Smalltalk at:#Rectangle) 
  3483         left:(((self aspectFor:#leftOffset)   value) ? 0)
  3489         left:(self aspectValueOr0For:#leftOffset)
  3484         top:(((self aspectFor:#topOffset)    value) ? 0)
  3490         top:(self aspectValueOr0For:#topOffset)
  3485         right:(((self aspectFor:#rightOffset)  value) ? 0)
  3491         right:(self aspectValueOr0For:#rightOffset)
  3486         bottom:(((self aspectFor:#bottomOffset) value) ? 0)
  3492         bottom:(self aspectValueOr0For:#bottomOffset)
  3487 ! !
  3493 ! !
  3488 
  3494 
  3489 !UILayoutTool class methodsFor:'documentation'!
  3495 !UILayoutTool class methodsFor:'documentation'!
  3490 
  3496 
  3491 version
  3497 version