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