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