Skip to content

Commit

Permalink
Small cleanups in BorderedMorph
Browse files Browse the repository at this point in the history
Fix #6273
  • Loading branch information
astares committed May 1, 2020
1 parent 93fc647 commit 3da63db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
15 changes: 8 additions & 7 deletions src/Morphic-Base/BorderedMorph.extension.st
Expand Up @@ -34,14 +34,15 @@ Click when done.' translated hand: evt hand.

{ #category : #'*Morphic-Base' }
BorderedMorph class >> exampleGradient [
"self exampleGradient"

| morph fs |
morph := BorderedMorph new.
morph := self new.
fs := GradientFillStyle ramp: {0.0 -> Color red. 1.0 -> Color green}.
fs origin: morph bounds center.
fs direction: (morph bounds width // 2) @ 0.
fs radial: true.
morph fillStyle: fs.
morph openInWindow
fs
origin: morph bounds center;
direction: (morph bounds width // 2) @ 0;
radial: true.
morph
fillStyle: fs;
openInWindow
]
8 changes: 4 additions & 4 deletions src/Morphic-Base/Form.extension.st
Expand Up @@ -12,13 +12,13 @@ Form >> asMorph [
]

{ #category : #'*Morphic-Base' }
Form >> floodFillTolerance [
^ self class floodFillTolerance
Form class >> floodFillTolerance [
^ FloodFillTolerance ifNil: [FloodFillTolerance := 0.0]
]

{ #category : #'*Morphic-Base' }
Form class >> floodFillTolerance [
^ FloodFillTolerance ifNil: [FloodFillTolerance := 0.0]
Form >> floodFillTolerance [
^ self class floodFillTolerance
]

{ #category : #'*Morphic-Base' }
Expand Down
31 changes: 17 additions & 14 deletions src/Morphic-Core/BorderedMorph.class.st
Expand Up @@ -39,9 +39,11 @@ BorderedMorph >> addBorderStyleMenuItems: aMenu hand: aHandMorph [

| subMenu |
subMenu := UIManager default newMenuIn: self for: self.
subMenu add: 'border width...' selector: #changeBorderWidth:.
subMenu add: 'border color...' selector: #changeBorderColor:.
subMenu addLine.
subMenu
add: 'border width...' selector: #changeBorderWidth:;
add: 'border color...' selector: #changeBorderColor:;
addLine.

BorderStyle borderStyleChoices do:
[:sym | (self borderStyleForSymbol: sym)
ifNotNil:
Expand Down Expand Up @@ -75,13 +77,6 @@ BorderedMorph >> borderColor: colorOrSymbolOrNil [

]

{ #category : #initialization }
BorderedMorph >> borderInitialize [
"initialize the receiver state related to border"
borderColor:= self defaultBorderColor.
borderWidth := self defaultBorderWidth
]

{ #category : #accessing }
BorderedMorph >> borderInset [
self borderColor: #inset
Expand Down Expand Up @@ -177,13 +172,13 @@ BorderedMorph >> colorForInsets [
^super colorForInsets
]

{ #category : #initialization }
{ #category : #'accessing - defaults' }
BorderedMorph >> defaultBorderColor [
"answer the default border color/fill style for the receiver"
^ Color black
]

{ #category : #initialization }
{ #category : #'accessing - defaults' }
BorderedMorph >> defaultBorderWidth [
"answer the default border width for the receiver"
^ self theme borderWidth
Expand All @@ -200,10 +195,18 @@ BorderedMorph >> doesBevels [

{ #category : #initialization }
BorderedMorph >> initialize [
"initialize the state of the receiver"
"Initializes the receiver"

super initialize.
self initializeBorder
]

{ #category : #'private - initialization' }
BorderedMorph >> initializeBorder [
"Initialize the receiver state related to border."

self borderInitialize
borderColor:= self defaultBorderColor.
borderWidth := self defaultBorderWidth
]

{ #category : #testing }
Expand Down

0 comments on commit 3da63db

Please sign in to comment.