Skip to content

Commit

Permalink
Merge 5837321 into 60c111a
Browse files Browse the repository at this point in the history
  • Loading branch information
LucPrestin committed Jul 2, 2019
2 parents 60c111a + 5837321 commit 7b99687
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default properties
minimumPadding

^ 5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
drawing
labelShrinkThreshold

^ (self label font widthOf: $m) * 2
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
drawing
updateContents: aCanvas

self updateLabelPosition.
self updateIcons
self updateIcons.
self updateLabelExtent.
self updateLabelPosition
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
drawing
updateLabelExtent

| availableWidth |

availableWidth := self width.
self hasIcon ifTrue: [availableWidth := availableWidth - self icon width].
self hasIconRight ifTrue: [availableWidth := availableWidth - self iconRight width].
availableWidth := availableWidth - (self class minimumPadding * 2).

availableWidth < self labelShrinkThreshold
ifTrue: [self label shrink]
ifFalse: [
self label expand.
availableWidth < self label fullWidth
ifTrue: [self label width: availableWidth]]
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"icon:" : "JW 6/19/2018 10:20",
"iconRight:" : "JW 6/19/2018 10:20",
"minWidth" : "JW 5/17/2018 13:01",
"minimumPadding" : "RW 7/1/2019 14:17",
"textDisabledAlpha" : "CG 7/25/2018 20:36" },
"instance" : {
"addIcon:" : "CG 7/1/2018 11:10",
Expand Down Expand Up @@ -54,6 +55,7 @@
"labelPositionIconNotPresent" : "LS 6/12/2018 20:14",
"labelPositionIconPresent" : "LS 6/28/2018 21:29",
"labelPositionOnlyIconRightPresent" : "mats 6/21/2018 11:47",
"labelShrinkThreshold" : "RW 7/1/2019 15:09",
"minHeight" : "LS 6/28/2018 21:25",
"removeIcon" : "LS 6/12/2018 16:27",
"removeIconRight" : "JW 6/19/2018 11:38",
Expand All @@ -67,9 +69,10 @@
"toggleOn" : "mats 7/3/2018 13:09",
"toggled:" : "JW 6/15/2018 12:34",
"updateBounds" : "mats 7/10/2018 12:45",
"updateContents:" : "CG 7/1/2018 11:36",
"updateContents:" : "RW 7/1/2019 14:21",
"updateIcon" : "LS 6/10/2018 17:42",
"updateIconColor:" : "LS 6/10/2018 15:33",
"updateIconRight" : "LS 6/10/2018 17:43",
"updateIcons" : "CG 7/1/2018 11:37",
"updateLabelExtent" : "lp 7/2/2019 21:20",
"updateLabelPosition" : "LS 6/28/2018 21:29" } }
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ contents: anObject
ifTrue: [^ self].
"no substantive change"
newContents].
self fitContents
self fitContents.
self fullContents: newContents
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scaling
expand

contents := self fullContents.
self fitContents
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
fullContents: anObject

fullContents := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
fullContents

^ fullContents ifNil: [fullContents := '']
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scaling
fullWidth

^ self font widthOfString: self fullContents
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scaling
shrink

self fullContents ifNotEmpty: [
contents := self fullContents first asString.
self fitContents]
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@
"instance" : {
"alwaysUppercase" : "CG 7/11/2018 17:31",
"alwaysUppercase:" : "CG 7/11/2018 17:31",
"contents:" : "wb 6/13/2019 14:43",
"findString:startingAt:caseSensitive:" : "LS 6/26/2018 17:17" } }
"contents:" : "RW 7/1/2019 14:10",
"expand" : "RW 7/1/2019 15:14",
"findString:startingAt:caseSensitive:" : "LS 6/26/2018 17:17",
"fullContents" : "RW 7/1/2019 14:30",
"fullContents:" : "RW 7/1/2019 14:10",
"fullWidth" : "RW 7/1/2019 14:18",
"shrink" : "RW 7/1/2019 15:14" } }
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
],
"commentStamp" : "LS 6/11/2018 10:16",
"instvars" : [
"alwaysUppercase" ],
"alwaysUppercase",
"fullContents" ],
"name" : "MDLabel",
"pools" : [
],
Expand Down

0 comments on commit 7b99687

Please sign in to comment.