UIGalleryView.st
changeset 1501 f760ccab7a35
parent 1455 5d4d3c5ca76c
child 1561 dde6c4539acd
equal deleted inserted replaced
1500:36c0b4b268b8 1501:f760ccab7a35
   536 !UIGalleryView::Canvas methodsFor:'searching'!
   536 !UIGalleryView::Canvas methodsFor:'searching'!
   537 
   537 
   538 findObjectAtX:x y:y
   538 findObjectAtX:x y:y
   539     "find the origin/corner of the currentWidget
   539     "find the origin/corner of the currentWidget
   540     "
   540     "
   541     |point id p|
   541     |point p|
   542 
   542 
   543     point := Point x:x y:y.
   543     point := Point x:x y:y.
   544     id    := inputView id.
       
   545 
   544 
   546     subViews do:[:v|
   545     subViews do:[:v|
   547 	|pX pY|
   546         |pX pY|
   548 
   547 
   549 	v ~~ inputView ifTrue:[
   548         v ~~ inputView ifTrue:[
   550 	    p := device translatePoint:point from:id to:(v id).
   549             p := device translatePoint:point fromView:inputView toView:v.
   551 	    pX := p x.
   550             pX := p x.
   552 	    pY := p y.
   551             pY := p y.
   553 	    (     pX >= 0 and:[pX <= v width
   552             (     pX >= 0 and:[pX <= v width
   554 	     and:[pY >= 0 and:[pY <= v height
   553              and:[pY >= 0 and:[pY <= v height
   555 	     and:[(self findSpecFor:v) notNil]]]]
   554              and:[(self findSpecFor:v) notNil]]]]
   556 	    ) ifTrue:[
   555             ) ifTrue:[
   557 		^ v
   556                 ^ v
   558 	    ]
   557             ]
   559 	]
   558         ]
   560     ].
   559     ].
   561   ^ nil
   560   ^ nil
   562 
   561 
   563 
   562     "Modified: / 10.10.2001 / 14:02:08 / cg"
   564 !
   563 !
   565 
   564 
   566 findSpecFor:anObject
   565 findSpecFor:anObject
   567     "returns subspec assigned to instance or nil
   566     "returns subspec assigned to instance or nil
   568     "
   567     "
   689 !UIGalleryView::Canvas::DropSpec class methodsFor:'instance creation'!
   688 !UIGalleryView::Canvas::DropSpec class methodsFor:'instance creation'!
   690 
   689 
   691 for:aView specification:aSpec
   690 for:aView specification:aSpec
   692     "create drop object for a view derived from a specification
   691     "create drop object for a view derived from a specification
   693     "
   692     "
   694     |point extent root device inst displayObject|
   693     |point extent rootView device inst displayObject|
   695 
   694 
   696     device := aView device.
   695     device   := aView device.
   697     root   := device rootView.
   696     rootView := device rootView.
   698     extent := aView extent.
   697     extent   := aView extent.
   699     point  := device translatePoint:0@0 from:(aView id) to:(root id).
   698     point    := device translatePoint:0@0 fromView:aView toView:rootView.
   700 
   699 
   701     (point x > 0 and:[point y > 0]) ifTrue:[
   700     (point x > 0 and:[point y > 0]) ifTrue:[
   702 	point := point + extent.
   701         point := point + extent.
   703 	(point x < root width and:[point y < root height]) ifTrue:[
   702         (point x < rootView width and:[point y < rootView height]) ifTrue:[
   704 	    aView topView raise.
   703             aView topView raise.
   705 	    device sync.
   704             device sync.
   706 	    aView invalidate.
   705             aView invalidate.
   707 	    aView windowGroup processExposeEvents.
   706             aView windowGroup processExposeEvents.
   708 	    displayObject := Image fromView:aView grab:false.
   707             displayObject := Image fromView:aView grab:false.
   709 	]
   708         ]
   710     ].
   709     ].
   711     displayObject isNil ifTrue:[
   710     displayObject isNil ifTrue:[
   712 	displayObject := Form extent:extent depth:1.
   711         displayObject := Form extent:extent depth:1.
   713 	displayObject colorMap:(Array with:Color white with:Color black).
   712         displayObject colorMap:(Array with:Color white with:Color black).
   714 	displayObject fill:(Color colorId:0).
   713         displayObject fill:(Color colorId:0).
   715 	displayObject paint:(Color colorId:1).
   714         displayObject paint:(Color colorId:1).
   716 	displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y.
   715         displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y.
   717     ].
   716     ].
   718     aSpec class == UISubSpecification ifTrue:[
   717     aSpec class == UISubSpecification ifTrue:[
   719 	aSpec layout:(LayoutOrigin fromPoint:0@0)
   718         aSpec layout:(LayoutOrigin fromPoint:0@0)
   720     ].
   719     ].
   721 
   720 
   722     inst := self new.
   721     inst := self new.
   723     inst displayObject:displayObject.
   722     inst displayObject:displayObject.
   724     inst theObject:aSpec.
   723     inst theObject:aSpec.
   725   ^ inst.
   724   ^ inst.
       
   725 
       
   726     "Modified: / 10.10.2001 / 14:03:00 / cg"
   726 ! !
   727 ! !
   727 
   728 
   728 !UIGalleryView class methodsFor:'documentation'!
   729 !UIGalleryView class methodsFor:'documentation'!
   729 
   730 
   730 version
   731 version