-
-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve demo and migrate it to Spec 2.
Fixes #3855
- Loading branch information
Showing
2 changed files
with
73 additions
and
31 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,66 @@ | ||
" | ||
I am a simple presenter to display the Athens demo. | ||
I'll open an Athens demo morph and will display two buttons to navigate the different demos. | ||
Examples | ||
------------- | ||
self open | ||
" | ||
Class { | ||
#name : #AthensDemoPresenter, | ||
#superclass : #SpPresenter, | ||
#instVars : [ | ||
'backButton', | ||
'forwardButton', | ||
'demo' | ||
], | ||
#category : #'Athens-Examples-Demos' | ||
} | ||
|
||
{ #category : #specs } | ||
AthensDemoPresenter class >> defaultSpec [ | ||
^ SpBoxLayout newVertical | ||
add: #demo; | ||
add: | ||
(SpBoxLayout newHorizontal | ||
add: #backButton; | ||
add: #forwardButton; | ||
yourself) | ||
withConstraints: [ :constraints | constraints height: self toolbarHeight ]; | ||
yourself | ||
] | ||
|
||
{ #category : #'instance creation' } | ||
AthensDemoPresenter class >> open [ | ||
<script> | ||
self new openWithSpec | ||
] | ||
|
||
{ #category : #initialization } | ||
AthensDemoPresenter >> initializeWidgets [ | ||
backButton := self newButton. | ||
forwardButton := self newButton. | ||
demo := self newMorph. | ||
|
||
demo morph: AthensDemoMorph new. | ||
|
||
backButton | ||
label: 'Previous Figure'; | ||
action: [ demo morph prevFigure ]. | ||
forwardButton | ||
label: 'Next Figure'; | ||
action: [ demo morph nextFigure ]. | ||
|
||
self focusOrder | ||
add: backButton; | ||
add: forwardButton | ||
] | ||
|
||
{ #category : #initialization } | ||
AthensDemoPresenter >> initializeWindow: aWindowPresenter [ | ||
aWindowPresenter | ||
title: 'Athens demos'; | ||
initialExtent: demo morph extent + (0 @ 100) | ||
] |