The Trunk: ToolBuilder-Morphic-mt.174.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.174.mcz

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

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

Name: ToolBuilder-Morphic-mt.174
Author: mt
Time: 31 July 2016, 11:17:03.77049 am
UUID: f9224283-fd0c-3e47-8895-a070844b3e2a
Ancestors: ToolBuilder-Morphic-mt.173

*** Widget Refactorings and UI Themes (Part 6 of 11) ***

Some fixes and refactorings for buttons including added support for UI theming.

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

Item was changed:
  PluggableButtonMorph subclass: #PluggableButtonMorphPlus
+ instanceVariableNames: 'enabled action getColorSelector getEnabledSelector updateMap disabledColor disabledTextColor'
- instanceVariableNames: 'enabled action getColorSelector getEnabledSelector updateMap'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'ToolBuilder-Morphic'!
 
  !PluggableButtonMorphPlus commentStamp: 'ar 2/11/2005 21:53' prior: 0!
  An extended version of PluggableButtonMorph supporting enablement, color and block/message actions.!

Item was added:
+ ----- Method: PluggableButtonMorphPlus class>>themeProperties (in category 'preferences') -----
+ themeProperties
+
+ ^ super themeProperties, {
+ { #disabledColor. 'Colors'. 'Color when button cannot be clicked.' }.
+ { #disabledTextColor. 'Colors'. 'Color for label when button cannot be clicked.' }.
+ }!

Item was added:
+ ----- Method: PluggableButtonMorphPlus>>applyUserInterfaceTheme (in category 'updating') -----
+ applyUserInterfaceTheme
+
+ super applyUserInterfaceTheme.!

Item was changed:
  ----- Method: PluggableButtonMorphPlus>>enabled: (in category 'accessing') -----
  enabled: aBool
  enabled := aBool.
+ self updateFillStyle.!
- enabled
- ifFalse:[self color: Color gray]
- ifTrue:[self getModelState
- ifTrue: [self color: onColor]
- ifFalse: [self color: offColor]]!

Item was changed:
  ----- Method: PluggableButtonMorphPlus>>getEnabledSelector: (in category 'accessing') -----
  getEnabledSelector: aSymbol
  getEnabledSelector := aSymbol.
+ self update: getEnabledSelector.!
- self update: aSymbol.!

Item was added:
+ ----- Method: PluggableButtonMorphPlus>>handlesMouseDown: (in category 'event handling') -----
+ handlesMouseDown: evt
+ ^ enabled!

Item was added:
+ ----- Method: PluggableButtonMorphPlus>>handlesMouseOver: (in category 'event handling') -----
+ handlesMouseOver: evt
+ ^ enabled!

Item was added:
+ ----- Method: PluggableButtonMorphPlus>>handlesMouseOverDragging: (in category 'event handling') -----
+ handlesMouseOverDragging: evt
+ ^ enabled!

Item was changed:
  ----- Method: PluggableButtonMorphPlus>>initialize (in category 'initialize-release') -----
  initialize
+
- super initialize.
  enabled := true.
+ super initialize.!
- onColor := Color veryLightGray.
- offColor := Color white!

Item was removed:
- ----- Method: PluggableButtonMorphPlus>>mouseDown: (in category 'action') -----
- mouseDown: evt
- enabled ifFalse:[^self].
- ^super mouseDown: evt!

Item was removed:
- ----- Method: PluggableButtonMorphPlus>>mouseMove: (in category 'action') -----
- mouseMove: evt
- enabled ifFalse:[^self].
- ^super mouseMove: evt!

Item was removed:
- ----- Method: PluggableButtonMorphPlus>>mouseUp: (in category 'action') -----
- mouseUp: evt
- enabled ifFalse:[^self].
- ^super mouseUp: evt!

Item was removed:
- ----- Method: PluggableButtonMorphPlus>>onColor:offColor: (in category 'accessing') -----
- onColor: colorWhenOn offColor: colorWhenOff
- "Set the fill colors to be used when this button is on/off."
-
- onColor := colorWhenOn.
- offColor := colorWhenOff.
- self update: getStateSelector.!

Item was added:
+ ----- Method: PluggableButtonMorphPlus>>setDefaultParameters (in category 'initialize-release') -----
+ setDefaultParameters
+
+ disabledColor := (self userInterfaceTheme disabledColor ifNil: [Color transparent]).
+ disabledTextColor := (self userInterfaceTheme disabledTextColor ifNil: [Color gray: 0.6]).
+
+ super setDefaultParameters.
+ !

Item was added:
+ ----- Method: PluggableButtonMorphPlus>>textColorToUse (in category 'drawing') -----
+ textColorToUse
+
+ ^ self enabled
+ ifTrue: [super textColorToUse]
+ ifFalse: [disabledTextColor ifNil: [Color gray: 0.6]]!

Item was changed:
  ----- Method: PluggableButtonMorphPlus>>update: (in category 'updating') -----
  update: what
 
+ super update: what.
+
+ getColorSelector ifNotNil: [:sel |
+ what == sel ifTrue: [self offColor: (model perform: sel)]].
- self getModelState
- ifTrue: [self color: onColor]
- ifFalse: [self color: offColor].
 
+ getEnabledSelector ifNotNil: [:sel |
+ what == sel ifTrue: [self enabled: (model perform: sel)]].
- 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.
- ].
- ].
-
- getEnabledSelector ifNotNil:[
- self enabled: (model perform: getEnabledSelector).
- ].
  updateMap ifNotNil:
  [(updateMap at: what ifAbsent: [])
+ ifNotNilDo: [ :newTarget | self update: newTarget]].
- ifNotNilDo: [ :newTarget | ^self update: newTarget]].
  !

Item was added:
+ ----- Method: PluggableButtonMorphPlus>>updateFillStylePressing:hovering: (in category 'initialize-release') -----
+ updateFillStylePressing: isPressing hovering: isHovering
+
+ enabled ifFalse: [
+ self color: (disabledColor ifNil: [Color transparent]).
+ self borderStyle color: Color transparent.
+ ^ self].
+
+ super updateFillStylePressing: isPressing hovering: isHovering.!