PopUpView.st
author ca
Mon, 12 Mar 2007 09:24:24 +0100
changeset 4738 e2224a3d9174
parent 4372 30c22dddafcf
child 5387 be2ff936d043
permissions -rw-r--r--
accessing haveControl from outside
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
"
3219
9197f5be48d1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3179
diff changeset
    12
"{ Package: 'stx:libview' }"
9197f5be48d1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3179
diff changeset
    13
135
claus
parents: 89
diff changeset
    14
TopView subclass:#PopUpView
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
    15
	instanceVariableNames:'shadowView haveControl exclusivePointer mapTime
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
    16
		previousPointerGrab previousKeyboardGrab'
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
2876
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    72
    "return the shadows-flag. False means: turned off.
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    73
     Notice, that even when set to true, a particular device might
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    74
     want to suppress this feature."
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    75
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    76
    ^ DefaultShadow
144
claus
parents: 141
diff changeset
    77
!
claus
parents: 141
diff changeset
    78
claus
parents: 141
diff changeset
    79
shadows:aBoolean
claus
parents: 141
diff changeset
    80
    "turn on/off shadows under popUpViews. 
2876
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    81
     Notice, that even when set to true, a particular device might
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    82
     want to suppress this feature.
144
claus
parents: 141
diff changeset
    83
     On slow displays, turning them off makes menus appear a bit snappier.
claus
parents: 141
diff changeset
    84
     The default is set via the styleSheet and changes when the viewStyle
claus
parents: 141
diff changeset
    85
     is changed."
claus
parents: 141
diff changeset
    86
claus
parents: 141
diff changeset
    87
    DefaultShadow := aBoolean
claus
parents: 141
diff changeset
    88
!
claus
parents: 141
diff changeset
    89
2876
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    90
shadowsOnDevice:aDevice
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    91
    "return true, if shadows should be shown on aDevice"
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    92
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    93
    ^ DefaultShadow and:[aDevice suppressShadowViews not]
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    94
!
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
    95
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    96
updateStyleCache
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    97
    "extract values from the styleSheet and cache them in class variables"
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
    98
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
    99
    <resource: #style (#'popup.shadow' #'popup.level'
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   100
                       #'popup.borderWidth'
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   101
                       #'popup.borderColor')>
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
   102
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   103
    ShadowView isNil ifTrue:[
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
   104
        DefaultShadow := false
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   105
    ] ifFalse:[
2876
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
   106
        "/ notice, that even when true, a particular device might
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
   107
        "/ want to suppress this feature.
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   108
        DefaultShadow := StyleSheet at:'popup.shadow' default:false.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   109
    ].
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   110
    DefaultLevel := StyleSheet at:'popup.level'.
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   111
    DefaultBorderWidth := StyleSheet at:'popup.borderWidth'.
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   112
    DefaultBorderColor := StyleSheet colorAt:'popup.borderColor'.
485
47c3cfae7ae2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 388
diff changeset
   113
1930
a46b3cd6a232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1732
diff changeset
   114
    "Modified: 20.10.1997 / 15:10:07 / 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
!PopUpView methodsFor:'accessing'!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   118
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   119
exclusivePointer:aBoolean
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   120
    "set/clear the exclusive pointer flag;
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   121
     DANGER: if set, no interaction with other views is possible,
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   122
     while the popUp is active"
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   123
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   124
    exclusivePointer := aBoolean
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   125
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   126
    "Modified: 12.5.1996 / 22:02:52 / cg"
269
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
4738
e2224a3d9174 accessing haveControl from outside
ca
parents: 4372
diff changeset
   129
haveControl:aBoolean
e2224a3d9174 accessing haveControl from outside
ca
parents: 4372
diff changeset
   130
    "set the flag which decides whether the pointers canbe grab
e2224a3d9174 accessing haveControl from outside
ca
parents: 4372
diff changeset
   131
     during mapped.
e2224a3d9174 accessing haveControl from outside
ca
parents: 4372
diff changeset
   132
    "
e2224a3d9174 accessing haveControl from outside
ca
parents: 4372
diff changeset
   133
    haveControl := aBoolean.
e2224a3d9174 accessing haveControl from outside
ca
parents: 4372
diff changeset
   134
!
e2224a3d9174 accessing haveControl from outside
ca
parents: 4372
diff changeset
   135
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   136
noShadow
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   137
    "turn off the shadow"
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
    shadowView := nil
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   140
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   141
3887
01f98c2951a6 method category rename
Claus Gittinger <cg@exept.de>
parents: 3884
diff changeset
   142
!PopUpView methodsFor:'activation & deactivation'!
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   143
3154
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   144
open
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   145
    "default for popUpViews is to come up modal"
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   146
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   147
    self openModal
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   148
!
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   149
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   150
show
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   151
    "realize the view at its last position"
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
    self fixSize.
3154
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   154
    self open
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   155
!
144
claus
parents: 141
diff changeset
   156
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   157
showAt:aPoint
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   158
    "realize the view at aPoint"
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
    self showAt:aPoint resizing:true 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   161
!
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
showAt:aPoint resizing:aBoolean
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   164
    "realize the view at aPoint"
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
    aBoolean ifTrue:[
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   167
        self fixSize.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   168
    ].
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   169
    self origin:aPoint.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   170
    self makeFullyVisible.
3154
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   171
    self open 
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   172
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   173
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   174
showAtPointer
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   175
    "realize the view at the current pointer position"
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
    self showAt:(device pointerPosition) resizing:true
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
showCenteredIn:aView
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   181
    "make myself visible at the screen center."
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   182
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   183
    |top|
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   184
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   185
    top := aView topView.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   186
    top raise.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   187
    self showAt:(top origin 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   188
		 + (aView originRelativeTo:top) 
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   189
		 + (aView extent // 2)
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   190
		 - (self extent // 2))
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   191
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   192
2412
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   193
!PopUpView methodsFor:'defaults'!
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   194
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   195
defaultShadow
2876
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
   196
    "obsoleted by PopUpView defaultShadowOn:aDevice"
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
   197
3588
ce74b5c6953c Obsolete method
Stefan Vogel <sv@exept.de>
parents: 3402
diff changeset
   198
    <resource: #obsolete>
ce74b5c6953c Obsolete method
Stefan Vogel <sv@exept.de>
parents: 3402
diff changeset
   199
2876
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
   200
    self obsoleteMethodWarning.
2412
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   201
    ^ DefaultShadow
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   202
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   203
    "Created: / 4.12.1998 / 15:11:20 / cg"
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   204
! !
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   205
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   206
!PopUpView methodsFor:'grabbing'!
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   207
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   208
forceUngrabKeyboard
3402
df9d1563077f remove info print (... should no longer be invoked)
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   209
"/    'PopUpView [warning]: forceUngrabKeyboard should no longer be invoked' errorPrintCR.
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   210
"/ Transcript show:'k-uuu forced by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   211
"/ self halt.
3402
df9d1563077f remove info print (... should no longer be invoked)
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   212
    super forceUngrabKeyboard.
df9d1563077f remove info print (... should no longer be invoked)
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   213
!
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   214
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   215
forceUngrabPointer
3402
df9d1563077f remove info print (... should no longer be invoked)
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   216
"/    'PopUpView [warning]: forceUngrabPointer should no longer be invoked' errorPrintCR.
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   217
"/ Transcript show:'uuu forced by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   218
"/ self halt.
3402
df9d1563077f remove info print (... should no longer be invoked)
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   219
    super forceUngrabPointer.
df9d1563077f remove info print (... should no longer be invoked)
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   220
!
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   221
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   222
grabKeyboard
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   223
    previousKeyboardGrab := device activeKeyboardGrab.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   224
"/ Transcript show:'k-ggg by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   225
    ^ super grabKeyboard
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   226
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   227
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   228
!
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   229
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   230
grabPointerWithCursor:aCursorOrNil
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   231
    previousPointerGrab := device activePointerGrab.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   232
"/ Transcript show:'ggg by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   233
    ^ super grabPointerWithCursor:aCursorOrNil
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   234
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   235
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   236
!
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   237
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   238
ungrabKeyboard
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   239
"/ Transcript show:'k-uuu by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   240
    super ungrabKeyboard.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   241
    previousKeyboardGrab notNil ifTrue:[
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   242
        device grabKeyboardInView:previousKeyboardGrab
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   243
    ].
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   244
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   245
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   246
!
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   247
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   248
ungrabPointer
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   249
"/ Transcript show:'uuu by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   250
    super ungrabPointer.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   251
    previousPointerGrab notNil ifTrue:[
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   252
        device grabPointerInView:previousPointerGrab
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   253
    ].
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   254
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   255
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   256
! !
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   257
3884
dc9ea4cfc963 method category rename
Claus Gittinger <cg@exept.de>
parents: 3882
diff changeset
   258
!PopUpView methodsFor:'initialization & release'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   259
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   260
create
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   261
    super create.
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   262
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   263
    shadowView isNil ifTrue:[
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   264
        self saveUnder:true
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   265
    ]
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   266
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   267
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   268
destroy
141
claus
parents: 135
diff changeset
   269
    haveControl := false.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   270
    super destroy.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   271
    shadowView notNil ifTrue:[shadowView destroy. shadowView := nil]
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   272
!
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   273
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   274
initStyle
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   275
    "setup viewStyle specifics"
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   276
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   277
    |l|
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   278
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   279
    super initStyle.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   280
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   281
    DefaultBorderColor notNil ifTrue:[
2831
62b8abcdf5f2 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2579
diff changeset
   282
        self borderColor:(DefaultBorderColor onDevice:device).
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   283
    ].
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   284
    DefaultBorderWidth isNil ifTrue:[
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   285
        borderWidth := styleSheet is3D ifTrue:[0] ifFalse:[1].
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   286
    ] ifFalse:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   287
        borderWidth := DefaultBorderWidth.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   288
    ].
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   289
    DefaultLevel isNil ifTrue:[
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   290
        l := styleSheet is3D ifTrue:[1] ifFalse:[0].
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   291
    ] ifFalse:[
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   292
        l := DefaultLevel.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   293
    ].
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   294
    self level:l.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   295
2876
dbe1454f8539 allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
   296
    (self class shadowsOnDevice:device) ifTrue:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   297
        shadowView := (ShadowView onDevice:device) for:self.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   298
    ].
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   299
2412
3065f9e362dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2387
diff changeset
   300
    "Modified: / 4.12.1998 / 15:11:28 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   301
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   302
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   303
initialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   304
    super initialize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   305
    exclusivePointer := true.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   306
    haveControl := false.
4080
8f7e8d597552 no access to type instVar
Claus Gittinger <cg@exept.de>
parents: 3952
diff changeset
   307
    self bePopUpView
162
claus
parents: 157
diff changeset
   308
!
claus
parents: 157
diff changeset
   309
3307
bc96492a48de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
   310
releaseDeviceResources
bc96492a48de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
   311
    shadowView notNil ifTrue:[shadowView destroy. shadowView := nil].
bc96492a48de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
   312
    super releaseDeviceResources
bc96492a48de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
   313
!
bc96492a48de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
   314
162
claus
parents: 157
diff changeset
   315
releasePointer 
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   316
    "release the mouse pointer"
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   317
162
claus
parents: 157
diff changeset
   318
    device activePointerGrab == self ifTrue:[
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   319
        device ungrabPointer.
162
claus
parents: 157
diff changeset
   320
    ].
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   321
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   322
    "Modified: 12.5.1996 / 22:04:09 / cg"
2387
cfd8fa32799b also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   323
!
cfd8fa32799b also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   324
cfd8fa32799b also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   325
releasePointerAndKeyboard 
cfd8fa32799b also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   326
    "release the pointer and keyboard"
cfd8fa32799b also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   327
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   328
    self ungrabPointer.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   329
    self ungrabKeyboard.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   330
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   331
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   332
!PopUpView methodsFor:'private'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   333
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   334
regainControl
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   335
    "get exclusive access to pointer and keyboard"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   336
648
a913a55fa11b checkin from browser
Stefan Vogel <sv@exept.de>
parents: 643
diff changeset
   337
    shown ifTrue:[
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   338
        self grabPointer.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   339
        self grabKeyboard.
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   340
        self sensor flushMotionEventsFor:nil; flushKeyboardFor:nil.
648
a913a55fa11b checkin from browser
Stefan Vogel <sv@exept.de>
parents: 643
diff changeset
   341
    ].
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   342
648
a913a55fa11b checkin from browser
Stefan Vogel <sv@exept.de>
parents: 643
diff changeset
   343
    "Modified: 6.5.1996 / 22:33:39 / stefan"
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   344
    "Modified: 12.5.1996 / 22:04:42 / cg"
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   345
! !
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   346
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   347
!PopUpView methodsFor:'queries'!
89
ea2bf46eb669 *** empty log message ***
claus
parents: 81
diff changeset
   348
3154
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   349
grabWhenMapped
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   350
    "return true, if I should perform a grab when mapped. 
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   351
     Redefinable for subclasses."
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   352
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   353
    ^ true
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   354
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   355
    "Modified: 12.5.1996 / 21:57:51 / cg"
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   356
!
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   357
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   358
isPopUpView
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   359
    "return true, since I want to come up without decoration 
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   360
     and popUp to top immediately."
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   361
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   362
    ^ true
677
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   363
069dd8cd00d1 removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
   364
    "Modified: 12.5.1996 / 21:57:51 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   365
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   366
3882
6b3ca3db5d31 method category rename
Claus Gittinger <cg@exept.de>
parents: 3588
diff changeset
   367
!PopUpView methodsFor:'realize & unrealize'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   368
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   369
hide
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   370
    "hide the view, leave its modal event loop"
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   371
2579
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   372
    |masterGroup|
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   373
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   374
    windowGroup notNil ifTrue:[
2579
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   375
        masterGroup := windowGroup previousGroup.
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   376
        windowGroup removeView:self.
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   377
        windowGroup := nil.
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   378
    ].
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   379
    self unmap.
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   380
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   381
    "/ allow for redraw events to arrive
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   382
    "/ (actually, only req'd for win32 systems,
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   383
    "/  but that short delay does not hurt on others)
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   384
2579
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   385
"/    Delay waitForSeconds:0.05.
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   386
    masterGroup notNil ifTrue:[
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   387
        "
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   388
         this is a kludge for IRIS and others which do not provide backingstore:
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   389
         when we hide a modalbox (such as a searchbox) which covered
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   390
         a scrollbar, the scrollbars bitblt-method will copy from the
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   391
         not-yet redrawn area - effectively clearing the scroller.
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   392
         We need a short delay here, since at this time, the expose event has
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   393
         not yet arrived.
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   394
        "
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   395
        Delay waitForSeconds:0.05.
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   396
        masterGroup processExposeEvents   
774e6fb33dde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
   397
    ].
2574
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   398
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   399
    "Modified: / 3.5.1996 / 23:48:22 / stefan"
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   400
    "Modified: / 12.9.1998 / 14:58:33 / cg"
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   401
!
ab434bf2439e category change;
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
   402
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   403
mapped
162
claus
parents: 157
diff changeset
   404
    "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
   405
     If the grab fails, try again and unmap myself if that fails too."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   406
3952
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   407
    |count grabbed|
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   408
523
2de6065d37c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 506
diff changeset
   409
    mapTime := Time millisecondClockValue.
2de6065d37c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 506
diff changeset
   410
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   411
    super mapped.
162
claus
parents: 157
diff changeset
   412
157
claus
parents: 151
diff changeset
   413
    (haveControl 
162
claus
parents: 157
diff changeset
   414
    and:[true "/ exclusivePointer
3154
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   415
    and:[realized
2c9c64a64c20 some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents: 3088
diff changeset
   416
    and:[self grabWhenMapped]]]) ifTrue:[
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   417
        (self grabPointer) ifFalse:[
3952
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   418
            count := 0.
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   419
            [
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   420
                "wait a little bit and try again"
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   421
                Delay waitForSeconds:0.1.
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   422
                count := count + 1.
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   423
            ] doUntil:[ (grabbed := self grabPointer) or:[count > 4]].
b96c9aaa2c63 retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents: 3887
diff changeset
   424
            grabbed ifFalse:[
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   425
                "give up"
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   426
                'PopUpView [warning]: could not grab pointer' errorPrintCR.
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   427
                self unmap
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   428
            ]
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   429
        ].
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   430
        exclusivePointer ifFalse:[
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   431
            self releasePointer
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   432
        ].
3088
79259d26e59e grabbing changed to restore grab at hiding time,
ca
parents: 2876
diff changeset
   433
        self grabKeyboard.
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   434
        self getKeyboardFocus
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   435
    ]
493
736384460102 grab keyboard when mapped
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   436
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   437
    "Modified: 3.5.1996 / 23:48:37 / stefan"
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   438
    "Modified: 10.1.1997 / 18:00:31 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   439
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   440
48194c26a46c Initial revision
claus
parents:
diff changeset
   441
realize
48194c26a46c Initial revision
claus
parents:
diff changeset
   442
    shadowView notNil ifTrue:[shadowView realize].
48194c26a46c Initial revision
claus
parents:
diff changeset
   443
    self raise.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   444
    haveControl := true.
3219
9197f5be48d1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3179
diff changeset
   445
9197f5be48d1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3179
diff changeset
   446
"/    device zoom:(device pointerPosition extent:1@1)to:(self bounds) duration:10.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   447
    super realize.
48194c26a46c Initial revision
claus
parents:
diff changeset
   448
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   449
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   450
unmap
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   451
    haveControl := false.
1732
e6b92cfc32a7 flush motion and keyboard events
ca
parents: 1263
diff changeset
   452
2387
cfd8fa32799b also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   453
    self releasePointerAndKeyboard.
643
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   454
    super unmap.
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   455
    shadowView notNil ifTrue:[shadowView unmap].
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   456
d58256573e17 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   457
    "Modified: 3.5.1996 / 23:46:06 / stefan"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   458
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   459
1174
6889dc61d701 newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   460
!PopUpView class methodsFor:'documentation'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   461
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   462
version
4738
e2224a3d9174 accessing haveControl from outside
ca
parents: 4372
diff changeset
   463
    ^ '$Header: /cvs/stx/stx/libview/PopUpView.st,v 1.57 2007-03-12 08:24:24 ca Exp $'
157
claus
parents: 151
diff changeset
   464
! !