BorderedWrapper.st
author Claus Gittinger <cg@exept.de>
Wed, 29 May 1996 00:43:39 +0200
changeset 278 f2382bb48850
child 283 f28c462b9d13
permissions -rw-r--r--
intitial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
278
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
BoundedWrapper subclass:#BorderedWrapper
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
	instanceVariableNames:'border inset insideColor'
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	classVariableNames:''
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	poolDictionaries:''
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	category:'Graphics-Display Objects'
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
!
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!BorderedWrapper class methodsFor:'documentation'!
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
examples
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
                                                                        [exBegin]
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
    |t s v e component|
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
    t := StandardSystemView extent:250@200.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
    s := HVScrollableView for:View miniScroller:true in:t.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
    s origin:0.0@0.0 corner:1.0@1.0.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
    v := s scrolledView.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
    e := Rectangle origin:0@0 corner:80@80.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
    component := FillingWrapper on:e.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
    component foregroundColor:Color red.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
    v addComponent:(BorderedWrapper on:component at:10@10).
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
    e := EllipticalArc boundingBox:(0@0 corner:80@80)
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
                     startAngle:0 sweepAngle:360.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
    component := StrokingWrapper on:e.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
    component lineWidth:5.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
    v addComponent:(BorderedWrapper on:component at:10@10).
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
    e := Arrow from:0@0 to:50@150.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
    component := StrokingWrapper on:e.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
    component lineWidth:2.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
    v addComponent:(BorderedWrapper on:component at:100@100).
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
    t open
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
                                                                        [exEnd]
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
! !
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
!BorderedWrapper class methodsFor:'instance creation'!
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
on:aComponent in:aLayout border:aBorder
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    ^ (super on:aComponent in:aLayout) border:aBorder
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    "Created: 28.5.1996 / 23:15:00 / cg"
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
! !
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
!BorderedWrapper methodsFor:'accessing'!
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
border
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    "return border"
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    ^ border
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    "Created: 28.5.1996 / 23:15:15 / cg"
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
border:something
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    "set border"
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    border := something.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    "Created: 28.5.1996 / 23:15:15 / cg"
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
! !
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
!BorderedWrapper methodsFor:'displaying'!
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
displayOn:aGC
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    |bounds x y w h tX tY|
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    super displayOn:aGC.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    bounds := self bounds.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    x := bounds left rounded.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    y := bounds top rounded.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    w := bounds width rounded.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    h := bounds height rounded.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    tX := aGC translation x.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    tY := aGC translation y.
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    aGC drawEdgesForX:x+tX
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
                    y:y+tY
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
                width:w
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
               height:h
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
                level:1 
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
               shadow:Color black 
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
                light:Color white
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
           halfShadow:Color grey 
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
            halfLight:Color grey
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
                style:#iris
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    "Modified: 29.5.1996 / 00:36:00 / cg"
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
! !
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
!BorderedWrapper class methodsFor:'documentation'!
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
version
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    ^ '$Header: /cvs/stx/stx/libview2/BorderedWrapper.st,v 1.1 1996-05-28 22:43:05 cg Exp $'
f2382bb48850 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
! !