[ENH]SystemWindow closeBox collapseBox
Karl Ramberg
karl.ramberg at chello.se
Thu Apr 27 19:33:27 UTC 2000
Hi, I' m fiddling around enhancing small stuff and found this that I
found really annoying from the first time I used morphic.
When you close or collapse the window a little gray circle
appears behind the widget. This circle used to have an extent that
went over the edges of the window and making it look kind of a
fast hack. I made the circle a little smaller and now it is far less
distressing.
An improvement till we get some real widgets going.
Karl
-------------- next part --------------
'From Squeak2.8alpha of 19 February 2000 [latest update: #2040] on 27 April 2000 at 9:02:42 pm'!
!SystemWindow methodsFor: 'initialization' stamp: 'kfr 4/27/2000 20:56'!
addCloseBox
self addMorph: (closeBox _ SimpleButtonMorph new borderWidth: 0;
label: 'X' font: Preferences standardButtonFont; color: Color transparent;
actionSelector: #delete; target: self; extent: 14 at 14)! !
!SystemWindow methodsFor: 'initialization' stamp: 'kfr 4/27/2000 20:57'!
initialize
| aFont |
super initialize.
allowReframeHandles := true.
labelString ifNil: [labelString _ 'Untitled Window'].
isCollapsed _ false.
activeOnlyOnTop _ true.
paneMorphs _ Array new.
paneRects _ Array new.
borderColor _ #raised.
borderWidth _ 1.
color _ Color black.
aFont _ Preferences standardButtonFont.
stripes _ Array with: (RectangleMorph newBounds: bounds) "see extent:"
with: (RectangleMorph newBounds: bounds).
self addMorph: (stripes first borderWidth: 1).
self addMorph: (stripes second borderWidth: 2).
self addMorph: (label _ StringMorph new contents: labelString;
font: Preferences windowTitleFont emphasis: 1).
self setLabelWidgetAllowance.
self addCloseBox.
self addMenuControl.
self addMorph: (collapseBox _ SimpleButtonMorph new borderWidth: 0;
label: 'O' font: aFont; color: Color transparent;
actionSelector: #collapseOrExpand; target: self; extent: 14 at 14).
Preferences noviceMode ifTrue:
[closeBox ifNotNil: [closeBox setBalloonText: 'close window'].
menuBox ifNotNil: [menuBox setBalloonText: 'window menu'].
collapseBox ifNotNil: [collapseBox setBalloonText: 'collapse/expand window']].
self on: #mouseEnter send: #spawnReframeHandle: to: self.
self on: #mouseLeave send: #spawnReframeHandle: to: self.
label on: #mouseDown send: #relabelEvent: to: self.
self extent: 300 at 200.
mustNotClose _ false.
updatablePanes _ Array new.! !
!SystemWindow methodsFor: 'geometry' stamp: 'kfr 4/27/2000 20:58'!
extent: newExtent
| inner labelRect |
isCollapsed
ifTrue: [super extent: newExtent x @ (self labelHeight + 2)]
ifFalse: [super extent: newExtent].
inner _ self innerBounds.
labelRect _ self labelRect.
stripes first bounds: (labelRect insetBy: 1).
stripes second bounds: (labelRect insetBy: 3).
self setStripeColorsFrom: self paneColorToUse.
closeBox ifNotNil:
[closeBox align: closeBox topLeft with: inner topLeft + (4 at 1)].
menuBox ifNotNil:
[menuBox align: menuBox topLeft with: (inner topLeft + (19 at 1))].
collapseBox align: collapseBox topRight with: inner topRight - (4 at 1 negated).
label fitContents; setWidth: (label width min: bounds width - self labelWidgetAllowance).
label align: label bounds topCenter with: inner topCenter.
isCollapsed ifFalse: [self setBoundsOfPaneMorphs].
! !
More information about the Squeak-dev
mailing list
|