The Trunk: ToolBuilder-Morphic-mt.128.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: ToolBuilder-Morphic-mt.128.mcz

commits-2
Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-mt.128.mcz

==================== Summary ====================

Name: ToolBuilder-Morphic-mt.128
Author: mt
Time: 14 April 2015, 5:04:16.422 pm
UUID: 93b11520-1c7c-9347-8230-e7d4b3fb1179
Ancestors: ToolBuilder-Morphic-mt.127

Pluggable buttons can get a default color now by just giving that color into the spec's #color:.

=============== Diff against ToolBuilder-Morphic-mt.127 ===============

Item was changed:
  ----- Method: MorphicToolBuilder>>buildPluggableButton: (in category 'widgets required') -----
  buildPluggableButton: aSpec
  | widget label state action enabled |
  label := aSpec label.
  state := aSpec state.
  action := aSpec action.
  widget := self buttonClass on: aSpec model
  getState: (state isSymbol ifTrue:[state])
  action: nil
  label: (label isSymbol ifTrue:[label]).
  widget style: aSpec style.
  aSpec changeLabelWhen
  ifNotNilDo: [ :event | widget whenChanged: event update: aSpec label].
  self register: widget id: aSpec name.
  enabled := aSpec enabled.
  enabled isSymbol
  ifTrue:[widget getEnabledSelector: enabled]
  ifFalse:[widget enabled:enabled].
  widget action: action.
+ aSpec color isColor
+ ifTrue: [widget
+ onColor: aSpec color
+ offColor: aSpec color]
+ ifFalse: [
+ widget getColorSelector: aSpec color.
+ widget offColor: Color white].
- widget getColorSelector: aSpec color.
- widget offColor: Color white..
  self buildHelpFor: widget spec: aSpec.
  (label isSymbol or:[label == nil]) ifFalse:[widget label: label].
  self setFrame: aSpec frame in: widget.
  parent ifNotNil:[self add: widget to: parent].
  ^widget!

Item was changed:
  ----- Method: PluggableButtonMorphPlus>>update: (in category 'updating') -----
  update: what
+
+ self getModelState
+ ifTrue: [self color: onColor]
+ ifFalse: [self color: offColor].
+
  what ifNil:[^self].
+
  what == getLabelSelector ifTrue: [
  self label: (model perform: getLabelSelector)].
  what == getEnabledSelector ifTrue:[^self enabled: (model perform: getEnabledSelector)].
 
  getColorSelector ifNotNil: [ | cc |
  color = (cc := model perform: getColorSelector) ifFalse:[
  color := cc.
  self onColor: color offColor: color.
  self changed.
  ].
  ].
+
- self getModelState
- ifTrue: [self color: onColor]
- ifFalse: [self color: offColor].
  getEnabledSelector ifNotNil:[
  self enabled: (model perform: getEnabledSelector).
  ].
  updateMap ifNotNil:
  [(updateMap at: what ifAbsent: [])
  ifNotNilDo: [ :newTarget | ^self update: newTarget]].
  !