Button.st
changeset 3925 cd7aa2f275ac
parent 3839 5cbf92d3aa64
child 3926 b7cacdc31dc2
--- a/Button.st	Fri Sep 18 10:31:46 2009 +0200
+++ b/Button.st	Fri Sep 18 10:31:49 2009 +0200
@@ -127,6 +127,20 @@
       If you want this behavior, you must set labelMsg and aspectMsg
       as appropriate.
 
+    labels
+      Originally, labels only had a label- and disabledLabel attributes (both
+      had to be explicitly set via setter methods).
+      Later the model- and labelChannel interfaces were added; model interface
+      for compatbility with other smalltalks, where a single multi-aspect model
+      might be used, the channels were added to support visualWorks style of multiple
+      single-aspect holders. This final version is also what the UIBuilder is working
+      against. The other mechanisms are still present, but disabled if a newer mechanism
+      is used (i.e. if a labelChannel has been given, the label and disabledLabel instvars
+      are ignored).
+      All of this is here to provide backward compatibility for existing customers
+      and st/x programs (which is a good thing to have, b.t.w).
+
+
     See examples.
 
 
@@ -148,8 +162,8 @@
                                               return key - if true, it will draw a return-bitmap 
                                               in addition to the logo (default: false)
 
-      defaultable	      <Boolean>	      true, if this button can become a returnButton.
-					      (computes its default extent differently)
+      defaultable             <Boolean>       true, if this button can become a returnButton.
+                                              (computes its default extent differently)
 
       shadowForm              <Form>          form to display in addition to buttons label (returnbutton only)
       lightForm               <Form>          light part of shadowForm (returnbutton only)
@@ -1286,11 +1300,15 @@
 disabledLogo:anImageOrString
     "define the logo to be displayed while disabled -
      this is optional; the default is to display the same
-     (logo) in both pressed and released states."
+     (logo) in both pressed and released states.
+     However, the disabled logo is ignored if a labelChannel has
+     been set - then that value has priority."
 
     disabledLogo := anImageOrString.
-    self enabled ifFalse:[
-        self label:anImageOrString
+    labelChannel isNil ifTrue:[
+        self enabled ifFalse:[
+            self label:anImageOrString
+        ]
     ]
 
     "Created: 17.9.1995 / 19:50:17 / claus"
@@ -1354,18 +1372,24 @@
 enteredLogo:anImageOrString
     "define the logo to be displayed while the mousePointer is in the button -
      this is optional; the default is to display the same
-     (logo) in both entered and normal states."
+     (logo) in both entered and normal states.
+     However, the entered logo is ignored if a labelChannel has
+     been set - then that value has priority."
 
     enteredLogo := anImageOrString.
-    controller entered ifTrue:[
-        self label:anImageOrString
+    labelChannel isNil ifTrue:[
+        controller entered ifTrue:[
+            self label:anImageOrString
+        ]
     ]
 !
 
 focusLogo:anImageOrString
     "define the logo to be displayed while active -
      this is optional; the default is to display the same
-     (logo) in both pressed and released states."
+     (logo) in both pressed and released states.
+     However, the focus logo is ignored if a labelChannel has
+     been set - then that value has priority."
 
     focusLogo := anImageOrString.
 
@@ -1478,11 +1502,15 @@
 passiveLogo:anImageOrString
     "define the logo to be displayed while inactive -
      this is optional; the default is to display the same
-     (logo) in both pressed and released states."
+     (logo) in both pressed and released states.
+     However, the inactive logo is ignored if a labelChannel has
+     been set - then that value has priority."
 
     passiveLogo := anImageOrString.
-    controller pressed ifFalse:[
-        self label:anImageOrString
+    labelChannel isNil ifTrue:[
+        controller pressed ifFalse:[
+            self label:anImageOrString
+        ]
     ]
 !
 
@@ -1931,6 +1959,11 @@
     "Modified: / 3.11.1997 / 09:15:52 / cg"
 !
 
+getLabelFromLabelChannel
+    passiveLogo := labelChannel value.
+    super getLabelFromLabelChannel.
+!
+
 shiftLabelWhenPressed
     ^ self class == Button
 ! !
@@ -2324,5 +2357,5 @@
 !Button class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.142 2009-02-23 14:57:38 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.143 2009-09-18 08:31:49 cg Exp $'
 ! !