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