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