ApplicationModel subclass:#UIHelpTool
instanceVariableNames:'dictionary list model'
classVariableNames:''
poolDictionaries:''
category:'Interface-UIPainter'
!
!UIHelpTool class methodsFor:'documentation'!
documentation
"
used by the UIPainter to add help text to any component which will be shown
during runing an application with enabled activeHelp mode.
"
! !
!UIHelpTool class methodsFor:'interface specs'!
windowSpec
"this window spec was automatically generated by the ST/X UIPainter"
"do not manually edit this - the painter/builder may not be able to
handle the specification if its corrupted."
"
UIPainter new openOnClass:ActiveHelpTool andSelector:#windowSpec
ActiveHelpTool new openInterface:#windowSpec
"
"ActiveHelpTool open"
<resource: #canvas>
^
#(#FullSpec
#'window:'
#(#WindowSpec
#'name:' 'uIPainterView'
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
#'label:' 'unnamed canvas'
#'bounds:' #(#Rectangle 0 0 286 272)
)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#TextEditorSpec
#'name:' 'textView'
#'layout:' #(#LayoutFrame 46 0 25 0.0 0 1.0 0 1.0)
#'model:' #textChannel
#'hasHorizontalScrollBar:' true
#'hasVerticalScrollBar:' true
#'miniScrollerHorizontal:' true
#'miniScrollerVertical:' true
)
#(#LabelSpec
#'name:' 'keyLabel'
#'layout:' #(#LayoutFrame 0 0.0 1 0.0 41 0 21 0)
#'label:' 'Key:'
#'adjust:' #left
#'resizeForLabel:' false
)
#(#ComboBoxSpec
#'name:' 'comboBox'
#'layout:' #(#LayoutFrame 46 0 1 0 0 1.0 21 0)
#'tabable:' true
#'comboList:' #listChannel
)
#(#LabelSpec
#'name:' 'textLabel'
#'layout:' #(#LayoutFrame 0 0.0 25 0.0 41 0 45 0)
#'label:' 'Text:'
#'adjust:' #left
#'resizeForLabel:' false
)
)
)
)
! !
!UIHelpTool methodsFor:'accessing'!
key
"get the key from the edit field as symbol or nil
"
|key|
key := model value.
( key size ~~ 0
and:[(key indexOfSeparatorStartingAt:1) == 0
or:[(key := key withoutSeparators) notEmpty]]
) ifTrue:[
^ key asSymbol
].
^ nil
!
model:aKeyHolder
"set the model on the edit field
"
model notNil ifTrue:[
model removeDependent:self
].
(model := aKeyHolder) notNil ifTrue:[
model addDependent:self
].
(builder componentAt:#comboBox) model:model.
! !
!UIHelpTool methodsFor:'actions'!
accept
"accept the text
"
|key txt|
key := self key.
txt := self textChannel.
key notNil ifTrue:[
txt dependentsDo:[:edt| edt accept].
(dictionary at:key ifAbsent:nil) isNil ifTrue:[
list add:key.
self listChannel value:list
].
dictionary at:key put:(txt value)
] ifFalse:[
key := nil.
txt value:nil.
].
model notNil ifTrue:[
model value:key
]
! !
!UIHelpTool methodsFor:'aspects'!
listChannel
"automatically generated by UIPainter ..."
|holder|
(holder := builder bindingAt:#listChannel) isNil ifTrue:[
builder aspectAt:#listChannel put:(holder := ValueHolder new).
].
^ holder
!
textChannel
"automatically generated by UIPainter ..."
|holder|
(holder := builder bindingAt:#textChannel) isNil ifTrue:[
builder aspectAt:#textChannel put:(holder := ValueHolder new).
].
^ holder
! !
!UIHelpTool methodsFor:'change & update'!
update:something with:aParameter from:someObject
"model might change
"
|text key|
(key := self key) notNil ifTrue:[
(text := dictionary at:key ifAbsent:nil) notNil ifTrue:[
self textChannel value:text
]
]
! !
!UIHelpTool methodsFor:'initialization'!
initialize
"setup instance attributes
"
super initialize.
dictionary := IdentityDictionary new.
list := OrderedCollection new.
! !
!UIHelpTool class methodsFor:'documentation'!
version
^ '$Header$'
! !