6772
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
"{ Package: 'stx:libtool' }"
|
|
14 |
|
|
15 |
SimpleView subclass:#ViewWithAcceptAndCancelBar
|
|
16 |
instanceVariableNames:'slaveView bar reallyModifiedHolder acceptAction cancelAction'
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Views-Basic'
|
|
20 |
!
|
|
21 |
|
|
22 |
SimpleView subclass:#AcceptAndCancelBar
|
|
23 |
instanceVariableNames:'acceptButton cancelButton'
|
|
24 |
classVariableNames:''
|
|
25 |
poolDictionaries:''
|
|
26 |
privateIn:ViewWithAcceptAndCancelBar
|
|
27 |
!
|
|
28 |
|
6775
|
29 |
Button subclass:#ButtonWithHelpText
|
|
30 |
instanceVariableNames:'helpText'
|
|
31 |
classVariableNames:''
|
|
32 |
poolDictionaries:''
|
|
33 |
privateIn:ViewWithAcceptAndCancelBar::AcceptAndCancelBar
|
|
34 |
!
|
|
35 |
|
6772
|
36 |
!ViewWithAcceptAndCancelBar class methodsFor:'documentation'!
|
|
37 |
|
|
38 |
copyright
|
|
39 |
"
|
|
40 |
COPYRIGHT (c) 2006 by eXept Software AG
|
|
41 |
All Rights Reserved
|
|
42 |
|
|
43 |
This software is furnished under a license and may be used
|
|
44 |
only in accordance with the terms of that license and with the
|
|
45 |
inclusion of the above copyright notice. This software may not
|
|
46 |
be provided or otherwise made available to, or used by, any
|
|
47 |
other person. No title to or ownership of the software is
|
|
48 |
hereby transferred.
|
|
49 |
"
|
|
50 |
!
|
|
51 |
|
|
52 |
documentation
|
|
53 |
"
|
|
54 |
experimental - self like accept/cancel bar in the browsers
|
|
55 |
code view.
|
|
56 |
Enable with:
|
|
57 |
UserPreferences current showAcceptCancelBarInBrowser:true
|
|
58 |
"
|
|
59 |
! !
|
|
60 |
|
|
61 |
!ViewWithAcceptAndCancelBar methodsFor:'accessing'!
|
|
62 |
|
|
63 |
accept
|
|
64 |
acceptAction value
|
|
65 |
!
|
|
66 |
|
|
67 |
acceptAction:something
|
|
68 |
acceptAction := something.
|
|
69 |
!
|
|
70 |
|
|
71 |
cancel
|
|
72 |
cancelAction value
|
|
73 |
!
|
|
74 |
|
|
75 |
cancelAction:something
|
|
76 |
cancelAction := something.
|
|
77 |
!
|
|
78 |
|
|
79 |
reallyModifiedHolder:aValueHolder
|
|
80 |
reallyModifiedHolder := aValueHolder.
|
|
81 |
reallyModifiedHolder addDependent:self.
|
|
82 |
! !
|
|
83 |
|
|
84 |
!ViewWithAcceptAndCancelBar methodsFor:'change & update'!
|
|
85 |
|
|
86 |
hideBar
|
|
87 |
bar unmap.
|
|
88 |
bar hiddenOnRealize:true.
|
6775
|
89 |
slaveView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
|
6772
|
90 |
!
|
|
91 |
|
|
92 |
showBar
|
6775
|
93 |
slaveView origin:(20 @ 0.0) corner:(1.0 @ 1.0).
|
6772
|
94 |
bar hiddenOnRealize:false.
|
|
95 |
bar realize.
|
|
96 |
!
|
|
97 |
|
|
98 |
update:something with:aParameter from:changedObject
|
|
99 |
slaveView notNil ifTrue:[
|
|
100 |
changedObject == reallyModifiedHolder ifTrue:[
|
|
101 |
self application
|
|
102 |
enqueueMessage:#updateBarVisibility
|
|
103 |
for:self arguments:#().
|
|
104 |
].
|
|
105 |
|
|
106 |
changedObject == slaveView modifiedChannel ifTrue:[
|
|
107 |
self application
|
|
108 |
enqueueMessage:#updateBarVisibility
|
|
109 |
for:self arguments:#().
|
|
110 |
].
|
|
111 |
].
|
|
112 |
super update:something with:aParameter from:changedObject
|
|
113 |
!
|
|
114 |
|
|
115 |
updateBarVisibility
|
|
116 |
|modified|
|
|
117 |
|
|
118 |
modified := reallyModifiedHolder notNil
|
|
119 |
ifTrue:[ reallyModifiedHolder value ]
|
|
120 |
ifFalse:[ slaveView modifiedChannel value ].
|
|
121 |
|
|
122 |
modified ifTrue:[
|
|
123 |
self showBar
|
|
124 |
] ifFalse:[
|
|
125 |
self hideBar
|
|
126 |
].
|
|
127 |
! !
|
|
128 |
|
|
129 |
!ViewWithAcceptAndCancelBar methodsFor:'initialization'!
|
|
130 |
|
|
131 |
initialize
|
|
132 |
super initialize.
|
|
133 |
|
|
134 |
bar := AcceptAndCancelBar in:self.
|
|
135 |
bar origin:(0.0 @ 0.0) corner:(20 @ 1.0).
|
|
136 |
bar hiddenOnRealize:true.
|
|
137 |
|
|
138 |
bar acceptButton action:[ self accept ].
|
|
139 |
bar cancelButton action:[ self cancel ].
|
|
140 |
|
|
141 |
acceptAction := [ slaveView notNil ifTrue:[ slaveView accept ] ].
|
|
142 |
cancelAction := [ ].
|
|
143 |
|
|
144 |
"
|
|
145 |
self new open
|
|
146 |
"
|
|
147 |
!
|
|
148 |
|
|
149 |
slaveView:aView
|
|
150 |
self add:aView.
|
|
151 |
slaveView := aView.
|
|
152 |
aView origin:(0.0@0.0) corner:(1.0@1.0).
|
|
153 |
aView modifiedChannel addDependent:self.
|
|
154 |
|
|
155 |
"
|
|
156 |
|v|
|
|
157 |
|
|
158 |
v := self new.
|
|
159 |
v slaveView:CodeView new.
|
|
160 |
v open
|
|
161 |
"
|
|
162 |
! !
|
|
163 |
|
|
164 |
!ViewWithAcceptAndCancelBar::AcceptAndCancelBar methodsFor:'accessing'!
|
|
165 |
|
|
166 |
acceptButton
|
|
167 |
^ acceptButton
|
|
168 |
!
|
|
169 |
|
|
170 |
cancelButton
|
|
171 |
^ cancelButton
|
6775
|
172 |
!
|
|
173 |
|
|
174 |
flyByHelpTextAt:srcPoint
|
|
175 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)."
|
|
176 |
|
|
177 |
(acceptButton bounds containsPoint:srcPoint) ifTrue:[
|
|
178 |
^ 'Accept'
|
|
179 |
].
|
|
180 |
(acceptButton bounds containsPoint:srcPoint) ifTrue:[
|
|
181 |
^ 'Cancel'
|
|
182 |
].
|
|
183 |
^ nil
|
6772
|
184 |
! !
|
|
185 |
|
|
186 |
!ViewWithAcceptAndCancelBar::AcceptAndCancelBar methodsFor:'initialization'!
|
|
187 |
|
|
188 |
initialize
|
|
189 |
super initialize.
|
|
190 |
|
6775
|
191 |
acceptButton := ButtonWithHelpText new.
|
|
192 |
acceptButton origin:0.0 @ 0.0 corner:1.0@0.80.
|
6772
|
193 |
acceptButton backgroundColor:Color green.
|
6775
|
194 |
acceptButton flyByHelpText:'Accept'.
|
6772
|
195 |
self add:acceptButton.
|
|
196 |
|
6775
|
197 |
cancelButton := ButtonWithHelpText new.
|
|
198 |
cancelButton origin:0.0 @ 0.80 corner:1.0@1.0.
|
6772
|
199 |
cancelButton backgroundColor:Color red.
|
6775
|
200 |
cancelButton flyByHelpText:'Cancel'.
|
6772
|
201 |
self add:cancelButton.
|
|
202 |
|
|
203 |
"
|
|
204 |
AcceptAndCancelBar new open
|
|
205 |
"
|
|
206 |
! !
|
|
207 |
|
6775
|
208 |
!ViewWithAcceptAndCancelBar::AcceptAndCancelBar::ButtonWithHelpText methodsFor:'accessing'!
|
|
209 |
|
|
210 |
flyByHelpText
|
|
211 |
^ helpText
|
|
212 |
!
|
|
213 |
|
|
214 |
flyByHelpText:something
|
|
215 |
helpText := something.
|
|
216 |
! !
|
|
217 |
|
6772
|
218 |
!ViewWithAcceptAndCancelBar class methodsFor:'documentation'!
|
|
219 |
|
|
220 |
version
|
6775
|
221 |
^ '$Header: /cvs/stx/stx/libtool/ViewWithAcceptAndCancelBar.st,v 1.2 2006-04-24 11:44:46 cg Exp $'
|
6772
|
222 |
! !
|