[squeak-dev] Border grips for windows

Stéphane Rollandin lecteur at zogotounga.net
Mon Apr 19 20:54:39 UTC 2010


Attached is a contribution, if someone wants to submit it: it enables 
resizing of windows via their edges (border grips)

Stef
-------------- next part --------------
'From Squeak4.1 of 17 April 2010 [latest update: #9956] on 19 April 2010 at 10:24:10 pm'!
CornerGripMorph subclass: #BorderGripMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-Windows'!
BorderGripMorph subclass: #BottomGripMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-Windows'!
BorderGripMorph subclass: #LeftGripMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-Windows'!
BorderGripMorph subclass: #RightGripMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-Windows'!
BorderGripMorph subclass: #TopGripMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-Windows'!

!BorderGripMorph methodsFor: 'as yet unclassified' stamp: 'spfa 4/19/2010 22:17'!
drawOn: aCanvas

! !

!BorderGripMorph methodsFor: 'as yet unclassified' stamp: 'spfa 4/19/2010 22:17'!
initialize
	super initialize.
	self extent: self defaultWidth*3 @ (self defaultHeight+2).! !

!BorderGripMorph methodsFor: 'as yet unclassified' stamp: 'spfa 4/19/2010 22:22'!
setDefaultColors! !

!BorderGripMorph methodsFor: 'as yet unclassified' stamp: 'spfa 4/19/2010 22:21'!
setInverseColors! !


!BorderedMorph methodsFor: 'lookenhancements' stamp: 'spfa 8/15/2009 11:43'!
addCornerGrips
	self
		addMorphBack: (TopLeftGripMorph new target: self; position: self position).
	self
		addMorphBack: (TopRightGripMorph new target: self; position: self position).
	self
		addMorphBack: (BottomLeftGripMorph new target: self;position: self position).
	self
		addMorphBack: (BottomRightGripMorph new target: self;position: self position).
	self
		addMorphBack: (TopGripMorph new target: self;position: self position).
	self
		addMorphBack: (BottomGripMorph new target: self;position: self position).
	self
		addMorphBack: (RightGripMorph new target: self;position: self position).
	self
		addMorphBack: (LeftGripMorph new target: self;position: self position).! !


!BottomGripMorph methodsFor: 'target resize' stamp: 'spfa 8/15/2009 11:37'!
apply: delta 
	| oldBounds |
	oldBounds := target bounds.
	target
		bounds: (oldBounds origin + (delta x @ 0) corner: oldBounds corner + (0 @ delta y))! !

!BottomGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:38'!
gripLayoutFrame
	^ LayoutFrame
		fractions: (0 @ 1 corner: 1 @ 1)
		offsets: (0 @ (0 - self defaultHeight) corner: 0@ 0)! !

!BottomGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:37'!
ptName
	^#bottom! !

!BottomGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:37'!
resizeCursor

	^ Cursor resizeForEdge: #top! !


!LeftGripMorph methodsFor: 'target resize' stamp: 'spfa 8/15/2009 11:41'!
apply: delta 
	| oldBounds |
	oldBounds := target bounds.
	target
		bounds: (oldBounds origin + (delta x @ 0) corner: oldBounds corner + (0 @ delta y))! !

!LeftGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:41'!
gripLayoutFrame
	^ LayoutFrame
		fractions: (0 @ 0 corner: 0 @ 1)
		offsets: (0 - self defaultWidth @ (0 - self defaultHeight) corner: 0@ 0)! !

!LeftGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:41'!
ptName
	^#left! !

!LeftGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:41'!
resizeCursor

	^ Cursor resizeForEdge: #left! !


!RightGripMorph methodsFor: 'target resize' stamp: 'spfa 8/15/2009 11:39'!
apply: delta 
	| oldBounds |
	oldBounds := target bounds.
	target
		bounds: (oldBounds origin + (delta x @ 0) corner: oldBounds corner + (0 @ delta y))! !

!RightGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:40'!
gripLayoutFrame
	^ LayoutFrame
		fractions: (1 @ 0 corner: 1 @ 1)
		offsets: (0 - self defaultWidth @ (0 - self defaultHeight) corner: 0@ 0)! !

!RightGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:40'!
ptName
	^#right! !

!RightGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:40'!
resizeCursor

	^ Cursor resizeForEdge: #right! !


!TopGripMorph methodsFor: 'target resize' stamp: 'spfa 8/15/2009 11:22'!
apply: delta 
	| oldBounds |
	oldBounds := target bounds.
	target
		bounds: (oldBounds origin + (delta x @ 0) corner: oldBounds corner + (0 @ delta y))! !

!TopGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:35'!
gripLayoutFrame
	^ LayoutFrame
		fractions: (0 @ 0 corner: 1 @ 0)
		offsets: (0 @ (0 - 27)  corner: 0@ 0)! !

!TopGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:23'!
ptName
	^#top! !

!TopGripMorph methodsFor: 'accessing' stamp: 'spfa 8/15/2009 11:23'!
resizeCursor

	^ Cursor resizeForEdge: #top! !



More information about the Squeak-dev mailing list