SimpleDialog.st
author Claus Gittinger <cg@exept.de>
Thu, 23 Jan 2020 17:47:56 +0100
changeset 4431 732c2cd831b8
parent 4329 2ad714b6092f
child 4444 e9af6984f470
permissions -rw-r--r--
#OTHER by cg fix: if moving over an item within the same view, possibly suppress already forked and scheduled helptext (eg. when moving over close-icon in a tabList, moving within the same tab label, but away from the close icon, the tooltip was shown erronously in the previous version)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4288
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
     1
"{ Encoding: utf8 }"
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
     2
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
 COPYRIGHT (c) 1996 by eXept Software AG
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
              All Rights Reserved
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 This software is furnished under a license and may be used
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
 hereby transferred.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
1373
c04eea37d7db Fix typos in comment.
Stefan Vogel <sv@exept.de>
parents: 1346
diff changeset
    14
"{ Package: 'stx:libview2' }"
c04eea37d7db Fix typos in comment.
Stefan Vogel <sv@exept.de>
parents: 1346
diff changeset
    15
3445
c0ee6acd0090 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3422
diff changeset
    16
"{ NameSpace: Smalltalk }"
c0ee6acd0090 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3422
diff changeset
    17
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
ApplicationModel subclass:#SimpleDialog
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    19
	instanceVariableNames:'accept cancel close escapeIsCancel postBuildBlock postOpenBlock
2500
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
    20
		preBuildBlock closeAllowedChannel acceptedValue'
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	classVariableNames:''
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	poolDictionaries:''
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
	category:'Interface-Framework'
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
!SimpleDialog class methodsFor:'documentation'!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
copyright
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 COPYRIGHT (c) 1996 by eXept Software AG
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
              All Rights Reserved
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 This software is furnished under a license and may be used
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 only in accordance with the terms of that license and with the
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 be provided or otherwise made available to, or used by, any
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 other person.  No title to or ownership of the software is
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 hereby transferred.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
documentation
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
"
1589
2c0a2c71d775 Update docu
Stefan Vogel <sv@exept.de>
parents: 1551
diff changeset
    45
    Use SimpleDialog to specify Dialogs with a windowSpec built by the GUI Builder.
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    Notice: this class was implemented using protocol information
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    from alpha testers and PD code - it may not be complete or compatible to
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    the corresponding ST-80 class. If you encounter any incompatibilities,
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    please forward a note to the ST/X team.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
4329
2ad714b6092f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
    52
    Hints:
2ad714b6092f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
    53
        to provide a helpSpec, either add it to the builder's bindings;
2ad714b6092f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
    54
        (I will fetch help also via: 'self aspectFor:#helpSpec')
2ad714b6092f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
    55
        or define the dialog's masterApplication
2ad714b6092f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
    56
        (I will ask it for help texts then)
2ad714b6092f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
    57
2ad714b6092f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
    58
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    [author:]
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
        Claus Gittinger
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    [see also:]
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
        StandardSystemView
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
        WindowGroup DeviceWorkstation DialogBox
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
! !
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
906
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    68
!SimpleDialog class methodsFor:'queries'!
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    69
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    70
isVisualStartable
1427
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
    71
    "return true, if this application can be started via #open.
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
    72
     (to allow start of a change browser via double-click in the browser)"
906
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    73
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    74
    self == SimpleDialog ifTrue:[^false].
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    75
    ^super isVisualStartable
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    76
! !
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    77
2019
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    78
!SimpleDialog methodsFor:'DialogBox compatibility'!
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    79
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    80
destroy
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    81
    self closeRequest
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    82
!
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    83
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    84
hide
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    85
    self window hide
7ad3dee35894 protocol compatibility with DialogBox
Claus Gittinger <cg@exept.de>
parents: 1943
diff changeset
    86
! !
976
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    87
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    88
!SimpleDialog methodsFor:'accessing'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    89
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    90
accept
2500
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
    91
    "return the valueholder which gets set to true by the accept button.
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
    92
     Also, when this valueHolder gets a true stuffed into it, the dialog is closed.
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
    93
     This valueHolder is also set to true, if the acceptValue get a value stored into."
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    94
1640
5bd912083327 Initialize accept and cancel valueHolders
Stefan Vogel <sv@exept.de>
parents: 1598
diff changeset
    95
    accept isNil ifTrue:[
3445
c0ee6acd0090 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3422
diff changeset
    96
        accept := ValueHolder with:false.
1640
5bd912083327 Initialize accept and cancel valueHolders
Stefan Vogel <sv@exept.de>
parents: 1598
diff changeset
    97
    ].
5bd912083327 Initialize accept and cancel valueHolders
Stefan Vogel <sv@exept.de>
parents: 1598
diff changeset
    98
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    99
    ^ accept
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   100
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   101
    "Modified: / 20.5.1998 / 20:51:05 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   102
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   103
2500
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   104
acceptValue:something
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   105
    "save something in acceptedValue (to be passed back to the opened of this dialog),
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   106
     and set the accept-holder to true, which closes the dialog window.
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   107
     This is similar to a regular accept, but allows for a particular return-value to be passed
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   108
     back."
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   109
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   110
    acceptedValue := something.
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   111
    self closeAccept
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   112
!
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   113
1381
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   114
accepted
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   115
    "after the box has closed:
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   116
         return true if accepted, false if canceled"
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   117
3259
901d67809da0 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3208
diff changeset
   118
    ^ accept value
1381
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   119
!
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   120
2500
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   121
acceptedValue
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   122
    "an additional value which can be passed back to the one who opened a dialog"
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   123
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   124
    ^ acceptedValue
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   125
!
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   126
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   127
bindings
4329
2ad714b6092f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4288
diff changeset
   128
    "return my builder's bindings"
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   129
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   130
    ^ builder bindings
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   131
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   132
    "Modified: / 20.5.1998 / 20:51:15 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   133
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   134
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   135
cancel
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   136
    "return the valueholder which gets set by the cancel button.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   137
     Also, when this valueHolder gets a true stuffed into it, the
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   138
     dialog is closed."
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   139
1640
5bd912083327 Initialize accept and cancel valueHolders
Stefan Vogel <sv@exept.de>
parents: 1598
diff changeset
   140
    cancel isNil ifTrue:[
3445
c0ee6acd0090 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3422
diff changeset
   141
        cancel := ValueHolder with:false.
1640
5bd912083327 Initialize accept and cancel valueHolders
Stefan Vogel <sv@exept.de>
parents: 1598
diff changeset
   142
    ].
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   143
    ^ cancel
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   144
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   145
    "Modified: / 20.5.1998 / 20:51:02 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   146
!
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   147
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   148
escapeIsCancel
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   149
    "return the escapeIsCancel setting"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   150
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   151
    ^ escapeIsCancel
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   152
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   153
    "Modified: / 20.5.1998 / 20:52:44 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   154
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   155
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   156
escapeIsCancel:something
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   157
    "set/clear the escapeIsCancel option.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   158
     If on, an ESC-key will be treated like a cancel action."
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   159
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   160
    escapeIsCancel := something.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   161
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   162
    "Modified: / 20.5.1998 / 20:53:23 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   163
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   164
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   165
postBuildBlock:something
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   166
    "set postBuildBlock; if non-nil, this is evaluated after the build process"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   167
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   168
    postBuildBlock := something.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   169
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   170
    "Modified: / 20.5.1998 / 20:54:06 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   171
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   172
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   173
postOpenBlock:something
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   174
    "set the postBuildBlock; if non-nil, this is evaluated after the view is opened"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   175
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   176
    postOpenBlock := something.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   177
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   178
    "Modified: / 20.5.1998 / 20:54:23 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   179
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   180
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   181
preBuildBlock:something
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   182
    "set the preBuildBlock; if non-nil, this is evaluated before the view is constructed"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   183
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   184
    preBuildBlock := something.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   185
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   186
    "Modified: / 20.5.1998 / 20:54:41 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   187
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   188
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   189
source:anApplication
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   190
    "define the application which provides resources, aspects etc."
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   191
1067
5b39cef366fe also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   192
    builder source:anApplication.
5b39cef366fe also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   193
    masterApplication isNil ifTrue:[
1440
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   194
        anApplication ~~ self ifTrue:[
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   195
            masterApplication := anApplication
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   196
        ]
1067
5b39cef366fe also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   197
    ].
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   198
1067
5b39cef366fe also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   199
    "Modified: / 8.9.1998 / 01:46:06 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   200
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   201
4026
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   202
!SimpleDialog methodsFor:'accessing-channels'!
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   203
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   204
closeAllowedChannel
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   205
    "return the value-provider which controls if close is allowed.
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   206
     This is initialized to true."
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   207
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   208
    ^ closeAllowedChannel
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   209
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   210
    "Created: / 20.5.1998 / 21:52:32 / cg"
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   211
    "Modified: / 20.5.1998 / 21:53:18 / cg"
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   212
!
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   213
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   214
closeAllowedChannel:aValueHolderOrBlock
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   215
    "set a value-provider which controls if close is allowed."
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   216
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   217
    ^ closeAllowedChannel
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   218
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   219
    "Created: / 20.5.1998 / 21:52:53 / cg"
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   220
!
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   221
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   222
closeChannel
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   223
    "return the closeChannel; If a true is stuffed into this valueHolder,
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   224
     I will close myself."
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   225
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   226
    ^ close
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   227
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   228
    "Modified: / 20.5.1998 / 20:52:29 / cg"
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   229
! !
4bbb79ad0788 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
   230
1397
47ac1d3e1df1 category changes
Claus Gittinger <cg@exept.de>
parents: 1381
diff changeset
   231
!SimpleDialog methodsFor:'accessing-window'!
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   232
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   233
minWidth:nPixels
3303
24f64ee4560b class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   234
    |w|
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   235
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   236
    w := builder window width.
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   237
    builder window width:(w max:nPixels).
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   238
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   239
"/    box := builder window displayBox.
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   240
"/    box width: (box width max: nPixels).
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   241
"/    builder window displayBox: box
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   242
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   243
    "Modified: 3.3.1997 / 21:56:27 / cg"
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   244
! !
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   245
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   246
!SimpleDialog methodsFor:'events'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   247
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   248
closeAccept
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   249
    "accept was pressed. close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   250
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   251
    self requestForWindowClose ifTrue:[
1129
0d5fd9b819a9 autoAccept
Claus Gittinger <cg@exept.de>
parents: 1067
diff changeset
   252
        builder keyboardProcessor requestGlobalAutoAccept ifTrue:[
1943
0cff3328cb36 set acceptChannels valueHolder to true in closeAccept.
Claus Gittinger <cg@exept.de>
parents: 1881
diff changeset
   253
            accept value:true.
1129
0d5fd9b819a9 autoAccept
Claus Gittinger <cg@exept.de>
parents: 1067
diff changeset
   254
            self closeWindow
0d5fd9b819a9 autoAccept
Claus Gittinger <cg@exept.de>
parents: 1067
diff changeset
   255
        ]
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   256
    ]
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   257
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   258
    "Modified: 17.6.1997 / 14:10:23 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   259
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   260
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   261
closeCancel
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   262
    "cancel was pressed. close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   263
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   264
    self requestForWindowClose ifTrue:[
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   265
        self closeWindow
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   266
    ]
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   267
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   268
    "Modified: 17.6.1997 / 14:10:29 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   269
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   270
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   271
closeWindow
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   272
    "close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   273
1053
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   274
    |c|
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   275
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   276
    c := self closeChannel.
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   277
    c retractInterestsFor:self.
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   278
    c value:true.
3204
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   279
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   280
    "/ must destroy instead of hide - otherwise there is no #release to
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   281
    "/ the controller (onChangeSend-dependency problem)
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   282
    "/     builder window destroy. "/ hide
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   283
3204
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   284
    "/ changed to use the general closeDownViews 
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   285
    "/ (some want to redefine it and expect it to be called; it eventually also does a window destroy)
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   286
    self closeDownViews.
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   287
c606e3239538 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3180
diff changeset
   288
    "Modified (comment): / 31-07-2013 / 18:02:55 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   289
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   290
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   291
requestForWindowClose
1373
c04eea37d7db Fix typos in comment.
Stefan Vogel <sv@exept.de>
parents: 1346
diff changeset
   292
    "the dialog is about to be closed - this method is invoked and may
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   293
     return false to suppress the close.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   294
     Here the value of closeAllowedChannel is returned, which is
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   295
     set to true initially.
1373
c04eea37d7db Fix typos in comment.
Stefan Vogel <sv@exept.de>
parents: 1346
diff changeset
   296
     You may redefined this in a special dialog, and/or provide a boolean
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   297
     valueHolder or a boolean block via the #closeAllowedChannel: method."
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   298
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   299
    ^ closeAllowedChannel value
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   300
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   301
    "Modified: / 20.5.1998 / 21:52:25 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   302
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   303
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   304
!SimpleDialog methodsFor:'forced actions'!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   305
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   306
doAccept
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   307
    "force accept"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   308
1640
5bd912083327 Initialize accept and cancel valueHolders
Stefan Vogel <sv@exept.de>
parents: 1598
diff changeset
   309
    self accept value:true
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   310
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   311
    "Created: / 18.10.1997 / 05:18:09 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   312
    "Modified: / 20.5.1998 / 21:53:35 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   313
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   314
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   315
doCancel
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   316
    "force cancel"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   317
1640
5bd912083327 Initialize accept and cancel valueHolders
Stefan Vogel <sv@exept.de>
parents: 1598
diff changeset
   318
    self cancel value:true
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   319
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   320
    "Created: / 18.10.1997 / 05:18:22 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   321
    "Modified: / 20.5.1998 / 21:53:40 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   322
! !
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   323
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   324
!SimpleDialog methodsFor:'initialization'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   325
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   326
initialize
3867
9b2f1d48773a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3495
diff changeset
   327
    <modifier: #super> "must be called if redefined"
9b2f1d48773a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3495
diff changeset
   328
935
ccb6caad1da0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
   329
    accept := (ValueHolder with:false).
ccb6caad1da0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
   330
    close := (ValueHolder with:false).
ccb6caad1da0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
   331
    cancel := (ValueHolder with:false).
978
cd056a68d67a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   332
    self createBuilder.
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   333
    builder aspectAt:#accept put:accept.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   334
    builder aspectAt:#close put:close.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   335
    builder aspectAt:#cancel put:cancel.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   336
    escapeIsCancel := true.
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   337
    closeAllowedChannel := true
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   338
3867
9b2f1d48773a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3495
diff changeset
   339
    "Modified: / 08-02-2017 / 00:34:07 / cg"
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   340
!
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   341
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   342
initializeBuilderFor:aView 
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   343
    aView notNil ifTrue:[
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   344
        builder window:aView.
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   345
    ]
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   346
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   347
    "Created: 3.3.1997 / 16:23:04 / cg"
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   348
!
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   349
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   350
initializeWindowFor:aView
679
0f94c493751c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   351
    |v|
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   352
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   353
    (v := aView) isNil ifTrue:[
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   354
        v := ModalBox new.
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   355
    ].
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   356
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   357
    builder setupWindowFor:v.
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   358
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   359
    "Modified: 3.3.1997 / 20:39:46 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   360
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   361
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   362
!SimpleDialog methodsFor:'opening-dialogInterface'!
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   363
2877
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   364
allButOpenFor:anApplication interfaceSpec:aSpec withBindings:bindings
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   365
    "open the dialog for some appModel from a given spec;
3099
90ad6c9bb1bd class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 2922
diff changeset
   366
     the bindings argument may provide overwriting bindings for the dialog.
2877
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   367
     Return true if accepted, false if canceled"
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   368
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   369
    |app|
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   370
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   371
    builder isNil ifTrue:[ self createBuilder ].
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   372
2877
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   373
    builder addBindings:bindings.
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   374
    (app := anApplication) isNil ifTrue:[
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   375
        app := ApplicationModel new
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   376
    ].
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   377
    self source:app.
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   378
    ^ self allButOpenFrom:aSpec
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   379
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   380
    "Created: / 05-11-2010 / 11:27:26 / cg"
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   381
!
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   382
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   383
allButOpenFrom:aSpec
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   384
    "create my views but do not open the main window"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   385
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   386
    super allButOpenFrom:aSpec.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   387
    self preOpen
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   388
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   389
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   390
openFor:anApplication interface:aSelector
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   391
    "open the dialog for some appModel from a given spec;
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   392
     Return true if accepted, false if canceled"
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   393
464
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   394
    ^ self openFor:anApplication interface:aSelector withBindings:nil
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   395
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   396
    "Modified: 28.2.1997 / 16:22:08 / cg"
464
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   397
!
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   398
4288
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   399
openFor:anApplication interface:anInterfaceSymbolOrSpec withBindings:bindings
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   400
    "open the dialog for some appModel from a given specSymbol;
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   401
     the application must provide an interfaceSpec for that symbol.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   402
     The bindings argument may provide overwriting bindings for the
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   403
     dialog.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   404
     Return true if accepted, false if canceled"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   405
4288
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   406
    |spec|
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   407
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   408
    (anInterfaceSymbolOrSpec isSymbol) ifTrue:[
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   409
        spec := (anApplication interfaceSpecFor:anInterfaceSymbolOrSpec)
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   410
    ] ifFalse:[
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   411
        spec := anInterfaceSymbolOrSpec
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   412
    ].
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   413
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   414
    ^ self
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   415
        openFor:anApplication 
4288
d17422986c53 #FEATURE by alkurz
alkurz
parents: 4026
diff changeset
   416
        interfaceSpec:spec
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   417
        withBindings:bindings
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   418
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   419
    "Modified: 18.10.1997 / 04:43:13 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   420
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   421
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   422
openFor:anApplication interfaceSpec:aSpec withBindings:bindings
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   423
    "open the dialog for some appModel from a given spec;
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   424
     the bindings argument may provide overwriting bindings for the
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   425
     dialog.
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   426
     Return true if accepted, false if canceled"
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   427
2877
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   428
    self allButOpenFor:anApplication interfaceSpec:aSpec withBindings:bindings.
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   429
    self openDialog.
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   430
    ^ accept value
1491
6a1c859f50da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1441
diff changeset
   431
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   432
    "Created: / 07-07-2011 / 16:52:04 / cg"
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   433
!
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   434
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   435
openFor:anApplication spec:aSpec withBindings:bindings
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   436
    "open the dialog for some appModel from a given spec.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   437
     The bindings argument may provide overwriting bindings for the
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   438
     dialog.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   439
     Return true if accepted, false if canceled"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   440
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   441
    ^ self
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   442
        openFor:anApplication 
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   443
        interfaceSpec:aSpec
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   444
        withBindings:bindings
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   445
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   446
    "Modified: / 18.10.1997 / 04:43:13 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   447
    "Created: / 20.5.1998 / 20:28:29 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   448
!
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   449
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   450
openFrom:anInterfaceSpec
466
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   451
    "open the dialog from a given spec;
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   452
     return true if accepted, false if canceled"
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   453
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   454
    self allButOpenFrom:anInterfaceSpec.
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   455
    self openDialog.
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   456
    ^ accept value
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   457
466
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   458
    "Modified: 28.2.1997 / 16:40:36 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   459
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   460
1441
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   461
openInterface:aSymbol
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   462
    "open a standard interface.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   463
     Redefined to return the accept value instead of the builder."
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   464
3493
4570371765c6 class: SimpleDialog
Stefan Vogel <sv@exept.de>
parents: 3445
diff changeset
   465
    self accept setValue:false.
3422
aba77672c635 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   466
1441
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   467
    super openInterfaceModal:aSymbol.
2500
d146fa50819b allow for an acceptValue to be returned
Claus Gittinger <cg@exept.de>
parents: 2441
diff changeset
   468
    acceptedValue notNil ifTrue:[^ acceptedValue].
1441
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   469
    ^ accept value.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   470
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   471
    "Created: / 23.1.1998 / 18:19:57 / cg"
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   472
    "Modified: / 20.5.1998 / 20:21:28 / cg"
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   473
!
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   474
3180
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   475
openInterface:aSymbol at:position
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   476
    "open a standard interface.
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   477
     Redefined to return the accept value instead of the builder."
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   478
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   479
    super openInterfaceModal:aSymbol at:position.
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   480
    acceptedValue notNil ifTrue:[^ acceptedValue].
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   481
    ^ accept value.
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   482
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   483
    "Created: / 23.1.1998 / 18:19:57 / cg"
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   484
    "Modified: / 20.5.1998 / 20:21:28 / cg"
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   485
!
ddb23aad351e class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3099
diff changeset
   486
3495
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   487
openModelessFor:anApplication interfaceSpec:aSpec withBindings:bindings
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   488
    "open the dialog for some appModel from a given spec;
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   489
     the bindings argument may provide overwriting bindings for the
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   490
     dialog.
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   491
     Return immediately, not blocking the caller"
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   492
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   493
    self allButOpenFor:anApplication interfaceSpec:aSpec withBindings:bindings.
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   494
    self openDialogModeless
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   495
!
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   496
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   497
openModelessFor:anApplication spec:aSpec withBindings:bindings
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   498
    "open the dialog for some appModel from a given spec.
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   499
     The bindings argument may provide overwriting bindings for the
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   500
     dialog.
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   501
     Return immediately (i.e non-blocking the caller)"
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   502
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   503
    self
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   504
        openModelessFor:anApplication 
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   505
        interfaceSpec:aSpec
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   506
        withBindings:bindings
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   507
!
f626e72f5334 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3493
diff changeset
   508
1441
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   509
openSpec:aWindowSpec
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   510
    "open a window spec.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   511
     Redefned to open modal and to return the accept value instead 
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   512
     of the builder."
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   513
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   514
    super openSpecModal:aWindowSpec.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   515
    ^ accept value.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   516
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   517
    "Modified: / 22.4.1998 / 11:59:05 / cg"
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   518
    "Created: / 20.5.1998 / 20:21:17 / cg"
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   519
!
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   520
1440
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   521
openSpec:anInterfaceSpec withBindings:bindings
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   522
    "open the dialog with a given spec;
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   523
     The bindings argument is mandatory and provides aspect bindings for the
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   524
     dialog.
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   525
     Return true if accepted, false if canceled"
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   526
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   527
    ^ self
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   528
        openFor:self 
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   529
        interfaceSpec:anInterfaceSpec
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   530
        withBindings:bindings
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   531
!
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   532
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   533
postBuildWith:aBuilder
3970
d993b77cf073 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   534
    "this is sent after the dialog's widgets have been created
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   535
     (but before the dialog is opened).
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   536
     If a postBuildBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   537
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   538
    postBuildBlock notNil ifTrue:[
1551
f3428747591f use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   539
        postBuildBlock valueWithOptionalArgument:aBuilder
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   540
    ].
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   541
    builder source ~= self ifTrue:[
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   542
        "/ I was opened as dialogInterface for another application;
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   543
        "/ inform it that I am ready now
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   544
        builder source postBuildDialogWith:aBuilder
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   545
    ].
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   546
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   547
    super postBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   548
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   549
    "Created: / 18-10-1997 / 05:17:12 / cg"
3970
d993b77cf073 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   550
    "Modified (comment): / 03-08-2017 / 14:39:04 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   551
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   552
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   553
postOpenWith:aBuilder
3970
d993b77cf073 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   554
    "this is sent after the dialog's main window is opened.
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   555
     If a postOpenBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   556
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   557
    postOpenBlock notNil ifTrue:[
1551
f3428747591f use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   558
        postOpenBlock valueWithOptionalArgument:aBuilder
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   559
    ].
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   560
    builder source ~= self ifTrue:[
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   561
        "/ I was opened as dialogInterface for another application;
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   562
        "/ inform it that I am ready now
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   563
        builder source postOpenDialogWith:aBuilder
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   564
    ].
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   565
    super postOpenWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   566
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   567
    "Created: / 18-10-1997 / 05:15:48 / cg"
3970
d993b77cf073 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   568
    "Modified (comment): / 03-08-2017 / 14:39:08 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   569
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   570
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   571
preBuildWith:aBuilder
3970
d993b77cf073 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   572
    "this is sent before the dialog's widgets are created.
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   573
     If a preBuildBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   574
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   575
    preBuildBlock notNil ifTrue:[
1551
f3428747591f use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   576
        preBuildBlock valueWithOptionalArgument:aBuilder
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   577
    ].
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   578
    builder source ~= self ifTrue:[
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   579
        "/ I was opened as dialogInterface for another application;
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   580
        "/ inform it that I am ready now
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   581
        builder source preBuildDialogWith:aBuilder
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   582
    ].
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   583
    super preBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   584
2922
ff84e43f9c94 special postBuildDialog & postOpenDialog hooks for apps opening
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   585
    "Created: / 18-10-1997 / 15:02:27 / cg"
3970
d993b77cf073 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   586
    "Modified (comment): / 03-08-2017 / 14:39:11 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   587
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   588
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   589
preOpen
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   590
    "arrange for #closeAccept & #closeCancel to be invoked when
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   591
     either accept or close is triggered
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   592
     (usually the models of corresponding buttons)"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   593
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   594
    accept onChangeSend:#closeAccept to:self.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   595
    cancel onChangeSend:#closeCancel to:self.
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   596
    close  onChangeSend:#closeWindow to:self.
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   597
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   598
    "Modified: / 20.5.1998 / 20:49:26 / cg"
3299
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   599
!
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   600
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   601
preOpenWith:aBuilder
3970
d993b77cf073 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   602
    "this is sent after the dialog's main window is opened.
3299
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   603
     If a postOpenBlock was set, evaluate it here."
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   604
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   605
    builder source ~= self ifTrue:[
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   606
        "/ I was opened as dialogInterface for another application;
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   607
        "/ inform it that I am ready now
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   608
        builder source preOpenDialogWith:aBuilder
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   609
    ].
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   610
    super preOpenWith:aBuilder
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   611
c3f409635112 Added pre-open hooks.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3259
diff changeset
   612
    "Created: / 05-03-2014 / 18:47:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3970
d993b77cf073 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   613
    "Modified (comment): / 03-08-2017 / 14:39:15 / cg"
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   614
! !
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   615
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
!SimpleDialog methodsFor:'queries'!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
defaultWindowType
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
    "SimpleDialogs come up modal, by default"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
    ^ #dialog
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
    "Modified: 14.2.1997 / 22:17:20 / cg"
3205
88b0e4082379 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   624
!
88b0e4082379 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   625
88b0e4082379 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   626
shouldRememberLastExtent
3208
bc25fa88a042 class: UserPreferences
Claus Gittinger <cg@exept.de>
parents: 3205
diff changeset
   627
    (self accepted) ifFalse:[^ false].
bc25fa88a042 class: UserPreferences
Claus Gittinger <cg@exept.de>
parents: 3205
diff changeset
   628
    ^ super shouldRememberLastExtent
3205
88b0e4082379 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   629
88b0e4082379 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   630
    "Created: / 31-07-2013 / 18:06:12 / cg"
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
! !
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
!SimpleDialog class methodsFor:'documentation'!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
3205
88b0e4082379 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   635
version
3493
4570371765c6 class: SimpleDialog
Stefan Vogel <sv@exept.de>
parents: 3445
diff changeset
   636
    ^ '$Header$'
3205
88b0e4082379 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   637
!
88b0e4082379 class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 3204
diff changeset
   638
2877
2ab7a4fa2b3d added: #allButOpenFor:interfaceSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
   639
version_CVS
3493
4570371765c6 class: SimpleDialog
Stefan Vogel <sv@exept.de>
parents: 3445
diff changeset
   640
    ^ '$Header$'
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
! !
3099
90ad6c9bb1bd class: SimpleDialog
Claus Gittinger <cg@exept.de>
parents: 2922
diff changeset
   642