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