80 lines
1.9 KiB
Smalltalk
80 lines
1.9 KiB
Smalltalk
"
|
|
I am a Spec ComposableModel for all Glamour presentations (GLMPresentation subclasses.) By default I open a Playground because its creation contract is special.
|
|
|
|
Example uses :
|
|
|
|
""open a playground""
|
|
GlamourPresentationModel new openWithSpec.
|
|
|
|
""open a playground on 42""
|
|
|ui|
|
|
ui := GlamourPresentationModel new.
|
|
ui presentationClass: GTPlayground startOn: (GTPlayPage new saveContent: '42').
|
|
ui openWithSpec
|
|
|
|
""open an inspector on 42""
|
|
|ui|
|
|
ui := GlamourPresentationModel new.
|
|
ui presentationClass: GTInspector startOn: 42.
|
|
ui openWithSpec
|
|
"
|
|
Class {
|
|
#name : #GlamourPresentationModel,
|
|
#superclass : #SpPresenter,
|
|
#instVars : [
|
|
'presentation',
|
|
'glmPres'
|
|
],
|
|
#category : 'Grafoscopio-UI'
|
|
}
|
|
|
|
{ #category : #specs }
|
|
GlamourPresentationModel class >> defaultSpec [
|
|
<spec: #default>
|
|
^ SpBoxLayout newHorizontal
|
|
add: #presentation;
|
|
yourself
|
|
]
|
|
|
|
{ #category : #deprecation }
|
|
GlamourPresentationModel class >> isDeprecated [
|
|
^ true
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GlamourPresentationModel >> glmPres [
|
|
glmPres isNil ifTrue:[glmPres := GTPlayground new startOn: GTPlayPage new].
|
|
^glmPres
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GlamourPresentationModel >> initializeWidgets [
|
|
"Should actually do nothing at all.
|
|
This is because we cannot create the morph and later set the presentation.
|
|
So we will do all of this in the presentation: accessor.
|
|
"
|
|
self presentation.
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GlamourPresentationModel >> presentation [
|
|
presentation isNil ifTrue:[
|
|
| morph |
|
|
morph := GLMMorphicRenderer new render: self glmPres.
|
|
morph hResizing: #spaceFill.
|
|
morph vResizing: #spaceFill.
|
|
presentation := MorphicGenericAdapter morph: morph].
|
|
|
|
^ presentation
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GlamourPresentationModel >> presentation: anObject [
|
|
presentation := anObject
|
|
]
|
|
|
|
{ #category : #api }
|
|
GlamourPresentationModel >> presentationClass: aGLMCompositePresentation startOn: anObject [
|
|
glmPres := aGLMCompositePresentation new startOn: anObject
|
|
]
|