VisualPart.st
author Claus Gittinger <cg@exept.de>
Fri, 10 Jul 1998 02:00:15 +0200
changeset 998 4a76a5a9a3cc
parent 962 e6ccfc7fb22e
child 1220 39e5e28042da
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
VisualComponent subclass:#VisualPart
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
	instanceVariableNames:'container'
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	classVariableNames:''
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	poolDictionaries:''
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	category:'Graphics-Display Objects'
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
!
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
     8
!VisualPart class methodsFor:'documentation'!
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
     9
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    10
documentation
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    11
"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    12
    abstract superclass for all kinds of visual components, which
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    13
    are containers for some other component.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    14
    This class and its subclasses (currently) exist mostly for
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    15
    ST-80 compatibility - to provide a home for ported PD classes,
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    16
    which depend on the VisualPart hierarchy.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    17
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    18
    Notice: 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    19
        this class was implemented using protocol information
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
    20
        from alpha testers, from reading PD programs and 
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
    21
        from the Hopkins/Horan book.
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    22
        - it may not be complete or compatible to the corresponding ST-80 class. 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    23
        If you encounter any incompatibilities, please forward a note 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    24
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    25
        This is still being constructed - not yet finished.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    26
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    27
    [author:]
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    28
        Claus Gittinger
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    29
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    30
    [see also:]
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    31
        GeometricWrapper
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    32
"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    33
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    34
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    35
! !
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!VisualPart methodsFor:'accessing'!
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
962
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    39
backgroundColor
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    40
    ^ container backgroundColor
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    41
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    42
    "Created: / 18.6.1998 / 15:58:34 / cg"
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    43
!
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    44
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
container
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    46
    "return my container"
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    ^ container
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    "Created: 9.5.1996 / 00:31:41 / cg"
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    51
    "Modified: 5.6.1996 / 01:08:26 / cg"
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
!
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
container:something
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    "set container"
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    container := something.
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "Created: 9.5.1996 / 00:31:41 / cg"
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
!
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
graphicsContext
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    "return the graphicsContext"
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
254
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    65
    ^ container graphicsContext
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    "Created: 9.5.1996 / 00:32:12 / cg"
254
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    68
    "Modified: 9.5.1996 / 01:37:10 / cg"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    69
!
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    70
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    71
graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    72
    "return the graphicsContext"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    73
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    74
    ^ container graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    75
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    76
    "Created: 9.5.1996 / 00:32:12 / cg"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    77
    "Modified: 9.5.1996 / 01:37:03 / cg"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    78
!
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    79
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    80
topComponent
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    81
    "return the top component - typically the topView"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    82
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    83
    ^ container topComponent
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    84
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    85
    "Modified: 9.5.1996 / 01:37:10 / cg"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    86
    "Created: 9.5.1996 / 01:39:15 / cg"
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    87
!
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    88
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    89
view
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    90
    "return my view"
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    91
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    92
    container isNil ifTrue:[^ nil].
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    93
    ^ container view
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    94
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    95
    "Created: 4.6.1996 / 21:32:34 / cg"
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    96
    "Modified: 5.6.1996 / 01:20:13 / cg"
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    97
! !
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    98
294
f44534fc18e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 289
diff changeset
    99
!VisualPart methodsFor:'view protocol mimicri'!
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   100
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   101
containerChangedSize
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   102
    "my container changed its size.
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   103
     The default here is to ignore this, but some wrappers like
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   104
     to resize when this happens."
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   105
323
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   106
"/Transcript show:'container '; show:container; show:' of '; show:self; 
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   107
"/           show:' changed size to '; showCR:container viewRectangle.
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   108
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   109
    self bounds:container viewRectangle
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   110
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   111
    "Created: 4.6.1996 / 21:27:58 / cg"
323
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   112
    "Modified: 19.7.1996 / 21:20:58 / cg"
962
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   113
!
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   114
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   115
create
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   116
    "want myself to be created."
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   117
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   118
    container create
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   119
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   120
    "Created: 4.6.1996 / 21:30:25 / cg"
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   121
!
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   122
962
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   123
invalidate
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   124
    container notNil ifTrue:[
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   125
        container invalidate:self bounds
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   126
    ]
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   127
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   128
    "Modified: / 18.6.1998 / 16:12:15 / cg"
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   129
!
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   130
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   131
realize
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   132
    "my container realized itself.
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   133
     The default here is to ignore this, but some wrappers like
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   134
     to do something when this happens."
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   135
998
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   136
    self realizeAllSubViews
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   137
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   138
    "Created: / 4.6.1996 / 21:28:31 / cg"
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   139
    "Modified: / 6.7.1998 / 18:38:28 / cg"
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   140
!
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   141
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   142
realizeAllSubViews
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   143
    "realize all my subviews - but not myself."
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   144
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   145
    ^ self
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   146
998
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   147
    "Created: / 6.7.1998 / 18:37:08 / cg"
962
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   148
!
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   149
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   150
subViewChangedSize
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   151
    ^ self
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   152
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   153
    "Created: 4.6.1996 / 21:35:57 / cg"
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   154
!
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   155
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   156
windowGroup
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   157
    ^ container windowGroup
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   158
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   159
    "Created: 5.6.1996 / 00:49:19 / cg"
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
! !
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   162
!VisualPart class methodsFor:'documentation'!
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
version
998
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   165
    ^ '$Header: /cvs/stx/stx/libview2/VisualPart.st,v 1.9 1998-07-10 00:00:15 cg Exp $'
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
! !