164
|
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 |
|
|
15 |
|
|
16 |
ApplicationModel subclass:#UISpecificationTool
|
172
|
17 |
instanceVariableNames:'modifiedHolder aspects specification selection specChannel'
|
164
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Interface-UIPainter'
|
|
21 |
!
|
|
22 |
|
|
23 |
!UISpecificationTool class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 1995 by eXept Software AG
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
!
|
|
41 |
|
|
42 |
documentation
|
|
43 |
"
|
|
44 |
used by the UIPainter to manipulate the specifications of the selected component
|
|
45 |
|
|
46 |
[author:]
|
|
47 |
Claus Atzkern
|
|
48 |
|
|
49 |
[see also:]
|
|
50 |
UIPainter
|
|
51 |
UILayoutTool
|
|
52 |
UIHelpTool
|
|
53 |
"
|
|
54 |
! !
|
|
55 |
|
172
|
56 |
!UISpecificationTool class methodsFor:'help specs'!
|
|
57 |
|
|
58 |
helpSpec
|
|
59 |
"return a dictionary filled with helpKey -> helptext associations.
|
294
|
60 |
These are used by the activeHelp tool."
|
|
61 |
|
|
62 |
"
|
|
63 |
UIHelpTool openOnClass:UISpecificationTool
|
172
|
64 |
"
|
294
|
65 |
|
172
|
66 |
^ super helpSpec addPairsFrom:#(
|
|
67 |
|
303
|
68 |
#showRoot
|
|
69 |
'show or hide the first element into the hierarchical list.'
|
|
70 |
|
|
71 |
#tabOrientation
|
|
72 |
'where to place the tabs'
|
|
73 |
|
294
|
74 |
#menuHolder
|
|
75 |
'selector or holder of the middle button menu'
|
|
76 |
|
|
77 |
#galleryModel
|
|
78 |
'a holder, which keeps the label of the current selected tab or nil.'
|
|
79 |
|
|
80 |
#listHolder
|
|
81 |
'gets a list or list holder'
|
|
82 |
|
303
|
83 |
#document
|
|
84 |
'a holder which keeps the document name to be shown.'
|
|
85 |
|
172
|
86 |
#maxChars
|
294
|
87 |
'set the maximum number of characters that are allowed in the editfield.'
|
|
88 |
|
303
|
89 |
#action
|
|
90 |
'action evaluated when the button is pressed or released which depends on the setting of triggerOnDown flag, either set the press-action and clear any release-action or vice versa, set the release-action and clear the press-action.'
|
|
91 |
|
294
|
92 |
#canvasSelector
|
|
93 |
'after open the application specified by the clientKey, this selector if not nil will be evaluated,'
|
|
94 |
|
|
95 |
#enableChannel
|
|
96 |
'enable the view - selection changes are allowed'
|
|
97 |
|
|
98 |
#canvas
|
|
99 |
'gets a widget placed into the notebook'
|
|
100 |
|
303
|
101 |
#oneTabPerLine
|
|
102 |
'draw only one tab per line'
|
|
103 |
|
294
|
104 |
#middleButtonPressed
|
|
105 |
'called if the middle button is pressed; you can open a menu'
|
|
106 |
|
|
107 |
#defaultLabel
|
|
108 |
'set the default label which will be set if nothing selected.'
|
172
|
109 |
|
|
110 |
#id
|
294
|
111 |
'enter the name of the field here. This ID can be used by the application to access components, using #componentAt:<key>'
|
|
112 |
|
303
|
113 |
#showDirectoyIndication
|
|
114 |
'show or hide the open/closed indicator on nodes which contains children'
|
|
115 |
|
|
116 |
#sizeAsDefault
|
|
117 |
'the size of the widget depends on its label. In case of a fixed Layout nothing will change.'
|
|
118 |
|
|
119 |
#arbitraryView
|
|
120 |
'the widget class shown represented by the arbitrary component or a selector which returns a widget class.'
|
|
121 |
|
294
|
122 |
#selectionHolder
|
|
123 |
'the one which keeps the selection and in case of a ''SelectionInList'' model the list.'
|
|
124 |
|
|
125 |
#level
|
|
126 |
'set the level relative to its superView'
|
|
127 |
|
|
128 |
#majorKey
|
|
129 |
'name of the class which provides the window specification or in case of nil the application itself is used'
|
|
130 |
|
|
131 |
#isMultiSelect
|
|
132 |
'enable/disable multiple selections.'
|
|
133 |
|
|
134 |
#gallerySelectors
|
|
135 |
'the list of selectors specify which interface specification should be used dependent on the tab pressed. Each selector must return an interfaceSpec. On default the #windowSpec method is used'
|
|
136 |
|
|
137 |
#gallerySelection
|
|
138 |
'a holder, which keeps the specification of the current selected widget or nil.'
|
|
139 |
|
|
140 |
#canvasArgument
|
|
141 |
'the argument to the selector or none'
|
|
142 |
|
303
|
143 |
#beDefault
|
|
144 |
'show/dont show a return-key image after the label'
|
|
145 |
|
294
|
146 |
#typeConverter
|
|
147 |
'convert the fields string value to some object'
|
|
148 |
|
|
149 |
#backgroundColor
|
|
150 |
'set the background color'
|
|
151 |
|
303
|
152 |
#showLines
|
|
153 |
'show or hide lines'
|
|
154 |
|
|
155 |
#label
|
|
156 |
'the label of the widget'
|
|
157 |
|
294
|
158 |
#minorKey
|
|
159 |
'the selector specifies which interface specification to be used. The selector must return an interfaceSpec. On default the #windowSpec method is used'
|
|
160 |
|
303
|
161 |
#showFrame
|
|
162 |
'show the frame'
|
|
163 |
|
|
164 |
#autoRepeat
|
|
165 |
'repeat the action as long as the button is pressed; to have this behavior the ''isTriggerOnDown'' state must be enabled'
|
|
166 |
|
|
167 |
#booleanHolder
|
|
168 |
'a boolean holder which keeps the state'
|
|
169 |
|
294
|
170 |
#menuButton
|
|
171 |
'pressing the button will open the menu editor on the specified menu selector.'
|
|
172 |
|
|
173 |
#galleryLabels
|
|
174 |
'a list of tab labels'
|
|
175 |
|
|
176 |
#selectionModel
|
|
177 |
'the one which keeps the selection and in case of a ''SelectionInList'' model the list.'
|
|
178 |
|
|
179 |
#tabLabels
|
|
180 |
'a list or list holder which provides the labels assigned to the tabs.'
|
|
181 |
|
|
182 |
#foregroundColor
|
|
183 |
'set the foreground color'
|
|
184 |
|
|
185 |
#tabWidget
|
|
186 |
'select the tab style'
|
|
187 |
|
|
188 |
#valueChangeSelector
|
303
|
189 |
'called whenever the selection changed. If the selector ends with '':'' the method is invoked with the current selection.'
|
294
|
190 |
|
|
191 |
#doubleClickSelector
|
303
|
192 |
'define the double click action which is evaluated on double click in case of a none nil selection. If the selector ends with '':'' the method is invoked with the current selection.'
|
294
|
193 |
|
|
194 |
#fontMenu
|
|
195 |
'set the font for the widget'
|
|
196 |
|
|
197 |
#clientKey
|
|
198 |
'returns an application which provides the builder. On default the application itself is used.'
|
|
199 |
|
303
|
200 |
#selectionInTreeModel
|
|
201 |
'model which keeps the hierarchical list and the selection. The model returned must be kind of class SelectionInTree'
|
|
202 |
|
|
203 |
#selectionInTreeModelButton
|
|
204 |
'opens a hierarchical list editor which generates and installs a hierarchical list for the model.'
|
|
205 |
|
|
206 |
#isTriggerOnDown
|
|
207 |
'if true, the action is evaluated when the button is pressed'
|
|
208 |
|
294
|
209 |
#useIndex
|
|
210 |
'set/clear the useIndex flag. If set, the index of the selection is used otherwise the selected string.'
|
|
211 |
|
303
|
212 |
#borderWidth
|
|
213 |
'width of the border'
|
172
|
214 |
|
|
215 |
)
|
|
216 |
! !
|
|
217 |
|
164
|
218 |
!UISpecificationTool class methodsFor:'interface specs'!
|
|
219 |
|
|
220 |
windowSpec
|
|
221 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
222 |
|
|
223 |
"do not manually edit this - the painter/builder may not be able to
|
|
224 |
handle the specification if its corrupted."
|
|
225 |
|
|
226 |
"
|
|
227 |
UIPainter new openOnClass:UISpecificationTool andSelector:#windowSpec
|
|
228 |
UISpecificationTool new openInterface:#windowSpec
|
|
229 |
"
|
|
230 |
"UISpecificationTool open"
|
|
231 |
|
|
232 |
<resource: #canvas>
|
|
233 |
|
|
234 |
^
|
|
235 |
|
|
236 |
#(#FullSpec
|
|
237 |
#'window:'
|
|
238 |
#(#WindowSpec
|
|
239 |
#'name:' 'uIPainterView'
|
|
240 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
241 |
#'label:' 'unnamed canvas'
|
|
242 |
#'bounds:' #(#Rectangle 0 0 300 300)
|
|
243 |
)
|
|
244 |
#'component:'
|
|
245 |
#(#SpecCollection
|
|
246 |
#'collection:'
|
|
247 |
#(
|
|
248 |
#(#ViewSpec
|
|
249 |
#'name:' 'Frame'
|
|
250 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
251 |
)
|
|
252 |
)
|
|
253 |
)
|
|
254 |
)
|
|
255 |
! !
|
|
256 |
|
|
257 |
!UISpecificationTool methodsFor:'accessing'!
|
|
258 |
|
172
|
259 |
specification
|
|
260 |
"gets current edit specification
|
|
261 |
"
|
|
262 |
^ specification
|
|
263 |
|
|
264 |
|
|
265 |
!
|
|
266 |
|
|
267 |
specification:aSpec
|
|
268 |
"sets current edit specification
|
|
269 |
"
|
|
270 |
aSpec isNil ifTrue:[
|
|
271 |
specChannel := nil.
|
|
272 |
specification := nil.
|
|
273 |
aspects := nil.
|
|
274 |
] ifFalse:[
|
|
275 |
specification class == aSpec class ifTrue:[
|
|
276 |
specification := aSpec.
|
|
277 |
^ specChannel value:specification.
|
|
278 |
].
|
|
279 |
specification := aSpec.
|
|
280 |
aspects := IdentityDictionary new.
|
|
281 |
specChannel := specification asValue.
|
|
282 |
specification class addBindingsTo:aspects for:specification channel:specChannel.
|
|
283 |
aspects do:[:el| el addDependent:self ].
|
|
284 |
].
|
|
285 |
|
|
286 |
selection notNil ifTrue:[
|
|
287 |
(builder componentAt:#Frame) destroySubViews.
|
|
288 |
selection := nil.
|
|
289 |
].
|
|
290 |
! !
|
|
291 |
|
|
292 |
!UISpecificationTool methodsFor:'accessing channels'!
|
|
293 |
|
164
|
294 |
modifiedHolder:aValueHolder
|
|
295 |
"set the value holder set to true in case of modifying attributes
|
|
296 |
"
|
|
297 |
modifiedHolder notNil ifTrue:[
|
|
298 |
modifiedHolder removeDependent:self.
|
|
299 |
].
|
|
300 |
|
|
301 |
(modifiedHolder := aValueHolder) notNil ifTrue:[
|
|
302 |
modifiedHolder addDependent:self.
|
|
303 |
].
|
|
304 |
|
|
305 |
! !
|
|
306 |
|
|
307 |
!UISpecificationTool methodsFor:'bindings'!
|
|
308 |
|
|
309 |
aspectFor:aKey
|
|
310 |
"returns aspect for a key or nil
|
|
311 |
"
|
|
312 |
aspects notNil ifTrue:[
|
|
313 |
^ aspects at:aKey ifAbsent:nil
|
|
314 |
].
|
|
315 |
^ super aspectFor:aKey
|
|
316 |
|
172
|
317 |
! !
|
|
318 |
|
|
319 |
!UISpecificationTool methodsFor:'change & update'!
|
164
|
320 |
|
172
|
321 |
update
|
|
322 |
"reload specification
|
164
|
323 |
"
|
172
|
324 |
specChannel notNil ifTrue:[
|
|
325 |
specChannel value:specification.
|
|
326 |
]
|
164
|
327 |
|
|
328 |
|
|
329 |
!
|
|
330 |
|
|
331 |
update:something with:someArgument from:someone
|
|
332 |
"any attribute changed its state in the current specification
|
|
333 |
"
|
|
334 |
someone ~~ modifiedHolder ifTrue:[
|
|
335 |
modifiedHolder value ~~ true ifTrue:[
|
|
336 |
modifiedHolder value:true
|
|
337 |
]
|
|
338 |
]
|
|
339 |
|
|
340 |
|
|
341 |
! !
|
|
342 |
|
|
343 |
!UISpecificationTool methodsFor:'selection'!
|
|
344 |
|
|
345 |
selection:something
|
172
|
346 |
"selection changed
|
|
347 |
"
|
164
|
348 |
|slices idx spec frame|
|
|
349 |
|
172
|
350 |
specification notNil ifTrue:[
|
|
351 |
slices := specification class slices.
|
164
|
352 |
idx:= slices findFirst:[:aSlice| aSlice first = something ].
|
|
353 |
|
|
354 |
idx ~~ 0 ifTrue:[
|
172
|
355 |
spec := specification class perform:((slices at:idx) last).
|
164
|
356 |
].
|
|
357 |
].
|
|
358 |
|
172
|
359 |
spec ~= selection ifTrue:[
|
164
|
360 |
frame := builder componentAt:#Frame.
|
|
361 |
frame destroySubViews.
|
|
362 |
|
|
363 |
spec notNil ifTrue:[
|
|
364 |
builder buildFromSpec:spec in:frame.
|
|
365 |
frame allViewBackground:(frame viewBackground).
|
|
366 |
frame realizeAllSubViews.
|
|
367 |
]
|
|
368 |
].
|
172
|
369 |
selection := spec.
|
164
|
370 |
! !
|
|
371 |
|
|
372 |
!UISpecificationTool class methodsFor:'documentation'!
|
|
373 |
|
|
374 |
version
|
|
375 |
^ '$Header$'
|
|
376 |
! !
|