PopUpView.st
author Claus Gittinger <cg@exept.de>
Wed, 06 Mar 1996 16:48:58 +0100
changeset 506 9c67d5232519
parent 493 736384460102
child 523 2de6065d37c8
permissions -rw-r--r--
added mapTime instVar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
135
claus
parents: 89
diff changeset
    13
TopView subclass:#PopUpView
506
9c67d5232519 added mapTime instVar
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    14
	instanceVariableNames:'shadowView haveControl exclusivePointer mapTime'
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    15
	classVariableNames:'DefaultShadow DefaultLevel DefaultBorderWidth DefaultBorderColor'
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    16
	poolDictionaries:''
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    17
	category:'Views-Basic'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    18
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    19
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    20
!PopUpView class methodsFor:'documentation'!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    21
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    22
copyright
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    23
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    24
 COPYRIGHT (c) 1989 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
    25
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    26
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    27
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    28
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    30
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    31
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    32
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    33
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    34
!
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    35
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    36
documentation
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    37
"
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    38
    this class implements an abstract superclass for all views which bypass the 
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
    39
    window manager and pop up on top of the screen. A typical example is
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
    40
    a PopUpMenu. PopUpView itself is abstract, providing basic mechanisms.
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
    41
    They are not decorated by window managers.
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    42
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    43
    styleSheet parameters:
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    44
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    45
	popupShadow         <Boolean>           if true, popupViews show a shadow below
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    46
	popupLevel          <nil | Integer>     3D level
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    47
	popupBorderWidth    <nil | Integer>     borderWidth
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    48
"
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    49
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    50
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    51
!PopUpView class methodsFor:'defaults'!
48194c26a46c Initial revision
claus
parents:
diff changeset
    52
48194c26a46c Initial revision
claus
parents:
diff changeset
    53
defaultExtent
135
claus
parents: 89
diff changeset
    54
    ^ (Display width // 3) @ (Display height // 3)
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    55
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    56
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    57
shadows
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    58
    "return the shadows-flag. False means: turned off."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    59
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    60
    ^ DefaultShadow
144
claus
parents: 141
diff changeset
    61
!
claus
parents: 141
diff changeset
    62
claus
parents: 141
diff changeset
    63
shadows:aBoolean
claus
parents: 141
diff changeset
    64
    "turn on/off shadows under popUpViews. 
claus
parents: 141
diff changeset
    65
     On slow displays, turning them off makes menus appear a bit snappier.
claus
parents: 141
diff changeset
    66
     The default is set via the styleSheet and changes when the viewStyle
claus
parents: 141
diff changeset
    67
     is changed."
claus
parents: 141
diff changeset
    68
claus
parents: 141
diff changeset
    69
    DefaultShadow := aBoolean
claus
parents: 141
diff changeset
    70
!
claus
parents: 141
diff changeset
    71
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    72
updateStyleCache
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    73
    "extract values from the styleSheet and cache them in class variables"
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    74
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    75
    <resource: #style (#popupShadow #popupLevel
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    76
                       #popupBorderWidth
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    77
                       #popupBorderColor)>
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    78
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    79
    ShadowView isNil ifTrue:[
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    80
        DefaultShadow := false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    81
    ] ifFalse:[
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    82
        DefaultShadow := StyleSheet at:'popupShadow' default:false.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    83
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    84
    DefaultLevel := StyleSheet at:'popupLevel'.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    85
    DefaultBorderWidth := StyleSheet at:'popupBorderWidth'.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    86
    DefaultBorderColor := StyleSheet colorAt:'popupBorderColor'.
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    87
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    88
    "Modified: 1.3.1996 / 13:45:26 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    89
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    90
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    91
!PopUpView methodsFor:'accessing'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    92
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    93
exclusivePointer:aBoolean
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    94
    exclusivePointer := aBoolean
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    95
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    96
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    97
noShadow
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    98
    "turn off the shadow"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    99
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   100
    shadowView := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   101
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   102
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   103
!PopUpView methodsFor:'activation'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   104
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   105
hide
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   106
    "hide the view, leave its modal event loop"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   107
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   108
    windowGroup notNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   109
	windowGroup removeView:self.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   110
	windowGroup := nil.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   111
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   112
    self unrealize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   113
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   114
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   115
show
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   116
    "realize the view at its last position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   117
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   118
    self fixSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   119
    self openModal:[true] "realize     "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   120
!
144
claus
parents: 141
diff changeset
   121
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   122
showAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   123
    "realize the view at aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   124
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   125
    self showAt:aPoint resizing:true 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   126
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   127
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   128
showAt:aPoint resizing:aBoolean
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   129
    "realize the view at aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   130
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   131
    aBoolean ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   132
	self fixSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   133
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   134
    self origin:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   135
    self makeFullyVisible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   136
    self openModal:[true] "realize     "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   137
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   138
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   139
showAtPointer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   140
    "realize the view at the current pointer position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   141
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   142
    self showAt:(device pointerPosition) resizing:true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   143
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   144
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   145
showCenteredIn:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   146
    "make myself visible at the screen center."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   147
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   148
    |top|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   149
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   150
    top := aView topView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   151
    top raise.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   152
    self showAt:(top origin 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   153
		 + (aView originRelativeTo:top) 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   154
		 + (aView extent // 2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   155
		 - (self extent // 2))
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   156
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   157
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   158
!PopUpView methodsFor:'dispatching'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   159
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   160
modalLoop
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   161
    haveControl := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   162
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   163
    "this is a kludge - we do not have multiple processes, therefore
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   164
     we start another dispatch loop, which exits when control is lost"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   165
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   166
    device dispatchFor:nil while:[haveControl]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   167
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   168
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   169
!PopUpView methodsFor:'initialize / release'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   170
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   171
create
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   172
    super create.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   173
    shadowView isNil ifTrue:[
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   174
	self saveUnder:true
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   175
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   176
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   177
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   178
destroy
141
claus
parents: 135
diff changeset
   179
    haveControl := false.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   180
    super destroy.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   181
    shadowView notNil ifTrue:[shadowView destroy. shadowView := nil]
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   182
!
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   183
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   184
initStyle
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   185
    super initStyle.
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   186
151
claus
parents: 144
diff changeset
   187
    styleSheet is3D == true ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   188
	borderWidth := 0.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   189
	level := 2
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   190
    ] ifFalse:[
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   191
	borderWidth := 1.
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   192
	level := 0
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   193
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   194
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   195
    DefaultBorderColor notNil ifTrue:[
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   196
	self borderColor:(DefaultBorderColor on:device).
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   197
    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   198
    DefaultBorderWidth notNil ifTrue:[
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   199
	borderWidth := DefaultBorderWidth.
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   200
    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   201
"/    DefaultEdgeStyle notNil ifTrue:[
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   202
"/        edgeStyle := DefaultEdgeStyle.
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   203
"/    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   204
    DefaultLevel notNil ifTrue:[
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   205
	self level:DefaultLevel.
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   206
    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   207
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   208
    DefaultShadow ifTrue:[
135
claus
parents: 89
diff changeset
   209
	shadowView := (ShadowView onDevice:device) for:self.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   210
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   211
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   212
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   213
initialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   214
    super initialize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   215
    exclusivePointer := true.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   216
    haveControl := false.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   217
    type := #popup 
162
claus
parents: 157
diff changeset
   218
!
claus
parents: 157
diff changeset
   219
claus
parents: 157
diff changeset
   220
releasePointer 
claus
parents: 157
diff changeset
   221
    device activePointerGrab == self ifTrue:[
claus
parents: 157
diff changeset
   222
	device ungrabPointer.
claus
parents: 157
diff changeset
   223
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   224
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   225
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   226
!PopUpView methodsFor:'private'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   227
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   228
leaveControl
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   229
    haveControl := false
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   230
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   231
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   232
regainControl
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   233
    device grabPointerInView:self. 
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   234
device grabKeyboardInView:self.
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   235
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   236
    "Modified: 1.3.1996 / 13:18:22 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   237
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   238
48194c26a46c Initial revision
claus
parents:
diff changeset
   239
takeControl
48194c26a46c Initial revision
claus
parents:
diff changeset
   240
^ self.
48194c26a46c Initial revision
claus
parents:
diff changeset
   241
    haveControl := true.
48194c26a46c Initial revision
claus
parents:
diff changeset
   242
48194c26a46c Initial revision
claus
parents:
diff changeset
   243
    "this is a kludge - we do not have multiple processes, therefore
48194c26a46c Initial revision
claus
parents:
diff changeset
   244
     we start another dispatch loop, which exits when control is lost"
48194c26a46c Initial revision
claus
parents:
diff changeset
   245
48194c26a46c Initial revision
claus
parents:
diff changeset
   246
    device dispatchFor:drawableId while:[haveControl]
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   247
! !
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   248
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   249
!PopUpView methodsFor:'queries'!
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   250
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   251
isPopUpView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   252
    ^ true
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   253
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   254
48194c26a46c Initial revision
claus
parents:
diff changeset
   255
!PopUpView methodsFor:'realize / unrealize'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   256
48194c26a46c Initial revision
claus
parents:
diff changeset
   257
mapped
162
claus
parents: 157
diff changeset
   258
    "grab the pointer here, when visible (but not control is already lost). 
claus
parents: 157
diff changeset
   259
     If the grab fails, try again and unrealize myself if that fails too."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   260
48194c26a46c Initial revision
claus
parents:
diff changeset
   261
    super mapped.
162
claus
parents: 157
diff changeset
   262
157
claus
parents: 151
diff changeset
   263
    (haveControl 
162
claus
parents: 157
diff changeset
   264
    and:[true "/ exclusivePointer
157
claus
parents: 151
diff changeset
   265
    and:[realized]]) ifTrue:[
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   266
        (device grabPointerInView:self) ifFalse:[
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   267
            "wait a little bit and try again"
157
claus
parents: 151
diff changeset
   268
"/            'grab pointer failed' errorPrintNL.
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   269
            Delay waitForSeconds:0.1.
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   270
            (device grabPointerInView:self) ifFalse:[
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   271
                "give up"
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   272
                'could not grab pointer' errorPrintNL.
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   273
                self unrealize
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   274
            ]
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   275
        ].
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   276
        exclusivePointer ifFalse:[
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   277
            self releasePointer
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   278
        ].
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   279
device grabKeyboardInView:self.
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   280
        self getKeyboardFocus
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   281
    ]
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   282
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   283
    "Modified: 1.3.1996 / 13:17:35 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   284
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   285
48194c26a46c Initial revision
claus
parents:
diff changeset
   286
realize
48194c26a46c Initial revision
claus
parents:
diff changeset
   287
    shadowView notNil ifTrue:[shadowView realize].
48194c26a46c Initial revision
claus
parents:
diff changeset
   288
    self raise.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   289
    haveControl := true.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   290
    super realize.
48194c26a46c Initial revision
claus
parents:
diff changeset
   291
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   292
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   293
restarted
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   294
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   295
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   296
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   297
unrealize
48194c26a46c Initial revision
claus
parents:
diff changeset
   298
    haveControl := false.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   299
    device activePointerGrab == self ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
   300
	device ungrabPointer.
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   301
    ].
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   302
    super unrealize.
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   303
    shadowView notNil ifTrue:[shadowView unrealize].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   304
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   305
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   306
!PopUpView class methodsFor:'documentation'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   307
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   308
version
506
9c67d5232519 added mapTime instVar
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
   309
    ^ '$Header: /cvs/stx/stx/libview/PopUpView.st,v 1.24 1996-03-06 15:48:58 cg Exp $'
157
claus
parents: 151
diff changeset
   310
! !