author | Claus Gittinger <cg@exept.de> |
Tue, 29 Aug 2017 02:19:30 +0200 | |
changeset 3994 | 8ab8729d5dec |
parent 3968 | b3a568ff40cd |
child 4036 | 05c32a3bb82e |
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 |
3951 | 247 |
"look for a menuItem with the given nameKey. If one is found, aBlock is evaluated for it. |
3340 | 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 |
|
3951 | 258 |
|
259 |
"Modified (comment): / 16-05-2017 / 10:55:03 / mawalch" |
|
3340 | 260 |
! |
261 |
||
578 | 262 |
groupSizes |
1500 | 263 |
^ groupSizes |
264 |
! |
|
578 | 265 |
|
266 |
groupSizes:something |
|
1500 | 267 |
groupSizes := something. |
268 |
! |
|
578 | 269 |
|
3942 | 270 |
itemAtValue:aValue |
271 |
"gets the item which has aValue assigned as value |
|
272 |
" |
|
273 |
^ self menuAndSubmenusDetectItem:[:anItem | anItem value == aValue ]. |
|
274 |
||
275 |
"Created: / 14-03-2017 / 16:12:37 / cg" |
|
276 |
! |
|
277 |
||
1986 | 278 |
items |
279 |
^ items |
|
280 |
! |
|
281 |
||
3833 | 282 |
items:aCollectionOfMenuItems |
283 |
items := aCollectionOfMenuItems |
|
284 |
! |
|
285 |
||
584 | 286 |
labelAt:anIndex |
287 |
"gets the label of the menu item at the given index or nil |
|
288 |
" |
|
289 |
|item| |
|
290 |
||
291 |
(item := self menuItemAt:anIndex) notNil ifTrue:[ |
|
801 | 292 |
^ item label |
584 | 293 |
]. |
801 | 294 |
^ nil |
584 | 295 |
|
801 | 296 |
"Modified: / 2.2.1998 / 13:28:32 / cg" |
584 | 297 |
! |
298 |
||
299 |
labelAtValue:aValue |
|
300 |
"gets the label of the menu item assigned to value |
|
301 |
" |
|
302 |
|item| |
|
303 |
||
801 | 304 |
item := self menuAndSubmenusDetectItem:[:anItem | anItem value == aValue ]. |
584 | 305 |
|
306 |
item notNil ifTrue:[ |
|
801 | 307 |
^ item label |
584 | 308 |
]. |
801 | 309 |
^ nil |
584 | 310 |
|
801 | 311 |
"Modified: / 2.2.1998 / 13:28:28 / cg" |
584 | 312 |
! |
313 |
||
451 | 314 |
labels |
315 |
"return a collection of labels from my items" |
|
316 |
||
977
e07277070839
return valid collection in #labels.
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
317 |
items isNil ifTrue:[^ #()]. |
451 | 318 |
^ items collect:[:anItem | anItem label] |
319 |
||
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
320 |
"Created: / 25.2.1997 / 19:47:53 / cg" |
977
e07277070839
return valid collection in #labels.
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
321 |
"Modified: / 19.6.1998 / 02:36:22 / cg" |
451 | 322 |
! |
323 |
||
940 | 324 |
lastItem |
2584 | 325 |
"returns the last item or nil, if there are none" |
326 |
||
327 |
^ items isEmptyOrNil |
|
328 |
ifTrue:[nil] |
|
329 |
ifFalse:[items last] |
|
940 | 330 |
! |
331 |
||
489 | 332 |
lines |
737 | 333 |
"return the indexes of the menu items that are the last menu item in their group (except the very last)." |
489 | 334 |
|
801 | 335 |
|lines groupSz| |
737 | 336 |
|
3752 | 337 |
(groupSz := groupSizes size) <= 1 ifTrue: [^ #()]. |
801 | 338 |
lines := Array new:(groupSz - 1). |
339 |
lines at:1 put:groupSizes first. |
|
340 |
2 to:(groupSz-1) do:[:i | |
|
341 |
lines at:i put:(lines at:(i - 1)) + (groupSizes at:i) |
|
342 |
]. |
|
343 |
^ lines |
|
489 | 344 |
|
801 | 345 |
"Modified: / 2.2.1998 / 13:28:19 / cg" |
489 | 346 |
! |
347 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
348 |
menuItemAt:index |
3942 | 349 |
"gets the menu item at the given index. |
350 |
When the index is out of bounds, nil is returned" |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
351 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
352 |
(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
|
353 |
^ items at:index |
584 | 354 |
]. |
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
355 |
^ nil |
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 |
"Modified: / 30-06-2011 / 10:51:39 / cg" |
3942 | 358 |
"Modified (comment): / 14-03-2017 / 16:11:31 / cg" |
489 | 359 |
! |
360 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
361 |
menuItemLabeled:anItemLabel |
724 | 362 |
"return the menuItem for the given nameKey; nil if no such item is in the menu. |
363 |
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
|
364 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
365 |
self |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
366 |
allItemsDo:[:anItem | |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
367 |
|l| |
724 | 368 |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
369 |
((l := anItem label) sameAs:anItemLabel) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
370 |
^ anItem |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
371 |
]. |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
372 |
(l includes:$&) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
373 |
((l copyWithout:$&) sameAs:anItemLabel) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
374 |
^ anItem |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
375 |
] |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
376 |
] |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
377 |
]. |
724 | 378 |
^ nil |
379 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
380 |
"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
|
381 |
"Modified: / 30-06-2011 / 10:51:44 / cg" |
724 | 382 |
! |
383 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
384 |
menuItemWithArgument:aValue |
2908
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
385 |
"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
|
386 |
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
|
387 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
388 |
self |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
389 |
allItemsDo:[:anItem | |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
390 |
|l| |
2908
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
391 |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
392 |
(anItem argument = aValue) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
393 |
^ anItem |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
394 |
]. |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
395 |
]. |
2908
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
396 |
^ nil |
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
397 |
|
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
398 |
"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
|
399 |
"Modified: / 30-06-2011 / 10:51:50 / cg" |
2908
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
400 |
! |
e21010b76553
added: #menuItemWithArgument:
Claus Gittinger <cg@exept.de>
parents:
2867
diff
changeset
|
401 |
|
2952
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
402 |
menuItemWithKey:aValue |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
403 |
"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
|
404 |
Searches all items (i.e. also submenu items)" |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
405 |
|
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
406 |
self |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
407 |
allItemsDo:[:anItem | |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
408 |
|
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
409 |
(anItem nameKey = aValue) ifTrue:[ |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
410 |
^ anItem |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
411 |
]. |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
412 |
]. |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
413 |
^ nil |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
414 |
|
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
415 |
"Created: / 19-04-2011 / 14:42:18 / cg" |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
416 |
"Modified: / 30-06-2011 / 10:51:50 / cg" |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
417 |
"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
|
418 |
! |
1cedbbc95433
added: #menuItemWithKey:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2918
diff
changeset
|
419 |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
420 |
menuItemWithValue:aValue |
1652 | 421 |
"return the menuItem for the given value; nil if no such item is in the menu. |
422 |
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
|
423 |
|
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
424 |
self |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
425 |
allItemsDo:[:anItem | |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
426 |
|l| |
1652 | 427 |
|
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
428 |
(anItem value == aValue) ifTrue:[ |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
429 |
^ anItem |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
430 |
]. |
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
431 |
]. |
1652 | 432 |
^ nil |
433 |
||
2918
44a68f3ffba5
fixes for Jan's menu rewriting in NewSystemBrowser
Claus Gittinger <cg@exept.de>
parents:
2917
diff
changeset
|
434 |
"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
|
435 |
"Modified: / 30-06-2011 / 10:51:56 / cg" |
1652 | 436 |
! |
437 |
||
489 | 438 |
menuItems |
1327
b0b482a84570
menuItems always returns a collection (never nil)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
439 |
^ items ? #() |
489 | 440 |
! |
441 |
||
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
442 |
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
|
443 |
|n| |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
444 |
|
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
445 |
items := groupSizes := nil. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
446 |
|
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
447 |
aCollectionOfMenuItems size == 0 ifTrue:[ ^ self ]. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
448 |
|
451 | 449 |
items := aCollectionOfMenuItems. |
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
450 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
451 |
sizes size > 0 ifTrue:[ |
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
452 |
groupSizes := sizes. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
453 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
454 |
n := sizes inject:0 into:[:sumSoFar :this | sumSoFar + this]. |
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
455 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
456 |
n = items size ifTrue:[ |
3117
3c7f6b69b2c5
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3028
diff
changeset
|
457 |
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
|
458 |
] |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
459 |
]. |
451 | 460 |
|
579 | 461 |
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
|
462 |
items with:values do:[:anItem :aValue |anItem value:aValue] |
454 | 463 |
]. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
464 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
465 |
"Modified: / 19.4.1998 / 11:47:34 / cg" |
451 | 466 |
! |
467 |
||
1116 | 468 |
menuPerformer:something |
469 |
"set the receiver of the menu messages" |
|
470 |
||
471 |
receiver := something. |
|
472 |
||
473 |
"Modified: / 2.2.1998 / 13:26:29 / cg" |
|
474 |
! |
|
475 |
||
494 | 476 |
numberOfItems |
801 | 477 |
"return the number of items in this menu" |
478 |
||
494 | 479 |
^ items size |
480 |
||
801 | 481 |
"Created: / 6.3.1997 / 15:15:53 / cg" |
482 |
"Modified: / 2.2.1998 / 13:26:40 / cg" |
|
494 | 483 |
! |
484 |
||
579 | 485 |
receiver |
801 | 486 |
"return the receiver of the menu messages" |
579 | 487 |
|
801 | 488 |
^ receiver |
489 |
||
490 |
"Modified: / 2.2.1998 / 13:26:20 / cg" |
|
491 |
! |
|
579 | 492 |
|
493 |
receiver:something |
|
801 | 494 |
"set the receiver of the menu messages" |
579 | 495 |
|
801 | 496 |
receiver := something. |
497 |
||
498 |
"Modified: / 2.2.1998 / 13:26:29 / cg" |
|
499 |
! |
|
579 | 500 |
|
451 | 501 |
valueAt:index |
3942 | 502 |
"return the value of an item" |
451 | 503 |
|
504 |
^ (items at:index) value |
|
505 |
||
3942 | 506 |
"Created: / 25-02-1997 / 19:49:41 / cg" |
507 |
"Modified (comment): / 14-03-2017 / 16:10:23 / cg" |
|
451 | 508 |
! |
509 |
||
494 | 510 |
valueAt:anIndex put:aValue |
3942 | 511 |
"put value at an index" |
494 | 512 |
|
513 |
(items at:anIndex) value:aValue |
|
514 |
||
3942 | 515 |
"Created: / 06-03-1997 / 15:15:48 / cg" |
516 |
"Modified (comment): / 14-03-2017 / 16:10:29 / cg" |
|
494 | 517 |
! |
518 |
||
451 | 519 |
values |
520 |
"return a collection of values from my items" |
|
521 |
||
522 |
^ items collect:[:anItem | anItem value] |
|
523 |
||
524 |
"Created: 25.2.1997 / 19:49:29 / cg" |
|
724 | 525 |
! |
526 |
||
527 |
values:aCollectionOfValues |
|
3942 | 528 |
"set the collection of values in my items" |
724 | 529 |
|
530 |
|s| |
|
531 |
||
532 |
s := aCollectionOfValues readStream. |
|
533 |
self itemsDo:[:item | |
|
1111 | 534 |
|val| |
724 | 535 |
|
1111 | 536 |
val := s next. |
537 |
item value:val |
|
724 | 538 |
]. |
1111 | 539 |
s atEnd ifFalse:[ |
2092 | 540 |
self error:'not enough elements in the value collection' mayProceed:true |
1111 | 541 |
] |
724 | 542 |
|
3942 | 543 |
"Created: / 27-10-1997 / 15:15:47 / cg" |
544 |
"Modified (comment): / 14-03-2017 / 16:10:41 / cg" |
|
724 | 545 |
! |
546 |
||
547 |
visibleMenuItemGroups |
|
801 | 548 |
|itemGroups visibleItemGroups nextItem| |
724 | 549 |
|
801 | 550 |
itemGroups := OrderedCollection new. |
551 |
nextItem := 1. |
|
552 |
groupSizes do:[:groupSize | |
|
553 |
itemGroups addLast: (items copyFrom:nextItem to:nextItem + groupSize - 1). |
|
554 |
nextItem := nextItem + groupSize |
|
555 |
]. |
|
556 |
self hasHiddenItems ifFalse:[^ itemGroups]. |
|
724 | 557 |
|
801 | 558 |
"Remove the hidden items." |
559 |
visibleItemGroups := OrderedCollection new. |
|
560 |
itemGroups do:[:eachItemGroup | |
|
561 |
|visibleItemGroup| |
|
562 |
||
563 |
visibleItemGroup := eachItemGroup reject:[:eachMenuItem | eachMenuItem hidden]. |
|
2129 | 564 |
visibleItemGroup notEmpty ifTrue:[ |
801 | 565 |
visibleItemGroups addLast: visibleItemGroup |
566 |
] |
|
567 |
]. |
|
568 |
^ visibleItemGroups |
|
724 | 569 |
|
570 |
"Created: / 27.10.1997 / 15:07:50 / cg" |
|
801 | 571 |
"Modified: / 2.2.1998 / 13:25:52 / cg" |
451 | 572 |
! ! |
573 |
||
1397 | 574 |
!Menu methodsFor:'accessing-resource'! |
582 | 575 |
|
584 | 576 |
findGuiResourcesIn:aResourceContainerOrApplication |
2269
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
577 |
"setup a resource owner" |
1986 | 578 |
|
579 |
receiver isNil ifTrue:[ |
|
580 |
receiver := aResourceContainerOrApplication |
|
581 |
]. |
|
3778 | 582 |
self |
2269
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
583 |
findGuiResourcesIn:aResourceContainerOrApplication |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
584 |
rememberResourcesIn:(ValueHolder new) |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
585 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
586 |
"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
|
587 |
! |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
588 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
589 |
findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil |
3845 | 590 |
"resolve national language translations from aResourceContainerOrApplication" |
2269
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
591 |
|
3967 | 592 |
|need resolvedItems rcv| |
2269
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
593 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
594 |
"/ 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
|
595 |
"/ menu via #receiver: by the application. |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
596 |
"/ 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
|
597 |
"/ 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
|
598 |
|
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
599 |
"/ receiver isNil ifTrue:[ |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
600 |
"/ receiver := aResourceContainerOrApplication |
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
601 |
"/ ]. |
1986 | 602 |
items isEmptyOrNil ifTrue:[^ self]. |
3965 | 603 |
"/ someone might catch queries and return some non-boolean |
604 |
"/ this is a bad side effect of Query being a subclass of Notification!! |
|
3967 | 605 |
(need := NeedResourcesQuery query) == true ifFalse:[ |
606 |
need isBoolean ifFalse:[ |
|
3968 | 607 |
"/ Transcript showCR:NeedResourcesQuery findHandler senderContext(GuiBrowser::ExpeccoGuiBrowser >> update:with:from: [70]). |
608 |
"/ self halt. |
|
609 |
"/ NeedResourcesQuery query. |
|
3967 | 610 |
thisContext fullPrintAllOn:Transcript |
611 |
]. |
|
612 |
^self |
|
613 |
]. |
|
1986 | 614 |
|
615 |
resolvedItems := OrderedCollection new. |
|
616 |
||
617 |
items do:[:anItem | |
|
2867 | 618 |
anItem isMenuSlice ifTrue:[ |
619 |
|resItems| |
|
620 |
||
2059
36e4aa247402
fixed menu-slice resolving (search in masterApplication too)
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
621 |
rcv := aResourceContainerOrApplication. |
36e4aa247402
fixed menu-slice resolving (search in masterApplication too)
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
622 |
[rcv notNil and:[resItems isNil]] whileTrue:[ |
3965 | 623 |
"/ pass down the original app while walking the master chain, |
624 |
"/ so that subclices can be redefined (is that what we want???) |
|
625 |
resItems := anItem resolveSliceMenuItemsIn:rcv for:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil. |
|
2059
36e4aa247402
fixed menu-slice resolving (search in masterApplication too)
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
626 |
rcv := rcv perform:#masterApplication ifNotUnderstood:nil. |
36e4aa247402
fixed menu-slice resolving (search in masterApplication too)
Claus Gittinger <cg@exept.de>
parents:
2039
diff
changeset
|
627 |
]. |
1986 | 628 |
|
629 |
resItems notEmptyOrNil ifTrue:[ |
|
630 |
resolvedItems addAll:resItems. |
|
631 |
] |
|
632 |
] ifFalse:[ |
|
3449 | 633 |
anItem findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil. |
1986 | 634 |
resolvedItems add:anItem. |
1534
292c277fcf6a
findGuiResources... now sets the receiver, if not yet set
Claus Gittinger <cg@exept.de>
parents:
1532
diff
changeset
|
635 |
]. |
1986 | 636 |
]. |
637 |
items := resolvedItems. |
|
2269
7fae2df3ba48
resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents:
2129
diff
changeset
|
638 |
|
3968 | 639 |
"Modified: / 23-07-2017 / 12:17:58 / cg" |
582 | 640 |
! ! |
641 |
||
940 | 642 |
!Menu methodsFor:'adding & removing'! |
643 |
||
644 |
addItem:aMenuItem |
|
1029 | 645 |
"add a menuItem at the end; |
646 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
647 |
||
940 | 648 |
items isNil ifTrue:[ |
1029 | 649 |
items := OrderedCollection new |
650 |
] ifFalse:[ |
|
651 |
items := items asOrderedCollection |
|
940 | 652 |
]. |
653 |
items add:aMenuItem. |
|
1029 | 654 |
|
655 |
"Modified: / 4.8.1998 / 17:31:13 / cg" |
|
940 | 656 |
! |
657 |
||
658 |
addItem:aMenuItem beforeIndex:anIndex |
|
1029 | 659 |
"add a menuItem at some position; |
660 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
661 |
||
940 | 662 |
items isNil ifTrue:[ |
663 |
items := OrderedCollection new |
|
1029 | 664 |
] ifFalse:[ |
665 |
items := items asOrderedCollection |
|
940 | 666 |
]. |
667 |
items add:aMenuItem beforeIndex:anIndex. |
|
1029 | 668 |
|
669 |
"Modified: / 4.8.1998 / 17:31:39 / cg" |
|
940 | 670 |
! |
671 |
||
672 |
addItem:aMenuItem value:aValue |
|
3022 | 673 |
aMenuItem itemValue:aValue. |
940 | 674 |
self addItem:aMenuItem. |
3022 | 675 |
|
676 |
"Modified: / 09-09-2012 / 13:08:50 / cg" |
|
940 | 677 |
! |
678 |
||
1758 | 679 |
addItemGroup:aGroup |
1029 | 680 |
"add a group of items at the end; |
681 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
682 |
||
940 | 683 |
groupSizes isNil ifTrue:[ |
1758 | 684 |
groupSizes := OrderedCollection with:items size. |
940 | 685 |
]. |
1758 | 686 |
groupSizes add:aGroup size. |
940 | 687 |
|
1758 | 688 |
aGroup do:[:item | |
1029 | 689 |
self addItem:item |
940 | 690 |
]. |
691 |
||
692 |
"Created: / 27.10.1997 / 15:02:15 / cg" |
|
1029 | 693 |
"Modified: / 4.8.1998 / 17:32:06 / cg" |
940 | 694 |
! |
695 |
||
696 |
addItemGroup:aGroup values:values |
|
1029 | 697 |
"add a group of items at the end; |
698 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
699 |
||
1758 | 700 |
aGroup with:values do:[:item :value | |
701 |
item value:value |
|
940 | 702 |
]. |
1758 | 703 |
self addItemGroup:aGroup |
1029 | 704 |
|
705 |
"Modified: / 4.8.1998 / 17:32:18 / cg" |
|
940 | 706 |
! |
707 |
||
708 |
addItemGroupLabels:labels values:values |
|
1029 | 709 |
"add a group of items at the end; |
710 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
711 |
||
940 | 712 |
|items| |
713 |
||
714 |
items := labels with:values |
|
1029 | 715 |
collect:[:label :value | |
3185 | 716 |
MenuItem label:label itemValue:value |
1029 | 717 |
]. |
940 | 718 |
self addItemGroup:items |
719 |
||
720 |
"Created: / 27.10.1997 / 19:49:27 / cg" |
|
1029 | 721 |
"Modified: / 4.8.1998 / 17:35:22 / cg" |
940 | 722 |
! |
723 |
||
724 |
addItemLabel:label value:value |
|
1029 | 725 |
"add an item at the end; |
726 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
940 | 727 |
|
3185 | 728 |
self addItem:(MenuItem label:label itemValue:value) |
940 | 729 |
|
730 |
"Created: / 27.10.1997 / 19:47:12 / cg" |
|
1029 | 731 |
"Modified: / 4.8.1998 / 17:34:44 / cg" |
940 | 732 |
! |
733 |
||
3226 | 734 |
addItems: collection |
735 |
"Add all items in given collection. |
|
736 |
Useful to build a menu programmatically (or, to add more items dynamically)" |
|
737 |
||
738 |
items isNil ifTrue:[ |
|
739 |
items := OrderedCollection new |
|
740 |
] ifFalse:[ |
|
741 |
items := items asOrderedCollection |
|
742 |
]. |
|
743 |
items addAll: collection |
|
744 |
||
745 |
"Created: / 01-09-2013 / 16:43:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
746 |
! |
|
747 |
||
748 |
addItemsFrom: anotherMenu |
|
749 |
"Add all items from another menu. |
|
750 |
Useful to build a menu programmatically (or, to add more items dynamically)" |
|
751 |
||
3254 | 752 |
self addItems: anotherMenu items ? #() |
3226 | 753 |
|
754 |
"Created: / 01-09-2013 / 16:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3254 | 755 |
"Modified: / 04-10-2013 / 19:28:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3226 | 756 |
! |
757 |
||
1500 | 758 |
addSeparator |
759 |
"add a separating line item at the end; |
|
760 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
761 |
||
2814 | 762 |
self addItem:(MenuItem separator). |
1500 | 763 |
! |
764 |
||
940 | 765 |
removeItem:aMenuItem |
766 |
"remove an item from the menu" |
|
767 |
||
768 |
|idx| |
|
769 |
||
770 |
items notNil ifTrue:[ |
|
771 |
idx := items identityIndexOf:aMenuItem. |
|
772 |
idx ~~ 0 ifTrue:[ |
|
773 |
items removeAtIndex:idx |
|
774 |
] |
|
775 |
]. |
|
776 |
||
777 |
"Created: / 13.9.1997 / 10:27:31 / cg" |
|
778 |
"Modified: / 2.2.1998 / 13:26:49 / cg" |
|
779 |
! |
|
780 |
||
781 |
removeItemAt:anIndex |
|
782 |
"remove item at an index |
|
783 |
" |
|
784 |
anIndex <= items size ifTrue:[ |
|
785 |
^ items removeAtIndex:anIndex |
|
786 |
]. |
|
787 |
^ nil |
|
788 |
! ! |
|
789 |
||
451 | 790 |
!Menu methodsFor:'converting'! |
791 |
||
2081 | 792 |
asOldStylePopUpMenuFor:anApplicationOrNil |
2080 | 793 |
"a temporary kludge - will vanish, when oldStyle MenuView and PopUpMenu are gone" |
794 |
||
2081 | 795 |
|menuView itemsShown| |
796 |
||
2867 | 797 |
itemsShown := items |
798 |
select:[:each | |
|
2081 | 799 |
|visibilityInItem| |
800 |
||
801 |
visibilityInItem := each isVisible. |
|
802 |
visibilityInItem isNil ifTrue:[ |
|
803 |
true |
|
804 |
] ifFalse:[ |
|
805 |
visibilityInItem isBoolean ifTrue:[ |
|
806 |
visibilityInItem |
|
807 |
] ifFalse:[ |
|
808 |
visibilityInItem isSymbol ifTrue:[ |
|
2917
2ba0fee85a7f
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2916
diff
changeset
|
809 |
anApplicationOrNil isNil |
2ba0fee85a7f
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2916
diff
changeset
|
810 |
or:[ (anApplicationOrNil perform:visibilityInItem) value ]. |
2081 | 811 |
] ifFalse:[ |
812 |
visibilityInItem value |
|
813 |
]. |
|
814 |
]. |
|
815 |
]. |
|
816 |
]. |
|
2080 | 817 |
|
818 |
menuView := MenuView |
|
2081 | 819 |
labels:(itemsShown collect:[:each | each label]) |
820 |
selectors:(itemsShown collect:[:each | each value]) |
|
2751
d0729d604864
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2584
diff
changeset
|
821 |
accelerators:(itemsShown collect:[:each | each shortcutKey]) |
2081 | 822 |
args:(itemsShown collect:[:each | each argument]) |
2080 | 823 |
receiver:receiver. |
824 |
||
2092 | 825 |
itemsShown doWithIndex:[:each :idx | |
2081 | 826 |
|enabledInItem enabled| |
827 |
||
828 |
enabledInItem := each enabled. |
|
829 |
enabledInItem notNil ifTrue:[ |
|
830 |
enabledInItem isSymbol ifTrue:[ |
|
2917
2ba0fee85a7f
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2916
diff
changeset
|
831 |
enabled := anApplicationOrNil isNil or:[ (anApplicationOrNil perform:enabledInItem) ]. |
2081 | 832 |
] ifFalse:[ |
3028
29a0a22942fe
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
3022
diff
changeset
|
833 |
enabled := enabledInItem |
2081 | 834 |
]. |
835 |
enabled value ifFalse:[ |
|
2092 | 836 |
menuView disable:idx |
2081 | 837 |
]. |
838 |
]. |
|
839 |
]. |
|
840 |
||
3245 | 841 |
menuView actions:(itemsShown |
842 |
collect:[:each | |
|
843 |
[ |
|
844 |
|actionOrSymbol| |
|
845 |
||
846 |
actionOrSymbol := each itemValue. |
|
847 |
actionOrSymbol isBlock ifTrue:[ |
|
848 |
actionOrSymbol value |
|
849 |
] ifFalse:[ |
|
850 |
receiver perform:actionOrSymbol |
|
851 |
] |
|
852 |
] |
|
853 |
] |
|
854 |
). |
|
2080 | 855 |
|
856 |
^ PopUpMenu forMenu:menuView |
|
2867 | 857 |
|
2917
2ba0fee85a7f
changed: #asOldStylePopUpMenuFor:
Claus Gittinger <cg@exept.de>
parents:
2916
diff
changeset
|
858 |
"Modified: / 30-06-2011 / 10:35:57 / cg" |
2080 | 859 |
! |
860 |
||
451 | 861 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
862 |
"read my contents from a aLiteralEncodedArray" |
|
863 |
||
864 |
|items groups values| |
|
865 |
||
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
866 |
items := aLiteralEncodedArray at:2. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
867 |
|
2864
f90017f2da66
changed: #fromLiteralArrayEncoding:
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
868 |
items notNil ifTrue:[ |
1620
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
869 |
items := items collect:[:item | item decodeAsLiteralArray]. |
bf72298c42bc
bug fixes; handle unspecified items in literalArrayEncoding
ca
parents:
1599
diff
changeset
|
870 |
]. |
1405
c7775c10e8fd
tolerant literalDecoding (missing 2nd and 3rd elements);
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
871 |
groups := aLiteralEncodedArray at:3 ifAbsent:nil. |
c7775c10e8fd
tolerant literalDecoding (missing 2nd and 3rd elements);
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
872 |
values := aLiteralEncodedArray at:4 ifAbsent:nil. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
873 |
self menuItems:items menuItemGroups:groups values:values. |
451 | 874 |
|
875 |
"extract from PD folder.st: |
|
876 |
#(#Menu #( |
|
1245 | 877 |
#(#MenuItem |
878 |
#rawLabel: 'left' |
|
879 |
#value: #left ) |
|
880 |
#(#MenuItem |
|
881 |
#rawLabel: 'center' |
|
882 |
#value: #center ) |
|
883 |
#(#MenuItem |
|
884 |
#rawLabel: 'right' |
|
885 |
#value: #right ) |
|
886 |
) |
|
887 |
#(3 ) |
|
888 |
nil |
|
451 | 889 |
) decodeAsLiteralArray |
890 |
" |
|
452 | 891 |
" |
892 |
#(#Menu #( |
|
1245 | 893 |
#(#MenuItem |
894 |
#label: 'Straighten Up' ) |
|
895 |
#(#MenuItem |
|
896 |
#label: 'Inspect' ) |
|
897 |
#(#MenuItem |
|
898 |
#label: 'Coredump' ) |
|
899 |
) |
|
900 |
#(3 ) |
|
901 |
#(#straightenUp #inspect #halt ) |
|
452 | 902 |
) decodeAsLiteralArray startUp |
903 |
" |
|
457 | 904 |
|
454 | 905 |
"extract from iconicBrowser.st: |
452 | 906 |
#(#Menu #( |
1245 | 907 |
#(#MenuItem |
908 |
#label: 'Straighten Up' ) |
|
909 |
#(#MenuItem |
|
910 |
#label: 'Inspect' ) |
|
911 |
#(#MenuItem |
|
912 |
#label: 'Coredump' ) |
|
913 |
) |
|
914 |
#(3 ) |
|
915 |
#(1 2 3 ) |
|
452 | 916 |
) decodeAsLiteralArray startUp |
917 |
" |
|
451 | 918 |
|
454 | 919 |
"extract from refactory213.st: |
920 |
#(#Menu #( |
|
1245 | 921 |
#(#MenuItem |
922 |
#label: 'File List' |
|
923 |
#accessCharacterPosition: 1 ) |
|
924 |
#(#MenuItem #label: 'File Editor...' |
|
925 |
#accessCharacterPosition: 6 ) |
|
926 |
#(#MenuItem #label: 'Refactoring Tool...' |
|
927 |
#accessCharacterPosition: 1 ) |
|
928 |
#(#MenuItem #label: 'Workspace' |
|
929 |
#accessCharacterPosition: 1 ) |
|
930 |
#(#MenuItem #label: 'New Canvas' |
|
931 |
#accessCharacterPosition: 1 ) |
|
932 |
#(#MenuItem #label: 'Palette' |
|
933 |
#accessCharacterPosition: 1 ) |
|
934 |
#(#MenuItem #label: 'Canvas Tool' |
|
935 |
#accessCharacterPosition: 1 ) |
|
936 |
#(#MenuItem #label: 'Image Editor' |
|
937 |
#accessCharacterPosition: 1 ) |
|
938 |
#(#MenuItem #label: 'Menu Editor' |
|
939 |
#accessCharacterPosition: 1 ) |
|
940 |
#(#MenuItem #label: 'Advanced' |
|
941 |
#accessCharacterPosition: 1 ) |
|
942 |
#(#MenuItem #label: 'DLL and C Connect' |
|
943 |
#accessCharacterPosition: 1 ) |
|
944 |
#(#MenuItem #label: 'System Transcript' |
|
945 |
#accessCharacterPosition: 8 ) |
|
946 |
) |
|
947 |
#(4 5 2 1 ) |
|
948 |
#(#openFileList #openFileEditor #openRefactoringTool #toolsNewWorkspace #toolsNewCanvas #toolsPalette #toolsCanvasTool #toolsMaskEditor #toolsMenuEditor nil #openExternalFinder #toggleSystemTranscript ) |
|
949 |
) decodeAsLiteralArray startUp |
|
454 | 950 |
" |
951 |
||
457 | 952 |
"submenus: |
953 |
#(#Menu #( |
|
1245 | 954 |
#(#MenuItem |
955 |
#label: 'Foo' |
|
956 |
#submenu: #(#Menu #( |
|
957 |
#(#MenuItem #label: 'foo 1') |
|
958 |
#(#MenuItem #label: 'foo 2') |
|
959 |
) |
|
960 |
nil |
|
961 |
#(11 22) |
|
962 |
) |
|
963 |
) |
|
964 |
#(#MenuItem |
|
965 |
#label: 'Inspect' ) |
|
966 |
#(#MenuItem |
|
967 |
#label: 'Coredump' ) |
|
968 |
) |
|
969 |
#(3 ) |
|
970 |
#(1 2 3 ) |
|
457 | 971 |
) decodeAsLiteralArray startUp |
972 |
" |
|
973 |
||
2864
f90017f2da66
changed: #fromLiteralArrayEncoding:
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
974 |
"Modified: / 08-08-2010 / 14:43:03 / cg" |
489 | 975 |
! |
976 |
||
977 |
literalArrayEncoding |
|
978 |
"return myself encoded as a literal array" |
|
979 |
||
1245 | 980 |
|coll array size| |
489 | 981 |
|
982 |
coll := OrderedCollection new. |
|
983 |
coll add:#Menu. |
|
1245 | 984 |
|
985 |
(size := items size) == 0 ifTrue:[ |
|
986 |
array := nil |
|
987 |
] ifFalse:[ |
|
988 |
array := Array new:size. |
|
989 |
items keysAndValuesDo:[:anIndex :anItem| |
|
990 |
array at:anIndex put:(anItem literalArrayEncoding) |
|
991 |
] |
|
992 |
]. |
|
993 |
coll add:array. |
|
994 |
||
995 |
(size := groupSizes size) == 0 ifTrue:[ |
|
996 |
array := nil |
|
997 |
] ifFalse:[ |
|
998 |
array := Array new:size. |
|
999 |
groupSizes keysAndValuesDo:[:anIndex :aSize| |
|
1000 |
array at:anIndex put:(aSize literalArrayEncoding) |
|
1001 |
] |
|
1002 |
]. |
|
1003 |
coll add:array. |
|
489 | 1004 |
coll add:nil. |
579 | 1005 |
^ coll asArray |
451 | 1006 |
! ! |
1007 |
||
584 | 1008 |
!Menu methodsFor:'enumerating'! |
1009 |
||
2494
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1010 |
allItemsDetect:aOneArgBlock ifNone:exceptionalValue |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1011 |
"find an element amongst each item and submenu items" |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1012 |
|
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1013 |
self itemsDo:[:anItem| |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1014 |
|sub subItem| |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1015 |
|
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1016 |
(aOneArgBlock value:anItem) ifTrue:[^ anItem]. |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1017 |
(sub := anItem submenu) notNil ifTrue:[ |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1018 |
subItem := sub allItemsDetect:aOneArgBlock ifNone:nil. |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1019 |
subItem notNil ifTrue:[^ subItem]. |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1020 |
] |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1021 |
]. |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1022 |
^ exceptionalValue value |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1023 |
! |
994b030ae562
new enumerator: allItemsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
2433
diff
changeset
|
1024 |
|
665 | 1025 |
allItemsDo:aOneArgBlock |
1026 |
"evaluate block on each item and submenu items |
|
1027 |
" |
|
1028 |
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
|
1029 |
|sub| |
724 | 1030 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1031 |
aOneArgBlock value:anItem. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1032 |
(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
|
1033 |
sub allItemsDo:aOneArgBlock |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1034 |
] |
665 | 1035 |
] |
724 | 1036 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1037 |
"Modified: / 19.6.1998 / 00:34:53 / cg" |
665 | 1038 |
! |
1039 |
||
940 | 1040 |
detectItem:aBlock |
1041 |
"evaluate the argument, aBlock for each item in the menu until the |
|
1042 |
block returns true; in this case return the item which caused the |
|
1043 |
true evaluation. |
|
1044 |
If none of the evaluations returns true, return the result of the |
|
1045 |
evaluation of the exceptionBlock |
|
1046 |
" |
|
1047 |
^ self detectItem:aBlock ifNone:[self errorNotFound] |
|
1048 |
||
1049 |
! |
|
1050 |
||
3942 | 1051 |
detectItem:aBlock ifNone:exceptionValue |
940 | 1052 |
"evaluate the argument, aBlock for each item in the menu until the |
1053 |
block returns true; in this case return the item which caused the |
|
1054 |
true evaluation. |
|
3942 | 1055 |
If none of the evaluations returns true, return the value from exceptionValue |
940 | 1056 |
" |
1057 |
items notNil ifTrue:[ |
|
3942 | 1058 |
^ items detect:aBlock ifNone:exceptionValue |
940 | 1059 |
]. |
3942 | 1060 |
^ exceptionValue value |
1061 |
||
1062 |
"Modified (comment): / 14-03-2017 / 16:09:51 / cg" |
|
940 | 1063 |
! |
1064 |
||
589 | 1065 |
itemsDo:aOneArgBlock |
1066 |
"evaluate the block for each item in the current menu |
|
1067 |
" |
|
1068 |
items notNil ifTrue:[items do:aOneArgBlock] |
|
1069 |
! |
|
1070 |
||
584 | 1071 |
menuAndSubmenusDetectItem:aOneArgBlock |
1072 |
"evaluate the block for each item in the current menu and all |
|
1073 |
submenus. In case that the block returns a non nil argument, |
|
1074 |
the item will be returned |
|
1075 |
" |
|
724 | 1076 |
|item| |
584 | 1077 |
|
1078 |
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
|
1079 |
items do:[:anItem| |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1080 |
|sub| |
724 | 1081 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1082 |
(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
|
1083 |
^ anItem |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1084 |
]. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1085 |
(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
|
1086 |
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
|
1087 |
item notNil ifTrue:[ |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1088 |
^ item |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1089 |
] |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1090 |
] |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1091 |
] |
584 | 1092 |
]. |
724 | 1093 |
^ nil |
1094 |
||
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
1095 |
"Modified: / 19.6.1998 / 00:35:00 / cg" |
584 | 1096 |
! ! |
1097 |
||
672
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1098 |
!Menu methodsFor:'kludged fixes'! |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1099 |
|
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1100 |
destroy |
1599 | 1101 |
"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
|
1102 |
|
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1103 |
"Created: 28.7.1997 / 10:16:52 / cg" |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1104 |
! ! |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
1105 |
|
584 | 1106 |
!Menu methodsFor:'menu items'! |
1107 |
||
2404 | 1108 |
removeAllAccelerators |
1109 |
self allItemsDo:[:eachItem | |
|
1110 |
eachItem shortcutKey:nil. |
|
1111 |
]. |
|
1112 |
! |
|
1113 |
||
740 | 1114 |
someMenuItemLabeled:aLabel |
1115 |
"get the menu item with that label; in case that the label |
|
1116 |
is not found, nil is returned |
|
1117 |
" |
|
1118 |
^ self someMenuItemLabeled:aLabel ifNone:nil |
|
1119 |
||
1120 |
"Created: / 14.11.1997 / 20:55:17 / cg" |
|
1121 |
! |
|
1122 |
||
1123 |
someMenuItemLabeled:aLabel ifNone:exceptionBlock |
|
1124 |
"get the menu item labeled aLabel; in case that the value |
|
1125 |
is not found, the given exceptionBlock is executed and its value returned |
|
1126 |
" |
|
1127 |
|item| |
|
1128 |
||
1129 |
item := self menuAndSubmenusDetectItem:[:anItem| anItem label = aLabel]. |
|
1130 |
||
1131 |
item notNil ifTrue:[ |
|
1132 |
^ item |
|
1133 |
]. |
|
1134 |
^ exceptionBlock value |
|
1135 |
||
1136 |
"Created: / 14.11.1997 / 20:56:13 / cg" |
|
1137 |
! |
|
1138 |
||
584 | 1139 |
someMenuItemWithValue:aValue |
1140 |
"get the menu item assigned with the value; in case that the value |
|
1141 |
is not found nil is returned |
|
1142 |
" |
|
1143 |
^ self someMenuItemWithValue:aValue ifNone:nil |
|
1144 |
! |
|
1145 |
||
1146 |
someMenuItemWithValue:aValue ifNone:exceptionBlock |
|
1147 |
"get the menu item assigned with the value; in case that the value |
|
1148 |
is not found, the given exceptionBlock is executed and returned |
|
1149 |
" |
|
1150 |
|item| |
|
1151 |
||
1152 |
item := self menuAndSubmenusDetectItem:[:anItem| anItem value == aValue]. |
|
1153 |
||
1154 |
item notNil ifTrue:[ |
|
740 | 1155 |
^ item |
584 | 1156 |
]. |
1157 |
^ exceptionBlock value |
|
1158 |
! ! |
|
1159 |
||
1160 |
!Menu methodsFor:'queries'! |
|
1161 |
||
724 | 1162 |
hasHiddenItems |
1163 |
"test whether any item is hidden" |
|
1164 |
||
1165 |
self allItemsDo:[:anItem| |
|
740 | 1166 |
anItem isHidden ifTrue:[^ true] |
724 | 1167 |
]. |
1168 |
^ false |
|
1169 |
||
1170 |
"Modified: / 27.10.1997 / 15:12:44 / cg" |
|
1171 |
! |
|
1172 |
||
2584 | 1173 |
hasItems |
1174 |
"test whether there are any menu-items" |
|
1175 |
||
1176 |
^ items notEmptyOrNil |
|
1177 |
! |
|
1178 |
||
584 | 1179 |
hasSubMenuAt:anIndex |
1180 |
"test whether the menu item at the given index has a submenu |
|
1181 |
" |
|
1182 |
^ (self menuItemAt:anIndex) hasSubmenu |
|
1183 |
! ! |
|
1184 |
||
451 | 1185 |
!Menu methodsFor:'startup'! |
1186 |
||
729 | 1187 |
show |
1188 |
"realize the menu at its last position; returns the value associated with the |
|
1189 |
selected item, 0 if none was selected" |
|
1190 |
||
1191 |
^ (MenuPanel menu:self) show ? 0 |
|
1192 |
||
1193 |
||
1194 |
! |
|
1195 |
||
1196 |
showAt:aPoint |
|
1197 |
"realize the menu at aPoint; returns the value associated with the |
|
1198 |
selected item, 0 if none was selected" |
|
1199 |
||
1200 |
^ self showAt:aPoint resizing:true |
|
1201 |
||
1202 |
||
1203 |
! |
|
1204 |
||
1205 |
showAt:aPoint resizing:aBoolean |
|
1206 |
"realize the menu at aPoint; returns the value associated with the |
|
451 | 1207 |
selected item, 0 if none was selected" |
1208 |
||
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1209 |
^ ((MenuPanel menu:self) showAt:aPoint resizing:aBoolean) ? 0 |
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1210 |
|
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1211 |
"Modified: / 8.7.1998 / 19:57:55 / cg" |
729 | 1212 |
! |
1213 |
||
1214 |
showAtPointer |
|
1215 |
"realize the menu at the current pointer position; returns the value associated with the |
|
1216 |
selected item, 0 if none was selected" |
|
1217 |
||
1218 |
^ self startUp |
|
1219 |
! |
|
457 | 1220 |
|
729 | 1221 |
showCenteredIn:aView |
1222 |
"realize the menu visible at the aView center; returns the value associated with the |
|
1223 |
selected item, 0 if none was selected" |
|
1224 |
||
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1225 |
^ ((MenuPanel menu:self) showCenteredIn:aView) ? 0 |
729 | 1226 |
|
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
1227 |
"Modified: / 8.7.1998 / 19:58:05 / cg" |
729 | 1228 |
! |
1229 |
||
1230 |
startUp |
|
1231 |
"display the menu as a popUp; returns the value associated with the |
|
2039 | 1232 |
selected item, nil if none was selected. |
1233 |
(should we return 0 form ST-80 compatibility ?)" |
|
729 | 1234 |
|
1367 | 1235 |
^ (MenuPanel menu:self) startUp "/ ? 0 |
451 | 1236 |
|
579 | 1237 |
" |
1367 | 1238 |
|m| |
579 | 1239 |
|
1367 | 1240 |
m := #(#Menu #( |
1241 |
#(#MenuItem |
|
1242 |
#rawLabel: 'left' |
|
1243 |
#value: #left ) |
|
1244 |
#(#MenuItem |
|
1245 |
#rawLabel: 'center' |
|
1246 |
#value: #center ) |
|
1247 |
#(#MenuItem |
|
1248 |
#rawLabel: 'right' |
|
1249 |
#value: #right ) ) |
|
1250 |
#(2) |
|
1251 |
nil |
|
1252 |
) decodeAsLiteralArray. |
|
451 | 1253 |
|
579 | 1254 |
Transcript showCR:(m startUp) |
1255 |
" |
|
938
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1256 |
! |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1257 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1258 |
startUpAt:aPoint |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1259 |
"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
|
1260 |
selected item, 0 if none was selected" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1261 |
|
939 | 1262 |
^ ((MenuPanel menu:self) startUpAt:aPoint) ? 0 |
938
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1263 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1264 |
" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1265 |
|m| |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1266 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1267 |
m := #(#Menu #( |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1268 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1269 |
#rawLabel: 'left' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1270 |
#value: #left ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1271 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1272 |
#rawLabel: 'center' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1273 |
#value: #center ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1274 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1275 |
#rawLabel: 'right' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1276 |
#value: #right ) ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1277 |
#(2) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1278 |
nil |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1279 |
) decodeAsLiteralArray. |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1280 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1281 |
Transcript showCR:(m startUpAt:100@100) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1282 |
" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1283 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1284 |
"Created: / 21.5.1998 / 14:15:21 / cg" |
939 | 1285 |
"Modified: / 21.5.1998 / 14:17:46 / cg" |
1367 | 1286 |
! |
1287 |
||
1652 | 1288 |
startUpFor:originatingWidget |
1289 |
"display the menu as a popUp; returns the value associated with the |
|
2039 | 1290 |
selected item, nil if none was selected. |
1291 |
(should we return 0 for ST-80 compatibility ?)" |
|
1652 | 1292 |
|
1293 |
^ (MenuPanel menu:self) startUpFor:originatingWidget "/ ? 0 |
|
1294 |
||
1295 |
" |
|
1296 |
|m| |
|
1297 |
||
1298 |
m := #(#Menu #( |
|
1299 |
#(#MenuItem |
|
1300 |
#rawLabel: 'left' |
|
1301 |
#value: #left ) |
|
1302 |
#(#MenuItem |
|
1303 |
#rawLabel: 'center' |
|
1304 |
#value: #center ) |
|
1305 |
#(#MenuItem |
|
1306 |
#rawLabel: 'right' |
|
1307 |
#value: #right ) ) |
|
1308 |
#(2) |
|
1309 |
nil |
|
1310 |
) decodeAsLiteralArray. |
|
1311 |
||
1312 |
Transcript showCR:(m startUp) |
|
1313 |
" |
|
1314 |
! |
|
1315 |
||
1367 | 1316 |
startUpOrNil |
1317 |
"display the menu as a popUp; returns the value associated with the |
|
1318 |
selected item, nil if none was selected" |
|
1319 |
||
1405
c7775c10e8fd
tolerant literalDecoding (missing 2nd and 3rd elements);
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1320 |
^ (MenuPanel menu:self) startUpOrNil |
451 | 1321 |
! ! |
1322 |
||
2967
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1323 |
!Menu methodsFor:'utilities'! |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1324 |
|
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1325 |
replaceArgument: oldValue with: newValue |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1326 |
|
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1327 |
"Recusively Replace argument in menu items where |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1328 |
current argument is equal to oldValue by newValue" |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1329 |
|
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1330 |
self itemsDo:[:item| |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1331 |
item replaceArgument: oldValue with: newValue |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1332 |
] |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1333 |
|
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1334 |
"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
|
1335 |
! ! |
c50ab5fa6cf0
Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2952
diff
changeset
|
1336 |
|
3778 | 1337 |
!Menu::NeedResourcesQuery class methodsFor:'defaults'! |
1338 |
||
1339 |
defaultAnswer |
|
1340 |
^ true |
|
1341 |
! ! |
|
1342 |
||
3968 | 1343 |
!Menu::NeedResourcesQuery methodsFor:'accessing'! |
1344 |
||
1345 |
defaultResumeValue |
|
1346 |
"the default answer, if no one handles the query and the exception is resumed" |
|
1347 |
||
1348 |
^ true |
|
1349 |
||
1350 |
"Created: / 23-07-2017 / 12:13:27 / cg" |
|
1351 |
! ! |
|
1352 |
||
451 | 1353 |
!Menu class methodsFor:'documentation'! |
1354 |
||
3845 | 1355 |
version |
1356 |
^ '$Header$' |
|
1357 |
! |
|
1358 |
||
2764 | 1359 |
version_CVS |
3752 | 1360 |
^ '$Header$' |
451 | 1361 |
! ! |
3117
3c7f6b69b2c5
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3028
diff
changeset
|
1362 |