-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from jecisc/45-add-spacers-to-layouts
45-add-spacers-to-layouts
- Loading branch information
Showing
12 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
" | ||
Description | ||
-------------------- | ||
I am a simple presenter to add spacers to spec layouts. | ||
" | ||
Class { | ||
#name : #SpacerPresenter, | ||
#superclass : #AbstractWidgetPresenter, | ||
#category : #'Spec-Core-Widgets' | ||
} | ||
|
||
{ #category : #specs } | ||
SpacerPresenter class >> adapterName [ | ||
|
||
^ #SpacerAdapter | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Extension { #name : #SpecLayout } | ||
|
||
{ #category : #'*Spec-Core' } | ||
SpecLayout >> addSpacer [ | ||
self add: #specSpacer | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
" | ||
Description | ||
-------------------- | ||
I am a simple demo to show how to use spacers in Spec layouts. | ||
``` | ||
SpecSpacerDemo example | ||
``` | ||
" | ||
Class { | ||
#name : #SpecSpacerDemo, | ||
#superclass : #ComposablePresenter, | ||
#instVars : [ | ||
'input2', | ||
'input3', | ||
'input4', | ||
'button1', | ||
'button2', | ||
'button3', | ||
'button4', | ||
'input1' | ||
], | ||
#category : #'Spec-Examples-Demo-Layouts' | ||
} | ||
|
||
{ #category : #specs } | ||
SpecSpacerDemo class >> defaultSpec [ | ||
^ SpecLayout composed | ||
newColumn: [ :c | | ||
c | ||
newRow: #input1 height: self inputTextHeight; | ||
addSpacer; | ||
newRow: #input2 height: self inputTextHeight; | ||
newRow: #input3 height: self inputTextHeight; | ||
addSpacer; | ||
addSpacer; | ||
newRow: #input4 height: self inputTextHeight; | ||
addSpacer; | ||
newRow: [ :r | | ||
r | ||
add: #button1; | ||
addSpacer; | ||
add: #button2; | ||
"addSpacer;" | ||
add: #button3; | ||
"addSpacer;" | ||
add: #button4 ] | ||
height: self toolbarHeight ]; | ||
yourself | ||
] | ||
|
||
{ #category : #specs } | ||
SpecSpacerDemo class >> example [ | ||
^ self new openWithSpec | ||
] | ||
|
||
{ #category : #specs } | ||
SpecSpacerDemo class >> title [ | ||
^ 'Spacer demo' | ||
] | ||
|
||
{ #category : #accessing } | ||
SpecSpacerDemo >> button1 [ | ||
^ button1 | ||
] | ||
|
||
{ #category : #accessing } | ||
SpecSpacerDemo >> button2 [ | ||
^ button2 | ||
] | ||
|
||
{ #category : #accessing } | ||
SpecSpacerDemo >> button3 [ | ||
^ button3 | ||
] | ||
|
||
{ #category : #accessing } | ||
SpecSpacerDemo >> button4 [ | ||
^ button4 | ||
] | ||
|
||
{ #category : #specs } | ||
SpecSpacerDemo >> extent [ | ||
^ 700@500 | ||
] | ||
|
||
{ #category : #initialization } | ||
SpecSpacerDemo >> initializeWidgets [ | ||
|
||
input1 := self newTextInput. | ||
input2 := self newTextInput. | ||
input3 := self newTextInput. | ||
input4 := self newTextInput. | ||
|
||
button1 := self newButton. | ||
button2 := self newButton. | ||
button3 := self newButton. | ||
button4 := self newButton. | ||
|
||
input1 ghostText: 'Input 1'. | ||
input2 ghostText: 'Input 2'. | ||
input3 ghostText: 'Input 3'. | ||
input4 ghostText: 'Input 4'. | ||
|
||
button1 label: 'Button 1'. | ||
button2 label: 'Button 2'. | ||
button3 label: 'Button 3'. | ||
button4 label: 'Button 4' | ||
] | ||
|
||
{ #category : #accessing } | ||
SpecSpacerDemo >> input1 [ | ||
^ input1 | ||
] | ||
|
||
{ #category : #accessing } | ||
SpecSpacerDemo >> input2 [ | ||
^ input2 | ||
] | ||
|
||
{ #category : #accessing } | ||
SpecSpacerDemo >> input3 [ | ||
^ input3 | ||
] | ||
|
||
{ #category : #accessing } | ||
SpecSpacerDemo >> input4 [ | ||
^ input4 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Class { | ||
#name : #MorphicSpacerAdapter, | ||
#superclass : #AbstractMorphicAdapter, | ||
#category : #'Spec-MorphicAdapters-Base' | ||
} | ||
|
||
{ #category : #factory } | ||
MorphicSpacerAdapter >> buildWidget [ | ||
^ PanelMorph new | ||
changeTableLayout; | ||
hResizing: #spaceFill; | ||
vResizing: #spaceFill; | ||
yourself | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
" | ||
Stub | ||
" | ||
Class { | ||
#name : #SpecStubSpacerAdapter, | ||
#superclass : #SpecStubAbstractAdapter, | ||
#category : #'Spec-StubAdapter-Adapters' | ||
} | ||
|
||
{ #category : #factory } | ||
SpecStubSpacerAdapter >> buildWidget [ | ||
^ SpecStubSpacerView new | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
" | ||
Stub | ||
" | ||
Class { | ||
#name : #SpecStubSpacerView, | ||
#superclass : #SpecStubViews, | ||
#category : #'Spec-StubAdapter-Views' | ||
} |