FillingWrapper.st
author Claus Gittinger <cg@exept.de>
Tue, 03 Sep 2013 17:23:55 +0200
changeset 3228 187a4158a51a
parent 2635 dd576df334a4
child 3855 1db7742d33ad
permissions -rw-r--r--
class: FlyByHelp changed: #initiateHelpFor:at:now: #showHelp:for: changed the flyBy suppression slightly: if the same text is to be shown again, do not show it except if the help is for another widget. (used to check for the text only previously)
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
"
1789
f52f0a0d8448 category
Claus Gittinger <cg@exept.de>
parents: 405
diff changeset
    12
"{ Package: 'stx:libview2' }"
f52f0a0d8448 category
Claus Gittinger <cg@exept.de>
parents: 405
diff changeset
    13
2635
dd576df334a4 refactored
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    14
StrokingOrFillingWrapper subclass:#FillingWrapper
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:''
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:''
1789
f52f0a0d8448 category
Claus Gittinger <cg@exept.de>
parents: 405
diff changeset
    18
	category:'Compatibility-ST80-Graphics-Display Objects'
245
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
!FillingWrapper 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
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    a wrapper for a geometric object, which is to be drawn filled.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    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
    43
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    44
    (background info: geometrics are mathematical objects - they do not 
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    45
     keep any color or lineStyle attributes. Wrappers add this information
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    46
     and can also be used as components of a view)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    47
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    48
    Notice: 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    49
        this class was implemented using protocol information
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
    50
        from alpha testers, from reading PD programs and 
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
    51
        from the Hopkins/Horan book.
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    52
        - it may not be complete or compatible to the corresponding ST-80 class. 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    53
        If you encounter any incompatibilities, please forward a note 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    54
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    55
248
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    56
    [see also:]
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    57
        StrokingWrapper Geometric GraphicsContext
266a7ec53d9f more examples & comments
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    58
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    [author:]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
        Claus Gittinger
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
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
examples
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
"
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    68
  wrap an ellipticArc and display it
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    69
  (notice, that no automatic redraw is performed):
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
                                                                        [exBegin]
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    71
    |v e component|
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    72
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    73
    v := (View extent:250@250) openAndWait.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    74
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    75
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    76
                        startAngle:0 
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    77
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    78
    component := FillingWrapper on:e.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    80
    component displayOn:v.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    81
                                                                        [exEnd]
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    82
  wrap an spline and display it
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    83
  (notice, that no automatic redraw is performed):
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    84
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    85
    |v s component|
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    86
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    87
    v := (View extent:250@250) openAndWait.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    89
    s := Spline controlPoints:
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    90
               (Array with:(20@20)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    91
                      with:(80@80)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    92
                      with:(20@80)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    93
                      with:(20@20)).
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    94
    component := FillingWrapper on:s.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    95
    component foregroundColor:(Color green darkened).
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    96
    component displayOn:v.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    97
                                                                        [exEnd]
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    98
  wrap ellipticArcs
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    99
  and add them as components to a View
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   100
  (notice, that doing so makes the redraw automatic):
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   101
                                                                        [exBegin]
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   102
    |v e component|
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   104
    v := View extent:250@250.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   105
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   106
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   107
                        startAngle:0 
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   108
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   109
    v addComponent:(StrokingWrapper on:e).
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   110
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   111
    e := EllipticalArc boundingBox:(110@110 corner:190@190)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   112
                        startAngle:0 
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   113
                        sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   114
    v addComponent:(FillingWrapper on:e).
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   115
    v open
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
                                                                        [exEnd]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   119
  wrap a rectangle and an ellipticArc,
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   120
  and add them as components to a View
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   121
  (notice, that doing so makes the redraw automatic):
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
                                                                        [exBegin]
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   123
    |v e component|
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 := View new.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   126
    v extent:250@250.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   128
    e := Rectangle origin:10@10 corner:90@90.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   129
    component := FillingWrapper on:e.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   130
    component foregroundColor:Color red.
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
    e := EllipticalArc boundingBox:(10@10 corner:90@90)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   135
                     startAngle:0 sweepAngle:270.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   136
    component := StrokingWrapper on:e.
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   137
    component lineWidth:5.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   139
    v addComponent:component.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   141
    v addComponent:(Button label:'hello').
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
254
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   143
    v open
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
                                                                        [exEnd]
266
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   145
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   146
 spline as a Buttons-label (hugh ?):
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   147
                                                                        [exBegin]
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   148
    |a b|
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   149
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   150
    a := ArrowedSpline controlPoints:
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   151
               (Array with:(00@00)
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   152
                      with:(60@60)
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   153
                      with:(00@60)).
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   154
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   155
    b := Button label:(((StrokingWrapper on:a) 
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   156
                        foregroundColor:Color red;
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   157
                        lineWidth:3;
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   158
                        lineStyle:#dashed)).
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   159
    b open.
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   160
                                                                        [exEnd]
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
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
!FillingWrapper methodsFor:'displaying'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
displayOn:aGC
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   167
    "display myself - here, display the geometric object asFilled"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   168
2635
dd576df334a4 refactored
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
   169
    self displayFilledOn:aGC
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
!FillingWrapper class methodsFor:'documentation'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
version
2635
dd576df334a4 refactored
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
   175
    ^ '$Header: /cvs/stx/stx/libview2/FillingWrapper.st,v 1.12 2009-05-06 07:29:44 cg Exp $'
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
! !