SimpleDialog.st
author ca
Mon, 05 Jan 1998 16:46:07 +0100
changeset 751 56a83a3b210c
parent 713 548898fdd1dc
child 766 67d7a6bc6780
permissions -rw-r--r--
add isEditing; set to true if running UIPainter
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1996 by eXept Software AG
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
    14
'From Smalltalk/X, Version:3.2.1 on 18-oct-1997 at 4:26:08 pm'                  !
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
    15
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
ApplicationModel subclass:#SimpleDialog
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    17
	instanceVariableNames:'accept cancel close escapeIsCancel postBuildBlock postOpenBlock
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    18
		preBuildBlock'
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	classVariableNames:''
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	poolDictionaries:''
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	category:'Interface-Framework'
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!SimpleDialog class methodsFor:'documentation'!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
copyright
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 (c) 1996 by eXept Software AG
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
              All Rights Reserved
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 This software is furnished under a license and may be used
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 only in accordance with the terms of that license and with the
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 be provided or otherwise made available to, or used by, any
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 other person.  No title to or ownership of the software is
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 hereby transferred.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
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
documentation
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    Since many ST-80 classes are subclasses of SompleDialog, this class
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    is provided here to allow easier porting of ST-80 code.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    It does not (currently) provide much functionality and is NOT
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    compatible to the corresponding ST80 class; therefore, manual
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    changes have to be made to get those applications to run under ST/X.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    (but at least, this enables you to fileIn that code and have a superclass
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
     for them)
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    However, as time goes by, ST/X applications may be converted to use the
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    ApplicationModel / SimpleDialog framework as well.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    Notice: this class was implemented using protocol information
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    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
    57
    the corresponding ST-80 class. If you encounter any incompatibilities,
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    please forward a note to the ST/X team.
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    [author:]
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
        Claus Gittinger
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    [see also:]
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
        StandardSystemView
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
        WindowGroup DeviceWorkstation DialogBox
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
! !
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    71
!SimpleDialog methodsFor:'accessing'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    72
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    73
accept
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    74
    "return the valueholder which gets set by the accept button"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    75
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    76
    ^ accept
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    77
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    78
    "Modified: 17.6.1997 / 14:09:48 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    79
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    80
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    81
bindings
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    82
    ^ builder bindings
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    83
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    84
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    85
cancel
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    86
    "return the valueholder which gets set by the cancel button"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    87
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    88
    ^ cancel
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    89
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
    90
    "Modified: 17.6.1997 / 14:09:55 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    91
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    92
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    93
closeChannel
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    94
    "return the value of the instance variable 'close' (automatically generated)"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    95
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    96
    ^ close
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    97
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    98
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
    99
escapeIsCancel
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   100
    "return the value of the instance variable 'escapeIsCancel' (automatically generated)"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   101
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   102
    ^ escapeIsCancel!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   103
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   104
escapeIsCancel:something
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   105
    "set the value of the instance variable 'escapeIsCancel' (automatically generated)"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   106
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   107
    escapeIsCancel := something.!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   108
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   109
postBuildBlock:something
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   110
    "set the value of the instance variable 'postBuildBlock' (automatically generated)"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   111
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   112
    postBuildBlock := something.!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   113
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   114
postOpenBlock:something
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   115
    "set the value of the instance variable 'postOpenBlock' (automatically generated)"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   116
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   117
    postOpenBlock := something.!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   118
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   119
preBuildBlock:something
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   120
    "set the value of the instance variable 'preBuildBlock' (automatically generated)"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   121
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   122
    preBuildBlock := something.!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   123
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   124
source:anApplication
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   125
    builder source:anApplication
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   126
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   127
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   128
!SimpleDialog methodsFor:'accessing - window'!
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   129
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   130
minWidth:nPixels
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   131
    |w box |
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   132
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   133
    w := builder window width.
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   134
    builder window width:(w max:nPixels).
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   135
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   136
"/    box := builder window displayBox.
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   137
"/    box width: (box width max: nPixels).
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   138
"/    builder window displayBox: box
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   139
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   140
    "Modified: 3.3.1997 / 21:56:27 / cg"
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   141
! !
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   142
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   143
!SimpleDialog methodsFor:'events'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   144
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   145
closeAccept
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   146
    "accept was pressed. close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   147
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   148
    self requestForWindowClose ifTrue:[
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   149
        self closeWindow
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   150
    ]
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   151
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   152
    "Modified: 17.6.1997 / 14:10:23 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   153
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   154
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   155
closeCancel
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   156
    "cancel was pressed. close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   157
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   158
    self requestForWindowClose ifTrue:[
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   159
        self closeWindow
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   160
    ]
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   161
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   162
    "Modified: 17.6.1997 / 14:10:29 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   163
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   164
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   165
closeWindow
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   166
    "close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   167
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   168
    self closeChannel value:true.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   169
    builder window hide
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   170
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   171
    "Modified: 17.6.1997 / 14:10:38 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   172
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   173
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   174
requestForWindowClose
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   175
    ^ true
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   176
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   177
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   178
!SimpleDialog methodsFor:'forced actions'!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   179
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   180
doAccept
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   181
    accept value:true
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   182
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   183
    "Created: 18.10.1997 / 05:18:09 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   184
    "Modified: 18.10.1997 / 05:18:28 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   185
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   186
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   187
doCancel
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   188
    cancel value:true
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   189
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   190
    "Created: 18.10.1997 / 05:18:22 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   191
! !
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   192
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   193
!SimpleDialog methodsFor:'initialization'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   194
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   195
initialize
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   196
    accept := false asValue.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   197
    close := false asValue.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   198
    cancel := false asValue.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   199
    builder aspectAt:#accept put:accept.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   200
    builder aspectAt:#close put:close.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   201
    builder aspectAt:#cancel put:cancel.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   202
    escapeIsCancel := true.
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   203
!
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   204
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   205
initializeBuilderFor:aView 
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   206
    aView notNil ifTrue:[
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   207
        builder window:aView.
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   208
    ]
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   209
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   210
    "Created: 3.3.1997 / 16:23:04 / cg"
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   211
!
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   212
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   213
initializeWindowFor:aView
679
0f94c493751c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   214
    |v|
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   215
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   216
    (v := aView) isNil ifTrue:[
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   217
        v := ModalBox new.
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   218
    ].
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   219
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   220
    builder setupWindowFor:v.
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   221
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   222
    "Modified: 3.3.1997 / 20:39:46 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   223
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   224
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   225
!SimpleDialog methodsFor:'interface opening'!
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   226
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   227
allButOpenFrom:aSpec
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   228
    "create my views but do not open the main window"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   229
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   230
    super allButOpenFrom:aSpec.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   231
    self preOpen
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   232
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   233
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   234
openFor:anApplication interface:aSelector
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   235
    "open the dialog for some appModel from a given spec;
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   236
     Return true if accepted, false if canceled"
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   237
464
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   238
    ^ 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
   239
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   240
    "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
   241
!
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   242
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   243
openFor:anApplication interface:aSelector withBindings:bindings
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   244
    "open the dialog for some appModel from a given specSymbol;
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   245
     the application must provide an interfaceSpec for that symbol.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   246
     The bindings argument may provide overwriting bindings for the
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   247
     dialog.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   248
     Return true if accepted, false if canceled"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   249
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   250
    ^ self
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   251
        openFor:anApplication 
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   252
        interfaceSpec:(anApplication class interfaceSpecFor:aSelector)
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   253
        withBindings:bindings
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   254
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   255
    "Modified: 18.10.1997 / 04:43:13 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   256
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   257
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   258
openFor:anApplication interfaceSpec:aSpec withBindings:bindings
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   259
    "open the dialog for some appModel from a given spec;
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   260
     the bindings argument may provide overwriting bindings for the
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   261
     dialog.
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   262
     Return true if accepted, false if canceled"
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   263
464
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   264
    builder addBindings:bindings.
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   265
    self source:anApplication.
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   266
    ^ self openFrom:aSpec
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   267
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   268
    "Modified: 28.2.1997 / 16:22:00 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   269
    "Created: 18.10.1997 / 04:41:29 / cg"
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   270
!
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   271
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   272
openFrom:anInterfaceSpec
466
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   273
    "open the dialog from a given spec;
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   274
     return true if accepted, false if canceled"
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   275
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   276
    self allButOpenFrom:anInterfaceSpec.
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   277
    self openDialog.
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   278
    ^ accept value
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   279
466
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   280
    "Modified: 28.2.1997 / 16:40:36 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   281
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   282
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   283
postBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   284
    "this is sent after the dialogs widgets have been created
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   285
     (but before the dialog is opened).
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   286
     If a postBuildBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   287
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   288
    postBuildBlock notNil ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   289
        postBuildBlock numArgs == 0 ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   290
            postBuildBlock value
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   291
        ] ifFalse:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   292
            postBuildBlock value:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   293
        ]
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   294
    ].
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   295
    super postBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   296
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   297
    "Created: 18.10.1997 / 05:17:12 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   298
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   299
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   300
postOpenWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   301
    "this is sent after the dialogs main window is opened.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   302
     If a postOpenBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   303
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   304
    postOpenBlock notNil ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   305
        postOpenBlock numArgs == 0 ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   306
            postOpenBlock value
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   307
        ] ifFalse:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   308
            postOpenBlock value:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   309
        ]
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   310
    ].
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   311
    super postOpenWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   312
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   313
    "Created: 18.10.1997 / 05:15:48 / cg"
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
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   316
preBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   317
    "this is sent before the dialogs widgets are created.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   318
     If a preBuildBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   319
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   320
    preBuildBlock notNil ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   321
        preBuildBlock numArgs == 0 ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   322
            preBuildBlock value
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   323
        ] ifFalse:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   324
            preBuildBlock value:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   325
        ]
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   326
    ].
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   327
    super preBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   328
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   329
    "Created: 18.10.1997 / 15:02:27 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   330
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   331
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   332
preOpen
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   333
    "arrange for #closeAccept & #closeCancel to be invoked when
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   334
     either accept or close is triggered
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   335
     (usually the models of corresponding buttons)"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   336
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   337
    accept onChangeSend:#closeAccept to:self.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   338
    cancel onChangeSend:#closeCancel to:self.
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   339
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   340
    "Modified: 17.6.1997 / 14:13:16 / cg"
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   341
! !
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   342
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
!SimpleDialog methodsFor:'queries'!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
defaultWindowType
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
    "SimpleDialogs come up modal, by default"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
    ^ #dialog
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
    "Modified: 14.2.1997 / 22:17:20 / cg"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
! !
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
!SimpleDialog class methodsFor:'documentation'!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
version
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   356
    ^ '$Header: /cvs/stx/stx/libview2/SimpleDialog.st,v 1.13 1997-10-21 18:27:05 cg Exp $'
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
! !