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