69 lines
1.8 KiB
Smalltalk
69 lines
1.8 KiB
Smalltalk
Class {
|
|
#name : #GrafoscopioNewTextModel,
|
|
#superclass : #GrafoscopioNewTextInputModel,
|
|
#instVars : [
|
|
'up',
|
|
'down',
|
|
'delete',
|
|
'editionMode'
|
|
],
|
|
#category : #'Grafoscopio-New-UI'
|
|
}
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioNewTextModel >> createLayoutFor: aGrafoscopioNodeContent [
|
|
^ editionMode
|
|
ifTrue: [ self editionLayoutFor: aGrafoscopioNodeContent ]
|
|
ifFalse: [ self normalLayoutFor: aGrafoscopioNodeContent ]
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioNewTextModel >> editionLayoutFor: aGrafoscopioNodeContent [
|
|
^ SpBoxLayout newVertical
|
|
add:
|
|
(SpBoxLayout newHorizontal
|
|
add:
|
|
(SpBoxLayout newVertical
|
|
add: #up;
|
|
add: #down;
|
|
add: #delete;
|
|
yourself)
|
|
width: 30;
|
|
add: #body;
|
|
yourself)
|
|
height: (self heightFor: aGrafoscopioNodeContent)
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioNewTextModel >> initializeWidgets [
|
|
super initializeWidgets .
|
|
editionMode := true.
|
|
up := self newButton icon: (self iconNamed: #up) ; color: Color transparent ; yourself .
|
|
down := self newButton icon: (self iconNamed: #down) ; color: Color transparent ; yourself .
|
|
delete := self newButton icon: (self iconNamed: #delete) ; color: Color transparent ; yourself .
|
|
up action: [ model moveUp. self informModification. ].
|
|
down action: [ model moveDown. self informModification.].
|
|
delete action: [ model remove .self informModification. ]
|
|
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioNewTextModel >> newTextComponent [
|
|
^ self newText
|
|
whenTextChangedDo: [ model text: body text ];
|
|
autoAccept: true;
|
|
yourself
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioNewTextModel >> normalLayoutFor: aGrafoscopioNodeContent [
|
|
^ SpBoxLayout newVertical
|
|
add: #body
|
|
height: (self heightFor: aGrafoscopioNodeContent)
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioNewTextModel >> toogleEditionMode [
|
|
editionMode := editionMode not.
|
|
]
|