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