"
COPYRIGHT (c) 1990-93 by Claus Gittinger
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.
"
EnterBox subclass:#ListSelectionBox
instanceVariableNames:'selectionList'
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
!
ListSelectionBox comment:'
COPYRIGHT (c) 1990-93 by Claus Gittinger
All Rights Reserved
this class implements boxes for selection from a list
%W% %E%
written Jan 90 by claus
'!
!ListSelectionBox class methodsFor:'defaults'!
defaultExtent
^ (Display pixelPerMillimeter * (80 @ 100)) rounded
! !
!ListSelectionBox class methodsFor:'instance creation'!
title:titleString okText:okText abortText:abortText list:aList action:aBlock
"create and return a new listSelectionBox with list already defined"
|newBox|
newBox := super title:titleString okText:okText abortText:abortText
action:aBlock.
^ newBox list:aList
! !
!ListSelectionBox methodsFor:'initialization'!
initialize
|space2 v|
super initialize.
"need more space than an enterBox"
"self height:(height + (font height * 5)). "
space2 := 2 * ViewSpacing.
v := ScrollableView for:SelectionInListView in:self.
"kludge: see note in EnterBox"
v origin:(ViewSpacing
@
(enterField origin y + enterField height + ViewSpacing)).
v extent:((width - space2 - (v borderWidth * 2))
@
(height
- ViewSpacing - labelField heightIncludingBorder
- ViewSpacing - enterField heightIncludingBorder
- buttonPanel heightIncludingBorder - ViewSpacing
- space2)
).
v origin:[ViewSpacing
@
(enterField origin y + enterField height + ViewSpacing)]
extent:[(width - space2 - (v borderWidth * 2))
@
(height
- ViewSpacing - labelField heightIncludingBorder
- ViewSpacing - enterField heightIncludingBorder
- buttonPanel heightIncludingBorder - ViewSpacing
- space2)
].
selectionList := v scrolledView.
"self updateList."
"selections in list get forwarded to enterfield"
selectionList action:[:lineNr |
enterField contents:(selectionList selectionValue)
].
selectionList keyboardHandler:enterField
!
updateList
"setup contents of list; nothing done here but redefined in subclasses"
^ self
!
realize
self updateList.
super realize
! !
!ListSelectionBox methodsFor:'private'!
resize
"resize myself to make everything visible"
|wWanted hWanted|
wWanted := labelField width + ViewSpacing + ViewSpacing.
(wWanted > width) ifFalse:[
wWanted := width
].
hWanted := ViewSpacing + labelField height +
ViewSpacing + enterField height +
ViewSpacing + selectionList height +
ViewSpacing + buttonPanel height +
ViewSpacing.
(hWanted < height) ifTrue:[
hWanted := height
].
self extent:(wWanted @ hWanted)
! !
!ListSelectionBox methodsFor:'accessing'!
list:aList
"set the list to be displayed in selection list"
selectionList list:aList
! !