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