Skip to content
Permalink
Browse files

Merge pull request #767 from demarey/766-Allow-to-add-an-image-in-the…

…-layout-without-declaring-an-image-presenter

Fixes issue #766 Allow to add an image in the layout without declarin…
  • Loading branch information...
jecisc committed Sep 11, 2019
2 parents 0d029c0 + c523dee commit 748bc59545ff1f96581779033ef9f9a7cb7209f8
@@ -0,0 +1,8 @@
Extension { #name : #Form }

{ #category : #'*Spec2-Core' }
Form >> asPresenter [
^ SpImagePresenter new
image: self;
yourself
]
@@ -0,0 +1,29 @@
"
Description
--------------------

Demo page for SpecDemoImagePresenter
"
Class {
#name : #SpDemoImagePage,
#superclass : #SpDemoPage,
#category : #'Spec2-Examples-Demo-Other'
}

{ #category : #initialization }
SpDemoImagePage class >> pageName [

^ 'Images'
]

{ #category : #initialization }
SpDemoImagePage class >> priority [

^ 16
]

{ #category : #initialization }
SpDemoImagePage >> pageClass [

^ SpDemoImagePresenter
]
@@ -0,0 +1,59 @@
"
Description
--------------------
This demo show how to use the image presenter
"
Class {
#name : #SpDemoImagePresenter,
#superclass : #SpPresenter,
#instVars : [
'image1',
'image2'
],
#category : #'Spec2-Examples-Demo-Other'
}

{ #category : #specs }
SpDemoImagePresenter class >> defaultSpec [
^ SpBoxLayout newVertical
add: (SpBoxLayout newHorizontal
add: 'Image added through an ImagePresenter:';
add: #image1;
yourself)
height: 50;
add: (SpBoxLayout newHorizontal
add: 'Image added through an ImagePresenter:';
add: #image2;
yourself);
add: (SpBoxLayout newHorizontal
add: 'Image added directly from the layout definition:';
add: (self iconNamed: #pharoBig);
yourself);
yourself
]

{ #category : #'instance creation' }
SpDemoImagePresenter class >> open [
<script>
self new openWithSpec
]

{ #category : #accessing }
SpDemoImagePresenter >> image1 [
^ image1
]

{ #category : #accessing }
SpDemoImagePresenter >> image2 [
^ image2
]

{ #category : #initialization }
SpDemoImagePresenter >> initializeWidgets [
image1 := self newImage.
image2 := self newImage.

image1 image: (self iconNamed: #pharo).
image2 image: self currentWorld submorphs last form.
]

0 comments on commit 748bc59

Please sign in to comment.
You can’t perform that action at this time.