author | ca |
Fri, 20 Jun 1997 19:34:01 +0200 | |
changeset 167 | 01cbd385f878 |
parent 150 | 9f88bc99e0af |
child 182 | 5e0f65e92d95 |
permissions | -rw-r--r-- |
93 | 1 |
" |
2 |
COPYRIGHT (c) 1997 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 |
||
112 | 14 |
ApplicationModel subclass:#UISelectionPanel |
15 |
instanceVariableNames:'selection selectors receiver' |
|
93 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-UIPainter' |
|
19 |
! |
|
20 |
||
112 | 21 |
View subclass:#Canvas |
22 |
instanceVariableNames:'inputView selection specification lastClickPoint labelHolder |
|
23 |
nameHolder' |
|
24 |
classVariableNames:'' |
|
25 |
poolDictionaries:'' |
|
26 |
privateIn:UISelectionPanel |
|
27 |
! |
|
28 |
||
93 | 29 |
DropObject subclass:#DropSpecification |
30 |
instanceVariableNames:'' |
|
31 |
classVariableNames:'' |
|
32 |
poolDictionaries:'' |
|
112 | 33 |
privateIn:UISelectionPanel::Canvas |
93 | 34 |
! |
35 |
||
36 |
!UISelectionPanel class methodsFor:'documentation'! |
|
37 |
||
38 |
copyright |
|
39 |
" |
|
40 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
41 |
All Rights Reserved |
|
42 |
||
43 |
This software is furnished under a license and may be used |
|
44 |
only in accordance with the terms of that license and with the |
|
45 |
inclusion of the above copyright notice. This software may not |
|
46 |
be provided or otherwise made available to, or used by, any |
|
47 |
other person. No title to or ownership of the software is |
|
48 |
hereby transferred. |
|
49 |
" |
|
50 |
||
51 |
! |
|
52 |
||
53 |
documentation |
|
54 |
" |
|
55 |
implements a selection panel, keeping widgets which could be placed |
|
56 |
into the UIPainter by drag & drop. |
|
57 |
||
58 |
[author:] |
|
59 |
Claus Atzkern |
|
60 |
||
61 |
[see also:] |
|
62 |
TabView |
|
63 |
UIPainter |
|
104 | 64 |
|
65 |
[start with:] |
|
112 | 66 |
UISelectionPanel open |
104 | 67 |
|
93 | 68 |
" |
69 |
||
70 |
! ! |
|
71 |
||
72 |
!UISelectionPanel class methodsFor:'instance creation'! |
|
73 |
||
135 | 74 |
newDefault |
112 | 75 |
|appl| |
93 | 76 |
|
112 | 77 |
appl := self new. |
93 | 78 |
|
112 | 79 |
appl labels:#( 'Button & Toggle' |
93 | 80 |
'Panel' |
81 |
'Text' |
|
82 |
'View' |
|
83 |
'Menu & Combo' |
|
104 | 84 |
'Slider' |
93 | 85 |
) |
112 | 86 |
|
93 | 87 |
selectors:#( #buttonToggleSpec |
88 |
#panelSpec |
|
89 |
#textSpec |
|
90 |
#viewsSpec |
|
91 |
#menuComboSpec |
|
104 | 92 |
#sliderSpec |
93 | 93 |
) |
94 |
receiver:self. |
|
95 |
||
135 | 96 |
^ appl. |
97 |
! |
|
98 |
||
99 |
open |
|
100 |
|appl| |
|
101 |
||
102 |
appl := self newDefault. |
|
112 | 103 |
appl open. |
135 | 104 |
^ appl. |
93 | 105 |
! ! |
106 |
||
142 | 107 |
!UISelectionPanel class methodsFor:'interface specs'! |
93 | 108 |
|
109 |
buttonToggleSpec |
|
110 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
111 |
||
112 |
"do not manually edit this - the painter/builder may not be able to |
|
113 |
handle the specification if its corrupted." |
|
114 |
||
115 |
" |
|
116 |
UIPainter new openOnClass:UISelectionPanel andSelector:#buttonToggleSpec |
|
117 |
UISelectionPanel new openInterface:#buttonToggleSpec |
|
118 |
" |
|
119 |
||
120 |
<resource: #canvas> |
|
121 |
||
122 |
^ |
|
147 | 123 |
|
93 | 124 |
#(#FullSpec |
125 |
#'window:' |
|
126 |
#(#WindowSpec |
|
127 |
#'name:' 'uIPainterView' |
|
128 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
129 |
#'label:' 'unnamed' |
|
105 | 130 |
#'bounds:' #(#Rectangle 0 0 439 193) |
93 | 131 |
) |
132 |
#'component:' |
|
133 |
#(#SpecCollection |
|
134 |
#'collection:' |
|
135 |
#( |
|
136 |
#(#ArrowButtonSpec |
|
137 |
#'name:' 'ArrowButton up' |
|
105 | 138 |
#'layout:' #(#LayoutFrame 237 0 20 0 259 0 42 0) |
93 | 139 |
#'isTriggerOnDown:' true |
147 | 140 |
#'autoRepeat:' false |
93 | 141 |
#'direction:' #up |
142 |
) |
|
143 |
#(#ActionButtonSpec |
|
144 |
#'name:' 'Button' |
|
105 | 145 |
#'layout:' #(#LayoutFrame 20 0 20 0 119 0 42 0) |
93 | 146 |
#'label:' 'Button' |
147 |
#'isTriggerOnDown:' false |
|
147 | 148 |
#'autoRepeat:' false |
93 | 149 |
) |
150 |
#(#RadioButtonSpec |
|
151 |
#'name:' 'RadioButton' |
|
105 | 152 |
#'layout:' #(#LayoutFrame 127 0.0 20 0 226 0 42 0) |
93 | 153 |
#'label:' 'RadioButton' |
154 |
#'isTriggerOnDown:' true |
|
147 | 155 |
#'autoRepeat:' false |
93 | 156 |
#'showLamp:' true |
157 |
#'lampColor:' #(#Color 100.0 100.0 0.0) |
|
158 |
) |
|
159 |
#(#ArrowButtonSpec |
|
160 |
#'name:' 'ArrowButton down' |
|
105 | 161 |
#'layout:' #(#LayoutFrame 238 0 51 0 260 0 73 0) |
93 | 162 |
#'hasCharacterOrientedLabel:' false |
163 |
#'isTriggerOnDown:' true |
|
147 | 164 |
#'autoRepeat:' false |
93 | 165 |
#'direction:' #down |
166 |
) |
|
167 |
#(#ArrowButtonSpec |
|
168 |
#'name:' 'ArrowButton left' |
|
105 | 169 |
#'layout:' #(#LayoutFrame 238 0 82 0 260 0 104 0) |
93 | 170 |
#'hasCharacterOrientedLabel:' false |
171 |
#'isTriggerOnDown:' true |
|
147 | 172 |
#'autoRepeat:' false |
93 | 173 |
#'direction:' #left |
174 |
) |
|
175 |
#(#ArrowButtonSpec |
|
176 |
#'name:' 'ArrowButton right' |
|
105 | 177 |
#'layout:' #(#LayoutFrame 238 0 113 0 260 0 135 0) |
93 | 178 |
#'hasCharacterOrientedLabel:' false |
179 |
#'isTriggerOnDown:' true |
|
147 | 180 |
#'autoRepeat:' false |
93 | 181 |
#'direction:' #right |
182 |
) |
|
183 |
#(#CheckToggleSpec |
|
184 |
#'name:' 'CheckToggle' |
|
105 | 185 |
#'layout:' #(#LayoutFrame 297 0 82 0 317 0 102 0) |
93 | 186 |
#'isTriggerOnDown:' true |
147 | 187 |
#'autoRepeat:' false |
93 | 188 |
#'showLamp:' false |
189 |
#'lampColor:' #(#Color 100.0 100.0 0.0) |
|
190 |
) |
|
191 |
#(#ToggleSpec |
|
192 |
#'name:' 'Toggle' |
|
105 | 193 |
#'layout:' #(#LayoutFrame 297 0 20 0 396 0 42 0) |
93 | 194 |
#'label:' 'Toggle' |
195 |
#'isTriggerOnDown:' true |
|
147 | 196 |
#'autoRepeat:' false |
93 | 197 |
#'showLamp:' true |
198 |
#'lampColor:' #(#Color 100.0 100.0 0.0) |
|
199 |
) |
|
200 |
#(#CheckBoxSpec |
|
201 |
#'name:' 'CheckBox' |
|
147 | 202 |
#'layout:' #(#LayoutFrame 297 0 51 0 398 0 73 0) |
93 | 203 |
#'label:' 'CheckBox' |
204 |
) |
|
105 | 205 |
#(#ActionButtonSpec |
206 |
#'name:' 'ok' |
|
207 |
#'layout:' #(#LayoutFrame 20 0 51 0 119 0 73 0) |
|
208 |
#'label:' 'ok' |
|
209 |
#'model:' #accept |
|
210 |
#'isTriggerOnDown:' false |
|
147 | 211 |
#'autoRepeat:' false |
105 | 212 |
) |
213 |
#(#ActionButtonSpec |
|
214 |
#'name:' 'cancel' |
|
215 |
#'layout:' #(#LayoutFrame 20 0 82 0 119 0 104 0) |
|
216 |
#'label:' 'cancel' |
|
217 |
#'model:' #cancel |
|
218 |
#'isTriggerOnDown:' false |
|
147 | 219 |
#'autoRepeat:' false |
105 | 220 |
) |
221 |
#(#ActionButtonSpec |
|
222 |
#'name:' 'help' |
|
223 |
#'layout:' #(#LayoutFrame 20 0 113 0 119 0 135 0) |
|
224 |
#'label:' 'help' |
|
225 |
#'model:' #help |
|
226 |
#'isTriggerOnDown:' false |
|
147 | 227 |
#'autoRepeat:' false |
105 | 228 |
) |
93 | 229 |
) |
230 |
) |
|
231 |
) |
|
232 |
! |
|
233 |
||
142 | 234 |
menuComboSpec |
235 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
236 |
||
237 |
"do not manually edit this - the painter/builder may not be able to |
|
238 |
handle the specification if its corrupted." |
|
239 |
||
240 |
" |
|
241 |
UIPainter new openOnClass:UISelectionPanel andSelector:#menuComboSpec |
|
242 |
UISelectionPanel new openInterface:#menuComboSpec |
|
243 |
" |
|
244 |
||
245 |
<resource: #canvas> |
|
246 |
||
247 |
^ |
|
248 |
||
249 |
#(#FullSpec |
|
250 |
#'window:' |
|
251 |
#(#WindowSpec |
|
252 |
#'name:' 'uIPainterView' |
|
253 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
254 |
#'label:' 'unnamed' |
|
255 |
#'bounds:' #(#Rectangle 0 0 464 253) |
|
256 |
) |
|
257 |
#'component:' |
|
258 |
#(#SpecCollection |
|
259 |
#'collection:' |
|
260 |
#( |
|
261 |
#(#ComboBoxSpec |
|
262 |
#'name:' 'ComboBox' |
|
147 | 263 |
#'layout:' #(#LayoutFrame 20 0 14 0 123 0 34 0) |
142 | 264 |
) |
265 |
#(#ComboListSpec |
|
266 |
#'name:' 'ComboList' |
|
147 | 267 |
#'layout:' #(#LayoutFrame 20 0 71 0 123 0 91 0) |
268 |
#'useIndex:' false |
|
142 | 269 |
) |
270 |
#(#PopUpListSpec |
|
271 |
#'name:' 'PopUpList' |
|
147 | 272 |
#'layout:' #(#LayoutFrame 147 0 14 0 250 0 36 0) |
142 | 273 |
#'label:' 'PopUpList' |
147 | 274 |
#'useIndex:' false |
142 | 275 |
) |
276 |
#(#MenuPanelSpec |
|
277 |
#'name:' 'MenuPanel' |
|
147 | 278 |
#'layout:' #(#LayoutFrame 147 0 71 0 250 0 91 0) |
142 | 279 |
) |
280 |
#(#TabViewSpec |
|
281 |
#'name:' 'TabView' |
|
147 | 282 |
#'layout:' #(#LayoutFrame 269 0 14 0 409 0 50 0) |
142 | 283 |
#'tabWidget:' #Window |
284 |
) |
|
285 |
#(#NoteBookViewSpec |
|
286 |
#'name:' 'noteBookView' |
|
147 | 287 |
#'layout:' #(#LayoutFrame 269 0 71 0 409 0 159 0) |
288 |
#'tabWidget:' #Window |
|
142 | 289 |
) |
290 |
#(#LabelSpec |
|
291 |
#'name:' 'label1' |
|
147 | 292 |
#'layout:' #(#LayoutFrame 150 0 73 0 236 0 89 0) |
142 | 293 |
#'label:' 'MenuPanel' |
167 | 294 |
#'style:' |
295 |
#(#FontDescription |
|
296 |
#helvetica #medium |
|
297 |
#roman #'10' |
|
298 |
) |
|
147 | 299 |
#'adjust:' #left |
142 | 300 |
#'canUIDrag:' false |
301 |
) |
|
302 |
) |
|
303 |
) |
|
304 |
) |
|
305 |
! |
|
306 |
||
93 | 307 |
panelSpec |
308 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
309 |
||
310 |
"do not manually edit this - the painter/builder may not be able to |
|
311 |
handle the specification if its corrupted." |
|
312 |
||
313 |
" |
|
314 |
UIPainter new openOnClass:UISelectionPanel andSelector:#panelSpec |
|
315 |
UISelectionPanel new openInterface:#panelSpec |
|
316 |
" |
|
317 |
||
318 |
<resource: #canvas> |
|
319 |
||
320 |
^ |
|
112 | 321 |
|
93 | 322 |
#(#FullSpec |
323 |
#'window:' |
|
324 |
#(#WindowSpec |
|
325 |
#'name:' 'uIPainterView' |
|
326 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
327 |
#'label:' 'unnamed' |
|
105 | 328 |
#'bounds:' #(#Rectangle 0 0 475 136) |
93 | 329 |
) |
330 |
#'component:' |
|
331 |
#(#SpecCollection |
|
332 |
#'collection:' |
|
333 |
#( |
|
334 |
#(#HorizontalPanelViewSpec |
|
335 |
#'name:' 'HorizontalPanelView' |
|
105 | 336 |
#'layout:' #(#LayoutFrame 20 0 20 0 104 0 105 0) |
93 | 337 |
#'component:' |
338 |
#(#SpecCollection |
|
339 |
#'collection:' |
|
340 |
#( |
|
112 | 341 |
#(#LabelSpec |
342 |
#'name:' 'label1' |
|
93 | 343 |
#'label:' 'A' |
112 | 344 |
#'level:' 2 |
345 |
#'extent:' #(#Point 23 23) |
|
93 | 346 |
#'canUIDrag:' false |
347 |
) |
|
112 | 348 |
#(#LabelSpec |
349 |
#'name:' 'label2' |
|
93 | 350 |
#'label:' 'B' |
112 | 351 |
#'level:' 2 |
352 |
#'extent:' #(#Point 23 23) |
|
104 | 353 |
#'canUIDrag:' false |
354 |
) |
|
112 | 355 |
#(#LabelSpec |
356 |
#'name:' 'label3' |
|
104 | 357 |
#'label:' 'C' |
112 | 358 |
#'level:' 2 |
359 |
#'extent:' #(#Point 23 23) |
|
93 | 360 |
#'canUIDrag:' false |
361 |
) |
|
362 |
) |
|
363 |
) |
|
364 |
#'horizontalLayout:' #center |
|
365 |
#'verticalLayout:' #center |
|
366 |
#'horizontalSpace:' 3 |
|
367 |
#'verticalSpace:' 3 |
|
368 |
) |
|
369 |
#(#VariableHorizontalPanelSpec |
|
370 |
#'name:' 'VariableHorizontalPanel' |
|
112 | 371 |
#'layout:' #(#LayoutFrame 249 0 20 0 337 0 105 0) |
93 | 372 |
#'component:' |
373 |
#(#SpecCollection |
|
374 |
#'collection:' |
|
375 |
#( |
|
112 | 376 |
#(#LabelSpec |
377 |
#'name:' 'label4' |
|
93 | 378 |
#'label:' 'A' |
112 | 379 |
#'level:' 2 |
93 | 380 |
#'canUIDrag:' false |
381 |
) |
|
112 | 382 |
#(#LabelSpec |
383 |
#'name:' 'label5' |
|
93 | 384 |
#'label:' 'B' |
112 | 385 |
#'level:' 2 |
93 | 386 |
#'canUIDrag:' false |
387 |
) |
|
388 |
) |
|
389 |
) |
|
390 |
) |
|
391 |
#(#VerticalPanelViewSpec |
|
392 |
#'name:' 'VerticalPanelView' |
|
112 | 393 |
#'layout:' #(#LayoutFrame 110 0 20 0 168 0 105 0) |
93 | 394 |
#'component:' |
395 |
#(#SpecCollection |
|
396 |
#'collection:' |
|
397 |
#( |
|
112 | 398 |
#(#LabelSpec |
399 |
#'name:' 'label6' |
|
93 | 400 |
#'label:' 'A' |
112 | 401 |
#'level:' 2 |
402 |
#'extent:' #(#Point 23 23) |
|
93 | 403 |
#'canUIDrag:' false |
404 |
) |
|
112 | 405 |
#(#LabelSpec |
406 |
#'name:' 'label7' |
|
93 | 407 |
#'label:' 'B' |
112 | 408 |
#'level:' 2 |
409 |
#'extent:' #(#Point 23 23) |
|
104 | 410 |
#'canUIDrag:' false |
411 |
) |
|
112 | 412 |
#(#LabelSpec |
413 |
#'name:' 'label8' |
|
104 | 414 |
#'label:' 'C' |
112 | 415 |
#'level:' 2 |
416 |
#'extent:' #(#Point 23 23) |
|
93 | 417 |
#'canUIDrag:' false |
418 |
) |
|
419 |
) |
|
420 |
) |
|
421 |
#'horizontalLayout:' #center |
|
422 |
#'verticalLayout:' #center |
|
423 |
#'horizontalSpace:' 3 |
|
424 |
#'verticalSpace:' 3 |
|
425 |
) |
|
426 |
#(#VariableVerticalPanelSpec |
|
427 |
#'name:' 'VariableVerticalPanel' |
|
112 | 428 |
#'layout:' #(#LayoutFrame 342 0 20 0 426 0 105 0) |
93 | 429 |
#'component:' |
430 |
#(#SpecCollection |
|
431 |
#'collection:' |
|
432 |
#( |
|
112 | 433 |
#(#LabelSpec |
434 |
#'name:' 'label9' |
|
93 | 435 |
#'label:' 'A' |
112 | 436 |
#'level:' 2 |
93 | 437 |
#'canUIDrag:' false |
438 |
) |
|
112 | 439 |
#(#LabelSpec |
440 |
#'name:' 'label10' |
|
93 | 441 |
#'label:' 'B' |
112 | 442 |
#'level:' 2 |
93 | 443 |
#'canUIDrag:' false |
444 |
) |
|
445 |
) |
|
446 |
) |
|
447 |
) |
|
104 | 448 |
#(#PanelViewSpec |
449 |
#'name:' 'PanelView' |
|
112 | 450 |
#'layout:' #(#LayoutFrame 174 0 20 0 232 0 105 0) |
104 | 451 |
#'component:' |
452 |
#(#SpecCollection |
|
453 |
#'collection:' |
|
454 |
#( |
|
112 | 455 |
#(#LabelSpec |
456 |
#'name:' 'label11' |
|
104 | 457 |
#'label:' 'A' |
112 | 458 |
#'level:' 2 |
459 |
#'extent:' #(#Point 23 23) |
|
104 | 460 |
#'canUIDrag:' false |
461 |
) |
|
112 | 462 |
#(#LabelSpec |
463 |
#'name:' 'label12' |
|
104 | 464 |
#'label:' 'B' |
112 | 465 |
#'level:' 2 |
466 |
#'extent:' #(#Point 23 23) |
|
104 | 467 |
#'canUIDrag:' false |
468 |
) |
|
112 | 469 |
#(#LabelSpec |
470 |
#'name:' 'label13' |
|
104 | 471 |
#'label:' 'C' |
112 | 472 |
#'level:' 2 |
473 |
#'extent:' #(#Point 23 23) |
|
104 | 474 |
#'canUIDrag:' false |
475 |
) |
|
112 | 476 |
#(#LabelSpec |
477 |
#'name:' 'label14' |
|
104 | 478 |
#'label:' 'D' |
112 | 479 |
#'level:' 2 |
480 |
#'extent:' #(#Point 23 23) |
|
104 | 481 |
#'canUIDrag:' false |
482 |
) |
|
112 | 483 |
#(#LabelSpec |
484 |
#'name:' 'label15' |
|
104 | 485 |
#'label:' 'E' |
112 | 486 |
#'level:' 2 |
487 |
#'extent:' #(#Point 23 23) |
|
104 | 488 |
#'canUIDrag:' false |
489 |
) |
|
490 |
) |
|
491 |
) |
|
492 |
#'horizontalLayout:' #fitSpace |
|
493 |
#'verticalLayout:' #fitSpace |
|
494 |
#'horizontalSpace:' 3 |
|
495 |
#'verticalSpace:' 3 |
|
496 |
) |
|
93 | 497 |
) |
498 |
) |
|
499 |
) |
|
112 | 500 |
|
93 | 501 |
! |
502 |
||
104 | 503 |
sliderSpec |
93 | 504 |
"this window spec was automatically generated by the ST/X UIPainter" |
505 |
||
506 |
"do not manually edit this - the painter/builder may not be able to |
|
507 |
handle the specification if its corrupted." |
|
508 |
||
509 |
" |
|
104 | 510 |
UIPainter new openOnClass:UISelectionPanel andSelector:#sliderSpec |
511 |
UISelectionPanel new openInterface:#sliderSpec |
|
93 | 512 |
" |
513 |
||
514 |
<resource: #canvas> |
|
515 |
||
516 |
^ |
|
150 | 517 |
|
93 | 518 |
#(#FullSpec |
519 |
#'window:' |
|
520 |
#(#WindowSpec |
|
521 |
#'name:' 'uIPainterView' |
|
522 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
523 |
#'label:' 'unnamed' |
|
105 | 524 |
#'bounds:' #(#Rectangle 0 0 445 162) |
93 | 525 |
) |
526 |
#'component:' |
|
527 |
#(#SpecCollection |
|
528 |
#'collection:' |
|
529 |
#( |
|
104 | 530 |
#(#SliderSpec |
531 |
#'name:' 'Vertical Slider' |
|
105 | 532 |
#'layout:' #(#LayoutFrame 20 0 20 0 38 0 108 0) |
104 | 533 |
#'orientation:' #vertical |
93 | 534 |
) |
104 | 535 |
#(#ThumbWheelSpec |
536 |
#'name:' 'Vertical ThumbWheel' |
|
105 | 537 |
#'layout:' #(#LayoutFrame 48 0 20 0 63 0 108 0) |
104 | 538 |
#'orientation:' #vertical |
539 |
#'start:' 0 |
|
540 |
#'stop:' 360 |
|
93 | 541 |
) |
104 | 542 |
#(#ThumbWheelSpec |
543 |
#'name:' 'Horizontal ThumbWheel' |
|
105 | 544 |
#'layout:' #(#LayoutFrame 102 0 20 0 191 0 35 0) |
104 | 545 |
#'orientation:' #horizontal |
546 |
#'start:' 0 |
|
547 |
#'stop:' 360 |
|
93 | 548 |
) |
549 |
#(#SliderSpec |
|
104 | 550 |
#'name:' 'Horizontal Slider' |
150 | 551 |
#'layout:' #(#LayoutFrame 102 0 53 0 191 0 71 0) |
104 | 552 |
#'orientation:' #horizontal |
553 |
#'start:' 0 |
|
554 |
#'stop:' 100 |
|
93 | 555 |
) |
150 | 556 |
#(#ProgressIndicatorSpec |
557 |
#'name:' 'Progress Indicator' |
|
558 |
#'layout:' #(#LayoutFrame 102 0 90 0 191 0 108 0) |
|
559 |
#'showPercentage:' true |
|
560 |
) |
|
93 | 561 |
) |
562 |
) |
|
563 |
) |
|
564 |
! |
|
565 |
||
97 | 566 |
textSpec |
567 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
568 |
||
569 |
"do not manually edit this - the painter/builder may not be able to |
|
570 |
handle the specification if its corrupted." |
|
571 |
||
572 |
" |
|
573 |
UIPainter new openOnClass:UISelectionPanel andSelector:#textSpec |
|
574 |
UISelectionPanel new openInterface:#textSpec |
|
575 |
" |
|
576 |
||
577 |
<resource: #canvas> |
|
578 |
||
579 |
^ |
|
139 | 580 |
|
97 | 581 |
#(#FullSpec |
582 |
#'window:' |
|
583 |
#(#WindowSpec |
|
584 |
#'name:' 'uIPainterView' |
|
585 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
586 |
#'label:' 'unnamed' |
|
139 | 587 |
#'bounds:' #(#Rectangle 0 0 467 207) |
97 | 588 |
) |
589 |
#'component:' |
|
590 |
#(#SpecCollection |
|
591 |
#'collection:' |
|
592 |
#( |
|
593 |
#(#InputFieldSpec |
|
594 |
#'name:' 'EditField' |
|
139 | 595 |
#'layout:' #(#LayoutFrame 222 0 109 0 401 0 131 0) |
97 | 596 |
) |
597 |
#(#LabelSpec |
|
598 |
#'name:' 'Text Label' |
|
139 | 599 |
#'layout:' #(#LayoutFrame 222 0 138 0 401 0 160 0) |
147 | 600 |
#'label:' '' |
97 | 601 |
) |
602 |
#(#TextEditorSpec |
|
603 |
#'name:' 'EditTextView' |
|
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
604 |
#'layout:' #(#LayoutFrame 20 0 13 0 199 0 101 0) |
139 | 605 |
#'hasHorizontalScrollBar:' true |
606 |
#'hasVerticalScrollBar:' true |
|
607 |
) |
|
608 |
#(#SequenceViewSpec |
|
609 |
#'name:' 'SelectionInListView' |
|
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
610 |
#'layout:' #(#LayoutFrame 222 0 13 0 401 0 101 0) |
139 | 611 |
#'hasHorizontalScrollBar:' true |
612 |
#'hasVerticalScrollBar:' true |
|
613 |
) |
|
614 |
#(#HTMLViewSpec |
|
615 |
#'name:' 'HTMLView' |
|
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
616 |
#'layout:' #(#LayoutFrame 20 0 109 0 199 0 197 0) |
97 | 617 |
#'hasHorizontalScrollBar:' true |
618 |
#'hasVerticalScrollBar:' true |
|
619 |
) |
|
139 | 620 |
#(#LabelSpec |
621 |
#'name:' 'HTMLViewLabel' |
|
167 | 622 |
#'layout:' #(#LayoutFrame 93 0 179 0 183 0 193 0) |
139 | 623 |
#'label:' 'HTMLView' |
167 | 624 |
#'style:' |
625 |
#(#FontDescription |
|
626 |
#helvetica #medium |
|
627 |
#roman #'10' |
|
628 |
) |
|
147 | 629 |
#'adjust:' #left |
139 | 630 |
#'canUIDrag:' false |
97 | 631 |
) |
139 | 632 |
#(#LabelSpec |
633 |
#'name:' 'label1' |
|
167 | 634 |
#'layout:' #(#LayoutFrame 93 0 83 0 183 0 97 0) |
139 | 635 |
#'label:' 'EditText' |
167 | 636 |
#'style:' |
637 |
#(#FontDescription |
|
638 |
#helvetica #medium |
|
639 |
#roman #'10' |
|
640 |
) |
|
147 | 641 |
#'adjust:' #left |
139 | 642 |
#'canUIDrag:' false |
97 | 643 |
) |
139 | 644 |
#(#LabelSpec |
645 |
#'name:' 'label2' |
|
167 | 646 |
#'layout:' #(#LayoutFrame 295 0 83 0 387 0 97 0) |
139 | 647 |
#'label:' 'SelectionInList' |
167 | 648 |
#'style:' |
649 |
#(#FontDescription |
|
650 |
#helvetica #medium |
|
651 |
#roman #'10' |
|
652 |
) |
|
147 | 653 |
#'adjust:' #left |
654 |
#'canUIDrag:' false |
|
655 |
) |
|
656 |
#(#LabelSpec |
|
657 |
#'name:' 'labelInLabel' |
|
167 | 658 |
#'layout:' #(#LayoutFrame 226 0 142 0 275 0 156 0) |
147 | 659 |
#'label:' 'Label' |
167 | 660 |
#'style:' |
661 |
#(#FontDescription |
|
662 |
#helvetica #medium |
|
663 |
#roman #'10' |
|
664 |
) |
|
147 | 665 |
#'adjust:' #left |
139 | 666 |
#'canUIDrag:' false |
98 | 667 |
) |
97 | 668 |
) |
669 |
) |
|
670 |
) |
|
671 |
! |
|
672 |
||
93 | 673 |
viewsSpec |
674 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
675 |
||
676 |
"do not manually edit this - the painter/builder may not be able to |
|
677 |
handle the specification if its corrupted." |
|
678 |
||
679 |
" |
|
680 |
UIPainter new openOnClass:UISelectionPanel andSelector:#viewsSpec |
|
681 |
UISelectionPanel new openInterface:#viewsSpec |
|
682 |
" |
|
683 |
||
684 |
<resource: #canvas> |
|
685 |
||
686 |
^ |
|
135 | 687 |
|
93 | 688 |
#(#FullSpec |
689 |
#'window:' |
|
690 |
#(#WindowSpec |
|
691 |
#'name:' 'uIPainterView' |
|
692 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
693 |
#'label:' 'unnamed' |
|
112 | 694 |
#'bounds:' #(#Rectangle 0 0 485 245) |
93 | 695 |
) |
696 |
#'component:' |
|
697 |
#(#SpecCollection |
|
698 |
#'collection:' |
|
699 |
#( |
|
700 |
#(#FramedBoxSpec |
|
701 |
#'name:' 'FramedBox' |
|
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
702 |
#'layout:' #(#LayoutFrame 16 0 14 0 177 0 104 0) |
104 | 703 |
#'label:' 'FramedBox' |
93 | 704 |
#'labelPosition:' #topCenter |
705 |
) |
|
706 |
#(#ViewSpec |
|
98 | 707 |
#'name:' 'View' |
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
708 |
#'layout:' #(#LayoutFrame 14 0 116 0 175 0 188 0) |
93 | 709 |
) |
710 |
#(#SubCanvasSpec |
|
98 | 711 |
#'name:' 'SubCanvas' |
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
712 |
#'layout:' #(#LayoutFrame 199 0 14 0 360 0 104 0) |
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
713 |
#'hasHorizontalScrollBar:' true |
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
714 |
#'hasVerticalScrollBar:' true |
93 | 715 |
) |
716 |
#(#LabelSpec |
|
112 | 717 |
#'name:' 'subCanvasLabel' |
147 | 718 |
#'layout:' #(#LayoutFrame 272 0 86 0 343 0 100 0) |
93 | 719 |
#'label:' 'SubCanvas' |
167 | 720 |
#'style:' |
721 |
#(#FontDescription |
|
722 |
#helvetica #medium |
|
723 |
#roman #'10' |
|
724 |
) |
|
147 | 725 |
#'adjust:' #left |
93 | 726 |
#'canUIDrag:' false |
727 |
) |
|
728 |
#(#DividerSpec |
|
729 |
#'name:' 'Horizontal Seperator' |
|
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
730 |
#'layout:' #(#LayoutFrame 199 0 116 0 360 0 120 0) |
93 | 731 |
#'orientation:' #horizontal |
732 |
) |
|
733 |
#(#DividerSpec |
|
734 |
#'name:' 'Vertical Seperator' |
|
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
735 |
#'layout:' #(#LayoutFrame 356 0 116 0 360 0 188 0) |
93 | 736 |
#'orientation:' #vertical |
737 |
) |
|
104 | 738 |
#(#LabelSpec |
112 | 739 |
#'name:' 'viewLabel' |
147 | 740 |
#'layout:' #(#LayoutFrame 19 0 118 0 70 0 135 0) |
112 | 741 |
#'label:' 'View' |
167 | 742 |
#'style:' |
743 |
#(#FontDescription |
|
744 |
#helvetica #medium |
|
745 |
#roman #'10' |
|
746 |
) |
|
147 | 747 |
#'adjust:' #left |
104 | 748 |
#'canUIDrag:' false |
749 |
) |
|
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
750 |
#(#LabelSpec |
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
751 |
#'name:' 'Seperators' |
147 | 752 |
#'layout:' #(#LayoutFrame 199 0 125 0 270 0 143 0) |
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
753 |
#'label:' 'Seperators' |
167 | 754 |
#'style:' |
755 |
#(#FontDescription |
|
756 |
#helvetica #medium |
|
757 |
#roman #'10' |
|
758 |
) |
|
147 | 759 |
#'adjust:' #left |
143
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
760 |
#'canUIDrag:' false |
9add9e2609d9
change SubCanvasSpec; have to update caused by new attributes
ca
parents:
142
diff
changeset
|
761 |
) |
150 | 762 |
#(#RegionSpec |
763 |
#'name:' 'Region' |
|
167 | 764 |
#'layout:' #(#LayoutFrame 373 0 14 0 473 0 104 0) |
150 | 765 |
#'lineWidth:' 2 |
766 |
#'regionType:' #ellipse |
|
767 |
) |
|
768 |
#(#LabelSpec |
|
769 |
#'name:' 'RegionLabel' |
|
770 |
#'layout:' #(#LayoutFrame 388 0 50 0 459 0 68 0) |
|
771 |
#'label:' 'Region' |
|
167 | 772 |
#'style:' |
773 |
#(#FontDescription |
|
774 |
#helvetica #medium |
|
775 |
#roman #'10' |
|
776 |
) |
|
777 |
#'canUIDrag:' false |
|
778 |
) |
|
779 |
#(#UISubSpecification |
|
780 |
#'name:' 'UISubSpecification' |
|
781 |
#'layout:' #(#LayoutFrame 373 0 116 0 473 0 188 0) |
|
782 |
) |
|
783 |
#(#LabelSpec |
|
784 |
#'name:' 'SubSpec label 1' |
|
785 |
#'layout:' #(#LayoutFrame 403 0 132 0 442 0 150 0) |
|
786 |
#'label:' 'UISub-' |
|
787 |
#'style:' |
|
788 |
#(#FontDescription |
|
789 |
#helvetica #medium |
|
790 |
#roman #'10' |
|
791 |
) |
|
792 |
#'canUIDrag:' false |
|
793 |
) |
|
794 |
#(#LabelSpec |
|
795 |
#'name:' 'SubSpec label 2' |
|
796 |
#'layout:' #(#LayoutFrame 383 0 146 0 455 0 164 0) |
|
797 |
#'label:' 'Specification' |
|
798 |
#'style:' |
|
799 |
#(#FontDescription |
|
800 |
#helvetica #medium |
|
801 |
#roman #'10' |
|
802 |
) |
|
150 | 803 |
#'canUIDrag:' false |
804 |
) |
|
93 | 805 |
) |
806 |
) |
|
807 |
) |
|
139 | 808 |
! |
112 | 809 |
|
810 |
windowSpec |
|
811 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
812 |
||
813 |
"do not manually edit this - the painter/builder may not be able to |
|
814 |
handle the specification if its corrupted." |
|
815 |
||
816 |
" |
|
817 |
UIPainter new openOnClass:UISelectionPanel andSelector:#windowSpec |
|
818 |
UISelectionPanel new openInterface:#windowSpec |
|
819 |
" |
|
820 |
"UISelectionPanel open" |
|
821 |
||
822 |
<resource: #canvas> |
|
823 |
||
824 |
^ |
|
825 |
||
826 |
#(#FullSpec |
|
827 |
#'window:' |
|
828 |
#(#WindowSpec |
|
829 |
#'name:' 'uIPainterView' |
|
830 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
125 | 831 |
#'label:' 'Component Gallery' |
112 | 832 |
#'bounds:' #(#Rectangle 0 0 480 260) |
833 |
) |
|
834 |
#'component:' |
|
835 |
#(#SpecCollection |
|
836 |
#'collection:' |
|
837 |
#( |
|
838 |
#(#LabelSpec |
|
839 |
#'name:' 'label1' |
|
840 |
#'layout:' #(#LayoutFrame 0 0.0 -20 1.0 0 1.0 0 1.0) |
|
841 |
#'label:' 'selection' |
|
142 | 842 |
#'labelChannel:' #nameOfObject |
112 | 843 |
#'level:' 2 |
844 |
#'hasCharacterOrientedLabel:' false |
|
845 |
) |
|
846 |
#(#NoteBookViewSpec |
|
847 |
#'name:' 'noteBookView1' |
|
848 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -21 1.0) |
|
142 | 849 |
#'menu:' #tabList |
112 | 850 |
#'model:' #tabModel |
851 |
#'tabWidget:' #Window |
|
852 |
#'useIndex:' true |
|
853 |
#'level:' 2 |
|
854 |
#'canvas:' #canvas |
|
855 |
) |
|
856 |
) |
|
857 |
) |
|
858 |
) |
|
93 | 859 |
! ! |
860 |
||
861 |
!UISelectionPanel methodsFor:'accessing'! |
|
862 |
||
112 | 863 |
labels:loLabels selectors:loSelectors receiver:aReceiver |
864 |
selectors := loSelectors. |
|
865 |
receiver := aReceiver. |
|
866 |
(self tabList) value:loLabels. |
|
867 |
||
868 |
! ! |
|
869 |
||
870 |
!UISelectionPanel methodsFor:'aspects'! |
|
871 |
||
872 |
canvas |
|
873 |
|holder| |
|
874 |
||
875 |
(holder := builder bindingAt:#canvas) isNil ifTrue:[ |
|
876 |
builder aspectAt:#canvas put:(holder := Canvas new) |
|
877 |
]. |
|
878 |
^ holder |
|
879 |
! |
|
880 |
||
881 |
nameOfObject |
|
882 |
|holder canvas| |
|
883 |
||
884 |
(holder := builder bindingAt:#nameOfObject) isNil ifTrue:[ |
|
885 |
builder aspectAt:#nameOfObject put:(holder := ValueHolder new). |
|
886 |
canvas := self canvas. |
|
887 |
canvas nameHolder:holder. |
|
888 |
]. |
|
889 |
^ holder |
|
890 |
! |
|
891 |
||
892 |
tabList |
|
893 |
"returns list of tab-labels |
|
93 | 894 |
" |
112 | 895 |
|holder| |
896 |
||
897 |
(holder := builder bindingAt:#tabList) isNil ifTrue:[ |
|
898 |
builder aspectAt:#tabList put:(holder := ValueHolder new). |
|
93 | 899 |
]. |
112 | 900 |
^ holder |
93 | 901 |
! |
902 |
||
112 | 903 |
tabModel |
904 |
"returns my model; catching select notifications |
|
905 |
" |
|
906 |
|holder| |
|
907 |
||
908 |
(holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
|
909 |
holder := AspectAdaptor new subject:self; forAspect:#selection. |
|
910 |
builder aspectAt:#tabModel put:holder. |
|
911 |
]. |
|
912 |
^ holder |
|
913 |
||
914 |
! ! |
|
915 |
||
916 |
!UISelectionPanel methodsFor:'selection'! |
|
917 |
||
918 |
selection |
|
919 |
^ selection |
|
920 |
! |
|
921 |
||
922 |
selection:aValue |
|
147 | 923 |
|spec canvas| |
112 | 924 |
|
139 | 925 |
(aValue isNil or:[aValue == 0]) ifTrue:[ |
926 |
^ self |
|
927 |
]. |
|
112 | 928 |
selection ~~ aValue ifTrue:[ |
929 |
(selection := aValue) notNil ifTrue:[ |
|
930 |
selectors size >= aValue ifTrue:[ |
|
931 |
spec := receiver perform:(selectors at:selection) |
|
932 |
] |
|
933 |
]. |
|
147 | 934 |
canvas := builder aspectAt:#canvas. |
935 |
canvas specification:spec. |
|
112 | 936 |
]. |
937 |
! ! |
|
938 |
||
939 |
!UISelectionPanel::Canvas methodsFor:'accessing'! |
|
940 |
||
941 |
nameHolder:aValueHolder |
|
942 |
"set value holder which keeps the name of the object |
|
943 |
under the cursor or selected |
|
944 |
" |
|
945 |
nameHolder := aValueHolder |
|
946 |
! |
|
947 |
||
948 |
specification:aSpecOrSpecArray |
|
949 |
"load a new specification |
|
93 | 950 |
" |
951 |
|builder| |
|
952 |
||
953 |
self selection:nil. |
|
954 |
||
112 | 955 |
self subViews copy do:[:aSubView| |
93 | 956 |
aSubView ~~ inputView ifTrue:[ |
957 |
aSubView destroy |
|
958 |
] |
|
959 |
]. |
|
960 |
||
112 | 961 |
aSpecOrSpecArray notNil ifTrue:[ |
962 |
specification := UISpecification from:aSpecOrSpecArray. |
|
93 | 963 |
builder := UIBuilder new. |
112 | 964 |
specification buildViewFor:builder in:self. |
147 | 965 |
|
966 |
subViews do:[:v| |
|
967 |
(v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[ |
|
968 |
v borderWidth:1. |
|
969 |
] |
|
970 |
]. |
|
971 |
||
112 | 972 |
self realizeAllSubViews. |
93 | 973 |
inputView raise. |
974 |
] ifFalse:[ |
|
112 | 975 |
specification := nil |
93 | 976 |
] |
977 |
||
978 |
! ! |
|
979 |
||
112 | 980 |
!UISelectionPanel::Canvas methodsFor:'drag & drop'! |
93 | 981 |
|
982 |
buildSpecFrom:aSpec |
|
983 |
"build spec out of spec |
|
984 |
" |
|
985 |
|spec comp coll| |
|
986 |
||
987 |
(aSpec notNil and:[aSpec canUIDrag]) ifFalse:[ |
|
988 |
^ nil |
|
989 |
]. |
|
990 |
||
112 | 991 |
spec := aSpec copy. |
992 |
||
93 | 993 |
(aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[ |
112 | 994 |
^ spec |
93 | 995 |
]. |
996 |
comp := aSpec component. |
|
997 |
spec component:nil. |
|
998 |
||
999 |
comp canUIDrag ifFalse:[ |
|
1000 |
^ spec |
|
1001 |
]. |
|
1002 |
coll := OrderedCollection new. |
|
1003 |
||
1004 |
comp do:[:anEntry||spc| |
|
1005 |
(spc := self buildSpecFrom:anEntry) notNil ifTrue:[ |
|
1006 |
coll add:spc |
|
1007 |
] |
|
1008 |
]. |
|
1009 |
coll isEmpty ifTrue:[ |
|
1010 |
^ spec |
|
1011 |
]. |
|
1012 |
comp := comp copy. |
|
1013 |
comp collection:coll. |
|
1014 |
spec component:comp. |
|
1015 |
^ spec |
|
112 | 1016 |
|
1017 |
||
93 | 1018 |
! |
1019 |
||
112 | 1020 |
startDrag |
1021 |
"start drag of selection |
|
1022 |
" |
|
1023 |
|dragObj spec name| |
|
1024 |
||
1025 |
spec := self findSpecFor:selection. |
|
1026 |
||
1027 |
spec notNil ifTrue:[ |
|
1028 |
spec := self buildSpecFrom:spec. |
|
1029 |
name := spec className asString. |
|
1030 |
name := name copyFrom:1 to:(name size - ('Spec' size) + 1). |
|
1031 |
name at:1 put:(name at:1) asLowercase. |
|
1032 |
name at:(name size) put:$1. |
|
1033 |
spec name:name. |
|
1034 |
||
1035 |
self showUnselected. |
|
1036 |
dragObj := DropSpecification for:selection specification:spec. |
|
1037 |
self showSelected. |
|
1038 |
DragAndDropManager startDrag:dragObj from:inputView. |
|
1039 |
] |
|
1040 |
||
1041 |
||
1042 |
! ! |
|
1043 |
||
1044 |
!UISelectionPanel::Canvas methodsFor:'event handling'! |
|
1045 |
||
1046 |
buttonMotion:state x:x y:y |
|
1047 |
"start a drag on selection |
|
1048 |
" |
|
1049 |
|obj sensor| |
|
1050 |
||
1051 |
(state ~~ 0 and:[selection notNil]) ifTrue:[ |
|
1052 |
sensor := self sensor. |
|
1053 |
sensor anyButtonPressed ifTrue:[ |
|
1054 |
(lastClickPoint dist:(x@y)) > 10.0 ifTrue:[ |
|
1055 |
self startDrag |
|
1056 |
] |
|
1057 |
] |
|
1058 |
] ifFalse:[ |
|
1059 |
(nameHolder notNil and:[(obj := self findObjectAtX:x y:y) notNil]) ifTrue:[ |
|
1060 |
nameHolder value:(obj name) |
|
1061 |
] |
|
1062 |
] |
|
1063 |
||
1064 |
! |
|
1065 |
||
1066 |
buttonPress:button x:x y:y |
|
1067 |
"change selection |
|
1068 |
" |
|
1069 |
lastClickPoint := Point x:x y:y. |
|
1070 |
self selection:(self findObjectAtX:x y:y). |
|
1071 |
||
1072 |
||
1073 |
! |
|
1074 |
||
1075 |
exposeX:x y:y width:w height:h |
|
1076 |
"handle an expose event from device; redraw selection |
|
1077 |
" |
|
1078 |
super exposeX:x y:y width:w height:h. |
|
1079 |
||
167 | 1080 |
(selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[ |
1081 |
self showSelected. |
|
1082 |
]. |
|
112 | 1083 |
|
1084 |
! ! |
|
1085 |
||
1086 |
!UISelectionPanel::Canvas methodsFor:'initialization'! |
|
1087 |
||
1088 |
initialize |
|
1089 |
super initialize. |
|
1090 |
||
1091 |
inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:self. |
|
1092 |
||
1093 |
inputView eventReceiver:self. |
|
1094 |
inputView enableButtonEvents. |
|
1095 |
inputView enableButtonMotionEvents. |
|
1096 |
inputView enableMotionEvents. |
|
1097 |
||
1098 |
! ! |
|
1099 |
||
1100 |
!UISelectionPanel::Canvas methodsFor:'searching'! |
|
1101 |
||
93 | 1102 |
findObjectAtX:x y:y |
1103 |
"find the origin/corner of the currentWidget |
|
1104 |
" |
|
147 | 1105 |
|point id p e| |
1106 |
||
1107 |
point := Point x:x y:y. |
|
1108 |
id := inputView id. |
|
93 | 1109 |
|
147 | 1110 |
subViews do:[:v| |
1111 |
v ~~ inputView ifTrue:[ |
|
1112 |
p := device translatePoint:point from:id to:(v id). |
|
1113 |
( p x >= 0 and:[p x <= v width |
|
1114 |
and:[p y >= 0 and:[p y <= v height |
|
1115 |
and:[(self findSpecFor:v) notNil]]]] |
|
1116 |
) ifTrue:[ |
|
1117 |
^ v |
|
1118 |
] |
|
93 | 1119 |
] |
1120 |
]. |
|
147 | 1121 |
^ nil |
1122 |
||
93 | 1123 |
|
1124 |
||
112 | 1125 |
|
1126 |
||
93 | 1127 |
! |
1128 |
||
1129 |
findSpecFor:anObject |
|
1130 |
"returns subspec assigned to instance or nil |
|
1131 |
" |
|
1132 |
|name components spec| |
|
1133 |
||
1134 |
anObject notNil ifTrue:[ |
|
1135 |
name := anObject name. |
|
1136 |
||
1137 |
specification do:[:aSpec| |
|
1138 |
aSpec name = name ifTrue:[ |
|
1139 |
aSpec canUIDrag ifTrue:[^ aSpec] |
|
1140 |
ifFalse:[^ nil] |
|
1141 |
] |
|
1142 |
] |
|
1143 |
]. |
|
1144 |
^ nil |
|
1145 |
||
1146 |
! ! |
|
1147 |
||
112 | 1148 |
!UISelectionPanel::Canvas methodsFor:'selection'! |
93 | 1149 |
|
1150 |
handlesOf:aComponent do:aOneArgBlock |
|
1151 |
"evaluate the block on each handle; the argument to the block |
|
1152 |
is a rectangle |
|
1153 |
" |
|
1154 |
aComponent notNil ifTrue:[ |
|
167 | 1155 |
aOneArgBlock value:(aComponent origin - (2@2) extent:6@6). |
1156 |
aOneArgBlock value:(aComponent corner - (1@1) extent:6@6). |
|
1157 |
aOneArgBlock value:(aComponent topRight - (1@2) extent:6@6). |
|
1158 |
aOneArgBlock value:(aComponent bottomLeft - (2@1) extent:6@6). |
|
1159 |
aOneArgBlock value:(aComponent leftCenter - (2@0) extent:6@6). |
|
1160 |
aOneArgBlock value:(aComponent rightCenter - (1@0) extent:6@6). |
|
1161 |
aOneArgBlock value:(aComponent topCenter - (0@2) extent:6@6). |
|
1162 |
aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6). |
|
93 | 1163 |
] |
1164 |
||
1165 |
! |
|
1166 |
||
1167 |
selection:anObject |
|
1168 |
"selection changed |
|
1169 |
" |
|
112 | 1170 |
|name| |
93 | 1171 |
|
1172 |
selection ~~ anObject ifTrue:[ |
|
1173 |
self showUnselected. |
|
112 | 1174 |
(self findSpecFor:anObject) notNil ifTrue:[ |
93 | 1175 |
selection := anObject. |
112 | 1176 |
name := anObject name. |
93 | 1177 |
self showSelected |
1178 |
] ifFalse:[ |
|
1179 |
selection := nil |
|
1180 |
]. |
|
112 | 1181 |
nameHolder notNil ifTrue:[nameHolder value:name] |
93 | 1182 |
] |
1183 |
||
1184 |
! |
|
1185 |
||
1186 |
showSelected |
|
1187 |
"show selected |
|
1188 |
" |
|
1189 |
selection notNil ifTrue:[ |
|
112 | 1190 |
self clippedByChildren:false. |
93 | 1191 |
|
1192 |
self handlesOf:selection do:[:aRectangle| |
|
112 | 1193 |
self fillRectangle:aRectangle |
93 | 1194 |
]. |
112 | 1195 |
self clippedByChildren:true. |
93 | 1196 |
]. |
112 | 1197 |
|
1198 |
||
93 | 1199 |
! |
1200 |
||
1201 |
showUnselected |
|
1202 |
"show unselected |
|
1203 |
" |
|
167 | 1204 |
|r currSel| |
93 | 1205 |
|
167 | 1206 |
(currSel := selection) isNil ifTrue:[ |
93 | 1207 |
^ self |
1208 |
]. |
|
167 | 1209 |
selection := nil. |
112 | 1210 |
self clippedByChildren:false. |
93 | 1211 |
|
167 | 1212 |
self handlesOf:currSel do:[:aRectangle| |
112 | 1213 |
self clearRectangle:aRectangle |
93 | 1214 |
]. |
112 | 1215 |
self clippedByChildren:true. |
167 | 1216 |
r := currSel bounds. |
93 | 1217 |
|
167 | 1218 |
subViews do:[:sv| |
93 | 1219 |
|absOrg absFrame| |
1220 |
||
167 | 1221 |
sv ~~ inputView ifTrue:[ |
1222 |
(sv bounds intersects:r) ifTrue:[ |
|
1223 |
sv borderColor:(Color gray:5). |
|
1224 |
sv borderColor:(Color black). |
|
93 | 1225 |
|
167 | 1226 |
sv withAllSubViewsDo:[:v| |
1227 |
v fill:v viewBackground. |
|
1228 |
v exposeX:0 y:0 width:9999 height:9999. |
|
93 | 1229 |
] |
1230 |
] |
|
1231 |
] |
|
167 | 1232 |
]. |
1233 |
selection := currSel. |
|
112 | 1234 |
|
93 | 1235 |
! ! |
1236 |
||
112 | 1237 |
!UISelectionPanel::Canvas::DropSpecification class methodsFor:'instance creation'! |
93 | 1238 |
|
1239 |
for:aView specification:aSpec |
|
1240 |
"create drop object for a view derived from a specification |
|
1241 |
" |
|
147 | 1242 |
|point extent root device| |
1243 |
||
1244 |
device := aView device. |
|
1245 |
root := device rootView. |
|
1246 |
extent := aView extent. |
|
1247 |
point := device translatePoint:0@0 from:(aView id) to:(root id). |
|
1248 |
||
1249 |
DisplayObject := nil. |
|
93 | 1250 |
|
147 | 1251 |
(point x > 0 and:[point y > 0]) ifTrue:[ |
1252 |
point := point + extent. |
|
1253 |
(point x < root width and:[point y < root height]) ifTrue:[ |
|
1254 |
aView topView raise. |
|
1255 |
device sync. |
|
1256 |
aView invalidate. |
|
1257 |
aView windowGroup processExposeEvents. |
|
1258 |
DisplayObject := Image fromView:aView grab:false. |
|
1259 |
] |
|
1260 |
]. |
|
1261 |
DisplayObject isNil ifTrue:[ |
|
1262 |
DisplayObject := Form extent:extent depth:1. |
|
93 | 1263 |
DisplayObject colorMap:(Array with:Color white with:Color black). |
1264 |
DisplayObject fill:(Color colorId:0). |
|
1265 |
DisplayObject paint:(Color colorId:1). |
|
1266 |
DisplayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y. |
|
1267 |
]. |
|
167 | 1268 |
aSpec class == UISubSpecification ifTrue:[ |
1269 |
aSpec layout:(LayoutOrigin fromPoint:0@0) |
|
1270 |
]. |
|
147 | 1271 |
^ self new theObject:aSpec |
112 | 1272 |
|
1273 |
||
93 | 1274 |
! ! |
1275 |
||
1276 |
!UISelectionPanel class methodsFor:'documentation'! |
|
1277 |
||
1278 |
version |
|
1279 |
^ '$Header$' |
|
1280 |
! ! |