ViewWithAcceptAndCancelBar.st
changeset 8332 fd3728983e3c
parent 8240 907893416fca
child 8336 e37d5992d9e4
equal deleted inserted replaced
8331:038e91a462ad 8332:fd3728983e3c
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libtool' }"
    12 "{ Package: 'stx:libtool' }"
    13 
    13 
    14 SimpleView subclass:#ViewWithAcceptAndCancelBar
    14 SimpleView subclass:#ViewWithAcceptAndCancelBar
    15 	instanceVariableNames:'slaveView bar reallyModifiedHolder acceptAction cancelAction'
    15 	instanceVariableNames:'slaveView bar reallyModifiedHolder acceptAction cancelAction
       
    16 		compareAction'
    16 	classVariableNames:''
    17 	classVariableNames:''
    17 	poolDictionaries:''
    18 	poolDictionaries:''
    18 	category:'Views-Basic'
    19 	category:'Views-Basic'
    19 !
    20 !
    20 
    21 
    21 SimpleView subclass:#AcceptAndCancelBar
    22 SimpleView subclass:#AcceptAndCancelBar
    22 	instanceVariableNames:'acceptButton cancelButton'
    23 	instanceVariableNames:'acceptButton cancelButton compareButton'
    23 	classVariableNames:''
    24 	classVariableNames:''
    24 	poolDictionaries:''
    25 	poolDictionaries:''
    25 	privateIn:ViewWithAcceptAndCancelBar
    26 	privateIn:ViewWithAcceptAndCancelBar
    26 !
    27 !
    27 
    28 
    57 "
    58 "
    58 ! !
    59 ! !
    59 
    60 
    60 !ViewWithAcceptAndCancelBar methodsFor:'accessing'!
    61 !ViewWithAcceptAndCancelBar methodsFor:'accessing'!
    61 
    62 
    62 accept
       
    63     acceptAction value
       
    64 !
       
    65 
       
    66 acceptAction:something
    63 acceptAction:something
    67     acceptAction := something.
    64     acceptAction := something.
    68 !
    65 !
    69 
    66 
    70 cancel
       
    71     cancelAction value
       
    72 !
       
    73 
       
    74 cancelAction:something
    67 cancelAction:something
    75     cancelAction := something.
    68     cancelAction := something.
       
    69 !
       
    70 
       
    71 compareAction:something
       
    72     compareAction := something.
    76 !
    73 !
    77 
    74 
    78 reallyModifiedHolder:aValueHolder
    75 reallyModifiedHolder:aValueHolder
    79     reallyModifiedHolder := aValueHolder.
    76     reallyModifiedHolder := aValueHolder.
    80     reallyModifiedHolder addDependent:self.
    77     reallyModifiedHolder addDependent:self.
       
    78 ! !
       
    79 
       
    80 !ViewWithAcceptAndCancelBar methodsFor:'action'!
       
    81 
       
    82 accept
       
    83     acceptAction value
       
    84 !
       
    85 
       
    86 cancel
       
    87     cancelAction notNil ifTrue:[
       
    88         cancelAction value
       
    89     ]
       
    90 !
       
    91 
       
    92 compare
       
    93     compareAction notNil ifTrue:[
       
    94         compareAction value
       
    95     ]
    81 ! !
    96 ! !
    82 
    97 
    83 !ViewWithAcceptAndCancelBar methodsFor:'change & update'!
    98 !ViewWithAcceptAndCancelBar methodsFor:'change & update'!
    84 
    99 
    85 hideBar
   100 hideBar
   144     bar origin:(0.0 @ 0.0) corner:(20 @ 1.0).
   159     bar origin:(0.0 @ 0.0) corner:(20 @ 1.0).
   145     bar hiddenOnRealize:true.
   160     bar hiddenOnRealize:true.
   146 
   161 
   147     bar acceptButton action:[ self accept ].
   162     bar acceptButton action:[ self accept ].
   148     bar cancelButton action:[ self cancel ].
   163     bar cancelButton action:[ self cancel ].
       
   164     bar compareButton action:[ self compare ].
   149 
   165 
   150     acceptAction := [ slaveView notNil ifTrue:[ slaveView accept ] ].
   166     acceptAction := [ slaveView notNil ifTrue:[ slaveView accept ] ].
   151     cancelAction := [  ].
   167     cancelAction := [  ].
   152 
   168 
   153     "
   169     "
   176     ^ acceptButton
   192     ^ acceptButton
   177 !
   193 !
   178 
   194 
   179 cancelButton
   195 cancelButton
   180     ^ cancelButton
   196     ^ cancelButton
       
   197 !
       
   198 
       
   199 compareButton
       
   200     ^ compareButton
   181 ! !
   201 ! !
   182 
   202 
   183 !ViewWithAcceptAndCancelBar::AcceptAndCancelBar methodsFor:'help'!
   203 !ViewWithAcceptAndCancelBar::AcceptAndCancelBar methodsFor:'help'!
   184 
   204 
   185 flyByHelpTextAt:srcPoint
   205 flyByHelpTextAt:srcPoint
   186     "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)."
   206     "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)."
   187 
   207 
   188     (acceptButton bounds containsPoint:srcPoint) ifTrue:[
   208     (acceptButton bounds containsPoint:srcPoint) ifTrue:[
   189         ^ 'Accept'
   209         ^ 'Accept'
   190     ].
   210     ].
   191     (acceptButton bounds containsPoint:srcPoint) ifTrue:[
   211     (cancelButton bounds containsPoint:srcPoint) ifTrue:[
   192         ^ 'Cancel'
   212         ^ 'Cancel'
       
   213     ].
       
   214     (compareButton bounds containsPoint:srcPoint) ifTrue:[
       
   215         ^ 'Compare against Original'
   193     ].
   216     ].
   194     ^ nil
   217     ^ nil
   195 ! !
   218 ! !
   196 
   219 
   197 !ViewWithAcceptAndCancelBar::AcceptAndCancelBar methodsFor:'initialization'!
   220 !ViewWithAcceptAndCancelBar::AcceptAndCancelBar methodsFor:'initialization'!
   204     acceptButton backgroundColor:Color green.
   227     acceptButton backgroundColor:Color green.
   205     acceptButton flyByHelpText:'Accept'.
   228     acceptButton flyByHelpText:'Accept'.
   206     self add:acceptButton.
   229     self add:acceptButton.
   207 
   230 
   208     cancelButton := ButtonWithHelpText new.
   231     cancelButton := ButtonWithHelpText new.
   209     cancelButton origin:0.0 @ 0.80 corner:1.0@1.0.
   232     cancelButton origin:0.0 @ 0.80 corner:1.0@0.9.
   210     cancelButton backgroundColor:Color red.
   233     cancelButton backgroundColor:Color red.
   211     cancelButton flyByHelpText:'Cancel'.
   234     cancelButton flyByHelpText:'Cancel'.
   212     self add:cancelButton.
   235     self add:cancelButton.
   213 
   236 
       
   237     compareButton := ButtonWithHelpText new.
       
   238     compareButton origin:0.0 @ 0.90 corner:1.0@1.0.
       
   239     compareButton backgroundColor:Color yellow.
       
   240     compareButton flyByHelpText:'Compare against Original'.
       
   241     compareButton label:'?'.
       
   242     self add:compareButton.
       
   243 
   214     "
   244     "
   215      AcceptAndCancelBar new open
   245      AcceptAndCancelBar new open
   216     "
   246     "
   217 ! !
   247 ! !
   218 
   248 
   227 ! !
   257 ! !
   228 
   258 
   229 !ViewWithAcceptAndCancelBar class methodsFor:'documentation'!
   259 !ViewWithAcceptAndCancelBar class methodsFor:'documentation'!
   230 
   260 
   231 version
   261 version
   232     ^ '$Header: /cvs/stx/stx/libtool/ViewWithAcceptAndCancelBar.st,v 1.5 2008-08-20 20:39:05 cg Exp $'
   262     ^ '$Header: /cvs/stx/stx/libtool/ViewWithAcceptAndCancelBar.st,v 1.6 2008-10-16 08:31:02 cg Exp $'
   233 ! !
   263 ! !