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