VisualComponent.st
author Claus Gittinger <cg@exept.de>
Fri, 10 Jan 1997 18:32:24 +0100
changeset 357 4bcb93f5892e
parent 323 ee2f4da361a6
child 365 47e0d48fd769
permissions -rw-r--r--
newStyle info & error messages
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
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
Object subclass:#VisualComponent
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	instanceVariableNames:'bounds fgColor bgColor'
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:''
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Graphics-Display Objects'
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
321
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
    22
!VisualComponent  class methodsFor:'documentation'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 1996 by Claus Gittinger
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
              All Rights Reserved
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
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
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
documentation
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
    42
    abstract superclass for all kinds of visual components.
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    43
    This class and its subclasses (currently) exist mostly for
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    44
    ST-80 compatibility - to provide a home for ported PD classes,
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    45
    which depend on the VisualComponent hierarchy.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    46
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    47
    Notice: 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    48
        this class was implemented using protocol information
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    49
        from alpha testers and from the Hopkins/Horan book.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    50
        - it may not be complete or compatible to the corresponding ST-80 class. 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    51
        If you encounter any incompatibilities, please forward a note 
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    52
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    53
        This is still being constructed - not yet finished.
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    [author:]
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
        Claus Gittinger
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    57
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    58
    [see also:]
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    59
        GeometricWrapper
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
321
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
    64
!VisualComponent  class methodsFor:'instance creation'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
new
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    ^ self basicNew initialize
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
!VisualComponent methodsFor:'accessing'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
274
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    72
container:someContainer
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    73
    "ignored here"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    74
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    75
    "Created: 9.5.1996 / 00:48:54 / cg"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    76
!
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    77
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    78
setParentViewIn:aView
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    79
    "ignored here - for now"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    80
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    81
    "Created: 9.5.1996 / 00:19:39 / cg"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    82
! !
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    83
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    84
!VisualComponent methodsFor:'accessing - dimensions'!
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    85
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    86
bottom
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    87
    "return my bottom y coordinate"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    88
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    89
    ^ self bounds bottom
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    90
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    91
    "Modified: 9.5.1996 / 00:13:12 / cg"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    92
    "Created: 26.5.1996 / 12:56:12 / cg"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    93
!
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
    94
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
bounds
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
    96
    "return my bounds"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
    97
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    ^ bounds
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    "Created: 8.5.1996 / 23:35:19 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   101
    "Modified: 9.5.1996 / 00:12:00 / cg"
291
785a5faf3320 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   102
! !
785a5faf3320 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   103
785a5faf3320 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   104
!VisualComponent ignoredMethodsFor:'accessing - dimensions'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   106
bounds:aRectangle
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   107
    "set my bounds"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   108
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   109
    bounds := aRectangle
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    "Created: 8.5.1996 / 23:36:07 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   112
    "Modified: 9.5.1996 / 00:13:12 / cg"
291
785a5faf3320 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   113
! !
785a5faf3320 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   114
785a5faf3320 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
   115
!VisualComponent methodsFor:'accessing - dimensions'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
274
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   117
left
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   118
    "return my left x coordinate"
250
40acd5bd28ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   119
274
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   120
    ^ self bounds left
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   121
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   122
    "Created: 8.5.1996 / 23:36:07 / cg"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   123
    "Modified: 26.5.1996 / 12:56:22 / cg"
250
40acd5bd28ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   124
!
40acd5bd28ef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   125
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
preferredBounds
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   127
    "return my preferredBounds"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   128
323
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   129
    ^ 0@0 extent:100@100
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    "Created: 8.5.1996 / 23:36:29 / cg"
323
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   132
    "Modified: 19.7.1996 / 20:06:28 / cg"
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   133
!
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   134
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   135
preferredExtent
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   136
    ^ self preferredBounds extent
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   137
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   138
    "Modified: 9.5.1996 / 00:13:22 / cg"
323
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   139
    "Created: 19.7.1996 / 20:06:19 / cg"
247
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   140
!
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   141
274
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   142
right
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   143
    "return my right x coordinate"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   144
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   145
    ^ self bounds right
247
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   146
274
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   147
    "Modified: 9.5.1996 / 00:13:12 / cg"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   148
    "Created: 26.5.1996 / 12:56:25 / cg"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   149
!
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   150
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   151
top
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   152
    "return my top y coordinate"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   153
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   154
    ^ self bounds top
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   155
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   156
    "Modified: 9.5.1996 / 00:13:12 / cg"
434f1bc78362 category changes
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   157
    "Created: 26.5.1996 / 12:56:15 / cg"
321
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   158
!
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   159
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   160
viewRectangle
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   161
    ^ self bounds
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   162
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   163
    "Created: 19.7.1996 / 17:24:58 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
!VisualComponent methodsFor:'accessing - look'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
backgroundColor:aColor
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   169
    "set my backgroundColor"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   170
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    bgColor := aColor
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    "Created: 8.5.1996 / 23:47:11 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   174
    "Modified: 9.5.1996 / 00:13:33 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
foregroundColor:aColor
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   178
    "set my foregroundColor"
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   179
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    fgColor := aColor
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    "Created: 8.5.1996 / 23:47:05 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   183
    "Modified: 9.5.1996 / 00:13:39 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
293
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   186
!VisualComponent methodsFor:'accessing-mvc'!
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   187
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   188
model
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   189
    "return nil - generic components have no model"
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   190
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   191
    ^ nil
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   192
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   193
    "Created: 5.6.1996 / 14:18:16 / cg"
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   194
! !
d10ad10d23fa prepare for view-component integration
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   195
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   196
!VisualComponent methodsFor:'displaying'!
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   197
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   198
displayOn:aGC x:x y:y
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   199
    |oldTranslation|
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   200
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   201
    oldTranslation := aGC translation.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   202
    aGC translation:(x @ y).
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   203
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   204
    self displayOn:aGC.
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   205
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   206
    aGC translation:oldTranslation
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   207
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   208
    "Created: 13.5.1996 / 10:18:43 / cg"
266
e9d35cd74f64 wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   209
    "Modified: 13.5.1996 / 11:18:24 / cg"
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   210
! !
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   211
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
!VisualComponent methodsFor:'event handling'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
buttonPress:button x:x y:y
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   215
    "button was pressed over me - ignored here"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   217
    "Modified: 9.5.1996 / 00:14:08 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
buttonRelease:button x:x y:y
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   221
    "button was released over me - ignored here"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
    "Created: 8.5.1996 / 23:38:30 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   224
    "Modified: 9.5.1996 / 00:14:04 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
321
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   227
containerChangedSize
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   228
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   229
    "Created: 19.7.1996 / 17:32:19 / cg"
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   230
!
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   231
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   232
containerMapped
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   233
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   234
    "Created: 19.7.1996 / 17:39:27 / cg"
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   235
!
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   236
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   237
containerUnmapped
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   238
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   239
    "Created: 19.7.1996 / 17:44:52 / cg"
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   240
!
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   241
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   242
destroy
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   243
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   244
    "Created: 19.7.1996 / 17:25:46 / cg"
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   245
!
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   246
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
keyPress:key x:x y:y
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   248
    "key was pressed over me - ignored here"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
    "Created: 8.5.1996 / 23:46:03 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   251
    "Modified: 9.5.1996 / 00:14:14 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
keyRelease:key x:x y:y
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   255
    "key was released over me - ignored here"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    "Created: 8.5.1996 / 23:46:07 / cg"
246
9f80dbcbcd34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   258
    "Modified: 9.5.1996 / 00:14:19 / cg"
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
!VisualComponent methodsFor:'initialization'!
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
initialize
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
    fgColor := Color black.
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
    bgColor := Color white.
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:54 / cg"
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
! !
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   270
!VisualComponent methodsFor:'queries'!
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   271
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   272
heightOn:aGC
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   273
    "return my height, if displayed on aGC;
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   274
     I assume that my height is independent of the device, and return
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   275
     the bounds height"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   276
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   277
    ^ self bounds height
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   278
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   279
    "Modified: 13.5.1996 / 10:15:13 / cg"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   280
!
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   281
290
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   282
isBorderedWrapper
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   283
     ^ false
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   284
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   285
    "Created: 5.6.1996 / 14:11:18 / cg"
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   286
!
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   287
321
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   288
isLayoutWrapper
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   289
     ^ false
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   290
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   291
    "Created: 19.7.1996 / 17:50:59 / cg"
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   292
!
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   293
290
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   294
isWrapper
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   295
     ^ false
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   296
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   297
    "Created: 5.6.1996 / 01:04:40 / cg"
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   298
!
d26dc55ac7e4 prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents: 274
diff changeset
   299
265
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   300
widthOn:aGC
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   301
    "return my width, if displayed on aGC;
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   302
     I assume that my width is independent of the device, and return
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   303
     the bounds width"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   304
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   305
    ^ self bounds width
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   306
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   307
    "Created: 13.5.1996 / 10:14:44 / cg"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   308
    "Modified: 13.5.1996 / 10:15:17 / cg"
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   309
! !
45c83acd7562 comments
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   310
247
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   311
!VisualComponent methodsFor:'testing'!
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   312
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   313
containsPoint:aPoint
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   314
    "return true, if the receiver contains aPoint"
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   315
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   316
    ^ self bounds containsPoint:aPoint
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   317
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   318
    "Created: 9.5.1996 / 00:21:44 / cg"
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   319
    "Modified: 9.5.1996 / 00:22:00 / cg"
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   320
!
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   321
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   322
hasBorder
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   323
    "return true, if the receiver shows a border"
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   324
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   325
    ^ false
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   326
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   327
    "Modified: 9.5.1996 / 00:21:29 / cg"
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   328
!
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   329
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   330
intersects:aRectangle
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   331
    "return true, if the receivers bounds intersects aRectangle"
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   332
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   333
    ^ self bounds intersects:aRectangle
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   334
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   335
    "Created: 9.5.1996 / 00:21:18 / cg"
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   336
    "Modified: 9.5.1996 / 00:22:04 / cg"
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   337
! !
7b29d5a02e68 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   338
321
6421da8810e2 more view mimicri;
Claus Gittinger <cg@exept.de>
parents: 293
diff changeset
   339
!VisualComponent  class methodsFor:'documentation'!
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
version
323
ee2f4da361a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 321
diff changeset
   342
    ^ '$Header: /cvs/stx/stx/libview2/VisualComponent.st,v 1.12 1996-07-22 09:02:58 cg Exp $'
245
8d7f9a8d2c78 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
! !