FillingWrapper.st
author Claus Gittinger <cg@exept.de>
Thu, 09 May 1996 10:43:59 +0200
changeset 254 1286cec58b5d
parent 252 80f1ba561aab
child 265 45c83acd7562
permissions -rw-r--r--
doku
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1996 by Claus Gittinger
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
252
80f1ba561aab inserted GeometricWrapper
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    15
GeometricWrapper subclass:#FillingWrapper
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	instanceVariableNames:''
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:''
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Graphics-Display Objects'
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!FillingWrapper class methodsFor:'documentation'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 1996 by Claus Gittinger
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
              All Rights Reserved
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
documentation
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    a wrapper for a geometric object, which is to be drawn filled.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    This allows any geometric thingy to be used as a filled component in a view.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    45
    (background info: geometrics are mathematical objects - they do not 
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    46
     keep any color or lineStyle attributes. Wrappers add this information
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    47
     and can also be used as components of a view)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    48
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    49
    [see also:]
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    50
        StrokingWrapper Geometric GraphicsContext
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    51
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    [author:]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
        Claus Gittinger
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
examples
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
"
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    61
  wrap an ellipticArc and display it
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    62
  (notice, that no automatic redraw is performed):
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
                                                                        [exBegin]
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    64
    |v e component|
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    65
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    66
    v := (View extent:250@250) openAndWait.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    67
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    68
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    69
                        startAngle:0 
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    70
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    71
    component := FillingWrapper on:e.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    73
    component displayOn:v.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    74
                                                                        [exEnd]
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    75
  wrap an spline and display it
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    76
  (notice, that no automatic redraw is performed):
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    77
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    78
    |v s component|
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    79
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    80
    v := (View extent:250@250) openAndWait.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    82
    s := Spline controlPoints:
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    83
               (Array with:(20@20)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    84
                      with:(80@80)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    85
                      with:(20@80)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    86
                      with:(20@20)).
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    87
    component := FillingWrapper on:s.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    88
    component foregroundColor:(Color green darkened).
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    89
    component displayOn:v.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    90
                                                                        [exEnd]
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    91
  wrap ellipticArcs
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    92
  and add them as components to a View
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    93
  (notice, that doing so makes the redraw automatic):
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    94
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    95
    |v e component|
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    97
    v := View extent:250@250.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    98
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    99
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   100
                        startAngle:0 
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   101
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   102
    v addComponent:(StrokingWrapper on:e).
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   103
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   104
    e := EllipticalArc boundingBox:(110@110 corner:190@190)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   105
                        startAngle:0 
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   106
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   107
    v addComponent:(FillingWrapper on:e).
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   108
    v open
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
                                                                        [exEnd]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   112
  wrap a rectangle and an ellipticArc,
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   113
  and add them as components to a View
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   114
  (notice, that doing so makes the redraw automatic):
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
                                                                        [exBegin]
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   116
    |v e component|
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   118
    v := View new.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   119
    v extent:250@250.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   121
    e := Rectangle origin:10@10 corner:90@90.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   122
    component := FillingWrapper on:e.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   123
    component foregroundColor:Color red.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   125
    v addComponent:component.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   127
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   128
                     startAngle:0 sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   129
    component := StrokingWrapper on:e.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   130
    component lineWidth:5.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   132
    v addComponent:component.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   134
    v addComponent:(Button label:'hello').
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   136
    v open
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
                                                                        [exEnd]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
!FillingWrapper methodsFor:'displaying'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
displayOn:aGC
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   144
    "display myself - here, display the geometric object asFilled"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   145
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    |prevFg|
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    prevFg := aGC paint.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    aGC paint:fgColor.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    component displayFilledOn:aGC.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    aGC paint:prevFg.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    "Created: 8.5.1996 / 23:54:06 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   157
    "Modified: 9.5.1996 / 00:11:27 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
!FillingWrapper class methodsFor:'documentation'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
version
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   163
    ^ '$Header: /cvs/stx/stx/libview2/FillingWrapper.st,v 1.5 1996-05-09 08:43:59 cg Exp $'
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
! !