9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 |
13 |
|
14 |
14 ApplicationModel subclass:#UISelectionPanel |
15 ApplicationModel subclass:#UISelectionPanel |
15 instanceVariableNames:'selection selectors receiver' |
16 instanceVariableNames:'userClass userSpecs userLabels majorSelection clipBoardSpec' |
16 classVariableNames:'' |
17 classVariableNames:'UserClass UserSpecs UserLabels' |
17 poolDictionaries:'' |
18 poolDictionaries:'' |
18 category:'Interface-UIPainter' |
19 category:'Interface-UIPainter' |
19 ! |
20 ! |
20 |
21 |
21 View subclass:#Canvas |
|
22 instanceVariableNames:'inputView selection specification lastClickPoint labelHolder |
|
23 nameHolder' |
|
24 classVariableNames:'' |
|
25 poolDictionaries:'' |
|
26 privateIn:UISelectionPanel |
|
27 ! |
|
28 |
|
29 DropObject subclass:#DropSpecification |
|
30 instanceVariableNames:'' |
|
31 classVariableNames:'' |
|
32 poolDictionaries:'' |
|
33 privateIn:UISelectionPanel::Canvas |
|
34 ! |
|
35 |
|
36 !UISelectionPanel class methodsFor:'documentation'! |
22 !UISelectionPanel class methodsFor:'documentation'! |
37 |
23 |
38 copyright |
24 copyright |
39 " |
25 " |
40 COPYRIGHT (c) 1997 by eXept Software AG |
26 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
41 All Rights Reserved |
27 All Rights Reserved |
42 |
28 |
43 This software is furnished under a license and may be used |
29 This software is furnished under a license and may be used |
44 only in accordance with the terms of that license and with the |
30 only in accordance with the terms of that license and with the |
45 inclusion of the above copyright notice. This software may not |
31 inclusion of the above copyright notice. This software may not |
46 be provided or otherwise made available to, or used by, any |
32 be provided or otherwise made available to, or used by, any |
47 other person. No title to or ownership of the software is |
33 other person. No title to or ownership of the software is |
48 hereby transferred. |
34 hereby transferred. |
49 " |
35 " |
50 |
36 |
|
37 |
51 ! |
38 ! |
52 |
39 |
53 documentation |
40 documentation |
54 " |
41 " |
55 implements a selection panel, keeping widgets which could be placed |
42 implements a selection panel, keeping widgets which could be placed |
56 into the UIPainter by drag & drop. |
43 into the UIPainter by drag & drop. |
57 |
44 |
|
45 [start with:] |
|
46 UISelectionPanel open |
|
47 |
58 [author:] |
48 [author:] |
|
49 Claus Gittinger |
59 Claus Atzkern |
50 Claus Atzkern |
60 |
51 |
61 [see also:] |
52 [see also:] |
62 TabView |
53 TabView |
|
54 NoteBookView |
|
55 UIGalleryView |
63 UIPainter |
56 UIPainter |
64 |
57 |
65 [start with:] |
|
66 UISelectionPanel open |
|
67 |
|
68 " |
58 " |
69 |
59 |
70 ! ! |
60 ! ! |
71 |
61 |
72 !UISelectionPanel class methodsFor:'instance creation'! |
62 !UISelectionPanel class methodsFor:'accessing'! |
73 |
63 |
74 newDefault |
64 specifications |
75 |appl| |
65 |
76 |
66 ^ #( |
77 appl := self new. |
67 #( 'Standarts' #( |
78 |
68 #('Button & Toggle' standartButtonToggle) |
79 appl labels:#( 'Button & Toggle' |
69 #('Menus' standartMenus) |
80 'Panel' |
70 #('Panel' standartPanels) |
81 'Text' |
71 #('Text' standartText) |
82 'View' |
72 #('Views' standartViews) |
83 'Menu & Combo' |
73 #('Canvas' standartCanvas) |
84 'Slider' |
74 #('Sliders' standartSliders) |
85 ) |
75 ) |
86 |
76 ) |
87 selectors:#( #buttonToggleSpec |
77 |
88 #panelSpec |
78 #( 'Clip Board' #( |
89 #textSpec |
79 #('Copy & Paste Buffer' clipBoardSpec) |
90 #viewsSpec |
80 ) |
91 #menuComboSpec |
81 ) |
92 #sliderSpec |
82 |
93 ) |
83 #( 'User Defined' #userDefined ) |
94 receiver:self. |
84 ) |
95 |
|
96 ^ appl. |
|
97 ! |
|
98 |
|
99 open |
|
100 |appl| |
|
101 |
|
102 appl := self newDefault. |
|
103 appl open. |
|
104 ^ appl. |
|
105 ! ! |
85 ! ! |
106 |
86 |
107 !UISelectionPanel class methodsFor:'interface specs'! |
87 !UISelectionPanel class methodsFor:'interface specification'! |
108 |
88 |
109 buttonToggleSpec |
89 nameAndSelectorSpec |
110 "this window spec was automatically generated by the ST/X UIPainter" |
90 "this window spec was automatically generated by the ST/X UIPainter" |
111 |
91 |
112 "do not manually edit this - the painter/builder may not be able to |
92 "do not manually edit this - the painter/builder may not be able to |
113 handle the specification if its corrupted." |
93 handle the specification if its corrupted." |
114 |
94 |
115 " |
95 " |
116 UIPainter new openOnClass:UISelectionPanel andSelector:#buttonToggleSpec |
96 UIPainter new openOnClass:UISelectionPanel andSelector:#nameAndSelectorSpec |
117 UISelectionPanel new openInterface:#buttonToggleSpec |
97 UISelectionPanel new openInterface:#nameAndSelectorSpec |
|
98 " |
|
99 |
|
100 <resource: #canvas> |
|
101 |
|
102 ^ |
|
103 |
|
104 #(#FullSpec |
|
105 #'window:' |
|
106 #(#WindowSpec |
|
107 #'name:' 'uIPainterView' |
|
108 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
109 #'label:' 'Painter' |
|
110 #'bounds:' #(#Rectangle 0 0 315 216) |
|
111 ) |
|
112 #'component:' |
|
113 #(#SpecCollection |
|
114 #'collection:' |
|
115 #( |
|
116 #(#LabelSpec |
|
117 #'name:' 'title' |
|
118 #'layout:' #(#Point 5 10) |
|
119 #'label:' 'class & selectors to access user specs:' |
|
120 #'adjust:' #left |
|
121 #'resizeForLabel:' true |
|
122 ) |
|
123 #(#LabelSpec |
|
124 #'name:' 'classLabel' |
|
125 #'layout:' #(#AlignmentOrigin 68 0.11 51 0 1 0.5) |
|
126 #'label:' 'Class:' |
|
127 #'adjust:' #right |
|
128 #'resizeForLabel:' true |
|
129 ) |
|
130 #(#InputFieldSpec |
|
131 #'name:' 'classField' |
|
132 #'layout:' #(#LayoutFrame 74 0.11 39 0 -5 1.0 61 0) |
|
133 #'tabable:' true |
|
134 #'model:' #className |
|
135 #'type:' #string |
|
136 ) |
|
137 #(#LabelSpec |
|
138 #'name:' 'labelsLabel' |
|
139 #'layout:' #(#AlignmentOrigin 68 0.11 74 0 1 0.5) |
|
140 #'label:' 'Labels:' |
|
141 #'adjust:' #right |
|
142 #'resizeForLabel:' true |
|
143 ) |
|
144 #(#InputFieldSpec |
|
145 #'name:' 'labelsField' |
|
146 #'layout:' #(#LayoutFrame 74 0.11 64 0 -5 1.0 86 0) |
|
147 #'tabable:' true |
|
148 #'model:' #labelsKey |
|
149 #'type:' #symbolOrNil |
|
150 ) |
|
151 #(#LabelSpec |
|
152 #'name:' 'specsLabel' |
|
153 #'layout:' #(#AlignmentOrigin 68 0.11 99 0 1 0.5) |
|
154 #'label:' 'Specifications:' |
|
155 #'adjust:' #right |
|
156 #'resizeForLabel:' true |
|
157 ) |
|
158 #(#InputFieldSpec |
|
159 #'name:' 'specsField' |
|
160 #'layout:' #(#LayoutFrame 74 0.11 89 0 -5 1.0 111 0) |
|
161 #'tabable:' true |
|
162 #'model:' #specsKey |
|
163 #'type:' #symbolOrNil |
|
164 ) |
|
165 #(#HorizontalPanelViewSpec |
|
166 #'name:' 'commitPanel' |
|
167 #'layout:' #(#LayoutFrame 0 0.0 -23 1.0 0 1.0 0 1.0) |
|
168 #'component:' |
|
169 #(#SpecCollection |
|
170 #'collection:' |
|
171 #( |
|
172 #(#ActionButtonSpec |
|
173 #'name:' 'cancel' |
|
174 #'label:' 'cancel' |
|
175 #'tabable:' true |
|
176 #'model:' #cancel |
|
177 #'extent:' #(#Point 153 23) |
|
178 ) |
|
179 #(#ActionButtonSpec |
|
180 #'name:' 'accept' |
|
181 #'label:' 'ok' |
|
182 #'tabable:' true |
|
183 #'isDefault:' true |
|
184 #'model:' #accept |
|
185 #'extent:' #(#Point 153 23) |
|
186 ) |
|
187 ) |
|
188 ) |
|
189 #'horizontalLayout:' #fitSpace |
|
190 #'verticalLayout:' #fit |
|
191 #'horizontalSpace:' 3 |
|
192 #'verticalSpace:' 3 |
|
193 ) |
|
194 #(#CheckBoxSpec |
|
195 #'name:' 'updateDefaultResources' |
|
196 #'layout:' #(#Point 5 133) |
|
197 #'model:' #updateDefaultResources |
|
198 #'label:' 'Update Default Resources' |
|
199 ) |
|
200 ) |
|
201 ) |
|
202 ) |
|
203 ! |
|
204 |
|
205 windowSpec |
|
206 "this window spec was automatically generated by the ST/X UIPainter" |
|
207 |
|
208 "do not manually edit this - the painter/builder may not be able to |
|
209 handle the specification if its corrupted." |
|
210 |
|
211 " |
|
212 UIPainter new openOnClass:UISelectionPanel andSelector:#windowSpec |
|
213 UISelectionPanel new openInterface:#windowSpec |
|
214 " |
|
215 "UISelectionPanel open" |
|
216 |
|
217 <resource: #canvas> |
|
218 |
|
219 ^ |
|
220 |
|
221 #(#FullSpec |
|
222 #'window:' |
|
223 #(#WindowSpec |
|
224 #'name:' 'uIPainterView' |
|
225 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
226 #'label:' 'Component Gallery' |
|
227 #'bounds:' #(#Rectangle 0 0 471 223) |
|
228 ) |
|
229 #'component:' |
|
230 #(#SpecCollection |
|
231 #'collection:' |
|
232 #( |
|
233 #(#UIGalleryViewSpec |
|
234 #'name:' 'gallery' |
|
235 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 -40 1.0 0 1.0) |
|
236 #'tabable:' true |
|
237 #'menu:' #galleryList |
|
238 #'style:' |
|
239 #(#FontDescription |
|
240 #helvetica #medium |
|
241 #roman #'10' |
|
242 ) |
|
243 #'model:' #galleryModel |
|
244 #'tabWidget:' #Window |
|
245 #'minorKeys:' #minorKeys |
|
246 #'clientSpec:' #clientSpec |
|
247 #'raiseMenu:' #raiseMenu |
|
248 #'useIndex:' true |
|
249 ) |
|
250 #(#TabViewSpec |
|
251 #'name:' 'major' |
|
252 #'layout:' #(#LayoutFrame -40 1.0 30 0.0 0 1.0 0 1.0) |
|
253 #'menu:' #majorList |
|
254 #'style:' |
|
255 #(#FontDescription |
|
256 #helvetica #medium |
|
257 #roman #'10' |
|
258 ) |
|
259 #'model:' #majorChannel |
|
260 #'tabWidget:' #Window |
|
261 #'direction:' #right |
|
262 #'useIndex:' true |
|
263 ) |
|
264 #(#LabelSpec |
|
265 #'name:' 'clientSpecLabel' |
|
266 #'layout:' #(#AlignmentOrigin 0 0.0 0 1.0 0 1) |
|
267 #'label:' '' |
|
268 #'adjust:' #left |
|
269 #'resizeForLabel:' true |
|
270 ) |
|
271 ) |
|
272 ) |
|
273 ) |
|
274 ! ! |
|
275 |
|
276 !UISelectionPanel class methodsFor:'menus'! |
|
277 |
|
278 menuSelected |
|
279 ^ #(#Menu #( |
|
280 #(#MenuItem |
|
281 #'label:' 'copy' |
|
282 #'value:' #copy |
|
283 ) |
|
284 #(#MenuItem |
|
285 #'label:' 'cut' |
|
286 #'value:' #cut |
|
287 ) |
|
288 ) |
|
289 nil |
|
290 nil |
|
291 ) |
|
292 |
|
293 |
|
294 |
|
295 ! |
|
296 |
|
297 menuUnselected |
|
298 ^ #(#Menu #( |
|
299 #(#MenuItem |
|
300 #'label:' 'paste' |
|
301 #'value:' #paste |
|
302 ) |
|
303 ) |
|
304 nil |
|
305 nil |
|
306 ) |
|
307 |
|
308 |
|
309 |
|
310 ! ! |
|
311 |
|
312 !UISelectionPanel class methodsFor:'standart specifications'! |
|
313 |
|
314 standartButtonToggle |
|
315 "this window spec was automatically generated by the ST/X UIPainter" |
|
316 |
|
317 "do not manually edit this - the painter/builder may not be able to |
|
318 handle the specification if its corrupted." |
|
319 |
|
320 " |
|
321 UIPainter new openOnClass:UISelectionPanel andSelector:#standartButtonToggle |
|
322 UISelectionPanel new openInterface:#standartButtonToggle |
118 " |
323 " |
119 |
324 |
120 <resource: #canvas> |
325 <resource: #canvas> |
121 |
326 |
122 ^ |
327 ^ |
582 #'window:' |
1009 #'window:' |
583 #(#WindowSpec |
1010 #(#WindowSpec |
584 #'name:' 'uIPainterView' |
1011 #'name:' 'uIPainterView' |
585 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
1012 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
586 #'label:' 'unnamed' |
1013 #'label:' 'unnamed' |
587 #'bounds:' #(#Rectangle 0 0 467 207) |
1014 #'bounds:' #(#Rectangle 0 0 431 200) |
588 ) |
|
589 #'component:' |
|
590 #(#SpecCollection |
|
591 #'collection:' |
|
592 #( |
|
593 #(#InputFieldSpec |
|
594 #'name:' 'EditField' |
|
595 #'layout:' #(#LayoutFrame 222 0 109 0 401 0 131 0) |
|
596 ) |
|
597 #(#LabelSpec |
|
598 #'name:' 'Text Label' |
|
599 #'layout:' #(#LayoutFrame 222 0 138 0 401 0 160 0) |
|
600 #'label:' '' |
|
601 ) |
|
602 #(#TextEditorSpec |
|
603 #'name:' 'EditTextView' |
|
604 #'layout:' #(#LayoutFrame 20 0 13 0 199 0 101 0) |
|
605 #'hasHorizontalScrollBar:' true |
|
606 #'hasVerticalScrollBar:' true |
|
607 ) |
|
608 #(#SequenceViewSpec |
|
609 #'name:' 'SelectionInListView' |
|
610 #'layout:' #(#LayoutFrame 222 0 13 0 401 0 101 0) |
|
611 #'hasHorizontalScrollBar:' true |
|
612 #'hasVerticalScrollBar:' true |
|
613 ) |
|
614 #(#HTMLViewSpec |
|
615 #'name:' 'HTMLView' |
|
616 #'layout:' #(#LayoutFrame 20 0 109 0 199 0 197 0) |
|
617 #'hasHorizontalScrollBar:' true |
|
618 #'hasVerticalScrollBar:' true |
|
619 ) |
|
620 #(#LabelSpec |
|
621 #'name:' 'HTMLViewLabel' |
|
622 #'layout:' #(#LayoutFrame 93 0 179 0 183 0 193 0) |
|
623 #'label:' 'HTMLView' |
|
624 #'style:' |
|
625 #(#FontDescription |
|
626 #helvetica #medium |
|
627 #roman #'10' |
|
628 ) |
|
629 #'adjust:' #left |
|
630 #'canUIDrag:' false |
|
631 ) |
|
632 #(#LabelSpec |
|
633 #'name:' 'label1' |
|
634 #'layout:' #(#LayoutFrame 93 0 83 0 183 0 97 0) |
|
635 #'label:' 'EditText' |
|
636 #'style:' |
|
637 #(#FontDescription |
|
638 #helvetica #medium |
|
639 #roman #'10' |
|
640 ) |
|
641 #'adjust:' #left |
|
642 #'canUIDrag:' false |
|
643 ) |
|
644 #(#LabelSpec |
|
645 #'name:' 'label2' |
|
646 #'layout:' #(#LayoutFrame 295 0 83 0 387 0 97 0) |
|
647 #'label:' 'SelectionInList' |
|
648 #'style:' |
|
649 #(#FontDescription |
|
650 #helvetica #medium |
|
651 #roman #'10' |
|
652 ) |
|
653 #'adjust:' #left |
|
654 #'canUIDrag:' false |
|
655 ) |
|
656 #(#LabelSpec |
|
657 #'name:' 'labelInLabel' |
|
658 #'layout:' #(#LayoutFrame 226 0 142 0 275 0 156 0) |
|
659 #'label:' 'Label' |
|
660 #'style:' |
|
661 #(#FontDescription |
|
662 #helvetica #medium |
|
663 #roman #'10' |
|
664 ) |
|
665 #'adjust:' #left |
|
666 #'canUIDrag:' false |
|
667 ) |
|
668 ) |
|
669 ) |
|
670 ) |
|
671 ! |
|
672 |
|
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 ^ |
|
687 |
|
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' |
|
694 #'bounds:' #(#Rectangle 0 0 485 245) |
|
695 ) |
1015 ) |
696 #'component:' |
1016 #'component:' |
697 #(#SpecCollection |
1017 #(#SpecCollection |
698 #'collection:' |
1018 #'collection:' |
699 #( |
1019 #( |
700 #(#FramedBoxSpec |
1020 #(#FramedBoxSpec |
701 #'name:' 'FramedBox' |
1021 #'name:' 'FramedBox' |
702 #'layout:' #(#LayoutFrame 16 0 14 0 177 0 104 0) |
1022 #'layout:' #(#LayoutFrame 16 0 14 0 136 0 94 0) |
703 #'label:' 'FramedBox' |
1023 #'label:' 'FramedBox' |
704 #'labelPosition:' #topCenter |
1024 #'labelPosition:' #topCenter |
705 ) |
1025 ) |
706 #(#ViewSpec |
1026 #(#ViewSpec |
707 #'name:' 'View' |
1027 #'name:' 'View' |
708 #'layout:' #(#LayoutFrame 14 0 116 0 175 0 188 0) |
1028 #'layout:' #(#LayoutFrame 152 0 14 0 266 0 94 0) |
709 ) |
|
710 #(#SubCanvasSpec |
|
711 #'name:' 'SubCanvas' |
|
712 #'layout:' #(#LayoutFrame 199 0 14 0 360 0 104 0) |
|
713 #'hasHorizontalScrollBar:' true |
|
714 #'hasVerticalScrollBar:' true |
|
715 ) |
|
716 #(#LabelSpec |
|
717 #'name:' 'subCanvasLabel' |
|
718 #'layout:' #(#LayoutFrame 272 0 86 0 343 0 100 0) |
|
719 #'label:' 'SubCanvas' |
|
720 #'style:' |
|
721 #(#FontDescription |
|
722 #helvetica #medium |
|
723 #roman #'10' |
|
724 ) |
|
725 #'adjust:' #left |
|
726 #'canUIDrag:' false |
|
727 ) |
1029 ) |
728 #(#DividerSpec |
1030 #(#DividerSpec |
729 #'name:' 'Horizontal Seperator' |
1031 #'name:' 'Horizontal Seperator' |
730 #'layout:' #(#LayoutFrame 199 0 116 0 360 0 120 0) |
1032 #'layout:' #(#LayoutFrame 16 0 107 0 137 0 111 0) |
731 #'orientation:' #horizontal |
1033 #'orientation:' #horizontal |
732 ) |
1034 ) |
733 #(#DividerSpec |
1035 #(#DividerSpec |
734 #'name:' 'Vertical Seperator' |
1036 #'name:' 'Vertical Seperator' |
735 #'layout:' #(#LayoutFrame 356 0 116 0 360 0 188 0) |
1037 #'layout:' #(#LayoutFrame 16 0 107 0 20 0 159 0) |
736 #'orientation:' #vertical |
1038 #'orientation:' #vertical |
737 ) |
1039 ) |
738 #(#LabelSpec |
1040 #(#LabelSpec |
739 #'name:' 'viewLabel' |
1041 #'name:' 'viewLabel' |
740 #'layout:' #(#LayoutFrame 19 0 118 0 70 0 135 0) |
1042 #'layout:' #(#AlignmentOrigin 158 0 20 0 0 0) |
741 #'label:' 'View' |
1043 #'label:' 'View' |
742 #'style:' |
1044 #'style:' |
743 #(#FontDescription |
1045 #(#FontDescription |
744 #helvetica #medium |
1046 #helvetica #medium |
745 #roman #'10' |
1047 #roman #'10' |
746 ) |
1048 ) |
747 #'adjust:' #left |
1049 #'adjust:' #left |
|
1050 #'resizeForLabel:' true |
748 #'canUIDrag:' false |
1051 #'canUIDrag:' false |
749 ) |
1052 ) |
750 #(#LabelSpec |
1053 #(#LabelSpec |
751 #'name:' 'Seperators' |
1054 #'name:' 'Seperators' |
752 #'layout:' #(#LayoutFrame 199 0 125 0 270 0 143 0) |
1055 #'layout:' #(#AlignmentOrigin 136 0 117 0 1 0) |
753 #'label:' 'Seperators' |
1056 #'label:' 'Seperators' |
754 #'style:' |
1057 #'style:' |
755 #(#FontDescription |
1058 #(#FontDescription |
756 #helvetica #medium |
1059 #helvetica #medium |
757 #roman #'10' |
1060 #roman #'10' |
758 ) |
1061 ) |
759 #'adjust:' #left |
1062 #'adjust:' #left |
|
1063 #'resizeForLabel:' true |
760 #'canUIDrag:' false |
1064 #'canUIDrag:' false |
761 ) |
1065 ) |
762 #(#RegionSpec |
1066 #(#RegionSpec |
763 #'name:' 'Region' |
1067 #'name:' 'Region' |
764 #'layout:' #(#LayoutFrame 373 0 14 0 473 0 104 0) |
1068 #'layout:' #(#LayoutFrame 278 0 14 0 358 0 94 0) |
765 #'lineWidth:' 2 |
1069 #'lineWidth:' 2 |
766 #'regionType:' #ellipse |
1070 #'regionType:' #ellipse |
767 ) |
1071 ) |
768 #(#LabelSpec |
1072 #(#LabelSpec |
769 #'name:' 'RegionLabel' |
1073 #'name:' 'RegionLabel' |
770 #'layout:' #(#LayoutFrame 388 0 50 0 459 0 68 0) |
1074 #'layout:' #(#AlignmentOrigin 319 0 54 0 0.5 0.5) |
771 #'label:' 'Region' |
1075 #'label:' 'Region' |
772 #'style:' |
1076 #'style:' |
773 #(#FontDescription |
1077 #(#FontDescription |
774 #helvetica #medium |
1078 #helvetica #medium |
775 #roman #'10' |
1079 #roman #'10' |
776 ) |
1080 ) |
|
1081 #'resizeForLabel:' true |
777 #'canUIDrag:' false |
1082 #'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 ) |
|
803 #'canUIDrag:' false |
|
804 ) |
|
805 ) |
|
806 ) |
|
807 ) |
|
808 ! |
|
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) |
|
831 #'label:' 'Component Gallery' |
|
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' |
|
842 #'labelChannel:' #nameOfObject |
|
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) |
|
849 #'menu:' #tabList |
|
850 #'model:' #tabModel |
|
851 #'tabWidget:' #Window |
|
852 #'useIndex:' true |
|
853 #'level:' 2 |
|
854 #'canvas:' #canvas |
|
855 ) |
1083 ) |
856 ) |
1084 ) |
857 ) |
1085 ) |
858 ) |
1086 ) |
859 ! ! |
1087 ! ! |
860 |
1088 |
861 !UISelectionPanel methodsFor:'accessing'! |
1089 !UISelectionPanel methodsFor:'actions'! |
862 |
1090 |
863 labels:loLabels selectors:loSelectors receiver:aReceiver |
1091 defineClassAndSelector |
864 selectors := loSelectors. |
1092 |bd cls sel lbl| |
865 receiver := aReceiver. |
1093 |
866 (self tabList) value:loLabels. |
1094 bd := IdentityDictionary new. |
867 |
1095 bd at:#className put:( userClass asValue). |
868 ! ! |
1096 bd at:#specsKey put:( (userSpecs ? '') asValue). |
869 |
1097 bd at:#labelsKey put:( (userLabels ? '') asValue). |
870 !UISelectionPanel methodsFor:'aspects'! |
1098 bd at:#updateDefaultResources put:(false asValue). |
871 |
1099 |
872 canvas |
1100 (self openDialogInterface:#nameAndSelectorSpec withBindings:bd) ifTrue:[ |
873 |holder| |
1101 ( (cls := (bd at:#className) value) notNil |
874 |
1102 and:[(sel := (bd at:#specsKey) value) notNil |
875 (holder := builder bindingAt:#canvas) isNil ifTrue:[ |
1103 and:[(lbl := (bd at:#labelsKey) value) notNil]] |
876 builder aspectAt:#canvas put:(holder := Canvas new) |
1104 ) ifTrue:[ |
877 ]. |
1105 userClass := cls. |
878 ^ holder |
1106 userSpecs := sel. |
879 ! |
1107 userLabels := lbl. |
880 |
1108 |
881 nameOfObject |
1109 (bd at:#updateDefaultResources) value ifTrue:[ |
882 |holder canvas| |
1110 UserClass := userClass. |
883 |
1111 UserSpecs := userSpecs. |
884 (holder := builder bindingAt:#nameOfObject) isNil ifTrue:[ |
1112 UserLabels := userLabels. |
885 builder aspectAt:#nameOfObject put:(holder := ValueHolder new). |
1113 ] |
886 canvas := self canvas. |
1114 ] |
887 canvas nameHolder:holder. |
1115 ]. |
888 ]. |
1116 ! |
889 ^ holder |
1117 |
890 ! |
1118 paste:something |
891 |
1119 "paste something at a point |
892 tabList |
1120 " |
893 "returns list of tab-labels |
1121 |coll specs point device gallery ext spec| |
894 " |
1122 |
895 |holder| |
1123 clipBoardSpec isNil ifTrue:[ |
896 |
1124 clipBoardSpec := SpecCollection new. |
897 (holder := builder bindingAt:#tabList) isNil ifTrue:[ |
1125 clipBoardSpec collection:(OrderedCollection new). |
898 builder aspectAt:#tabList put:(holder := ValueHolder new). |
1126 ]. |
899 ]. |
1127 coll := clipBoardSpec collection. |
900 ^ holder |
1128 gallery := self builder componentAt:#gallery. |
901 ! |
1129 device := gallery device. |
902 |
1130 |
903 tabModel |
1131 point := device translatePoint:(device pointerPosition) |
904 "returns my model; catching select notifications |
1132 from:(device rootView id) |
905 " |
1133 to:(gallery canvas id). |
906 |holder| |
1134 |
907 |
1135 point y < 1 ifTrue:[point y:1]. |
908 (holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
1136 ext := gallery extent - (10@10). |
909 holder := AspectAdaptor new subject:self; forAspect:#selection. |
1137 |
910 builder aspectAt:#tabModel put:holder. |
1138 (specs := something) isCollection ifFalse:[ |
911 ]. |
1139 specs := Array with:something |
912 ^ holder |
1140 ]. |
913 |
1141 |
914 ! ! |
1142 specs do:[:aSpec| |
915 |
1143 point x > ext x ifTrue:[point x:1]. |
916 !UISelectionPanel methodsFor:'selection'! |
1144 point y > ext y ifTrue:[point y:1]. |
917 |
1145 |
918 selection |
1146 spec := aSpec copy. |
919 ^ selection |
1147 spec layout:(LayoutOrigin fromPoint:point). |
920 ! |
1148 coll add:spec. |
921 |
1149 point := point + (20@20). |
922 selection:aValue |
1150 ]. |
923 |spec canvas| |
1151 gallery update. |
924 |
1152 ! |
925 (aValue isNil or:[aValue == 0]) ifTrue:[ |
1153 |
926 ^ self |
1154 raiseMenu |
927 ]. |
1155 "can open menu |
928 selection ~~ aValue ifTrue:[ |
1156 " |
929 (selection := aValue) notNil ifTrue:[ |
1157 |spec menu value collection paste| |
930 selectors size >= aValue ifTrue:[ |
1158 |
931 spec := receiver perform:(selectors at:selection) |
1159 spec := self clientSpec value. |
|
1160 |
|
1161 spec notNil ifTrue:[ |
|
1162 menu := self class menuSelected decodeAsLiteralArray. |
|
1163 self isClipBoard ifFalse:[ |
|
1164 (menu someMenuItemWithValue:#cut) disable. |
|
1165 ]. |
|
1166 |
|
1167 (value := menu startUp) == #cut ifTrue:[ |
|
1168 clipBoardSpec collection remove:spec ifAbsent:nil. |
|
1169 (self builder componentAt:#gallery) update. |
|
1170 ] ifFalse:[ |
|
1171 value == #copy ifTrue:[ |
|
1172 self window setSelection:spec |
932 ] |
1173 ] |
933 ]. |
1174 ]. |
934 canvas := builder aspectAt:#canvas. |
1175 ^ self |
935 canvas specification:spec. |
1176 ]. |
|
1177 |
|
1178 self isUserBoard ifTrue:[ |
|
1179 ^ self defineClassAndSelector |
|
1180 ]. |
|
1181 |
|
1182 paste := self window getSelection. |
|
1183 |
|
1184 (self canPaste:paste) ifTrue:[ |
|
1185 menu := self class menuUnselected decodeAsLiteralArray. |
|
1186 |
|
1187 (menu startUp) == #paste ifTrue:[ |
|
1188 self paste:paste |
|
1189 ] |
936 ]. |
1190 ]. |
937 ! ! |
1191 ! ! |
938 |
1192 |
939 !UISelectionPanel::Canvas methodsFor:'accessing'! |
1193 !UISelectionPanel methodsFor:'aspects'! |
940 |
1194 |
941 nameHolder:aValueHolder |
1195 clientSpec |
942 "set value holder which keeps the name of the object |
1196 "automatically generated by UIPainter ..." |
943 under the cursor or selected |
1197 |
944 " |
1198 |holder| |
945 nameHolder := aValueHolder |
1199 |
946 ! |
1200 (holder := builder bindingAt:#clientSpec) isNil ifTrue:[ |
947 |
1201 builder aspectAt:#clientSpec put:(holder := ValueHolder new). |
948 specification:aSpecOrSpecArray |
1202 holder addDependent:self. |
949 "load a new specification |
1203 ]. |
950 " |
1204 ^ holder |
951 |builder| |
1205 ! |
952 |
1206 |
953 self selection:nil. |
1207 clipBoardSpec |
954 |
1208 ^ clipBoardSpec |
955 self subViews copy do:[:aSubView| |
1209 ! |
956 aSubView ~~ inputView ifTrue:[ |
1210 |
957 aSubView destroy |
1211 galleryList |
|
1212 "automatically generated by UIPainter ..." |
|
1213 |
|
1214 |holder| |
|
1215 |
|
1216 (holder := builder bindingAt:#galleryList) isNil ifTrue:[ |
|
1217 builder aspectAt:#galleryList put:(holder := ValueHolder new). |
|
1218 ]. |
|
1219 ^ holder |
|
1220 ! |
|
1221 |
|
1222 galleryModel |
|
1223 "automatically generated by UIPainter ..." |
|
1224 |
|
1225 |holder| |
|
1226 |
|
1227 (holder := builder bindingAt:#galleryModel) isNil ifTrue:[ |
|
1228 builder aspectAt:#galleryModel put:(holder := ValueHolder new). |
|
1229 ]. |
|
1230 ^ holder |
|
1231 ! |
|
1232 |
|
1233 majorChannel |
|
1234 "automatically generated by UIPainter ..." |
|
1235 |
|
1236 |holder| |
|
1237 |
|
1238 (holder := builder bindingAt:#majorChannel) isNil ifTrue:[ |
|
1239 holder := AspectAdaptor new subject:self; forAspect:#majorSelection. |
|
1240 builder aspectAt:#majorChannel put:holder. |
|
1241 ]. |
|
1242 ^ holder |
|
1243 ! |
|
1244 |
|
1245 majorList |
|
1246 "automatically generated by UIPainter ... |
|
1247 " |
|
1248 ^ self class specifications collect:[:el| el first] |
|
1249 ! |
|
1250 |
|
1251 minorKeys |
|
1252 "automatically generated by UIPainter ..." |
|
1253 |
|
1254 |holder| |
|
1255 |
|
1256 (holder := builder bindingAt:#minorKeys) isNil ifTrue:[ |
|
1257 builder aspectAt:#minorKeys put:(holder := ValueHolder new). |
|
1258 ]. |
|
1259 ^ holder |
|
1260 ! ! |
|
1261 |
|
1262 !UISelectionPanel methodsFor:'change & update'! |
|
1263 |
|
1264 update:something with:aParameter from:changedObject |
|
1265 "one of my models changed its value |
|
1266 " |
|
1267 |channel label| |
|
1268 |
|
1269 (channel := self clientSpec) == changedObject ifTrue:[ |
|
1270 label := self builder componentAt:#clientSpecLabel. |
|
1271 |
|
1272 channel value notNil ifTrue:[ |
|
1273 label label:(' ', channel value name, ' '). |
|
1274 label level:1. |
|
1275 ] ifFalse:[ |
|
1276 label label:nil. |
|
1277 label level:0. |
958 ] |
1278 ] |
959 ]. |
1279 ]. |
960 |
1280 |
961 aSpecOrSpecArray notNil ifTrue:[ |
1281 super update:something with:aParameter from:changedObject. |
962 specification := UISpecification from:aSpecOrSpecArray. |
1282 |
963 builder := UIBuilder new. |
1283 |
964 specification buildViewFor:builder in:self. |
1284 ! ! |
965 |
1285 |
966 subViews do:[:v| |
1286 !UISelectionPanel methodsFor:'drag & drop'! |
967 (v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[ |
1287 |
968 v borderWidth:1. |
1288 canDrop:something in:aComponent |
|
1289 ^ self canPaste:(something collect:[:el| el theObject ]). |
|
1290 ! |
|
1291 |
|
1292 drop:something in:aComponent at:aPoint |
|
1293 |
|
1294 |spc top| |
|
1295 |
|
1296 top := DragAndDropManager dragOriginatorQuerySignal raise topView. |
|
1297 |
|
1298 top == aComponent topView ifTrue:[ |
|
1299 spc := self clientSpec value. |
|
1300 spc isNil ifTrue:[^ self]. |
|
1301 |
|
1302 (clipBoardSpec collection remove:spc ifAbsent:nil) isNil ifTrue:[ |
|
1303 ^ self |
|
1304 ]. |
|
1305 ] ifFalse:[ |
|
1306 spc := something collect:[:el| el theObject]. |
|
1307 ]. |
|
1308 self paste:spc. |
|
1309 ! ! |
|
1310 |
|
1311 !UISelectionPanel methodsFor:'queries'! |
|
1312 |
|
1313 canPaste:something |
|
1314 "returns true if something could be paste |
|
1315 " |
|
1316 (self isClipBoard and:[something notNil]) ifTrue:[ |
|
1317 something isCollection ifTrue:[ |
|
1318 something notEmpty ifTrue:[ |
|
1319 ^ (something at:1) isKindOf:UISpecification |
969 ] |
1320 ] |
|
1321 ] ifFalse:[ |
|
1322 ^ something isKindOf:UISpecification |
|
1323 ] |
|
1324 ]. |
|
1325 ^ false |
|
1326 |
|
1327 ! |
|
1328 |
|
1329 isClipBoard |
|
1330 "returns true if current view is clip board |
|
1331 " |
|
1332 majorSelection notNil ifTrue:[ |
|
1333 ^ (self majorList at:majorSelection) startsWith:'Clip' |
|
1334 ]. |
|
1335 ^ false |
|
1336 ! |
|
1337 |
|
1338 isUserBoard |
|
1339 "returns true if current view is clip board |
|
1340 " |
|
1341 majorSelection notNil ifTrue:[ |
|
1342 ^ (self majorList at:majorSelection) startsWith:'User' |
|
1343 ]. |
|
1344 ^ false |
|
1345 ! ! |
|
1346 |
|
1347 !UISelectionPanel methodsFor:'selection'! |
|
1348 |
|
1349 majorSelection |
|
1350 ^ majorSelection |
|
1351 ! |
|
1352 |
|
1353 majorSelection:aSelection |
|
1354 |spec channel| |
|
1355 |
|
1356 (majorSelection == aSelection or:[aSelection isNil]) ifTrue:[ |
|
1357 ^ self |
|
1358 ]. |
|
1359 (self builder componentAt:#gallery) builder:nil. |
|
1360 majorSelection := aSelection. |
|
1361 spec := ((self class specifications) at:aSelection) last. |
|
1362 |
|
1363 spec isSymbol ifFalse:[ |
|
1364 self galleryList value:(spec collect:[:a| a first]). |
|
1365 self minorKeys value:(spec collect:[:a| a last]). |
|
1366 ] ifTrue:[ |
|
1367 self perform:spec |
|
1368 ]. |
|
1369 channel := self galleryModel. |
|
1370 |
|
1371 channel value notNil ifTrue:[ |
|
1372 channel setValue:nil |
|
1373 ]. |
|
1374 channel value:1. |
|
1375 |
|
1376 ! ! |
|
1377 |
|
1378 !UISelectionPanel methodsFor:'startup / release'! |
|
1379 |
|
1380 allButOpenInterface:aSpec |
|
1381 "setup default values |
|
1382 " |
|
1383 super allButOpenInterface:aSpec. |
|
1384 userClass := UserClass. |
|
1385 userSpecs := UserSpecs. |
|
1386 userLabels := UserLabels. |
|
1387 ! |
|
1388 |
|
1389 closeRequest |
|
1390 |sav| |
|
1391 |
|
1392 (sav := masterApplication) notNil ifTrue:[ |
|
1393 masterApplication := nil. |
|
1394 masterApplication closeRequestFor:(self window). |
|
1395 masterApplication := sav. |
|
1396 ] ifFalse:[ |
|
1397 super closeRequest. |
|
1398 ] |
|
1399 ! |
|
1400 |
|
1401 openWindow |
|
1402 "setup default values |
|
1403 " |
|
1404 super openWindow. |
|
1405 "/ self window waitForExpose. |
|
1406 Delay waitForSeconds:1. |
|
1407 self majorChannel value:1. |
|
1408 ! ! |
|
1409 |
|
1410 !UISelectionPanel methodsFor:'user defined'! |
|
1411 |
|
1412 userDefined |
|
1413 |cls lbl sel builder| |
|
1414 |
|
1415 (cls := userClass) notNil ifTrue:[ |
|
1416 cls isBehavior ifFalse:[ |
|
1417 cls := Smalltalk at:cls asSymbol |
970 ]. |
1418 ]. |
971 |
1419 (cls notNil and:[(cls respondsTo:userLabels)]) ifTrue:[ |
972 self realizeAllSubViews. |
1420 lbl := cls perform:userLabels. |
973 inputView raise. |
1421 sel := Array new:(lbl size) withAll:#userDefinedSpec. |
974 ] ifFalse:[ |
1422 self galleryList value:lbl. |
975 specification := nil |
1423 self minorKeys value:sel. |
976 ] |
|
977 |
|
978 ! ! |
|
979 |
|
980 !UISelectionPanel::Canvas methodsFor:'drag & drop'! |
|
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 |
|
991 spec := aSpec copy. |
|
992 |
|
993 (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[ |
|
994 ^ spec |
|
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 ] |
1424 ] |
1008 ]. |
1425 ]. |
1009 coll isEmpty ifTrue:[ |
1426 builder := UIBuilder new. |
1010 ^ spec |
1427 builder application:self. |
1011 ]. |
1428 (self builder componentAt:#gallery) builder:builder. |
1012 comp := comp copy. |
1429 self galleryList value:#( '???' ). |
1013 comp collection:coll. |
1430 self minorKeys value:#( standartUserPanel ). |
1014 spec component:comp. |
1431 ! |
1015 ^ spec |
1432 |
1016 |
1433 userDefinedHelpText |
1017 |
1434 |
1018 ! |
1435 ^ ' |
1019 |
1436 no user defined specifications are configured yet. To assign |
1020 startDrag |
1437 user defined specifications to the gallery press the middle |
1021 "start drag of selection |
1438 button of your mouse to open a dialog. |
1022 " |
1439 ' |
1023 |dragObj spec name| |
1440 ! |
1024 |
1441 |
1025 spec := self findSpecFor:selection. |
1442 userDefinedSpec |
1026 |
1443 |cls spc idx| |
1027 spec notNil ifTrue:[ |
1444 |
1028 spec := self buildSpecFrom:spec. |
1445 (cls := userClass) notNil ifTrue:[ |
1029 name := spec className asString. |
1446 cls isBehavior ifFalse:[ |
1030 name := name copyFrom:1 to:(name size - ('Spec' size) + 1). |
1447 cls := Smalltalk at:cls asSymbol |
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 |
|
1080 (selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[ |
|
1081 self showSelected. |
|
1082 ]. |
|
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 |
|
1102 findObjectAtX:x y:y |
|
1103 "find the origin/corner of the currentWidget |
|
1104 " |
|
1105 |point id p e| |
|
1106 |
|
1107 point := Point x:x y:y. |
|
1108 id := inputView id. |
|
1109 |
|
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 ] |
|
1119 ] |
|
1120 ]. |
|
1121 ^ nil |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
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 |
|
1148 !UISelectionPanel::Canvas methodsFor:'selection'! |
|
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:[ |
|
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). |
|
1163 ] |
|
1164 |
|
1165 ! |
|
1166 |
|
1167 selection:anObject |
|
1168 "selection changed |
|
1169 " |
|
1170 |name| |
|
1171 |
|
1172 selection ~~ anObject ifTrue:[ |
|
1173 self showUnselected. |
|
1174 (self findSpecFor:anObject) notNil ifTrue:[ |
|
1175 selection := anObject. |
|
1176 name := anObject name. |
|
1177 self showSelected |
|
1178 ] ifFalse:[ |
|
1179 selection := nil |
|
1180 ]. |
1448 ]. |
1181 nameHolder notNil ifTrue:[nameHolder value:name] |
1449 (cls notNil and:[(cls respondsTo:userSpecs)]) ifTrue:[ |
1182 ] |
1450 spc := cls perform:userSpecs. |
1183 |
1451 idx := self galleryModel value. |
1184 ! |
1452 |
1185 |
1453 idx <= spc size ifTrue:[ |
1186 showSelected |
1454 spc := spc at:idx. |
1187 "show selected |
1455 (cls respondsTo:spc) ifTrue:[ |
1188 " |
1456 ^ cls perform:spc |
1189 selection notNil ifTrue:[ |
|
1190 self clippedByChildren:false. |
|
1191 |
|
1192 self handlesOf:selection do:[:aRectangle| |
|
1193 self fillRectangle:aRectangle |
|
1194 ]. |
|
1195 self clippedByChildren:true. |
|
1196 ]. |
|
1197 |
|
1198 |
|
1199 ! |
|
1200 |
|
1201 showUnselected |
|
1202 "show unselected |
|
1203 " |
|
1204 |r currSel| |
|
1205 |
|
1206 (currSel := selection) isNil ifTrue:[ |
|
1207 ^ self |
|
1208 ]. |
|
1209 selection := nil. |
|
1210 self clippedByChildren:false. |
|
1211 |
|
1212 self handlesOf:currSel do:[:aRectangle| |
|
1213 self clearRectangle:aRectangle |
|
1214 ]. |
|
1215 self clippedByChildren:true. |
|
1216 r := currSel bounds. |
|
1217 |
|
1218 subViews do:[:sv| |
|
1219 |absOrg absFrame| |
|
1220 |
|
1221 sv ~~ inputView ifTrue:[ |
|
1222 (sv bounds intersects:r) ifTrue:[ |
|
1223 sv borderColor:(Color gray:5). |
|
1224 sv borderColor:(Color black). |
|
1225 |
|
1226 sv withAllSubViewsDo:[:v| |
|
1227 v fill:v viewBackground. |
|
1228 v exposeX:0 y:0 width:9999 height:9999. |
|
1229 ] |
1457 ] |
1230 ] |
1458 ] |
1231 ] |
1459 ] |
1232 ]. |
1460 ]. |
1233 selection := currSel. |
1461 ^ nil |
1234 |
|
1235 ! ! |
|
1236 |
|
1237 !UISelectionPanel::Canvas::DropSpecification class methodsFor:'instance creation'! |
|
1238 |
|
1239 for:aView specification:aSpec |
|
1240 "create drop object for a view derived from a specification |
|
1241 " |
|
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. |
|
1250 |
|
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. |
|
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 ]. |
|
1268 aSpec class == UISubSpecification ifTrue:[ |
|
1269 aSpec layout:(LayoutOrigin fromPoint:0@0) |
|
1270 ]. |
|
1271 ^ self new theObject:aSpec |
|
1272 |
|
1273 |
|
1274 ! ! |
1462 ! ! |
1275 |
1463 |
1276 !UISelectionPanel class methodsFor:'documentation'! |
1464 !UISelectionPanel class methodsFor:'documentation'! |
1277 |
1465 |
1278 version |
1466 version |
1279 ^ '$Header$' |
1467 ^ '$Header$' |
|
1468 |
1280 ! ! |
1469 ! ! |