add more simple drag & drop functionality:
support one icon for a set of drag objects
"
COPYRIGHT (c) 1996 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
ApplicationModel subclass:#SimpleDialog
instanceVariableNames:'accept cancel close escapeIsCancel postBuildBlock postOpenBlock
preBuildBlock'
classVariableNames:''
poolDictionaries:''
category:'Interface-Framework'
!
!SimpleDialog class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
documentation
"
Since many ST-80 classes are subclasses of SompleDialog, this class
is provided here to allow easier porting of ST-80 code.
It does not (currently) provide much functionality and is NOT
compatible to the corresponding ST80 class; therefore, manual
changes have to be made to get those applications to run under ST/X.
(but at least, this enables you to fileIn that code and have a superclass
for them)
However, as time goes by, ST/X applications may be converted to use the
ApplicationModel / SimpleDialog framework as well.
Notice: this class was implemented using protocol information
from alpha testers and PD code - it may not be complete or compatible to
the corresponding ST-80 class. If you encounter any incompatibilities,
please forward a note to the ST/X team.
[author:]
Claus Gittinger
[see also:]
StandardSystemView
WindowGroup DeviceWorkstation DialogBox
"
! !
!SimpleDialog methodsFor:'accessing'!
accept
"return the valueholder which gets set by the accept button"
^ accept
"Modified: 17.6.1997 / 14:09:48 / cg"
!
bindings
^ builder bindings
!
cancel
"return the valueholder which gets set by the cancel button"
^ cancel
"Modified: 17.6.1997 / 14:09:55 / cg"
!
closeChannel
"return the value of the instance variable 'close' (automatically generated)"
^ close
!
escapeIsCancel
"return the value of the instance variable 'escapeIsCancel' (automatically generated)"
^ escapeIsCancel!
escapeIsCancel:something
"set the value of the instance variable 'escapeIsCancel' (automatically generated)"
escapeIsCancel := something.!
postBuildBlock:something
"set the value of the instance variable 'postBuildBlock' (automatically generated)"
postBuildBlock := something.!
postOpenBlock:something
"set the value of the instance variable 'postOpenBlock' (automatically generated)"
postOpenBlock := something.!
preBuildBlock:something
"set the value of the instance variable 'preBuildBlock' (automatically generated)"
preBuildBlock := something.!
source:anApplication
builder source:anApplication
! !
!SimpleDialog methodsFor:'accessing - window'!
minWidth:nPixels
|w box |
w := builder window width.
builder window width:(w max:nPixels).
"/ box := builder window displayBox.
"/ box width: (box width max: nPixels).
"/ builder window displayBox: box
"Modified: 3.3.1997 / 21:56:27 / cg"
! !
!SimpleDialog methodsFor:'events'!
closeAccept
"accept was pressed. close the dialog"
self requestForWindowClose ifTrue:[
self closeWindow
]
"Modified: 17.6.1997 / 14:10:23 / cg"
!
closeCancel
"cancel was pressed. close the dialog"
self requestForWindowClose ifTrue:[
self closeWindow
]
"Modified: 17.6.1997 / 14:10:29 / cg"
!
closeWindow
"close the dialog"
self closeChannel value:true.
builder window hide
"Modified: 17.6.1997 / 14:10:38 / cg"
!
requestForWindowClose
^ true
! !
!SimpleDialog methodsFor:'forced actions'!
doAccept
accept value:true
"Created: 18.10.1997 / 05:18:09 / cg"
"Modified: 18.10.1997 / 05:18:28 / cg"
!
doCancel
cancel value:true
"Created: 18.10.1997 / 05:18:22 / cg"
! !
!SimpleDialog methodsFor:'initialization'!
initialize
accept := false asValue.
close := false asValue.
cancel := false asValue.
builder aspectAt:#accept put:accept.
builder aspectAt:#close put:close.
builder aspectAt:#cancel put:cancel.
escapeIsCancel := true.
!
initializeBuilderFor:aView
aView notNil ifTrue:[
builder window:aView.
]
"Created: 3.3.1997 / 16:23:04 / cg"
!
initializeWindowFor:aView
|v|
(v := aView) isNil ifTrue:[
v := ModalBox new.
].
builder setupWindowFor:v.
"Modified: 3.3.1997 / 20:39:46 / cg"
! !
!SimpleDialog methodsFor:'interface opening'!
allButOpenFrom:aSpec
"create my views but do not open the main window"
super allButOpenFrom:aSpec.
self preOpen
!
openFor:anApplication interface:aSelector
"open the dialog for some appModel from a given spec;
Return true if accepted, false if canceled"
^ self openFor:anApplication interface:aSelector withBindings:nil
"Modified: 28.2.1997 / 16:22:08 / cg"
!
openFor:anApplication interface:aSelector withBindings:bindings
"open the dialog for some appModel from a given specSymbol;
the application must provide an interfaceSpec for that symbol.
The bindings argument may provide overwriting bindings for the
dialog.
Return true if accepted, false if canceled"
^ self
openFor:anApplication
interfaceSpec:(anApplication class interfaceSpecFor:aSelector)
withBindings:bindings
"Modified: 18.10.1997 / 04:43:13 / cg"
!
openFor:anApplication interfaceSpec:aSpec withBindings:bindings
"open the dialog for some appModel from a given spec;
the bindings argument may provide overwriting bindings for the
dialog.
Return true if accepted, false if canceled"
builder addBindings:bindings.
self source:anApplication.
^ self openFrom:aSpec
"Modified: 28.2.1997 / 16:22:00 / cg"
"Created: 18.10.1997 / 04:41:29 / cg"
!
openFrom:anInterfaceSpec
"open the dialog from a given spec;
return true if accepted, false if canceled"
self allButOpenFrom:anInterfaceSpec.
self openDialog.
^ accept value
"Modified: 28.2.1997 / 16:40:36 / cg"
!
postBuildWith:aBuilder
"this is sent after the dialogs widgets have been created
(but before the dialog is opened).
If a postBuildBlock was set, evaluate it here."
postBuildBlock notNil ifTrue:[
postBuildBlock numArgs == 0 ifTrue:[
postBuildBlock value
] ifFalse:[
postBuildBlock value:aBuilder
]
].
super postBuildWith:aBuilder
"Created: 18.10.1997 / 05:17:12 / cg"
!
postOpenWith:aBuilder
"this is sent after the dialogs main window is opened.
If a postOpenBlock was set, evaluate it here."
postOpenBlock notNil ifTrue:[
postOpenBlock numArgs == 0 ifTrue:[
postOpenBlock value
] ifFalse:[
postOpenBlock value:aBuilder
]
].
super postOpenWith:aBuilder
"Created: 18.10.1997 / 05:15:48 / cg"
!
preBuildWith:aBuilder
"this is sent before the dialogs widgets are created.
If a preBuildBlock was set, evaluate it here."
preBuildBlock notNil ifTrue:[
preBuildBlock numArgs == 0 ifTrue:[
preBuildBlock value
] ifFalse:[
preBuildBlock value:aBuilder
]
].
super preBuildWith:aBuilder
"Created: 18.10.1997 / 15:02:27 / cg"
!
preOpen
"arrange for #closeAccept & #closeCancel to be invoked when
either accept or close is triggered
(usually the models of corresponding buttons)"
accept onChangeSend:#closeAccept to:self.
cancel onChangeSend:#closeCancel to:self.
"Modified: 17.6.1997 / 14:13:16 / cg"
! !
!SimpleDialog methodsFor:'queries'!
defaultWindowType
"SimpleDialogs come up modal, by default"
^ #dialog
"Modified: 14.2.1997 / 22:17:20 / cg"
! !
!SimpleDialog methodsFor:'startup'!
openInterface:aWindowSpec
"open a standard interface.
Redefned to return the accept value instead of the builder."
super openInterface:aWindowSpec.
^ accept value.
"Created: / 23.1.1998 / 18:19:57 / cg"
"Modified: / 23.1.1998 / 18:20:54 / cg"
! !
!SimpleDialog class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview2/SimpleDialog.st,v 1.14 1998-01-23 17:23:05 cg Exp $'
! !