156
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
148
|
15 |
ApplicationModel subclass:#UIHelpTool
|
|
16 |
instanceVariableNames:'dictionary list model'
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Interface-UIPainter'
|
|
20 |
!
|
|
21 |
|
|
22 |
!UIHelpTool class methodsFor:'documentation'!
|
|
23 |
|
156
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1995 by eXept Software AG
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
|
|
37 |
|
|
38 |
!
|
|
39 |
|
148
|
40 |
documentation
|
|
41 |
"
|
|
42 |
used by the UIPainter to add help text to any component which will be shown
|
|
43 |
during runing an application with enabled activeHelp mode.
|
156
|
44 |
|
|
45 |
[author:]
|
|
46 |
Claus Atzkern
|
148
|
47 |
"
|
|
48 |
! !
|
|
49 |
|
151
|
50 |
!UIHelpTool class methodsFor:'help specs'!
|
|
51 |
|
|
52 |
helpSpec
|
|
53 |
"return a dictionary filled with helpKey -> helptext associations.
|
|
54 |
These are used by the activeHelp tool."
|
|
55 |
|
|
56 |
|dict|
|
|
57 |
|
|
58 |
dict := super helpSpec.
|
|
59 |
dict at:#activeHelpAccessKey put:'This ID is used to access an active
|
|
60 |
help text for the selected component'.
|
|
61 |
^ dict
|
|
62 |
! !
|
|
63 |
|
148
|
64 |
!UIHelpTool class methodsFor:'interface specs'!
|
|
65 |
|
|
66 |
windowSpec
|
|
67 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
68 |
|
|
69 |
"do not manually edit this - the painter/builder may not be able to
|
|
70 |
handle the specification if its corrupted."
|
|
71 |
|
|
72 |
"
|
151
|
73 |
UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec
|
|
74 |
UIHelpTool new openInterface:#windowSpec
|
148
|
75 |
"
|
151
|
76 |
"UIHelpTool open"
|
148
|
77 |
|
|
78 |
<resource: #canvas>
|
|
79 |
|
|
80 |
^
|
|
81 |
|
|
82 |
#(#FullSpec
|
|
83 |
#'window:'
|
|
84 |
#(#WindowSpec
|
|
85 |
#'name:' 'uIPainterView'
|
|
86 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
87 |
#'label:' 'unnamed canvas'
|
|
88 |
#'bounds:' #(#Rectangle 0 0 286 272)
|
|
89 |
)
|
|
90 |
#'component:'
|
|
91 |
#(#SpecCollection
|
|
92 |
#'collection:'
|
|
93 |
#(
|
|
94 |
#(#TextEditorSpec
|
|
95 |
#'name:' 'textView'
|
|
96 |
#'layout:' #(#LayoutFrame 46 0 25 0.0 0 1.0 0 1.0)
|
|
97 |
#'model:' #textChannel
|
|
98 |
#'hasHorizontalScrollBar:' true
|
|
99 |
#'hasVerticalScrollBar:' true
|
|
100 |
#'miniScrollerHorizontal:' true
|
|
101 |
#'miniScrollerVertical:' true
|
|
102 |
)
|
|
103 |
#(#LabelSpec
|
|
104 |
#'name:' 'keyLabel'
|
|
105 |
#'layout:' #(#LayoutFrame 0 0.0 1 0.0 41 0 21 0)
|
|
106 |
#'label:' 'Key:'
|
|
107 |
#'adjust:' #left
|
|
108 |
#'resizeForLabel:' false
|
|
109 |
)
|
|
110 |
#(#ComboBoxSpec
|
|
111 |
#'name:' 'comboBox'
|
|
112 |
#'layout:' #(#LayoutFrame 46 0 1 0 0 1.0 21 0)
|
151
|
113 |
#'activeHelpKey:' #activeHelpAccessKey
|
148
|
114 |
#'tabable:' true
|
|
115 |
#'comboList:' #listChannel
|
|
116 |
)
|
|
117 |
#(#LabelSpec
|
|
118 |
#'name:' 'textLabel'
|
|
119 |
#'layout:' #(#LayoutFrame 0 0.0 25 0.0 41 0 45 0)
|
|
120 |
#'label:' 'Text:'
|
|
121 |
#'adjust:' #left
|
|
122 |
#'resizeForLabel:' false
|
|
123 |
)
|
|
124 |
)
|
|
125 |
)
|
|
126 |
)
|
|
127 |
! !
|
|
128 |
|
|
129 |
!UIHelpTool methodsFor:'accessing'!
|
|
130 |
|
151
|
131 |
dictionary
|
|
132 |
"return the value of the instance variable 'dictionary' (automatically generated)"
|
|
133 |
|
|
134 |
^ dictionary!
|
|
135 |
|
|
136 |
dictionary:aDictionary
|
|
137 |
"set the value of the instance variable 'dictionary' (automatically generated)"
|
|
138 |
|
|
139 |
(dictionary := aDictionary) notNil ifTrue:[
|
|
140 |
list := dictionary keys asOrderedCollection
|
|
141 |
] ifFalse:[
|
|
142 |
list := nil
|
|
143 |
].
|
|
144 |
!
|
|
145 |
|
148
|
146 |
key
|
|
147 |
"get the key from the edit field as symbol or nil
|
|
148 |
"
|
|
149 |
|key|
|
|
150 |
|
|
151 |
key := model value.
|
|
152 |
|
|
153 |
( key size ~~ 0
|
|
154 |
and:[(key indexOfSeparatorStartingAt:1) == 0
|
|
155 |
or:[(key := key withoutSeparators) notEmpty]]
|
|
156 |
) ifTrue:[
|
|
157 |
^ key asSymbol
|
|
158 |
].
|
|
159 |
^ nil
|
|
160 |
!
|
|
161 |
|
|
162 |
model:aKeyHolder
|
|
163 |
"set the model on the edit field
|
|
164 |
"
|
|
165 |
model notNil ifTrue:[
|
|
166 |
model removeDependent:self
|
|
167 |
].
|
|
168 |
(model := aKeyHolder) notNil ifTrue:[
|
|
169 |
model addDependent:self
|
|
170 |
].
|
|
171 |
(builder componentAt:#comboBox) model:model.
|
151
|
172 |
self update:nil with:#model from:model.
|
148
|
173 |
! !
|
|
174 |
|
|
175 |
!UIHelpTool methodsFor:'actions'!
|
|
176 |
|
|
177 |
accept
|
|
178 |
"accept the text
|
|
179 |
"
|
|
180 |
|key txt|
|
|
181 |
|
|
182 |
key := self key.
|
|
183 |
txt := self textChannel.
|
|
184 |
|
|
185 |
key notNil ifTrue:[
|
|
186 |
txt dependentsDo:[:edt| edt accept].
|
|
187 |
|
|
188 |
(dictionary at:key ifAbsent:nil) isNil ifTrue:[
|
|
189 |
list add:key.
|
|
190 |
self listChannel value:list
|
|
191 |
].
|
|
192 |
dictionary at:key put:(txt value)
|
|
193 |
] ifFalse:[
|
|
194 |
key := nil.
|
|
195 |
txt value:nil.
|
|
196 |
].
|
|
197 |
|
|
198 |
model notNil ifTrue:[
|
|
199 |
model value:key
|
|
200 |
]
|
|
201 |
! !
|
|
202 |
|
|
203 |
!UIHelpTool methodsFor:'aspects'!
|
|
204 |
|
|
205 |
listChannel
|
|
206 |
"automatically generated by UIPainter ..."
|
|
207 |
|
|
208 |
|holder|
|
|
209 |
|
|
210 |
(holder := builder bindingAt:#listChannel) isNil ifTrue:[
|
|
211 |
builder aspectAt:#listChannel put:(holder := ValueHolder new).
|
151
|
212 |
holder value:list
|
148
|
213 |
].
|
|
214 |
^ holder
|
|
215 |
!
|
|
216 |
|
|
217 |
textChannel
|
|
218 |
"automatically generated by UIPainter ..."
|
|
219 |
|
|
220 |
|holder|
|
|
221 |
|
|
222 |
(holder := builder bindingAt:#textChannel) isNil ifTrue:[
|
|
223 |
builder aspectAt:#textChannel put:(holder := ValueHolder new).
|
|
224 |
].
|
|
225 |
^ holder
|
|
226 |
! !
|
|
227 |
|
|
228 |
!UIHelpTool methodsFor:'change & update'!
|
|
229 |
|
|
230 |
update:something with:aParameter from:someObject
|
|
231 |
"model might change
|
|
232 |
"
|
|
233 |
|text key|
|
|
234 |
|
|
235 |
(key := self key) notNil ifTrue:[
|
|
236 |
(text := dictionary at:key ifAbsent:nil) notNil ifTrue:[
|
|
237 |
self textChannel value:text
|
|
238 |
]
|
|
239 |
]
|
|
240 |
! !
|
|
241 |
|
|
242 |
!UIHelpTool methodsFor:'initialization'!
|
|
243 |
|
|
244 |
initialize
|
|
245 |
"setup instance attributes
|
|
246 |
"
|
|
247 |
super initialize.
|
|
248 |
dictionary := IdentityDictionary new.
|
|
249 |
list := OrderedCollection new.
|
|
250 |
! !
|
|
251 |
|
|
252 |
!UIHelpTool class methodsFor:'documentation'!
|
|
253 |
|
|
254 |
version
|
|
255 |
^ '$Header$'
|
|
256 |
! !
|