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