--- a/CheckBox.st Mon Mar 09 17:13:28 1998 +0100
+++ b/CheckBox.st Mon Mar 09 22:21:33 1998 +0100
@@ -13,7 +13,7 @@
HorizontalPanelView subclass:#CheckBox
instanceVariableNames:'toggleView labelView labelForegroundColor
- disabledLabelForegroundColor'
+ disabledLabelForegroundColor foregroundChannel backgroundChannel'
classVariableNames:'DefaultLabelForegroundColor DefaultDisabledLabelForegroundColor
CheckToggleLeft'
poolDictionaries:''
@@ -298,22 +298,6 @@
"Modified: 20.10.1997 / 13:51:30 / cg"
! !
-!CheckBox methodsFor:'accessing - components'!
-
-labelView
- "return the labelView; allows manipulation of the
- labels attributes (colors etc.)"
-
- ^ labelView
-!
-
-toggleView
- "return the toggleView; allows manipulation of the
- toggles attributes (colors etc.)"
-
- ^ toggleView
-! !
-
!CheckBox methodsFor:'accessing-behavior'!
action:aBlock
@@ -330,6 +314,7 @@
|clr|
toggleView disable.
+
clr := disabledLabelForegroundColor.
clr isNil ifTrue:[ clr := toggleView disabledForegroundColor ].
labelView foregroundColor:clr.
@@ -343,9 +328,10 @@
|clr|
toggleView enable.
+
clr := labelForegroundColor.
- clr isNil ifTrue:[ clr := toggleView foregroundColor ].
- labelView foregroundColor:clr.
+ clr isNil ifTrue:[ clr := labelView foregroundColor ].
+ labelView foregroundColor:clr.
"Modified: 25.4.1996 / 16:31:40 / cg"
!
@@ -377,6 +363,17 @@
!CheckBox methodsFor:'accessing-channels'!
+backgroundChannel
+
+ ^labelView backgroundChannel
+!
+
+backgroundChannel:aChannel
+
+ labelView backgroundChannel: (backgroundChannel := aChannel).
+ aChannel onChangeSend:#value to: [self enableStateChanged]
+!
+
enableChannel
"return a valueHolder for enable/disable"
@@ -392,13 +389,65 @@
wasEnabled := toggleView enabled.
toggleView enableChannel:aChannel.
- aChannel onChangeSend:#enableStateChanged to:self.
+ aChannel onChangeSend:#value to: [self enableStateChanged].
+
aChannel value ~~ wasEnabled ifTrue:[
- self enableStateChanged
+ self enableStateChanged
]
+!
- "Created: 17.12.1995 / 16:07:59 / cg"
- "Modified: 25.4.1996 / 16:32:34 / cg"
+foregroundChannel
+
+ ^labelView foregroundChannel
+!
+
+foregroundChannel:aChannel
+
+ labelView foregroundChannel: (foregroundChannel := aChannel).
+ aChannel onChangeSend:#value to: [self enableStateChanged]
+
+!
+
+labelChannel
+
+ ^labelView labelChannel
+!
+
+labelChannel:aChannel
+
+ labelView labelChannel: aChannel
+
+! !
+
+!CheckBox methodsFor:'accessing-colors'!
+
+backgroundColor: backgroundColor
+ "set backgroundColor only for the label"
+
+ labelView backgroundColor: backgroundColor
+!
+
+foregroundColor: foregroundColor
+ "set foregroundColor only for the label"
+
+ labelView foregroundColor: (labelForegroundColor := foregroundColor).
+ foregroundChannel notNil ifTrue: [foregroundChannel value: foregroundColor]
+! !
+
+!CheckBox methodsFor:'accessing-components'!
+
+labelView
+ "return the labelView; allows manipulation of the
+ labels attributes (colors etc.)"
+
+ ^ labelView
+!
+
+toggleView
+ "return the toggleView; allows manipulation of the
+ toggles attributes (colors etc.)"
+
+ ^ toggleView
! !
!CheckBox methodsFor:'accessing-look'!
@@ -467,7 +516,7 @@
labelForegroundColor
"return the labels foregroundColor"
- labelForegroundColor isNil ifTrue:[ ^ toggleView foregroundColor ].
+ labelForegroundColor isNil ifTrue:[ ^ labelView foregroundColor ].
^ labelForegroundColor
"Created: 16.12.1995 / 19:47:20 / cg"
@@ -484,7 +533,7 @@
!
viewBackground:aColor
- super viewBackground:aColor.
+ "super viewBackground:aColor."
labelView viewBackground:aColor
"Created: / 26.10.1997 / 22:15:10 / cg"
@@ -552,14 +601,24 @@
|clr|
+ self enabled
+ ifTrue:
+ [
+ labelView foregroundChannel: foregroundChannel.
+ labelForegroundColor := labelView foregroundColor
+ ]
+ ifFalse:
+ [
+ labelView foregroundChannel: nil
+ ].
+
toggleView enabled ifTrue:[
- clr := self labelForegroundColor
+ clr := self labelForegroundColor.
] ifFalse:[
clr := self disabledLabelForegroundColor
- ].
- labelView foregroundColor:clr
+ ].
+ labelView foregroundColor:clr.
- "Modified: 3.3.1997 / 11:02:33 / cg"
! !
!CheckBox methodsFor:'event handling'!
@@ -621,6 +680,7 @@
"Created: 14.12.1995 / 14:50:03 / cg"
"Modified: 22.1.1997 / 11:57:03 / cg"
+
!
initialize
@@ -735,5 +795,5 @@
!CheckBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/CheckBox.st,v 1.50 1998-02-13 13:54:42 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/CheckBox.st,v 1.51 1998-03-09 21:21:33 tz Exp $'
! !