author | ca |
Wed, 15 Oct 1997 15:41:28 +0200 | |
changeset 335 | 9f048ededd7d |
parent 331 | aa1663b8c2ab |
child 396 | e15b7b5bb81b |
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 |
]. |
|
181 | 341 |
builder := uiBuilder ? UIBuilder new. |
342 |
specification buildViewFor:builder in:self. |
|
343 |
||
344 |
subViews do:[:v| |
|
345 |
(v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[ |
|
346 |
v borderWidth:1. |
|
347 |
] |
|
348 |
]. |
|
349 |
self shown ifTrue:[ |
|
350 |
self realizeAllSubViews. |
|
351 |
inputView raise |
|
352 |
] |
|
353 |
] ifFalse:[ |
|
354 |
specification := nil |
|
355 |
] |
|
356 |
||
357 |
||
358 |
||
359 |
! ! |
|
360 |
||
361 |
!UIGalleryView::Canvas methodsFor:'building'! |
|
362 |
||
363 |
buildSpecFrom:aSpec |
|
364 |
"build spec out of spec |
|
365 |
" |
|
366 |
|spec comp coll| |
|
367 |
||
368 |
(aSpec notNil and:[aSpec canUIDrag]) ifFalse:[ |
|
369 |
^ nil |
|
370 |
]. |
|
371 |
||
372 |
spec := aSpec copy. |
|
373 |
||
374 |
(aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[ |
|
375 |
^ spec |
|
376 |
]. |
|
377 |
comp := aSpec component. |
|
378 |
spec component:nil. |
|
379 |
||
380 |
comp canUIDrag ifFalse:[ |
|
381 |
^ spec |
|
382 |
]. |
|
383 |
coll := OrderedCollection new. |
|
384 |
||
385 |
comp do:[:anEntry||spc| |
|
386 |
(spc := self buildSpecFrom:anEntry) notNil ifTrue:[ |
|
387 |
coll add:spc |
|
388 |
] |
|
389 |
]. |
|
390 |
coll isEmpty ifTrue:[ |
|
391 |
^ spec |
|
392 |
]. |
|
393 |
comp := comp copy. |
|
394 |
comp collection:coll. |
|
395 |
spec component:comp. |
|
396 |
^ spec |
|
397 |
||
398 |
||
399 |
||
400 |
||
401 |
! ! |
|
402 |
||
403 |
!UIGalleryView::Canvas methodsFor:'drag & drop'! |
|
404 |
||
405 |
startDrag |
|
406 |
"start drag of selection |
|
407 |
" |
|
408 |
|dragObj spec name| |
|
409 |
||
410 |
spec := self findSpecFor:selection. |
|
411 |
||
412 |
spec notNil ifTrue:[ |
|
413 |
spec := self buildSpecFrom:spec. |
|
414 |
name := spec className asString. |
|
415 |
name := name copyFrom:1 to:(name size - ('Spec' size) + 1). |
|
416 |
name at:1 put:(name at:1) asLowercase. |
|
417 |
name at:(name size) put:$1. |
|
418 |
spec name:name. |
|
419 |
||
420 |
self showUnselected. |
|
421 |
dragObj := DropSpec for:selection specification:spec. |
|
422 |
self showSelected. |
|
423 |
DragAndDropManager startDrag:dragObj from:inputView. |
|
424 |
] |
|
425 |
||
278 | 426 |
! |
427 |
||
428 |
startDragWithOffset:offs |
|
429 |
"start drag of selection |
|
430 |
" |
|
431 |
|dragObj spec name o| |
|
432 |
||
433 |
spec := self findSpecFor:selection. |
|
434 |
||
435 |
spec notNil ifTrue:[ |
|
436 |
spec := self buildSpecFrom:spec. |
|
437 |
name := spec className asString. |
|
438 |
name := name copyFrom:1 to:(name size - ('Spec' size) + 1). |
|
439 |
name at:1 put:(name at:1) asLowercase. |
|
440 |
name at:(name size) put:$1. |
|
441 |
spec name:name. |
|
442 |
||
443 |
self showUnselected. |
|
444 |
dragObj := DropSpec for:selection specification:spec. |
|
445 |
self showSelected. |
|
446 |
||
447 |
o := lastClickPoint - selection origin. |
|
448 |
||
449 |
DragAndDropManager |
|
450 |
startDrag:dragObj |
|
451 |
from:inputView |
|
452 |
offset:o. |
|
453 |
] |
|
454 |
||
455 |
"Created: 11.8.1997 / 00:44:17 / cg" |
|
456 |
"Modified: 11.8.1997 / 00:48:35 / cg" |
|
181 | 457 |
! ! |
458 |
||
459 |
!UIGalleryView::Canvas methodsFor:'event handling'! |
|
460 |
||
461 |
buttonMotion:state x:x y:y |
|
462 |
"start a drag on selection |
|
463 |
" |
|
464 |
|sensor| |
|
465 |
||
289 | 466 |
(state ~~ 0 and:[lastClickPoint notNil and:[selection notNil]]) ifTrue:[ |
181 | 467 |
sensor := self sensor. |
468 |
sensor anyButtonPressed ifTrue:[ |
|
469 |
(lastClickPoint dist:(x@y)) > 10.0 ifTrue:[ |
|
278 | 470 |
^ self startDragWithOffset:(x@y) - lastClickPoint |
181 | 471 |
] |
472 |
] |
|
473 |
] |
|
474 |
! |
|
475 |
||
476 |
buttonPress:button x:x y:y |
|
477 |
"change selection |
|
478 |
" |
|
479 |
|application| |
|
480 |
||
481 |
button == 1 ifTrue:[ |
|
482 |
lastClickPoint := Point x:x y:y. |
|
483 |
self selection:(self findObjectAtX:x y:y). |
|
484 |
] ifFalse:[ |
|
485 |
lastClickPoint := nil. |
|
486 |
||
487 |
(menuSelector notNil and:[(application := self application) notNil]) ifTrue:[ |
|
488 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
489 |
] do:[ |
|
490 |
application aspectFor:menuSelector |
|
491 |
] |
|
492 |
] |
|
493 |
] |
|
494 |
||
495 |
! |
|
496 |
||
497 |
exposeX:x y:y width:w height:h |
|
498 |
"handle an expose event from device; redraw selection |
|
499 |
" |
|
500 |
super exposeX:x y:y width:w height:h. |
|
501 |
||
502 |
(selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[ |
|
503 |
self showSelected. |
|
504 |
]. |
|
505 |
||
506 |
||
507 |
! ! |
|
508 |
||
509 |
!UIGalleryView::Canvas methodsFor:'initialization'! |
|
510 |
||
511 |
initialize |
|
512 |
super initialize. |
|
513 |
||
514 |
inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:self. |
|
515 |
inputView eventReceiver:self. |
|
516 |
inputView enableButtonEvents. |
|
517 |
inputView enableButtonMotionEvents. |
|
518 |
inputView enableMotionEvents. |
|
519 |
||
520 |
||
521 |
! ! |
|
522 |
||
523 |
!UIGalleryView::Canvas methodsFor:'searching'! |
|
524 |
||
525 |
findObjectAtX:x y:y |
|
526 |
"find the origin/corner of the currentWidget |
|
527 |
" |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
528 |
|point id p| |
181 | 529 |
|
530 |
point := Point x:x y:y. |
|
531 |
id := inputView id. |
|
532 |
||
533 |
subViews do:[:v| |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
534 |
|pX pY| |
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
535 |
|
181 | 536 |
v ~~ inputView ifTrue:[ |
537 |
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
|
538 |
pX := p x. |
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
539 |
pY := p y. |
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
540 |
( 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
|
541 |
and:[pY >= 0 and:[pY <= v height |
181 | 542 |
and:[(self findSpecFor:v) notNil]]]] |
543 |
) ifTrue:[ |
|
544 |
^ v |
|
545 |
] |
|
546 |
] |
|
547 |
]. |
|
548 |
^ nil |
|
549 |
||
550 |
||
551 |
! |
|
552 |
||
553 |
findSpecFor:anObject |
|
554 |
"returns subspec assigned to instance or nil |
|
555 |
" |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
556 |
|name| |
181 | 557 |
|
558 |
anObject notNil ifTrue:[ |
|
559 |
name := anObject name. |
|
560 |
||
561 |
specification do:[:aSpec| |
|
562 |
aSpec name = name ifTrue:[ |
|
563 |
aSpec canUIDrag ifTrue:[^ aSpec] |
|
564 |
ifFalse:[^ nil] |
|
565 |
] |
|
566 |
] |
|
567 |
]. |
|
568 |
^ nil |
|
569 |
||
570 |
||
571 |
! ! |
|
572 |
||
573 |
!UIGalleryView::Canvas methodsFor:'selection'! |
|
574 |
||
575 |
handlesOf:aComponent do:aOneArgBlock |
|
576 |
"evaluate the block on each handle; the argument to the block |
|
577 |
is a rectangle |
|
578 |
" |
|
579 |
aComponent notNil ifTrue:[ |
|
580 |
aOneArgBlock value:(aComponent origin - (2@2) extent:6@6). |
|
581 |
aOneArgBlock value:(aComponent corner - (1@1) extent:6@6). |
|
582 |
aOneArgBlock value:(aComponent topRight - (1@2) extent:6@6). |
|
583 |
aOneArgBlock value:(aComponent bottomLeft - (2@1) extent:6@6). |
|
584 |
aOneArgBlock value:(aComponent leftCenter - (2@0) extent:6@6). |
|
585 |
aOneArgBlock value:(aComponent rightCenter - (1@0) extent:6@6). |
|
586 |
aOneArgBlock value:(aComponent topCenter - (0@2) extent:6@6). |
|
587 |
aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6). |
|
588 |
] |
|
589 |
||
590 |
||
591 |
! |
|
592 |
||
593 |
selection:anObject |
|
594 |
"selection changed |
|
595 |
" |
|
239
ce46eb6f92a5
do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
596 |
|spec| |
181 | 597 |
|
598 |
selection ~~ anObject ifTrue:[ |
|
599 |
self showUnselected. |
|
600 |
spec := self findSpecFor:anObject. |
|
601 |
||
602 |
spec notNil ifTrue:[ |
|
603 |
selection := anObject. |
|
604 |
self showSelected |
|
605 |
] ifFalse:[ |
|
606 |
selection := nil |
|
607 |
]. |
|
608 |
clientSpecHolder notNil ifTrue:[ |
|
609 |
clientSpecHolder value:spec |
|
610 |
] |
|
611 |
] |
|
612 |
||
613 |
||
614 |
! |
|
615 |
||
616 |
showSelected |
|
617 |
"show selected |
|
618 |
" |
|
619 |
self shown ifFalse:[^ self]. |
|
620 |
||
621 |
selection notNil ifTrue:[ |
|
622 |
self clippedByChildren:false. |
|
623 |
||
624 |
self handlesOf:selection do:[:aRectangle| |
|
625 |
self fillRectangle:aRectangle |
|
626 |
]. |
|
627 |
self clippedByChildren:true. |
|
628 |
]. |
|
629 |
||
630 |
||
631 |
! |
|
632 |
||
633 |
showUnselected |
|
634 |
"show unselected |
|
635 |
" |
|
636 |
|r currSel| |
|
637 |
||
638 |
(currSel := selection) isNil ifTrue:[ |
|
639 |
^ self |
|
640 |
]. |
|
641 |
selection := nil. |
|
642 |
self shown ifFalse:[^ self]. |
|
643 |
||
644 |
self clippedByChildren:false. |
|
645 |
||
646 |
self handlesOf:currSel do:[:aRectangle| |
|
647 |
self clearRectangle:aRectangle |
|
648 |
]. |
|
649 |
self clippedByChildren:true. |
|
650 |
r := currSel bounds. |
|
651 |
||
652 |
subViews do:[:sv| |
|
653 |
|absOrg absFrame| |
|
654 |
||
655 |
sv ~~ inputView ifTrue:[ |
|
656 |
(sv bounds intersects:r) ifTrue:[ |
|
657 |
sv borderColor:(Color gray:5). |
|
658 |
sv borderColor:(Color black). |
|
659 |
||
660 |
sv withAllSubViewsDo:[:v| |
|
661 |
v fill:v viewBackground. |
|
662 |
v exposeX:0 y:0 width:9999 height:9999. |
|
663 |
] |
|
664 |
] |
|
665 |
] |
|
666 |
]. |
|
667 |
selection := currSel. |
|
668 |
||
669 |
! ! |
|
670 |
||
671 |
!UIGalleryView::Canvas::DropSpec class methodsFor:'instance creation'! |
|
672 |
||
673 |
for:aView specification:aSpec |
|
674 |
"create drop object for a view derived from a specification |
|
675 |
" |
|
240 | 676 |
|point extent root device| |
181 | 677 |
|
678 |
device := aView device. |
|
679 |
root := device rootView. |
|
680 |
extent := aView extent. |
|
681 |
point := device translatePoint:0@0 from:(aView id) to:(root id). |
|
682 |
||
240 | 683 |
DisplayObject := nil. |
181 | 684 |
|
685 |
(point x > 0 and:[point y > 0]) ifTrue:[ |
|
686 |
point := point + extent. |
|
687 |
(point x < root width and:[point y < root height]) ifTrue:[ |
|
688 |
aView topView raise. |
|
689 |
device sync. |
|
690 |
aView invalidate. |
|
691 |
aView windowGroup processExposeEvents. |
|
240 | 692 |
DisplayObject := Image fromView:aView grab:false. |
181 | 693 |
] |
694 |
]. |
|
240 | 695 |
DisplayObject isNil ifTrue:[ |
696 |
DisplayObject := Form extent:extent depth:1. |
|
697 |
DisplayObject colorMap:(Array with:Color white with:Color black). |
|
698 |
DisplayObject fill:(Color colorId:0). |
|
699 |
DisplayObject paint:(Color colorId:1). |
|
700 |
DisplayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y. |
|
181 | 701 |
]. |
702 |
aSpec class == UISubSpecification ifTrue:[ |
|
703 |
aSpec layout:(LayoutOrigin fromPoint:0@0) |
|
704 |
]. |
|
705 |
^ self new theObject:aSpec |
|
240 | 706 |
|
707 |
"Modified: 26.7.1997 / 20:27:40 / cg" |
|
181 | 708 |
! ! |
709 |
||
710 |
!UIGalleryView class methodsFor:'documentation'! |
|
711 |
||
712 |
version |
|
713 |
^ '$Header$' |
|
714 |
! ! |