author | tz |
Thu, 05 Feb 1998 22:19:32 +0100 | |
changeset 604 | 9d62f4f07c65 |
parent 396 | e15b7b5bb81b |
child 661 | 34af6869d5b8 |
permissions | -rw-r--r-- |
181 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
||
15 |
NoteBookView subclass:#UIGalleryView |
|
16 |
instanceVariableNames:'majorKey minorKeys minorKeysHolder' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-UIPainter' |
|
20 |
! |
|
21 |
||
22 |
View subclass:#Canvas |
|
23 |
instanceVariableNames:'dragMode clientSpecHolder inputView selection specification |
|
24 |
lastClickPoint menuSelector raiseMenuSelector uiBuilder' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
privateIn:UIGalleryView |
|
28 |
! |
|
29 |
||
30 |
DropObject subclass:#DropSpec |
|
31 |
instanceVariableNames:'' |
|
247 | 32 |
classVariableNames:'' |
181 | 33 |
poolDictionaries:'' |
34 |
privateIn:UIGalleryView::Canvas |
|
35 |
! |
|
36 |
||
37 |
!UIGalleryView class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
41 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
42 |
All Rights Reserved |
|
43 |
||
44 |
This software is furnished under a license and may be used |
|
45 |
only in accordance with the terms of that license and with the |
|
46 |
inclusion of the above copyright notice. This software may not |
|
47 |
be provided or otherwise made available to, or used by, any |
|
48 |
other person. No title to or ownership of the software is |
|
49 |
hereby transferred. |
|
50 |
" |
|
51 |
||
52 |
||
53 |
! |
|
54 |
||
55 |
documentation |
|
56 |
" |
|
57 |
implements a selection panel, keeping widgets which could be placed |
|
58 |
into other components by drag & drop or copy @ paste. The objects |
|
59 |
which are draged/droped must be kind of UISpecification's. |
|
60 |
The UISelectionPanel used by the UIPainter is implemented in this way. |
|
61 |
||
62 |
[author:] |
|
63 |
Claus Gittinger |
|
64 |
Claus Atzkern |
|
65 |
||
66 |
[see also:] |
|
67 |
UIPainter |
|
68 |
UISelectionPanel |
|
69 |
" |
|
70 |
||
71 |
! |
|
72 |
||
73 |
examples |
|
74 |
" |
|
75 |
opens a gallery |
|
76 |
||
77 |
[exBegin] |
|
78 |
|top sel| |
|
79 |
||
80 |
top := StandardSystemView new label:'gallery'; extent:500@300. |
|
81 |
sel := UIGalleryView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
82 |
||
83 |
sel labels:#( 'Buttons' |
|
84 |
'Panels' |
|
85 |
'Text' |
|
86 |
). |
|
87 |
||
191 | 88 |
sel minorKeys:#( #standardButtonToggle |
89 |
#standardPanels |
|
90 |
#standardText |
|
181 | 91 |
). |
92 |
||
93 |
sel majorKey:UISelectionPanel. |
|
94 |
top open. |
|
95 |
[exEnd] |
|
96 |
" |
|
97 |
! ! |
|
98 |
||
99 |
!UIGalleryView methodsFor:'accessing'! |
|
100 |
||
101 |
builder |
|
102 |
"get the builder used to setup a window from a specification (or nil in case |
|
103 |
of using a new builder) |
|
104 |
" |
|
105 |
^ canvas builder |
|
106 |
! |
|
107 |
||
108 |
builder:aBuilderOrNil |
|
109 |
"set the builder used to setup a window from a specification (or nil in case |
|
110 |
of using a new builder) |
|
111 |
" |
|
112 |
canvas builder:aBuilderOrNil |
|
113 |
! |
|
114 |
||
115 |
canvas:aCanvas |
|
116 |
^ self |
|
117 |
||
118 |
! |
|
119 |
||
120 |
labels:listOfLabels minorKeys:listOfMinorKeys majorKey:aMajorKey |
|
121 |
"setup for labels, selectors and class provider |
|
122 |
" |
|
123 |
self labels:listOfLabels. |
|
124 |
minorKeys := listOfMinorKeys. |
|
125 |
majorKey := aMajorKey. |
|
126 |
! |
|
127 |
||
128 |
majorKey |
|
129 |
"get the class providing the window specifications |
|
130 |
" |
|
131 |
^ majorKey |
|
132 |
! |
|
133 |
||
134 |
majorKey:aKey |
|
135 |
"get the class providing the window specifications |
|
136 |
" |
|
335 | 137 |
|appl| |
138 |
||
139 |
appl := self application. |
|
140 |
||
141 |
appl notNil ifTrue:[ |
|
142 |
majorKey := appl resolveName:aKey |
|
143 |
] ifFalse:[ |
|
144 |
majorKey := Smalltalk resolveName:aKey inClass:self class |
|
145 |
]. |
|
181 | 146 |
self selection:nil |
147 |
! |
|
148 |
||
149 |
minorKeys |
|
150 |
"get the list of selector keys |
|
151 |
" |
|
152 |
^ minorKeys |
|
153 |
! |
|
154 |
||
155 |
minorKeys:aListOfSelectors |
|
156 |
"set the list of selectors |
|
157 |
" |
|
158 |
minorKeys := aListOfSelectors. |
|
159 |
tabRaw selection:nil. |
|
160 |
! ! |
|
161 |
||
162 |
!UIGalleryView methodsFor:'accessing holders'! |
|
163 |
||
164 |
clientSpecHolder |
|
165 |
"get the holder which keeps the current selection or in case of |
|
166 |
no selection the specification under the cursor |
|
167 |
" |
|
168 |
^ canvas clientSpecHolder |
|
169 |
! |
|
170 |
||
171 |
clientSpecHolder:aHolder |
|
172 |
"set the holder which keeps the current selection or in case of |
|
173 |
no selection the specification under the cursor |
|
174 |
" |
|
175 |
canvas clientSpecHolder:aHolder |
|
176 |
! |
|
177 |
||
178 |
menuSelector |
|
179 |
^ canvas menuSelector |
|
180 |
! |
|
181 |
||
182 |
menuSelector:aSelector |
|
183 |
^ canvas menuSelector:aSelector |
|
184 |
! |
|
185 |
||
186 |
minorKeysHolder |
|
187 |
"get the holder keeping the minor keys; the selectors to access |
|
188 |
specifications from a class associated with the majorKey. |
|
189 |
" |
|
190 |
^ minorKeysHolder |
|
191 |
! |
|
192 |
||
193 |
minorKeysHolder:aValueHolder |
|
194 |
"set the holder keeping the minor keys; the selectors to access |
|
195 |
specifications from a class associated with the majorKey. |
|
196 |
" |
|
197 |
minorKeysHolder notNil ifTrue:[ |
|
198 |
minorKeysHolder removeDependent:self. |
|
199 |
]. |
|
200 |
||
201 |
(minorKeysHolder := aValueHolder) notNil ifTrue:[ |
|
202 |
minorKeysHolder addDependent:self. |
|
203 |
]. |
|
204 |
self minorKeys:(minorKeysHolder value) |
|
205 |
! ! |
|
206 |
||
207 |
!UIGalleryView methodsFor:'change & update'! |
|
208 |
||
209 |
selectionChangedTo:something |
|
210 |
"selection changed |
|
211 |
" |
|
212 |
|specification selector selection application| |
|
213 |
||
214 |
selection := tabRaw listIndexOf:something. |
|
215 |
||
216 |
(selection notNil and:[minorKeys size >= selection]) ifTrue:[ |
|
217 |
selector := minorKeys at:selection. |
|
218 |
||
219 |
(majorKey respondsTo:selector) ifTrue:[ |
|
220 |
specification := majorKey perform:selector |
|
221 |
] ifFalse:[ |
|
222 |
(application := self application) notNil ifTrue:[ |
|
223 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
224 |
(application class respondsTo:selector) ifTrue:[ |
|
225 |
specification := application class perform:selector |
|
226 |
] |
|
227 |
] do:[ |
|
228 |
specification := application aspectFor:selector |
|
229 |
] |
|
230 |
] |
|
231 |
] |
|
232 |
]. |
|
233 |
canvas specification:specification. |
|
234 |
||
235 |
! |
|
236 |
||
237 |
update |
|
238 |
self selectionChangedTo:(tabRaw selection). |
|
239 |
! |
|
240 |
||
241 |
update:something with:aParameter from:changedObject |
|
242 |
"one of my models changed its value |
|
243 |
" |
|
244 |
changedObject == minorKeysHolder ifTrue:[ |
|
245 |
^ self minorKeys:( minorKeysHolder value) |
|
246 |
]. |
|
247 |
super update:something with:aParameter from:changedObject. |
|
248 |
||
249 |
! ! |
|
250 |
||
251 |
!UIGalleryView methodsFor:'initialization'! |
|
252 |
||
253 |
destroy |
|
254 |
minorKeysHolder notNil ifTrue:[ |
|
255 |
minorKeysHolder removeDependent:self. |
|
256 |
minorKeysHolder := nil. |
|
257 |
]. |
|
258 |
super destroy. |
|
259 |
! |
|
260 |
||
261 |
initialize |
|
262 |
"setup default attributes |
|
263 |
" |
|
264 |
canvas := Canvas. |
|
265 |
||
266 |
super initialize. |
|
267 |
tabRaw action:[:something| self selectionChangedTo:something ]. |
|
268 |
||
269 |
! ! |
|
270 |
||
271 |
!UIGalleryView::Canvas methodsFor:'accessing'! |
|
272 |
||
273 |
builder |
|
274 |
"get the builder used to setup a window from a specification (or nil in case |
|
275 |
of using a new builder) |
|
276 |
" |
|
277 |
^ uiBuilder |
|
278 |
! |
|
279 |
||
280 |
builder:something |
|
281 |
"set the builder used to setup a window from a specification (or nil in case |
|
282 |
of using a new builder) |
|
283 |
" |
|
284 |
uiBuilder := something. |
|
285 |
! |
|
286 |
||
287 |
clientSpecHolder |
|
288 |
"get the holder which keeps the current selection or in case of |
|
289 |
no selection the specification under the cursor |
|
290 |
" |
|
291 |
^ clientSpecHolder |
|
292 |
! |
|
293 |
||
294 |
clientSpecHolder:aHolder |
|
295 |
"set the holder which keeps the current selection or in case of |
|
296 |
no selection the specification under the cursor |
|
297 |
" |
|
298 |
(clientSpecHolder := aHolder) notNil ifTrue:[ |
|
299 |
clientSpecHolder value:selection |
|
300 |
]. |
|
301 |
! |
|
302 |
||
303 |
menuSelector |
|
304 |
"return the value of the instance variable 'menuSelector' (automatically generated)" |
|
305 |
||
306 |
^ menuSelector! |
|
307 |
||
308 |
menuSelector:something |
|
309 |
"set the value of the instance variable 'menuSelector' (automatically generated)" |
|
310 |
||
311 |
menuSelector := something.! |
|
312 |
||
313 |
specification |
|
314 |
"get current specification |
|
315 |
" |
|
316 |
^ specification |
|
317 |
||
318 |
||
319 |
! |
|
320 |
||
321 |
specification:aSpecOrSpecArray |
|
322 |
"set a new specification |
|
323 |
" |
|
324 |
|builder| |
|
325 |
||
326 |
self selection:nil. |
|
327 |
||
328 |
self subViews copy do:[:aSubView| |
|
329 |
aSubView ~~ inputView ifTrue:[ |
|
330 |
aSubView destroy |
|
331 |
] |
|
332 |
]. |
|
333 |
||
334 |
aSpecOrSpecArray notNil ifTrue:[ |
|
335 |
specification := UISpecification from:aSpecOrSpecArray. |
|
205 | 336 |
|
337 |
(specification respondsTo:#buildViewFor:in:) ifFalse:[ |
|
338 |
specification := nil. |
|
339 |
^ self |
|
340 |
]. |
|
396 | 341 |
(builder := uiBuilder) isNil ifTrue:[ |
342 |
builder := UIBuilder new isEditing:true |
|
343 |
]. |
|
344 |
||
181 | 345 |
specification buildViewFor:builder in:self. |
346 |
||
347 |
subViews do:[:v| |
|
348 |
(v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[ |
|
349 |
v borderWidth:1. |
|
350 |
] |
|
351 |
]. |
|
352 |
self shown ifTrue:[ |
|
353 |
self realizeAllSubViews. |
|
354 |
inputView raise |
|
355 |
] |
|
356 |
] ifFalse:[ |
|
357 |
specification := nil |
|
358 |
] |
|
359 |
||
360 |
||
361 |
||
362 |
! ! |
|
363 |
||
364 |
!UIGalleryView::Canvas methodsFor:'building'! |
|
365 |
||
366 |
buildSpecFrom:aSpec |
|
367 |
"build spec out of spec |
|
368 |
" |
|
369 |
|spec comp coll| |
|
370 |
||
371 |
(aSpec notNil and:[aSpec canUIDrag]) ifFalse:[ |
|
372 |
^ nil |
|
373 |
]. |
|
374 |
||
375 |
spec := aSpec copy. |
|
376 |
||
377 |
(aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[ |
|
378 |
^ spec |
|
379 |
]. |
|
380 |
comp := aSpec component. |
|
381 |
spec component:nil. |
|
382 |
||
383 |
comp canUIDrag ifFalse:[ |
|
384 |
^ spec |
|
385 |
]. |
|
386 |
coll := OrderedCollection new. |
|
387 |
||
388 |
comp do:[:anEntry||spc| |
|
389 |
(spc := self buildSpecFrom:anEntry) notNil ifTrue:[ |
|
390 |
coll add:spc |
|
391 |
] |
|
392 |
]. |
|
393 |
coll isEmpty ifTrue:[ |
|
394 |
^ spec |
|
395 |
]. |
|
396 |
comp := comp copy. |
|
397 |
comp collection:coll. |
|
398 |
spec component:comp. |
|
399 |
^ spec |
|
400 |
||
401 |
||
402 |
||
403 |
||
404 |
! ! |
|
405 |
||
406 |
!UIGalleryView::Canvas methodsFor:'drag & drop'! |
|
407 |
||
408 |
startDrag |
|
409 |
"start drag of selection |
|
410 |
" |
|
411 |
|dragObj spec name| |
|
412 |
||
413 |
spec := self findSpecFor:selection. |
|
414 |
||
415 |
spec notNil ifTrue:[ |
|
416 |
spec := self buildSpecFrom:spec. |
|
417 |
name := spec className asString. |
|
418 |
name := name copyFrom:1 to:(name size - ('Spec' size) + 1). |
|
419 |
name at:1 put:(name at:1) asLowercase. |
|
420 |
name at:(name size) put:$1. |
|
421 |
spec name:name. |
|
422 |
||
423 |
self showUnselected. |
|
424 |
dragObj := DropSpec for:selection specification:spec. |
|
425 |
self showSelected. |
|
426 |
DragAndDropManager startDrag:dragObj from:inputView. |
|
427 |
] |
|
428 |
||
278 | 429 |
! |
430 |
||
431 |
startDragWithOffset:offs |
|
432 |
"start drag of selection |
|
433 |
" |
|
434 |
|dragObj spec name o| |
|
435 |
||
436 |
spec := self findSpecFor:selection. |
|
437 |
||
438 |
spec notNil ifTrue:[ |
|
439 |
spec := self buildSpecFrom:spec. |
|
440 |
name := spec className asString. |
|
441 |
name := name copyFrom:1 to:(name size - ('Spec' size) + 1). |
|
442 |
name at:1 put:(name at:1) asLowercase. |
|
443 |
name at:(name size) put:$1. |
|
444 |
spec name:name. |
|
445 |
||
446 |
self showUnselected. |
|
447 |
dragObj := DropSpec for:selection specification:spec. |
|
448 |
self showSelected. |
|
449 |
||
450 |
o := lastClickPoint - selection origin. |
|
451 |
||
452 |
DragAndDropManager |
|
453 |
startDrag:dragObj |
|
454 |
from:inputView |
|
455 |
offset:o. |
|
456 |
] |
|
457 |
||
458 |
"Created: 11.8.1997 / 00:44:17 / cg" |
|
459 |
"Modified: 11.8.1997 / 00:48:35 / cg" |
|
181 | 460 |
! ! |
461 |
||
462 |
!UIGalleryView::Canvas methodsFor:'event handling'! |
|
463 |
||
464 |
buttonMotion:state x:x y:y |
|
465 |
"start a drag on selection |
|
466 |
" |
|
467 |
|sensor| |
|
468 |
||
289 | 469 |
(state ~~ 0 and:[lastClickPoint notNil and:[selection notNil]]) ifTrue:[ |
181 | 470 |
sensor := self sensor. |
471 |
sensor anyButtonPressed ifTrue:[ |
|
472 |
(lastClickPoint dist:(x@y)) > 10.0 ifTrue:[ |
|
278 | 473 |
^ self startDragWithOffset:(x@y) - lastClickPoint |
181 | 474 |
] |
475 |
] |
|
476 |
] |
|
477 |
! |
|
478 |
||
479 |
buttonPress:button x:x y:y |
|
480 |
"change selection |
|
481 |
" |
|
482 |
|application| |
|
483 |
||
484 |
button == 1 ifTrue:[ |
|
485 |
lastClickPoint := Point x:x y:y. |
|
486 |
self selection:(self findObjectAtX:x y:y). |
|
487 |
] ifFalse:[ |
|
488 |
lastClickPoint := nil. |
|
489 |
||
490 |
(menuSelector notNil and:[(application := self application) notNil]) ifTrue:[ |
|
491 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
492 |
] do:[ |
|
493 |
application aspectFor:menuSelector |
|
494 |
] |
|
495 |
] |
|
496 |
] |
|
497 |
||
498 |
! |
|
499 |
||
500 |
exposeX:x y:y width:w height:h |
|
501 |
"handle an expose event from device; redraw selection |
|
502 |
" |
|
503 |
super exposeX:x y:y width:w height:h. |
|
504 |
||
505 |
(selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[ |
|
506 |
self showSelected. |
|
507 |
]. |
|
508 |
||
509 |
||
510 |
! ! |
|
511 |
||
512 |
!UIGalleryView::Canvas methodsFor:'initialization'! |
|
513 |
||
514 |
initialize |
|
515 |
super initialize. |
|
516 |
||
517 |
inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:self. |
|
518 |
inputView eventReceiver:self. |
|
519 |
inputView enableButtonEvents. |
|
520 |
inputView enableButtonMotionEvents. |
|
521 |
inputView enableMotionEvents. |
|
522 |
||
523 |
||
524 |
! ! |
|
525 |
||
526 |
!UIGalleryView::Canvas methodsFor:'searching'! |
|
527 |
||
528 |
findObjectAtX:x y:y |
|
529 |
"find the origin/corner of the currentWidget |
|
530 |
" |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
531 |
|point id p| |
181 | 532 |
|
533 |
point := Point x:x y:y. |
|
534 |
id := inputView id. |
|
535 |
||
536 |
subViews do:[:v| |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
537 |
|pX pY| |
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
538 |
|
181 | 539 |
v ~~ inputView ifTrue:[ |
540 |
p := device translatePoint:point from:id to:(v id). |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
541 |
pX := p x. |
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
542 |
pY := p y. |
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
543 |
( pX >= 0 and:[pX <= v width |
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
544 |
and:[pY >= 0 and:[pY <= v height |
181 | 545 |
and:[(self findSpecFor:v) notNil]]]] |
546 |
) ifTrue:[ |
|
547 |
^ v |
|
548 |
] |
|
549 |
] |
|
550 |
]. |
|
551 |
^ nil |
|
552 |
||
553 |
||
554 |
! |
|
555 |
||
556 |
findSpecFor:anObject |
|
557 |
"returns subspec assigned to instance or nil |
|
558 |
" |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
559 |
|name| |
181 | 560 |
|
561 |
anObject notNil ifTrue:[ |
|
562 |
name := anObject name. |
|
563 |
||
564 |
specification do:[:aSpec| |
|
565 |
aSpec name = name ifTrue:[ |
|
566 |
aSpec canUIDrag ifTrue:[^ aSpec] |
|
567 |
ifFalse:[^ nil] |
|
568 |
] |
|
569 |
] |
|
570 |
]. |
|
571 |
^ nil |
|
572 |
||
573 |
||
574 |
! ! |
|
575 |
||
576 |
!UIGalleryView::Canvas methodsFor:'selection'! |
|
577 |
||
578 |
handlesOf:aComponent do:aOneArgBlock |
|
579 |
"evaluate the block on each handle; the argument to the block |
|
580 |
is a rectangle |
|
581 |
" |
|
582 |
aComponent notNil ifTrue:[ |
|
583 |
aOneArgBlock value:(aComponent origin - (2@2) extent:6@6). |
|
584 |
aOneArgBlock value:(aComponent corner - (1@1) extent:6@6). |
|
585 |
aOneArgBlock value:(aComponent topRight - (1@2) extent:6@6). |
|
586 |
aOneArgBlock value:(aComponent bottomLeft - (2@1) extent:6@6). |
|
587 |
aOneArgBlock value:(aComponent leftCenter - (2@0) extent:6@6). |
|
588 |
aOneArgBlock value:(aComponent rightCenter - (1@0) extent:6@6). |
|
589 |
aOneArgBlock value:(aComponent topCenter - (0@2) extent:6@6). |
|
590 |
aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6). |
|
591 |
] |
|
592 |
||
593 |
||
594 |
! |
|
595 |
||
596 |
selection:anObject |
|
597 |
"selection changed |
|
598 |
" |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
599 |
|spec| |
181 | 600 |
|
601 |
selection ~~ anObject ifTrue:[ |
|
602 |
self showUnselected. |
|
603 |
spec := self findSpecFor:anObject. |
|
604 |
||
605 |
spec notNil ifTrue:[ |
|
606 |
selection := anObject. |
|
607 |
self showSelected |
|
608 |
] ifFalse:[ |
|
609 |
selection := nil |
|
610 |
]. |
|
611 |
clientSpecHolder notNil ifTrue:[ |
|
612 |
clientSpecHolder value:spec |
|
613 |
] |
|
614 |
] |
|
615 |
||
616 |
||
617 |
! |
|
618 |
||
619 |
showSelected |
|
620 |
"show selected |
|
621 |
" |
|
622 |
self shown ifFalse:[^ self]. |
|
623 |
||
624 |
selection notNil ifTrue:[ |
|
625 |
self clippedByChildren:false. |
|
626 |
||
627 |
self handlesOf:selection do:[:aRectangle| |
|
628 |
self fillRectangle:aRectangle |
|
629 |
]. |
|
630 |
self clippedByChildren:true. |
|
631 |
]. |
|
632 |
||
633 |
||
634 |
! |
|
635 |
||
636 |
showUnselected |
|
637 |
"show unselected |
|
638 |
" |
|
639 |
|r currSel| |
|
640 |
||
641 |
(currSel := selection) isNil ifTrue:[ |
|
642 |
^ self |
|
643 |
]. |
|
644 |
selection := nil. |
|
645 |
self shown ifFalse:[^ self]. |
|
646 |
||
647 |
self clippedByChildren:false. |
|
648 |
||
649 |
self handlesOf:currSel do:[:aRectangle| |
|
650 |
self clearRectangle:aRectangle |
|
651 |
]. |
|
652 |
self clippedByChildren:true. |
|
653 |
r := currSel bounds. |
|
654 |
||
655 |
subViews do:[:sv| |
|
656 |
|absOrg absFrame| |
|
657 |
||
658 |
sv ~~ inputView ifTrue:[ |
|
659 |
(sv bounds intersects:r) ifTrue:[ |
|
660 |
sv borderColor:(Color gray:5). |
|
661 |
sv borderColor:(Color black). |
|
662 |
||
663 |
sv withAllSubViewsDo:[:v| |
|
664 |
v fill:v viewBackground. |
|
665 |
v exposeX:0 y:0 width:9999 height:9999. |
|
666 |
] |
|
667 |
] |
|
668 |
] |
|
669 |
]. |
|
670 |
selection := currSel. |
|
671 |
||
672 |
! ! |
|
673 |
||
674 |
!UIGalleryView::Canvas::DropSpec class methodsFor:'instance creation'! |
|
675 |
||
676 |
for:aView specification:aSpec |
|
677 |
"create drop object for a view derived from a specification |
|
678 |
" |
|
240 | 679 |
|point extent root device| |
181 | 680 |
|
681 |
device := aView device. |
|
682 |
root := device rootView. |
|
683 |
extent := aView extent. |
|
684 |
point := device translatePoint:0@0 from:(aView id) to:(root id). |
|
685 |
||
240 | 686 |
DisplayObject := nil. |
181 | 687 |
|
688 |
(point x > 0 and:[point y > 0]) ifTrue:[ |
|
689 |
point := point + extent. |
|
690 |
(point x < root width and:[point y < root height]) ifTrue:[ |
|
691 |
aView topView raise. |
|
692 |
device sync. |
|
693 |
aView invalidate. |
|
694 |
aView windowGroup processExposeEvents. |
|
240 | 695 |
DisplayObject := Image fromView:aView grab:false. |
181 | 696 |
] |
697 |
]. |
|
240 | 698 |
DisplayObject isNil ifTrue:[ |
699 |
DisplayObject := Form extent:extent depth:1. |
|
700 |
DisplayObject colorMap:(Array with:Color white with:Color black). |
|
701 |
DisplayObject fill:(Color colorId:0). |
|
702 |
DisplayObject paint:(Color colorId:1). |
|
703 |
DisplayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y. |
|
181 | 704 |
]. |
705 |
aSpec class == UISubSpecification ifTrue:[ |
|
706 |
aSpec layout:(LayoutOrigin fromPoint:0@0) |
|
707 |
]. |
|
708 |
^ self new theObject:aSpec |
|
240 | 709 |
|
710 |
"Modified: 26.7.1997 / 20:27:40 / cg" |
|
181 | 711 |
! ! |
712 |
||
713 |
!UIGalleryView class methodsFor:'documentation'! |
|
714 |
||
715 |
version |
|
716 |
^ '$Header$' |
|
717 |
! ! |