Skip to content

Commit

Permalink
Added Textmorph
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Krohn committed Jun 30, 2024
1 parent 59f0473 commit 9501907
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 64 deletions.
55 changes: 0 additions & 55 deletions src/SqueakWhiteboard-Core/WBDynamicTextbox.class.st

This file was deleted.

31 changes: 26 additions & 5 deletions src/SqueakWhiteboard-Core/WBElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Class {
'lastMouseClick',
'doubleClickMaxDelta',
'supportsText',
'morph'
'morph',
'resizable'
],
#classInstVars : [
'globalColor'
Expand All @@ -37,7 +38,7 @@ WBElement class >> defaultSize [

{
#category : #'instance creation',
#'squeak_changestamp' : 'si 6/20/2024 23:14'
#'squeak_changestamp' : 'JK 6/30/2024 15:58'
}
WBElement class >> newWithCanvas: aCanvas [

Expand Down Expand Up @@ -107,11 +108,13 @@ WBElement >> addOwnMorphTo: aMorph [

{
#category : #resize,
#'squeak_changestamp' : 'is 6/23/2024 01:30'
#'squeak_changestamp' : 'JK 6/30/2024 15:40'
}
WBElement >> addResizeFrame [

self resizeFrame: (WBResizeFrame newWithParent: self)

self resizable ifTrue: [
self resizeFrame: (WBResizeFrame newWithParent: self)
]



Expand Down Expand Up @@ -774,6 +777,24 @@ WBElement >> resetTextfield [
self textField: nil
]

{
#category : #accessing,
#'squeak_changestamp' : 'JK 6/30/2024 15:47'
}
WBElement >> resizable [

^ resizable ifNil: [resizable := true]
]

{
#category : #accessing,
#'squeak_changestamp' : 'JK 6/30/2024 15:46'
}
WBElement >> resizable: anObject [

resizable := anObject
]

{
#category : #accessing,
#'squeak_changestamp' : 'si 6/3/2024 15:53'
Expand Down
34 changes: 32 additions & 2 deletions src/SqueakWhiteboard-Core/WBPluggableTextMorphPlus.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Class {
#superclass : #PluggableTextMorphPlus,
#instVars : [
'enabled',
'element'
'element',
'onChanged'
],
#category : #'SqueakWhiteboard-Core',
#'squeak_changestamp' : 'is 6/1/2024 17:19'
Expand Down Expand Up @@ -53,6 +54,17 @@ WBPluggableTextMorphPlus >> enabled: aBoolean [
self owner currentHand releaseKeyboardFocus]
]

{
#category : #'event handling',
#'squeak_changestamp' : 'JK 6/30/2024 15:34'
}
WBPluggableTextMorphPlus >> handleKeystroke: anEvent [

super handleKeystroke: anEvent.
self onChanged value

]

{
#category : #'event handling',
#'squeak_changestamp' : 'is 6/23/2024 01:48'
Expand Down Expand Up @@ -93,7 +105,7 @@ WBPluggableTextMorphPlus >> hasUnacceptedEdits: aBoolean [

{
#category : #initialization,
#'squeak_changestamp' : 'is 6/23/2024 01:48'
#'squeak_changestamp' : 'JK 6/30/2024 15:34'
}
WBPluggableTextMorphPlus >> initialize [

Expand All @@ -105,6 +117,24 @@ WBPluggableTextMorphPlus >> initialize [
wrapFlag: true
]

{
#category : #accessing,
#'squeak_changestamp' : 'JK 6/30/2024 15:59'
}
WBPluggableTextMorphPlus >> onChanged [

^ onChanged
]

{
#category : #accessing,
#'squeak_changestamp' : 'JK 6/30/2024 15:59'
}
WBPluggableTextMorphPlus >> onChanged: anObject [

onChanged := anObject
]

{
#category : #private,
#'squeak_changestamp' : 'is 6/2/2024 18:30'
Expand Down
30 changes: 30 additions & 0 deletions src/SqueakWhiteboard-Core/WBTextbox.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Class {
#name : #WBTextbox,
#superclass : #WBRectangularElement,
#category : #'SqueakWhiteboard-Core'
}

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'JK 6/30/2024 15:52'
}
WBTextbox >> initialize [

self resizable: false.
super initialize.
self color: Color transparent.
self textField wrapFlag: false;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
onChanged: [self resize];
position: self position.
]

{
#category : #'as yet unclassified',
#'squeak_changestamp' : 'JK 6/30/2024 15:12'
}
WBTextbox >> resize [

self morph bounds: self textField bounds
]
4 changes: 2 additions & 2 deletions src/SqueakWhiteboard-Core/WBToolbar.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ WBToolbar >> buttonFunctionalityForShapeChoosing [

{
#category : #'button functionalities',
#'squeak_changestamp' : 'is 6/25/2024 15:34'
#'squeak_changestamp' : 'JK 6/30/2024 14:56'
}
WBToolbar >> buttonFunctionalityForTextbox [

^ [:aButton | self canvas spawnAnElement: (WBDynamicTextbox newWithCanvas: self canvas) At: aButton currentEvent]
^ [:aButton | self canvas spawnAnElement: (WBTextbox newWithCanvas: self canvas) At: aButton currentEvent]
]

{
Expand Down

0 comments on commit 9501907

Please sign in to comment.