author | Claus Gittinger <cg@exept.de> |
Tue, 05 Sep 2000 14:44:17 +0200 | |
changeset 1403 | 94f9ec117aa5 |
parent 1401 | 0fda9891ba4a |
child 1409 | d51c83a4268c |
permissions | -rw-r--r-- |
1196 | 1 |
" |
2 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
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 |
|
451 | 16 |
Object subclass:#MenuItem |
752 | 17 |
instanceVariableNames:'activeHelpKey enabled label value nameKey adornment |
1328 | 18 |
translateLabel isButton startGroup isVisible hideMenuOnActivated' |
451 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Views-Support' |
|
22 |
! |
|
23 |
||
24 |
Object subclass:#MenuItemAdornment |
|
666 | 25 |
instanceVariableNames:'color indication submenu submenuChannel shortcutKey labelText |
1213 | 26 |
labelImage accessCharacterPosition argument choice choiceValue |
1370 | 27 |
font auxValue showBusyCursorWhilePerforming keepLinkedMenu' |
451 | 28 |
classVariableNames:'' |
29 |
poolDictionaries:'' |
|
30 |
privateIn:MenuItem |
|
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 |
" |
|
52 |
not yet finished MenuItem class - this will eventually replace |
|
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 |
||
58 |
[author:] |
|
59 |
Claus Gittinger |
|
60 |
||
61 |
[see also:] |
|
62 |
MenuItem |
|
63 |
PopUpMenu |
|
64 |
" |
|
65 |
||
66 |
! ! |
|
67 |
||
490 | 68 |
!MenuItem class methodsFor:'instance creation'! |
69 |
||
1044 | 70 |
label:aString |
71 |
"create and return a new menuItem, given a label string" |
|
72 |
||
73 |
^ self new label:aString |
|
74 |
||
75 |
"Modified: / 4.8.1998 / 17:33:13 / cg" |
|
76 |
"Created: / 14.8.1998 / 19:19:14 / cg" |
|
77 |
! |
|
78 |
||
1030
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
79 |
label:labelString value:selectorOrValue |
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
80 |
"create and return a new menuItem, given its label and value" |
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
81 |
|
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
82 |
^ (self new) label:labelString; value:selectorOrValue; yourself |
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
83 |
|
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
84 |
"Created: / 4.8.1998 / 17:34:18 / cg" |
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
85 |
! |
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
86 |
|
490 | 87 |
labeled:aString |
1030
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
88 |
"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
|
89 |
|
490 | 90 |
^ self new label:aString |
1030
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
91 |
|
3684379a1ac8
added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
92 |
"Modified: / 4.8.1998 / 17:33:13 / cg" |
490 | 93 |
! ! |
94 |
||
1306 | 95 |
!MenuItem methodsFor:'Compatibility - ST80'! |
724 | 96 |
|
97 |
isEnabled:aBoolean |
|
98 |
self enabled:aBoolean |
|
99 |
||
100 |
"Created: / 27.10.1997 / 16:34:55 / cg" |
|
101 |
! ! |
|
102 |
||
451 | 103 |
!MenuItem methodsFor:'accessing'! |
104 |
||
579 | 105 |
accessCharacterPosition |
106 |
"get the index of the access character in the label text or string, or nil if none |
|
107 |
" |
|
108 |
adornment notNil ifTrue:[ |
|
109 |
^ adornment accessCharacterPosition |
|
110 |
]. |
|
111 |
^ nil |
|
451 | 112 |
! |
113 |
||
579 | 114 |
accessCharacterPosition:index |
115 |
"set the index of the access character in the label text or string, or nil if none |
|
116 |
" |
|
117 |
(index isNil and:[adornment isNil]) ifFalse:[ |
|
118 |
self adornment accessCharacterPosition:index |
|
119 |
] |
|
451 | 120 |
! |
121 |
||
640 | 122 |
activeHelpKey |
123 |
^ activeHelpKey |
|
124 |
! |
|
125 |
||
126 |
activeHelpKey:aKey |
|
127 |
activeHelpKey := aKey |
|
128 |
! |
|
129 |
||
684 | 130 |
argument |
131 |
"get argument given to the value (selector) |
|
132 |
" |
|
133 |
adornment notNil ifTrue:[ |
|
134 |
^ adornment argument |
|
135 |
]. |
|
136 |
^ nil |
|
137 |
! |
|
138 |
||
139 |
argument:something |
|
140 |
"set argument given to the value (selector) |
|
141 |
" |
|
142 |
|arg| |
|
143 |
||
144 |
(arg := something) notNil ifTrue:[ |
|
145 |
arg isString ifTrue:[ |
|
146 |
(arg size == 0 or:[(arg indexOfNonSeparatorStartingAt:1) == 0]) ifTrue:[ |
|
147 |
arg := nil |
|
148 |
] |
|
149 |
] |
|
150 |
]. |
|
151 |
||
152 |
(arg isNil and:[adornment isNil]) ifFalse:[ |
|
153 |
self adornment argument:arg |
|
154 |
] |
|
155 |
! |
|
156 |
||
1213 | 157 |
auxValue |
158 |
"an additional, arbitrary value" |
|
159 |
||
160 |
adornment notNil ifTrue:[ |
|
161 |
^ adornment auxValue |
|
162 |
]. |
|
163 |
^ nil |
|
164 |
! |
|
165 |
||
166 |
auxValue:something |
|
167 |
"set the auxValue - an arbitrary user value |
|
168 |
" |
|
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
169 |
(something notNil or:[adornment notNil]) ifTrue:[ |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
170 |
self adornment auxValue:something |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
171 |
] |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
172 |
|
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
173 |
"Modified: / 4.2.2000 / 12:38:44 / cg" |
1213 | 174 |
! |
175 |
||
1360 | 176 |
font |
177 |
"get the specific font for an item or nil |
|
178 |
" |
|
179 |
adornment notNil ifTrue:[ |
|
180 |
^ adornment font |
|
181 |
]. |
|
182 |
^ nil |
|
183 |
! |
|
184 |
||
185 |
font:aFont |
|
186 |
"set the index of the access character in the label text or string, or nil if none |
|
187 |
" |
|
188 |
||
189 |
(aFont isNil and:[adornment isNil]) ifFalse:[ |
|
190 |
self adornment font:aFont |
|
191 |
] |
|
192 |
! |
|
193 |
||
1328 | 194 |
hideMenuOnActivated |
195 |
"hide the menu when the item was activated; the default is true |
|
196 |
" |
|
197 |
^ hideMenuOnActivated ? true |
|
198 |
||
199 |
! |
|
200 |
||
201 |
hideMenuOnActivated:aBool |
|
202 |
"hide the menu when the item was activated; the default is true |
|
203 |
" |
|
204 |
hideMenuOnActivated := aBool ? true |
|
205 |
||
206 |
! |
|
207 |
||
798 | 208 |
isVisible |
209 |
^ isVisible ? true |
|
210 |
! |
|
211 |
||
212 |
isVisible:something |
|
213 |
isVisible := something |
|
214 |
! |
|
215 |
||
1370 | 216 |
keepLinkedMenu |
217 |
"an additional, arbitrary value" |
|
218 |
||
219 |
adornment notNil ifTrue:[ |
|
220 |
^ adornment keepLinkedMenu |
|
221 |
]. |
|
222 |
^ false |
|
223 |
! |
|
224 |
||
225 |
keepLinkedMenu:aBoolean |
|
226 |
"set the keepLinkedMenu |
|
227 |
" |
|
228 |
adornment notNil ifTrue:[ |
|
229 |
adornment keepLinkedMenu:aBoolean. |
|
230 |
] ifFalse:[ |
|
231 |
aBoolean == true ifTrue:[ |
|
232 |
"/ the default is false |
|
233 |
self adornment keepLinkedMenu:true |
|
234 |
] |
|
235 |
]. |
|
236 |
! |
|
237 |
||
451 | 238 |
label |
973 | 239 |
^ self filteredLabel "/ label |
451 | 240 |
|
973 | 241 |
"Created: / 25.2.1997 / 19:48:16 / cg" |
242 |
"Modified: / 19.6.1998 / 00:02:55 / cg" |
|
451 | 243 |
! |
244 |
||
453 | 245 |
label:aString |
246 |
label := aString |
|
247 |
||
248 |
"Created: 25.2.1997 / 19:55:16 / cg" |
|
249 |
! |
|
250 |
||
581 | 251 |
labelImage |
252 |
"gets the labelImage |
|
253 |
" |
|
254 |
adornment notNil ifTrue:[ |
|
584 | 255 |
^ adornment labelImage value |
581 | 256 |
]. |
257 |
^ nil |
|
258 |
! |
|
259 |
||
260 |
labelImage:aResourceRetriever |
|
261 |
"set the labelImage |
|
262 |
" |
|
263 |
aResourceRetriever notNil ifTrue:[ |
|
264 |
self adornment labelImage:aResourceRetriever |
|
265 |
] |
|
266 |
! |
|
267 |
||
578 | 268 |
nameKey |
269 |
^ nameKey |
|
270 |
||
271 |
||
272 |
! |
|
273 |
||
274 |
nameKey:aNameKey |
|
579 | 275 |
nameKey := aNameKey. |
578 | 276 |
|
277 |
||
278 |
! |
|
279 |
||
490 | 280 |
rawLabel |
281 |
^ label |
|
282 |
||
283 |
"Created: 25.2.1997 / 19:48:16 / cg" |
|
284 |
! |
|
285 |
||
451 | 286 |
rawLabel:aString |
287 |
label := aString |
|
288 |
||
289 |
"Created: 25.2.1997 / 19:11:02 / cg" |
|
290 |
! |
|
291 |
||
490 | 292 |
shortcutKeyCharacter |
293 |
"ignored for now" |
|
294 |
||
578 | 295 |
adornment notNil ifTrue:[ |
296 |
^ adornment shortcutKeyCharacter |
|
297 |
]. |
|
490 | 298 |
^ nil |
299 |
! |
|
300 |
||
578 | 301 |
shortcutKeyCharacter:aKey |
302 |
"set the key to press to select the menu item from the keyboard |
|
303 |
" |
|
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
304 |
(aKey notNil or:[adornment notNil]) ifTrue:[ |
579 | 305 |
self adornment shortcutKeyCharacter:aKey |
306 |
] |
|
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
307 |
|
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
308 |
"Modified: / 4.2.2000 / 12:39:30 / cg" |
578 | 309 |
! |
310 |
||
1347
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
311 |
showBusyCursorWhilePerforming |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
312 |
"get the flag which controls if a busy cursor is to be shown |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
313 |
while performing the menu action. Defaults to false." |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
314 |
|
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
315 |
adornment notNil ifTrue:[ |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
316 |
^ adornment showBusyCursorWhilePerforming |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
317 |
]. |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
318 |
^ nil |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
319 |
! |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
320 |
|
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
321 |
showBusyCursorWhilePerforming:aBoolean |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
322 |
"set/clear the flag which controls if a busy cursor is to be shown |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
323 |
while performing the menu action. Defaults to false." |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
324 |
|
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
325 |
((aBoolean == true) or:[adornment notNil]) ifTrue:[ |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
326 |
self adornment showBusyCursorWhilePerforming:aBoolean |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
327 |
] |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
328 |
! |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
329 |
|
794 | 330 |
startGroup |
331 |
"start group #left #right #center ... or nil |
|
332 |
at the moment only #right is implemented |
|
333 |
" |
|
334 |
^ startGroup |
|
335 |
! |
|
336 |
||
337 |
startGroup:aSymbol |
|
338 |
"start group #left #right #center ... |
|
339 |
at the moment only #right is implemented |
|
340 |
" |
|
341 |
(startGroup isNil or:[startGroup == #right]) ifTrue:[ |
|
342 |
startGroup := aSymbol |
|
343 |
] ifFalse:[ |
|
344 |
self warn:('not supported group: ', aSymbol printString ). |
|
345 |
] |
|
346 |
! |
|
347 |
||
458 | 348 |
submenu |
578 | 349 |
adornment notNil ifTrue:[ |
350 |
^ adornment submenu |
|
351 |
]. |
|
352 |
^ nil |
|
458 | 353 |
|
354 |
"Created: 25.2.1997 / 20:57:24 / cg" |
|
355 |
! |
|
356 |
||
357 |
submenu:aMenu |
|
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
358 |
(aMenu notNil or:[adornment notNil]) ifTrue:[ |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
359 |
self adornment submenu:aMenu |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
360 |
] |
458 | 361 |
|
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
362 |
"Created: / 25.2.1997 / 20:56:20 / cg" |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
363 |
"Modified: / 4.2.2000 / 12:40:02 / cg" |
458 | 364 |
! |
365 |
||
666 | 366 |
submenuChannel |
367 |
adornment notNil ifTrue:[ |
|
368 |
^ adornment submenuChannel |
|
369 |
]. |
|
370 |
^ nil |
|
371 |
! |
|
372 |
||
373 |
submenuChannel:something |
|
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
374 |
(something notNil or:[adornment notNil]) ifTrue:[ |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
375 |
self adornment submenuChannel:something |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
376 |
] |
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
377 |
|
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
378 |
"Modified: / 4.2.2000 / 12:40:19 / cg" |
666 | 379 |
! |
380 |
||
451 | 381 |
value |
382 |
^ value |
|
383 |
||
384 |
"Created: 25.2.1997 / 19:50:14 / cg" |
|
385 |
! |
|
386 |
||
387 |
value:something |
|
388 |
value := something |
|
389 |
||
390 |
"Created: 25.2.1997 / 19:11:13 / cg" |
|
391 |
! ! |
|
392 |
||
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
393 |
!MenuItem methodsFor:'accessing-behavior'! |
579 | 394 |
|
590 | 395 |
beOff |
396 |
"set indication off |
|
397 |
" |
|
398 |
self indication:false |
|
399 |
! |
|
400 |
||
401 |
beOn |
|
402 |
"set indication on |
|
403 |
" |
|
404 |
self indication:true |
|
405 |
! |
|
406 |
||
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
407 |
choice |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
408 |
"return the menu items choice indicator (RadioButton) |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
409 |
" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
410 |
adornment notNil ifTrue:[ |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
411 |
^ adornment choice |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
412 |
]. |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
413 |
^ nil |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
414 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
415 |
"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
|
416 |
"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
|
417 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
418 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
419 |
choice:aChoice |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
420 |
"set the menu items choice indicator (RadioButton) |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
421 |
" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
422 |
(aChoice notNil or:[adornment notNil]) ifTrue:[ |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
423 |
self adornment choice:aChoice. |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
424 |
]. |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
425 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
426 |
"Created: / 14.8.1998 / 15:11:17 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
427 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
428 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
429 |
choiceValue |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
430 |
"return the menu items choiceValue (RadioButton) |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
431 |
" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
432 |
adornment notNil ifTrue:[ |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
433 |
^ adornment choiceValue |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
434 |
]. |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
435 |
^ nil |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
436 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
437 |
"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
|
438 |
"Created: / 14.8.1998 / 15:38:05 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
439 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
440 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
441 |
choiceValue:something |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
442 |
"set the menu items choiceValue (RadioButton) |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
443 |
" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
444 |
(something notNil or:[adornment notNil]) ifTrue:[ |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
445 |
self adornment choiceValue:something. |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
446 |
]. |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
447 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
448 |
"Created: / 14.8.1998 / 15:39:12 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
449 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
450 |
|
579 | 451 |
disable |
452 |
enabled := false |
|
453 |
||
454 |
"Created: 25.2.1997 / 19:39:09 / cg" |
|
455 |
! |
|
456 |
||
457 |
enable |
|
458 |
enabled := true |
|
459 |
||
460 |
"Created: 25.2.1997 / 19:39:00 / cg" |
|
461 |
! |
|
462 |
||
581 | 463 |
enabled |
464 |
"returns a boolean, valueHolder or block |
|
465 |
" |
|
466 |
^ enabled |
|
467 |
! |
|
579 | 468 |
|
581 | 469 |
enabled:something |
470 |
"a boolean, valueHolder or block |
|
471 |
" |
|
472 |
enabled := something |
|
590 | 473 |
! |
474 |
||
475 |
indication |
|
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
476 |
"return the menu items on/off indicator (CheckToggle) |
590 | 477 |
" |
478 |
adornment notNil ifTrue:[ |
|
479 |
^ adornment indication |
|
480 |
]. |
|
481 |
^ nil |
|
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
482 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
483 |
"Modified: / 14.8.1998 / 15:11:37 / cg" |
590 | 484 |
! |
485 |
||
486 |
indication:anIndication |
|
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
487 |
"set the menu items an on/off indicator (CheckToggle) |
590 | 488 |
" |
489 |
(anIndication notNil or:[adornment notNil]) ifTrue:[ |
|
490 |
self adornment indication:anIndication. |
|
491 |
]. |
|
492 |
||
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
493 |
"Modified: / 14.8.1998 / 15:11:25 / cg" |
752 | 494 |
! |
495 |
||
496 |
isButton |
|
497 |
"returns whether item looks like a Button |
|
498 |
" |
|
499 |
^isButton ? false |
|
500 |
||
501 |
||
502 |
! |
|
503 |
||
504 |
isButton:anBoolean |
|
505 |
"sets whether item looks like a Button |
|
506 |
" |
|
507 |
isButton := anBoolean |
|
508 |
||
509 |
||
510 |
! |
|
511 |
||
512 |
translateLabel |
|
513 |
"returns whether label is translated |
|
514 |
" |
|
515 |
^translateLabel ? false |
|
516 |
||
517 |
||
518 |
! |
|
519 |
||
520 |
translateLabel:anBoolean |
|
521 |
"sets whether label is translated |
|
522 |
" |
|
523 |
translateLabel := anBoolean |
|
524 |
||
525 |
||
581 | 526 |
! ! |
527 |
||
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
528 |
!MenuItem methodsFor:'accessing-resource'! |
581 | 529 |
|
584 | 530 |
findGuiResourcesIn:aResourceContainerOrApplication |
581 | 531 |
"setup a resource container |
532 |
" |
|
960
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
533 |
|lblImg m| |
581 | 534 |
|
752 | 535 |
self translateLabel ifTrue:[ |
536 |
label := ResourceRetriever findResourceLabel: label in: aResourceContainerOrApplication |
|
537 |
]. |
|
538 |
||
584 | 539 |
adornment notNil ifTrue:[ |
752 | 540 |
(lblImg := adornment labelImage) notNil ifTrue:[ |
541 |
lblImg findGuiResourcesIn:aResourceContainerOrApplication. |
|
542 |
lblImg labelText notNil ifTrue: [lblImg labelText: label]. |
|
543 |
]. |
|
960
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
544 |
(m := adornment submenu) notNil ifTrue:[ |
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
545 |
m := m value. |
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
546 |
m notNil ifTrue:[ |
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
547 |
m findGuiResourcesIn:aResourceContainerOrApplication |
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
548 |
] |
752 | 549 |
]. |
581 | 550 |
] |
960
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
551 |
|
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
552 |
"Modified: / 18.6.1998 / 16:54:25 / cg" |
1401
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
553 |
! |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
554 |
|
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
555 |
findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
556 |
"setup a resource container |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
557 |
" |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
558 |
|lblImg m| |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
559 |
|
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
560 |
self translateLabel ifTrue:[ |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
561 |
label := ResourceRetriever |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
562 |
findResourceLabel:label |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
563 |
in:aResourceContainerOrApplication |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
564 |
rememberResourcesIn:aValueHolderOrNil |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
565 |
]. |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
566 |
|
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
567 |
adornment notNil ifTrue:[ |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
568 |
(lblImg := adornment labelImage) notNil ifTrue:[ |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
569 |
lblImg findGuiResourcesIn:aResourceContainerOrApplication. |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
570 |
lblImg labelText notNil ifTrue: [lblImg labelText: label]. |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
571 |
]. |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
572 |
(m := adornment submenu) notNil ifTrue:[ |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
573 |
m := m value. |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
574 |
m notNil ifTrue:[ |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
575 |
m findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
576 |
] |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
577 |
]. |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
578 |
] |
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
579 |
|
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
580 |
"Modified: / 18.6.1998 / 16:54:25 / cg" |
579 | 581 |
! ! |
582 |
||
451 | 583 |
!MenuItem methodsFor:'converting'! |
584 |
||
585 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
|
586 |
"read my contents from a aLiteralEncodedArray" |
|
587 |
||
1202 | 588 |
|selector value| |
589 |
||
451 | 590 |
2 to:aLiteralEncodedArray size by:2 do:[:i | |
591 |
selector := aLiteralEncodedArray at:i. |
|
1203 | 592 |
value := (aLiteralEncodedArray at:i+1). |
593 |
selector == #argument: ifFalse:[ |
|
594 |
value := value decodeAsLiteralArray |
|
595 |
]. |
|
581 | 596 |
self perform:selector with:value |
451 | 597 |
]. |
598 |
||
599 |
" |
|
578 | 600 |
#( #MenuItem #rawLabel: 'left' #nameKey: 'identifier' #value: #left ) |
451 | 601 |
decodeAsLiteralArray |
602 |
" |
|
603 |
||
1333
423b4b4404c4
avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents:
1329
diff
changeset
|
604 |
"Modified: / 4.2.2000 / 12:50:28 / cg" |
490 | 605 |
! |
606 |
||
607 |
literalArrayEncoding |
|
608 |
"return myself encoded as a literal array" |
|
609 |
||
581 | 610 |
|coll something| |
490 | 611 |
|
612 |
coll := OrderedCollection new. |
|
613 |
coll add:#MenuItem. |
|
581 | 614 |
|
615 |
label notNil ifTrue:[ |
|
616 |
coll add:#label: ; add:(label literalArrayEncoding) |
|
617 |
]. |
|
752 | 618 |
self translateLabel ifTrue:[ |
1328 | 619 |
coll add:#translateLabel: ; add:true |
752 | 620 |
]. |
621 |
self isButton ifTrue:[ |
|
1328 | 622 |
coll add:#isButton:; add:true |
623 |
]. |
|
624 |
hideMenuOnActivated == false ifTrue:[ |
|
625 |
coll add:#hideMenuOnActivated: ; add:false |
|
752 | 626 |
]. |
581 | 627 |
nameKey notNil ifTrue:[ |
628 |
coll add:#nameKey: ; add:(nameKey literalArrayEncoding) |
|
629 |
]. |
|
798 | 630 |
isVisible notNil ifTrue:[ |
631 |
isVisible ~~ true ifTrue:[ |
|
632 |
coll add:#isVisible: ; add:(isVisible literalArrayEncoding) |
|
633 |
] |
|
634 |
]. |
|
794 | 635 |
startGroup notNil ifTrue:[ |
636 |
coll add:#startGroup: ; add:(startGroup literalArrayEncoding) |
|
637 |
]. |
|
638 |
||
579 | 639 |
value notNil ifTrue:[ |
640 |
coll add:#value: ; add:(value literalArrayEncoding). |
|
641 |
]. |
|
653 | 642 |
activeHelpKey notNil ifTrue:[ |
643 |
coll add:#activeHelpKey: ; add:(activeHelpKey literalArrayEncoding). |
|
644 |
]. |
|
645 |
(something := self enabled) notNil ifTrue:[ |
|
646 |
coll add:#enabled: ; add:(enabled literalArrayEncoding). |
|
579 | 647 |
]. |
648 |
||
653 | 649 |
adornment notNil ifTrue:[ |
650 |
(something := self shortcutKeyCharacter) notNil ifTrue:[ |
|
651 |
coll add:#shortcutKeyCharacter: ; add:(something literalArrayEncoding) |
|
652 |
]. |
|
1360 | 653 |
(something := self font) notNil ifTrue:[ |
654 |
coll add:#font: ; add:(something literalArrayEncoding) |
|
655 |
]. |
|
653 | 656 |
|
657 |
(something := self accessCharacterPosition) notNil ifTrue:[ |
|
658 |
coll add:#accessCharacterPosition: ; add:(something literalArrayEncoding) |
|
659 |
]. |
|
660 |
||
1347
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
661 |
(something := self showBusyCursorWhilePerforming) == true ifTrue:[ |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
662 |
coll add:#showBusyCursorWhilePerforming: ; add:(something literalArrayEncoding) |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
663 |
]. |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
664 |
|
684 | 665 |
(something := self argument) notNil ifTrue:[ |
666 |
coll add:#argument: ; add:(something literalArrayEncoding) |
|
667 |
]. |
|
668 |
||
661 | 669 |
adornment labelImage notNil ifTrue:[ |
653 | 670 |
coll add:#labelImage: ; add:(adornment labelImage literalArrayEncoding) |
671 |
]. |
|
672 |
(something := self indication) notNil ifTrue:[ |
|
673 |
coll add:#indication: ; add:(something literalArrayEncoding) |
|
666 | 674 |
]. |
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
675 |
(something := self choice) notNil ifTrue:[ |
1369
281acc9f1a73
dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents:
1360
diff
changeset
|
676 |
coll add:#choice: ; add:(something literalArrayEncoding). |
281acc9f1a73
dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents:
1360
diff
changeset
|
677 |
|
281acc9f1a73
dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents:
1360
diff
changeset
|
678 |
(something := self choiceValue) notNil ifTrue:[ |
281acc9f1a73
dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents:
1360
diff
changeset
|
679 |
coll add:#choiceValue: ; add:(something literalArrayEncoding) |
281acc9f1a73
dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents:
1360
diff
changeset
|
680 |
]. |
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
681 |
]. |
1213 | 682 |
(something := self auxValue) notNil ifTrue:[ |
683 |
coll add:#auxValue: ; add:(something literalArrayEncoding) |
|
684 |
]. |
|
579 | 685 |
|
666 | 686 |
(something := self submenuChannel) notNil ifTrue:[ |
1370 | 687 |
coll add:#submenuChannel: ; add:(something literalArrayEncoding). |
688 |
||
689 |
(something := self keepLinkedMenu) ifTrue:[ |
|
690 |
coll add:#keepLinkedMenu: ; add:true |
|
691 |
] |
|
666 | 692 |
]. |
693 |
||
694 |
self hasSubmenu ifTrue:[ |
|
695 |
coll add:#submenu:; add:(self submenu literalArrayEncoding) |
|
696 |
]. |
|
581 | 697 |
]. |
653 | 698 |
|
579 | 699 |
^ coll asArray |
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
700 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
701 |
"Modified: / 14.8.1998 / 15:44:53 / cg" |
451 | 702 |
! ! |
703 |
||
1329 | 704 |
!MenuItem methodsFor:'printing & storing'! |
705 |
||
706 |
displayString |
|
707 |
^ self classNameWithArticle , '(' , label storeString , ')' |
|
708 |
! ! |
|
709 |
||
458 | 710 |
!MenuItem methodsFor:'private - accessing'! |
711 |
||
712 |
adornment |
|
713 |
adornment isNil ifTrue:[ |
|
714 |
adornment := MenuItemAdornment new |
|
715 |
]. |
|
716 |
^ adornment |
|
717 |
||
718 |
"Created: 25.2.1997 / 20:57:05 / cg" |
|
973 | 719 |
! |
720 |
||
721 |
filteredLabel |
|
722 |
"return the label without any &-chars" |
|
723 |
||
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
724 |
|rawLabel l in out c pos emp e| |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
725 |
|
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
726 |
rawLabel := self rawLabel. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
727 |
rawLabel isString ifFalse:[^ rawLabel]. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
728 |
|
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
729 |
"/ be careful to preserve any emphasis ... |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
730 |
"/ bad kludge ... |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
731 |
rawLabel isText ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
732 |
emp := RunArray new. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
733 |
]. |
973 | 734 |
|
735 |
out := WriteStream on:''. |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
736 |
in := rawLabel readStream. |
973 | 737 |
[in atEnd] whileFalse:[ |
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
738 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
739 |
e := rawLabel emphasisAt:(in position). |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
740 |
]. |
973 | 741 |
c := in next. |
742 |
c == $& ifTrue:[ |
|
743 |
in peek == $& ifTrue:[ |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
744 |
out nextPut:c. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
745 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
746 |
emp add:e |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
747 |
] |
973 | 748 |
] |
749 |
] ifFalse:[ |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
750 |
out nextPut:c. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
751 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
752 |
emp add:e |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
753 |
] |
973 | 754 |
] |
755 |
]. |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
756 |
l := out contents. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
757 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
758 |
^ Text string:l emphasisCollection:emp |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
759 |
]. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
760 |
^ l. |
973 | 761 |
|
762 |
"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
|
763 |
"Modified: / 20.6.1998 / 17:15:18 / cg" |
458 | 764 |
! ! |
765 |
||
579 | 766 |
!MenuItem methodsFor:'queries'! |
767 |
||
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
768 |
hasChoice |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
769 |
"test whether choice exists |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
770 |
" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
771 |
^ self choice notNil |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
772 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
773 |
"Created: / 14.8.1998 / 14:34:29 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
774 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
775 |
|
590 | 776 |
hasIndication |
777 |
"test whether indication on/off exists |
|
778 |
" |
|
779 |
^ self indication notNil |
|
780 |
! |
|
781 |
||
579 | 782 |
hasSubmenu |
584 | 783 |
^ self submenu notNil |
579 | 784 |
|
785 |
"Created: 25.2.1997 / 20:56:20 / cg" |
|
786 |
! |
|
787 |
||
788 |
isEnabled |
|
581 | 789 |
^ enabled value ? true |
579 | 790 |
|
791 |
"Created: 25.2.1997 / 19:39:17 / cg" |
|
590 | 792 |
! |
793 |
||
724 | 794 |
isHidden |
795 |
"not yet supported" |
|
796 |
||
797 |
^ false |
|
798 |
||
799 |
"Created: / 27.10.1997 / 15:13:43 / cg" |
|
800 |
! |
|
801 |
||
590 | 802 |
isOff |
803 |
"test whether indication on/off exists and is off |
|
804 |
" |
|
805 |
|indication| |
|
806 |
||
807 |
indication := self indication. |
|
808 |
^ indication value == false |
|
809 |
! |
|
810 |
||
811 |
isOn |
|
812 |
"test whether indication on/off exists and is on |
|
813 |
" |
|
814 |
|indication| |
|
815 |
||
816 |
indication := self indication. |
|
817 |
^ indication value == true |
|
579 | 818 |
! ! |
819 |
||
458 | 820 |
!MenuItem::MenuItemAdornment methodsFor:'accessing'! |
821 |
||
579 | 822 |
accessCharacterPosition |
823 |
"return the value of the instance variable 'accessCharacterPosition' (automatically generated)" |
|
824 |
||
825 |
^ accessCharacterPosition! |
|
826 |
||
827 |
accessCharacterPosition:something |
|
828 |
"set the value of the instance variable 'accessCharacterPosition' (automatically generated)" |
|
829 |
||
830 |
accessCharacterPosition := something.! |
|
831 |
||
684 | 832 |
argument |
833 |
"return the value of the instance variable 'argument' (automatically generated)" |
|
834 |
||
835 |
^ argument |
|
836 |
||
837 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
838 |
! |
|
839 |
||
840 |
argument:something |
|
841 |
"set the value of the instance variable 'argument' (automatically generated)" |
|
842 |
||
843 |
argument := something. |
|
844 |
||
845 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
846 |
! |
|
847 |
||
1213 | 848 |
auxValue |
849 |
"return the value of the instance variable 'auxValue' (automatically generated)" |
|
850 |
||
851 |
^ auxValue! |
|
852 |
||
853 |
auxValue:something |
|
854 |
"set the value of the instance variable 'auxValue' (automatically generated)" |
|
855 |
||
856 |
auxValue := something.! |
|
857 |
||
1041
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
858 |
choice |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
859 |
"return the value of the instance variable 'choice' (automatically generated)" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
860 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
861 |
^ choice |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
862 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
863 |
"Created: / 14.8.1998 / 14:32:06 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
864 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
865 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
866 |
choice:something |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
867 |
"set the value of the instance variable 'choice' (automatically generated)" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
868 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
869 |
choice := something. |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
870 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
871 |
"Created: / 14.8.1998 / 14:32:06 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
872 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
873 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
874 |
choiceValue |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
875 |
"return the value of the instance variable 'choiceValue' (automatically generated)" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
876 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
877 |
^ choiceValue |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
878 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
879 |
"Created: / 14.8.1998 / 15:39:26 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
880 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
881 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
882 |
choiceValue:something |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
883 |
"set the value of the instance variable 'choiceValue' (automatically generated)" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
884 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
885 |
choiceValue := something. |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
886 |
|
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
887 |
"Created: / 14.8.1998 / 15:39:26 / cg" |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
888 |
! |
d28f0375cd26
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
889 |
|
458 | 890 |
color |
891 |
"return the value of the instance variable 'color' (automatically generated)" |
|
892 |
||
893 |
^ color |
|
894 |
||
895 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
896 |
! |
|
897 |
||
898 |
color:something |
|
899 |
"set the value of the instance variable 'color' (automatically generated)" |
|
900 |
||
901 |
color := something. |
|
902 |
||
903 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
904 |
! |
|
905 |
||
1360 | 906 |
font |
907 |
"get the specific font for an item or nil |
|
908 |
" |
|
909 |
^ font |
|
910 |
! |
|
911 |
||
912 |
font:aFont |
|
913 |
"set a specific font for an item |
|
914 |
" |
|
915 |
font := aFont. |
|
916 |
! |
|
917 |
||
458 | 918 |
indication |
590 | 919 |
"test whether the menu item has an on/off indicator (CheckToggle) |
920 |
" |
|
458 | 921 |
^ indication |
922 |
||
923 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
924 |
! |
|
925 |
||
926 |
indication:something |
|
590 | 927 |
"test whether the menu item has an on/off indicator (CheckToggle) |
928 |
" |
|
458 | 929 |
indication := something. |
930 |
||
931 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
932 |
! |
|
933 |
||
1370 | 934 |
keepLinkedMenu |
935 |
"return the value of the instance variable 'keepLinkedMenu' (automatically generated)" |
|
936 |
||
937 |
^ keepLinkedMenu ? false |
|
938 |
! |
|
939 |
||
940 |
keepLinkedMenu:aBoolean |
|
941 |
"set the value of the instance variable 'keepLinkedMenu' (automatically generated)" |
|
942 |
||
943 |
keepLinkedMenu := aBoolean ? false. |
|
944 |
! |
|
945 |
||
581 | 946 |
labelImage |
947 |
"return the value of the instance variable 'labelImage' (automatically generated)" |
|
948 |
||
949 |
^ labelImage! |
|
950 |
||
951 |
labelImage:something |
|
952 |
"set the value of the instance variable 'labelImage' (automatically generated)" |
|
953 |
||
954 |
labelImage := something.! |
|
955 |
||
578 | 956 |
labelText |
957 |
"get the text appear as the menu label |
|
958 |
" |
|
959 |
^ labelText |
|
960 |
! |
|
961 |
||
962 |
labelText:something |
|
963 |
"set the text appear as the menu label |
|
964 |
" |
|
965 |
labelText := something. |
|
966 |
! |
|
967 |
||
968 |
shortcutKeyCharacter |
|
969 |
"get the key to press to select the menu item from the keyboard |
|
970 |
" |
|
971 |
^ shortcutKey |
|
972 |
! |
|
973 |
||
974 |
shortcutKeyCharacter:something |
|
975 |
"set the key to press to select the menu item from the keyboard |
|
976 |
" |
|
977 |
shortcutKey := something. |
|
978 |
! |
|
979 |
||
1347
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
980 |
showBusyCursorWhilePerforming |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
981 |
"get the flag which controls if a busy cursor is to be shown |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
982 |
while performing the menu action. Defaults to false." |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
983 |
|
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
984 |
^ showBusyCursorWhilePerforming ? false |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
985 |
|
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
986 |
! |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
987 |
|
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
988 |
showBusyCursorWhilePerforming:aBoolean |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
989 |
"set/clear the flag which controls if a busy cursor is to be shown |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
990 |
while performing the menu action. Defaults to false." |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
991 |
|
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
992 |
showBusyCursorWhilePerforming := aBoolean |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
993 |
|
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
994 |
! |
e033db194238
added 'showBysuCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
995 |
|
1336
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
996 |
staticSubmenu |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
997 |
"get the submenu or nil; |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
998 |
only returns the subMenu if its a static subMenu (i.e. not |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
999 |
provided by a valueHolder or block). |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1000 |
" |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1001 |
(submenu isValueModel or:[submenu isBlock]) ifTrue:[ |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1002 |
^ nil |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1003 |
]. |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1004 |
^ submenu |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1005 |
|
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1006 |
"Modified: / 5.2.2000 / 16:49:54 / cg" |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1007 |
! |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1008 |
|
458 | 1009 |
submenu |
578 | 1010 |
"get the submenu or nil |
1011 |
" |
|
973 | 1012 |
^ submenu value |
458 | 1013 |
|
973 | 1014 |
"Created: / 25.2.1997 / 20:59:28 / cg" |
1015 |
"Modified: / 19.6.1998 / 00:33:58 / cg" |
|
458 | 1016 |
! |
1017 |
||
1018 |
submenu:something |
|
578 | 1019 |
"set the submenu or nil |
1020 |
" |
|
1336
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1021 |
(something isValueModel or:[something isBlock]) ifTrue:[ |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1022 |
submenuChannel notNil ifTrue:[ |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1023 |
"/ programmers error ? |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1024 |
"/ how can I decide which one to use if there is both |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1025 |
"/ a channel and a subMenu ... |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1026 |
self halt:'overwriting submenuchannel'. |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1027 |
]. |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1028 |
submenuChannel := something |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1029 |
] ifFalse:[ |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1030 |
submenu := something. |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1031 |
] |
458 | 1032 |
|
1336
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1033 |
"Created: / 25.2.1997 / 20:59:28 / cg" |
97d0a2cff0ac
when setting a valueHolder or block via
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1034 |
"Modified: / 5.2.2000 / 16:53:28 / cg" |
666 | 1035 |
! |
1036 |
||
1037 |
submenuChannel |
|
1038 |
"get the submenuChannel or nil |
|
1039 |
" |
|
1040 |
^ submenuChannel |
|
1041 |
! |
|
1042 |
||
1043 |
submenuChannel:something |
|
1044 |
"set the submenuChannel or nil |
|
1045 |
" |
|
1046 |
submenuChannel := something. |
|
973 | 1047 |
! |
1048 |
||
1049 |
submenuHolder |
|
1050 |
"get the submenuHolder or nil |
|
1051 |
" |
|
1052 |
^ submenu |
|
1053 |
||
1054 |
"Modified: / 19.6.1998 / 00:33:58 / cg" |
|
1055 |
"Created: / 19.6.1998 / 00:34:32 / cg" |
|
458 | 1056 |
! ! |
1057 |
||
451 | 1058 |
!MenuItem class methodsFor:'documentation'! |
1059 |
||
1060 |
version |
|
1401
0fda9891ba4a
only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents:
1370
diff
changeset
|
1061 |
^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.41 2000-09-01 10:17:13 cg Exp $' |
451 | 1062 |
! ! |