ModalBox.st
author Claus Gittinger <cg@exept.de>
Mon, 08 Dec 1997 19:20:24 +0100
changeset 1970 5b602928ee03
parent 1931 27aa9e5b15dd
child 2193 8ef9d174d111
permissions -rw-r--r--
experimental: no longer grab the keyboardFocus in a dialogs pointerEnter method.
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) 1990 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 66
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
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
StandardSystemView subclass:#ModalBox
1221
7ae7d7a901de added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
    14
	instanceVariableNames:'shadowView exclusiveKeyboard escapeIsCancel'
1865
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    15
	classVariableNames:'UseTransientViews DefaultExtent'
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    16
	poolDictionaries:''
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
    17
	category:'Views-Basic'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    18
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    19
1232
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
    20
!ModalBox class methodsFor:'documentation'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    21
46
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    22
copyright
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    23
"
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    24
 COPYRIGHT (c) 1990 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
    25
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    26
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    27
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    28
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    30
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    31
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    32
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    33
"
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    34
!
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    35
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    36
documentation
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    37
"
46
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
    38
    this class implements modal boxes; ModalBoxes are different from
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    39
    others, in that they take control over the current topview, until 
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    40
    all processing is done (i.e. the currently active topview and all of
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
    41
    its subviews will not handle user events while the box is active).
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    42
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    43
    ModalBoxes are either implemented as transient windows
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    44
    (if UseTransientViews := true) or as override redirect views.
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    45
    Some window managers have problems with either; so you may want to
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    46
    change the default setting from your display.rc file.
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 596
diff changeset
    47
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 596
diff changeset
    48
    [see also:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 596
diff changeset
    49
        StandardSystemView 
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 596
diff changeset
    50
        DialogBox
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 596
diff changeset
    51
        ( introduction to view programming :html: programming/viewintro.html )
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 596
diff changeset
    52
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 596
diff changeset
    53
    [author:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 596
diff changeset
    54
        Claus Gittinger
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    55
"
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    56
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    57
1232
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
    58
!ModalBox class methodsFor:'initialization'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    59
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
    60
initialize
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    61
    UseTransientViews := true.
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
    62
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
    63
    "
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
    64
     UseTransientViews := false
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
    65
    "
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
    66
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
    67
    "Modified: 24.7.1997 / 15:18:59 / cg"
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    68
! !
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    69
1232
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
    70
!ModalBox class methodsFor:'defaults'!
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    71
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    72
defaultExtent
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    73
    "this defines the defaultExtent for instances of me;
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    74
     the value returned here is usually not correct for concrete subclasses,
587
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    75
     so you better redefine this method.
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    76
     The value returned here is usually ignored, and
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    77
     the value from preferredExtent taken instead."
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    78
1865
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    79
    DefaultExtent notNil ifTrue:[
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    80
        ^ DefaultExtent
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    81
    ].
922
52c1d0d22c0e dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
    82
    ^ (Screen current pixelPerMillimeter * (60 @ 30)) rounded
587
c0fb8bc13596 commentary
Claus Gittinger <cg@exept.de>
parents: 514
diff changeset
    83
1865
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    84
    "Modified: 15.8.1997 / 01:45:52 / cg"
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    85
!
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    86
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    87
defaultLabel
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    88
    "return the boxes default window title."
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    89
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    90
    ^ 'PopUp'
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    91
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    92
    "Created: 23.4.1996 / 17:14:21 / cg"
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    93
!
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
    94
1865
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    95
updateStyleCache
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    96
    "extract values from the styleSheet and cache them in class variables"
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    97
1931
27aa9e5b15dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1915
diff changeset
    98
    <resource: #style (#'modalBox.defaultExtent')>
1865
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
    99
1931
27aa9e5b15dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1915
diff changeset
   100
    DefaultExtent := StyleSheet at:'modalBox.defaultExtent' default:nil.
1865
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   101
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   102
    "
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   103
     self updateStyleCache
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   104
    "
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   105
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   106
    "Modified: 31.8.1995 / 03:01:14 / claus"
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   107
    "Created: 15.8.1997 / 01:40:53 / cg"
1931
27aa9e5b15dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1915
diff changeset
   108
    "Modified: 20.10.1997 / 15:07:37 / cg"
1865
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   109
!
43c2eaba229d allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents: 1826
diff changeset
   110
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   111
useTransientViews:aBoolean 
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   112
    "change the way modalBoxes are created on the Display.
1397
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   113
     If the argument is true, transient views are used; 
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   114
     otherwise override redirect views are used. 
959
a47e44337899 modalBoxes from non-windowGroup processes (background process)
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
   115
     Depending on your windowmanager, either one may have problems. 
a47e44337899 modalBoxes from non-windowGroup processes (background process)
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
   116
     You may want to change the setting
1397
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   117
     from your display.rc or d_xxx.rc file.
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   118
     This is now obsolete - transient views work and are always used."
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   119
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   120
    UseTransientViews := aBoolean.
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   121
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   122
    "
144
claus
parents: 141
diff changeset
   123
     ModalBox useTransientViews:false
claus
parents: 141
diff changeset
   124
     ModalBox useTransientViews:true 
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   125
    "
959
a47e44337899 modalBoxes from non-windowGroup processes (background process)
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
   126
1397
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   127
    "Modified: 28.2.1997 / 22:27:46 / cg"
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   128
!
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   129
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   130
usingTransientViews 
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   131
    "return true, if transient views are used 
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   132
     for modalBoxes. This is somewhat oboslete."
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   133
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   134
    ^ UseTransientViews
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   135
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   136
    "
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   137
     ModalBox usingTransientViews
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   138
    "
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   139
959
a47e44337899 modalBoxes from non-windowGroup processes (background process)
Claus Gittinger <cg@exept.de>
parents: 953
diff changeset
   140
    "Modified: 18.7.1996 / 19:18:46 / cg"
1397
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   141
    "Created: 28.2.1997 / 22:27:12 / cg"
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   142
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   143
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   144
!ModalBox methodsFor:'accessing'!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   145
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   146
exclusiveKeyboard:aBoolean
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   147
    "set/clear exclusive locking of the keyboard;
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   148
     If set, the box will take total control over the
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   149
     keyboard, not allowing input to other views/boxes
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   150
     while active.
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   151
     DANGER: 
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   152
        only use this for very very urgent boxes, since
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   153
        no interaction with ANY view on the screen is possible then."
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   154
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   155
    exclusiveKeyboard := aBoolean
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   156
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   157
    "Modified: 12.5.1996 / 21:55:09 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   158
! !
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   159
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   160
!ModalBox methodsFor:'event handling'!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   161
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   162
coveredBy:aView
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   163
    "the receiver has been covered by another view.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   164
     If the other view is a non-modal one, raise"
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   165
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   166
    |mainGroup topViews|
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   167
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   168
    "
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   169
     if the other view is not a modal- (or shadow-, or popup-) -view,
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   170
     bring myself to the front again.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   171
    "
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   172
    aView isPopUpView ifFalse:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   173
	"
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   174
	 if I have a mainGroup,
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   175
	 only raise if its one of my maingroup-views
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   176
	"
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   177
	windowGroup notNil ifTrue:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   178
	    mainGroup := windowGroup mainGroup.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   179
	    mainGroup notNil ifTrue:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   180
		topViews := mainGroup topViews.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   181
		topViews notNil ifTrue:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   182
		    topViews do:[:aTopView |
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   183
			aView == aTopView ifTrue:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   184
			    self raise.     
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   185
			    ^ self
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   186
			]
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   187
		    ]
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   188
		].
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   189
		^ self
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   190
	    ]
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   191
	].
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   192
	self raise
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   193
    ]
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   194
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   195
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   196
terminate
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   197
    "this is the close from a windowmanager
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   198
     (only if UseTransientViews == true)"
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   199
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   200
    "
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   201
     if I am a dialog, make the receiver invisible and leave control.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   202
     But, do not destroy the underlying view resources, to allow for
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   203
     another open/show to occur later.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   204
     if I have been opened modeLess, perform the normal destroy operation.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   205
    "
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   206
    (windowGroup isNil or:[windowGroup isModal]) ifTrue:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   207
	self hide
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   208
    ] ifFalse:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   209
	super terminate
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   210
    ]
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   211
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   212
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   213
visibilityChange:how
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   214
    "raise when covered - this should not be needed, since we
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   215
     have been created as override-redirect window (which should
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   216
     stay on top - but some window managers (fvwm) seem to ignore
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   217
     this ..."
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   218
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   219
    "the code below is not good, since it will lead to
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   220
     oscillating raises when two modalBoxes are going to cover
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   221
     each other - see coveredBy:-handling ..."
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   222
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   223
"/    how ~~ #fullyVisible ifTrue:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   224
"/        self raise
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   225
"/    ]
1970
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   226
!
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   227
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   228
xxxpointerEnter:state x:x y:y
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   229
    "mhmh: this seems to be a special X kludge;
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   230
     without the following, we will not regain input focus after
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   231
     pointer is reentered."
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   232
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   233
"/
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   234
"/ experimental: disabled; bad behavior with some windowManagers,
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   235
"/ if enter/leave events are processed late.
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   236
"/
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   237
    self getKeyboardFocus.
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   238
    super pointerEnter:state x:x y:y
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   239
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   240
    "Created: / 8.12.1997 / 19:18:45 / cg"
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   241
    "Modified: / 8.12.1997 / 19:19:39 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   242
! !
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   243
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   244
!ModalBox methodsFor:'initialize / release'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   245
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   246
addToCurrentProject
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   247
    "ignored here"
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   248
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   249
    ^ self
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   250
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   251
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   252
create
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   253
    super create.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   254
    shadowView notNil ifTrue:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   255
	self saveUnder:true
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   256
    ]
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   257
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   258
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   259
destroy
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   260
    "destroy the view.
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   261
     redefined to also destroy my shadow, if there is one,
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   262
     and to release the global keyboard grab (if there is one)"
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   263
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   264
    shadowView notNil ifTrue:[
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   265
        shadowView destroy.
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   266
        shadowView := nil
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   267
    ].
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   268
    exclusiveKeyboard ifTrue:[
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   269
        device ungrabKeyboard
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   270
    ].
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   271
    super destroy.
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   272
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   273
    "Modified: 12.5.1996 / 21:56:10 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   274
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   275
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   276
initEvents
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   277
    "initialize event handling; redefined to enable visibility changes"
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   278
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   279
    super initEvents.
1221
7ae7d7a901de added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   280
    self enableEvent:#visibilityChange.
7ae7d7a901de added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   281
    escapeIsCancel := true.
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   282
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   283
    "Modified: 12.5.1996 / 21:56:31 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   284
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   285
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   286
initStyle
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   287
    "setup viewStyle specifics"
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   288
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   289
    |style|
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   290
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   291
    super initStyle.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   292
    style := styleSheet name.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   293
    ((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   294
        borderWidth := 0.
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   295
        UseTransientViews ifFalse:[
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   296
            self level:2
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   297
        ]
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   298
    ]
1263
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   299
f5af4e2abd71 commentary
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   300
    "Modified: 22.1.1997 / 11:57:35 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   301
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   302
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   303
initialize
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   304
    |form resizeButton moveButton|
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   305
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   306
    super initialize.
48194c26a46c Initial revision
claus
parents:
diff changeset
   307
141
claus
parents: 138
diff changeset
   308
    type := #dialog. 
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   309
    exclusiveKeyboard := false.
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   310
"/    label := ' '.
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   311
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   312
"/    label := 'Popup'.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   313
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   314
    UseTransientViews ifFalse:[
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   315
        PopUpView shadows ifTrue:[
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   316
            shadowView := (ShadowView onDevice:device) for:self
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   317
        ].
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   318
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   319
        form := Form width:8 height:8 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   320
                     fromArray:#[2r00000000
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   321
                                 2r00000000 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   322
                                 2r00000000 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   323
                                 2r00000001
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   324
                                 2r00000011
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   325
                                 2r00000111 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   326
                                 2r00001111
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   327
                                 2r00011111 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   328
                                ]
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   329
                     on:device.
1826
eccabd80bbc0 fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
   330
        resizeButton := Button label:form in:self.
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   331
        resizeButton origin:1.0 @ 1.0 corner:1.0@1.0.
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   332
        resizeButton activeForegroundColor:(resizeButton foregroundColor).
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   333
        resizeButton activeBackgroundColor:(resizeButton backgroundColor).
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   334
        resizeButton enteredBackgroundColor:(resizeButton backgroundColor).
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   335
        resizeButton leftInset:-8; topInset:-8.
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   336
        resizeButton releaseAction:[].
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   337
        resizeButton pressAction:[resizeButton turnOff; redraw. self doResize].
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   338
        resizeButton borderWidth:0.
752
d9ee7d398ad6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 675
diff changeset
   339
        resizeButton activeLevel:0; passiveLevel:0.
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   340
        resizeButton cursor:(Cursor corner).
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   341
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   342
        form := Form width:8 height:8 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   343
                     fromArray:#[2r11111000
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   344
                                 2r11110000 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   345
                                 2r11100000 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   346
                                 2r11000000
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   347
                                 2r10000000
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   348
                                 2r00000000 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   349
                                 2r00000000
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   350
                                 2r00000000 
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   351
                                ]
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   352
                     on:device.
1826
eccabd80bbc0 fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
   353
        moveButton := Button label:form in:self.
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   354
        moveButton origin:0.0 @ 0.0 corner:0.0@0.0.
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   355
        moveButton activeForegroundColor:(moveButton foregroundColor).
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   356
        moveButton activeBackgroundColor:(moveButton backgroundColor).
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   357
        moveButton enteredBackgroundColor:(moveButton backgroundColor).
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   358
        moveButton rightInset:-8; bottomInset:-8.
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   359
        moveButton releaseAction:[].
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   360
        moveButton pressAction:[moveButton turnOff; redraw. self doMove].
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   361
        moveButton borderWidth:0.
752
d9ee7d398ad6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 675
diff changeset
   362
        moveButton activeLevel:0; passiveLevel:0.
596
e196ea43d242 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   363
        moveButton cursor:(Cursor origin)
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   364
    ].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   365
1826
eccabd80bbc0 fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
   366
    "Modified: 24.7.1997 / 16:08:11 / cg"
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   367
!
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   368
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   369
isPopUpView
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   370
    "return true, if I want to come up without decoration
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   371
     and popUp to top immediately."
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   372
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   373
    ^ UseTransientViews not
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   374
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   375
    "Modified: 24.7.1997 / 15:20:14 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   376
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   377
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   378
reinitialize
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   379
   super reinitialize.
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   380
   self unmap.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   381
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   382
    "Modified: 3.5.1996 / 23:48:04 / stefan"
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   383
!
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   384
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   385
resize
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   386
    "resize myself to make everything visible"
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   387
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   388
    |newExtent|
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   389
151
claus
parents: 144
diff changeset
   390
    newExtent := self preferredExtent.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   391
    newExtent = self extent ifTrue:[^ self].
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   392
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   393
    (shown and:[shadowView notNil]) ifTrue:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   394
        shadowView unmap.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   395
        self extent:newExtent.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   396
        shadowView realize.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   397
        self raise
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   398
    ] ifFalse:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   399
        self extent:newExtent.
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   400
    ].
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   401
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   402
    "Modified: 3.5.1996 / 23:48:12 / stefan"
180
claus
parents: 157
diff changeset
   403
!
claus
parents: 157
diff changeset
   404
claus
parents: 157
diff changeset
   405
resizeUnderPointer
claus
parents: 157
diff changeset
   406
    "resize myself to make everything visible, AND possibly change the origin
claus
parents: 157
diff changeset
   407
     to have the mouse pointer stay within my bounds.
claus
parents: 157
diff changeset
   408
     This is used for self-resizing enterBoxes, to avoid moving
claus
parents: 157
diff changeset
   409
     the box away from the cursor."
claus
parents: 157
diff changeset
   410
claus
parents: 157
diff changeset
   411
    |newExtent newLeft delta|
claus
parents: 157
diff changeset
   412
claus
parents: 157
diff changeset
   413
    newExtent := self preferredExtent.
claus
parents: 157
diff changeset
   414
    newExtent = self extent ifTrue:[^ self].
claus
parents: 157
diff changeset
   415
claus
parents: 157
diff changeset
   416
    shown ifTrue:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   417
        delta := width - newExtent x.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   418
        newLeft := left + delta.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   419
        (((newLeft @ top) extent:newExtent) 
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   420
            containsPoint:device pointerPosition)
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   421
        ifFalse:[newLeft := left].
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   422
        newLeft < 0 ifTrue:[newLeft := 0].
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   423
        newLeft + newExtent x > device width ifTrue:[
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   424
            newLeft := device width - newExtent x
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   425
        ].
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   426
        shadowView notNil ifTrue:[
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   427
            shadowView unmap.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   428
        ].
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   429
        self origin:(newLeft @ top) extent:newExtent.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   430
        shadowView notNil ifTrue:[
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   431
            shadowView realize.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   432
            self raise.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   433
        ].
180
claus
parents: 157
diff changeset
   434
    ] ifFalse:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   435
        self extent:newExtent.
180
claus
parents: 157
diff changeset
   436
    ].
claus
parents: 157
diff changeset
   437
claus
parents: 157
diff changeset
   438
    "Modified: 6.9.1995 / 15:31:21 / claus"
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   439
    "Modified: 3.5.1996 / 23:48:17 / stefan"
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   440
! !
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   441
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   442
!ModalBox methodsFor:'move & resize'!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   443
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   444
doMove
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   445
    "the move button was pressed.
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   446
     This method is only used with non-transient views
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   447
     (UseTransientViews == false)."
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   448
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   449
    |r|
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   450
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   451
    r := device rectangleFromUser:(self origin corner:self corner) keepExtent:true.
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   452
    shadowView notNil ifTrue:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   453
        shadowView unmap
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   454
    ].
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   455
    self origin:r origin extent:(self extent).
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   456
    shadowView notNil ifTrue:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   457
        shadowView realize.
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   458
        self raise.
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   459
    ].
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   460
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   461
    "Modified: 3.5.1996 / 23:47:38 / stefan"
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   462
    "Modified: 24.7.1997 / 16:07:18 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   463
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   464
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   465
doResize
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   466
    "the resize button was pressed.
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   467
     This method is only used with non-transient views
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   468
     (UseTransientViews == false)."
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   469
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   470
    |r|
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   471
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   472
    r := device rectangleFromUser:(self origin corner:self corner).
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   473
    shadowView notNil ifTrue:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   474
        shadowView unmap
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   475
    ].
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   476
    self origin:r origin extent:(r extent max:(100@100)).
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   477
    shadowView notNil ifTrue:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   478
        shadowView realize.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   479
        self raise
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   480
    ].
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   481
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   482
    "Modified: 3.5.1996 / 23:47:47 / stefan"
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   483
    "Modified: 24.7.1997 / 15:18:46 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   484
! !
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   485
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   486
!ModalBox methodsFor:'queries'!
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   487
151
claus
parents: 144
diff changeset
   488
preferredExtent
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   489
    "return the extent required to make all components
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   490
     visible in myself. This should be redefined in
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   491
     subclasses."
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   492
965
c95ecf109867 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   493
    "/ If I have an explicit preferredExtent ..
c95ecf109867 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   494
761
34d17118452a care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 752
diff changeset
   495
    preferredExtent notNil ifTrue:[
34d17118452a care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 752
diff changeset
   496
        ^ preferredExtent
34d17118452a care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 752
diff changeset
   497
    ].
34d17118452a care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 752
diff changeset
   498
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   499
    ^ self class defaultExtent
761
34d17118452a care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 752
diff changeset
   500
965
c95ecf109867 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   501
    "Modified: 19.7.1996 / 20:45:07 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   502
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   503
1700
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   504
!ModalBox methodsFor:'queries - internal'!
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   505
1915
f86162de1a2f extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   506
windowLabelFor:labelString
f86162de1a2f extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   507
    "dialogs do not include the hostname in the window label"
f86162de1a2f extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   508
f86162de1a2f extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   509
    ^ labelString
f86162de1a2f extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   510
f86162de1a2f extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   511
    "Created: 22.9.1997 / 10:14:02 / cg"
f86162de1a2f extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   512
!
f86162de1a2f extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents: 1865
diff changeset
   513
1700
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   514
windowStyle
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   515
    "return a symbol describing my style 
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   516
     (may be used internally by the device as a decoration hint)"
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   517
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   518
    UseTransientViews ifTrue:[
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   519
        ^ #dialog
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   520
    ].
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   521
    ^ #popUp
1700
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   522
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   523
    "Created: 2.5.1997 / 14:34:17 / cg"
1825
c6f133f38dff fixed non-transient mode
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
   524
    "Modified: 24.7.1997 / 15:22:39 / cg"
1700
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   525
! !
ea1abaa7901d preps for native window support
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   526
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   527
!ModalBox methodsFor:'show / hide'!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   528
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   529
autoHideAfter:seconds with:anAction
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   530
    "install a background process, which hides the box
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   531
     after some time. Also, if non-nil, anAction will be
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   532
     evaluated then. The action will not be evaluated if
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   533
     the box is closed by the user pressing a button."
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   534
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   535
    "the implementation is simple: just fork of a process
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   536
     to hide me."
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   537
    [
371
cc32d8f8bc8d use new Delay-wait
Claus Gittinger <cg@exept.de>
parents: 300
diff changeset
   538
	Delay waitForSeconds:seconds.
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   539
	self shown ifTrue:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   540
	    self hide. 
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   541
	    anAction notNil ifTrue:[anAction value]
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   542
	]
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   543
    ] forkAt:4.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   544
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   545
    "
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   546
     |b|
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   547
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   548
     b := InfoBox title:'hello there'.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   549
     b autoHideAfter:5 with:[].
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   550
     b showAtCenter.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   551
    "
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   552
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   553
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   554
fixSize
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   555
    "this is sent right before the modalBox is made visible;
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   556
     If the size is not fixed, adjust my size."
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   557
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   558
    sizeFixed == true ifFalse:[
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   559
	self resize.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   560
    ].
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   561
    super fixSize.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   562
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   563
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   564
hide
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   565
    "make the receiver invisible and leave control"
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   566
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   567
    |p|
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   568
1314
99e3347abb6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   569
    realized ifFalse:[^ self].
99e3347abb6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   570
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   571
    shadowView notNil ifTrue:[shadowView unmap].
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   572
    windowGroup notNil ifTrue:[windowGroup focusView:nil].
675
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   573
    exclusiveKeyboard ifTrue:[
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   574
        device ungrabKeyboard
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   575
    ].
fc15e8886089 removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents: 644
diff changeset
   576
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   577
    self unmap.
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   578
    device flush. 
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   579
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   580
    (windowGroup notNil and:[(p := windowGroup previousGroup) notNil]) ifTrue:[
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   581
        "
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   582
         this is a kludge for IRIS which does not provide backingstore:
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   583
         when we hide a modalbox (such as a searchbox) which covered
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   584
         a scrollbar, the scrollbars bitblt-method will copy from the
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   585
         not-yet redrawn area - effectively clearing the scroller.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   586
         We need a short delay here, since at this time, the expose event has
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   587
         not yet arrived.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   588
        "
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   589
        Delay waitForSeconds:0.1.
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   590
        p processExposeEvents   
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   591
    ].
644
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   592
85ce9499c925 Rename unrealize-->unmap.
Stefan Vogel <sv@exept.de>
parents: 616
diff changeset
   593
    "Modified: 3.5.1996 / 23:47:57 / stefan"
1314
99e3347abb6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
   594
    "Modified: 8.2.1997 / 17:41:16 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   595
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   596
393
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   597
hideRequest
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   598
    "hide request from windowGroup (i.e. via Escape key).
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   599
     Can be redefined in subclasses which dont like this"
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   600
1221
7ae7d7a901de added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   601
    escapeIsCancel ifTrue:[
7ae7d7a901de added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   602
        self hide
7ae7d7a901de added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
   603
    ]
393
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   604
!
3504a0adbb2d use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   605
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   606
mapped
48194c26a46c Initial revision
claus
parents:
diff changeset
   607
    "wait till visible for grabbing"
48194c26a46c Initial revision
claus
parents:
diff changeset
   608
48194c26a46c Initial revision
claus
parents:
diff changeset
   609
    super mapped.
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   610
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   611
    "take it away from any popup menu possibly still active"
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   612
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   613
    device ungrabKeyboard.
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   614
    device ungrabPointer.
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   615
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   616
    "
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   617
     if I am a super-modal box, take the keyboard
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   618
    "
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   619
    exclusiveKeyboard ifTrue:[
81
4ba554473294 *** empty log message ***
claus
parents: 72
diff changeset
   620
	device grabKeyboardInView:self.
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   621
    ].
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   622
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   623
"/    UseTransientViews ifFalse:[
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   624
	"
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   625
	 get the focus
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   626
	"
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   627
	self getKeyboardFocus.
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   628
	self enableEnterLeaveEvents
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   629
"/    ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   630
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   631
46
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
   632
open
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   633
    "default for modalboxes is to come up modal at the pointer position"
46
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
   634
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   635
    ^ self showAtPointer
46
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
   636
!
7b331e9012fd *** empty log message ***
claus
parents: 21
diff changeset
   637
953
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   638
openAt:aPoint
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   639
    "default for modalboxes is to come up modal at the pointer position"
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   640
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   641
    ^ self openModalAt:aPoint
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   642
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   643
    "Created: 17.7.1996 / 14:50:44 / cg"
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   644
!
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   645
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   646
openAtCenter
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   647
    "default for modalboxes is to come up modal at the pointer position"
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   648
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   649
    ^ self openModalAtCenter
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   650
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   651
    "Created: 17.7.1996 / 14:50:35 / cg"
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   652
!
226d5ccde5fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   653
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   654
openModal:aBlock
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   655
    "open the box modal;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   656
     In addition to the basic (inherited) modalloop, change
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   657
     the current active windowgroups cursors to the busy-stop cursor, show
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   658
     a shadow, and raise the box."
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   659
1397
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   660
    shadowView notNil ifTrue:[shadowView realize].
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   661
    super openModal:aBlock.
300
6a63af1fec3e passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   662
6a63af1fec3e passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
   663
    "Created: 10.12.1995 / 14:07:01 / cg"
1397
932c517ad29c moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 1314
diff changeset
   664
    "Modified: 28.2.1997 / 22:32:49 / cg"
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   665
!
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   666
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   667
positionOffset
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   668
    "return the delta, by which the box should be
1232
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   669
     displaced from the mouse pointer.
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   670
     Here, the boxes center is returned as a default.
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   671
     Usually redefined in subclasses to have the most convenient
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   672
     ok-button appear under the pointer."
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   673
1232
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   674
    ^ self extent // 2
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   675
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   676
    "Modified: 16.1.1997 / 20:42:07 / cg"
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   677
!
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   678
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   679
show
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   680
    "make myself visible (at the last or default position) and take control.
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   681
     If that position is out of the screen area, moves the receiver to make
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   682
     it fully visible."
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   683
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   684
    self fixSize.
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   685
    self makeFullyVisible.
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   686
    self openModal
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   687
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   688
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   689
     |b|
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   690
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   691
     b := InfoBox title:'hello'.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   692
     b show.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   693
    "
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   694
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   695
    "Modified: 7.3.1996 / 17:57:49 / cg"
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   696
!
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   697
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   698
showAt:aPoint
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   699
    "make myself visible at aPoint.
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   700
     Fix position to make box fully visible"
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   701
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   702
    self fixSize.
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   703
    self fixPosition:aPoint.
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   704
    self openModal
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   705
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   706
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   707
     |b|
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   708
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   709
     b := InfoBox title:'hello'.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   710
     b showAt:(0 @ 0).
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   711
     b showAt:(400 @ 400).
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   712
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   713
!
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   714
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   715
showAt:aPoint center:center
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   716
    "make myself visible at aPoint. center specifies
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   717
     if the view should show up centered around aPoint."
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   718
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   719
    self showAt:aPoint centerX:center centerY:center
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   720
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   721
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   722
     |b|
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   723
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   724
     b := InfoBox title:'hello'.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   725
     b showAt:(100 @ 100) center:true.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   726
     b showAt:(100 @ 100) center:false.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   727
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   728
!
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   729
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   730
showAt:aPoint centerX:centerX centerY:centerY
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   731
    "make myself visible at aPoint. centerX/centerY specify
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   732
     if the view should show up centered around aPoint.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   733
     Fix position to make box fully visible"
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   734
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   735
    |dx dy|
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   736
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   737
    self fixSize.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   738
    centerX ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   739
	dx := self width // 2.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   740
    ] ifFalse:[
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   741
	dx := 0
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   742
    ].
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   743
    centerY ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   744
	dy := self height // 2.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   745
    ] ifFalse:[
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   746
	dy := 0
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   747
    ].
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   748
    self origin:(aPoint - (dx @ dy)).
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   749
    self makeFullyVisible.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   750
    self openModal
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   751
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   752
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   753
     |b|
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   754
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   755
     b := InfoBox title:'hello'.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   756
     b showAt:(100 @ 100).
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   757
     b showAt:(100 @ 100) centerX:true centerY:false.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   758
    "
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   759
!
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   760
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   761
showAtCenter
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   762
    "make myself visible at the screen center."
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   763
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   764
    self showAt:(device center) center:true
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   765
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   766
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   767
     |b|
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   768
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   769
     b := InfoBox title:'hello'.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   770
     b showAtCenter.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   771
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   772
!
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   773
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   774
showAtPointer
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   775
    "make myself visible at mouse pointer shifted to have
66
398cf6bfb241 *** empty log message ***
claus
parents: 59
diff changeset
   776
     convenient button under cursor. self positionOffset should
398cf6bfb241 *** empty log message ***
claus
parents: 59
diff changeset
   777
     return that offset (usually redefined, since we dont know here,
398cf6bfb241 *** empty log message ***
claus
parents: 59
diff changeset
   778
     which button should be under cursor)."
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   779
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   780
    self fixSize.
66
398cf6bfb241 *** empty log message ***
claus
parents: 59
diff changeset
   781
    self fixPosition:(device pointerPosition - self positionOffset).
398cf6bfb241 *** empty log message ***
claus
parents: 59
diff changeset
   782
    self openModal
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   783
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   784
    "/ cannot use:
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   785
    "/    self showAt:(device pointerPosition - self positionOffset).
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   786
    "/ because the resizing must be done before the
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   787
    "/ positionOffset is grabbed (it may change due to the resize)
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   788
72
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   789
    "
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   790
     |b|
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   791
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   792
     b := InfoBox title:'hello'.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   793
     b showAtPointer.
3e84121988c3 *** empty log message ***
claus
parents: 66
diff changeset
   794
    "
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   795
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   796
    "Modified: 7.3.1996 / 17:56:53 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   797
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   798
48194c26a46c Initial revision
claus
parents:
diff changeset
   799
showAtPointerNotCovering:aView
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   800
    "make myself visible at mouse pointer shifted to have
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   801
     convenient button under cursor.
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   802
     Fix position to make the box fully visible AND to make sure that
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   803
     aView is not covered."
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   804
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   805
    |pos newX|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   806
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   807
    pos := device pointerPosition - self positionOffset.
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   808
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   809
    ((Rectangle origin:pos extent:self extent) 
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   810
        intersects: (aView origin corner: aView corner)) 
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   811
    ifTrue:[
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   812
        "
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   813
         try to the right of the untouchable view
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   814
        "
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   815
        newX := (aView origin x + aView width).
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   816
        newX + width > device width ifTrue:[
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   817
            newX := device width - width
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   818
        ].
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   819
        pos x:newX.
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   820
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   821
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   822
        ((Rectangle origin:pos extent:self extent) 
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   823
            intersects: (aView origin corner: aView corner)) 
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   824
        ifTrue:[
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   825
            "
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   826
             try to the left of the untouchable view
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   827
            "
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   828
            newX := aView origin x - width.
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   829
            "
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   830
             should look for vertical possibilities too ...
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   831
            "
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   832
            pos x:newX.
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   833
        ]
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   834
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   835
    ].
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   836
    self showAt:pos
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   837
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   838
    "Modified: 7.3.1996 / 17:58:10 / cg"
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   839
!
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   840
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   841
showCenteredIn:aView
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   842
    "make myself visible at the center if aView."
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   843
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   844
    |top|
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   845
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   846
    top := aView topView.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   847
    top raise.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   848
    self showAt:(top center + (aView originRelativeTo:top)) center:true
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   849
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   850
    "
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   851
     |b|
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   852
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   853
     b := InfoBox title:'hello'.
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   854
     b showCenteredIn:Transcript.
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   855
    "
514
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   856
122e61a00a9d commentary
Claus Gittinger <cg@exept.de>
parents: 421
diff changeset
   857
    "Modified: 7.3.1996 / 17:58:53 / cg"
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   858
! !
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   859
1232
8106eef0084c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   860
!ModalBox class methodsFor:'documentation'!
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   861
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   862
version
1970
5b602928ee03 experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   863
    ^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.61 1997-12-08 18:20:24 cg Exp $'
270
f80e2a67de1e oops - checkin failed
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
   864
! !
296
655507429feb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 270
diff changeset
   865
ModalBox initialize!