Skip to content

Commit

Permalink
Merge pull request #15680 from Rinzwind/iconicbuttonmorph-formset
Browse files Browse the repository at this point in the history
Refactor IconicButtonMorph to support use of a FormSet
  • Loading branch information
MarcusDenker authored Dec 4, 2023
2 parents 76910c2 + 7329e0c commit bfcc0b6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/Calypso-Browser/ClyMainItemCellMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ ClyMainItemCellMorph >> collapsedButton [
target: item;
actionSelector: #expand;
arguments: {};
labelGraphic: self theme treeUnexpandedForm;
labelFormSet: self theme treeUnexpandedFormSet;
color: Color transparent;
helpText: 'Expand Item';
borderWidth: 0
Expand Down Expand Up @@ -212,7 +212,7 @@ ClyMainItemCellMorph >> expandedButton [
target: item;
actionSelector: #collapse;
arguments: {};
labelGraphic: self theme treeExpandedForm;
labelFormSet: self theme treeExpandedFormSet;
color: Color transparent;
helpText: 'Unexpand Item';
borderWidth: 0
Expand Down
4 changes: 2 additions & 2 deletions src/Calypso-Browser/ClyToolContextNavigatorMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ ClyToolContextNavigatorMorph >> build [
| goButton contextLabel |
contextLabel := ownerTool printContext.
contextLabel ifEmpty: [ ^self ]. "if ownerTool not defines meaningfull context name we ignore it"
self addMorphBack: (self iconNamed: #uncommentedClass) asMorph.
self addMorphBack: (self iconFormSetNamed: #uncommentedClass) asMorph.
self addMorphBack: contextLabel asMorph.
goButton := IconicButtonMorph new
target: self;
actionSelector: #restoreBrowserState;
arguments: {};
labelGraphic: (self iconNamed: #forward);
labelFormSet: (self iconFormSetNamed: #forward);
color: Color transparent;
helpText: 'Move browser to ', contextLabel;
borderWidth: 0.
Expand Down
4 changes: 2 additions & 2 deletions src/Calypso-SystemTools-Core/ClyProtocolEditorMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ClyProtocolEditorMorph >> buildEditButton [
target: self;
actionSelector: #openEditor;
arguments: #();
labelGraphic: (self iconNamed: #edit);
labelFormSet: (self iconFormSetNamed: #edit);
color: Color transparent;
borderWidth: 0
]
Expand Down Expand Up @@ -93,7 +93,7 @@ ClyProtocolEditorMorph >> buildResetButton [
target: self;
actionSelector: #resetProtocolAndPackage;
arguments: #();
labelGraphic: (self iconNamed: #glamorousClose);
labelFormSet: (self iconFormSetNamed: #glamorousClose);
color: Color transparent;
borderWidth: 0;
hResizing: #shinkWrap;
Expand Down
28 changes: 20 additions & 8 deletions src/Morphic-Widgets-Basic/IconicButtonMorph.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ IconicButtonMorph >> interactSelector [
^ #interact
]

{ #category : 'accessing' }
IconicButtonMorph >> labelFormSet [

^ graphicalMorph formSet
]

{ #category : 'accessing' }
IconicButtonMorph >> labelFormSet: aFormSet [
"Changed to look for any image morph rather than just a sketch."

graphicalMorph ifNotNil: [graphicalMorph delete].
graphicalMorph := ImageMorph new formSet: aFormSet.
self extent: graphicalMorph extent + (self borderWidth + self extraBorder).
graphicalMorph position: self center - (graphicalMorph extent // 2).
self addMorph: graphicalMorph.
graphicalMorph lock
]

{ #category : 'accessing' }
IconicButtonMorph >> labelFromString: aString [
"Make an iconic label from aString"
Expand All @@ -130,19 +148,13 @@ IconicButtonMorph >> labelFromString: aString [
{ #category : 'accessing' }
IconicButtonMorph >> labelGraphic [

^ graphicalMorph form
^ self labelFormSet asForm
]

{ #category : 'accessing' }
IconicButtonMorph >> labelGraphic: aForm [
"Changed to look for any image morph rather than just a sketch."

graphicalMorph ifNotNil: [graphicalMorph delete].
graphicalMorph := ImageMorph new form: aForm.
self extent: graphicalMorph extent + (self borderWidth + self extraBorder).
graphicalMorph position: self center - (graphicalMorph extent // 2).
self addMorph: graphicalMorph.
graphicalMorph lock
^ self labelFormSet: (FormSet form: aForm)
]

{ #category : 'mouse events' }
Expand Down
12 changes: 6 additions & 6 deletions src/Morphic-Widgets-FastTable/FTBasicItem.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Class {
}

{ #category : 'expanding-collapsing' }
FTBasicItem class >> expandedForm [
^ self theme treeExpandedForm
FTBasicItem class >> expandedFormSet [
^ self theme treeExpandedFormSet
]

{ #category : 'accessing' }
Expand All @@ -62,8 +62,8 @@ FTBasicItem class >> theme [
]

{ #category : 'expanding-collapsing' }
FTBasicItem class >> unexpandedForm [
^ self theme treeUnexpandedForm
FTBasicItem class >> unexpandedFormSet [
^ self theme treeUnexpandedFormSet
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -125,7 +125,7 @@ FTBasicItem >> collpasedButton [
target: self;
actionSelector: #expandAndRefresh;
arguments: {};
labelGraphic: self class unexpandedForm;
labelFormSet: self class unexpandedFormSet;
color: Color transparent;
helpText: 'Expand Item';
borderWidth: 0
Expand Down Expand Up @@ -199,7 +199,7 @@ FTBasicItem >> expandedButton [
target: self;
actionSelector: #collapseAndRefresh;
arguments: {};
labelGraphic: self class expandedForm;
labelFormSet: self class expandedFormSet;
color: Color transparent;
helpText: 'Unexpand Item';
borderWidth: 0
Expand Down

0 comments on commit bfcc0b6

Please sign in to comment.