diff -r 038e91a462ad -r fd3728983e3c ViewWithAcceptAndCancelBar.st --- a/ViewWithAcceptAndCancelBar.st Wed Oct 15 17:53:53 2008 +0200 +++ b/ViewWithAcceptAndCancelBar.st Thu Oct 16 10:31:02 2008 +0200 @@ -12,14 +12,15 @@ "{ Package: 'stx:libtool' }" SimpleView subclass:#ViewWithAcceptAndCancelBar - instanceVariableNames:'slaveView bar reallyModifiedHolder acceptAction cancelAction' + instanceVariableNames:'slaveView bar reallyModifiedHolder acceptAction cancelAction + compareAction' classVariableNames:'' poolDictionaries:'' category:'Views-Basic' ! SimpleView subclass:#AcceptAndCancelBar - instanceVariableNames:'acceptButton cancelButton' + instanceVariableNames:'acceptButton cancelButton compareButton' classVariableNames:'' poolDictionaries:'' privateIn:ViewWithAcceptAndCancelBar @@ -59,27 +60,41 @@ !ViewWithAcceptAndCancelBar methodsFor:'accessing'! -accept - acceptAction value -! - acceptAction:something acceptAction := something. ! -cancel - cancelAction value -! - cancelAction:something cancelAction := something. ! +compareAction:something + compareAction := something. +! + reallyModifiedHolder:aValueHolder reallyModifiedHolder := aValueHolder. reallyModifiedHolder addDependent:self. ! ! +!ViewWithAcceptAndCancelBar methodsFor:'action'! + +accept + acceptAction value +! + +cancel + cancelAction notNil ifTrue:[ + cancelAction value + ] +! + +compare + compareAction notNil ifTrue:[ + compareAction value + ] +! ! + !ViewWithAcceptAndCancelBar methodsFor:'change & update'! hideBar @@ -146,6 +161,7 @@ bar acceptButton action:[ self accept ]. bar cancelButton action:[ self cancel ]. + bar compareButton action:[ self compare ]. acceptAction := [ slaveView notNil ifTrue:[ slaveView accept ] ]. cancelAction := [ ]. @@ -178,6 +194,10 @@ cancelButton ^ cancelButton +! + +compareButton + ^ compareButton ! ! !ViewWithAcceptAndCancelBar::AcceptAndCancelBar methodsFor:'help'! @@ -188,9 +208,12 @@ (acceptButton bounds containsPoint:srcPoint) ifTrue:[ ^ 'Accept' ]. - (acceptButton bounds containsPoint:srcPoint) ifTrue:[ + (cancelButton bounds containsPoint:srcPoint) ifTrue:[ ^ 'Cancel' ]. + (compareButton bounds containsPoint:srcPoint) ifTrue:[ + ^ 'Compare against Original' + ]. ^ nil ! ! @@ -206,11 +229,18 @@ self add:acceptButton. cancelButton := ButtonWithHelpText new. - cancelButton origin:0.0 @ 0.80 corner:1.0@1.0. + cancelButton origin:0.0 @ 0.80 corner:1.0@0.9. cancelButton backgroundColor:Color red. cancelButton flyByHelpText:'Cancel'. self add:cancelButton. + compareButton := ButtonWithHelpText new. + compareButton origin:0.0 @ 0.90 corner:1.0@1.0. + compareButton backgroundColor:Color yellow. + compareButton flyByHelpText:'Compare against Original'. + compareButton label:'?'. + self add:compareButton. + " AcceptAndCancelBar new open " @@ -229,5 +259,5 @@ !ViewWithAcceptAndCancelBar class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/ViewWithAcceptAndCancelBar.st,v 1.5 2008-08-20 20:39:05 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/ViewWithAcceptAndCancelBar.st,v 1.6 2008-10-16 08:31:02 cg Exp $' ! !