[squeak-dev] The Trunk: MorphicExtras-kfr.167.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Nov 19 19:55:39 UTC 2015
Karl Ramberg uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-kfr.167.mcz
==================== Summary ====================
Name: MorphicExtras-kfr.167
Author: kfr
Time: 19 November 2015, 8:55:15.765 pm
UUID: d101e159-825d-4c86-a582-8bd22029b3bf
Ancestors: MorphicExtras-mt.166
ProgressMorph and ProgressBarMorph are not used as widgets. Moved to MorphicExtras-Obsolete
=============== Diff against MorphicExtras-mt.166 ===============
Item was added:
+ BorderedMorph subclass: #ProgressBarMorph
+ instanceVariableNames: 'value progressColor lastValue'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'MorphicExtras-Obsolete'!
Item was added:
+ ----- Method: ProgressBarMorph>>addCustomMenuItems:hand: (in category 'menu') -----
+ addCustomMenuItems: aCustomMenu hand: aHandMorph
+ super addCustomMenuItems: aCustomMenu hand: aHandMorph.
+ aCustomMenu addList: {
+ {'progress color...' translated. #changeProgressColor:}.
+ {'progress value...' translated. #changeProgressValue:}.
+ }!
Item was added:
+ ----- Method: ProgressBarMorph>>changeProgressColor: (in category 'menu') -----
+ changeProgressColor: evt
+ | aHand |
+ aHand := evt ifNotNil: [evt hand] ifNil: [self primaryHand].
+ self changeColorTarget: self selector: #progressColor: originalColor: self progressColor hand: aHand.!
Item was added:
+ ----- Method: ProgressBarMorph>>changeProgressValue: (in category 'menu') -----
+ changeProgressValue: evt
+ | answer |
+ answer := UIManager default
+ request: 'Enter new value (0 - 1.0)'
+ initialAnswer: self value contents asString.
+ answer isEmptyOrNil ifTrue: [^ self].
+ self value contents: answer asNumber!
Item was added:
+ ----- Method: ProgressBarMorph>>drawOn: (in category 'drawing') -----
+ drawOn: aCanvas
+ | width inner |
+ super drawOn: aCanvas.
+ inner := self innerBounds.
+ width := (inner width * lastValue) truncated min: inner width.
+ aCanvas fillRectangle: (inner origin extent: width @ inner height) color: progressColor.!
Item was added:
+ ----- Method: ProgressBarMorph>>initialize (in category 'initialization') -----
+ initialize
+ super initialize.
+ progressColor := Color green.
+ self value: (ValueHolder new contents: 0.0).
+ lastValue := 0.0!
Item was added:
+ ----- Method: ProgressBarMorph>>progressColor (in category 'accessing') -----
+ progressColor
+ ^progressColor!
Item was added:
+ ----- Method: ProgressBarMorph>>progressColor: (in category 'accessing') -----
+ progressColor: aColor
+ progressColor = aColor
+ ifFalse:
+ [progressColor := aColor.
+ self changed]!
Item was added:
+ ----- Method: ProgressBarMorph>>update: (in category 'updating') -----
+ update: aSymbol
+ aSymbol == #contents
+ ifTrue:
+ [lastValue := value contents.
+ self changed]!
Item was added:
+ ----- Method: ProgressBarMorph>>value (in category 'accessing') -----
+ value
+ ^value!
Item was added:
+ ----- Method: ProgressBarMorph>>value: (in category 'accessing') -----
+ value: aModel
+ value ifNotNil: [value removeDependent: self].
+ value := aModel.
+ value ifNotNil: [value addDependent: self]!
Item was added:
+ RectangleMorph subclass: #ProgressMorph
+ instanceVariableNames: 'labelMorph subLabelMorph progress'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'MorphicExtras-Obsolete'!
Item was added:
+ ----- Method: ProgressMorph class>>example (in category 'example') -----
+ example
+ "ProgressMorph example"
+
+ | progress |
+ progress := ProgressMorph label: 'Test progress'.
+ progress subLabel: 'this is the subheading'.
+ progress openInWorld.
+ [10 timesRepeat:
+ [(Delay forMilliseconds: 200) wait.
+ progress incrDone: 0.1].
+ progress delete] fork!
Item was added:
+ ----- Method: ProgressMorph class>>label: (in category 'instance creation') -----
+ label: aString
+ ^self new label: aString!
Item was added:
+ ----- Method: ProgressMorph>>done (in category 'accessing') -----
+ done
+ ^self progress value contents!
Item was added:
+ ----- Method: ProgressMorph>>done: (in category 'accessing') -----
+ done: amountDone
+ self progress value contents: ((amountDone min: 1.0) max: 0.0).
+ self currentWorld displayWorld!
Item was added:
+ ----- Method: ProgressMorph>>fontOfPointSize: (in category 'private') -----
+ fontOfPointSize: size
+ ^ (TextConstants at: Preferences standardEToysFont familyName ifAbsent: [TextStyle default]) fontOfPointSize: size!
Item was added:
+ ----- Method: ProgressMorph>>incrDone: (in category 'accessing') -----
+ incrDone: incrDone
+ self done: self done + incrDone!
Item was added:
+ ----- Method: ProgressMorph>>initLabelMorph (in category 'initialization') -----
+ initLabelMorph
+ ^ labelMorph := StringMorph contents: '' font: (self fontOfPointSize: 14)!
Item was added:
+ ----- Method: ProgressMorph>>initProgressMorph (in category 'initialization') -----
+ initProgressMorph
+ progress := ProgressBarMorph new.
+ progress borderWidth: 1.
+ progress color: Color white.
+ progress progressColor: Color gray.
+ progress extent: 200 @ 15.
+ !
Item was added:
+ ----- Method: ProgressMorph>>initSubLabelMorph (in category 'initialization') -----
+ initSubLabelMorph
+ ^ subLabelMorph := StringMorph contents: '' font: (self fontOfPointSize: 12)!
Item was added:
+ ----- Method: ProgressMorph>>initialize (in category 'initialization') -----
+ initialize
+ super initialize.
+ self setupMorphs!
Item was added:
+ ----- Method: ProgressMorph>>label (in category 'accessing') -----
+ label
+ ^self labelMorph contents!
Item was added:
+ ----- Method: ProgressMorph>>label: (in category 'accessing') -----
+ label: aString
+ self labelMorph contents: aString.
+ self currentWorld displayWorld!
Item was added:
+ ----- Method: ProgressMorph>>labelMorph (in category 'private') -----
+ labelMorph
+ ^labelMorph ifNil: [self initLabelMorph]!
Item was added:
+ ----- Method: ProgressMorph>>progress (in category 'accessing') -----
+ progress
+ ^progress ifNil: [self initProgressMorph]!
Item was added:
+ ----- Method: ProgressMorph>>setupMorphs (in category 'initialization') -----
+ setupMorphs
+ | |
+ self initProgressMorph.
+ self
+ layoutPolicy: TableLayout new;
+ listDirection: #topToBottom;
+ cellPositioning: #topCenter;
+ listCentering: #center;
+ hResizing: #shrinkWrap;
+ vResizing: #shrinkWrap;
+ color: Color transparent.
+
+ self addMorphBack: self labelMorph.
+ self addMorphBack: self subLabelMorph.
+ self addMorphBack: self progress.
+
+ self borderWidth: 2.
+ self borderColor: Color black.
+
+ self color: Color veryLightGray.
+ self align: self fullBounds center with: Display boundingBox center
+ !
Item was added:
+ ----- Method: ProgressMorph>>subLabel (in category 'accessing') -----
+ subLabel
+ ^self subLabelMorph contents!
Item was added:
+ ----- Method: ProgressMorph>>subLabel: (in category 'accessing') -----
+ subLabel: aString
+ self subLabelMorph contents: aString.
+ self currentWorld displayWorld!
Item was added:
+ ----- Method: ProgressMorph>>subLabelMorph (in category 'private') -----
+ subLabelMorph
+ ^subLabelMorph ifNil: [self initSubLabelMorph]!
More information about the Squeak-dev
mailing list
|