ViewWithAcceptAndCancelBar.st
changeset 6775 08d41de35293
parent 6772 07a067c578d5
child 7309 691b97b5b79e
--- a/ViewWithAcceptAndCancelBar.st	Mon Apr 24 13:43:54 2006 +0200
+++ b/ViewWithAcceptAndCancelBar.st	Mon Apr 24 13:44:46 2006 +0200
@@ -26,6 +26,13 @@
 	privateIn:ViewWithAcceptAndCancelBar
 !
 
+Button subclass:#ButtonWithHelpText
+	instanceVariableNames:'helpText'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:ViewWithAcceptAndCancelBar::AcceptAndCancelBar
+!
+
 !ViewWithAcceptAndCancelBar class methodsFor:'documentation'!
 
 copyright
@@ -79,11 +86,11 @@
 hideBar
     bar unmap.
     bar hiddenOnRealize:true.
-    slaveView origin:(0.0 @ 0.0).
+    slaveView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
 !
 
 showBar
-    slaveView origin:(20 @ 0.0).
+    slaveView origin:(20 @ 0.0) corner:(1.0 @ 1.0).
     bar hiddenOnRealize:false.
     bar realize.
 !
@@ -162,6 +169,18 @@
 
 cancelButton
     ^ cancelButton
+!
+
+flyByHelpTextAt:srcPoint
+    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)."
+
+    (acceptButton bounds containsPoint:srcPoint) ifTrue:[
+        ^ 'Accept'
+    ].
+    (acceptButton bounds containsPoint:srcPoint) ifTrue:[
+        ^ 'Cancel'
+    ].
+    ^ nil
 ! !
 
 !ViewWithAcceptAndCancelBar::AcceptAndCancelBar methodsFor:'initialization'!
@@ -169,14 +188,16 @@
 initialize
     super initialize.
 
-    acceptButton := Button new.
-    acceptButton origin:0.0 @ 0.0 corner:1.0@0.75.
+    acceptButton := ButtonWithHelpText new.
+    acceptButton origin:0.0 @ 0.0 corner:1.0@0.80.
     acceptButton backgroundColor:Color green.
+    acceptButton flyByHelpText:'Accept'.
     self add:acceptButton.
 
-    cancelButton := Button new.
-    cancelButton origin:0.0 @ 0.75 corner:1.0@1.0.
+    cancelButton := ButtonWithHelpText new.
+    cancelButton origin:0.0 @ 0.80 corner:1.0@1.0.
     cancelButton backgroundColor:Color red.
+    cancelButton flyByHelpText:'Cancel'.
     self add:cancelButton.
 
     "
@@ -184,8 +205,18 @@
     "
 ! !
 
+!ViewWithAcceptAndCancelBar::AcceptAndCancelBar::ButtonWithHelpText methodsFor:'accessing'!
+
+flyByHelpText
+    ^ helpText
+!
+
+flyByHelpText:something
+    helpText := something.
+! !
+
 !ViewWithAcceptAndCancelBar class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/ViewWithAcceptAndCancelBar.st,v 1.1 2006-04-21 15:38:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/ViewWithAcceptAndCancelBar.st,v 1.2 2006-04-24 11:44:46 cg Exp $'
 ! !