author | sr |
Mon, 07 Nov 2016 15:00:22 +0100 | |
changeset 3778 | 902a70992ca0 |
parent 3752 | 42375c1cc0e9 |
child 3833 | 7bec3052fa14 |
permissions | -rw-r--r-- |
1354 | 1 |
" |
2 |
COPYRIGHT (c) 1997 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 |
" |
|
1367 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
3449 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
2854
d37c539b59ad
inherit from model, for cheap dependents.
Claus Gittinger <cg@exept.de>
parents:
2814
diff
changeset
|
16 |
Model subclass:#Menu |
579 | 17 |
instanceVariableNames:'items groupSizes receiver' |
451 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'Views-Support' |
|
21 |
! |
|
22 |
||
3778 | 23 |
Query subclass:#NeedResourcesQuery |
24 |
instanceVariableNames:'' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
privateIn:Menu |
|
28 |
! |
|
29 |
||
451 | 30 |
!Menu class methodsFor:'documentation'! |
31 |
||
1354 | 32 |
copyright |
33 |
" |
|
34 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
35 |
All Rights Reserved |
|
36 |
||
37 |
This software is furnished under a license and may be used |
|
38 |
only in accordance with the terms of that license and with the |
|
39 |
inclusion of the above copyright notice. This software may not |
|
40 |
be provided or otherwise made available to, or used by, any |
|
41 |
other person. No title to or ownership of the software is |
|
42 |
hereby transferred. |
|
43 |
" |
|
44 |
||
45 |
||
46 |
! |
|
47 |
||
451 | 48 |
documentation |
49 |
" |
|
50 |
not yet finished Menu class - this will eventually replace |
|
51 |
most of the MenuView and PopUpMenu stuff. |
|
52 |
(and hopefully be ST-80 compatible ...) |
|
53 |
||
54 |
For now, only a subset of the full protocol is implemented. |
|
55 |
||
56 |
[author:] |
|
740 | 57 |
Claus Gittinger |
451 | 58 |
|
59 |
[see also:] |
|
740 | 60 |
MenuItem |
61 |
PopUpMenu |
|
451 | 62 |
" |
63 |
! ! |
|
64 |
||
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
65 |
!Menu class methodsFor:'instance creation'! |
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
66 |
|
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
67 |
labelArray:arrayOfString lines:linesArray values:valueArrayOrNil |
737 | 68 |
"return a menu with menu items built with labels from arrayOfString (not Symbols). |
69 |
The linesArray describes which menu items are the last menu item in their group. |
|
70 |
The valueArray contains value objects for each menu item |
|
71 |
(or is nil if no value objects are specified)." |
|
72 |
||
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
73 |
|nLabel valueArray menuItems groupLengths| |
737 | 74 |
|
75 |
nLabel := arrayOfString size. |
|
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
76 |
|
737 | 77 |
valueArrayOrNil isNil ifTrue:[ |
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
78 |
(valueArray := arrayOfString isEmpty) ifTrue: [ |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
79 |
valueArray := #() |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
80 |
] ifFalse:[ |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
81 |
valueArray := (1 to:nLabel) |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
82 |
] |
737 | 83 |
] ifFalse:[ |
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
84 |
valueArray := valueArrayOrNil |
737 | 85 |
]. |
86 |
||
87 |
nLabel ~~ valueArray size ifTrue: [ |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
88 |
^ self error: 'illegal menu combination' |
737 | 89 |
]. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
90 |
|
737 | 91 |
menuItems := Array new:nLabel. |
92 |
1 to:nLabel do:[:i | |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
93 |
|mi v| |
737 | 94 |
|
3222 | 95 |
mi := MenuItem label:(arrayOfString at:i) asString. |
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
96 |
v := valueArray at:i. |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
97 |
(v isKindOf:Menu) ifTrue:[mi submenu:v]. |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
98 |
menuItems at:i put:mi |
737 | 99 |
]. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
100 |
|
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
101 |
(linesArray size == 0) ifTrue:[ |
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
102 |
groupLengths := (menuItems isEmpty) |
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
103 |
ifTrue: [Array new:0] |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
104 |
ifFalse: [Array with:menuItems size] |
737 | 105 |
] ifFalse:[ |
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
106 |
groupLengths := Array new:(linesArray size + 1). |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
107 |
groupLengths at:1 put:linesArray first. |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
108 |
2 to:linesArray size do: [:i | |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
109 |
groupLengths at:i put:((linesArray at:i) - (linesArray at:i - 1)) |
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
110 |
]. |
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
111 |
groupLengths at:groupLengths size put:(menuItems size - linesArray last). |
737 | 112 |
]. |
113 |
||
114 |
^ self new |
|
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
115 |
menuItems:menuItems |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
116 |
menuItemGroups:groupLengths |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
117 |
values:valueArray |
737 | 118 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
119 |
"Modified: / 19.4.1998 / 11:30:18 / cg" |
696 | 120 |
! |
121 |
||
1174
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
122 |
labelArray:arrayOfString values:valueArrayOrNil |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
123 |
"return a menu with menu items built with labels from arrayOfString (not Symbols). |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
124 |
The valueArray contains value objects for each menu item |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
125 |
(or is nil if no value objects are specified)." |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
126 |
|
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
127 |
^ self |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
128 |
labelArray:arrayOfString |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
129 |
lines:nil |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
130 |
values: valueArrayOrNil |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
131 |
|
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
132 |
! |
f58d5c8cee82
added #labelArray:values: (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1116
diff
changeset
|
133 |
|
696 | 134 |
labelList:arrayOfGroupStrings values:valueArrayOrNil |
135 |
|labels lines| |
|
136 |
||
137 |
lines := arrayOfGroupStrings collect:[:each | each size]. |
|
2017 | 138 |
labels := arrayOfGroupStrings collectAll:[:eachGroup | eachGroup]. |
696 | 139 |
^ self labelArray:labels lines:lines values:valueArrayOrNil |
140 |
||
141 |
"Modified: 20.6.1997 / 10:46:45 / cg" |
|
142 |
"Created: 13.9.1997 / 10:35:46 / cg" |
|
737 | 143 |
! |
144 |
||
738 | 145 |
labels:aString lines:linesArray values:valueArrayOrNil |
737 | 146 |
^ self |
740 | 147 |
labelArray:(aString asCollectionOfLines) |
148 |
lines:linesArray |
|
149 |
values:valueArrayOrNil |
|
737 | 150 |
|
151 |
"Created: / 31.10.1997 / 03:12:20 / cg" |
|
738 | 152 |
"Modified: / 31.10.1997 / 03:23:42 / cg" |
1525 | 153 |
! |
154 |
||
155 |
labels:aString values:valueArrayOrNil |
|
156 |
^ self |
|
157 |
labelArray:(aString asCollectionOfLines) |
|
158 |
lines:#() |
|
159 |
values:valueArrayOrNil |
|
160 |
||
161 |
"Modified: / 31.10.1997 / 03:23:42 / cg" |
|
162 |
"Created: / 12.11.2001 / 16:06:36 / cg" |
|
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
163 |
! ! |
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
164 |
|
1764 | 165 |
!Menu methodsFor:'Compatibility-ST80'! |
724 | 166 |
|
2126 | 167 |
addLine |
168 |
self addSeparator |
|
169 |
! |
|
170 |
||
724 | 171 |
indexOfMenuItem:anItem |
2433 | 172 |
^ items indexOf:anItem |
724 | 173 |
|
2433 | 174 |
"Created: / 27.10.1997 / 16:34:19 / cg" |
175 |
! |
|
176 |
||
177 |
indexOfMenuItemForWhich:aBlock |
|
178 |
^ items findFirst:aBlock |
|
724 | 179 |
|
180 |
"Created: / 27.10.1997 / 16:34:19 / cg" |
|
181 |
! |
|
182 |
||
183 |
menuButtons |
|
184 |
"ST-80 seems to use a special menuButton class here. |
|
185 |
Here, kludge a collection of menuItems." |
|
186 |
||
187 |
^ items |
|
188 |
||
189 |
"Created: / 27.10.1997 / 16:33:35 / cg" |
|
190 |
! ! |
|
191 |
||
1782 | 192 |
!Menu methodsFor:'Compatibility-Squeak'! |
193 |
||
2764 | 194 |
add:label target:target selector:selector |
3185 | 195 |
self addItem:(MenuItem label:label itemValue:[target perform:selector]). |
2764 | 196 |
! |
197 |
||
198 |
balloonTextForLastItem:aString |
|
199 |
items last helpText:aString |
|
200 |
! |
|
201 |
||
1782 | 202 |
labels:labels lines:lines selections:selections |
203 |
|labelArray| |
|
204 |
||
205 |
labels isString ifTrue:[ |
|
206 |
labelArray := labels asCollectionOfLines. |
|
207 |
] ifFalse:[ |
|
208 |
labelArray := labels. |
|
209 |
]. |
|
210 |
||
211 |
1 to:labelArray size do:[:idx | |
|
3355 | 212 |
self addItem:(MenuItem |
213 |
label:(labelArray at:idx) |
|
214 |
itemValue:(selections at:idx)). |
|
1782 | 215 |
|
216 |
(lines includes:idx) ifTrue:[ |
|
217 |
self addSeparator. |
|
218 |
]. |
|
219 |
]. |
|
3022 | 220 |
|
221 |
"Modified: / 09-09-2012 / 13:08:55 / cg" |
|
1782 | 222 |
! ! |
223 |
||
451 | 224 |
!Menu methodsFor:'accessing'! |
225 |
||
2916
ff96b6187a5f
added: #atMenuItemLabeled:putSubmenu:visible:
Claus Gittinger <cg@exept.de>
parents:
2908
diff
changeset
|
226 |
atMenuItemLabeled:aString putSubmenu:aMenu visible:visible |
ff96b6187a5f
added: #atMenuItemLabeled:putSubmenu:visible:
Claus Gittinger <cg@exept.de>
parents:
2908
diff
changeset
|
227 |
(self menuItemLabeled:aString) |
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
228 |
submenu:aMenu; |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
229 |
isVisible:visible |
2916
ff96b6187a5f
added: #atMenuItemLabeled:putSubmenu:visible:
Claus Gittinger <cg@exept.de>
parents:
2908
diff
changeset
|
230 |
|
ff96b6187a5f
added: #atMenuItemLabeled:putSubmenu:visible:
Claus Gittinger <cg@exept.de>
parents:
2908
diff
changeset
|
231 |
"Created: / 30-06-2011 / 10:30:22 / cg" |
ff96b6187a5f
added: #atMenuItemLabeled:putSubmenu:visible:
Claus Gittinger <cg@exept.de>
parents:
2908
diff
changeset
|
232 |
! |
ff96b6187a5f
added: #atMenuItemLabeled:putSubmenu:visible:
Claus Gittinger <cg@exept.de>
parents:
2908
diff
changeset
|
233 |
|
696 | 234 |
atNameKey:aNameKey |
724 | 235 |
"return the menuItem for the given nameKey; nil if no such item is in the menu. |
236 |
Searches in allItems (i.e. also in subMenus)" |
|
696 | 237 |
|
724 | 238 |
self allItemsDo:[:anItem| |
740 | 239 |
anItem nameKey == aNameKey ifTrue:[^ anItem] |
724 | 240 |
]. |
696 | 241 |
^ nil |
242 |
||
724 | 243 |
"Modified: / 27.10.1997 / 15:12:00 / cg" |
696 | 244 |
! |
245 |
||
3340 | 246 |
atNameKey:aNameKey ifPresentDo:aBlock |
247 |
"look for a menuItem withthe given nameKey. If one is found, aBlock is evaluated for it. |
|
248 |
If not, nothing is done. |
|
249 |
Searches in allItems (i.e. also in subMenus). |
|
250 |
Returns the item or nil." |
|
251 |
||
252 |
|item| |
|
253 |
||
254 |
(item := self atNameKey:aNameKey) notNil ifTrue:[ |
|
255 |
aBlock value:item. |
|
256 |
]. |
|
257 |
^ item |
|
258 |
! |
|
259 |
||
578 | 260 |
groupSizes |
1500 | 261 |
^ groupSizes |
262 |
! |
|
578 | 263 |
|
264 |
groupSizes:something |
|
1500 | 265 |
groupSizes := something. |
266 |
! |
|
578 | 267 |
|
1986 | 268 |
items |
269 |
^ items |
|
270 |
! |
|
271 |
||
584 | 272 |
labelAt:anIndex |
273 |
"gets the label of the menu item at the given index or nil |
|
274 |
" |
|
275 |
|item| |
|
276 |
||
277 |
(item := self menuItemAt:anIndex) notNil ifTrue:[ |
|
801 | 278 |
^ item label |
584 | 279 |
]. |
801 | 280 |
^ nil |
584 | 281 |
|
801 | 282 |
"Modified: / 2.2.1998 / 13:28:32 / cg" |
584 | 283 |
! |
284 |
||
285 |
labelAtValue:aValue |
|
286 |
"gets the label of the menu item assigned to value |
|
287 |
" |
|
288 |
|item| |
|
289 |
||
801 | 290 |
item := self menuAndSubmenusDetectItem:[:anItem | anItem value == aValue ]. |
584 | 291 |
|
292 |
item notNil ifTrue:[ |
|
801 | 293 |
^ item label |
584 | 294 |
]. |
801 | 295 |
^ nil |
584 | 296 |
|
801 | 297 |
"Modified: / 2.2.1998 / 13:28:28 / cg" |
584 | 298 |
! |
299 |
||
451 | 300 |
labels |
301 |
"return a collection of labels from my items" |
|
302 |
||
977
e07277070839
return valid collection in #labels.
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
303 |
items isNil ifTrue:[^ #()]. |
451 | 304 |
^ items collect:[:anItem | anItem label] |
305 |
||
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
306 |
"Created: / 25.2.1997 / 19:47:53 / cg" |
977
e07277070839
return valid collection in #labels.
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
307 |
"Modified: / 19.6.1998 / 02:36:22 / cg" |
451 | 308 |
! |
309 |
||
940 | 310 |
lastItem |
2584 | 311 |
"returns the last item or nil, if there are none" |
312 |
||
313 |
^ items isEmptyOrNil |
|
314 |
ifTrue:[nil] |
|
315 |
ifFalse:[items last] |
|
940 | 316 |
! |
317 |
||
489 | 318 |
lines |
737 | 319 |
"return the indexes of the menu items that are the last menu item in their group (except the very last)." |
489 | 320 |
|
801 | 321 |
|lines groupSz| |
737 | 322 |
|
3752 | 323 |
(groupSz := groupSizes size) <= 1 ifTrue: [^ #()]. |
801 | 324 |
lines := Array new:(groupSz - 1). |
325 |
lines at:1 put:groupSizes first. |
|
326 |
2 to:(groupSz-1) do:[:i | |
|
327 |
lines at:i put:(lines at:(i - 1)) + (groupSizes at:i) |
|
328 |
]. |
|
329 |
^ lines |
|
489 | 330 |
|
801 | 331 |
"Modified: / 2.2.1998 / 13:28:19 / cg" |
489 | 332 |
! |
333 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
334 |
menuItemAt:index |
584 | 335 |
"gets the menu item at the given index. When the index is out of bounds |
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
336 |
nil is returned" |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
337 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
338 |
(index > 0 and:[ index <= items size ]) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
339 |
^ items at:index |
584 | 340 |
]. |
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
341 |
^ nil |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
342 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
343 |
"Modified: / 30-06-2011 / 10:51:39 / cg" |
489 | 344 |
! |
345 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
346 |
menuItemLabeled:anItemLabel |
724 | 347 |
"return the menuItem for the given nameKey; nil if no such item is in the menu. |
348 |
Searches all items (i.e. also submenu items)" |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
349 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
350 |
self |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
351 |
allItemsDo:[:anItem | |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
352 |
|l| |
724 | 353 |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
354 |
((l := anItem label) sameAs:anItemLabel) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
355 |
^ anItem |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
356 |
]. |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
357 |
(l includes:$&) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
358 |
((l copyWithout:$&) sameAs:anItemLabel) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
359 |
^ anItem |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
360 |
] |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
361 |
] |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
362 |
]. |
724 | 363 |
^ nil |
364 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
365 |
"Created: / 13-09-1997 / 10:25:16 / cg" |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
366 |
"Modified: / 30-06-2011 / 10:51:44 / cg" |
724 | 367 |
! |
368 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
369 |
menuItemWithArgument:aValue |
2908
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
370 |
"return the menuItem for the given value; nil if no such item is in the menu. |
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
371 |
Searches all items (i.e. also submenu items)" |
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
372 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
373 |
self |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
374 |
allItemsDo:[:anItem | |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
375 |
|l| |
2908
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
376 |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
377 |
(anItem argument = aValue) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
378 |
^ anItem |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
379 |
]. |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
380 |
]. |
2908
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
381 |
^ nil |
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
382 |
|
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
383 |
"Created: / 19-04-2011 / 14:42:18 / cg" |
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
384 |
"Modified: / 30-06-2011 / 10:51:50 / cg" |
2908
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
385 |
! |
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
386 |
|
2952
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
387 |
menuItemWithKey:aValue |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
388 |
"return the menuItem for the given key; nil if no such item is in the menu. |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
389 |
Searches all items (i.e. also submenu items)" |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
390 |
|
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
391 |
self |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
392 |
allItemsDo:[:anItem | |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
393 |
|
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
394 |
(anItem nameKey = aValue) ifTrue:[ |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
395 |
^ anItem |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
396 |
]. |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
397 |
]. |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
398 |
^ nil |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
399 |
|
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
400 |
"Created: / 19-04-2011 / 14:42:18 / cg" |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
401 |
"Modified: / 30-06-2011 / 10:51:50 / cg" |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
402 |
"Created: / 07-10-2011 / 15:04:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
403 |
! |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
404 |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
405 |
menuItemWithValue:aValue |
1652 | 406 |
"return the menuItem for the given value; nil if no such item is in the menu. |
407 |
Searches all items (i.e. also submenu items)" |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
408 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
409 |
self |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
410 |
allItemsDo:[:anItem | |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
411 |
|l| |
1652 | 412 |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
413 |
(anItem value == aValue) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
414 |
^ anItem |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
415 |
]. |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
416 |
]. |
1652 | 417 |
^ nil |
418 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
419 |
"Created: / 13-09-1997 / 10:25:16 / cg" |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
420 |
"Modified: / 30-06-2011 / 10:51:56 / cg" |
1652 | 421 |
! |
422 |
||
489 | 423 |
menuItems |
1327
b0b482a84570
menuItems always returns a collection (never nil)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
424 |
^ items ? #() |
489 | 425 |
! |
426 |
||
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
427 |
menuItems:aCollectionOfMenuItems menuItemGroups:sizes values:values |
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
428 |
|n| |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
429 |
|
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
430 |
items := groupSizes := nil. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
431 |
|
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
432 |
aCollectionOfMenuItems size == 0 ifTrue:[ ^ self ]. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
433 |
|
451 | 434 |
items := aCollectionOfMenuItems. |
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
435 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
436 |
sizes size > 0 ifTrue:[ |
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
437 |
groupSizes := sizes. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
438 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
439 |
n := sizes inject:0 into:[:sumSoFar :this | sumSoFar + this]. |
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
440 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
441 |
n = items size ifTrue:[ |
3117
3c7f6b69b2c5
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3028
diff
changeset
|
442 |
groupSizes := sizes copyButLast:1 |
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
443 |
] |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
444 |
]. |
451 | 445 |
|
579 | 446 |
values notNil ifTrue:[ |
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
447 |
items with:values do:[:anItem :aValue |anItem value:aValue] |
454 | 448 |
]. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
449 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
450 |
"Modified: / 19.4.1998 / 11:47:34 / cg" |
451 | 451 |
! |
452 |
||
1116 | 453 |
menuPerformer:something |
454 |
"set the receiver of the menu messages" |
|
455 |
||
456 |
receiver := something. |
|
457 |
||
458 |
"Modified: / 2.2.1998 / 13:26:29 / cg" |
|
459 |
! |
|
460 |
||
494 | 461 |
numberOfItems |
801 | 462 |
"return the number of items in this menu" |
463 |
||
494 | 464 |
^ items size |
465 |
||
801 | 466 |
"Created: / 6.3.1997 / 15:15:53 / cg" |
467 |
"Modified: / 2.2.1998 / 13:26:40 / cg" |
|
494 | 468 |
! |
469 |
||
579 | 470 |
receiver |
801 | 471 |
"return the receiver of the menu messages" |
579 | 472 |
|
801 | 473 |
^ receiver |
474 |
||
475 |
"Modified: / 2.2.1998 / 13:26:20 / cg" |
|
476 |
! |
|
579 | 477 |
|
478 |
receiver:something |
|
801 | 479 |
"set the receiver of the menu messages" |
579 | 480 |
|
801 | 481 |
receiver := something. |
482 |
||
483 |
"Modified: / 2.2.1998 / 13:26:29 / cg" |
|
484 |
! |
|
579 | 485 |
|
451 | 486 |
valueAt:index |
487 |
"return a collection of values from my items" |
|
488 |
||
489 |
^ (items at:index) value |
|
490 |
||
491 |
"Created: 25.2.1997 / 19:49:41 / cg" |
|
492 |
! |
|
493 |
||
494 | 494 |
valueAt:anIndex put:aValue |
495 |
"put value an an index" |
|
496 |
||
497 |
(items at:anIndex) value:aValue |
|
498 |
||
499 |
"Created: 6.3.1997 / 15:15:48 / cg" |
|
500 |
! |
|
501 |
||
451 | 502 |
values |
503 |
"return a collection of values from my items" |
|
504 |
||
505 |
^ items collect:[:anItem | anItem value] |
|
506 |
||
507 |
"Created: 25.2.1997 / 19:49:29 / cg" |
|
724 | 508 |
! |
509 |
||
510 |
values:aCollectionOfValues |
|
511 |
"return a collection of values from my items" |
|
512 |
||
513 |
|s| |
|
514 |
||
515 |
s := aCollectionOfValues readStream. |
|
516 |
self itemsDo:[:item | |
|
1111 | 517 |
|val| |
724 | 518 |
|
1111 | 519 |
val := s next. |
520 |
item value:val |
|
724 | 521 |
]. |
1111 | 522 |
s atEnd ifFalse:[ |
2092 | 523 |
self error:'not enough elements in the value collection' mayProceed:true |
1111 | 524 |
] |
724 | 525 |
|
526 |
"Created: / 27.10.1997 / 15:15:47 / cg" |
|
527 |
! |
|
528 |
||
529 |
visibleMenuItemGroups |
|
801 | 530 |
|itemGroups visibleItemGroups nextItem| |
724 | 531 |
|
801 | 532 |
itemGroups := OrderedCollection new. |
533 |
nextItem := 1. |
|
534 |
groupSizes do:[:groupSize | |
|
535 |
itemGroups addLast: (items copyFrom:nextItem to:nextItem + groupSize - 1). |
|
536 |
nextItem := nextItem + groupSize |
|
537 |
]. |
|
538 |
self hasHiddenItems ifFalse:[^ itemGroups]. |
|
724 | 539 |
|
801 | 540 |
"Remove the hidden items." |
541 |
visibleItemGroups := OrderedCollection new. |
|
542 |
itemGroups do:[:eachItemGroup | |
|
543 |
|visibleItemGroup| |
|
544 |
||
545 |
visibleItemGroup := eachItemGroup reject:[:eachMenuItem | eachMenuItem hidden]. |
|
2129 | 546 |
visibleItemGroup notEmpty ifTrue:[ |
801 | 547 |
visibleItemGroups addLast: visibleItemGroup |
548 |
] |
|
549 |
]. |
|
550 |
^ visibleItemGroups |
|
724 | 551 |
|
552 |
"Created: / 27.10.1997 / 15:07:50 / cg" |
|
801 | 553 |
"Modified: / 2.2.1998 / 13:25:52 / cg" |
451 | 554 |
! ! |
555 |
||
1397 | 556 |
!Menu methodsFor:'accessing-resource'! |
582 | 557 |
|
584 | 558 |
findGuiResourcesIn:aResourceContainerOrApplication |
2269
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
559 |
"setup a resource owner" |
1986 | 560 |
|
561 |
receiver isNil ifTrue:[ |
|
562 |
receiver := aResourceContainerOrApplication |
|
563 |
]. |
|
3778 | 564 |
self |
2269
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
565 |
findGuiResourcesIn:aResourceContainerOrApplication |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
566 |
rememberResourcesIn:(ValueHolder new) |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
567 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
568 |
"Modified: / 26-10-2006 / 16:37:57 / cg" |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
569 |
! |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
570 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
571 |
findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
572 |
"setup a resource owner" |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
573 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
574 |
|resolvedItems rcv| |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
575 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
576 |
"/ cg: do not recursively change the receiver - it could be set for the top |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
577 |
"/ menu via #receiver: by the application. |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
578 |
"/ if the submenu's receiver is nil, the parentmenus receiver will be used, which is ok. |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
579 |
"/ But if it was changed below, we would need a recursive setting in #receiver: as well. |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
580 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
581 |
"/ receiver isNil ifTrue:[ |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
582 |
"/ receiver := aResourceContainerOrApplication |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
583 |
"/ ]. |
1986 | 584 |
items isEmptyOrNil ifTrue:[^ self]. |
3778 | 585 |
NeedResourcesQuery query ifFalse:[^self]. |
1986 | 586 |
|
587 |
resolvedItems := OrderedCollection new. |
|
588 |
||
589 |
items do:[:anItem | |
|
2867 | 590 |
anItem isMenuSlice ifTrue:[ |
591 |
|resItems| |
|
592 |
||
2059
36e4aa247402
fixed menu-slice resolving (search in masterApplication too)
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
593 |
rcv := aResourceContainerOrApplication. |
36e4aa247402
fixed menu-slice resolving (search in masterApplication too)
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
594 |
[rcv notNil and:[resItems isNil]] whileTrue:[ |
3449 | 595 |
resItems := anItem resolveSliceMenuItemsIn:rcv rememberResourcesIn:aValueHolderOrNil. |
2059
36e4aa247402
fixed menu-slice resolving (search in masterApplication too)
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
596 |
rcv := rcv perform:#masterApplication ifNotUnderstood:nil. |
36e4aa247402
fixed menu-slice resolving (search in masterApplication too)
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
597 |
]. |
1986 | 598 |
|
599 |
resItems notEmptyOrNil ifTrue:[ |
|
600 |
resolvedItems addAll:resItems. |
|
601 |
] |
|
602 |
] ifFalse:[ |
|
3449 | 603 |
anItem findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil. |
1986 | 604 |
resolvedItems add:anItem. |
1534
292c277fcf6a
findGuiResources... now sets the receiver, if not yet set
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
605 |
]. |
1986 | 606 |
]. |
607 |
items := resolvedItems. |
|
2269
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
608 |
|
2867 | 609 |
"Modified: / 22-09-2010 / 13:34:38 / cg" |
582 | 610 |
! ! |
611 |
||
940 | 612 |
!Menu methodsFor:'adding & removing'! |
613 |
||
614 |
addItem:aMenuItem |
|
1029 | 615 |
"add a menuItem at the end; |
616 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
617 |
||
940 | 618 |
items isNil ifTrue:[ |
1029 | 619 |
items := OrderedCollection new |
620 |
] ifFalse:[ |
|
621 |
items := items asOrderedCollection |
|
940 | 622 |
]. |
623 |
items add:aMenuItem. |
|
1029 | 624 |
|
625 |
"Modified: / 4.8.1998 / 17:31:13 / cg" |
|
940 | 626 |
! |
627 |
||
628 |
addItem:aMenuItem beforeIndex:anIndex |
|
1029 | 629 |
"add a menuItem at some position; |
630 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
631 |
||
940 | 632 |
items isNil ifTrue:[ |
633 |
items := OrderedCollection new |
|
1029 | 634 |
] ifFalse:[ |
635 |
items := items asOrderedCollection |
|
940 | 636 |
]. |
637 |
items add:aMenuItem beforeIndex:anIndex. |
|
1029 | 638 |
|
639 |
"Modified: / 4.8.1998 / 17:31:39 / cg" |
|
940 | 640 |
! |
641 |
||
642 |
addItem:aMenuItem value:aValue |
|
3022 | 643 |
aMenuItem itemValue:aValue. |
940 | 644 |
self addItem:aMenuItem. |
3022 | 645 |
|
646 |
"Modified: / 09-09-2012 / 13:08:50 / cg" |
|
940 | 647 |
! |
648 |
||
1758 | 649 |
addItemGroup:aGroup |
1029 | 650 |
"add a group of items at the end; |
651 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
652 |
||
940 | 653 |
groupSizes isNil ifTrue:[ |
1758 | 654 |
groupSizes := OrderedCollection with:items size. |
940 | 655 |
]. |
1758 | 656 |
groupSizes add:aGroup size. |
940 | 657 |
|
1758 | 658 |
aGroup do:[:item | |
1029 | 659 |
self addItem:item |
940 | 660 |
]. |
661 |
||
662 |
"Created: / 27.10.1997 / 15:02:15 / cg" |
|
1029 | 663 |
"Modified: / 4.8.1998 / 17:32:06 / cg" |
940 | 664 |
! |
665 |
||
666 |
addItemGroup:aGroup values:values |
|
1029 | 667 |
"add a group of items at the end; |
668 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
669 |
||
1758 | 670 |
aGroup with:values do:[:item :value | |
671 |
item value:value |
|
940 | 672 |
]. |
1758 | 673 |
self addItemGroup:aGroup |
1029 | 674 |
|
675 |
"Modified: / 4.8.1998 / 17:32:18 / cg" |
|
940 | 676 |
! |
677 |
||
678 |
addItemGroupLabels:labels values:values |
|
1029 | 679 |
"add a group of items at the end; |
680 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
681 |
||
940 | 682 |
|items| |
683 |
||
684 |
items := labels with:values |
|
1029 | 685 |
collect:[:label :value | |
3185 | 686 |
MenuItem label:label itemValue:value |
1029 | 687 |
]. |
940 | 688 |
self addItemGroup:items |
689 |
||
690 |
"Created: / 27.10.1997 / 19:49:27 / cg" |
|
1029 | 691 |
"Modified: / 4.8.1998 / 17:35:22 / cg" |
940 | 692 |
! |
693 |
||
694 |
addItemLabel:label value:value |
|
1029 | 695 |
"add an item at the end; |
696 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
940 | 697 |
|
3185 | 698 |
self addItem:(MenuItem label:label itemValue:value) |
940 | 699 |
|
700 |
"Created: / 27.10.1997 / 19:47:12 / cg" |
|
1029 | 701 |
"Modified: / 4.8.1998 / 17:34:44 / cg" |
940 | 702 |
! |
703 |
||
3226 | 704 |
addItems: collection |
705 |
"Add all items in given collection. |
|
706 |
Useful to build a menu programmatically (or, to add more items dynamically)" |
|
707 |
||
708 |
items isNil ifTrue:[ |
|
709 |
items := OrderedCollection new |
|
710 |
] ifFalse:[ |
|
711 |
items := items asOrderedCollection |
|
712 |
]. |
|
713 |
items addAll: collection |
|
714 |
||
715 |
"Created: / 01-09-2013 / 16:43:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
716 |
! |
|
717 |
||
718 |
addItemsFrom: anotherMenu |
|
719 |
"Add all items from another menu. |
|
720 |
Useful to build a menu programmatically (or, to add more items dynamically)" |
|
721 |
||
3254 | 722 |
self addItems: anotherMenu items ? #() |
3226 | 723 |
|
724 |
"Created: / 01-09-2013 / 16:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3254 | 725 |
"Modified: / 04-10-2013 / 19:28:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3226 | 726 |
! |
727 |
||
1500 | 728 |
addSeparator |
729 |
"add a separating line item at the end; |
|
730 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
731 |
||
2814 | 732 |
self addItem:(MenuItem separator). |
1500 | 733 |
! |
734 |
||
940 | 735 |
removeItem:aMenuItem |
736 |
"remove an item from the menu" |
|
737 |
||
738 |
|idx| |
|
739 |
||
740 |
items notNil ifTrue:[ |
|
741 |
idx := items identityIndexOf:aMenuItem. |
|
742 |
idx ~~ 0 ifTrue:[ |
|
743 |
items removeAtIndex:idx |
|
744 |
] |
|
745 |
]. |
|
746 |
||
747 |
"Created: / 13.9.1997 / 10:27:31 / cg" |
|
748 |
"Modified: / 2.2.1998 / 13:26:49 / cg" |
|
749 |
! |
|
750 |
||
751 |
removeItemAt:anIndex |
|
752 |
"remove item at an index |
|
753 |
" |
|
754 |
anIndex <= items size ifTrue:[ |
|
755 |
^ items removeAtIndex:anIndex |
|
756 |
]. |
|
757 |
^ nil |
|
758 |
! ! |
|
759 |
||
451 | 760 |
!Menu methodsFor:'converting'! |
761 |
||
2081 | 762 |
asOldStylePopUpMenuFor:anApplicationOrNil |
2080 | 763 |
"a temporary kludge - will vanish, when oldStyle MenuView and PopUpMenu are gone" |
764 |
||
2081 | 765 |
|menuView itemsShown| |
766 |
||
2867 | 767 |
itemsShown := items |
768 |
select:[:each | |
|
2081 | 769 |
|visibilityInItem| |
770 |
||
771 |
visibilityInItem := each isVisible. |
|
772 |
visibilityInItem isNil ifTrue:[ |
|
773 |
true |
|
774 |
] ifFalse:[ |
|
775 |
visibilityInItem isBoolean ifTrue:[ |
|
776 |
visibilityInItem |
|
777 |
] ifFalse:[ |
|
778 |
visibilityInItem isSymbol ifTrue:[ |
|
2917
2ba0fee85a7f
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2916
diff
changeset
|
779 |
anApplicationOrNil isNil |
2ba0fee85a7f
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2916
diff
changeset
|
780 |
or:[ (anApplicationOrNil perform:visibilityInItem) value ]. |
2081 | 781 |
] ifFalse:[ |
782 |
visibilityInItem value |
|
783 |
]. |
|
784 |
]. |
|
785 |
]. |
|
786 |
]. |
|
2080 | 787 |
|
788 |
menuView := MenuView |
|
2081 | 789 |
labels:(itemsShown collect:[:each | each label]) |
790 |
selectors:(itemsShown collect:[:each | each value]) |
|
2751
d0729d604864
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2584
diff
changeset
|
791 |
accelerators:(itemsShown collect:[:each | each shortcutKey]) |
2081 | 792 |
args:(itemsShown collect:[:each | each argument]) |
2080 | 793 |
receiver:receiver. |
794 |
||
2092 | 795 |
itemsShown doWithIndex:[:each :idx | |
2081 | 796 |
|enabledInItem enabled| |
797 |
||
798 |
enabledInItem := each enabled. |
|
799 |
enabledInItem notNil ifTrue:[ |
|
800 |
enabledInItem isSymbol ifTrue:[ |
|
2917
2ba0fee85a7f
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2916
diff
changeset
|
801 |
enabled := anApplicationOrNil isNil or:[ (anApplicationOrNil perform:enabledInItem) ]. |
2081 | 802 |
] ifFalse:[ |
3028
29a0a22942fe
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
3022
diff
changeset
|
803 |
enabled := enabledInItem |
2081 | 804 |
]. |
805 |
enabled value ifFalse:[ |
|
2092 | 806 |
menuView disable:idx |
2081 | 807 |
]. |
808 |
]. |
|
809 |
]. |
|
810 |
||
3245 | 811 |
menuView actions:(itemsShown |
812 |
collect:[:each | |
|
813 |
[ |
|
814 |
|actionOrSymbol| |
|
815 |
||
816 |
actionOrSymbol := each itemValue. |
|
817 |
actionOrSymbol isBlock ifTrue:[ |
|
818 |
actionOrSymbol value |
|
819 |
] ifFalse:[ |
|
820 |
receiver perform:actionOrSymbol |
|
821 |
] |
|
822 |
] |
|
823 |
] |
|
824 |
). |
|
2080 | 825 |
|
826 |
^ PopUpMenu forMenu:menuView |
|
2867 | 827 |
|
2917
2ba0fee85a7f
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2916
diff
changeset
|
828 |
"Modified: / 30-06-2011 / 10:35:57 / cg" |
2080 | 829 |
! |
830 |
||
451 | 831 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
832 |
"read my contents from a aLiteralEncodedArray" |
|
833 |
||
834 |
|items groups values| |
|
835 |
||
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
836 |
items := aLiteralEncodedArray at:2. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
837 |
|
2864
f90017f2da66
changed: #fromLiteralArrayEncoding:
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
838 |
items notNil ifTrue:[ |
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
839 |
items := items collect:[:item | item decodeAsLiteralArray]. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
840 |
]. |
1405
c7775c10e8fd
tolerant literalDecoding (missing 2nd and 3rd elements);
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
841 |
groups := aLiteralEncodedArray at:3 ifAbsent:nil. |
c7775c10e8fd
tolerant literalDecoding (missing 2nd and 3rd elements);
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
842 |
values := aLiteralEncodedArray at:4 ifAbsent:nil. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
843 |
self menuItems:items menuItemGroups:groups values:values. |
451 | 844 |
|
845 |
"extract from PD folder.st: |
|
846 |
#(#Menu #( |
|
1245 | 847 |
#(#MenuItem |
848 |
#rawLabel: 'left' |
|
849 |
#value: #left ) |
|
850 |
#(#MenuItem |
|
851 |
#rawLabel: 'center' |
|
852 |
#value: #center ) |
|
853 |
#(#MenuItem |
|
854 |
#rawLabel: 'right' |
|
855 |
#value: #right ) |
|
856 |
) |
|
857 |
#(3 ) |
|
858 |
nil |
|
451 | 859 |
) decodeAsLiteralArray |
860 |
" |
|
452 | 861 |
" |
862 |
#(#Menu #( |
|
1245 | 863 |
#(#MenuItem |
864 |
#label: 'Straighten Up' ) |
|
865 |
#(#MenuItem |
|
866 |
#label: 'Inspect' ) |
|
867 |
#(#MenuItem |
|
868 |
#label: 'Coredump' ) |
|
869 |
) |
|
870 |
#(3 ) |
|
871 |
#(#straightenUp #inspect #halt ) |
|
452 | 872 |
) decodeAsLiteralArray startUp |
873 |
" |
|
457 | 874 |
|
454 | 875 |
"extract from iconicBrowser.st: |
452 | 876 |
#(#Menu #( |
1245 | 877 |
#(#MenuItem |
878 |
#label: 'Straighten Up' ) |
|
879 |
#(#MenuItem |
|
880 |
#label: 'Inspect' ) |
|
881 |
#(#MenuItem |
|
882 |
#label: 'Coredump' ) |
|
883 |
) |
|
884 |
#(3 ) |
|
885 |
#(1 2 3 ) |
|
452 | 886 |
) decodeAsLiteralArray startUp |
887 |
" |
|
451 | 888 |
|
454 | 889 |
"extract from refactory213.st: |
890 |
#(#Menu #( |
|
1245 | 891 |
#(#MenuItem |
892 |
#label: 'File List' |
|
893 |
#accessCharacterPosition: 1 ) |
|
894 |
#(#MenuItem #label: 'File Editor...' |
|
895 |
#accessCharacterPosition: 6 ) |
|
896 |
#(#MenuItem #label: 'Refactoring Tool...' |
|
897 |
#accessCharacterPosition: 1 ) |
|
898 |
#(#MenuItem #label: 'Workspace' |
|
899 |
#accessCharacterPosition: 1 ) |
|
900 |
#(#MenuItem #label: 'New Canvas' |
|
901 |
#accessCharacterPosition: 1 ) |
|
902 |
#(#MenuItem #label: 'Palette' |
|
903 |
#accessCharacterPosition: 1 ) |
|
904 |
#(#MenuItem #label: 'Canvas Tool' |
|
905 |
#accessCharacterPosition: 1 ) |
|
906 |
#(#MenuItem #label: 'Image Editor' |
|
907 |
#accessCharacterPosition: 1 ) |
|
908 |
#(#MenuItem #label: 'Menu Editor' |
|
909 |
#accessCharacterPosition: 1 ) |
|
910 |
#(#MenuItem #label: 'Advanced' |
|
911 |
#accessCharacterPosition: 1 ) |
|
912 |
#(#MenuItem #label: 'DLL and C Connect' |
|
913 |
#accessCharacterPosition: 1 ) |
|
914 |
#(#MenuItem #label: 'System Transcript' |
|
915 |
#accessCharacterPosition: 8 ) |
|
916 |
) |
|
917 |
#(4 5 2 1 ) |
|
918 |
#(#openFileList #openFileEditor #openRefactoringTool #toolsNewWorkspace #toolsNewCanvas #toolsPalette #toolsCanvasTool #toolsMaskEditor #toolsMenuEditor nil #openExternalFinder #toggleSystemTranscript ) |
|
919 |
) decodeAsLiteralArray startUp |
|
454 | 920 |
" |
921 |
||
457 | 922 |
"submenus: |
923 |
#(#Menu #( |
|
1245 | 924 |
#(#MenuItem |
925 |
#label: 'Foo' |
|
926 |
#submenu: #(#Menu #( |
|
927 |
#(#MenuItem #label: 'foo 1') |
|
928 |
#(#MenuItem #label: 'foo 2') |
|
929 |
) |
|
930 |
nil |
|
931 |
#(11 22) |
|
932 |
) |
|
933 |
) |
|
934 |
#(#MenuItem |
|
935 |
#label: 'Inspect' ) |
|
936 |
#(#MenuItem |
|
937 |
#label: 'Coredump' ) |
|
938 |
) |
|
939 |
#(3 ) |
|
940 |
#(1 2 3 ) |
|
457 | 941 |
) decodeAsLiteralArray startUp |
942 |
" |
|
943 |
||
2864
f90017f2da66
changed: #fromLiteralArrayEncoding:
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
944 |
"Modified: / 08-08-2010 / 14:43:03 / cg" |
489 | 945 |
! |
946 |
||
947 |
literalArrayEncoding |
|
948 |
"return myself encoded as a literal array" |
|
949 |
||
1245 | 950 |
|coll array size| |
489 | 951 |
|
952 |
coll := OrderedCollection new. |
|
953 |
coll add:#Menu. |
|
1245 | 954 |
|
955 |
(size := items size) == 0 ifTrue:[ |
|
956 |
array := nil |
|
957 |
] ifFalse:[ |
|
958 |
array := Array new:size. |
|
959 |
items keysAndValuesDo:[:anIndex :anItem| |
|
960 |
array at:anIndex put:(anItem literalArrayEncoding) |
|
961 |
] |
|
962 |
]. |
|
963 |
coll add:array. |
|
964 |
||
965 |
(size := groupSizes size) == 0 ifTrue:[ |
|
966 |
array := nil |
|
967 |
] ifFalse:[ |
|
968 |
array := Array new:size. |
|
969 |
groupSizes keysAndValuesDo:[:anIndex :aSize| |
|
970 |
array at:anIndex put:(aSize literalArrayEncoding) |
|
971 |
] |
|
972 |
]. |
|
973 |
coll add:array. |
|
489 | 974 |
coll add:nil. |
579 | 975 |
^ coll asArray |
451 | 976 |
! ! |
977 |
||
584 | 978 |
!Menu methodsFor:'enumerating'! |
979 |
||
2494
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
980 |
allItemsDetect:aOneArgBlock ifNone:exceptionalValue |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
981 |
"find an element amongst each item and submenu items" |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
982 |
|
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
983 |
self itemsDo:[:anItem| |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
984 |
|sub subItem| |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
985 |
|
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
986 |
(aOneArgBlock value:anItem) ifTrue:[^ anItem]. |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
987 |
(sub := anItem submenu) notNil ifTrue:[ |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
988 |
subItem := sub allItemsDetect:aOneArgBlock ifNone:nil. |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
989 |
subItem notNil ifTrue:[^ subItem]. |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
990 |
] |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
991 |
]. |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
992 |
^ exceptionalValue value |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
993 |
! |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
994 |
|
665 | 995 |
allItemsDo:aOneArgBlock |
996 |
"evaluate block on each item and submenu items |
|
997 |
" |
|
998 |
self itemsDo:[:anItem| |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
999 |
|sub| |
724 | 1000 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1001 |
aOneArgBlock value:anItem. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1002 |
(sub := anItem submenu) notNil ifTrue:[ |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1003 |
sub allItemsDo:aOneArgBlock |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1004 |
] |
665 | 1005 |
] |
724 | 1006 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1007 |
"Modified: / 19.6.1998 / 00:34:53 / cg" |
665 | 1008 |
! |
1009 |
||
940 | 1010 |
detectItem:aBlock |
1011 |
"evaluate the argument, aBlock for each item in the menu until the |
|
1012 |
block returns true; in this case return the item which caused the |
|
1013 |
true evaluation. |
|
1014 |
If none of the evaluations returns true, return the result of the |
|
1015 |
evaluation of the exceptionBlock |
|
1016 |
" |
|
1017 |
^ self detectItem:aBlock ifNone:[self errorNotFound] |
|
1018 |
||
1019 |
! |
|
1020 |
||
1021 |
detectItem:aBlock ifNone:exceptionBlock |
|
1022 |
"evaluate the argument, aBlock for each item in the menu until the |
|
1023 |
block returns true; in this case return the item which caused the |
|
1024 |
true evaluation. |
|
1025 |
If none of the evaluations returns true, return the result of the |
|
1026 |
evaluation of the exceptionBlock |
|
1027 |
" |
|
1028 |
items notNil ifTrue:[ |
|
1029 |
^ items detect:aBlock ifNone:exceptionBlock |
|
1030 |
]. |
|
1031 |
^ exceptionBlock value |
|
1032 |
! |
|
1033 |
||
589 | 1034 |
itemsDo:aOneArgBlock |
1035 |
"evaluate the block for each item in the current menu |
|
1036 |
" |
|
1037 |
items notNil ifTrue:[items do:aOneArgBlock] |
|
1038 |
! |
|
1039 |
||
584 | 1040 |
menuAndSubmenusDetectItem:aOneArgBlock |
1041 |
"evaluate the block for each item in the current menu and all |
|
1042 |
submenus. In case that the block returns a non nil argument, |
|
1043 |
the item will be returned |
|
1044 |
" |
|
724 | 1045 |
|item| |
584 | 1046 |
|
1047 |
items notNil ifTrue:[ |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1048 |
items do:[:anItem| |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1049 |
|sub| |
724 | 1050 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1051 |
(aOneArgBlock value:anItem) ifTrue:[ |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1052 |
^ anItem |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1053 |
]. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1054 |
(sub := anItem submenu) notNil ifTrue:[ |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1055 |
item := sub menuAndSubmenusDetectItem:aOneArgBlock. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1056 |
item notNil ifTrue:[ |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1057 |
^ item |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1058 |
] |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1059 |
] |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1060 |
] |
584 | 1061 |
]. |
724 | 1062 |
^ nil |
1063 |
||
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1064 |
"Modified: / 19.6.1998 / 00:35:00 / cg" |
584 | 1065 |
! ! |
1066 |
||
672
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1067 |
!Menu methodsFor:'kludged fixes'! |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1068 |
|
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1069 |
destroy |
1599 | 1070 |
"dummy to allow a menu to be used where a MenuView used to be" |
672
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1071 |
|
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1072 |
"Created: 28.7.1997 / 10:16:52 / cg" |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1073 |
! ! |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1074 |
|
584 | 1075 |
!Menu methodsFor:'menu items'! |
1076 |
||
2404 | 1077 |
removeAllAccelerators |
1078 |
self allItemsDo:[:eachItem | |
|
1079 |
eachItem shortcutKey:nil. |
|
1080 |
]. |
|
1081 |
! |
|
1082 |
||
740 | 1083 |
someMenuItemLabeled:aLabel |
1084 |
"get the menu item with that label; in case that the label |
|
1085 |
is not found, nil is returned |
|
1086 |
" |
|
1087 |
^ self someMenuItemLabeled:aLabel ifNone:nil |
|
1088 |
||
1089 |
"Created: / 14.11.1997 / 20:55:17 / cg" |
|
1090 |
! |
|
1091 |
||
1092 |
someMenuItemLabeled:aLabel ifNone:exceptionBlock |
|
1093 |
"get the menu item labeled aLabel; in case that the value |
|
1094 |
is not found, the given exceptionBlock is executed and its value returned |
|
1095 |
" |
|
1096 |
|item| |
|
1097 |
||
1098 |
item := self menuAndSubmenusDetectItem:[:anItem| anItem label = aLabel]. |
|
1099 |
||
1100 |
item notNil ifTrue:[ |
|
1101 |
^ item |
|
1102 |
]. |
|
1103 |
^ exceptionBlock value |
|
1104 |
||
1105 |
"Created: / 14.11.1997 / 20:56:13 / cg" |
|
1106 |
! |
|
1107 |
||
584 | 1108 |
someMenuItemWithValue:aValue |
1109 |
"get the menu item assigned with the value; in case that the value |
|
1110 |
is not found nil is returned |
|
1111 |
" |
|
1112 |
^ self someMenuItemWithValue:aValue ifNone:nil |
|
1113 |
! |
|
1114 |
||
1115 |
someMenuItemWithValue:aValue ifNone:exceptionBlock |
|
1116 |
"get the menu item assigned with the value; in case that the value |
|
1117 |
is not found, the given exceptionBlock is executed and returned |
|
1118 |
" |
|
1119 |
|item| |
|
1120 |
||
1121 |
item := self menuAndSubmenusDetectItem:[:anItem| anItem value == aValue]. |
|
1122 |
||
1123 |
item notNil ifTrue:[ |
|
740 | 1124 |
^ item |
584 | 1125 |
]. |
1126 |
^ exceptionBlock value |
|
1127 |
! ! |
|
1128 |
||
1129 |
!Menu methodsFor:'queries'! |
|
1130 |
||
724 | 1131 |
hasHiddenItems |
1132 |
"test whether any item is hidden" |
|
1133 |
||
1134 |
self allItemsDo:[:anItem| |
|
740 | 1135 |
anItem isHidden ifTrue:[^ true] |
724 | 1136 |
]. |
1137 |
^ false |
|
1138 |
||
1139 |
"Modified: / 27.10.1997 / 15:12:44 / cg" |
|
1140 |
! |
|
1141 |
||
2584 | 1142 |
hasItems |
1143 |
"test whether there are any menu-items" |
|
1144 |
||
1145 |
^ items notEmptyOrNil |
|
1146 |
! |
|
1147 |
||
584 | 1148 |
hasSubMenuAt:anIndex |
1149 |
"test whether the menu item at the given index has a submenu |
|
1150 |
" |
|
1151 |
^ (self menuItemAt:anIndex) hasSubmenu |
|
1152 |
! ! |
|
1153 |
||
451 | 1154 |
!Menu methodsFor:'startup'! |
1155 |
||
729 | 1156 |
show |
1157 |
"realize the menu at its last position; returns the value associated with the |
|
1158 |
selected item, 0 if none was selected" |
|
1159 |
||
1160 |
^ (MenuPanel menu:self) show ? 0 |
|
1161 |
||
1162 |
||
1163 |
! |
|
1164 |
||
1165 |
showAt:aPoint |
|
1166 |
"realize the menu at aPoint; returns the value associated with the |
|
1167 |
selected item, 0 if none was selected" |
|
1168 |
||
1169 |
^ self showAt:aPoint resizing:true |
|
1170 |
||
1171 |
||
1172 |
! |
|
1173 |
||
1174 |
showAt:aPoint resizing:aBoolean |
|
1175 |
"realize the menu at aPoint; returns the value associated with the |
|
451 | 1176 |
selected item, 0 if none was selected" |
1177 |
||
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1178 |
^ ((MenuPanel menu:self) showAt:aPoint resizing:aBoolean) ? 0 |
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1179 |
|
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1180 |
"Modified: / 8.7.1998 / 19:57:55 / cg" |
729 | 1181 |
! |
1182 |
||
1183 |
showAtPointer |
|
1184 |
"realize the menu at the current pointer position; returns the value associated with the |
|
1185 |
selected item, 0 if none was selected" |
|
1186 |
||
1187 |
^ self startUp |
|
1188 |
! |
|
457 | 1189 |
|
729 | 1190 |
showCenteredIn:aView |
1191 |
"realize the menu visible at the aView center; returns the value associated with the |
|
1192 |
selected item, 0 if none was selected" |
|
1193 |
||
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1194 |
^ ((MenuPanel menu:self) showCenteredIn:aView) ? 0 |
729 | 1195 |
|
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1196 |
"Modified: / 8.7.1998 / 19:58:05 / cg" |
729 | 1197 |
! |
1198 |
||
1199 |
startUp |
|
1200 |
"display the menu as a popUp; returns the value associated with the |
|
2039 | 1201 |
selected item, nil if none was selected. |
1202 |
(should we return 0 form ST-80 compatibility ?)" |
|
729 | 1203 |
|
1367 | 1204 |
^ (MenuPanel menu:self) startUp "/ ? 0 |
451 | 1205 |
|
579 | 1206 |
" |
1367 | 1207 |
|m| |
579 | 1208 |
|
1367 | 1209 |
m := #(#Menu #( |
1210 |
#(#MenuItem |
|
1211 |
#rawLabel: 'left' |
|
1212 |
#value: #left ) |
|
1213 |
#(#MenuItem |
|
1214 |
#rawLabel: 'center' |
|
1215 |
#value: #center ) |
|
1216 |
#(#MenuItem |
|
1217 |
#rawLabel: 'right' |
|
1218 |
#value: #right ) ) |
|
1219 |
#(2) |
|
1220 |
nil |
|
1221 |
) decodeAsLiteralArray. |
|
451 | 1222 |
|
579 | 1223 |
Transcript showCR:(m startUp) |
1224 |
" |
|
938
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1225 |
! |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1226 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1227 |
startUpAt:aPoint |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1228 |
"display the menu as a popUp at aPoint; returns the value associated with the |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1229 |
selected item, 0 if none was selected" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1230 |
|
939 | 1231 |
^ ((MenuPanel menu:self) startUpAt:aPoint) ? 0 |
938
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1232 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1233 |
" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1234 |
|m| |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1235 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1236 |
m := #(#Menu #( |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1237 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1238 |
#rawLabel: 'left' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1239 |
#value: #left ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1240 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1241 |
#rawLabel: 'center' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1242 |
#value: #center ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1243 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1244 |
#rawLabel: 'right' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1245 |
#value: #right ) ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1246 |
#(2) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1247 |
nil |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1248 |
) decodeAsLiteralArray. |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1249 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1250 |
Transcript showCR:(m startUpAt:100@100) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1251 |
" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1252 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1253 |
"Created: / 21.5.1998 / 14:15:21 / cg" |
939 | 1254 |
"Modified: / 21.5.1998 / 14:17:46 / cg" |
1367 | 1255 |
! |
1256 |
||
1652 | 1257 |
startUpFor:originatingWidget |
1258 |
"display the menu as a popUp; returns the value associated with the |
|
2039 | 1259 |
selected item, nil if none was selected. |
1260 |
(should we return 0 for ST-80 compatibility ?)" |
|
1652 | 1261 |
|
1262 |
^ (MenuPanel menu:self) startUpFor:originatingWidget "/ ? 0 |
|
1263 |
||
1264 |
" |
|
1265 |
|m| |
|
1266 |
||
1267 |
m := #(#Menu #( |
|
1268 |
#(#MenuItem |
|
1269 |
#rawLabel: 'left' |
|
1270 |
#value: #left ) |
|
1271 |
#(#MenuItem |
|
1272 |
#rawLabel: 'center' |
|
1273 |
#value: #center ) |
|
1274 |
#(#MenuItem |
|
1275 |
#rawLabel: 'right' |
|
1276 |
#value: #right ) ) |
|
1277 |
#(2) |
|
1278 |
nil |
|
1279 |
) decodeAsLiteralArray. |
|
1280 |
||
1281 |
Transcript showCR:(m startUp) |
|
1282 |
" |
|
1283 |
! |
|
1284 |
||
1367 | 1285 |
startUpOrNil |
1286 |
"display the menu as a popUp; returns the value associated with the |
|
1287 |
selected item, nil if none was selected" |
|
1288 |
||
1405
c7775c10e8fd
tolerant literalDecoding (missing 2nd and 3rd elements);
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1289 |
^ (MenuPanel menu:self) startUpOrNil |
451 | 1290 |
! ! |
1291 |
||
2967
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1292 |
!Menu methodsFor:'utilities'! |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1293 |
|
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1294 |
replaceArgument: oldValue with: newValue |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1295 |
|
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1296 |
"Recusively Replace argument in menu items where |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1297 |
current argument is equal to oldValue by newValue" |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1298 |
|
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1299 |
self itemsDo:[:item| |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1300 |
item replaceArgument: oldValue with: newValue |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1301 |
] |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1302 |
|
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1303 |
"Created: / 12-10-2011 / 20:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1304 |
! ! |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1305 |
|
3778 | 1306 |
!Menu::NeedResourcesQuery class methodsFor:'defaults'! |
1307 |
||
1308 |
defaultAnswer |
|
1309 |
^ true |
|
1310 |
! ! |
|
1311 |
||
451 | 1312 |
!Menu class methodsFor:'documentation'! |
1313 |
||
2764 | 1314 |
version_CVS |
3752 | 1315 |
^ '$Header$' |
451 | 1316 |
! ! |
3117
3c7f6b69b2c5
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3028
diff
changeset
|
1317 |