--- a/ButtonController.st Thu Feb 16 17:31:54 1995 +0100
+++ b/ButtonController.st Fri Feb 17 14:23:13 1995 +0100
@@ -37,7 +37,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.2 1995-02-16 16:31:37 claus Exp $
+$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.3 1995-02-17 13:22:26 claus Exp $
"
!
@@ -62,166 +62,6 @@
repeatBlock <Block> block evaluated for auto-repeat (internal)
active <Boolean> true during action evaluation (internal)
"
-!
-
-examples
-"
- Although you can specify a lot in a button,
- use the default in most applications.
- As you specify more things in your program,
- the styleSheet settings are more and more ignored.
- Also, even though it might look fancy, colorful
- button panels are usually not a good GUI design;
- they will attract the users attention - possibly to things
- which are not worth it.
-
- default settings:
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button label:'hello' in:top.
- b action:[Transcript flash].
- top open.
-
-
- changing colors:
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button label:'hello' in:top.
- b action:[Transcript flash].
- b activeForegroundColor:(Color white).
- b activeBackgroundColor:(Color red).
- top open.
-
-
- changing more colors:
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button label:'hello' in:top.
- b action:[Transcript flash].
- b enteredForegroundColor:(Color red).
- b enteredBackgroundColor:(b backgroundColor).
- b activeForegroundColor:(Color white).
- b activeBackgroundColor:(Color red).
- top open.
-
-
- button with an image:
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button in:top.
- b form:(Image fromFile:'bitmaps/SBrowser.xbm').
- b action:[Transcript flash].
- b enteredForegroundColor:(Color green darkened).
- b enteredBackgroundColor:(b backgroundColor).
- b activeForegroundColor:(Color white).
- b activeBackgroundColor:(Color red).
- top open.
-
-
- changing the image:
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button in:top.
- b passiveLogo:(Image fromFile:'bitmaps/SBrowser.xbm').
- b activeLogo:(Image fromFile:'bitmaps/CBrowser.xbm').
- b action:[Transcript flash].
- b enteredForegroundColor:(Color red).
- b enteredBackgroundColor:(b backgroundColor).
- b activeForegroundColor:(Color white).
- b activeBackgroundColor:(Color red).
- top open.
-
-
- well, even that is possible (but you should never do it):
- (notice the changing size and the resulting problem when
- pressed near the bottom)
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button in:top.
- b passiveLogo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
- b activeLogo:#('start') asStringCollection.
- b action:[Transcript flash].
- b enteredForegroundColor:(Color red).
- b enteredBackgroundColor:(b backgroundColor).
- b activeForegroundColor:(Color white).
- b activeBackgroundColor:(Color red).
- top open.
-
-
- same as above, with frozen size
- (make certain, that the size is ok for all possible logos):
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button in:top.
- b passiveLogo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
- b activeLogo:#('go') asStringCollection.
- b action:[Transcript flash].
- b enteredForegroundColor:(Color red).
- b enteredBackgroundColor:(b backgroundColor).
- b activeForegroundColor:(Color white).
- b activeBackgroundColor:(Color red).
- b sizeFixed:true.
- top open.
-
-
- more playing with colors:
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button in:top.
- b passiveLogo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
- b action:[Transcript flash].
- b foregroundColor:(Color red:0 green:80 blue:20) darkened.
- b backgroundColor:(Color grey:10).
- b enteredBackgroundColor:(Color grey:20).
- b activeForegroundColor:(Color red).
- b activeBackgroundColor:(Color grey:20).
- top open.
-
-
- fire on press (buttons in scrollbars do this):
-
- |top b|
-
- top := StandardSystemView new.
- top extent:100@100.
-
- b := Button label:'hello' in:top.
- b controller beTriggerOnDown.
- b action:[Transcript flash].
- top open.
-"
! !
!ButtonController class methodsFor:'defaults'!
@@ -231,7 +71,6 @@
repeat every repeatDelay seconds"
^ 0.025
-
!
defaultInitialDelay
@@ -239,8 +78,6 @@
start repeating after initialDelay seconds"
^ 0.2
-
-
! !
!ButtonController methodsFor:'initialization'!
@@ -281,6 +118,9 @@
!
isTriggerOnDown
+ "return true, if I trigger on press
+ (in contrast to triggering on up, which is the default)"
+
^ triggerOnDown
!
@@ -350,18 +190,27 @@
!
enabled
+ "return true, if I am enabled"
+
^ enabled
!
active
+ "return true, if I am active; that is currently performing my
+ action."
+
^ active
!
pressed
+ "return true, if I am pressed"
+
^ pressed
!
entered
+ "return true, if the mouse pointer is currently in my view"
+
^ entered
!
@@ -465,8 +314,6 @@
].
active := false.
-
- view redraw.
]
]
]