PopUpView.st
author Claus Gittinger <cg@exept.de>
Tue, 21 Oct 1997 20:04:52 +0200
changeset 1930 a46b3cd6a232
parent 1732 e6b92cfc32a7
child 2335 73978e370059
permissions -rw-r--r--
*** empty log message ***
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
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    13
'From Smalltalk/X, Version:3.2.1 on 20-oct-1997 at 3:10:26 pm'                  !
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    14
135
claus
parents: 89
diff changeset
    15
TopView subclass:#PopUpView
506
9c67d5232519 added mapTime instVar
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    16
	instanceVariableNames:'shadowView haveControl exclusivePointer mapTime'
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    17
	classVariableNames:'DefaultShadow DefaultLevel DefaultBorderWidth DefaultBorderColor'
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    18
	poolDictionaries:''
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    19
	category:'Views-Basic'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    20
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    21
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
    22
!PopUpView class methodsFor:'documentation'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    23
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    24
copyright
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    25
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    26
 COPYRIGHT (c) 1989 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
    27
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    28
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    29
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    30
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    32
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    33
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    34
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    35
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    36
!
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    37
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    38
documentation
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    39
"
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    40
    this class implements an abstract superclass for all views which bypass the 
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
    41
    window manager and pop up on top of the screen. A typical example is
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
    42
    a PopUpMenu. PopUpView itself is abstract, providing basic mechanisms.
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
    43
    They are not decorated by window managers.
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    44
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    45
    [styleSheet parameters:]
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    46
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    47
        popupShadow         <Boolean>           if true, popupViews show a shadow below
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    48
        popupLevel          <nil | Integer>     3D level
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    49
        popupBorderWidth    <nil | Integer>     borderWidth
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    50
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    51
    [author:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    52
        Claus Gittinger
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    53
"
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    54
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    55
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
    56
!PopUpView class methodsFor:'defaults'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    57
48194c26a46c Initial revision
claus
parents:
diff changeset
    58
defaultExtent
587
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 523
diff changeset
    59
    "return the default extent of my instances.
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 523
diff changeset
    60
     The value returned here is usually ignored, and
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 523
diff changeset
    61
     the value from preferredExtent taken instead."
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 523
diff changeset
    62
922
52c1d0d22c0e dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
    63
    |screen|
587
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 523
diff changeset
    64
922
52c1d0d22c0e dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
    65
    screen := Screen current.
52c1d0d22c0e dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
    66
    ^ (screen width // 3) @ (screen height // 3)
52c1d0d22c0e dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
    67
52c1d0d22c0e dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents: 677
diff changeset
    68
    "Modified: 5.7.1996 / 13:55:08 / cg"
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    69
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    70
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    71
shadows
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    72
    "return the shadows-flag. False means: turned off."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    73
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    74
    ^ DefaultShadow
144
claus
parents: 141
diff changeset
    75
!
claus
parents: 141
diff changeset
    76
claus
parents: 141
diff changeset
    77
shadows:aBoolean
claus
parents: 141
diff changeset
    78
    "turn on/off shadows under popUpViews. 
claus
parents: 141
diff changeset
    79
     On slow displays, turning them off makes menus appear a bit snappier.
claus
parents: 141
diff changeset
    80
     The default is set via the styleSheet and changes when the viewStyle
claus
parents: 141
diff changeset
    81
     is changed."
claus
parents: 141
diff changeset
    82
claus
parents: 141
diff changeset
    83
    DefaultShadow := aBoolean
claus
parents: 141
diff changeset
    84
!
claus
parents: 141
diff changeset
    85
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    86
updateStyleCache
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    87
    "extract values from the styleSheet and cache them in class variables"
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    88
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    89
    <resource: #style (#'popup.shadow' #'popup.level'
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    90
                       #'popup.borderWidth'
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    91
                       #'popup.borderColor')>
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    92
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    93
    ShadowView isNil ifTrue:[
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    94
        DefaultShadow := false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    95
    ] ifFalse:[
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    96
        DefaultShadow := StyleSheet at:'popup.shadow' default:false.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    97
    ].
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    98
    DefaultLevel := StyleSheet at:'popup.level'.
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    99
    DefaultBorderWidth := StyleSheet at:'popup.borderWidth'.
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   100
    DefaultBorderColor := StyleSheet colorAt:'popup.borderColor'.
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
   101
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   102
    "Modified: 20.10.1997 / 15:10:07 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   103
! !
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
!PopUpView methodsFor:'accessing'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   106
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   107
exclusivePointer:aBoolean
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   108
    "set/clear the exclusive pointer flag;
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   109
     DANGER: if set, no interaction with other views is possible,
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   110
     while the popUp is active"
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   111
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   112
    exclusivePointer := aBoolean
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   113
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   114
    "Modified: 12.5.1996 / 22:02:52 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   115
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   116
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   117
noShadow
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   118
    "turn off the shadow"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   119
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   120
    shadowView := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   121
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   122
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   123
!PopUpView methodsFor:'activation'!
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
hide
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   126
    "hide the view, leave its modal event loop"
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
    windowGroup notNil ifTrue:[
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   129
        windowGroup removeView:self.
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   130
        windowGroup := nil.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   131
    ].
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   132
    self unmap.
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   133
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   134
    "Modified: 3.5.1996 / 23:48:22 / stefan"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   135
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   136
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   137
show
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   138
    "realize the view at its last position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   139
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   140
    self fixSize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   141
    self openModal:[true] "realize     "
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   142
!
144
claus
parents: 141
diff changeset
   143
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   144
showAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   145
    "realize the view at aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   146
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   147
    self showAt:aPoint resizing:true 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   148
!
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
showAt:aPoint resizing:aBoolean
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   151
    "realize the view at aPoint"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   152
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   153
    aBoolean ifTrue:[
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   154
        self fixSize.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   155
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   156
    self origin:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   157
    self makeFullyVisible.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   158
    self openModal:[true] "realize     "
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
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   161
showAtPointer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   162
    "realize the view at the current pointer position"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   163
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   164
    self showAt:(device pointerPosition) resizing:true
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
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   167
showCenteredIn:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   168
    "make myself visible at the screen center."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   169
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   170
    |top|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   171
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   172
    top := aView topView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   173
    top raise.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   174
    self showAt:(top origin 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   175
		 + (aView originRelativeTo:top) 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   176
		 + (aView extent // 2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   177
		 - (self extent // 2))
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   178
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   179
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   180
!PopUpView methodsFor:'dispatching'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   181
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   182
modalLoop
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   183
    "obsolete support for small configuration without threads.
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   184
     This is no longer used"
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   185
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   186
    haveControl := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   187
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   188
    "this is a kludge - if we do not have multiple processes, therefore
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   189
     we start another dispatch loop, which exits when control is lost"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   190
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   191
    device dispatchFor:nil while:[haveControl]
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   192
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   193
    "Modified: 12.5.1996 / 22:03:52 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   194
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   195
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   196
!PopUpView methodsFor:'initialize / release'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   197
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   198
create
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   199
    super create.
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   200
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   201
    shadowView isNil ifTrue:[
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   202
        self saveUnder:true
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   203
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   204
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   205
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   206
destroy
141
claus
parents: 135
diff changeset
   207
    haveControl := false.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   208
    super destroy.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   209
    shadowView notNil ifTrue:[shadowView destroy. shadowView := nil]
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   210
!
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   211
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   212
initStyle
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   213
    "setup viewStyle specifics"
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   214
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   215
    super initStyle.
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   216
151
claus
parents: 144
diff changeset
   217
    styleSheet is3D == true ifTrue:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   218
        borderWidth := 0.
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   219
        level := 2
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   220
    ] ifFalse:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   221
        borderWidth := 1.
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   222
        level := 0
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   223
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   224
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   225
    DefaultBorderColor notNil ifTrue:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   226
        self borderColor:(DefaultBorderColor on:device).
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   227
    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   228
    DefaultBorderWidth notNil ifTrue:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   229
        borderWidth := DefaultBorderWidth.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   230
    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   231
"/    DefaultEdgeStyle notNil ifTrue:[
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   232
"/        edgeStyle := DefaultEdgeStyle.
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   233
"/    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   234
    DefaultLevel notNil ifTrue:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   235
        self level:DefaultLevel.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   236
    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   237
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   238
    DefaultShadow ifTrue:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   239
        shadowView := (ShadowView onDevice:device) for:self.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   240
    ].
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   241
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   242
    "Modified: 22.1.1997 / 11:57:38 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   243
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   244
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   245
initialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   246
    super initialize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   247
    exclusivePointer := true.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   248
    haveControl := false.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   249
    type := #popup 
162
claus
parents: 157
diff changeset
   250
!
claus
parents: 157
diff changeset
   251
claus
parents: 157
diff changeset
   252
releasePointer 
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   253
    "release the mouse pointer"
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   254
162
claus
parents: 157
diff changeset
   255
    device activePointerGrab == self ifTrue:[
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   256
        device ungrabPointer.
162
claus
parents: 157
diff changeset
   257
    ].
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   258
"/ ?? ca ??
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   259
"/    device activeKeyboardGrab == self ifTrue:[
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   260
"/        device ungrabKeyboard
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   261
"/    ].
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   262
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   263
    "Modified: 12.5.1996 / 22:04:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   264
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   265
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   266
!PopUpView methodsFor:'private'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   267
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   268
regainControl
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   269
    "get exclusive access to pointer and keyboard"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   270
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   271
    |sensor|
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   272
648
a913a55fa11b checkin from browser
Stefan Vogel <sv@exept.de>
parents: 643
diff changeset
   273
    shown ifTrue:[
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   274
        device grabPointerInView:self.
648
a913a55fa11b checkin from browser
Stefan Vogel <sv@exept.de>
parents: 643
diff changeset
   275
        device grabKeyboardInView:self.
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   276
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   277
        self sensor flushMotionEventsFor:nil.
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   278
        self sensor flushKeyboardFor:nil.
648
a913a55fa11b checkin from browser
Stefan Vogel <sv@exept.de>
parents: 643
diff changeset
   279
    ].
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   280
648
a913a55fa11b checkin from browser
Stefan Vogel <sv@exept.de>
parents: 643
diff changeset
   281
    "Modified: 6.5.1996 / 22:33:39 / stefan"
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   282
    "Modified: 12.5.1996 / 22:04:42 / cg"
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   283
! !
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   284
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   285
!PopUpView methodsFor:'queries'!
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   286
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   287
isPopUpView
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   288
    "return true, since I want to come up without decoration 
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   289
     and popUp to top immediately."
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   290
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   291
    ^ true
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   292
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   293
    "Modified: 12.5.1996 / 21:57:51 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   294
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   295
48194c26a46c Initial revision
claus
parents:
diff changeset
   296
!PopUpView methodsFor:'realize / unrealize'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   297
48194c26a46c Initial revision
claus
parents:
diff changeset
   298
mapped
162
claus
parents: 157
diff changeset
   299
    "grab the pointer here, when visible (but not control is already lost). 
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   300
     If the grab fails, try again and unmap myself if that fails too."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   301
523
2de6065d37c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 506
diff changeset
   302
    mapTime := Time millisecondClockValue.
2de6065d37c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 506
diff changeset
   303
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   304
    super mapped.
162
claus
parents: 157
diff changeset
   305
157
claus
parents: 151
diff changeset
   306
    (haveControl 
162
claus
parents: 157
diff changeset
   307
    and:[true "/ exclusivePointer
157
claus
parents: 151
diff changeset
   308
    and:[realized]]) ifTrue:[
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   309
        (device grabPointerInView:self) ifFalse:[
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   310
            "wait a little bit and try again"
157
claus
parents: 151
diff changeset
   311
"/            'grab pointer failed' errorPrintNL.
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   312
            Delay waitForSeconds:0.1.
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   313
            (device grabPointerInView:self) ifFalse:[
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   314
                "give up"
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   315
                'PopUpView [warning]: could not grab pointer' errorPrintCR.
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   316
                self unmap
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   317
            ]
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   318
        ].
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   319
        exclusivePointer ifFalse:[
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   320
            self releasePointer
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   321
        ].
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   322
        device grabKeyboardInView:self.
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   323
        self getKeyboardFocus
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   324
    ]
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   325
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   326
    "Modified: 3.5.1996 / 23:48:37 / stefan"
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   327
    "Modified: 10.1.1997 / 18:00:31 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   328
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   329
48194c26a46c Initial revision
claus
parents:
diff changeset
   330
realize
48194c26a46c Initial revision
claus
parents:
diff changeset
   331
    shadowView notNil ifTrue:[shadowView realize].
48194c26a46c Initial revision
claus
parents:
diff changeset
   332
    self raise.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   333
    haveControl := true.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   334
    super realize.
48194c26a46c Initial revision
claus
parents:
diff changeset
   335
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   336
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   337
restarted
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   338
    ^ self
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   339
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   340
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   341
unmap
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   342
    haveControl := false.
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   343
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   344
    self releasePointer.
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   345
    super unmap.
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   346
    shadowView notNil ifTrue:[shadowView unmap].
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   347
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   348
    "Modified: 3.5.1996 / 23:46:06 / stefan"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   349
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   350
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   351
!PopUpView class methodsFor:'documentation'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   352
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   353
version
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   354
    ^ '$Header: /cvs/stx/stx/libview/PopUpView.st,v 1.35 1997-10-21 18:04:52 cg Exp $'
157
claus
parents: 151
diff changeset
   355
! !