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