StrokingWrapper.st
author Claus Gittinger <cg@exept.de>
Mon, 13 May 1996 10:50:38 +0200
changeset 265 45c83acd7562
parent 263 091fa4a2f558
child 273 f76fb9098814
permissions -rw-r--r--
comments
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
253
5b27778f470a inserted GeometricWrapper
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    14
GeometricWrapper subclass:#StrokingWrapper
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
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
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!StrokingWrapper class methodsFor:'documentation'!
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
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    a wrapper for a geometric object, which is to be drawn stroked.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    This allows any geometric thingy to be used as a component in a view.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    43
    (background info: geometrics are mathematical objects - they do not 
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    44
     keep any color or lineStyle attributes. Wrappers add this information
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    45
     and can also be used as components of a view)
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
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    49
        from alpha testers and from the Hopkins/Horan book.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    50
        - it may not be complete or compatible to the corresponding ST-80 class. 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    51
        If you encounter any incompatibilities, please forward a note 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    52
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
    53
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    54
    [see also:]
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    55
        FillingWrapper Geometric GraphicsContext
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    56
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    [author:]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
        Claus Gittinger
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
"
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
examples
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
"
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    64
  wrap an ellipticArc and display it
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    65
  (notice, that no automatic redraw is performed):
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
                                                                        [exBegin]
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    67
    |v e component|
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    69
    v := (View extent:250@250) openAndWait.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    71
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    72
                        startAngle:0 
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    73
                        sweepAngle:270.
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    74
    component := StrokingWrapper on:e.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    76
    component displayOn:v.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
                                                                        [exEnd]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
254
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    79
  wrap a rectangle and an ellipticArc,
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    80
  and add them as components to a View
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    81
  (notice, that doing so makes the redraw automatic):
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
                                                                        [exBegin]
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    83
    |v e component|
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    85
    v := View new.
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    86
    v extent:250@250.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    88
    e := Rectangle origin:10@10 corner:90@90.
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    89
    component := FillingWrapper on:e.
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    90
    component foregroundColor:Color red.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    92
    v addComponent:component.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    94
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    95
                     startAngle:0 sweepAngle:360.
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    96
    component := StrokingWrapper on:e.
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    97
    component lineWidth:5.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    99
    v addComponent:component.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   101
    v addComponent:(Button label:'hello').
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   103
    v open
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
                                                                        [exEnd]
263
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   105
  with lineWidth & style:
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   106
  (notice, that no automatic redraw is performed):
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   107
                                                                        [exBegin]
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   108
    |v e|
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   109
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   110
    v := View extent:250@250.
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   111
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   112
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   113
                        startAngle:0 
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   114
                        sweepAngle:270.
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   115
    v addComponent:((StrokingWrapper on:e)
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   116
                        lineWidth:5;
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   117
                        lineStyle:#dashed;
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   118
                        foregroundColor:(Color red)).
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   119
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   120
    e := EllipticalArc boundingBox:(30@30 corner:70@70)
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   121
                        startAngle:90 
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   122
                        sweepAngle:270.
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   123
    v addComponent:((StrokingWrapper on:e)
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   124
                        lineWidth:5;
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   125
                        lineStyle:#doubleDashed;
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   126
                        foregroundColor:(Color red);
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   127
                        backgroundColor:(Color green)).
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   128
    v open.
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   129
                                                                        [exEnd]
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   130
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
!StrokingWrapper methodsFor:'accessing'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
bounds
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   137
    "return the boundary rectangle - here, must take care of the lineWidth"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   138
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    ^ component bounds + (lineWidth - 1)
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    "Created: 8.5.1996 / 23:22:43 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   142
    "Modified: 9.5.1996 / 00:09:06 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   145
capStyle
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   146
    "return the capStyle"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   147
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   148
    ^ capStyle
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   149
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   150
    "Created: 8.5.1996 / 23:22:04 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   151
    "Modified: 9.5.1996 / 00:09:12 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   152
!
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   153
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   154
capStyle:aSymbol
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   155
    "set the capStyle"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   156
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   157
    capStyle := aSymbol
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   158
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   159
    "Created: 8.5.1996 / 23:22:13 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   160
    "Modified: 9.5.1996 / 00:09:17 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   161
!
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   162
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   163
joinStyle
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   164
    "return the joinStyle"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   165
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   166
    ^ joinStyle
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   167
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   168
    "Created: 8.5.1996 / 23:22:04 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   169
    "Modified: 9.5.1996 / 00:09:12 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   170
!
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   171
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   172
joinStyle:aSymbol
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   173
    "set the joinStyle"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   174
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   175
    joinStyle := aSymbol
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   176
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   177
    "Created: 8.5.1996 / 23:22:13 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   178
    "Modified: 9.5.1996 / 00:09:17 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   179
!
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   180
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   181
lineStyle
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   182
    "return the lineStyle"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   183
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   184
    ^ lineStyle
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   185
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   186
    "Created: 8.5.1996 / 23:22:04 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   187
    "Modified: 9.5.1996 / 00:09:12 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   188
!
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   189
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   190
lineStyle:aSymbol
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   191
    "set the lineStyle"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   192
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   193
    lineStyle := aSymbol
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   194
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   195
    "Created: 8.5.1996 / 23:22:13 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   196
    "Modified: 9.5.1996 / 00:09:17 / cg"
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   197
!
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   198
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
lineWidth
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   200
    "return the lineWidth"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   201
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    ^ lineWidth
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    "Created: 8.5.1996 / 23:22:04 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   205
    "Modified: 9.5.1996 / 00:09:12 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
lineWidth:aNumber
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   209
    "set the lineWidth"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   210
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    lineWidth := aNumber
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    "Created: 8.5.1996 / 23:22:13 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   214
    "Modified: 9.5.1996 / 00:09:17 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
preferredBounds
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   218
    "return the components bounds as preferredBounds"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   219
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    ^ self bounds
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
    "Created: 8.5.1996 / 23:23:00 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   223
    "Modified: 9.5.1996 / 00:09:31 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
!StrokingWrapper methodsFor:'displaying'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
displayOn:aGC
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   229
    "display myself - here, display the geometric object asStroked"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   230
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   231
    |prevLineWidth prevLineStyle prevCapStyle prevJoinStyle 
263
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   232
     prevFg prevBg|
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    prevLineWidth := aGC lineWidth.
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   235
    prevLineStyle := aGC lineStyle.
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   236
    prevJoinStyle := aGC joinStyle.
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   237
    prevCapStyle  := aGC capStyle.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    prevFg := aGC paint.
263
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   239
    prevBg := aGC backgroundPaint.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    aGC lineWidth:lineWidth.
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   242
    aGC lineStyle:lineStyle.
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   243
    aGC joinStyle:joinStyle.
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   244
    aGC capStyle:capStyle.
263
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   245
    aGC paint:fgColor on:bgColor.
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
    component displayStrokedOn:aGC.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
    aGC lineWidth:prevLineWidth.
262
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   250
    aGC lineStyle:prevLineStyle.
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   251
    aGC joinStyle:prevJoinStyle.
55b430276719 added lineStyle/capStyle & joinStyle
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   252
    aGC capStyle:prevCapStyle.
263
091fa4a2f558 fixed doubleDash bgColor
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   253
    aGC paint:prevFg on:prevBg.
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
    "Created: 8.5.1996 / 23:24:04 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   256
    "Modified: 9.5.1996 / 00:11:17 / cg"
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
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
!StrokingWrapper methodsFor:'initialization'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
initialize
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   262
    "default my lineWidth to one pixel"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   263
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
    super initialize.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
    lineWidth := 1.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
    "Created: 8.5.1996 / 23:49:27 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   268
    "Modified: 9.5.1996 / 00:11:51 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
!StrokingWrapper class methodsFor:'documentation'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
version
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   274
    ^ '$Header: /cvs/stx/stx/libview2/StrokingWrapper.st,v 1.8 1996-05-13 08:50:20 cg Exp $'
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
! !