InputView.st
author Claus Gittinger <cg@exept.de>
Wed, 27 May 1998 11:20:52 +0200
changeset 948 50ce6c646929
parent 521 2937b6c596b3
child 1185 522d9c84f0a9
permissions -rw-r--r--
prefRect may now be a valueHolder or block.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
3f9277473954 Initial revision
claus
parents:
diff changeset
     1
"
6
4ac87e6bf82f *** empty log message ***
claus
parents: 5
diff changeset
     2
 COPYRIGHT (c) 1990 by Claus Gittinger
99
claus
parents: 96
diff changeset
     3
	      All Rights Reserved
0
3f9277473954 Initial revision
claus
parents:
diff changeset
     4
3f9277473954 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
3f9277473954 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
3f9277473954 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
3f9277473954 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
3f9277473954 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
3f9277473954 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
3f9277473954 Initial revision
claus
parents:
diff changeset
    11
"
3f9277473954 Initial revision
claus
parents:
diff changeset
    12
65
claus
parents: 23
diff changeset
    13
SimpleView subclass:#InputView
225
7c62c2ffb363 documentation
Claus Gittinger <cg@exept.de>
parents: 130
diff changeset
    14
	instanceVariableNames:'eventReceiver'
7c62c2ffb363 documentation
Claus Gittinger <cg@exept.de>
parents: 130
diff changeset
    15
	classVariableNames:''
7c62c2ffb363 documentation
Claus Gittinger <cg@exept.de>
parents: 130
diff changeset
    16
	poolDictionaries:''
235
236f3222fa88 class category changes
Claus Gittinger <cg@exept.de>
parents: 225
diff changeset
    17
	category:'Views-Special'
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    18
!
3f9277473954 Initial revision
claus
parents:
diff changeset
    19
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    20
!InputView class methodsFor:'documentation'!
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    22
copyright
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    23
"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    24
 COPYRIGHT (c) 1990 by Claus Gittinger
99
claus
parents: 96
diff changeset
    25
	      All Rights Reserved
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    26
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    27
 This software is furnished under a license and may be used
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    28
 only in accordance with the terms of that license and with the
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    30
 be provided or otherwise made available to, or used by, any
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    31
 other person.  No title to or ownership of the software is
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    32
 hereby transferred.
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    33
"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    34
!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    35
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    36
documentation
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    37
"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    38
    a view for input only - forwarding all events to another object.
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    39
    This kind of view can be used to be laid ontop of another view to catch all
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    40
    input. (Interface builder)
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    41
    NOTICE: the event forwarding is a leftover from times when not delegation mechanism
225
7c62c2ffb363 documentation
Claus Gittinger <cg@exept.de>
parents: 130
diff changeset
    42
            existed - it will vanish - use delegates for new code.
7c62c2ffb363 documentation
Claus Gittinger <cg@exept.de>
parents: 130
diff changeset
    43
7c62c2ffb363 documentation
Claus Gittinger <cg@exept.de>
parents: 130
diff changeset
    44
    [author:]
7c62c2ffb363 documentation
Claus Gittinger <cg@exept.de>
parents: 130
diff changeset
    45
        Claus Gittinger
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    46
"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    47
! !
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    48
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    49
!InputView methodsFor:'accessing'!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    50
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    51
eventReceiver:aView
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    52
    eventReceiver := aView
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    53
!
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    54
286
b7f2e2aefae1 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    55
isInputOnly
b7f2e2aefae1 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    56
    "yes, this is a transparent input-only view"
b7f2e2aefae1 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    57
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    58
    ^ true
286
b7f2e2aefae1 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    59
b7f2e2aefae1 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
    60
    "Created: 1.6.1996 / 13:22:31 / cg"
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    61
! !
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    62
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    63
!InputView methodsFor:'drag & drop'!
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    64
521
2937b6c596b3 drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
    65
canDrop:aCollectionOfDropObjects
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    66
    eventReceiver notNil ifTrue:[
521
2937b6c596b3 drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
    67
        ^ eventReceiver canDrop:aCollectionOfDropObjects
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    68
    ].
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    69
    ^ false
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    70
521
2937b6c596b3 drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
    71
    "Modified: 11.4.1997 / 12:42:06 / cg"
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    72
!
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    73
521
2937b6c596b3 drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
    74
drop:aCollectionOfDropObjects at:aPoint
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    75
    eventReceiver notNil ifTrue:[
521
2937b6c596b3 drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
    76
        eventReceiver drop:aCollectionOfDropObjects at:aPoint
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    77
    ].
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    78
521
2937b6c596b3 drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
    79
    "Modified: 11.4.1997 / 12:43:41 / cg"
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    80
! !
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
    81
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    82
!InputView methodsFor:'event handling'!
3f9277473954 Initial revision
claus
parents:
diff changeset
    83
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    84
buttonMotion:state x:x y:y
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    85
    "redefined to forward event"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    86
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    87
    eventReceiver notNil ifTrue:[
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    88
	eventReceiver buttonMotion:state x:x y:y
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    89
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
    90
!
3f9277473954 Initial revision
claus
parents:
diff changeset
    91
3f9277473954 Initial revision
claus
parents:
diff changeset
    92
buttonPress:button x:x y:y
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    93
    "redefined to forward event"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
    94
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    95
    eventReceiver notNil ifTrue:[
99
claus
parents: 96
diff changeset
    96
	eventReceiver buttonPress:button x:x y:y
0
3f9277473954 Initial revision
claus
parents:
diff changeset
    97
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
    98
!
3f9277473954 Initial revision
claus
parents:
diff changeset
    99
3f9277473954 Initial revision
claus
parents:
diff changeset
   100
buttonRelease:button x:x y:y
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   101
    "redefined to forward event"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   102
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   103
    eventReceiver notNil ifTrue:[
99
claus
parents: 96
diff changeset
   104
	eventReceiver buttonRelease:button x:x y:y
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   105
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
   106
!
3f9277473954 Initial revision
claus
parents:
diff changeset
   107
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   108
exposeX:x y:y width:w height:h
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   109
    "will never be received"
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   110
    ^ self
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   111
!
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   112
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   113
focusIn
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   114
    "redefined to forward event"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   115
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   116
    eventReceiver notNil ifTrue:[
99
claus
parents: 96
diff changeset
   117
	eventReceiver focusIn
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   118
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
   119
!
3f9277473954 Initial revision
claus
parents:
diff changeset
   120
3f9277473954 Initial revision
claus
parents:
diff changeset
   121
focusOut
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   122
    "redefined to forward event"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   123
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   124
    eventReceiver notNil ifTrue:[
99
claus
parents: 96
diff changeset
   125
	eventReceiver focusOut
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   126
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
   127
!
3f9277473954 Initial revision
claus
parents:
diff changeset
   128
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   129
keyPress:key x:x y:y
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   130
    "redefined to forward event"
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   131
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   132
    eventReceiver notNil ifTrue:[
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   133
	eventReceiver keyPress:key x:x y:y
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   134
    ]
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   135
!
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   136
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   137
keyRelease:key x:x y:y
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   138
    "redefined to forward event"
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   139
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   140
    eventReceiver notNil ifTrue:[
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   141
	eventReceiver keyRelease:key x:x y:y
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   142
    ]
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   143
!
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   144
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   145
pointerEnter:state x:x y:y
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   146
    "redefined to forward event"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   147
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   148
    eventReceiver notNil ifTrue:[
99
claus
parents: 96
diff changeset
   149
	eventReceiver pointerEnter:state x:x y:y
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   150
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
   151
!
3f9277473954 Initial revision
claus
parents:
diff changeset
   152
3f9277473954 Initial revision
claus
parents:
diff changeset
   153
pointerLeave:state
21
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   154
    "redefined to forward event"
66b31c91177f *** empty log message ***
claus
parents: 6
diff changeset
   155
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   156
    eventReceiver notNil ifTrue:[
99
claus
parents: 96
diff changeset
   157
	eventReceiver pointerLeave:state
0
3f9277473954 Initial revision
claus
parents:
diff changeset
   158
    ]
3f9277473954 Initial revision
claus
parents:
diff changeset
   159
! !
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   160
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   161
!InputView methodsFor:'initialization'!
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   162
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   163
initialize
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   164
    super initialize.
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   165
    borderWidth := 0
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   166
! !
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   167
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   168
!InputView methodsFor:'redefined dummy'!
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   169
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   170
setViewBackground
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   171
    "inputviews have no background"
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   172
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   173
    ^ self
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   174
! !
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   175
449
9d18c9a66b59 delegate drop
ca
parents: 327
diff changeset
   176
!InputView class methodsFor:'documentation'!
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   177
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   178
version
521
2937b6c596b3 drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
   179
    ^ '$Header: /cvs/stx/stx/libview2/InputView.st,v 1.16 1997-04-11 10:48:20 cg Exp $'
130
ddb0e9c49fc8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   180
! !