SimpleDialog.st
author Claus Gittinger <cg@exept.de>
Thu, 17 May 2001 13:11:53 +0200
changeset 1471 50775b15e283
parent 1441 2777d3f49053
child 1491 6a1c859f50da
permissions -rw-r--r--
*** empty log message ***
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
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
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
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
    18
		preBuildBlock closeAllowedChannel'
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
906
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    71
!SimpleDialog class methodsFor:'queries'!
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    72
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    73
isVisualStartable
1427
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
    74
    "return true, if this application can be started via #open.
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
    75
     (to allow start of a change browser via double-click in the browser)"
906
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    76
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    77
    self == SimpleDialog ifTrue:[^false].
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    78
    ^super isVisualStartable
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    79
! !
732822b19bc3 isVisualStartable
tz
parents: 905
diff changeset
    80
976
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    81
!SimpleDialog methodsFor:'Refactoring Browser'!
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    82
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    83
addMultiList: model lines: maxLines validation: valid
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    84
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    85
	| height layout field grid font scrollW max fullMax |
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    86
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    87
	height := builder window displayBox height.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    88
	layout := LayoutFrame new.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    89
	layout leftOffset: 16.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    90
	layout rightFraction: 1 offset: -16.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    91
	layout topOffset: height.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    92
	field := SequenceViewSpec model: model menu: nil layout: layout.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    93
	field multipleSelections: true.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    94
	builder add: field.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    95
	builder wrapper widget controller setDispatcher:
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    96
		(UIDispatcher new doubleClick: [valid value ifTrue: [accept value: true]]).
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    97
	"builder wrapper widget setValidTargetIndex: model selectionIndex."
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    98
	scrollW := builder wrapper decorator scrollerComponent.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
    99
	scrollW preferredBoundsBlock:
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   100
				[:sw | | rect |
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   101
				rect := sw component preferredBounds
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   102
						translatedBy: sw translation.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   103
				rect height: maxLines*sw scrollGrid y.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   104
				rect].
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   105
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   106
	font := builder wrapper widget textStyle defaultFont.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   107
	font := Screen default defaultFontPolicy findFont: font.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   108
	max := model list inject: 0 into: [:i :str | i max: str size].
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   109
		"Instead of exactly measuring every string, we
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   110
		assume that $o will be a fairly representative
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   111
		character.  Actually, $o will probably be wider
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   112
		than the average, but this will usually be OK."
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   113
	max := (font widthOf: $o) * max.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   114
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   115
		"Don't let the dialog get too wide."
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   116
	fullMax := 350.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   117
	max > fullMax
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   118
		ifTrue:
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   119
			[max := fullMax.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   120
			builder wrapper decorator useHorizontalScrollBar.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   121
			builder wrapper widget measureWidth: true].
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   122
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   123
	grid := builder wrapper preferredBounds height.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   124
	layout bottomOffset: height+grid.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   125
	self addGap: grid.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   126
	self minWidth: max + 48.
1427
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
   127
	^builder wrapper
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
   128
!
976
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   129
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   130
chooseMultiple: messageString fromList: list values: listValues buttons: buttons values: buttonValues lines: maxLines cancel: cancelBlock 
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   131
	^self
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   132
		chooseMultiple: messageString
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   133
		fromList: list
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   134
		values: listValues
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   135
		buttons: buttons
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   136
		values: buttonValues
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   137
		lines: maxLines
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   138
		cancel: cancelBlock
1427
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
   139
		for: nil
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
   140
!
976
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   141
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   142
chooseMultiple: messageString fromList: list values: listValues buttons: buttons values: buttonValues lines: maxLines cancel: cancelBlock for: aVisualOrNil
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   143
	"Ask the user a question.  Let the user pick from a row of buttons made up
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   144
	to match the labels collection.  Return the response from the corresponding
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   145
	item from the values collection."
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   146
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   147
	"aVisualOrNil, if not nil, may be either a VisualPart or a
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   148
	ScheduledWindow.  It controls the look and feel and color choices
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   149
	used by the dialog, and supplies the dialog's master window, which
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   150
	is used by some window systems to create a visual connection between
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   151
	the dialog and the window that created it."
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   152
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   153
	"SimpleDialog new
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   154
		chooseMultiple: 'Which one do you want?'
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   155
		fromList: #('first' 'second' 'third' 'fourth') values: #(1 2 3 4)
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   156
		buttons: #() values: #()
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   157
		lines: 8
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   158
		cancel: [#noChoice]
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   159
		for: Dialog defaultParentWindow"
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   160
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   161
	| result spec okValue sequence wrappers listW |
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   162
	wrappers := OrderedCollection new.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   163
	result := ValueHolder new.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   164
	sequence := MultiSelectionInList new.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   165
	sequence list: list.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   166
	spec := (self class interfaceSpecFor: #emptySpec).
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   167
	okValue := Object new.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   168
	self initializeBuilderFor: aVisualOrNil.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   169
	builder add: spec window.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   170
	builder add: spec component.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   171
	self initializeWindowFor: aVisualOrNil.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   172
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   173
	self setInitialGap.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   174
	self addMessage: messageString centered: false.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   175
	self addGap: 8.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   176
	listW := self
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   177
			addMultiList: sequence
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   178
			lines: (maxLines min: list size+2)
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   179
			validation: [true].
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   180
	self addGap: 4.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   181
	wrappers add: (self addOK: [sequence selectionIndex ~= 0]).
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   182
	buttons isEmpty
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   183
		ifFalse:
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   184
			[self addGap: 4.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   185
			wrappers add: (self addDivider).
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   186
			self addGap: 4.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   187
			wrappers add:
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   188
					(self addLabels: buttons
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   189
						values: buttonValues
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   190
						default: okValue
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   191
						storeInto: result
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   192
						takeKeyboard: true
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   193
						equalize: true)].
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   194
	self addGap: 6.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   195
	self bottomAlignLowerEdge: listW.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   196
	self bottomAlign: wrappers.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   197
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   198
	self preOpen.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   199
	builder openDialogWithExtent: builder window displayBox extent.
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   200
	^accept value
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   201
		ifTrue: [sequence selectionIndexes collect: [:each | listValues at: each]]
1427
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
   202
		ifFalse: [cancel value ifTrue: [cancelBlock value] ifFalse: [result value]]
b3e355574ccf comment only
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
   203
! !
976
dd0045c9fdd7 must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
   204
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   205
!SimpleDialog methodsFor:'accessing'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   206
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   207
accept
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   208
    "return the valueholder which gets set by the accept button.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   209
     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
   210
     dialog is closed."
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   211
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   212
    ^ accept
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   213
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   214
    "Modified: / 20.5.1998 / 20:51:05 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   215
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   216
1381
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   217
accepted
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   218
    "after the box has closed:
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   219
         return true if accepted, false if canceled"
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   220
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   221
    ^ self accept value
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   222
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   223
!
1035403e302e added #accepted
Claus Gittinger <cg@exept.de>
parents: 1375
diff changeset
   224
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   225
bindings
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   226
    "return my builders bindings"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   227
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   228
    ^ builder bindings
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   229
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   230
    "Modified: / 20.5.1998 / 20:51:15 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   231
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   232
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   233
cancel
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   234
    "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
   235
     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
   236
     dialog is closed."
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   237
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   238
    ^ cancel
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   239
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   240
    "Modified: / 20.5.1998 / 20:51:02 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   241
!
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   242
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   243
closeAllowedChannel
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   244
    "return the value-provider which controls if close is allowed.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   245
     This is initialized to true."
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   246
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   247
    ^ closeAllowedChannel
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   248
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   249
    "Created: / 20.5.1998 / 21:52:32 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   250
    "Modified: / 20.5.1998 / 21:53:18 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   251
!
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   252
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   253
closeAllowedChannel:aValueHolderOrBlock
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   254
    "set a value-provider which controls if close is allowed."
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   255
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   256
    ^ closeAllowedChannel
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   257
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   258
    "Created: / 20.5.1998 / 21:52:53 / 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
closeChannel
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   262
    "return the closeChannel; If a true is stuffed into this valueHolder,
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   263
     I will close myself."
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   264
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   265
    ^ close
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   266
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   267
    "Modified: / 20.5.1998 / 20:52:29 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   268
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   269
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   270
escapeIsCancel
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   271
    "return the escapeIsCancel setting"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   272
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   273
    ^ escapeIsCancel
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   274
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   275
    "Modified: / 20.5.1998 / 20:52:44 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   276
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   277
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   278
escapeIsCancel:something
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   279
    "set/clear the escapeIsCancel option.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   280
     If on, an ESC-key will be treated like a cancel action."
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   281
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   282
    escapeIsCancel := something.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   283
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   284
    "Modified: / 20.5.1998 / 20:53:23 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   285
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   286
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   287
postBuildBlock:something
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   288
    "set postBuildBlock; if non-nil, this is evaluated after the build process"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   289
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   290
    postBuildBlock := something.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   291
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   292
    "Modified: / 20.5.1998 / 20:54:06 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   293
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   294
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   295
postOpenBlock:something
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   296
    "set the postBuildBlock; if non-nil, this is evaluated after the view is opened"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   297
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   298
    postOpenBlock := something.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   299
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   300
    "Modified: / 20.5.1998 / 20:54:23 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   301
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   302
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   303
preBuildBlock:something
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   304
    "set the preBuildBlock; if non-nil, this is evaluated before the view is constructed"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   305
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   306
    preBuildBlock := something.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   307
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   308
    "Modified: / 20.5.1998 / 20:54:41 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   309
!
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   310
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   311
source:anApplication
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   312
    "define the application which provides resources, aspects etc."
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   313
1067
5b39cef366fe also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   314
    builder source:anApplication.
5b39cef366fe also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   315
    masterApplication isNil ifTrue:[
1440
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   316
        anApplication ~~ self ifTrue:[
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   317
            masterApplication := anApplication
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   318
        ]
1067
5b39cef366fe also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   319
    ].
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   320
1067
5b39cef366fe also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents: 1053
diff changeset
   321
    "Modified: / 8.9.1998 / 01:46:06 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   322
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   323
1397
47ac1d3e1df1 category changes
Claus Gittinger <cg@exept.de>
parents: 1381
diff changeset
   324
!SimpleDialog methodsFor:'accessing-window'!
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   325
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   326
minWidth:nPixels
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   327
    |w box |
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   328
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   329
    w := builder window width.
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   330
    builder window width:(w max:nPixels).
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   331
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   332
"/    box := builder window displayBox.
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   333
"/    box width: (box width max: nPixels).
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   334
"/    builder window displayBox: box
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   335
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   336
    "Modified: 3.3.1997 / 21:56:27 / cg"
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   337
! !
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   338
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   339
!SimpleDialog methodsFor:'events'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   340
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   341
closeAccept
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   342
    "accept was pressed. close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   343
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   344
    self requestForWindowClose ifTrue:[
1129
0d5fd9b819a9 autoAccept
Claus Gittinger <cg@exept.de>
parents: 1067
diff changeset
   345
        builder keyboardProcessor requestGlobalAutoAccept ifTrue:[
0d5fd9b819a9 autoAccept
Claus Gittinger <cg@exept.de>
parents: 1067
diff changeset
   346
            self closeWindow
0d5fd9b819a9 autoAccept
Claus Gittinger <cg@exept.de>
parents: 1067
diff changeset
   347
        ]
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   348
    ]
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   349
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   350
    "Modified: 17.6.1997 / 14:10:23 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   351
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   352
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   353
closeCancel
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   354
    "cancel was pressed. close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   355
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   356
    self requestForWindowClose ifTrue:[
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   357
        self closeWindow
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   358
    ]
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   359
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   360
    "Modified: 17.6.1997 / 14:10:29 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   361
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   362
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   363
closeWindow
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   364
    "close the dialog"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   365
1053
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   366
    |c|
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   367
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   368
    c := self closeChannel.
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   369
    c retractInterestsFor:self.
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   370
    c value:true.
903
b9e0882bd2f4 checkin from browser
tz
parents: 902
diff changeset
   371
    "/ must destroy - otherwise there is no #release to
b9e0882bd2f4 checkin from browser
tz
parents: 902
diff changeset
   372
    "/ the  controllers (onChangeSend-dependency problem)
902
4851101e5b8c checkin from browser
tz
parents: 766
diff changeset
   373
    builder window destroy. "/ hide
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   374
1053
0d77637f9d45 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   375
    "Modified: / 24.8.1998 / 17:45:56 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   376
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   377
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   378
requestForWindowClose
1373
c04eea37d7db Fix typos in comment.
Stefan Vogel <sv@exept.de>
parents: 1346
diff changeset
   379
    "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
   380
     return false to suppress the close.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   381
     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
   382
     set to true initially.
1373
c04eea37d7db Fix typos in comment.
Stefan Vogel <sv@exept.de>
parents: 1346
diff changeset
   383
     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
   384
     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
   385
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   386
    ^ closeAllowedChannel value
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   387
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   388
    "Modified: / 20.5.1998 / 21:52:25 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   389
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   390
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   391
!SimpleDialog methodsFor:'forced actions'!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   392
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   393
doAccept
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   394
    "force accept"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   395
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   396
    accept value:true
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   397
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   398
    "Created: / 18.10.1997 / 05:18:09 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   399
    "Modified: / 20.5.1998 / 21:53:35 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   400
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   401
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   402
doCancel
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   403
    "force cancel"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   404
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   405
    cancel value:true
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   406
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   407
    "Created: / 18.10.1997 / 05:18:22 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   408
    "Modified: / 20.5.1998 / 21:53:40 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   409
! !
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   410
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   411
!SimpleDialog methodsFor:'initialization'!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   412
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   413
initialize
935
ccb6caad1da0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
   414
    accept := (ValueHolder with:false).
ccb6caad1da0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
   415
    close := (ValueHolder with:false).
ccb6caad1da0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
   416
    cancel := (ValueHolder with:false).
978
cd056a68d67a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   417
    self createBuilder.
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   418
    builder aspectAt:#accept put:accept.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   419
    builder aspectAt:#close put:close.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   420
    builder aspectAt:#cancel put:cancel.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   421
    escapeIsCancel := true.
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   422
    closeAllowedChannel := true
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   423
978
cd056a68d67a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
   424
    "Modified: / 19.6.1998 / 03:35:48 / cg"
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   425
!
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   426
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   427
initializeBuilderFor:aView 
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   428
    aView notNil ifTrue:[
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   429
        builder window:aView.
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   430
    ]
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   431
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   432
    "Created: 3.3.1997 / 16:23:04 / cg"
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   433
!
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   434
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   435
initializeWindowFor:aView
679
0f94c493751c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   436
    |v|
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   437
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   438
    (v := aView) isNil ifTrue:[
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   439
        v := ModalBox new.
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   440
    ].
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   441
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   442
    builder setupWindowFor:v.
476
628766c580c3 added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
   443
481
02d1db5d428a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 476
diff changeset
   444
    "Modified: 3.3.1997 / 20:39:46 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   445
! !
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   446
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   447
!SimpleDialog methodsFor:'interface opening'!
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   448
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   449
allButOpenFrom:aSpec
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   450
    "create my views but do not open the main window"
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   451
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   452
    super allButOpenFrom:aSpec.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   453
    self preOpen
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   454
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   455
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   456
openFor:anApplication interface:aSelector
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   457
    "open the dialog for some appModel from a given spec;
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   458
     Return true if accepted, false if canceled"
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   459
464
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   460
    ^ 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
   461
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   462
    "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
   463
!
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   464
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   465
openFor:anApplication interface:aSelector withBindings:bindings
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   466
    "open the dialog for some appModel from a given specSymbol;
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   467
     the application must provide an interfaceSpec for that symbol.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   468
     The bindings argument may provide overwriting bindings for the
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   469
     dialog.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   470
     Return true if accepted, false if canceled"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   471
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   472
    ^ self
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   473
        openFor:anApplication 
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   474
        interfaceSpec:(anApplication class interfaceSpecFor:aSelector)
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   475
        withBindings:bindings
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   476
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   477
    "Modified: 18.10.1997 / 04:43:13 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   478
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   479
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   480
openFor:anApplication interfaceSpec:aSpec withBindings:bindings
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   481
    "open the dialog for some appModel from a given spec;
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   482
     the bindings argument may provide overwriting bindings for the
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   483
     dialog.
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   484
     Return true if accepted, false if canceled"
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   485
464
25e6380399c6 allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
   486
    builder addBindings:bindings.
1346
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
   487
    self source:(anApplication ifNil:[ApplicationModel new]).
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   488
    ^ self openFrom:aSpec
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   489
465
5df2fbe7275a comments
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
   490
    "Modified: 28.2.1997 / 16:22:00 / cg"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   491
    "Created: 18.10.1997 / 04:41:29 / cg"
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   492
!
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   493
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   494
openFor:anApplication spec:aSpec withBindings:bindings
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   495
    "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
   496
     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
   497
     dialog.
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   498
     Return true if accepted, false if canceled"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   499
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   500
    ^ self
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   501
        openFor:anApplication 
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   502
        interfaceSpec:aSpec
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   503
        withBindings:bindings
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   504
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   505
    "Modified: / 18.10.1997 / 04:43:13 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   506
    "Created: / 20.5.1998 / 20:28:29 / cg"
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   507
!
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   508
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   509
openFrom:anInterfaceSpec
466
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   510
    "open the dialog from a given spec;
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   511
     return true if accepted, false if canceled"
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   512
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   513
    self allButOpenFrom:anInterfaceSpec.
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   514
    self openDialog.
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   515
    ^ accept value
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   516
466
784ed480f4eb comments
Claus Gittinger <cg@exept.de>
parents: 465
diff changeset
   517
    "Modified: 28.2.1997 / 16:40:36 / cg"
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   518
!
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   519
1441
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   520
openInterface:aSymbol
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   521
    "open a standard interface.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   522
     Redefined to return the accept value instead of the builder."
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   523
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   524
    super openInterfaceModal:aSymbol.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   525
    ^ accept value.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   526
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   527
    "Created: / 23.1.1998 / 18:19:57 / cg"
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   528
    "Modified: / 20.5.1998 / 20:21:28 / cg"
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   529
!
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   530
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   531
openSpec:aWindowSpec
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   532
    "open a window spec.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   533
     Redefned to open modal and to return the accept value instead 
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   534
     of the builder."
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   535
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   536
    super openSpecModal:aWindowSpec.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   537
    ^ accept value.
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   538
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   539
    "Modified: / 22.4.1998 / 11:59:05 / cg"
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   540
    "Created: / 20.5.1998 / 20:21:17 / cg"
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   541
!
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   542
1440
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   543
openSpec:anInterfaceSpec withBindings:bindings
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   544
    "open the dialog with a given spec;
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   545
     The bindings argument is mandatory and provides aspect bindings for the
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   546
     dialog.
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   547
     Return true if accepted, false if canceled"
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   548
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   549
    ^ self
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   550
        openFor:self 
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   551
        interfaceSpec:anInterfaceSpec
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   552
        withBindings:bindings
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   553
!
7a0b8cc86e87 added #openSpec:withBindings:
Claus Gittinger <cg@exept.de>
parents: 1427
diff changeset
   554
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   555
postBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   556
    "this is sent after the dialogs widgets have been created
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   557
     (but before the dialog is opened).
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   558
     If a postBuildBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   559
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   560
    postBuildBlock notNil ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   561
        postBuildBlock numArgs == 0 ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   562
            postBuildBlock value
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   563
        ] ifFalse:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   564
            postBuildBlock value:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   565
        ]
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   566
    ].
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   567
    super postBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   568
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   569
    "Created: 18.10.1997 / 05:17:12 / cg"
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
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   572
postOpenWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   573
    "this is sent after the dialogs main window is opened.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   574
     If a postOpenBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   575
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   576
    postOpenBlock notNil ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   577
        postOpenBlock numArgs == 0 ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   578
            postOpenBlock value
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   579
        ] ifFalse:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   580
            postOpenBlock value:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   581
        ]
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   582
    ].
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   583
    super postOpenWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   584
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   585
    "Created: 18.10.1997 / 05:15:48 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   586
!
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
preBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   589
    "this is sent before the dialogs widgets are created.
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   590
     If a preBuildBlock was set, evaluate it here."
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   591
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   592
    preBuildBlock notNil ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   593
        preBuildBlock numArgs == 0 ifTrue:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   594
            preBuildBlock value
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   595
        ] ifFalse:[
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   596
            preBuildBlock value:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   597
        ]
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   598
    ].
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   599
    super preBuildWith:aBuilder
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   600
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   601
    "Created: 18.10.1997 / 15:02:27 / cg"
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   602
!
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 679
diff changeset
   603
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   604
preOpen
605
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   605
    "arrange for #closeAccept & #closeCancel to be invoked when
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   606
     either accept or close is triggered
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   607
     (usually the models of corresponding buttons)"
9e9445252e25 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 485
diff changeset
   608
431
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   609
    accept onChangeSend:#closeAccept to:self.
99a2737206a6 checkin from browser
ca
parents: 429
diff changeset
   610
    cancel onChangeSend:#closeCancel to:self.
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   611
    close  onChangeSend:#closeWindow to:self.
429
3311c88f2a0e dialog opening stuff
ca
parents: 366
diff changeset
   612
932
f7b0ce4cc1d1 allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents: 906
diff changeset
   613
    "Modified: / 20.5.1998 / 20:49:26 / 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"
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
! !
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
!SimpleDialog class methodsFor:'documentation'!
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
version
1441
2777d3f49053 category changes
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   629
    ^ '$Header: /cvs/stx/stx/libview2/SimpleDialog.st,v 1.35 2000-12-07 13:48:21 cg Exp $'
366
bde54cb70d97 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
! !