eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TranslatingWrapper':

Home

everywhere
www.exept.de
for:
[back]

Class: TranslatingWrapper


Inheritance:

   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

Description:


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.


Related information:

    Wrapper

Class protocol:

instance creation
o  on: aComponent at: originPoint
create and return a translatingWrapper, which positions
aComponent at some originPoint


Instance protocol:

accessing
o  translation
return the origin offset

o  translation: originPoint
set the origin offset

accessing - bounds
o  bounds: newBounds

o  preferredBounds

displaying
o  displayOn: aGC

initialization
o  initialize

testing
o  containsPoint: aPoint

o  intersects: aRectangle


Examples:


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


ST/X 6.1.1; WebServer 1.620 at exept:8081; Thu, 24 May 2012 04:36:43 GMT