author | tz |
Sun, 19 Jul 1998 20:55:35 +0200 | |
changeset 1002 | a237e5fd2be9 |
parent 985 | 5a5b476cfd6b |
child 1030 | 3684379a1ac8 |
permissions | -rw-r--r-- |
451 | 1 |
Object subclass:#MenuItem |
752 | 2 |
instanceVariableNames:'activeHelpKey enabled label value nameKey adornment |
798 | 3 |
translateLabel isButton startGroup isVisible' |
451 | 4 |
classVariableNames:'' |
5 |
poolDictionaries:'' |
|
6 |
category:'Views-Support' |
|
7 |
! |
|
8 |
||
9 |
Object subclass:#MenuItemAdornment |
|
666 | 10 |
instanceVariableNames:'color indication submenu submenuChannel shortcutKey labelText |
684 | 11 |
labelImage accessCharacterPosition argument' |
451 | 12 |
classVariableNames:'' |
13 |
poolDictionaries:'' |
|
14 |
privateIn:MenuItem |
|
15 |
! |
|
16 |
||
17 |
!MenuItem class methodsFor:'documentation'! |
|
18 |
||
19 |
documentation |
|
20 |
" |
|
21 |
not yet finished MenuItem class - this will eventually replace |
|
22 |
most of the MenuView and PopUpMenu stuff. |
|
23 |
(and hopefully be ST-80 compatible ...) |
|
24 |
||
25 |
For now, only a subset of the full protocol is implemented. |
|
26 |
||
27 |
[author:] |
|
28 |
Claus Gittinger |
|
29 |
||
30 |
[see also:] |
|
31 |
MenuItem |
|
32 |
PopUpMenu |
|
33 |
" |
|
34 |
||
35 |
! ! |
|
36 |
||
490 | 37 |
!MenuItem class methodsFor:'instance creation'! |
38 |
||
39 |
labeled:aString |
|
40 |
^ self new label:aString |
|
41 |
! ! |
|
42 |
||
724 | 43 |
!MenuItem methodsFor:'ST-80 compatibility'! |
44 |
||
45 |
isEnabled:aBoolean |
|
46 |
self enabled:aBoolean |
|
47 |
||
48 |
"Created: / 27.10.1997 / 16:34:55 / cg" |
|
49 |
! ! |
|
50 |
||
451 | 51 |
!MenuItem methodsFor:'accessing'! |
52 |
||
579 | 53 |
accessCharacterPosition |
54 |
"get the index of the access character in the label text or string, or nil if none |
|
55 |
" |
|
56 |
adornment notNil ifTrue:[ |
|
57 |
^ adornment accessCharacterPosition |
|
58 |
]. |
|
59 |
^ nil |
|
451 | 60 |
! |
61 |
||
579 | 62 |
accessCharacterPosition:index |
63 |
"set the index of the access character in the label text or string, or nil if none |
|
64 |
" |
|
65 |
(index isNil and:[adornment isNil]) ifFalse:[ |
|
66 |
self adornment accessCharacterPosition:index |
|
67 |
] |
|
451 | 68 |
! |
69 |
||
640 | 70 |
activeHelpKey |
71 |
^ activeHelpKey |
|
72 |
! |
|
73 |
||
74 |
activeHelpKey:aKey |
|
75 |
activeHelpKey := aKey |
|
76 |
! |
|
77 |
||
684 | 78 |
argument |
79 |
"get argument given to the value (selector) |
|
80 |
" |
|
81 |
adornment notNil ifTrue:[ |
|
82 |
^ adornment argument |
|
83 |
]. |
|
84 |
^ nil |
|
85 |
! |
|
86 |
||
87 |
argument:something |
|
88 |
"set argument given to the value (selector) |
|
89 |
" |
|
90 |
|arg| |
|
91 |
||
92 |
(arg := something) notNil ifTrue:[ |
|
93 |
arg isString ifTrue:[ |
|
94 |
(arg size == 0 or:[(arg indexOfNonSeparatorStartingAt:1) == 0]) ifTrue:[ |
|
95 |
arg := nil |
|
96 |
] |
|
97 |
] |
|
98 |
]. |
|
99 |
||
100 |
(arg isNil and:[adornment isNil]) ifFalse:[ |
|
101 |
self adornment argument:arg |
|
102 |
] |
|
103 |
! |
|
104 |
||
798 | 105 |
isVisible |
106 |
^ isVisible ? true |
|
107 |
! |
|
108 |
||
109 |
isVisible:something |
|
110 |
isVisible := something |
|
111 |
! |
|
112 |
||
451 | 113 |
label |
973 | 114 |
^ self filteredLabel "/ label |
451 | 115 |
|
973 | 116 |
"Created: / 25.2.1997 / 19:48:16 / cg" |
117 |
"Modified: / 19.6.1998 / 00:02:55 / cg" |
|
451 | 118 |
! |
119 |
||
453 | 120 |
label:aString |
121 |
label := aString |
|
122 |
||
123 |
"Created: 25.2.1997 / 19:55:16 / cg" |
|
124 |
! |
|
125 |
||
581 | 126 |
labelImage |
127 |
"gets the labelImage |
|
128 |
" |
|
129 |
adornment notNil ifTrue:[ |
|
584 | 130 |
^ adornment labelImage value |
581 | 131 |
]. |
132 |
^ nil |
|
133 |
! |
|
134 |
||
135 |
labelImage:aResourceRetriever |
|
136 |
"set the labelImage |
|
137 |
" |
|
138 |
aResourceRetriever notNil ifTrue:[ |
|
139 |
self adornment labelImage:aResourceRetriever |
|
140 |
] |
|
141 |
! |
|
142 |
||
578 | 143 |
nameKey |
144 |
^ nameKey |
|
145 |
||
146 |
||
147 |
! |
|
148 |
||
149 |
nameKey:aNameKey |
|
579 | 150 |
nameKey := aNameKey. |
578 | 151 |
|
152 |
||
153 |
! |
|
154 |
||
490 | 155 |
rawLabel |
156 |
^ label |
|
157 |
||
158 |
"Created: 25.2.1997 / 19:48:16 / cg" |
|
159 |
! |
|
160 |
||
451 | 161 |
rawLabel:aString |
162 |
label := aString |
|
163 |
||
164 |
"Created: 25.2.1997 / 19:11:02 / cg" |
|
165 |
! |
|
166 |
||
490 | 167 |
shortcutKeyCharacter |
168 |
"ignored for now" |
|
169 |
||
578 | 170 |
adornment notNil ifTrue:[ |
171 |
^ adornment shortcutKeyCharacter |
|
172 |
]. |
|
490 | 173 |
^ nil |
174 |
! |
|
175 |
||
578 | 176 |
shortcutKeyCharacter:aKey |
177 |
"set the key to press to select the menu item from the keyboard |
|
178 |
" |
|
579 | 179 |
(aKey isNil and:[adornment isNil]) ifFalse:[ |
180 |
self adornment shortcutKeyCharacter:aKey |
|
181 |
] |
|
578 | 182 |
! |
183 |
||
794 | 184 |
startGroup |
185 |
"start group #left #right #center ... or nil |
|
186 |
at the moment only #right is implemented |
|
187 |
" |
|
188 |
^ startGroup |
|
189 |
! |
|
190 |
||
191 |
startGroup:aSymbol |
|
192 |
"start group #left #right #center ... |
|
193 |
at the moment only #right is implemented |
|
194 |
" |
|
195 |
(startGroup isNil or:[startGroup == #right]) ifTrue:[ |
|
196 |
startGroup := aSymbol |
|
197 |
] ifFalse:[ |
|
198 |
self warn:('not supported group: ', aSymbol printString ). |
|
199 |
] |
|
200 |
! |
|
201 |
||
458 | 202 |
submenu |
578 | 203 |
adornment notNil ifTrue:[ |
204 |
^ adornment submenu |
|
205 |
]. |
|
206 |
^ nil |
|
458 | 207 |
|
208 |
"Created: 25.2.1997 / 20:57:24 / cg" |
|
209 |
! |
|
210 |
||
211 |
submenu:aMenu |
|
212 |
self adornment submenu:aMenu |
|
213 |
||
214 |
"Created: 25.2.1997 / 20:56:20 / cg" |
|
215 |
! |
|
216 |
||
666 | 217 |
submenuChannel |
218 |
adornment notNil ifTrue:[ |
|
219 |
^ adornment submenuChannel |
|
220 |
]. |
|
221 |
^ nil |
|
222 |
! |
|
223 |
||
224 |
submenuChannel:something |
|
225 |
self adornment submenuChannel:something |
|
226 |
! |
|
227 |
||
451 | 228 |
value |
229 |
^ value |
|
230 |
||
231 |
"Created: 25.2.1997 / 19:50:14 / cg" |
|
232 |
! |
|
233 |
||
234 |
value:something |
|
235 |
value := something |
|
236 |
||
237 |
"Created: 25.2.1997 / 19:11:13 / cg" |
|
238 |
! ! |
|
239 |
||
579 | 240 |
!MenuItem methodsFor:'accessing behavior'! |
241 |
||
590 | 242 |
beOff |
243 |
"set indication off |
|
244 |
" |
|
245 |
self indication:false |
|
246 |
! |
|
247 |
||
248 |
beOn |
|
249 |
"set indication on |
|
250 |
" |
|
251 |
self indication:true |
|
252 |
! |
|
253 |
||
579 | 254 |
disable |
255 |
enabled := false |
|
256 |
||
257 |
"Created: 25.2.1997 / 19:39:09 / cg" |
|
258 |
! |
|
259 |
||
260 |
enable |
|
261 |
enabled := true |
|
262 |
||
263 |
"Created: 25.2.1997 / 19:39:00 / cg" |
|
264 |
! |
|
265 |
||
581 | 266 |
enabled |
267 |
"returns a boolean, valueHolder or block |
|
268 |
" |
|
269 |
^ enabled |
|
270 |
! |
|
579 | 271 |
|
581 | 272 |
enabled:something |
273 |
"a boolean, valueHolder or block |
|
274 |
" |
|
275 |
enabled := something |
|
590 | 276 |
! |
277 |
||
278 |
indication |
|
279 |
"test whether the menu item has an on/off indicator (CheckToggle) |
|
280 |
" |
|
281 |
adornment notNil ifTrue:[ |
|
282 |
^ adornment indication |
|
283 |
]. |
|
284 |
^ nil |
|
285 |
! |
|
286 |
||
287 |
indication:anIndication |
|
288 |
"test whether the menu item has an on/off indicator (CheckToggle) |
|
289 |
" |
|
290 |
(anIndication notNil or:[adornment notNil]) ifTrue:[ |
|
291 |
self adornment indication:anIndication. |
|
292 |
]. |
|
293 |
||
752 | 294 |
! |
295 |
||
296 |
isButton |
|
297 |
"returns whether item looks like a Button |
|
298 |
" |
|
299 |
^isButton ? false |
|
300 |
||
301 |
||
302 |
! |
|
303 |
||
304 |
isButton:anBoolean |
|
305 |
"sets whether item looks like a Button |
|
306 |
" |
|
307 |
isButton := anBoolean |
|
308 |
||
309 |
||
310 |
! |
|
311 |
||
312 |
translateLabel |
|
313 |
"returns whether label is translated |
|
314 |
" |
|
315 |
^translateLabel ? false |
|
316 |
||
317 |
||
318 |
! |
|
319 |
||
320 |
translateLabel:anBoolean |
|
321 |
"sets whether label is translated |
|
322 |
" |
|
323 |
translateLabel := anBoolean |
|
324 |
||
325 |
||
581 | 326 |
! ! |
327 |
||
328 |
!MenuItem methodsFor:'accessing resource'! |
|
329 |
||
584 | 330 |
findGuiResourcesIn:aResourceContainerOrApplication |
581 | 331 |
"setup a resource container |
332 |
" |
|
960
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
333 |
|lblImg m| |
581 | 334 |
|
752 | 335 |
self translateLabel ifTrue:[ |
336 |
label := ResourceRetriever findResourceLabel: label in: aResourceContainerOrApplication |
|
337 |
]. |
|
338 |
||
584 | 339 |
adornment notNil ifTrue:[ |
752 | 340 |
(lblImg := adornment labelImage) notNil ifTrue:[ |
341 |
lblImg findGuiResourcesIn:aResourceContainerOrApplication. |
|
342 |
lblImg labelText notNil ifTrue: [lblImg labelText: label]. |
|
343 |
]. |
|
960
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
344 |
(m := adornment submenu) notNil ifTrue:[ |
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
345 |
m := m value. |
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
346 |
m notNil ifTrue:[ |
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
347 |
m findGuiResourcesIn:aResourceContainerOrApplication |
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
348 |
] |
752 | 349 |
]. |
581 | 350 |
] |
960
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
351 |
|
fee5a1a50374
adornments submenu may be a valueHolder.
Claus Gittinger <cg@exept.de>
parents:
798
diff
changeset
|
352 |
"Modified: / 18.6.1998 / 16:54:25 / cg" |
579 | 353 |
! ! |
354 |
||
451 | 355 |
!MenuItem methodsFor:'converting'! |
356 |
||
357 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
|
358 |
"read my contents from a aLiteralEncodedArray" |
|
359 |
||
360 |
2 to:aLiteralEncodedArray size by:2 do:[:i | |
|
361 |
|selector value| |
|
362 |
||
363 |
selector := aLiteralEncodedArray at:i. |
|
581 | 364 |
value := (aLiteralEncodedArray at:i+1) decodeAsLiteralArray. |
365 |
self perform:selector with:value |
|
451 | 366 |
]. |
367 |
||
368 |
" |
|
578 | 369 |
#( #MenuItem #rawLabel: 'left' #nameKey: 'identifier' #value: #left ) |
451 | 370 |
decodeAsLiteralArray |
371 |
" |
|
372 |
||
373 |
"Modified: 25.2.1997 / 19:24:22 / cg" |
|
490 | 374 |
! |
375 |
||
376 |
literalArrayEncoding |
|
377 |
"return myself encoded as a literal array" |
|
378 |
||
581 | 379 |
|coll something| |
490 | 380 |
|
381 |
coll := OrderedCollection new. |
|
382 |
coll add:#MenuItem. |
|
581 | 383 |
|
384 |
label notNil ifTrue:[ |
|
385 |
coll add:#label: ; add:(label literalArrayEncoding) |
|
386 |
]. |
|
752 | 387 |
self translateLabel ifTrue:[ |
388 |
coll add:#translateLabel: ; add:(translateLabel literalArrayEncoding) |
|
389 |
]. |
|
390 |
self isButton ifTrue:[ |
|
391 |
coll add:#isButton:; add:(isButton literalArrayEncoding) |
|
392 |
]. |
|
581 | 393 |
nameKey notNil ifTrue:[ |
394 |
coll add:#nameKey: ; add:(nameKey literalArrayEncoding) |
|
395 |
]. |
|
798 | 396 |
isVisible notNil ifTrue:[ |
397 |
isVisible ~~ true ifTrue:[ |
|
398 |
coll add:#isVisible: ; add:(isVisible literalArrayEncoding) |
|
399 |
] |
|
400 |
]. |
|
794 | 401 |
|
402 |
startGroup notNil ifTrue:[ |
|
403 |
coll add:#startGroup: ; add:(startGroup literalArrayEncoding) |
|
404 |
]. |
|
405 |
||
579 | 406 |
value notNil ifTrue:[ |
407 |
coll add:#value: ; add:(value literalArrayEncoding). |
|
408 |
]. |
|
653 | 409 |
activeHelpKey notNil ifTrue:[ |
410 |
coll add:#activeHelpKey: ; add:(activeHelpKey literalArrayEncoding). |
|
411 |
]. |
|
412 |
(something := self enabled) notNil ifTrue:[ |
|
413 |
coll add:#enabled: ; add:(enabled literalArrayEncoding). |
|
579 | 414 |
]. |
415 |
||
653 | 416 |
adornment notNil ifTrue:[ |
417 |
(something := self shortcutKeyCharacter) notNil ifTrue:[ |
|
418 |
coll add:#shortcutKeyCharacter: ; add:(something literalArrayEncoding) |
|
419 |
]. |
|
420 |
||
421 |
(something := self accessCharacterPosition) notNil ifTrue:[ |
|
422 |
coll add:#accessCharacterPosition: ; add:(something literalArrayEncoding) |
|
423 |
]. |
|
424 |
||
684 | 425 |
(something := self argument) notNil ifTrue:[ |
426 |
coll add:#argument: ; add:(something literalArrayEncoding) |
|
427 |
]. |
|
428 |
||
661 | 429 |
adornment labelImage notNil ifTrue:[ |
653 | 430 |
coll add:#labelImage: ; add:(adornment labelImage literalArrayEncoding) |
431 |
]. |
|
432 |
(something := self indication) notNil ifTrue:[ |
|
433 |
coll add:#indication: ; add:(something literalArrayEncoding) |
|
666 | 434 |
]. |
579 | 435 |
|
666 | 436 |
(something := self submenuChannel) notNil ifTrue:[ |
437 |
coll add:#submenuChannel: ; add:(something literalArrayEncoding) |
|
438 |
]. |
|
439 |
||
440 |
self hasSubmenu ifTrue:[ |
|
441 |
coll add:#submenu:; add:(self submenu literalArrayEncoding) |
|
442 |
]. |
|
581 | 443 |
]. |
653 | 444 |
|
579 | 445 |
^ coll asArray |
451 | 446 |
! ! |
447 |
||
458 | 448 |
!MenuItem methodsFor:'private - accessing'! |
449 |
||
450 |
adornment |
|
451 |
adornment isNil ifTrue:[ |
|
452 |
adornment := MenuItemAdornment new |
|
453 |
]. |
|
454 |
^ adornment |
|
455 |
||
456 |
"Created: 25.2.1997 / 20:57:05 / cg" |
|
973 | 457 |
! |
458 |
||
459 |
filteredLabel |
|
460 |
"return the label without any &-chars" |
|
461 |
||
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
462 |
|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
|
463 |
|
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
464 |
rawLabel := self rawLabel. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
465 |
rawLabel isString ifFalse:[^ rawLabel]. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
466 |
|
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
467 |
"/ be careful to preserve any emphasis ... |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
468 |
"/ bad kludge ... |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
469 |
rawLabel isText ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
470 |
emp := RunArray new. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
471 |
]. |
973 | 472 |
|
473 |
out := WriteStream on:''. |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
474 |
in := rawLabel readStream. |
973 | 475 |
[in atEnd] whileFalse:[ |
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
476 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
477 |
e := rawLabel emphasisAt:(in position). |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
478 |
]. |
973 | 479 |
c := in next. |
480 |
c == $& ifTrue:[ |
|
481 |
in peek == $& ifTrue:[ |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
482 |
out nextPut:c. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
483 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
484 |
emp add:e |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
485 |
] |
973 | 486 |
] |
487 |
] ifFalse:[ |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
488 |
out nextPut:c. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
489 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
490 |
emp add:e |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
491 |
] |
973 | 492 |
] |
493 |
]. |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
494 |
l := out contents. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
495 |
emp notNil ifTrue:[ |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
496 |
^ Text string:l emphasisCollection:emp |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
497 |
]. |
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
498 |
^ l. |
973 | 499 |
|
500 |
"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
|
501 |
"Modified: / 20.6.1998 / 17:15:18 / cg" |
458 | 502 |
! ! |
503 |
||
579 | 504 |
!MenuItem methodsFor:'queries'! |
505 |
||
590 | 506 |
hasIndication |
507 |
"test whether indication on/off exists |
|
508 |
" |
|
509 |
^ self indication notNil |
|
510 |
! |
|
511 |
||
579 | 512 |
hasSubmenu |
584 | 513 |
^ self submenu notNil |
579 | 514 |
|
515 |
"Created: 25.2.1997 / 20:56:20 / cg" |
|
516 |
! |
|
517 |
||
518 |
isEnabled |
|
581 | 519 |
^ enabled value ? true |
579 | 520 |
|
521 |
"Created: 25.2.1997 / 19:39:17 / cg" |
|
590 | 522 |
! |
523 |
||
724 | 524 |
isHidden |
525 |
"not yet supported" |
|
526 |
||
527 |
^ false |
|
528 |
||
529 |
"Created: / 27.10.1997 / 15:13:43 / cg" |
|
530 |
! |
|
531 |
||
590 | 532 |
isOff |
533 |
"test whether indication on/off exists and is off |
|
534 |
" |
|
535 |
|indication| |
|
536 |
||
537 |
indication := self indication. |
|
538 |
^ indication value == false |
|
539 |
! |
|
540 |
||
541 |
isOn |
|
542 |
"test whether indication on/off exists and is on |
|
543 |
" |
|
544 |
|indication| |
|
545 |
||
546 |
indication := self indication. |
|
547 |
^ indication value == true |
|
579 | 548 |
! ! |
549 |
||
458 | 550 |
!MenuItem::MenuItemAdornment methodsFor:'accessing'! |
551 |
||
579 | 552 |
accessCharacterPosition |
553 |
"return the value of the instance variable 'accessCharacterPosition' (automatically generated)" |
|
554 |
||
555 |
^ accessCharacterPosition! |
|
556 |
||
557 |
accessCharacterPosition:something |
|
558 |
"set the value of the instance variable 'accessCharacterPosition' (automatically generated)" |
|
559 |
||
560 |
accessCharacterPosition := something.! |
|
561 |
||
684 | 562 |
argument |
563 |
"return the value of the instance variable 'argument' (automatically generated)" |
|
564 |
||
565 |
^ argument |
|
566 |
||
567 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
568 |
! |
|
569 |
||
570 |
argument:something |
|
571 |
"set the value of the instance variable 'argument' (automatically generated)" |
|
572 |
||
573 |
argument := something. |
|
574 |
||
575 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
576 |
! |
|
577 |
||
458 | 578 |
color |
579 |
"return the value of the instance variable 'color' (automatically generated)" |
|
580 |
||
581 |
^ color |
|
582 |
||
583 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
584 |
! |
|
585 |
||
586 |
color:something |
|
587 |
"set the value of the instance variable 'color' (automatically generated)" |
|
588 |
||
589 |
color := something. |
|
590 |
||
591 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
592 |
! |
|
593 |
||
594 |
indication |
|
590 | 595 |
"test whether the menu item has an on/off indicator (CheckToggle) |
596 |
" |
|
458 | 597 |
^ indication |
598 |
||
599 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
600 |
! |
|
601 |
||
602 |
indication:something |
|
590 | 603 |
"test whether the menu item has an on/off indicator (CheckToggle) |
604 |
" |
|
458 | 605 |
indication := something. |
606 |
||
607 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
608 |
! |
|
609 |
||
581 | 610 |
labelImage |
611 |
"return the value of the instance variable 'labelImage' (automatically generated)" |
|
612 |
||
613 |
^ labelImage! |
|
614 |
||
615 |
labelImage:something |
|
616 |
"set the value of the instance variable 'labelImage' (automatically generated)" |
|
617 |
||
618 |
labelImage := something.! |
|
619 |
||
578 | 620 |
labelText |
621 |
"get the text appear as the menu label |
|
622 |
" |
|
623 |
^ labelText |
|
624 |
! |
|
625 |
||
626 |
labelText:something |
|
627 |
"set the text appear as the menu label |
|
628 |
" |
|
629 |
labelText := something. |
|
630 |
! |
|
631 |
||
632 |
shortcutKeyCharacter |
|
633 |
"get the key to press to select the menu item from the keyboard |
|
634 |
" |
|
635 |
^ shortcutKey |
|
636 |
! |
|
637 |
||
638 |
shortcutKeyCharacter:something |
|
639 |
"set the key to press to select the menu item from the keyboard |
|
640 |
" |
|
641 |
shortcutKey := something. |
|
642 |
! |
|
643 |
||
458 | 644 |
submenu |
578 | 645 |
"get the submenu or nil |
646 |
" |
|
973 | 647 |
^ submenu value |
458 | 648 |
|
973 | 649 |
"Created: / 25.2.1997 / 20:59:28 / cg" |
650 |
"Modified: / 19.6.1998 / 00:33:58 / cg" |
|
458 | 651 |
! |
652 |
||
653 |
submenu:something |
|
578 | 654 |
"set the submenu or nil |
655 |
" |
|
458 | 656 |
submenu := something. |
657 |
||
658 |
"Created: 25.2.1997 / 20:59:28 / cg" |
|
666 | 659 |
! |
660 |
||
661 |
submenuChannel |
|
662 |
"get the submenuChannel or nil |
|
663 |
" |
|
664 |
^ submenuChannel |
|
665 |
! |
|
666 |
||
667 |
submenuChannel:something |
|
668 |
"set the submenuChannel or nil |
|
669 |
" |
|
670 |
submenuChannel := something. |
|
973 | 671 |
! |
672 |
||
673 |
submenuHolder |
|
674 |
"get the submenuHolder or nil |
|
675 |
" |
|
676 |
^ submenu |
|
677 |
||
678 |
"Modified: / 19.6.1998 / 00:33:58 / cg" |
|
679 |
"Created: / 19.6.1998 / 00:34:32 / cg" |
|
458 | 680 |
! ! |
681 |
||
451 | 682 |
!MenuItem class methodsFor:'documentation'! |
683 |
||
684 |
version |
|
985
5a5b476cfd6b
care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents:
973
diff
changeset
|
685 |
^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.23 1998-06-20 15:15:59 cg Exp $' |
451 | 686 |
! ! |