VisualPart.st
author Claus Gittinger <cg@exept.de>
Fri, 08 May 2009 16:17:09 +0200
changeset 2665 2e57436c3213
parent 2660 87d554e2590f
child 2666 01b3cb9faa58
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2376
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     1
"
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     2
 COPYRIGHT (c) 2002 by eXept Software AG
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     3
              All Rights Reserved
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     4
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     5
 This software is furnished under a license and may be used
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     6
 only in accordance with the terms of that license and with the
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     8
 be provided or otherwise made available to, or used by, any
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
     9
 other person.  No title to or ownership of the software is
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    10
 hereby transferred.
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    11
"
1789
f52f0a0d8448 category
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
    12
"{ Package: 'stx:libview2' }"
f52f0a0d8448 category
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
    13
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
VisualComponent subclass:#VisualPart
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'container'
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
1789
f52f0a0d8448 category
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
    18
	category:'Compatibility-ST80-Graphics-Display Objects'
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
    21
!VisualPart class methodsFor:'documentation'!
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    22
2376
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    23
copyright
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    24
"
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    25
 COPYRIGHT (c) 2002 by eXept Software AG
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    26
              All Rights Reserved
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    27
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    28
 This software is furnished under a license and may be used
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    29
 only in accordance with the terms of that license and with the
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    31
 be provided or otherwise made available to, or used by, any
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    32
 other person.  No title to or ownership of the software is
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    33
 hereby transferred.
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    34
"
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    35
!
bd1615a0d2af copyright
Claus Gittinger <cg@exept.de>
parents: 1789
diff changeset
    36
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    37
documentation
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    38
"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    39
    abstract superclass for all kinds of visual components, which
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    40
    are containers for some other component.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    41
    This class and its subclasses (currently) exist mostly for
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    42
    ST-80 compatibility - to provide a home for ported PD classes,
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    43
    which depend on the VisualPart hierarchy.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    44
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    45
    Notice: 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    46
        this class was implemented using protocol information
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
    47
        from alpha testers, from reading PD programs and 
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
    48
        from the Hopkins/Horan book.
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    49
        - it may not be complete or compatible to the corresponding ST-80 class. 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    50
        If you encounter any incompatibilities, please forward a note 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    51
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    52
        This is still being constructed - not yet finished.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    53
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    54
    [author:]
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    55
        Claus Gittinger
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    56
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    57
    [see also:]
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    58
        GeometricWrapper
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    59
"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    60
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    61
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
    62
! !
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
!VisualPart methodsFor:'accessing'!
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
962
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    66
backgroundColor
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    67
    ^ container backgroundColor
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    68
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    69
    "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
    70
!
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    71
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
container
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    73
    "return my container"
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    ^ container
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    "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
    78
    "Modified: 5.6.1996 / 01:08:26 / cg"
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
!
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
container:something
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    "set container"
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    container := something.
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    "Created: 9.5.1996 / 00:31:41 / cg"
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
!
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
graphicsContext
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    "return the graphicsContext"
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
254
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    92
    ^ container graphicsContext
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    "Created: 9.5.1996 / 00:32:12 / cg"
254
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    95
    "Modified: 9.5.1996 / 01:37:10 / cg"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    96
!
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    97
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    98
graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
    99
    "return the graphicsContext"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   100
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   101
    ^ container graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   102
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   103
    "Created: 9.5.1996 / 00:32:12 / cg"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   104
    "Modified: 9.5.1996 / 01:37:03 / cg"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   105
!
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   106
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   107
topComponent
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   108
    "return the top component - typically the topView"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   109
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   110
    ^ container topComponent
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   111
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   112
    "Modified: 9.5.1996 / 01:37:10 / cg"
Claus Gittinger <cg@exept.de>
parents: 249
diff changeset
   113
    "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
   114
!
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   115
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   116
view
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   117
    "return my view"
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   118
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   119
    container isNil ifTrue:[^ nil].
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   120
    ^ container view
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
    "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
   123
    "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
   124
! !
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   125
294
f44534fc18e4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 289
diff changeset
   126
!VisualPart methodsFor:'view protocol mimicri'!
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   127
2660
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   128
bottomInset
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   129
    ^ 0
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   130
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   131
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   132
computeExtent
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   133
    ^ self extent
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   134
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   135
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   136
computeOrigin
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   137
    ^ self origin
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   138
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   139
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   140
containerChangedSize
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   141
    "my container changed its size.
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   142
     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
   143
     to resize when this happens."
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   144
323
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   145
"/Transcript show:'container '; show:container; show:' of '; show:self; 
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   146
"/           show:' changed size to '; showCR:container viewRectangle.
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   147
2665
2e57436c3213 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
   148
    self layout notNil ifTrue:[
2e57436c3213 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
   149
        frame := self layout 
2e57436c3213 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
   150
                    rectangleRelativeTo:container bounds
2e57436c3213 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
   151
                    preferred:self preferredBounds.
2e57436c3213 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
   152
2e57436c3213 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
   153
        "/ container invalidate:frame.
2e57436c3213 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
   154
    ].
2660
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   155
    self invalidate.
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   156
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   157
    "Created: 4.6.1996 / 21:27:58 / cg"
323
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 294
diff changeset
   158
    "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
   159
!
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   160
2660
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   161
cornerRule
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   162
    ^ nil
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   163
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   164
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   165
create
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   166
    "want myself to be created."
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   167
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   168
    container create
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   169
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   170
    "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
   171
!
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   172
2660
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   173
destroy
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   174
    |c|
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   175
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   176
    (c := container) notNil ifTrue:[
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   177
        container := nil.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   178
        c invalidate:self bounds.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   179
        c removeComponent:self.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   180
    ].
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   181
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   182
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   183
device
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   184
    ^ container device
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   185
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   186
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   187
extentRule
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   188
    ^ nil
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   189
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   190
962
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   191
invalidate
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   192
    container notNil ifTrue:[
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   193
        container invalidate:self bounds
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   194
    ]
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   195
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   196
    "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
   197
!
e6ccfc7fb22e added more dummy methods to allow visualComponents to be
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   198
2660
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   199
isComponentOf:aViewOrComponent
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   200
    "return true, if I am a (direct or indirect) component of aViewOrComponent"
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   201
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   202
    |sview|
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   203
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   204
    sview := self.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   205
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   206
    [ (sview := sview container) notNil ] whileTrue:[
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   207
        sview == aViewOrComponent ifTrue:[^ true].
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   208
    ].
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   209
    ^ false
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   210
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   211
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   212
leftInset
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   213
    ^ 0
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   214
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   215
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   216
originRelativeTo:aContainer
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   217
    "return the origin (in pixels) relative to a superView,
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   218
     or relative to the rootView (if the aView argument is nil).
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   219
     If the receiver is nonNil and not a subview of aView, return nil."
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   220
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   221
    |currentPart
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   222
     bw   "{ Class: SmallInteger }"
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   223
     sumX "{ Class: SmallInteger }"
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   224
     sumY "{ Class: SmallInteger }"|
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   225
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   226
    currentPart := self.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   227
    sumX := 0.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   228
    sumY := 0.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   229
    [currentPart notNil] whileTrue:[
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   230
        (currentPart == aContainer) ifTrue:[
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   231
            ^ (sumX @ sumY)
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   232
        ].
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   233
        bw := currentPart borderWidth.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   234
        sumX := sumX + (currentPart left) + bw.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   235
        sumY := sumY + (currentPart top) + bw.
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   236
        currentPart := currentPart superView
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   237
    ].
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   238
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   239
    (aContainer isNil or:[aContainer == self graphicsDevice rootView]) ifTrue:[
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   240
        "return relative to screen ..."
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   241
        ^ (sumX @ sumY)
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   242
    ].
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   243
    ^ nil
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   244
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   245
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   246
originRule
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   247
    ^ nil
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   248
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   249
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   250
realize
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   251
    "my container realized itself.
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   252
     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
   253
     to do something when this happens."
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   254
998
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   255
    self realizeAllSubViews
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   256
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   257
    "Created: / 4.6.1996 / 21:28:31 / cg"
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   258
    "Modified: / 6.7.1998 / 18:38:28 / cg"
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   259
!
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   260
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   261
realizeAllSubViews
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   262
    "realize all my subviews - but not myself."
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   263
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   264
    ^ self
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   265
998
4a76a5a9a3cc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   266
    "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
   267
!
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   268
2660
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   269
relativeCorner
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   270
    ^ nil
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   271
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   272
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   273
relativeExtent
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   274
    ^ nil
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   275
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   276
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   277
relativeOrigin
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   278
    ^ nil
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   279
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   280
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   281
rightInset
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   282
    ^ 0
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   283
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   284
1220
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   285
shown
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   286
    container isNil ifTrue:[^ false].
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   287
    ^ container shown
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   288
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   289
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   290
!
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   291
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   292
subViewChangedSize
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   293
    ^ self
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   294
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   295
    "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
   296
!
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   297
2660
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   298
topInset
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   299
    ^ 0
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   300
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   301
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   302
topView
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   303
    ^ container topView
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   304
!
87d554e2590f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
   305
289
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   306
windowGroup
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   307
    ^ container windowGroup
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   308
5620dcc0c5f6 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   309
    "Created: 5.6.1996 / 00:49:19 / cg"
1220
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   310
!
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   311
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   312
withAllSubViewsDo:aBlock
39e5e28042da protocol fixes to make examples work again
Claus Gittinger <cg@exept.de>
parents: 998
diff changeset
   313
    aBlock value:self
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
! !
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
365
47e0d48fd769 commentary
Claus Gittinger <cg@exept.de>
parents: 323
diff changeset
   316
!VisualPart class methodsFor:'documentation'!
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
version
2665
2e57436c3213 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2660
diff changeset
   319
    ^ '$Header: /cvs/stx/stx/libview2/VisualPart.st,v 1.14 2009-05-08 14:17:09 cg Exp $'
249
38827944ca9c intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
! !