[squeak-dev] Border grips for windows

Stéphane Rollandin lecteur at zogotounga.net
Tue Apr 20 11:39:35 UTC 2010


> Ah, I see. Yes, I expected them to stretch along the whole edge. If they were only active in the middle, they should have some mark like on the splitters (though I'd personally prefer if they extended all the way).

I disagree on both points :)

Rationale:

- the middle of an edge is easy to find, no need to mark it (it's ugly 
for my taste).

- grips should no stretch along the full edge, because it would make it 
too easy to mistakenly resize the window while attempting to bring it up 
to front from under another window by grabbing one of its edges (am I 
clear here ?).

Of course, both points should be set by preferences, so everybody is happy !


> Also, their extent is off

fixed in the attached changeset

Stef
-------------- next part --------------
'From Squeak4.1.1 of 14 April 2010 [latest update: #9948] on 20 April 2010 at 1:33:54 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/20/2010 13:33'!
drawOn: aCanvas

	"aCanvas fillRectangle: self bounds color: Color red" "for debugging"
! !

!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 4/20/2010 13:32'!
gripLayoutFrame
	^ LayoutFrame
		fractions: (0 @ 1 corner: 1 @ 1)
		offsets: (0 @ self defaultHeight negated 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! !

!BottomGripMorph methodsFor: 'as yet unclassified' stamp: 'spfa 4/20/2010 13:28'!
defaultHeight

	^ 5! !


!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 4/20/2010 13:32'!
gripLayoutFrame
	^ LayoutFrame
		fractions: (0 @ 0 corner: 0 @ 1)
		offsets: (0 @ self defaultHeight negated corner: self defaultWidth @ 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! !

!LeftGripMorph methodsFor: 'as yet unclassified' stamp: 'spfa 4/20/2010 13:27'!
defaultWidth

	^ 5! !


!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 4/20/2010 13:32'!
gripLayoutFrame
	^ LayoutFrame
		fractions: (1 @ 0 corner: 1 @ 1)
		offsets: (self defaultWidth negated @ self defaultHeight negated 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! !

!RightGripMorph methodsFor: 'as yet unclassified' stamp: 'spfa 4/20/2010 13:28'!
defaultWidth

	^ 5! !


!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 4/20/2010 13:31'!
gripLayoutFrame
	^ LayoutFrame
		fractions: (0 @ 0 corner: 1 @ 0)
		offsets: (0 @ -40  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! !

!TopGripMorph methodsFor: 'as yet unclassified' stamp: 'spfa 4/20/2010 13:28'!
defaultHeight

	^ 5! !

TopGripMorph removeSelector: #initialize!
RightGripMorph removeSelector: #initialize!
LeftGripMorph removeSelector: #initialize!
BorderGripMorph removeSelector: #initialize!


More information about the Squeak-dev mailing list