New Look Suggestion [ENH]

Jochen F. Rick nadja at cc.gatech.edu
Mon Aug 27 19:05:07 UTC 2001


> I've tried a few versions but I didn't like any of those in particular. If
> you have some code that makes it look reasonably nice, I'd be happy to pick
> it up.

Okay. I think it looks better with the attached code.

Peace and Luck!

Je77
-------------- next part --------------
'From Squeak3.1alpha of 7 March 2001 [latest update: #4282] on 27 August 2001 at 3:02:05 pm'!
!ScrollBar methodsFor: 'initialize'!
initializeMenuButton
	"Preferences disable: #scrollBarsWithoutMenuButton"
	"Preferences enable: #scrollBarsWithoutMenuButton"

	(Preferences valueOfFlag: #scrollBarsWithoutMenuButton) ifTrue: [^self].
	menuButton := RectangleMorph
			newBounds: (self innerBounds topLeft extent: self buttonExtent)
			color: color.
	menuButton on: #mouseEnter send: #menuButtonMouseEnter: to: self.
	menuButton on: #mouseDown send: #menuButtonMouseDown: to: self.
	menuButton on: #mouseLeave send: #menuButtonMouseLeave: to: self.
	menuButton addMorphCentered:
		(RectangleMorph newBounds: (0 at 0 extent: 4 at 2) color: Color black).
	menuButton setBorderWidth: 1 borderColor: #raised.
	self addMorph: menuButton! !
!ScrollBar methodsFor: 'initialize'!
initializeDownButton
	downButton := RectangleMorph
		newBounds: (self innerBounds bottomRight - self buttonExtent extent: self bu!
!
ttonExtent)
		color: color.
	downButton on: #mouseDown send: #scrollDownInit to: self.
	downButton on: #mouseUp send: #finishedScrolling to: self.
	downButton addMorphCentered: (ImageMorph new image: 
		(self 
			cachedImageAt: (bounds isWide ifTrue: ['right'] ifFalse: ['down']) 
			ifAbsentPut: [
				self upArrow8Bit
					rotateBy: (bounds isWide ifTrue: [#right] ifFalse: [#pi])
					centerAt: 0 at 0
			]
		)
	).
	downButton setBorderWidth: 1 borderColor: #raised.
	self addMorph: downButton! !
!ScrollBar methodsFor: 'initialize'!
initializeUpButton
	upButton := RectangleMorph
		newBounds: ((menuButton ifNil: [self innerBounds topLeft]
				ifNotNil: [bounds isWide ifTrue: [menuButton bounds topRight]
									ifFalse: [menuButton bounds bottomLeft]])
					extent: self buttonExtent)
		color: color.
	upButton on: #mouseDown send: #scrollUpInit to: self.
	upButton on: #mouseUp send: #finishedScrolling to: self.
	upButton addMorphCentered: (ImageMorph new image:
		(self 
			cachedIma!
!
geAt: (bounds isWide ifTrue: ['left'] ifFalse: ['up'])
			ifAbsentPut: [
				bounds isWide ifTrue: [
					self upArrow8Bit rotateBy: #left centerAt: 0 at 0
				] ifFalse: [
					self upArrow8Bit
				]
			]
		)
	).
	upButton setBorderWidth: 1 borderColor: #raised.
	self addMorph: upButton! !
!ScrollBar methodsFor: 'initialize'!
initializePagingArea
	pagingArea := RectangleMorph newBounds: self totalSliderArea
								color: color lighter.
	pagingArea borderWidth: 0.
	pagingArea on: #mouseDown send: #scrollPageInit: to: self.
	pagingArea on: #mouseUp send: #finishedScrolling to: self.
	self addMorph: pagingArea! !
!Slider methodsFor: 'initialize'!
initialize
	super initialize.
	bounds := 0 at 0 corner: 16 at 100.
	color := Color lightGray.
	borderWidth := 1.
	borderColor := #inset.
	value _ 0.0.
	descending _ false.
	self initializeSlider! !
!ScrollPane methodsFor: 'access'!
model: aModel
	| aColor |
	Preferences alternativeWindowLook ifTrue: [
		aColor _ Preferences windowColorFor: aMod!
!
el class name.
		self colorScrollBar: aColor darker].
	^super model: aModel

! !
!ScrollPane methodsFor: 'scrolling'!
colorScrollBar: aColor
	scrollBar color: aColor.
	scrollBar borderColor: aColor darker! !


More information about the Squeak-dev mailing list