|
|
Class: TranslatingWrapper
Object
|
+--DisplayObject
|
+--VisualComponent
|
+--VisualPart
|
+--Wrapper
|
+--TranslatingWrapper
|
+--LayoutWrapper
- Package:
- stx:libview2
- Category:
- Compatibility-ST80-Graphics-Display Objects
- Version:
- rev:
1.8
date: 2009-05-08 11:55:06
- user: cg
- file: TranslatingWrapper.st directory: libview2
- module: stx stc-classLibrary: libview2
- Author:
- Claus Gittinger
a wrapper which shifts the origin of its wrapped component.
This allows the wrapped thingy to think & draw in its own 0@0 based
coordinates.
Notice:
this class was implemented using protocol information
from alpha testers, from reading PD programs and
from the Hopkins/Horan book.
- it may not be complete or compatible to the corresponding ST-80 class.
If you encounter any incompatibilities, please forward a note
describing the incompatibility verbal (i.e. no code) to the ST/X team.
Wrapper
instance creation
-
on: aComponent at: originPoint
-
create and return a translatingWrapper, which positions
aComponent at some originPoint
accessing
-
translation
-
return the origin offset
-
translation: originPoint
-
set the origin offset
accessing - bounds
-
bounds: newBounds
-
-
preferredBounds
-
displaying
-
displayOn: aGC
-
initialization
-
initialize
-
testing
-
containsPoint: aPoint
-
-
intersects: aRectangle
-
some components without translatingWrapper
|t s v e component|
t := StandardSystemView extent:250@200.
s := HVScrollableView for:View miniScroller:true in:t.
s origin:0.0@0.0 corner:1.0@1.0.
v := s scrolledView.
e := Rectangle origin:10@10 corner:90@90.
component := FillingWrapper on:e.
component foregroundColor:Color red.
v addComponent:component.
e := EllipticalArc boundingBox:(10@10 corner:90@90)
startAngle:0 sweepAngle:360.
component := StrokingWrapper on:e.
component lineWidth:5.
component foregroundColor:Color black.
v addComponent:component.
e := Arrow from:100@100 to:150@250.
component := StrokingWrapper on:e.
component lineWidth:2.
v addComponent:component.
t open
|
the same components WITH translatingWrappers
|t s v e component|
t := StandardSystemView extent:250@200.
s := HVScrollableView for:View miniScroller:true in:t.
s origin:0.0@0.0 corner:1.0@1.0.
v := s scrolledView.
e := Rectangle origin:0@0 corner:80@80.
component := FillingWrapper on:e.
component foregroundColor:Color red.
v addComponent:(TranslatingWrapper on:component at:10@10).
e := EllipticalArc boundingBox:(0@0 corner:80@80)
startAngle:0 sweepAngle:360.
component := StrokingWrapper on:e.
component lineWidth:5.
v addComponent:(TranslatingWrapper on:component at:10@10).
e := Arrow from:0@0 to:50@150.
component := StrokingWrapper on:e.
component lineWidth:2.
v addComponent:(TranslatingWrapper on:component at:100@100).
v addComponent:(TranslatingWrapper on:(Image fromFile:'SBrowser.xbm') at:0@100).
t open
|
overlapping
|t s v e component|
t := StandardSystemView extent:250@200.
s := HVScrollableView for:View miniScroller:true in:t.
s origin:0.0@0.0 corner:1.0@1.0.
v := s scrolledView.
e := Rectangle origin:0@0 corner:80@80.
component := FillingWrapper on:e.
component foregroundColor:Color red.
v addComponent:(TranslatingWrapper on:component at:10@10).
e := EllipticalArc boundingBox:(0@0 corner:80@80)
startAngle:0 sweepAngle:360.
component := StrokingWrapper on:e.
component lineWidth:5.
v addComponent:(TranslatingWrapper on:component at:50@50).
e := Arrow from:0@0 to:50@150.
component := StrokingWrapper on:e.
component lineWidth:2.
v addComponent:(TranslatingWrapper on:component at:100@100).
e := Image fromFile:'SBrowser.xbm'.
component := FillingWrapper on:e.
component foregroundColor:Color red; backgroundColor:Color yellow.
v addComponent:(TranslatingWrapper on:component at:50@150).
component := StrokingWrapper on:e.
component foregroundColor:Color blue.
v addComponent:(TranslatingWrapper on:component at:50@100).
t open
|
|