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