|
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 |
|
14 View subclass:#UISelectionPanel |
|
15 instanceVariableNames:'action window tabView labelView inputView selection |
|
16 lastClickPoint specification' |
|
17 classVariableNames:'' |
|
18 poolDictionaries:'' |
|
19 category:'Interface-UIPainter' |
|
20 ! |
|
21 |
|
22 DropObject subclass:#DropSpecification |
|
23 instanceVariableNames:'' |
|
24 classVariableNames:'' |
|
25 poolDictionaries:'' |
|
26 privateIn:UISelectionPanel |
|
27 ! |
|
28 |
|
29 !UISelectionPanel class methodsFor:'documentation'! |
|
30 |
|
31 copyright |
|
32 " |
|
33 COPYRIGHT (c) 1997 by eXept Software AG |
|
34 All Rights Reserved |
|
35 |
|
36 This software is furnished under a license and may be used |
|
37 only in accordance with the terms of that license and with the |
|
38 inclusion of the above copyright notice. This software may not |
|
39 be provided or otherwise made available to, or used by, any |
|
40 other person. No title to or ownership of the software is |
|
41 hereby transferred. |
|
42 " |
|
43 |
|
44 ! |
|
45 |
|
46 documentation |
|
47 " |
|
48 implements a selection panel, keeping widgets which could be placed |
|
49 into the UIPainter by drag & drop. |
|
50 |
|
51 [author:] |
|
52 Claus Atzkern |
|
53 |
|
54 [see also:] |
|
55 TabView |
|
56 UIPainter |
|
57 " |
|
58 |
|
59 ! |
|
60 |
|
61 examples |
|
62 " |
|
63 creates and opens the default panel |
|
64 [exBegin] |
|
65 self defaultPanel. |
|
66 [exEnd] |
|
67 |
|
68 |
|
69 create a panel with labels and selectors implemented by the receiver |
|
70 which returns a FullSpec. |
|
71 [exBegin] |
|
72 |top slv inset list view idx frame colSelected colUnselected| |
|
73 |
|
74 top := StandardSystemView new |
|
75 label:'UI-Selection Panel'; |
|
76 extent:450@150. |
|
77 |
|
78 view := self origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
79 |
|
80 view labels:#( 'Button & Toggles' |
|
81 'Panels' |
|
82 'Scroller' |
|
83 ) |
|
84 selectors:#( #buttonToggleSpec |
|
85 #scrollerSpec |
|
86 #panelSpec |
|
87 ) |
|
88 receiver:self. |
|
89 |
|
90 top open. |
|
91 [exEnd] |
|
92 " |
|
93 ! ! |
|
94 |
|
95 !UISelectionPanel class methodsFor:'instance creation'! |
|
96 |
|
97 defaultPanel |
|
98 |top slv inset list view idx frame colSelected colUnselected| |
|
99 |
|
100 top := StandardSystemView new |
|
101 label:'UI-Selection Panel'; |
|
102 extent:480@200. |
|
103 |
|
104 view := self origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
105 |
|
106 view labels:#( 'Button & Toggle' |
|
107 'Panel' |
|
108 'Text' |
|
109 'View' |
|
110 'Menu & Combo' |
|
111 'Scroller' |
|
112 ) |
|
113 selectors:#( #buttonToggleSpec |
|
114 #panelSpec |
|
115 #textSpec |
|
116 #viewsSpec |
|
117 #menuComboSpec |
|
118 #scrollerSpec |
|
119 ) |
|
120 receiver:self. |
|
121 |
|
122 top open. |
|
123 |
|
124 ! ! |
|
125 |
|
126 !UISelectionPanel class methodsFor:'default specifications'! |
|
127 |
|
128 buttonToggleSpec |
|
129 "this window spec was automatically generated by the ST/X UIPainter" |
|
130 |
|
131 "do not manually edit this - the painter/builder may not be able to |
|
132 handle the specification if its corrupted." |
|
133 |
|
134 " |
|
135 UIPainter new openOnClass:UISelectionPanel andSelector:#buttonToggleSpec |
|
136 UISelectionPanel new openInterface:#buttonToggleSpec |
|
137 " |
|
138 |
|
139 <resource: #canvas> |
|
140 |
|
141 ^ |
|
142 |
|
143 #(#FullSpec |
|
144 #'window:' |
|
145 #(#WindowSpec |
|
146 #'name:' 'uIPainterView' |
|
147 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
148 #'label:' 'unnamed' |
|
149 #'bounds:' #(#Rectangle 0 0 450 100) |
|
150 ) |
|
151 #'component:' |
|
152 #(#SpecCollection |
|
153 #'collection:' |
|
154 #( |
|
155 #(#ArrowButtonSpec |
|
156 #'name:' 'ArrowButton up' |
|
157 #'layout:' #(#LayoutFrame 16 0 70 0 38 0 92 0) |
|
158 #'translateLabel:' false |
|
159 #'tabable:' false |
|
160 #'hasCharacterOrientedLabel:' false |
|
161 #'isTriggerOnDown:' true |
|
162 #'direction:' #up |
|
163 ) |
|
164 #(#ActionButtonSpec |
|
165 #'name:' 'Button' |
|
166 #'layout:' #(#LayoutFrame 16 0 8 0 115 0 30 0) |
|
167 #'label:' 'Button' |
|
168 #'translateLabel:' false |
|
169 #'tabable:' false |
|
170 #'isTriggerOnDown:' false |
|
171 ) |
|
172 #(#RadioButtonSpec |
|
173 #'name:' 'RadioButton' |
|
174 #'layout:' #(#LayoutFrame 16 0.0 39 0 115 0 61 0) |
|
175 #'label:' 'RadioButton' |
|
176 #'translateLabel:' false |
|
177 #'tabable:' false |
|
178 #'isTriggerOnDown:' true |
|
179 #'showLamp:' true |
|
180 #'lampColor:' #(#Color 100.0 100.0 0.0) |
|
181 ) |
|
182 #(#ArrowButtonSpec |
|
183 #'name:' 'ArrowButton down' |
|
184 #'layout:' #(#LayoutFrame 42 0 70 0 64 0 92 0) |
|
185 #'translateLabel:' false |
|
186 #'tabable:' false |
|
187 #'hasCharacterOrientedLabel:' false |
|
188 #'isTriggerOnDown:' true |
|
189 #'direction:' #down |
|
190 ) |
|
191 #(#ArrowButtonSpec |
|
192 #'name:' 'ArrowButton left' |
|
193 #'layout:' #(#LayoutFrame 68 0 70 0 90 0 92 0) |
|
194 #'translateLabel:' false |
|
195 #'tabable:' false |
|
196 #'hasCharacterOrientedLabel:' false |
|
197 #'isTriggerOnDown:' true |
|
198 #'direction:' #left |
|
199 ) |
|
200 #(#ArrowButtonSpec |
|
201 #'name:' 'ArrowButton right' |
|
202 #'layout:' #(#LayoutFrame 93 0 70 0 115 0 92 0) |
|
203 #'translateLabel:' false |
|
204 #'tabable:' false |
|
205 #'hasCharacterOrientedLabel:' false |
|
206 #'isTriggerOnDown:' true |
|
207 #'direction:' #right |
|
208 ) |
|
209 #(#CheckToggleSpec |
|
210 #'name:' 'CheckToggle' |
|
211 #'layout:' #(#LayoutFrame 147 0 70 0 167 0 90 0) |
|
212 #'translateLabel:' false |
|
213 #'tabable:' false |
|
214 #'hasCharacterOrientedLabel:' false |
|
215 #'isTriggerOnDown:' true |
|
216 #'showLamp:' false |
|
217 #'lampColor:' #(#Color 100.0 100.0 0.0) |
|
218 ) |
|
219 #(#ToggleSpec |
|
220 #'name:' 'Toggle' |
|
221 #'layout:' #(#LayoutFrame 147 0 8 0 246 0 30 0) |
|
222 #'label:' 'Toggle' |
|
223 #'translateLabel:' false |
|
224 #'tabable:' false |
|
225 #'isTriggerOnDown:' true |
|
226 #'showLamp:' true |
|
227 #'lampColor:' #(#Color 100.0 100.0 0.0) |
|
228 ) |
|
229 #(#CheckBoxSpec |
|
230 #'name:' 'CheckBox' |
|
231 #'layout:' #(#LayoutFrame 145 0 39 0 246 0 61 0) |
|
232 #'tabable:' false |
|
233 #'label:' 'CheckBox' |
|
234 #'translateLabel:' false |
|
235 ) |
|
236 ) |
|
237 ) |
|
238 ) |
|
239 ! |
|
240 |
|
241 menuComboSpec |
|
242 "this window spec was automatically generated by the ST/X UIPainter" |
|
243 |
|
244 "do not manually edit this - the painter/builder may not be able to |
|
245 handle the specification if its corrupted." |
|
246 |
|
247 " |
|
248 UIPainter new openOnClass:UISelectionPanel andSelector:#menuComboSpec |
|
249 UISelectionPanel new openInterface:#menuComboSpec |
|
250 " |
|
251 |
|
252 <resource: #canvas> |
|
253 |
|
254 ^ |
|
255 |
|
256 #(#FullSpec |
|
257 #'window:' |
|
258 #(#WindowSpec |
|
259 #'name:' 'uIPainterView' |
|
260 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
261 #'label:' 'unnamed' |
|
262 #'bounds:' #(#Rectangle 0 0 450 100) |
|
263 ) |
|
264 #'component:' |
|
265 #(#SpecCollection |
|
266 #'collection:' |
|
267 #( |
|
268 #(#ComboBoxSpec |
|
269 #'name:' 'ComboBox' |
|
270 #'layout:' #(#LayoutFrame 14 0 15 0 117 0 35 0) |
|
271 #'immediateAccept:' false |
|
272 #'acceptOnLeave:' true |
|
273 #'acceptOnReturn:' true |
|
274 #'acceptOnTab:' true |
|
275 #'acceptOnLostFocus:' true |
|
276 #'hasBorder:' false |
|
277 ) |
|
278 #(#ComboListSpec |
|
279 #'name:' 'ComboList' |
|
280 #'layout:' #(#LayoutFrame 14 0 46 0 117 0 66 0) |
|
281 #'tabable:' false |
|
282 ) |
|
283 #(#PopUpListSpec |
|
284 #'name:' 'PopUpList' |
|
285 #'layout:' #(#LayoutFrame 139 0 15 0 242 0 37 0) |
|
286 #'label:' 'PopUpList' |
|
287 #'initiallyInvisible:' false |
|
288 #'translateLabel:' false |
|
289 ) |
|
290 ) |
|
291 ) |
|
292 ) |
|
293 ! |
|
294 |
|
295 panelSpec |
|
296 "this window spec was automatically generated by the ST/X UIPainter" |
|
297 |
|
298 "do not manually edit this - the painter/builder may not be able to |
|
299 handle the specification if its corrupted." |
|
300 |
|
301 " |
|
302 UIPainter new openOnClass:UISelectionPanel andSelector:#panelSpec |
|
303 UISelectionPanel new openInterface:#panelSpec |
|
304 " |
|
305 |
|
306 <resource: #canvas> |
|
307 |
|
308 ^ |
|
309 |
|
310 #(#FullSpec |
|
311 #'window:' |
|
312 #(#WindowSpec |
|
313 #'name:' 'uIPainterView' |
|
314 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
315 #'label:' 'unnamed' |
|
316 #'bounds:' #(#Rectangle 0 0 450 100) |
|
317 ) |
|
318 #'component:' |
|
319 #(#SpecCollection |
|
320 #'collection:' |
|
321 #( |
|
322 #(#HorizontalPanelViewSpec |
|
323 #'name:' 'HorizontalPanelView' |
|
324 #'layout:' #(#LayoutFrame 20 0 17 0 104 0 81 0) |
|
325 #'component:' |
|
326 #(#SpecCollection |
|
327 #'collection:' |
|
328 #( |
|
329 #(#ActionButtonSpec |
|
330 #'name:' 'button1' |
|
331 #'label:' 'A' |
|
332 #'translateLabel:' false |
|
333 #'tabable:' false |
|
334 #'isTriggerOnDown:' false |
|
335 #'extent:' #(#Point 34 23) |
|
336 #'canUIDrag:' false |
|
337 ) |
|
338 #(#ActionButtonSpec |
|
339 #'name:' 'button8' |
|
340 #'label:' 'B' |
|
341 #'translateLabel:' false |
|
342 #'tabable:' false |
|
343 #'isTriggerOnDown:' false |
|
344 #'extent:' #(#Point 32 41) |
|
345 #'canUIDrag:' false |
|
346 ) |
|
347 ) |
|
348 ) |
|
349 #'level:' 0 |
|
350 #'horizontalLayout:' #center |
|
351 #'verticalLayout:' #center |
|
352 #'horizontalSpace:' 3 |
|
353 #'verticalSpace:' 3 |
|
354 ) |
|
355 #(#VariableHorizontalPanelSpec |
|
356 #'name:' 'VariableHorizontalPanel' |
|
357 #'layout:' #(#LayoutFrame 128 0 17 0 212 0 81 0) |
|
358 #'component:' |
|
359 #(#SpecCollection |
|
360 #'collection:' |
|
361 #( |
|
362 #(#ActionButtonSpec |
|
363 #'name:' 'button2' |
|
364 #'label:' 'A' |
|
365 #'translateLabel:' false |
|
366 #'tabable:' false |
|
367 #'isTriggerOnDown:' false |
|
368 #'canUIDrag:' false |
|
369 ) |
|
370 #(#ActionButtonSpec |
|
371 #'name:' 'button3' |
|
372 #'label:' 'B' |
|
373 #'translateLabel:' false |
|
374 #'tabable:' false |
|
375 #'isTriggerOnDown:' false |
|
376 #'canUIDrag:' false |
|
377 ) |
|
378 ) |
|
379 ) |
|
380 ) |
|
381 #(#VerticalPanelViewSpec |
|
382 #'name:' 'VerticalPanelView' |
|
383 #'layout:' #(#LayoutFrame 236 0 17 0 320 0 81 0) |
|
384 #'component:' |
|
385 #(#SpecCollection |
|
386 #'collection:' |
|
387 #( |
|
388 #(#ActionButtonSpec |
|
389 #'name:' 'button4' |
|
390 #'label:' 'A' |
|
391 #'translateLabel:' false |
|
392 #'tabable:' false |
|
393 #'isTriggerOnDown:' false |
|
394 #'extent:' #(#Point 19 18) |
|
395 #'canUIDrag:' false |
|
396 ) |
|
397 #(#ActionButtonSpec |
|
398 #'name:' 'button5' |
|
399 #'label:' 'B' |
|
400 #'translateLabel:' false |
|
401 #'tabable:' false |
|
402 #'isTriggerOnDown:' false |
|
403 #'extent:' #(#Point 63 30) |
|
404 #'canUIDrag:' false |
|
405 ) |
|
406 ) |
|
407 ) |
|
408 #'level:' 0 |
|
409 #'horizontalLayout:' #center |
|
410 #'verticalLayout:' #center |
|
411 #'horizontalSpace:' 3 |
|
412 #'verticalSpace:' 3 |
|
413 ) |
|
414 #(#VariableVerticalPanelSpec |
|
415 #'name:' 'VariableVerticalPanel' |
|
416 #'layout:' #(#LayoutFrame 344 0 17 0 428 0 81 0) |
|
417 #'component:' |
|
418 #(#SpecCollection |
|
419 #'collection:' |
|
420 #( |
|
421 #(#ActionButtonSpec |
|
422 #'name:' 'button6' |
|
423 #'label:' 'A' |
|
424 #'translateLabel:' false |
|
425 #'tabable:' false |
|
426 #'isTriggerOnDown:' false |
|
427 #'canUIDrag:' false |
|
428 ) |
|
429 #(#ActionButtonSpec |
|
430 #'name:' 'button7' |
|
431 #'label:' 'B' |
|
432 #'translateLabel:' false |
|
433 #'tabable:' false |
|
434 #'isTriggerOnDown:' false |
|
435 #'canUIDrag:' false |
|
436 ) |
|
437 ) |
|
438 ) |
|
439 ) |
|
440 ) |
|
441 ) |
|
442 ) |
|
443 ! |
|
444 |
|
445 scrollerSpec |
|
446 "this window spec was automatically generated by the ST/X UIPainter" |
|
447 |
|
448 "do not manually edit this - the painter/builder may not be able to |
|
449 handle the specification if its corrupted." |
|
450 |
|
451 " |
|
452 UIPainter new openOnClass:UISelectionPanel andSelector:#scrollerSpec |
|
453 UISelectionPanel new openInterface:#scrollerSpec |
|
454 " |
|
455 |
|
456 <resource: #canvas> |
|
457 |
|
458 ^ |
|
459 |
|
460 #(#FullSpec |
|
461 #'window:' |
|
462 #(#WindowSpec |
|
463 #'name:' 'uIPainterView' |
|
464 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
465 #'label:' 'unnamed' |
|
466 #'bounds:' #(#Rectangle 0 0 450 100) |
|
467 ) |
|
468 #'component:' |
|
469 #(#SpecCollection |
|
470 #'collection:' |
|
471 #( |
|
472 #(#ArbitraryComponentSpec |
|
473 #'name:' 'HorizontalMiniScroller' |
|
474 #'layout:' #(#LayoutFrame 4 0 10 0 105 0 16 0) |
|
475 #'component:' '' |
|
476 #'tabable:' false |
|
477 #'hasHorizontalScrollBar:' false |
|
478 #'hasVerticalScrollBar:' false |
|
479 #'hasBorder:' false |
|
480 ) |
|
481 #(#ArbitraryComponentSpec |
|
482 #'name:' 'HorizontalScrollBar' |
|
483 #'layout:' #(#LayoutFrame 4 0 23 0 105 0 42 0) |
|
484 #'component:' '' |
|
485 #'tabable:' false |
|
486 #'hasHorizontalScrollBar:' false |
|
487 #'hasVerticalScrollBar:' false |
|
488 #'hasBorder:' false |
|
489 ) |
|
490 #(#ArbitraryComponentSpec |
|
491 #'name:' 'HorizontalScroller' |
|
492 #'layout:' #(#LayoutFrame 4 0 49 0 105 0 66 0) |
|
493 #'component:' '' |
|
494 #'tabable:' false |
|
495 #'hasHorizontalScrollBar:' false |
|
496 #'hasVerticalScrollBar:' false |
|
497 #'hasBorder:' false |
|
498 ) |
|
499 #(#ArbitraryComponentSpec |
|
500 #'name:' 'HorizontalSlider' |
|
501 #'layout:' #(#LayoutFrame 4 0 73 0 105 0 90 0) |
|
502 #'tabable:' false |
|
503 #'hasHorizontalScrollBar:' false |
|
504 #'hasVerticalScrollBar:' false |
|
505 #'hasBorder:' false |
|
506 ) |
|
507 #(#ArbitraryComponentSpec |
|
508 #'name:' 'MiniScroller' |
|
509 #'layout:' #(#LayoutFrame 137 0 11 0 143 0 90 0) |
|
510 #'component:' '' |
|
511 #'tabable:' false |
|
512 #'hasHorizontalScrollBar:' false |
|
513 #'hasVerticalScrollBar:' false |
|
514 #'hasBorder:' false |
|
515 ) |
|
516 #(#ArbitraryComponentSpec |
|
517 #'name:' 'ScrollBar' |
|
518 #'layout:' #(#LayoutFrame 153 0 11 0 172 0 90 0) |
|
519 #'component:' '' |
|
520 #'tabable:' false |
|
521 #'hasHorizontalScrollBar:' false |
|
522 #'hasVerticalScrollBar:' false |
|
523 #'hasBorder:' false |
|
524 ) |
|
525 #(#ScrollerSpec |
|
526 #'name:' 'Scroller' |
|
527 #'layout:' #(#LayoutFrame 182 0 11 0 212 0 90 0) |
|
528 ) |
|
529 #(#SliderSpec |
|
530 #'name:' 'Slider' |
|
531 #'layout:' #(#LayoutFrame 222 0 11 0 252 0 90 0) |
|
532 ) |
|
533 #(#ArbitraryComponentSpec |
|
534 #'name:' 'ThumbWheel' |
|
535 #'layout:' #(#LayoutFrame 270 0 11 0 285 0 90 0) |
|
536 #'component:' '' |
|
537 #'tabable:' false |
|
538 #'hasHorizontalScrollBar:' false |
|
539 #'hasVerticalScrollBar:' false |
|
540 #'hasBorder:' false |
|
541 ) |
|
542 ) |
|
543 ) |
|
544 ) |
|
545 ! |
|
546 |
|
547 textSpec |
|
548 "this window spec was automatically generated by the ST/X UIPainter" |
|
549 |
|
550 "do not manually edit this - the painter/builder may not be able to |
|
551 handle the specification if its corrupted." |
|
552 |
|
553 " |
|
554 UIPainter new openOnClass:UISelectionPanel andSelector:#textSpec |
|
555 UISelectionPanel new openInterface:#textSpec |
|
556 " |
|
557 |
|
558 <resource: #canvas> |
|
559 |
|
560 ^ |
|
561 |
|
562 #(#FullSpec |
|
563 #'window:' |
|
564 #(#WindowSpec |
|
565 #'name:' 'uIPainterView' |
|
566 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
567 #'label:' 'unnamed' |
|
568 #'bounds:' #(#Rectangle 0 0 450 100) |
|
569 ) |
|
570 #'component:' |
|
571 #(#SpecCollection |
|
572 #'collection:' |
|
573 #( |
|
574 #(#InputFieldSpec |
|
575 #'name:' 'EditField' |
|
576 #'layout:' #(#LayoutFrame 13 0 11 0 117 0 29 0) |
|
577 #'immediateAccept:' false |
|
578 #'acceptOnLeave:' true |
|
579 #'acceptOnReturn:' true |
|
580 #'acceptOnTab:' true |
|
581 #'acceptOnLostFocus:' true |
|
582 #'hasBorder:' false |
|
583 ) |
|
584 #(#TextEditorSpec |
|
585 #'name:' 'EditTextView' |
|
586 #'layout:' #(#LayoutFrame 171 0 11 0 275 0 91 0) |
|
587 ) |
|
588 #(#SequenceViewSpec |
|
589 #'name:' 'SelectionInListView' |
|
590 #'layout:' #(#LayoutFrame 329 0 11 0 433 0 91 0) |
|
591 #'hasHorizontalScrollBar:' true |
|
592 #'hasVerticalScrollBar:' true |
|
593 ) |
|
594 #(#LabelSpec |
|
595 #'name:' 'Text Label' |
|
596 #'layout:' #(#LayoutFrame 13 0 41 0 117 0 57 0) |
|
597 #'label:' 'Text Label' |
|
598 #'initiallyInvisible:' false |
|
599 #'translateLabel:' false |
|
600 #'level:' 0 |
|
601 #'adjust:' #center |
|
602 #'hasCharacterOrientedLabel:' true |
|
603 ) |
|
604 ) |
|
605 ) |
|
606 ) |
|
607 ! |
|
608 |
|
609 viewsSpec |
|
610 "this window spec was automatically generated by the ST/X UIPainter" |
|
611 |
|
612 "do not manually edit this - the painter/builder may not be able to |
|
613 handle the specification if its corrupted." |
|
614 |
|
615 " |
|
616 UIPainter new openOnClass:UISelectionPanel andSelector:#viewsSpec |
|
617 UISelectionPanel new openInterface:#viewsSpec |
|
618 " |
|
619 |
|
620 <resource: #canvas> |
|
621 |
|
622 ^ |
|
623 |
|
624 #(#FullSpec |
|
625 #'window:' |
|
626 #(#WindowSpec |
|
627 #'name:' 'uIPainterView' |
|
628 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
629 #'label:' 'unnamed' |
|
630 #'bounds:' #(#Rectangle 0 0 450 100) |
|
631 ) |
|
632 #'component:' |
|
633 #(#SpecCollection |
|
634 #'collection:' |
|
635 #( |
|
636 #(#FramedBoxSpec |
|
637 #'name:' 'FramedBox' |
|
638 #'layout:' #(#LayoutFrame 4 0 11 0 109 0 81 0) |
|
639 #'label:' 'FramedBox' |
|
640 #'labelPosition:' #topCenter |
|
641 #'showFrame:' true |
|
642 ) |
|
643 #(#ViewSpec |
|
644 #'name:' 'view1' |
|
645 #'layout:' #(#LayoutFrame 118 0 11 0 223 0 81 0) |
|
646 #'component:' |
|
647 #(#SpecCollection |
|
648 #'collection:' |
|
649 #( |
|
650 #(#LabelSpec |
|
651 #'name:' 'label1' |
|
652 #'layout:' #(#Point 3 2) |
|
653 #'label:' 'View' |
|
654 #'initiallyInvisible:' false |
|
655 #'translateLabel:' false |
|
656 #'level:' 0 |
|
657 #'adjust:' #center |
|
658 #'hasCharacterOrientedLabel:' true |
|
659 #'canUIDrag:' false |
|
660 ) |
|
661 ) |
|
662 ) |
|
663 ) |
|
664 #(#SubCanvasSpec |
|
665 #'name:' 'subCanvas1' |
|
666 #'layout:' #(#LayoutFrame 232 0 11 0 337 0 81 0) |
|
667 ) |
|
668 #(#LabelSpec |
|
669 #'name:' 'label2' |
|
670 #'layout:' #(#Point 246 20) |
|
671 #'label:' 'SubCanvas' |
|
672 #'initiallyInvisible:' false |
|
673 #'translateLabel:' false |
|
674 #'level:' 0 |
|
675 #'adjust:' #center |
|
676 #'hasCharacterOrientedLabel:' true |
|
677 #'canUIDrag:' false |
|
678 ) |
|
679 #(#DividerSpec |
|
680 #'name:' 'Horizontal Seperator' |
|
681 #'layout:' #(#LayoutFrame 373 0 11 0 437 0 28 0) |
|
682 #'orientation:' #horizontal |
|
683 ) |
|
684 #(#DividerSpec |
|
685 #'name:' 'Vertical Seperator' |
|
686 #'layout:' #(#LayoutFrame 345 0 11 0 364 0 81 0) |
|
687 #'orientation:' #vertical |
|
688 ) |
|
689 ) |
|
690 ) |
|
691 ) |
|
692 ! ! |
|
693 |
|
694 !UISelectionPanel methodsFor:'accessing'! |
|
695 |
|
696 labels:labels selectors:selectors receiver:receiver |
|
697 "change specification and tabs |
|
698 " |
|
699 tabView action:[:aNrOrNil||spec| |
|
700 aNrOrNil notNil ifTrue:[ |
|
701 spec := receiver perform:(selectors at:aNrOrNil). |
|
702 ]. |
|
703 self specification:spec. |
|
704 ]. |
|
705 tabView list:labels. |
|
706 self recomputeSizes. |
|
707 |
|
708 |
|
709 ! |
|
710 |
|
711 specification:specOrSpecArray |
|
712 "load a spec |
|
713 " |
|
714 |builder| |
|
715 |
|
716 self selection:nil. |
|
717 labelView label:''. |
|
718 |
|
719 window subViews copy do:[:aSubView| |
|
720 aSubView ~~ inputView ifTrue:[ |
|
721 aSubView == labelView ifTrue:[self halt]. |
|
722 aSubView destroy |
|
723 ] |
|
724 ]. |
|
725 |
|
726 specOrSpecArray notNil ifTrue:[ |
|
727 specification := UISpecification from:specOrSpecArray. |
|
728 |
|
729 builder := UIBuilder new. |
|
730 specification buildViewFor:builder in:window. |
|
731 window realizeAllSubViews. |
|
732 inputView raise. |
|
733 ] |
|
734 ! ! |
|
735 |
|
736 !UISelectionPanel methodsFor:'change & update'! |
|
737 |
|
738 recomputeSizes |
|
739 "recompute sizes dependent on list |
|
740 " |
|
741 |y x extent| |
|
742 |
|
743 extent := tabView preferredExtent. |
|
744 x := extent x. |
|
745 |
|
746 x <= (self extent x) ifTrue:[ |
|
747 y := extent y. |
|
748 ] ifFalse:[ |
|
749 y := tabView preferredHeight. |
|
750 ]. |
|
751 y := y + 8. |
|
752 tabView bottomInset:(y negated). |
|
753 window topInset:y. |
|
754 |
|
755 |
|
756 ! |
|
757 |
|
758 update:something with:aParameter from:changedObject |
|
759 "tabView might change its size |
|
760 " |
|
761 (something == #preferredHeight and:[changedObject == tabView]) ifFalse:[ |
|
762 ^ self |
|
763 ]. |
|
764 self recomputeSizes |
|
765 |
|
766 |
|
767 ! ! |
|
768 |
|
769 !UISelectionPanel methodsFor:'drag & drop'! |
|
770 |
|
771 startDrag |
|
772 "start drag of selection |
|
773 " |
|
774 |dragObj spec| |
|
775 |
|
776 spec := self findSpecFor:selection. |
|
777 |
|
778 spec notNil ifTrue:[ |
|
779 spec := self buildSpecFrom:spec. |
|
780 |
|
781 self showUnselected. |
|
782 dragObj := DropSpecification for:selection specification:spec. |
|
783 self showSelected. |
|
784 |
|
785 DragAndDropManager startDrag:dragObj from:inputView. |
|
786 ] |
|
787 |
|
788 ! ! |
|
789 |
|
790 !UISelectionPanel methodsFor:'event handling'! |
|
791 |
|
792 buttonMotion:state x:x y:y |
|
793 "start a drag on selection |
|
794 " |
|
795 |obj sensor| |
|
796 |
|
797 selection notNil ifTrue:[ |
|
798 sensor := self sensor. |
|
799 sensor anyButtonPressed ifTrue:[ |
|
800 (lastClickPoint dist:(x@y)) > 10.0 ifTrue:[ |
|
801 self startDrag |
|
802 ] |
|
803 ] |
|
804 ] ifFalse:[ |
|
805 obj := self findObjectAtX:x y:y. |
|
806 |
|
807 obj notNil ifTrue:[ |
|
808 labelView label:obj name |
|
809 ] |
|
810 ]. |
|
811 ! |
|
812 |
|
813 buttonPress:button x:x y:y |
|
814 "change selection |
|
815 " |
|
816 lastClickPoint := Point x:x y:y. |
|
817 self selection:(self findObjectAtX:x y:y). |
|
818 |
|
819 |
|
820 ! |
|
821 |
|
822 doesNotUnderstand:aMessage |
|
823 "any event message not catched; discard message |
|
824 " |
|
825 |
|
826 |
|
827 ! |
|
828 |
|
829 exposeX:x y:y width:w height:h |
|
830 "handle an expose event from device; redraw selection |
|
831 " |
|
832 super exposeX:x y:y width:w height:h. |
|
833 self showSelected. |
|
834 |
|
835 ! ! |
|
836 |
|
837 !UISelectionPanel methodsFor:'initialization'! |
|
838 |
|
839 initialize |
|
840 |y| |
|
841 |
|
842 super initialize. |
|
843 tabView := TabView origin:0.0@0.0 corner:1.0@0.0 in:self. |
|
844 window := NoteBookFrameView origin:0.0@0.0 corner:1.0@1.0 in:self. |
|
845 labelView := Label origin:0.0@1.0 corner:1.0@1.0 in:self. |
|
846 inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:window. |
|
847 |
|
848 y := labelView preferredExtent y. |
|
849 window bottomInset:y. |
|
850 labelView topInset:(y negated). |
|
851 |
|
852 inputView eventReceiver:self. |
|
853 inputView enableButtonEvents. |
|
854 inputView enableButtonMotionEvents. |
|
855 inputView enableMotionEvents. |
|
856 |
|
857 tabView tabWidget:#Window. |
|
858 |
|
859 tabView styleAt:#expandSelection put:6@2. |
|
860 tabView styleAt:#labelBottomInset put:4. |
|
861 tabView styleAt:#lableTopInset put:0. |
|
862 tabView font:(Label defaultFont). |
|
863 tabView addDependent:self. |
|
864 |
|
865 window viewBackground:(tabView styleAt:#selectedColor). |
|
866 labelView backgroundColor:(tabView styleAt:#unselectedColor). |
|
867 |
|
868 ! ! |
|
869 |
|
870 !UISelectionPanel methodsFor:'searching'! |
|
871 |
|
872 buildSpecFrom:aSpec |
|
873 "build spec out of spec |
|
874 " |
|
875 |spec comp coll| |
|
876 |
|
877 (aSpec notNil and:[aSpec canUIDrag]) ifFalse:[ |
|
878 ^ nil |
|
879 ]. |
|
880 |
|
881 (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[ |
|
882 ^ aSpec |
|
883 ]. |
|
884 comp := aSpec component. |
|
885 spec := aSpec copy. |
|
886 spec component:nil. |
|
887 |
|
888 comp canUIDrag ifFalse:[ |
|
889 ^ spec |
|
890 ]. |
|
891 coll := OrderedCollection new. |
|
892 |
|
893 comp do:[:anEntry||spc| |
|
894 (spc := self buildSpecFrom:anEntry) notNil ifTrue:[ |
|
895 coll add:spc |
|
896 ] |
|
897 ]. |
|
898 coll isEmpty ifTrue:[ |
|
899 ^ spec |
|
900 ]. |
|
901 comp := comp copy. |
|
902 comp collection:coll. |
|
903 spec component:comp. |
|
904 ^ spec |
|
905 ! |
|
906 |
|
907 findObjectAtX:x y:y |
|
908 "find the origin/corner of the currentWidget |
|
909 " |
|
910 |view viewId point| |
|
911 |
|
912 point := Point x:x y:y. |
|
913 point := device translatePoint:point from:(inputView id) |
|
914 to:(inputView device rootView id). |
|
915 inputView lower. |
|
916 viewId := device viewIdFromPoint:point in:(window id). |
|
917 view := device viewFromId:viewId. |
|
918 inputView raise. |
|
919 |
|
920 (view ~~ window and:[view ~~ inputView]) ifTrue:[ |
|
921 (self findSpecFor:view) notNil ifTrue:[ |
|
922 ^ view |
|
923 ] |
|
924 ]. |
|
925 ^ nil |
|
926 |
|
927 |
|
928 ! |
|
929 |
|
930 findSpecFor:anObject |
|
931 "returns subspec assigned to instance or nil |
|
932 " |
|
933 |name components spec| |
|
934 |
|
935 anObject notNil ifTrue:[ |
|
936 name := anObject name. |
|
937 |
|
938 specification do:[:aSpec| |
|
939 aSpec name = name ifTrue:[ |
|
940 aSpec canUIDrag ifTrue:[^ aSpec] |
|
941 ifFalse:[^ nil] |
|
942 ] |
|
943 ] |
|
944 ]. |
|
945 ^ nil |
|
946 |
|
947 ! ! |
|
948 |
|
949 !UISelectionPanel methodsFor:'selections'! |
|
950 |
|
951 handlesOf:aComponent do:aOneArgBlock |
|
952 "evaluate the block on each handle; the argument to the block |
|
953 is a rectangle |
|
954 " |
|
955 aComponent notNil ifTrue:[ |
|
956 aOneArgBlock value:(aComponent origin - (4@4) extent:7@7). |
|
957 aOneArgBlock value:(aComponent corner - (4@4) extent:7@7). |
|
958 aOneArgBlock value:(aComponent topRight - (4@4) extent:7@7). |
|
959 aOneArgBlock value:(aComponent bottomLeft - (4@4) extent:7@7). |
|
960 aOneArgBlock value:(aComponent leftCenter - (4@4) extent:7@7). |
|
961 aOneArgBlock value:(aComponent rightCenter - (4@4) extent:7@7). |
|
962 aOneArgBlock value:(aComponent topCenter - (4@4) extent:7@7). |
|
963 aOneArgBlock value:(aComponent bottomCenter - (4@4) extent:7@7). |
|
964 ] |
|
965 |
|
966 |
|
967 ! |
|
968 |
|
969 selection:anObject |
|
970 "selection changed |
|
971 " |
|
972 |spec| |
|
973 |
|
974 selection ~~ anObject ifTrue:[ |
|
975 self showUnselected. |
|
976 spec := self findSpecFor:anObject. |
|
977 |
|
978 spec notNil ifTrue:[ |
|
979 selection := anObject. |
|
980 self showSelected |
|
981 ] ifFalse:[ |
|
982 selection := nil |
|
983 ]. |
|
984 |
|
985 selection notNil ifTrue:[ |
|
986 labelView label:(selection name) |
|
987 ] |
|
988 ] |
|
989 |
|
990 ! |
|
991 |
|
992 showSelected |
|
993 "show selected |
|
994 " |
|
995 selection notNil ifTrue:[ |
|
996 window clippedByChildren:false. |
|
997 |
|
998 self handlesOf:selection do:[:aRectangle| |
|
999 window fillRectangle:aRectangle |
|
1000 ]. |
|
1001 window clippedByChildren:true. |
|
1002 ]. |
|
1003 ! |
|
1004 |
|
1005 showUnselected |
|
1006 "show unselected |
|
1007 " |
|
1008 |r| |
|
1009 |
|
1010 selection isNil ifTrue:[ |
|
1011 ^ self |
|
1012 ]. |
|
1013 |
|
1014 window clippedByChildren:false. |
|
1015 |
|
1016 self handlesOf:selection do:[:aRectangle| |
|
1017 window clearRectangle:aRectangle |
|
1018 ]. |
|
1019 window clippedByChildren:true. |
|
1020 |
|
1021 "must redraw all components which are affected b the handles |
|
1022 " |
|
1023 r := (selection originRelativeTo:window) - (4@4) extent:(selection extent + (4@4)). |
|
1024 |
|
1025 window subViews do:[:aComponent | |
|
1026 |absOrg absFrame| |
|
1027 |
|
1028 aComponent ~~ inputView ifTrue:[ |
|
1029 absOrg := aComponent originRelativeTo:window. |
|
1030 absFrame := absOrg extent:(aComponent extent). |
|
1031 |
|
1032 (absFrame intersects:r) ifTrue:[ |
|
1033 aComponent withAllSubViewsDo:[:aView| |
|
1034 aView clear. |
|
1035 aView exposeX:0 y:0 width:9999 height:9999. |
|
1036 ] |
|
1037 ] |
|
1038 ] |
|
1039 ] |
|
1040 |
|
1041 ! ! |
|
1042 |
|
1043 !UISelectionPanel::DropSpecification class methodsFor:'instance creation'! |
|
1044 |
|
1045 for:aView specification:aSpec |
|
1046 "create drop object for a view derived from a specification |
|
1047 " |
|
1048 aView topView raise. |
|
1049 aView device sync. |
|
1050 aView invalidate. |
|
1051 aView windowGroup processExposeEvents. |
|
1052 DisplayObject := Image fromView:aView grab:false. |
|
1053 |
|
1054 DisplayObject extent ~= aView extent ifTrue:[ |
|
1055 DisplayObject := Form extent:(aView extent) depth:1. |
|
1056 DisplayObject colorMap:(Array with:Color white with:Color black). |
|
1057 DisplayObject fill:(Color colorId:0). |
|
1058 DisplayObject paint:(Color colorId:1). |
|
1059 DisplayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y. |
|
1060 ]. |
|
1061 |
|
1062 ^ self new theObject:aSpec |
|
1063 ! ! |
|
1064 |
|
1065 !UISelectionPanel class methodsFor:'documentation'! |
|
1066 |
|
1067 version |
|
1068 ^ '$Header$' |
|
1069 ! ! |