# HG changeset patch # User Claus Gittinger # Date 1241783280 -7200 # Node ID 87d554e2590fd8d36f19074a4aec654a63437ed4 # Parent 0583c55f70001f7b2fcb6815ca332c3c9559582e *** empty log message *** diff -r 0583c55f7000 -r 87d554e2590f VisualPart.st --- a/VisualPart.st Fri May 08 13:47:57 2009 +0200 +++ b/VisualPart.st Fri May 08 13:48:00 2009 +0200 @@ -125,6 +125,18 @@ !VisualPart methodsFor:'view protocol mimicri'! +bottomInset + ^ 0 +! + +computeExtent + ^ self extent +! + +computeOrigin + ^ self origin +! + containerChangedSize "my container changed its size. The default here is to ignore this, but some wrappers like @@ -133,12 +145,17 @@ "/Transcript show:'container '; show:container; show:' of '; show:self; "/ show:' changed size to '; showCR:container viewRectangle. - self bounds:container viewRectangle + self bounds:container viewRectangle. + self invalidate. "Created: 4.6.1996 / 21:27:58 / cg" "Modified: 19.7.1996 / 21:20:58 / cg" ! +cornerRule + ^ nil +! + create "want myself to be created." @@ -147,6 +164,24 @@ "Created: 4.6.1996 / 21:30:25 / cg" ! +destroy + |c| + + (c := container) notNil ifTrue:[ + container := nil. + c invalidate:self bounds. + c removeComponent:self. + ]. +! + +device + ^ container device +! + +extentRule + ^ nil +! + invalidate container notNil ifTrue:[ container invalidate:self bounds @@ -155,6 +190,57 @@ "Modified: / 18.6.1998 / 16:12:15 / cg" ! +isComponentOf:aViewOrComponent + "return true, if I am a (direct or indirect) component of aViewOrComponent" + + |sview| + + sview := self. + + [ (sview := sview container) notNil ] whileTrue:[ + sview == aViewOrComponent ifTrue:[^ true]. + ]. + ^ false +! + +leftInset + ^ 0 +! + +originRelativeTo:aContainer + "return the origin (in pixels) relative to a superView, + or relative to the rootView (if the aView argument is nil). + If the receiver is nonNil and not a subview of aView, return nil." + + |currentPart + bw "{ Class: SmallInteger }" + sumX "{ Class: SmallInteger }" + sumY "{ Class: SmallInteger }"| + + currentPart := self. + sumX := 0. + sumY := 0. + [currentPart notNil] whileTrue:[ + (currentPart == aContainer) ifTrue:[ + ^ (sumX @ sumY) + ]. + bw := currentPart borderWidth. + sumX := sumX + (currentPart left) + bw. + sumY := sumY + (currentPart top) + bw. + currentPart := currentPart superView + ]. + + (aContainer isNil or:[aContainer == self graphicsDevice rootView]) ifTrue:[ + "return relative to screen ..." + ^ (sumX @ sumY) + ]. + ^ nil +! + +originRule + ^ nil +! + realize "my container realized itself. The default here is to ignore this, but some wrappers like @@ -174,6 +260,22 @@ "Created: / 6.7.1998 / 18:37:08 / cg" ! +relativeCorner + ^ nil +! + +relativeExtent + ^ nil +! + +relativeOrigin + ^ nil +! + +rightInset + ^ 0 +! + shown container isNil ifTrue:[^ false]. ^ container shown @@ -187,6 +289,14 @@ "Created: 4.6.1996 / 21:35:57 / cg" ! +topInset + ^ 0 +! + +topView + ^ container topView +! + windowGroup ^ container windowGroup @@ -200,5 +310,5 @@ !VisualPart class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview2/VisualPart.st,v 1.12 2008-01-22 15:54:28 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview2/VisualPart.st,v 1.13 2009-05-08 11:48:00 cg Exp $' ! !