StrokingWrapper.st
author Claus Gittinger <cg@exept.de>
Tue, 14 Jan 1997 18:02:37 +0100
changeset 365 47e0d48fd769
parent 295 e1a91bbfbef3
child 405 4acab6da7d82
permissions -rw-r--r--
commentary
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
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    14
GeometricWrapper subclass:#StrokingWrapper
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    15
	instanceVariableNames:'lineWidth lineStyle capStyle joinStyle'
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Graphics-Display Objects'
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    21
!StrokingWrapper class methodsFor:'documentation'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 1996 by Claus Gittinger
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
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
documentation
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    40
    a wrapper for a geometric object, which is to be drawn stroked.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    41
    This allows any geometric thingy to be used as a component in a view.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    42
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    43
    (background info: geometrics are mathematical objects - they do not 
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    44
     keep any color or lineStyle attributes. Wrappers add this information
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    45
     and can also be used as components of a view)
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    46
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    47
    Notice: 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    48
        this class was implemented using protocol information
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    49
        from alpha testers, from reading PD programs and 
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    50
        from the Hopkins/Horan book.
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    51
        - it may not be complete or compatible to the corresponding ST-80 class. 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    52
        If you encounter any incompatibilities, please forward a note 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    53
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    54
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    55
    [see also:]
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    56
        FillingWrapper Geometric GraphicsContext
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    57
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    [author:]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
        Claus Gittinger
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
examples
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
"
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    65
  wrap an ellipticArc and display it
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    66
  (notice, that no automatic redraw is performed):
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    67
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    68
    |v e component|
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    69
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    70
    v := (StandardSystemView extent:250@250) openAndWait.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    71
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    72
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    73
                        startAngle:0 
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    74
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    75
    component := StrokingWrapper on:e.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    76
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    77
    component displayOn:v.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    78
                                                                        [exEnd]
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    79
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    80
  wrap a rectangle and an ellipticArc,
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    81
  and add them as components to a View
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    82
  (notice, that doing so makes the redraw automatic):
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    83
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    84
    |v e component|
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    85
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    86
    v := StandardSystemView extent:250@250.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    87
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    88
    e := Rectangle origin:10@10 corner:90@90.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    89
    component := FillingWrapper on:e.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    90
    component foregroundColor:Color red.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    91
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    92
    v addComponent:component.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    93
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    94
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    95
                     startAngle:0 sweepAngle:360.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    96
    component := StrokingWrapper on:e.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    97
    component lineWidth:5.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    98
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    99
    v addComponent:component.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   100
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   101
    v addComponent:(Button label:'hello').
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   102
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   103
    v open
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   104
                                                                        [exEnd]
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   105
  with lineWidth & style:
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   106
  (notice, that the redraw is automatic):
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   107
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   108
    |v e|
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   109
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   110
    v := StandardSystemView extent:250@250.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   111
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   112
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   113
                        startAngle:0 
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   114
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   115
    v addComponent:((StrokingWrapper on:e)
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   116
                        lineWidth:5;
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   117
                        lineStyle:#dashed;
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   118
                        foregroundColor:(Color red)).
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   119
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   120
    e := EllipticalArc boundingBox:(30@30 corner:70@70)
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   121
                        startAngle:90 
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   122
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   123
    v addComponent:((StrokingWrapper on:e)
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   124
                        lineWidth:5;
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   125
                        lineStyle:#doubleDashed;
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   126
                        foregroundColor:(Color red);
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   127
                        backgroundColor:(Color green)).
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   128
    v open.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   129
                                                                        [exEnd]
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   130
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   131
  scrolling:
273
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   132
                                                                        [exBegin]
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   133
    |t s v e component|
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   134
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   135
    t := StandardSystemView extent:250@200.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   136
    s := HVScrollableView for:View miniScroller:true in:t.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   137
    s origin:0.0@0.0 corner:1.0@1.0.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   138
    v := s scrolledView.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   139
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   140
    e := Rectangle origin:10@10 corner:90@90.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   141
    component := FillingWrapper on:e.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   142
    component foregroundColor:Color red.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   143
    v addComponent:component.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   144
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   145
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   146
                     startAngle:0 sweepAngle:360.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   147
    component := StrokingWrapper on:e.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   148
    component lineWidth:5.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   149
    v addComponent:component.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   150
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   151
    e := Arrow from:100@100 to:150@250.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   152
    component := StrokingWrapper on:e.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   153
    component lineWidth:2.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   154
    v addComponent:component.
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   155
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   156
    v addComponent:(Button label:'hello').
273
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   157
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   158
    t open
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   159
                                                                        [exEnd]
f76fb9098814 fixed bounds computation
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   160
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   164
!StrokingWrapper methodsFor:'accessing'!
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   165
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   166
bounds
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   167
    "return the boundary rectangle - here, must take care of the lineWidth"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   168
295
e1a91bbfbef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 280
diff changeset
   169
    ^ (component bounds insetBy:(lineWidth // 2 + 1) negated) rounded
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   171
    "Created: 8.5.1996 / 23:22:43 / cg"
295
e1a91bbfbef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 280
diff changeset
   172
    "Modified: 5.6.1996 / 20:30:39 / cg"
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   173
!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   175
capStyle
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   176
    "return the capStyle"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   177
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   178
    ^ capStyle
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   179
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   180
    "Created: 8.5.1996 / 23:22:04 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   181
    "Modified: 9.5.1996 / 00:09:12 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   182
!
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   183
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   184
capStyle:aSymbol
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   185
    "set the capStyle"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   186
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   187
    capStyle := aSymbol
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   188
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   189
    "Created: 8.5.1996 / 23:22:13 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   190
    "Modified: 9.5.1996 / 00:09:17 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   191
!
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   192
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   193
joinStyle
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   194
    "return the joinStyle"
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   195
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   196
    ^ joinStyle
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   197
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   198
    "Created: 8.5.1996 / 23:22:04 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   199
    "Modified: 9.5.1996 / 00:09:12 / cg"
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   200
!
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   201
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   202
joinStyle:aSymbol
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   203
    "set the joinStyle"
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   204
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   205
    joinStyle := aSymbol
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   206
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   207
    "Created: 8.5.1996 / 23:22:13 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   208
    "Modified: 9.5.1996 / 00:09:17 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   209
!
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   210
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   211
lineStyle
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   212
    "return the lineStyle"
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   213
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   214
    ^ lineStyle
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   215
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   216
    "Created: 8.5.1996 / 23:22:04 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   217
    "Modified: 9.5.1996 / 00:09:12 / cg"
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   218
!
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   219
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   220
lineStyle:aSymbol
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   221
    "set the lineStyle"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   222
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   223
    lineStyle := aSymbol
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   224
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   225
    "Created: 8.5.1996 / 23:22:13 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   226
    "Modified: 9.5.1996 / 00:09:17 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   227
!
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   228
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   229
lineWidth
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   230
    "return the lineWidth"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   231
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   232
    ^ lineWidth
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   233
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   234
    "Created: 8.5.1996 / 23:22:04 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   235
    "Modified: 9.5.1996 / 00:09:12 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   236
!
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   237
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   238
lineWidth:aNumber
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   239
    "set the lineWidth"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   240
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   241
    lineWidth := aNumber
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   242
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   243
    "Created: 8.5.1996 / 23:22:13 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   244
    "Modified: 9.5.1996 / 00:09:17 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
preferredBounds
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   248
    "return the components bounds as preferredBounds"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   249
295
e1a91bbfbef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 280
diff changeset
   250
    ^ (component bounds insetBy:(lineWidth / 2 + 1) negated) rounded
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   251
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   252
    "Created: 8.5.1996 / 23:23:00 / cg"
295
e1a91bbfbef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 280
diff changeset
   253
    "Modified: 5.6.1996 / 20:32:36 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   256
!StrokingWrapper methodsFor:'displaying'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
displayOn:aGC
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   259
    "display myself - here, display the geometric object asStroked"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   260
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   261
    |prevLineWidth prevLineStyle prevCapStyle prevJoinStyle 
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   262
     prevFg prevBg|
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   264
    prevLineWidth := aGC lineWidth.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   265
    prevLineStyle := aGC lineStyle.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   266
    prevJoinStyle := aGC joinStyle.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   267
    prevCapStyle  := aGC capStyle.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   268
    prevFg := aGC paint.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   269
    prevBg := aGC backgroundPaint.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   271
    aGC lineWidth:lineWidth.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   272
    aGC lineStyle:lineStyle.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   273
    aGC joinStyle:joinStyle.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   274
    aGC capStyle:capStyle.
263
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   275
    aGC paint:fgColor on:bgColor.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   277
    component displayStrokedOn:aGC.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   279
    aGC lineWidth:prevLineWidth.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   280
    aGC lineStyle:prevLineStyle.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   281
    aGC joinStyle:prevJoinStyle.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   282
    aGC capStyle:prevCapStyle.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   283
    aGC paint:prevFg on:prevBg.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   285
    "Created: 8.5.1996 / 23:24:04 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   286
    "Modified: 9.5.1996 / 00:11:17 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   289
!StrokingWrapper methodsFor:'initialization'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   291
initialize
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   292
    "default my lineWidth to one pixel"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   293
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   294
    super initialize.
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   295
    lineWidth := 1.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   297
    "Created: 8.5.1996 / 23:49:27 / cg"
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   298
    "Modified: 9.5.1996 / 00:11:51 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
280
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   301
!StrokingWrapper class methodsFor:'documentation'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
version
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
   304
    ^ '$Header: /cvs/stx/stx/libview2/StrokingWrapper.st,v 1.13 1997-01-14 17:00:08 cg Exp $'
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
! !