author | Claus Gittinger <cg@exept.de> |
Thu, 09 Aug 2018 17:35:43 +0200 | |
changeset 4163 | 54d6a48b4655 |
parent 4162 | 26578918c9cf |
child 4165 | 15cc5643f1b0 |
permissions | -rw-r--r-- |
4084 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1196 | 3 |
" |
4 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1369
281acc9f1a73
dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents:
1360
diff
changeset
|
14 |
"{ Package: 'stx:libview2' }" |
281acc9f1a73
dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents:
1360
diff
changeset
|
15 |
|
3843 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
451 | 18 |
Object subclass:#MenuItem |
4162 | 19 |
instanceVariableNames:'flags activeHelpKey enabled label itemValue nameKey startGroup |
20 |
isVisible indication submenu submenuChannel submenuProvider |
|
21 |
shortcutKey labelImage accessCharacterPosition argument choice |
|
22 |
choiceValue font auxValue uuid' |
|
4159 | 23 |
classVariableNames:'FLAG_FORCE_MENUINDICATOR FLAG_TRANSLATE_LABEL FLAG_ISBUTTON |
24 |
FLAG_HIDE_ONACTIVATED FLAG_TRIGGER_ONDOWN |
|
25 |
FLAG_SHOW_BUSYCURSOR_WHILE_PERFORMING FLAG_KEEP_LINKEDMENU |
|
26 |
FLAG_SEND_TO_ORIGINATOR FLAG_IGNORE_MNEMONIC_KEYS |
|
27 |
FLAG_IGNORE_SHORTCUTS FLAG_IS_MENUSLICE FLAG_HORIZONTAL_LAYOUT' |
|
451 | 28 |
poolDictionaries:'' |
29 |
category:'Views-Support' |
|
30 |
! |
|
31 |
||
32 |
!MenuItem class methodsFor:'documentation'! |
|
33 |
||
1196 | 34 |
copyright |
35 |
" |
|
36 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
37 |
All Rights Reserved |
|
38 |
||
39 |
This software is furnished under a license and may be used |
|
40 |
only in accordance with the terms of that license and with the |
|
41 |
inclusion of the above copyright notice. This software may not |
|
42 |
be provided or otherwise made available to, or used by, any |
|
43 |
other person. No title to or ownership of the software is |
|
44 |
hereby transferred. |
|
45 |
" |
|
46 |
||
47 |
! |
|
48 |
||
451 | 49 |
documentation |
50 |
" |
|
4034 | 51 |
This together with MenuPanel will eventually replace |
451 | 52 |
most of the MenuView and PopUpMenu stuff. |
53 |
(and hopefully be ST-80 compatible ...) |
|
54 |
||
55 |
For now, only a subset of the full protocol is implemented. |
|
56 |
||
4034 | 57 |
new: |
58 |
%(xx) in label text will be expanded by asking the application |
|
59 |
for the xx labelFor:-aspect. |
|
60 |
||
451 | 61 |
[author:] |
62 |
Claus Gittinger |
|
63 |
||
4056 | 64 |
[instance variables:] |
65 |
label: MUST be a CharacterArray. |
|
66 |
||
451 | 67 |
[see also:] |
68 |
MenuItem |
|
69 |
PopUpMenu |
|
70 |
" |
|
71 |
! ! |
|
72 |
||
490 | 73 |
!MenuItem class methodsFor:'instance creation'! |
74 |
||
1044 | 75 |
label:aString |
76 |
"create and return a new menuItem, given a label string" |
|
77 |
||
4056 | 78 |
^ self new |
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
79 |
label:aString; |
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
80 |
yourself |
1044 | 81 |
|
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
82 |
"Created: / 14-08-1998 / 19:19:14 / cg" |
1044 | 83 |
! |
84 |
||
2813 | 85 |
label:labelString choice:choiceAspect choiceValue:selectorOrValue |
86 |
"create and return a new menuItem, given its label and choice/value. |
|
87 |
This will create a Radio-Button-like item." |
|
88 |
||
4056 | 89 |
^ (self new) |
90 |
label:labelString; choice:choiceAspect; choiceValue:selectorOrValue; |
|
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
91 |
yourself |
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
92 |
|
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
93 |
"Modified (format): / 26-04-2012 / 12:06:41 / cg" |
2813 | 94 |
! |
95 |
||
3023 | 96 |
label:labelString itemValue:selectorOrValue |
97 |
"create and return a new menuItem, given its label and value" |
|
98 |
||
4056 | 99 |
^ (self new) |
100 |
label:labelString itemValue:selectorOrValue; |
|
3023 | 101 |
yourself |
102 |
||
103 |
"Created: / 09-09-2012 / 13:21:48 / cg" |
|
104 |
! |
|
105 |
||
106 |
label:labelString itemValue:selectorOrValue argument:messageArg |
|
3353 | 107 |
"create and return a new menuItem, given its label and value |
108 |
and an argument to be passed with the action" |
|
1030
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
109 |
|
4056 | 110 |
^ (self new) |
111 |
label:labelString; |
|
3023 | 112 |
itemValue:selectorOrValue argument:messageArg; |
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
113 |
yourself |
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
114 |
|
3023 | 115 |
"Created: / 09-09-2012 / 13:22:31 / cg" |
116 |
! |
|
117 |
||
118 |
label:labelString itemValue:selectorOrValue enabled:enabledHolder |
|
3353 | 119 |
"create and return a new menuItem, given its label, value |
120 |
and enabled holder, which can be a boolean, a boolean valueHolder, |
|
121 |
a block or a selector (to be sent to the application)" |
|
3023 | 122 |
|
4056 | 123 |
^ (self new) |
3352 | 124 |
label:labelString itemValue:selectorOrValue enabled:enabledHolder |
3023 | 125 |
|
126 |
"Created: / 09-09-2012 / 13:23:05 / cg" |
|
127 |
! |
|
128 |
||
3352 | 129 |
label:labelString itemValue:selectorOrValue translateLabel:translateLabel |
130 |
"create and return a new menuItem, given its label, value and translateLabel flag" |
|
131 |
||
4056 | 132 |
^ (self new) |
133 |
label:labelString |
|
134 |
itemValue:selectorOrValue |
|
3352 | 135 |
translateLabel:translateLabel |
136 |
! |
|
137 |
||
3221 | 138 |
label:labelString submenuChannel:aSymbolOrValueHolder |
139 |
"create and return a new menuItem, given its label and value" |
|
140 |
||
4056 | 141 |
^ (self new) |
142 |
label:labelString submenuChannel:aSymbolOrValueHolder; |
|
3221 | 143 |
yourself |
144 |
! |
|
145 |
||
3023 | 146 |
label:labelString value:selectorOrValue |
147 |
<resource: #obsolete> |
|
148 |
"create and return a new menuItem, given its label and value" |
|
149 |
||
150 |
^ self label:labelString itemValue:selectorOrValue |
|
151 |
||
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
152 |
"Created: / 04-08-1998 / 17:34:18 / cg" |
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
153 |
! |
1030
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
154 |
|
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
155 |
label:labelString value:selectorOrValue argument:messageArg |
3023 | 156 |
<resource: #obsolete> |
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
157 |
"create and return a new menuItem, given its label and value" |
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
158 |
|
4056 | 159 |
^ (self new) |
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
160 |
label:labelString; value:selectorOrValue; argument:messageArg; |
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
161 |
yourself |
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
162 |
|
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
163 |
"Created: / 26-04-2012 / 12:06:34 / cg" |
1030
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
164 |
! |
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
165 |
|
2876
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
166 |
label:labelString value:selectorOrValue enabled:enabledHolder |
3023 | 167 |
<resource: #obsolete> |
2876
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
168 |
"create and return a new menuItem, given its label and value" |
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
169 |
|
4056 | 170 |
^ (self new) |
171 |
label:labelString; value:selectorOrValue; |
|
2876
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
172 |
enabled:enabledHolder; |
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
173 |
yourself |
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
174 |
|
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
175 |
"Created: / 29-10-2010 / 12:21:27 / cg" |
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
176 |
! |
de49b76ae355
added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
177 |
|
490 | 178 |
labeled:aString |
3225 | 179 |
<resource: #obsolete> |
180 |
||
1030
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
181 |
"create and return a new menuItem, given a label string" |
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
182 |
|
3225 | 183 |
^ self label:aString |
1030
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
184 |
|
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
185 |
"Modified: / 26-04-2012 / 12:07:12 / cg" |
1486 | 186 |
! |
187 |
||
188 |
separator |
|
3964 | 189 |
"create and return a new menuItem for a '----' separator" |
190 |
||
191 |
^ self separator:'-' |
|
192 |
||
193 |
"Modified: / 19-07-2017 / 09:17:30 / cg" |
|
194 |
! |
|
195 |
||
196 |
separator2 |
|
197 |
"create and return a new menuItem for a '====' separator" |
|
198 |
||
199 |
^ self separator:'=' |
|
200 |
||
201 |
"Created: / 19-07-2017 / 09:16:54 / cg" |
|
202 |
! |
|
203 |
||
204 |
separator:sepString |
|
1486 | 205 |
"create and return a new menuItem for a separator" |
206 |
||
4056 | 207 |
^ self new |
3964 | 208 |
label:sepString; translateLabel:false; |
3003
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
209 |
yourself |
e2177537ecb8
added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents:
2987
diff
changeset
|
210 |
|
3964 | 211 |
"Created: / 19-07-2017 / 09:17:21 / cg" |
490 | 212 |
! ! |
213 |
||
4159 | 214 |
!MenuItem class methodsFor:'class initialization'! |
215 |
||
216 |
initialize |
|
217 |
FLAG_HORIZONTAL_LAYOUT := 16r0001. |
|
218 |
FLAG_TRANSLATE_LABEL := 16r0002. |
|
219 |
FLAG_ISBUTTON := 16r0004. |
|
220 |
FLAG_HIDE_ONACTIVATED := 16r0008. |
|
221 |
FLAG_TRIGGER_ONDOWN := 16r0010. |
|
222 |
FLAG_SHOW_BUSYCURSOR_WHILE_PERFORMING := 16r0020. |
|
223 |
FLAG_KEEP_LINKEDMENU := 16r0040. |
|
224 |
FLAG_SEND_TO_ORIGINATOR := 16r0080. |
|
225 |
FLAG_IGNORE_MNEMONIC_KEYS := 16r0100. |
|
226 |
FLAG_IGNORE_SHORTCUTS := 16r0200. |
|
227 |
FLAG_IS_MENUSLICE := 16r0400. |
|
228 |
FLAG_FORCE_MENUINDICATOR := 16r0800. |
|
229 |
||
230 |
"Created: / 09-08-2018 / 16:36:25 / Claus Gittinger" |
|
231 |
! ! |
|
232 |
||
2264
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
233 |
!MenuItem class methodsFor:'constants'! |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
234 |
|
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
235 |
supportedStartGroupValues |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
236 |
"start group #left #right #conditionalRight ... |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
237 |
At the moment only #left/nil, #right/#conditionalRight are implemented. |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
238 |
|
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
239 |
The meanings are: |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
240 |
nil - default under control of the menu |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
241 |
#left - left align |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
242 |
#right - place at the right far end |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
243 |
#conditionalRight - controlled by a styleSheet variable; |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
244 |
like #right under all non-win32 systems, |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
245 |
ignored on win32. |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
246 |
Use with help-menu, which should be at the far right on some |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
247 |
viewStyles, but not under win32." |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
248 |
|
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
249 |
^ #(nil #left #right #conditionalRight) |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
250 |
|
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
251 |
"Created: / 16-10-2006 / 13:09:27 / cg" |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
252 |
! ! |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
253 |
|
1763 | 254 |
!MenuItem methodsFor:'Compatibility-ST80'! |
724 | 255 |
|
2755 | 256 |
enablementSelector:aSymbol |
257 |
"dummy for now - for visualworks compatibility (specs)" |
|
258 |
||
259 |
"/ self halt. |
|
260 |
! |
|
261 |
||
262 |
helpText:aString |
|
263 |
"dummy for now - for visualworks compatibility (specs)" |
|
264 |
||
265 |
activeHelpKey := aString. |
|
266 |
! |
|
267 |
||
268 |
indicationSelector:aSymbol |
|
269 |
"dummy for now - for visualworks compatibility (specs)" |
|
270 |
||
271 |
"/ self halt. |
|
272 |
! |
|
273 |
||
724 | 274 |
isEnabled:aBoolean |
275 |
self enabled:aBoolean |
|
276 |
||
277 |
"Created: / 27.10.1997 / 16:34:55 / cg" |
|
1646 | 278 |
! |
279 |
||
2755 | 280 |
shortcutModifiers:something |
281 |
"dummy for now - for visualworks compatibility (specs)" |
|
282 |
||
283 |
"/ self halt. |
|
284 |
! |
|
285 |
||
1646 | 286 |
value |
287 |
"obsolete - please use #itemValue (value is bad: it prevents us from using a valueHolder)" |
|
288 |
||
289 |
^ itemValue |
|
290 |
||
291 |
"Created: 25.2.1997 / 19:50:14 / cg" |
|
292 |
! |
|
293 |
||
294 |
value:something |
|
295 |
"obsolete - please use #itemValue: (value is bad: it prevents us from using a valueHolder)" |
|
296 |
||
297 |
itemValue := something |
|
298 |
||
299 |
"Created: 25.2.1997 / 19:11:13 / cg" |
|
724 | 300 |
! ! |
301 |
||
451 | 302 |
!MenuItem methodsFor:'accessing'! |
303 |
||
579 | 304 |
accessCharacterPosition |
2112 | 305 |
"get the index of the access character in the label text or string, or nil if none" |
4056 | 306 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
307 |
^ accessCharacterPosition |
451 | 308 |
! |
309 |
||
2112 | 310 |
accessCharacterPosition:index |
311 |
"set the index of the access character in the label text or string, or nil if none" |
|
4056 | 312 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
313 |
accessCharacterPosition := index |
451 | 314 |
! |
315 |
||
640 | 316 |
activeHelpKey |
4045 | 317 |
"the key used as index (and argument) to the helpSpec" |
3215 | 318 |
|
640 | 319 |
^ activeHelpKey |
320 |
! |
|
321 |
||
322 |
activeHelpKey:aKey |
|
4045 | 323 |
"the key used as index (and argument) to the helpSpec" |
3215 | 324 |
|
4158 | 325 |
aKey isAssociation ifTrue:[ |
326 |
self halt:'someone provides a bad key to me'. |
|
327 |
activeHelpKey := aKey key |
|
328 |
] ifFalse:[ |
|
329 |
activeHelpKey := aKey |
|
330 |
]. |
|
331 |
||
332 |
"Modified: / 09-08-2018 / 15:50:45 / Claus Gittinger" |
|
640 | 333 |
! |
334 |
||
684 | 335 |
argument |
2112 | 336 |
"get argument given to the value (selector)" |
4056 | 337 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
338 |
^ argument |
684 | 339 |
! |
340 |
||
4056 | 341 |
argument:something |
2112 | 342 |
"set argument given to the value (selector)" |
4056 | 343 |
|
684 | 344 |
|arg| |
345 |
||
346 |
(arg := something) notNil ifTrue:[ |
|
347 |
arg isString ifTrue:[ |
|
2112 | 348 |
(arg size == 0 or:[ (arg indexOfNonSeparatorStartingAt:1) == 0 ]) ifTrue:[ |
684 | 349 |
arg := nil |
350 |
] |
|
351 |
] |
|
352 |
]. |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
353 |
argument := arg |
684 | 354 |
! |
355 |
||
1213 | 356 |
auxValue |
357 |
"an additional, arbitrary value" |
|
358 |
||
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
359 |
^ auxValue |
1213 | 360 |
! |
361 |
||
4056 | 362 |
auxValue:something |
2112 | 363 |
"set the auxValue - an arbitrary user value" |
4056 | 364 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
365 |
auxValue := something |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
366 |
! |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
367 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
368 |
choice:something |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
369 |
choice := something. |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
370 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
371 |
"Created: / 14.8.1998 / 14:32:06 / cg" |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
372 |
! |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
373 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
374 |
choiceValue |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
375 |
^ choiceValue |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
376 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
377 |
"Created: / 14.8.1998 / 15:39:26 / cg" |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
378 |
! |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
379 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
380 |
choiceValue:something |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
381 |
choiceValue := something. |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
382 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
383 |
"Created: / 14.8.1998 / 15:39:26 / cg" |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
384 |
! |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
385 |
|
2548 | 386 |
hierarchicalUUID |
387 |
||
388 |
^ self uuid |
|
389 |
! |
|
390 |
||
1884 | 391 |
ignoreMnemonicKeys |
392 |
"if true, mnemonic (access character) in the submenus under the item are ignored; |
|
2938
e9074e9333fa
comment: #ignoreMnemonicKeys
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
393 |
Set this to speedup accelerator key processing for slow dynamci menus. |
e9074e9333fa
comment: #ignoreMnemonicKeys
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
394 |
The default is set to false" |
4056 | 395 |
|
4159 | 396 |
^ (flags ? 0) bitTest:FLAG_IGNORE_MNEMONIC_KEYS "/ ignoreMnemonicKeys ? false |
2938
e9074e9333fa
comment: #ignoreMnemonicKeys
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
397 |
|
e9074e9333fa
comment: #ignoreMnemonicKeys
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
398 |
"Modified (comment): / 08-09-2011 / 04:30:19 / cg" |
4159 | 399 |
"Modified: / 09-08-2018 / 16:41:53 / Claus Gittinger" |
1884 | 400 |
! |
401 |
||
4056 | 402 |
ignoreMnemonicKeys:aBoolean |
1884 | 403 |
"if true, mnemonic (access character) in the submenus under the item are ignored; |
2939
c04e85910837
comment: #ignoreMnemonicKeys:
Claus Gittinger <cg@exept.de>
parents:
2938
diff
changeset
|
404 |
Set this to speedup accelerator key processing for slow dynamci menus. |
4159 | 405 |
The default is false" |
4056 | 406 |
|
4159 | 407 |
"/ ignoreMnemonicKeys := aBoolean. |
408 |
flags := (flags ? 0) changeMask:FLAG_IGNORE_MNEMONIC_KEYS to:aBoolean. |
|
2939
c04e85910837
comment: #ignoreMnemonicKeys:
Claus Gittinger <cg@exept.de>
parents:
2938
diff
changeset
|
409 |
|
c04e85910837
comment: #ignoreMnemonicKeys:
Claus Gittinger <cg@exept.de>
parents:
2938
diff
changeset
|
410 |
"Modified (comment): / 08-09-2011 / 04:52:23 / cg" |
4159 | 411 |
"Modified: / 09-08-2018 / 16:43:08 / Claus Gittinger" |
1884 | 412 |
! |
413 |
||
414 |
ignoreShortcutKeys |
|
415 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored; |
|
2112 | 416 |
the default is set to false" |
4056 | 417 |
|
4159 | 418 |
^ (flags ? 0) bitTest:FLAG_IGNORE_SHORTCUTS "/ ignoreShortcutKeys ? false |
419 |
||
420 |
"Modified: / 09-08-2018 / 16:43:26 / Claus Gittinger" |
|
1884 | 421 |
! |
422 |
||
4056 | 423 |
ignoreShortcutKeys:aBoolean |
1884 | 424 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored; |
2112 | 425 |
the default is set to false" |
4056 | 426 |
|
4159 | 427 |
"/ ignoreShortcutKeys := aBoolean. |
428 |
flags := (flags ? 0) changeMask:FLAG_IGNORE_SHORTCUTS to:aBoolean. |
|
429 |
||
430 |
"Modified: / 09-08-2018 / 16:43:49 / Claus Gittinger" |
|
1884 | 431 |
! |
432 |
||
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
433 |
indication |
3178 | 434 |
"value of the items on/off indicator (CheckToggle). |
435 |
Usually a valueHolder" |
|
4056 | 436 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
437 |
^ indication |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
438 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
439 |
"Created: 25.2.1997 / 20:59:28 / cg" |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
440 |
! |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
441 |
|
4056 | 442 |
indication:someValueHolder |
3178 | 443 |
"value of the items on/off indicator (CheckToggle). |
444 |
someValueHolder is usually a value holder" |
|
4056 | 445 |
|
3178 | 446 |
indication := someValueHolder. |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
447 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
448 |
"Created: 25.2.1997 / 20:59:28 / cg" |
1213 | 449 |
! |
450 |
||
798 | 451 |
isVisible |
3215 | 452 |
"a visibility holder; either a block, boolean or value holder. |
453 |
If the menu is permanently visible, it should be a valueHolder, |
|
454 |
as the value is otherwise only checked for before the menu is opened" |
|
455 |
||
1663 | 456 |
^ isVisible ? true |
798 | 457 |
! |
458 |
||
459 |
isVisible:something |
|
3215 | 460 |
"a visibility holder; either a block, boolean or value holder. |
461 |
If the menu is permanently visible, it should be a valueHolder, |
|
462 |
as the value is otherwise only checked for before the menu is opened" |
|
463 |
||
798 | 464 |
isVisible := something |
465 |
! |
|
466 |
||
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
467 |
itemValue |
3215 | 468 |
"the item's action; if it is a block, that is evaluated; |
469 |
if a symbol, that message is sent to the menu's receiver" |
|
470 |
||
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
471 |
^ itemValue |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
472 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
473 |
"Created: 25.2.1997 / 19:50:14 / cg" |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
474 |
! |
1370 | 475 |
|
3215 | 476 |
itemValue:aBlockOrSymbol |
477 |
"set the item's action; if it is a block, that is evaluated; |
|
478 |
if a symbol, that message is sent to the menu's receiver" |
|
479 |
||
480 |
itemValue := aBlockOrSymbol |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
481 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
482 |
"Created: 25.2.1997 / 19:11:13 / cg" |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
483 |
! |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
484 |
|
3023 | 485 |
itemValue:selectorOrBlock argument:anArgument |
3215 | 486 |
"set the item's action and an argument; if it is ablock, that is evaluated; |
487 |
if a symbol, that message is sent to the menu's receiver" |
|
488 |
||
3023 | 489 |
itemValue := selectorOrBlock. |
490 |
argument := anArgument |
|
491 |
||
492 |
"Created: / 09-09-2012 / 13:05:14 / cg" |
|
493 |
! |
|
494 |
||
3221 | 495 |
label:aString icon:anImage |
496 |
self label:aString. |
|
497 |
self resourceRetriever: (ResourceRetriever icon:anImage string:'') |
|
498 |
! |
|
499 |
||
500 |
label:labelString itemValue:selectorOrBlock |
|
501 |
label := labelString. |
|
4056 | 502 |
itemValue := selectorOrBlock. |
3221 | 503 |
|
504 |
"Created: / 09-09-2012 / 13:18:34 / cg" |
|
4067 | 505 |
"Modified (comment): / 14-02-2018 / 12:55:40 / mawalch" |
3221 | 506 |
! |
507 |
||
508 |
label:labelString itemValue:selectorOrBlock argument:something |
|
3353 | 509 |
"define label, value and an argument to be passed with the action" |
510 |
||
4056 | 511 |
self assert:(labelString isNil or:[labelString isString]). |
512 |
||
3221 | 513 |
label := labelString. |
514 |
itemValue := selectorOrBlock. |
|
4056 | 515 |
argument := something. |
3221 | 516 |
|
517 |
"Created: / 09-09-2012 / 13:19:36 / cg" |
|
4056 | 518 |
"Modified: / 24-01-2018 / 14:34:10 / mawalch" |
3221 | 519 |
! |
520 |
||
3352 | 521 |
label:labelString itemValue:selectorOrBlock enabled:enabledHolder |
3353 | 522 |
"define label, value |
523 |
and enabled holder, which can be a boolean, a boolean valueHolder, |
|
524 |
a block or a selector (to be sent to the application)" |
|
525 |
||
4056 | 526 |
self assert:(labelString isNil or:[labelString isString]). |
527 |
||
3352 | 528 |
label := labelString. |
529 |
itemValue := selectorOrBlock. |
|
4056 | 530 |
enabled := enabledHolder. |
531 |
||
532 |
"Modified: / 24-01-2018 / 14:34:18 / mawalch" |
|
3352 | 533 |
! |
534 |
||
535 |
label:labelString itemValue:selectorOrBlock translateLabel:translateLabelBoolean |
|
4056 | 536 |
self assert:(labelString isNil or:[labelString isString]). |
537 |
||
3352 | 538 |
label := labelString. |
539 |
itemValue := selectorOrBlock. |
|
4162 | 540 |
self translateLabel:translateLabelBoolean. |
4056 | 541 |
|
542 |
"Modified: / 24-01-2018 / 14:34:24 / mawalch" |
|
4162 | 543 |
"Modified: / 09-08-2018 / 17:27:37 / Claus Gittinger" |
3352 | 544 |
! |
545 |
||
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
546 |
labelImage |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
547 |
^ labelImage |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
548 |
! |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
549 |
|
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
550 |
labelImage:something |
2125 | 551 |
labelImage := something. |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
552 |
|
2125 | 553 |
"/ VW compatibility: if I have a label also, |
554 |
"/ this will become a LabelAndImage. |
|
4019 | 555 |
(something isImage and:[label notNil]) ifTrue:[ |
556 |
labelImage := LabelAndIcon icon:labelImage string:label. |
|
2125 | 557 |
]. |
4019 | 558 |
|
559 |
"Modified: / 26-09-2017 / 12:29:32 / stefan" |
|
1370 | 560 |
! |
561 |
||
578 | 562 |
nameKey |
563 |
^ nameKey |
|
564 |
||
565 |
||
566 |
! |
|
567 |
||
568 |
nameKey:aNameKey |
|
4067 | 569 |
self assert:(aNameKey isNil or:[aNameKey isString]). |
579 | 570 |
nameKey := aNameKey. |
578 | 571 |
|
4067 | 572 |
"Modified: / 14-02-2018 / 12:24:56 / mawalch" |
578 | 573 |
! |
574 |
||
490 | 575 |
rawLabel |
576 |
^ label |
|
577 |
||
578 |
"Created: 25.2.1997 / 19:48:16 / cg" |
|
579 |
! |
|
580 |
||
451 | 581 |
rawLabel:aString |
4056 | 582 |
self assert:(aString isNil or:[aString isString]). |
583 |
||
451 | 584 |
label := aString |
585 |
||
4056 | 586 |
"Created: / 25-02-1997 / 19:11:02 / cg" |
587 |
"Modified: / 24-01-2018 / 14:34:36 / mawalch" |
|
451 | 588 |
! |
589 |
||
1621 | 590 |
resourceRetriever |
591 |
|retriever| |
|
592 |
||
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
593 |
retriever := labelImage. |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
594 |
(retriever notNil and:[retriever isKindOf:ResourceRetriever]) ifTrue:[ |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
595 |
^ retriever |
1621 | 596 |
]. |
597 |
^ nil |
|
598 |
! |
|
599 |
||
600 |
resourceRetriever:aRetriever |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
601 |
self labelImage:aRetriever |
1621 | 602 |
! |
603 |
||
1655
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
604 |
shortcutKey |
2112 | 605 |
"get the key to press to select the menu item from the keyboard" |
4056 | 606 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
607 |
^ shortcutKey |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
608 |
! |
490 | 609 |
|
4056 | 610 |
shortcutKey:something |
2112 | 611 |
"set the key to press to select the menu item from the keyboard" |
4056 | 612 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
613 |
shortcutKey := something. |
490 | 614 |
! |
615 |
||
1655
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
616 |
shortcutKeyCharacter |
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
617 |
"Backward compatibility; same as #shortcutKey. |
2112 | 618 |
get the key to press to select the menu item from the keyboard" |
4056 | 619 |
|
1655
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
620 |
^ self shortcutKey |
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
621 |
! |
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
622 |
|
4056 | 623 |
shortcutKeyCharacter:something |
1655
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
624 |
"Backward compatibility; same as #shortcutKey:. |
2112 | 625 |
set the key to press to select the menu item from the keyboard" |
4056 | 626 |
|
1655
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
627 |
self shortcutKey:something. |
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
628 |
! |
d937610cfe89
shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
629 |
|
458 | 630 |
submenu |
2112 | 631 |
"get the submenu or nil" |
4056 | 632 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
633 |
^ submenu value |
458 | 634 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
635 |
"Created: / 25.2.1997 / 20:59:28 / cg" |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
636 |
"Modified: / 19.6.1998 / 00:33:58 / cg" |
458 | 637 |
! |
638 |
||
4056 | 639 |
submenu:aMenu |
2112 | 640 |
"set the submenu or nil" |
4056 | 641 |
|
2987
66fad8f6ad33
comment/format in: #submenu:
Claus Gittinger <cg@exept.de>
parents:
2966
diff
changeset
|
642 |
(aMenu isValueModel or:[ aMenu isBlock ]) ifTrue:[ |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
643 |
submenuChannel notNil ifTrue:[ |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
644 |
"/ programmers error ? |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
645 |
"/ how can I decide which one to use if there is both |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
646 |
"/ a channel and a subMenu ... |
1649 | 647 |
self error:'overwriting submenuchannel' mayProceed:true. |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
648 |
]. |
2987
66fad8f6ad33
comment/format in: #submenu:
Claus Gittinger <cg@exept.de>
parents:
2966
diff
changeset
|
649 |
submenuChannel := aMenu |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
650 |
] ifFalse:[ |
2987
66fad8f6ad33
comment/format in: #submenu:
Claus Gittinger <cg@exept.de>
parents:
2966
diff
changeset
|
651 |
submenu := aMenu. |
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
652 |
] |
458 | 653 |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
654 |
"Created: / 25.2.1997 / 20:59:28 / cg" |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
655 |
"Modified: / 5.2.2000 / 16:53:28 / cg" |
458 | 656 |
! |
657 |
||
4056 | 658 |
submenuProvider |
2866 | 659 |
"useful if a sub-menu is plugged in from another application (i.e. when |
660 |
a submenu is fetched via a channel AND the top-menus application cannot provide |
|
661 |
it" |
|
4056 | 662 |
|
2866 | 663 |
^ submenuProvider |
664 |
||
665 |
"Created: / 22-09-2010 / 13:55:55 / cg" |
|
666 |
! |
|
667 |
||
4056 | 668 |
submenuProvider:something |
2866 | 669 |
"useful if a sub-menu is plugged in from another application (i.e. when |
670 |
a submenu is fetched via a channel AND the top-menus application cannot provide |
|
671 |
it" |
|
4056 | 672 |
|
2866 | 673 |
submenuProvider := something. |
674 |
||
675 |
"Created: / 22-09-2010 / 13:55:40 / cg" |
|
676 |
! |
|
677 |
||
2517 | 678 |
uuid |
4159 | 679 |
"automationID |
680 |
return my uuid component to be used for resource-access. |
|
4054 | 681 |
This is a unique and once-assigned-never-changed uuid by which |
682 |
UI automators can access the menu item." |
|
2517 | 683 |
|
684 |
^ uuid |
|
4159 | 685 |
|
686 |
"Modified (comment): / 09-08-2018 / 16:47:39 / Claus Gittinger" |
|
2517 | 687 |
! |
688 |
||
689 |
uuid:aUUID |
|
4159 | 690 |
"automationID |
691 |
set my uuid component to be used for resource-access |
|
4054 | 692 |
(called by menuBuilder). |
693 |
This is a unique and once-assigned-never-changed uuid by which |
|
694 |
UI automators can access the menu item." |
|
2517 | 695 |
|
696 |
uuid := aUUID |
|
4159 | 697 |
|
698 |
"Modified (comment): / 09-08-2018 / 16:47:34 / Claus Gittinger" |
|
451 | 699 |
! ! |
700 |
||
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
701 |
!MenuItem methodsFor:'accessing-behavior'! |
579 | 702 |
|
590 | 703 |
beOff |
2082 | 704 |
"set indication off" |
705 |
||
590 | 706 |
self indication:false |
707 |
! |
|
708 |
||
709 |
beOn |
|
2082 | 710 |
"set indication on" |
711 |
||
590 | 712 |
self indication:true |
713 |
! |
|
714 |
||
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
715 |
choice |
2082 | 716 |
"return the menu items choice indicator (RadioButton)" |
717 |
||
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
718 |
^ choice |
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
719 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
720 |
"Created: / 14.8.1998 / 14:34:55 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
721 |
"Modified: / 14.8.1998 / 15:11:57 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
722 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
723 |
|
579 | 724 |
disable |
725 |
enabled := false |
|
726 |
||
727 |
"Created: 25.2.1997 / 19:39:09 / cg" |
|
728 |
! |
|
729 |
||
730 |
enable |
|
731 |
enabled := true |
|
732 |
||
733 |
"Created: 25.2.1997 / 19:39:00 / cg" |
|
734 |
! |
|
735 |
||
581 | 736 |
enabled |
2082 | 737 |
"returns a boolean, valueHolder or block" |
738 |
||
4147 | 739 |
^ enabled ? true |
740 |
||
741 |
"Modified: / 12-07-2018 / 22:29:33 / Claus Gittinger" |
|
581 | 742 |
! |
579 | 743 |
|
3352 | 744 |
enabled:enabledHolder |
3353 | 745 |
"enabledHolder can be a boolean, a boolean valueHolder, |
746 |
a block or a selector (to be sent to the application)" |
|
2082 | 747 |
|
3352 | 748 |
enabled := enabledHolder |
590 | 749 |
! |
750 |
||
1595 | 751 |
hideMenuOnActivated |
2082 | 752 |
"hide the menu when the item was activated; the default is true" |
753 |
||
4159 | 754 |
"/ notice: here the default is true |
755 |
^ ((flags ? 0) bitTest:FLAG_HIDE_ONACTIVATED) not "/ hideMenuOnActivated ? true |
|
756 |
||
757 |
"Modified (comment): / 09-08-2018 / 17:00:01 / Claus Gittinger" |
|
758 |
! |
|
759 |
||
760 |
hideMenuOnActivated:aBoolean |
|
761 |
"hide the menu when the item was activated; the default is true" |
|
762 |
||
763 |
"/ notice: here the default is true |
|
764 |
||
765 |
"/ hideMenuOnActivated := aBool ? true |
|
766 |
flags := (flags ? 0) changeMask:FLAG_HIDE_ONACTIVATED to:aBoolean not. |
|
767 |
||
768 |
"Modified (comment): / 09-08-2018 / 17:00:05 / Claus Gittinger" |
|
1566
99ef8f1123c8
menuBuilder: support of horizontal/vertical layout of submenu
ca
parents:
1486
diff
changeset
|
769 |
! |
99ef8f1123c8
menuBuilder: support of horizontal/vertical layout of submenu
ca
parents:
1486
diff
changeset
|
770 |
|
4159 | 771 |
keepLinkedMenu |
772 |
"if true, a linked submenu menu is only computed once (slightly faster), |
|
773 |
but then, the linked menu cannot be dynamic" |
|
774 |
||
775 |
^ (flags ? 0) bitTest:FLAG_KEEP_LINKEDMENU "/ keepLinkedMenu ? false |
|
776 |
||
777 |
"Modified: / 09-08-2018 / 16:52:56 / Claus Gittinger" |
|
778 |
! |
|
2082 | 779 |
|
4159 | 780 |
keepLinkedMenu:aBoolean |
781 |
"if true, a linked submenu menu is only computed once (slightly faster), |
|
782 |
but then, the linked menu cannot be dynamic" |
|
783 |
||
784 |
"/ keepLinkedMenu := aBoolean ? false. |
|
785 |
flags := (flags ? 0) changeMask:FLAG_KEEP_LINKEDMENU to:aBoolean. |
|
786 |
||
787 |
"Modified: / 09-08-2018 / 16:53:12 / Claus Gittinger" |
|
1566
99ef8f1123c8
menuBuilder: support of horizontal/vertical layout of submenu
ca
parents:
1486
diff
changeset
|
788 |
! |
99ef8f1123c8
menuBuilder: support of horizontal/vertical layout of submenu
ca
parents:
1486
diff
changeset
|
789 |
|
1651 | 790 |
sendToOriginator |
791 |
"if true, the message is sent to the originating widget; |
|
792 |
otherwise (the default), it it sent to the receiver/application." |
|
793 |
||
4159 | 794 |
^ (flags ? 0) bitTest:FLAG_SEND_TO_ORIGINATOR "/ sendToOriginator ? false |
795 |
||
796 |
"Modified: / 09-08-2018 / 16:51:28 / Claus Gittinger" |
|
1651 | 797 |
! |
798 |
||
4159 | 799 |
sendToOriginator:aBoolean |
1651 | 800 |
"if true, the message is sent to the originating widget; |
801 |
otherwise (the default), it it sent to the receiver/application." |
|
802 |
||
4159 | 803 |
"/ sendToOriginator := aBoolean |
804 |
flags := (flags ? 0) changeMask:FLAG_SEND_TO_ORIGINATOR to:aBoolean. |
|
805 |
||
806 |
"Modified: / 09-08-2018 / 16:51:51 / Claus Gittinger" |
|
1651 | 807 |
! |
808 |
||
2533 | 809 |
showBusyCursorWhilePerforming |
810 |
"get the flag which controls if a busy cursor is to be shown |
|
811 |
while performing the menu action. Defaults to false." |
|
812 |
||
4159 | 813 |
^ (flags ? 0) bitTest:FLAG_SHOW_BUSYCURSOR_WHILE_PERFORMING "/ showBusyCursorWhilePerforming ? false |
2533 | 814 |
|
4159 | 815 |
"Modified: / 09-08-2018 / 16:52:14 / Claus Gittinger" |
2533 | 816 |
! |
817 |
||
818 |
showBusyCursorWhilePerforming:aBoolean |
|
819 |
"set/clear the flag which controls if a busy cursor is to be shown |
|
820 |
while performing the menu action. Defaults to false." |
|
821 |
||
4159 | 822 |
"/ showBusyCursorWhilePerforming := aBoolean |
823 |
flags := (flags ? 0) changeMask:FLAG_SHOW_BUSYCURSOR_WHILE_PERFORMING to:aBoolean. |
|
2533 | 824 |
|
4159 | 825 |
"Modified: / 09-08-2018 / 16:52:28 / Claus Gittinger" |
2533 | 826 |
! |
827 |
||
1595 | 828 |
translateLabel |
3843 | 829 |
"returns true if the label is to be translated. |
830 |
The default is true" |
|
2082 | 831 |
|
4162 | 832 |
"/ notice: here the default is true |
833 |
^ ((flags ? 0) bitTest:FLAG_TRANSLATE_LABEL) not "/ translateLabel ? true |
|
834 |
||
835 |
"Modified (comment): / 09-08-2018 / 17:27:00 / Claus Gittinger" |
|
1595 | 836 |
! |
837 |
||
2082 | 838 |
translateLabel:aBoolean |
839 |
"sets whether label is translated" |
|
1595 | 840 |
|
4162 | 841 |
"/ notice: here the default is true |
842 |
||
843 |
"/ translateLabel := aBoolean |
|
844 |
flags := (flags ? 0) changeMask:FLAG_HIDE_ONACTIVATED to:aBoolean not. |
|
845 |
||
846 |
"Modified (comment): / 09-08-2018 / 17:27:20 / Claus Gittinger" |
|
1595 | 847 |
! |
848 |
||
849 |
triggerOnDown |
|
3843 | 850 |
"returns true if the action is triggered when pressed. |
851 |
The default is false (trigger when released)" |
|
2082 | 852 |
|
4159 | 853 |
^ (flags ? 0) bitTest:FLAG_TRIGGER_ONDOWN "/ triggerOnDown ? false |
854 |
||
855 |
"Modified: / 09-08-2018 / 16:53:49 / Claus Gittinger" |
|
1595 | 856 |
! |
857 |
||
4159 | 858 |
triggerOnDown:aBoolean |
2082 | 859 |
"controls if the action is triggered when pressed or released" |
860 |
||
4159 | 861 |
"/ triggerOnDown := aBoolean. |
862 |
flags := (flags ? 0) changeMask:FLAG_TRIGGER_ONDOWN to:aBoolean. |
|
863 |
||
864 |
"Modified: / 09-08-2018 / 16:54:10 / Claus Gittinger" |
|
1595 | 865 |
! ! |
866 |
||
4029 | 867 |
!MenuItem methodsFor:'accessing-channels'! |
868 |
||
869 |
label:labelString submenuChannel:aSymbolOrValueHolder |
|
4056 | 870 |
self assert:(labelString isNil or:[labelString isString]). |
871 |
||
4029 | 872 |
label := labelString. |
4056 | 873 |
submenuChannel := aSymbolOrValueHolder. |
874 |
||
875 |
"Modified: / 24-01-2018 / 14:36:54 / mawalch" |
|
4029 | 876 |
! |
877 |
||
878 |
submenuChannel |
|
879 |
"get the submenuChannel or nil" |
|
4056 | 880 |
|
4029 | 881 |
^ submenuChannel |
882 |
! |
|
883 |
||
4056 | 884 |
submenuChannel:aMenuHolder |
4029 | 885 |
"set the submenuChannel or nil" |
4056 | 886 |
|
4029 | 887 |
submenuChannel := aMenuHolder. |
888 |
! ! |
|
889 |
||
1595 | 890 |
!MenuItem methodsFor:'accessing-look'! |
891 |
||
4159 | 892 |
font |
893 |
"get the specific font for an item or nil" |
|
894 |
||
895 |
^ font |
|
896 |
! |
|
897 |
||
898 |
font:aFont |
|
899 |
"set a specific font for an item" |
|
900 |
||
901 |
font := aFont. |
|
902 |
! |
|
903 |
||
904 |
hasMenuIndicator |
|
905 |
"returns whether item should always show a menu-indicator (arrow)" |
|
906 |
||
907 |
^ (flags ? 0) bitTest:FLAG_FORCE_MENUINDICATOR "/ forceMenuIndicator ? false |
|
908 |
||
909 |
"Created: / 09-08-2018 / 16:35:05 / Claus Gittinger" |
|
910 |
! |
|
911 |
||
912 |
hasMenuIndicator:aBoolean |
|
913 |
"force the item to always show a menu-indicator (arrow)" |
|
914 |
||
915 |
flags := (flags ? 0) changeMask:FLAG_FORCE_MENUINDICATOR to:aBoolean. |
|
916 |
||
917 |
"Created: / 09-08-2018 / 16:49:11 / Claus Gittinger" |
|
918 |
! |
|
919 |
||
920 |
horizontalLayout |
|
921 |
"by default, submenus have a vertical layout; |
|
922 |
if true, the submenu has a horizontal layout." |
|
923 |
||
924 |
^ (flags ? 0) bitTest:FLAG_HORIZONTAL_LAYOUT "/ horizontalLayout ? false |
|
925 |
||
926 |
"Modified: / 09-08-2018 / 16:46:50 / Claus Gittinger" |
|
927 |
! |
|
928 |
||
929 |
horizontalLayout:aBoolean |
|
930 |
"by default, submenus have a vertical layout; |
|
931 |
if true, the submenu has a horizontal layout." |
|
932 |
||
933 |
"/ horizontalLayout := aBoolean. |
|
934 |
flags := (flags ? 0) changeMask:FLAG_HORIZONTAL_LAYOUT to:aBoolean. |
|
935 |
||
936 |
"Modified: / 09-08-2018 / 16:47:05 / Claus Gittinger" |
|
937 |
! |
|
938 |
||
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
939 |
icon:anImage |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
940 |
self resourceRetriever: (ResourceRetriever icon:anImage) |
1595 | 941 |
! |
942 |
||
752 | 943 |
isButton |
944 |
"returns whether item looks like a Button |
|
945 |
" |
|
4159 | 946 |
^ (flags ? 0) bitTest:FLAG_ISBUTTON "/ isButton ? false |
947 |
||
948 |
"Modified: / 09-08-2018 / 16:49:32 / Claus Gittinger" |
|
949 |
! |
|
950 |
||
951 |
isButton:aBoolean |
|
952 |
"sets whether item looks like a Button |
|
953 |
" |
|
954 |
"/ isButton := aBoolean |
|
955 |
flags := (flags ? 0) changeMask:FLAG_ISBUTTON to:aBoolean. |
|
956 |
||
957 |
"Modified: / 09-08-2018 / 16:49:56 / Claus Gittinger" |
|
752 | 958 |
! |
959 |
||
4159 | 960 |
isMenuSlice |
961 |
"returns true if the menu is a slice, |
|
962 |
building its items into its container menu |
|
752 | 963 |
" |
4159 | 964 |
^ submenuChannel notNil |
965 |
and:[ (flags ? 0) bitTest:FLAG_IS_MENUSLICE "isMenuSlice == true"]. |
|
966 |
||
967 |
"Modified: / 09-08-2018 / 16:44:37 / Claus Gittinger" |
|
968 |
! |
|
752 | 969 |
|
4159 | 970 |
isMenuSlice:aBoolean |
971 |
"/ isMenuSlice := aBoolean. |
|
972 |
flags := (flags ? 0) changeMask:FLAG_IS_MENUSLICE to:aBoolean. |
|
752 | 973 |
|
4159 | 974 |
"Modified: / 09-08-2018 / 16:44:58 / Claus Gittinger" |
752 | 975 |
! |
976 |
||
1595 | 977 |
label |
978 |
^ self filteredLabel "/ label |
|
979 |
||
980 |
"Created: / 25.2.1997 / 19:48:16 / cg" |
|
981 |
"Modified: / 19.6.1998 / 00:02:55 / cg" |
|
982 |
! |
|
983 |
||
984 |
label:aString |
|
4056 | 985 |
label := aString. |
986 |
||
987 |
"Created: / 25-02-1997 / 19:55:16 / cg" |
|
4067 | 988 |
"Modified: / 14-02-2018 / 12:23:41 / mawalch" |
1595 | 989 |
! |
990 |
||
991 |
startGroup |
|
2264
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
992 |
"start group #left #right #conditionalRight ... or nil |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
993 |
at the moment only #right and #conditionalRight are implemented" |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
994 |
|
1595 | 995 |
^ startGroup ? #left |
2264
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
996 |
|
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
997 |
"Modified: / 16-10-2006 / 13:05:52 / cg" |
1595 | 998 |
! |
752 | 999 |
|
1595 | 1000 |
startGroup:aSymbol |
2264
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1001 |
"start group #left #right #conditionalRight ... |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1002 |
at the moment only #right and #conditionalRight are implemented. |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1003 |
The meanings are: |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1004 |
nil - default under control of the menu |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1005 |
#left - left align |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1006 |
#right - place at the right far end |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1007 |
#conditionalRight - controlled by a styleSheet variable; |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1008 |
like #right under all non-win32 systems, |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1009 |
ignored on win32. |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1010 |
Use with help-menu, which should be at the far right on some |
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1011 |
viewStyles, but not under win32. |
1595 | 1012 |
" |
2264
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1013 |
|
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1014 |
(self class supportedStartGroupValues includes:aSymbol) ifTrue:[ |
1595 | 1015 |
startGroup := aSymbol |
1016 |
] ifFalse:[ |
|
1017 |
self warn:('unsupported group: ', aSymbol printString ). |
|
1018 |
startGroup := #left |
|
1019 |
] |
|
2263
30cf468f47ca
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2125
diff
changeset
|
1020 |
|
2264
8736ee5ec90e
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
1021 |
"Modified: / 16-10-2006 / 13:09:45 / cg" |
581 | 1022 |
! ! |
1023 |
||
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
1024 |
!MenuItem methodsFor:'accessing-resource'! |
581 | 1025 |
|
584 | 1026 |
findGuiResourcesIn:aResourceContainerOrApplication |
4033 | 1027 |
"resolve national language translations from aResourceContainerOrApplication" |
1028 |
||
4056 | 1029 |
self |
1030 |
findGuiResourcesIn:aResourceContainerOrApplication |
|
4033 | 1031 |
rememberResourcesIn:nil |
1401
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1032 |
! |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1033 |
|
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1034 |
findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil |
4033 | 1035 |
"resolve national language translations from aResourceContainerOrApplication. |
1036 |
In addition, expand %(xxx) by asking the application for an xxx aspect." |
|
3305 | 1037 |
|
1038 |
|retriever m itemFont| |
|
1401
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1039 |
|
1986 | 1040 |
(aResourceContainerOrApplication isNil or:[self isMenuSlice]) ifTrue:[ |
1041 |
^ self. |
|
1042 |
]. |
|
1043 |
||
3305 | 1044 |
"while traversing all the menus, resolve symbolic fonts too" |
1045 |
itemFont := self font. |
|
1046 |
itemFont isSymbol ifTrue:[ |
|
1047 |
itemFont := aResourceContainerOrApplication resolveFont:itemFont. |
|
1048 |
self font:itemFont. |
|
1049 |
]. |
|
1050 |
||
2412
3f11e716f802
Do not try to translate separators
Stefan Vogel <sv@exept.de>
parents:
2293
diff
changeset
|
1051 |
(self translateLabel and:[label ~= '-']) ifTrue:[ |
4056 | 1052 |
label := ResourceRetriever |
1053 |
findResourceLabel:label |
|
1401
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1054 |
in:aResourceContainerOrApplication |
2018 | 1055 |
rememberResourcesIn:aValueHolderOrNil. |
1401
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1056 |
]. |
4037 | 1057 |
(label notNil and:[label includesString:'%(']) ifTrue:[ |
4033 | 1058 |
|fetchDict| |
1059 |
||
1060 |
fetchDict := VirtualDictionary new. |
|
4056 | 1061 |
fetchDict |
4033 | 1062 |
fetchBlock:[:key | |
1063 |
(aResourceContainerOrApplication labelFor:key asSymbol) value |
|
4056 | 1064 |
]. |
4033 | 1065 |
label := label bindWithArguments:fetchDict. |
1066 |
]. |
|
1401
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1067 |
|
4056 | 1068 |
(retriever := self resourceRetriever) notNil ifTrue:[ |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1069 |
retriever findGuiResourcesIn:aResourceContainerOrApplication. |
3305 | 1070 |
retriever labelText notNil ifTrue: [retriever labelText:label]. |
4056 | 1071 |
]. |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1072 |
(m := self submenu) notNil ifTrue:[ |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1073 |
m := m value. |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1074 |
m notNil ifTrue:[ |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1075 |
m findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1076 |
] |
1401
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1077 |
] |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1078 |
|
4037 | 1079 |
"Modified: / 18-06-1998 / 16:54:25 / cg" |
1080 |
"Modified: / 28-12-2017 / 18:36:31 / stefan" |
|
1986 | 1081 |
! |
1082 |
||
1083 |
receiver:aReceiver perform:aSelector with:anArgument ifNone:aBlock |
|
1084 |
"send the one-arg-message aSelector to the application; |
|
1085 |
the result returned from the send or nil is returned |
|
1086 |
" |
|
1087 |
|result| |
|
1088 |
||
1089 |
MessageNotUnderstood handle:[:ex| |
|
1090 |
ex selector ~~ aSelector ifTrue:[ |
|
1091 |
ex reject |
|
1092 |
]. |
|
1093 |
result := aBlock value. |
|
1094 |
] do:[ |
|
1095 |
aSelector numArgs == 0 ifTrue:[ |
|
1096 |
result := aReceiver perform:aSelector. |
|
1097 |
] ifFalse:[ |
|
1098 |
result := aReceiver perform:aSelector with:anArgument. |
|
1099 |
]. |
|
1100 |
]. |
|
1101 |
^ result |
|
1102 |
! |
|
1103 |
||
3966 | 1104 |
resolveSliceMenuItemsIn:aReceiver for:originalReceiver rememberResourcesIn:aValueHolderOrNil |
1986 | 1105 |
|menu| |
1106 |
||
1107 |
self isMenuSlice ifFalse:[ |
|
3305 | 1108 |
self error:'not a slice menu' mayProceed:true. |
1986 | 1109 |
^ Array with:self. |
1110 |
]. |
|
1111 |
||
1112 |
aReceiver isNil ifTrue:[ |
|
1113 |
^ nil |
|
1114 |
]. |
|
4056 | 1115 |
menu := self |
3966 | 1116 |
receiver:aReceiver perform:submenuChannel with:argument |
4056 | 1117 |
ifNone:[ |
1118 |
self |
|
3966 | 1119 |
receiver:(aReceiver class) perform:submenuChannel with:argument |
1120 |
ifNone:[ |
|
1121 |
"/ ('MenuItem [info]: no aspect for slice ',submenuChannel) infoPrintCR. |
|
1122 |
nil |
|
1123 |
]. |
|
2036 | 1124 |
]. |
1986 | 1125 |
|
1126 |
menu := menu value. |
|
2033 | 1127 |
menu isNil ifTrue:[^ nil]. |
1986 | 1128 |
|
2292 | 1129 |
menu isCollection ifTrue:[ |
1130 |
menu := Menu decodeFromLiteralArray:menu. |
|
1986 | 1131 |
]. |
3966 | 1132 |
menu findGuiResourcesIn:originalReceiver rememberResourcesIn:aValueHolderOrNil. |
1986 | 1133 |
^ menu items |
2268
a947e7f7a28f
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2264
diff
changeset
|
1134 |
|
3966 | 1135 |
"Created: / 21-07-2017 / 19:46:54 / cg" |
1136 |
! |
|
1137 |
||
1138 |
resolveSliceMenuItemsIn:aReceiver rememberResourcesIn:aValueHolderOrNil |
|
1139 |
^ self resolveSliceMenuItemsIn:aReceiver for:aReceiver rememberResourcesIn:aValueHolderOrNil |
|
1140 |
||
1141 |
"Modified: / 21-07-2017 / 19:48:45 / cg" |
|
579 | 1142 |
! ! |
1143 |
||
4162 | 1144 |
!MenuItem methodsFor:'encoding & decoding'! |
1145 |
||
1146 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
|
1147 |
"read my contents from a aLiteralEncodedArray" |
|
1148 |
||
1149 |
|selector value retriever| |
|
1150 |
||
1151 |
2 to:aLiteralEncodedArray size by:2 do:[:i | |
|
1152 |
selector := aLiteralEncodedArray at:i. |
|
1153 |
value := (aLiteralEncodedArray at:i+1). |
|
1154 |
selector == #argument: ifFalse:[ |
|
1155 |
value := value decodeAsLiteralArray |
|
1156 |
]. |
|
1157 |
self perform:selector with:value |
|
1158 |
]. |
|
1159 |
"/ kludge in case someone forgets to call findGUIResourcesIn: |
|
1160 |
(retriever := self resourceRetriever) notNil ifTrue:[ |
|
1161 |
retriever labelText notNil ifTrue: [retriever labelText: label]. |
|
1162 |
]. |
|
1163 |
||
1164 |
" |
|
1165 |
#( #MenuItem #rawLabel: 'left' #nameKey: 'identifier' #value: #left ) |
|
1166 |
decodeAsLiteralArray |
|
1167 |
" |
|
1168 |
||
1169 |
"Modified: / 4.2.2000 / 12:50:28 / cg" |
|
1170 |
! |
|
451 | 1171 |
|
1646 | 1172 |
skippedInLiteralEncoding |
4161 | 1173 |
"define the inst-slots which are skipped when generating a literalArrayEncoding; |
1174 |
(to skip the ones with default values.)" |
|
1175 |
||
1646 | 1176 |
|coll| |
1177 |
||
1178 |
coll := super skippedInLiteralEncoding asOrderedCollection. |
|
1179 |
||
4162 | 1180 |
coll add:#flags. |
1181 |
||
1646 | 1182 |
label isNil ifTrue:[ coll add:#label ]. |
4162 | 1183 |
(self translateLabel or:[#('' '-' '=') includes:label]) ifTrue:[ coll add:#translateLabel ]. |
1646 | 1184 |
self isButton ifFalse:[ coll add:#isButton ]. |
1185 |
self triggerOnDown ifFalse:[ coll add:#triggerOnDown ]. |
|
1186 |
self hideMenuOnActivated ifTrue:[ coll add:#hideMenuOnActivated]. |
|
1187 |
nameKey isNil ifTrue:[ coll add:#nameKey ]. |
|
4159 | 1188 |
(self isVisible == true) ifTrue:[coll add:#isVisible]. |
1646 | 1189 |
(startGroup isNil or:[startGroup == #left]) ifTrue:[coll add:#startGroup]. |
1190 |
itemValue isNil ifTrue:[ coll add:#itemValue]. |
|
1191 |
activeHelpKey isNil ifTrue:[ coll add:#activeHelpKey]. |
|
1192 |
enabled == true "could be a symbol" ifTrue:[ coll add:#enabled]. |
|
1193 |
shortcutKey isNil ifTrue:[ coll add:#shortcutKeyCharacter]. |
|
1194 |
font isNil ifTrue:[ coll add:#font]. |
|
1195 |
accessCharacterPosition isNil ifTrue:[coll add:#accessCharacterPosition]. |
|
1990 | 1196 |
self horizontalLayout ifFalse:[coll add:#horizontalLayout]. |
1646 | 1197 |
self showBusyCursorWhilePerforming ifFalse:[ coll add:#showBusyCursorWhilePerforming ]. |
1198 |
argument isNil ifTrue:[ coll add:#argument]. |
|
1199 |
self resourceRetriever isNil ifTrue:[ coll add:#resourceRetriever]. |
|
1200 |
indication isNil ifTrue:[ coll add:#indication]. |
|
1201 |
choice isNil ifTrue:[coll add:#choice]. |
|
1202 |
choiceValue isNil ifTrue:[ coll add:#choiceValue]. |
|
1203 |
auxValue isNil ifTrue:[ coll add:#auxValue ]. |
|
1204 |
submenuChannel isNil ifTrue:[ coll add:#submenuChannel]. |
|
1205 |
self keepLinkedMenu ifFalse:[ coll add:#keepLinkedMenu]. |
|
1206 |
submenu value isNil ifTrue:[coll add:#submenu ]. |
|
1651 | 1207 |
self sendToOriginator ifFalse:[coll add:#sendToOriginator ]. |
1646 | 1208 |
|
1885
860b47f2535f
support ignoreShortcutKeys and ignoreMnemonicKeys in Editor
ca
parents:
1884
diff
changeset
|
1209 |
self ignoreShortcutKeys ifFalse:[coll add:#ignoreShortcutKeys ]. |
860b47f2535f
support ignoreShortcutKeys and ignoreMnemonicKeys in Editor
ca
parents:
1884
diff
changeset
|
1210 |
self ignoreMnemonicKeys ifFalse:[coll add:#ignoreMnemonicKeys ]. |
4163 | 1211 |
self hasMenuIndicator ifFalse:[coll add:#hasMenuIndicator ]. |
1884 | 1212 |
|
1986 | 1213 |
self isMenuSlice ifFalse:[coll add:#isMenuSlice]. |
1884 | 1214 |
|
1646 | 1215 |
^ coll |
3021
39995ec958eb
changed: #skippedInLiteralEncoding
Claus Gittinger <cg@exept.de>
parents:
3003
diff
changeset
|
1216 |
|
39995ec958eb
changed: #skippedInLiteralEncoding
Claus Gittinger <cg@exept.de>
parents:
3003
diff
changeset
|
1217 |
"Modified: / 22-08-2012 / 21:22:20 / cg" |
4163 | 1218 |
"Modified: / 09-08-2018 / 17:34:37 / Claus Gittinger" |
4162 | 1219 |
! |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1220 |
|
4162 | 1221 |
virtualSlotsInLiteralEncoding |
1222 |
"defines additional virtual slots in the literalEncoding. |
|
1223 |
These are not instvars, but accessed via getters and setters during |
|
1224 |
store and load. |
|
1225 |
Use this when flags encode values which were previously encoded as boolean instvars, |
|
1226 |
to remain backward compatible" |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1227 |
|
4162 | 1228 |
^ #( ignoreMnemonicKeys ignoreShortcutKeys hideMenuOnActivated |
1229 |
keepLinkedMenu sendToOriginator showBusyCursorWhilePerforming triggerOnDown |
|
1230 |
hasMenuIndicator horizontalLayout isButton isMenuSlice translateLabel) |
|
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1231 |
|
4163 | 1232 |
" |
1233 |
self new literalArrayEncoding |
|
1234 |
self new ignoreMnemonicKeys:true; literalArrayEncoding |
|
1235 |
(self new ignoreMnemonicKeys:true; literalArrayEncoding) decodeAsLiteralArray |
|
1236 |
" |
|
1237 |
||
4162 | 1238 |
"Created: / 09-08-2018 / 17:24:19 / Claus Gittinger" |
1643
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1239 |
! ! |
e1148c53ad3c
got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents:
1625
diff
changeset
|
1240 |
|
1329 | 1241 |
!MenuItem methodsFor:'printing & storing'! |
1242 |
||
2736 | 1243 |
printOn:aStream |
1244 |
aStream nextPutAll:self classNameWithArticle. |
|
1245 |
aStream nextPutAll:'('. |
|
1246 |
aStream nextPutAll:label storeString. |
|
1247 |
aStream nextPutAll:')' |
|
1329 | 1248 |
! ! |
1249 |
||
1761 | 1250 |
!MenuItem methodsFor:'private-accessing'! |
458 | 1251 |
|
973 | 1252 |
filteredLabel |
1253 |
"return the label without any &-chars" |
|
1254 |
||
3212 | 1255 |
|rawLabel l in out c emp e| |
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1256 |
|
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1257 |
rawLabel := self rawLabel. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1258 |
rawLabel isString ifFalse:[^ rawLabel]. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1259 |
|
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1260 |
"/ be careful to preserve any emphasis ... |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1261 |
"/ bad kludge ... |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1262 |
rawLabel isText ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1263 |
emp := RunArray new. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1264 |
]. |
973 | 1265 |
|
1266 |
out := WriteStream on:''. |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1267 |
in := rawLabel readStream. |
973 | 1268 |
[in atEnd] whileFalse:[ |
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1269 |
emp notNil ifTrue:[ |
3212 | 1270 |
e := rawLabel emphasisAt:(in position + 1). |
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1271 |
]. |
973 | 1272 |
c := in next. |
2040 | 1273 |
c bitsPerCharacter > out collection bitsPerCharacter ifTrue:[ |
1274 |
out setCollection:(c stringSpecies fromString:out collection). |
|
1275 |
]. |
|
973 | 1276 |
c == $& ifTrue:[ |
1277 |
in peek == $& ifTrue:[ |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1278 |
out nextPut:c. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1279 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1280 |
emp add:e |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1281 |
] |
973 | 1282 |
] |
1283 |
] ifFalse:[ |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1284 |
out nextPut:c. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1285 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1286 |
emp add:e |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1287 |
] |
973 | 1288 |
] |
1289 |
]. |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1290 |
l := out contents. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1291 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1292 |
^ Text string:l emphasisCollection:emp |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1293 |
]. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1294 |
^ l. |
973 | 1295 |
|
1296 |
"Created: / 19.6.1998 / 00:02:10 / cg" |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
1297 |
"Modified: / 20.6.1998 / 17:15:18 / cg" |
458 | 1298 |
! ! |
1299 |
||
579 | 1300 |
!MenuItem methodsFor:'queries'! |
1301 |
||
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1302 |
hasChoice |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1303 |
"test whether choice exists |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1304 |
" |
4159 | 1305 |
^ self choice notNil |
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1306 |
|
4159 | 1307 |
"Created: / 14-08-1998 / 14:34:29 / cg" |
1308 |
"Modified (format): / 09-08-2018 / 16:50:14 / Claus Gittinger" |
|
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1309 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1310 |
|
590 | 1311 |
hasIndication |
1312 |
"test whether indication on/off exists |
|
1313 |
" |
|
2875 | 1314 |
^ self indication notNil |
1315 |
||
1316 |
"Modified: / 28-10-2010 / 23:30:52 / cg" |
|
590 | 1317 |
! |
1318 |
||
579 | 1319 |
hasSubmenu |
584 | 1320 |
^ self submenu notNil |
579 | 1321 |
|
1322 |
"Created: 25.2.1997 / 20:56:20 / cg" |
|
1323 |
! |
|
1324 |
||
1325 |
isEnabled |
|
581 | 1326 |
^ enabled value ? true |
579 | 1327 |
|
1328 |
"Created: 25.2.1997 / 19:39:17 / cg" |
|
590 | 1329 |
! |
1330 |
||
724 | 1331 |
isHidden |
1332 |
"not yet supported" |
|
1333 |
||
1334 |
^ false |
|
1335 |
||
1336 |
"Created: / 27.10.1997 / 15:13:43 / cg" |
|
1337 |
! |
|
1338 |
||
1648 | 1339 |
isMenuItem |
1340 |
^ true |
|
1341 |
! |
|
1342 |
||
590 | 1343 |
isOff |
1344 |
"test whether indication on/off exists and is off |
|
1345 |
" |
|
1346 |
|indication| |
|
1347 |
||
1348 |
indication := self indication. |
|
2875 | 1349 |
^ indication value == false |
1350 |
||
1351 |
"Modified: / 28-10-2010 / 23:30:57 / cg" |
|
590 | 1352 |
! |
1353 |
||
1354 |
isOn |
|
1355 |
"test whether indication on/off exists and is on |
|
1356 |
" |
|
1357 |
|indication| |
|
1358 |
||
1359 |
indication := self indication. |
|
2875 | 1360 |
^ indication value == true |
1361 |
||
1362 |
"Modified: / 28-10-2010 / 23:31:02 / cg" |
|
2122 | 1363 |
! |
1364 |
||
1365 |
isSeparatorItem |
|
1366 |
^ #('' '-' '=') includes:label |
|
1367 |
||
1368 |
"Created: 25.2.1997 / 19:39:17 / cg" |
|
579 | 1369 |
! ! |
1370 |
||
2966
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1371 |
!MenuItem methodsFor:'utilities'! |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1372 |
|
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1373 |
replaceArgument: oldValue with: newValue |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1374 |
|
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1375 |
"Recusively Replace argument in menu items where |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1376 |
current argument is equal to oldValue by newValue" |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1377 |
|
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1378 |
argument = oldValue ifTrue:[ |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1379 |
argument := newValue. |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1380 |
]. |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1381 |
submenu notNil ifTrue:[ |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1382 |
submenu replaceArgument: oldValue with: newValue |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1383 |
]. |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1384 |
|
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1385 |
"Created: / 12-10-2011 / 20:12:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1386 |
! ! |
5f538729ab69
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2939
diff
changeset
|
1387 |
|
451 | 1388 |
!MenuItem class methodsFor:'documentation'! |
1389 |
||
1390 |
version |
|
3843 | 1391 |
^ '$Header$' |
2755 | 1392 |
! |
1393 |
||
1394 |
version_CVS |
|
3843 | 1395 |
^ '$Header$' |
451 | 1396 |
! ! |
3178 | 1397 |
|
4159 | 1398 |
|
1399 |
MenuItem initialize! |