author | Claus Gittinger <cg@exept.de> |
Mon, 12 Apr 1999 13:16:06 +0200 | |
changeset 1156 | abdd5a7dce49 |
parent 1116 | 2b08dc4f8ae1 |
child 1174 | f58d5c8cee82 |
permissions | -rw-r--r-- |
451 | 1 |
Object subclass:#Menu |
579 | 2 |
instanceVariableNames:'items groupSizes receiver' |
451 | 3 |
classVariableNames:'' |
4 |
poolDictionaries:'' |
|
5 |
category:'Views-Support' |
|
6 |
! |
|
7 |
||
8 |
!Menu class methodsFor:'documentation'! |
|
9 |
||
10 |
documentation |
|
11 |
" |
|
12 |
not yet finished Menu class - this will eventually replace |
|
13 |
most of the MenuView and PopUpMenu stuff. |
|
14 |
(and hopefully be ST-80 compatible ...) |
|
15 |
||
16 |
For now, only a subset of the full protocol is implemented. |
|
17 |
||
18 |
[author:] |
|
740 | 19 |
Claus Gittinger |
451 | 20 |
|
21 |
[see also:] |
|
740 | 22 |
MenuItem |
23 |
PopUpMenu |
|
451 | 24 |
" |
25 |
! ! |
|
26 |
||
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
27 |
!Menu class methodsFor:'instance creation'! |
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
28 |
|
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
29 |
labelArray: arrayOfString lines: linesArray values: valueArrayOrNil |
737 | 30 |
"return a menu with menu items built with labels from arrayOfString (not Symbols). |
31 |
The linesArray describes which menu items are the last menu item in their group. |
|
32 |
The valueArray contains value objects for each menu item |
|
33 |
(or is nil if no value objects are specified)." |
|
34 |
||
35 |
| nLabel valueArray menuItems groupLengths | |
|
36 |
||
37 |
nLabel := arrayOfString size. |
|
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
38 |
|
737 | 39 |
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
|
40 |
(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
|
41 |
valueArray := #() |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
42 |
] ifFalse:[ |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
43 |
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
|
44 |
] |
737 | 45 |
] 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
|
46 |
valueArray := valueArrayOrNil |
737 | 47 |
]. |
48 |
||
49 |
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
|
50 |
^ self error: 'illegal menu combination' |
737 | 51 |
]. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
52 |
|
737 | 53 |
menuItems := Array new:nLabel. |
54 |
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
|
55 |
|mi v| |
737 | 56 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
57 |
mi := MenuItem labeled: (arrayOfString at:i) asString. |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
58 |
v := valueArray at: i. |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
59 |
(v isKindOf: Menu) ifTrue: [mi submenu: v]. |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
60 |
menuItems at: i put: mi |
737 | 61 |
]. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
62 |
|
737 | 63 |
(linesArray == nil or:[linesArray isEmpty]) 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
|
64 |
groupLengths := (menuItems isEmpty) |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
65 |
ifTrue: [Array new: 0] |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
66 |
ifFalse: [Array with: menuItems size] |
737 | 67 |
] 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
|
68 |
groupLengths := Array new: linesArray size + 1. |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
69 |
groupLengths at: 1 put: linesArray first. |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
70 |
2 to: linesArray size do: [:i | |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
71 |
groupLengths at: i put: (linesArray at: i) - (linesArray at: i - 1) |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
72 |
]. |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
73 |
groupLengths at: groupLengths size put: menuItems size - linesArray last. |
737 | 74 |
]. |
75 |
||
76 |
^ self new |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
77 |
menuItems: menuItems |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
78 |
menuItemGroups: groupLengths |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
79 |
values: valueArray |
737 | 80 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
81 |
"Modified: / 19.4.1998 / 11:30:18 / cg" |
696 | 82 |
! |
83 |
||
84 |
labelList:arrayOfGroupStrings values:valueArrayOrNil |
|
85 |
|labels lines| |
|
86 |
||
87 |
lines := arrayOfGroupStrings collect:[:each | each size]. |
|
88 |
labels := OrderedCollection new. |
|
89 |
arrayOfGroupStrings do:[:group | labels addAll:group]. |
|
90 |
^ self labelArray:labels lines:lines values:valueArrayOrNil |
|
91 |
||
92 |
"Modified: 20.6.1997 / 10:46:45 / cg" |
|
93 |
"Created: 13.9.1997 / 10:35:46 / cg" |
|
737 | 94 |
! |
95 |
||
738 | 96 |
labels:aString lines:linesArray values:valueArrayOrNil |
737 | 97 |
^ self |
740 | 98 |
labelArray:(aString asCollectionOfLines) |
99 |
lines:linesArray |
|
100 |
values:valueArrayOrNil |
|
737 | 101 |
|
102 |
"Created: / 31.10.1997 / 03:12:20 / cg" |
|
738 | 103 |
"Modified: / 31.10.1997 / 03:23:42 / cg" |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
104 |
! ! |
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
105 |
|
724 | 106 |
!Menu methodsFor:'ST-80 compatibility'! |
107 |
||
108 |
indexOfMenuItem:anItem |
|
109 |
||
110 |
^ items indexOf:anItem |
|
111 |
||
112 |
"Created: / 27.10.1997 / 16:34:19 / cg" |
|
113 |
! |
|
114 |
||
115 |
menuButtons |
|
116 |
"ST-80 seems to use a special menuButton class here. |
|
117 |
Here, kludge a collection of menuItems." |
|
118 |
||
119 |
^ items |
|
120 |
||
121 |
"Created: / 27.10.1997 / 16:33:35 / cg" |
|
122 |
! ! |
|
123 |
||
451 | 124 |
!Menu methodsFor:'accessing'! |
125 |
||
696 | 126 |
atNameKey:aNameKey |
724 | 127 |
"return the menuItem for the given nameKey; nil if no such item is in the menu. |
128 |
Searches in allItems (i.e. also in subMenus)" |
|
696 | 129 |
|
724 | 130 |
self allItemsDo:[:anItem| |
740 | 131 |
anItem nameKey == aNameKey ifTrue:[^ anItem] |
724 | 132 |
]. |
696 | 133 |
^ nil |
134 |
||
724 | 135 |
"Modified: / 27.10.1997 / 15:12:00 / cg" |
696 | 136 |
! |
137 |
||
578 | 138 |
groupSizes |
139 |
"return the value of the instance variable 'groupSizes' (automatically generated)" |
|
140 |
||
141 |
^ groupSizes! |
|
142 |
||
143 |
groupSizes:something |
|
144 |
"set the value of the instance variable 'groupSizes' (automatically generated)" |
|
145 |
||
146 |
groupSizes := something.! |
|
147 |
||
584 | 148 |
labelAt:anIndex |
149 |
"gets the label of the menu item at the given index or nil |
|
150 |
" |
|
151 |
|item| |
|
152 |
||
153 |
(item := self menuItemAt:anIndex) notNil ifTrue:[ |
|
801 | 154 |
^ item label |
584 | 155 |
]. |
801 | 156 |
^ nil |
584 | 157 |
|
801 | 158 |
"Modified: / 2.2.1998 / 13:28:32 / cg" |
584 | 159 |
! |
160 |
||
161 |
labelAtValue:aValue |
|
162 |
"gets the label of the menu item assigned to value |
|
163 |
" |
|
164 |
|item| |
|
165 |
||
801 | 166 |
item := self menuAndSubmenusDetectItem:[:anItem | anItem value == aValue ]. |
584 | 167 |
|
168 |
item notNil ifTrue:[ |
|
801 | 169 |
^ item label |
584 | 170 |
]. |
801 | 171 |
^ nil |
584 | 172 |
|
801 | 173 |
"Modified: / 2.2.1998 / 13:28:28 / cg" |
584 | 174 |
! |
175 |
||
451 | 176 |
labels |
177 |
"return a collection of labels from my items" |
|
178 |
||
977
e07277070839
return valid collection in #labels.
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
179 |
items isNil ifTrue:[^ #()]. |
451 | 180 |
^ items collect:[:anItem | anItem label] |
181 |
||
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
182 |
"Created: / 25.2.1997 / 19:47:53 / cg" |
977
e07277070839
return valid collection in #labels.
Claus Gittinger <cg@exept.de>
parents:
972
diff
changeset
|
183 |
"Modified: / 19.6.1998 / 02:36:22 / cg" |
451 | 184 |
! |
185 |
||
940 | 186 |
lastItem |
187 |
"returns last item |
|
188 |
" |
|
189 |
^ items notNil ifTrue:[items last] ifFalse:[nil] |
|
190 |
! |
|
191 |
||
489 | 192 |
lines |
737 | 193 |
"return the indexes of the menu items that are the last menu item in their group (except the very last)." |
489 | 194 |
|
801 | 195 |
|lines groupSz| |
737 | 196 |
|
801 | 197 |
(groupSz := groupSizes size) <= 1 ifTrue: [^ Array new]. |
198 |
lines := Array new:(groupSz - 1). |
|
199 |
lines at:1 put:groupSizes first. |
|
200 |
2 to:(groupSz-1) do:[:i | |
|
201 |
lines at:i put:(lines at:(i - 1)) + (groupSizes at:i) |
|
202 |
]. |
|
203 |
^ lines |
|
489 | 204 |
|
801 | 205 |
"Modified: / 2.2.1998 / 13:28:19 / cg" |
489 | 206 |
! |
207 |
||
208 |
menuItemAt:index |
|
584 | 209 |
"gets the menu item at the given index. When the index is out of bounds |
210 |
nil is returned |
|
211 |
" |
|
212 |
(index > 0 and:[index <= items size]) ifTrue:[ |
|
740 | 213 |
^ items at:index |
584 | 214 |
]. |
215 |
^ nil |
|
489 | 216 |
! |
217 |
||
724 | 218 |
menuItemLabeled:anItemLabel |
219 |
"return the menuItem for the given nameKey; nil if no such item is in the menu. |
|
220 |
Searches all items (i.e. also submenu items)" |
|
221 |
||
222 |
self allItemsDo:[:anItem| |
|
740 | 223 |
|l| |
724 | 224 |
|
740 | 225 |
((l := anItem label) sameAs: anItemLabel) ifTrue:[ |
226 |
^ anItem |
|
227 |
]. |
|
228 |
(l includes:$&) ifTrue:[ |
|
229 |
((l copyWithout:$&) sameAs: anItemLabel) ifTrue:[ |
|
230 |
^ anItem |
|
231 |
] |
|
232 |
] |
|
233 |
]. |
|
724 | 234 |
^ nil |
235 |
||
236 |
"Created: / 13.9.1997 / 10:25:16 / cg" |
|
237 |
"Modified: / 27.10.1997 / 15:23:33 / cg" |
|
238 |
! |
|
239 |
||
489 | 240 |
menuItems |
241 |
^ items |
|
242 |
! |
|
243 |
||
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
244 |
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
|
245 |
|n| |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
246 |
|
451 | 247 |
items := aCollectionOfMenuItems. |
579 | 248 |
groupSizes := sizes. |
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
249 |
sizes size > 0 ifTrue:[ |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
250 |
n := sizes inject:0 into:[:sumSoFar :this | sumSoFar + this]. |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
251 |
n = items size ifTrue:[ |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
252 |
groupSizes := sizes copyWithoutLast:1 |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
253 |
] |
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
254 |
]. |
451 | 255 |
|
579 | 256 |
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
|
257 |
items with:values do:[:anItem :aValue |anItem value:aValue] |
454 | 258 |
]. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
259 |
|
900
aa93395cdb55
care for empty group at the end (avoid line at end of menu)
Claus Gittinger <cg@exept.de>
parents:
801
diff
changeset
|
260 |
"Modified: / 19.4.1998 / 11:47:34 / cg" |
451 | 261 |
! |
262 |
||
1116 | 263 |
menuPerformer:something |
264 |
"set the receiver of the menu messages" |
|
265 |
||
266 |
receiver := something. |
|
267 |
||
268 |
"Modified: / 2.2.1998 / 13:26:29 / cg" |
|
269 |
! |
|
270 |
||
494 | 271 |
numberOfItems |
801 | 272 |
"return the number of items in this menu" |
273 |
||
494 | 274 |
^ items size |
275 |
||
801 | 276 |
"Created: / 6.3.1997 / 15:15:53 / cg" |
277 |
"Modified: / 2.2.1998 / 13:26:40 / cg" |
|
494 | 278 |
! |
279 |
||
579 | 280 |
receiver |
801 | 281 |
"return the receiver of the menu messages" |
579 | 282 |
|
801 | 283 |
^ receiver |
284 |
||
285 |
"Modified: / 2.2.1998 / 13:26:20 / cg" |
|
286 |
! |
|
579 | 287 |
|
288 |
receiver:something |
|
801 | 289 |
"set the receiver of the menu messages" |
579 | 290 |
|
801 | 291 |
receiver := something. |
292 |
||
293 |
"Modified: / 2.2.1998 / 13:26:29 / cg" |
|
294 |
! |
|
579 | 295 |
|
451 | 296 |
valueAt:index |
297 |
"return a collection of values from my items" |
|
298 |
||
299 |
^ (items at:index) value |
|
300 |
||
301 |
"Created: 25.2.1997 / 19:49:41 / cg" |
|
302 |
! |
|
303 |
||
494 | 304 |
valueAt:anIndex put:aValue |
305 |
"put value an an index" |
|
306 |
||
307 |
(items at:anIndex) value:aValue |
|
308 |
||
309 |
"Created: 6.3.1997 / 15:15:48 / cg" |
|
310 |
! |
|
311 |
||
451 | 312 |
values |
313 |
"return a collection of values from my items" |
|
314 |
||
315 |
^ items collect:[:anItem | anItem value] |
|
316 |
||
317 |
"Created: 25.2.1997 / 19:49:29 / cg" |
|
724 | 318 |
! |
319 |
||
320 |
values:aCollectionOfValues |
|
321 |
"return a collection of values from my items" |
|
322 |
||
323 |
|s| |
|
324 |
||
325 |
s := aCollectionOfValues readStream. |
|
326 |
self itemsDo:[:item | |
|
1111 | 327 |
|val| |
724 | 328 |
|
1111 | 329 |
val := s next. |
330 |
item value:val |
|
724 | 331 |
]. |
1111 | 332 |
s atEnd ifFalse:[ |
333 |
self halt:'not enough elements in value collection' |
|
334 |
] |
|
724 | 335 |
|
336 |
"Created: / 27.10.1997 / 15:15:47 / cg" |
|
337 |
! |
|
338 |
||
339 |
visibleMenuItemGroups |
|
801 | 340 |
|itemGroups visibleItemGroups nextItem| |
724 | 341 |
|
801 | 342 |
itemGroups := OrderedCollection new. |
343 |
nextItem := 1. |
|
344 |
groupSizes do:[:groupSize | |
|
345 |
itemGroups addLast: (items copyFrom:nextItem to:nextItem + groupSize - 1). |
|
346 |
nextItem := nextItem + groupSize |
|
347 |
]. |
|
348 |
self hasHiddenItems ifFalse:[^ itemGroups]. |
|
724 | 349 |
|
801 | 350 |
"Remove the hidden items." |
351 |
visibleItemGroups := OrderedCollection new. |
|
352 |
itemGroups do:[:eachItemGroup | |
|
353 |
|visibleItemGroup| |
|
354 |
||
355 |
visibleItemGroup := eachItemGroup reject:[:eachMenuItem | eachMenuItem hidden]. |
|
356 |
visibleItemGroup isEmpty ifFalse:[ |
|
357 |
visibleItemGroups addLast: visibleItemGroup |
|
358 |
] |
|
359 |
]. |
|
360 |
^ visibleItemGroups |
|
724 | 361 |
|
362 |
"Created: / 27.10.1997 / 15:07:50 / cg" |
|
801 | 363 |
"Modified: / 2.2.1998 / 13:25:52 / cg" |
451 | 364 |
! ! |
365 |
||
582 | 366 |
!Menu methodsFor:'accessing resource'! |
367 |
||
584 | 368 |
findGuiResourcesIn:aResourceContainerOrApplication |
582 | 369 |
"setup a resource owner |
370 |
" |
|
584 | 371 |
aResourceContainerOrApplication notNil ifTrue:[ |
740 | 372 |
items notNil ifTrue:[ |
373 |
items do:[:anItem| anItem findGuiResourcesIn:aResourceContainerOrApplication ] |
|
374 |
] |
|
582 | 375 |
] |
376 |
||
377 |
! ! |
|
378 |
||
940 | 379 |
!Menu methodsFor:'adding & removing'! |
380 |
||
381 |
addItem:aMenuItem |
|
1029 | 382 |
"add a menuItem at the end; |
383 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
384 |
||
940 | 385 |
items isNil ifTrue:[ |
1029 | 386 |
items := OrderedCollection new |
387 |
] ifFalse:[ |
|
388 |
items := items asOrderedCollection |
|
940 | 389 |
]. |
390 |
items add:aMenuItem. |
|
1029 | 391 |
|
392 |
"Modified: / 4.8.1998 / 17:31:13 / cg" |
|
940 | 393 |
! |
394 |
||
395 |
addItem:aMenuItem beforeIndex:anIndex |
|
1029 | 396 |
"add a menuItem at some position; |
397 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
398 |
||
940 | 399 |
items isNil ifTrue:[ |
400 |
items := OrderedCollection new |
|
1029 | 401 |
] ifFalse:[ |
402 |
items := items asOrderedCollection |
|
940 | 403 |
]. |
404 |
items add:aMenuItem beforeIndex:anIndex. |
|
1029 | 405 |
|
406 |
"Modified: / 4.8.1998 / 17:31:39 / cg" |
|
940 | 407 |
! |
408 |
||
409 |
addItem:aMenuItem value:aValue |
|
410 |
aMenuItem value:aValue. |
|
411 |
self addItem:aMenuItem. |
|
412 |
! |
|
413 |
||
414 |
addItemGroup:aCollectionOfItems |
|
1029 | 415 |
"add a group of items at the end; |
416 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
417 |
||
940 | 418 |
groupSizes isNil ifTrue:[ |
1029 | 419 |
groupSizes := OrderedCollection new |
940 | 420 |
]. |
421 |
groupSizes add:aCollectionOfItems size. |
|
422 |
||
423 |
aCollectionOfItems do:[:item | |
|
1029 | 424 |
self addItem:item |
940 | 425 |
]. |
426 |
||
427 |
"Created: / 27.10.1997 / 15:02:15 / cg" |
|
1029 | 428 |
"Modified: / 4.8.1998 / 17:32:06 / cg" |
940 | 429 |
! |
430 |
||
431 |
addItemGroup:aGroup values:values |
|
1029 | 432 |
"add a group of items at the end; |
433 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
434 |
||
940 | 435 |
groupSizes isNil ifTrue:[ |
1029 | 436 |
groupSizes := OrderedCollection new |
940 | 437 |
]. |
438 |
groupSizes add:items size. |
|
439 |
||
440 |
aGroup with:values do:[:item :value | |
|
1029 | 441 |
self addItem:item value:value |
940 | 442 |
]. |
1029 | 443 |
|
444 |
"Modified: / 4.8.1998 / 17:32:18 / cg" |
|
940 | 445 |
! |
446 |
||
447 |
addItemGroupLabels:labels values:values |
|
1029 | 448 |
"add a group of items at the end; |
449 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
450 |
||
940 | 451 |
|items| |
452 |
||
453 |
items := labels with:values |
|
1029 | 454 |
collect:[:label :value | |
455 |
MenuItem label:label value:value |
|
456 |
]. |
|
940 | 457 |
self addItemGroup:items |
458 |
||
459 |
"Created: / 27.10.1997 / 19:49:27 / cg" |
|
1029 | 460 |
"Modified: / 4.8.1998 / 17:35:22 / cg" |
940 | 461 |
! |
462 |
||
463 |
addItemLabel:label value:value |
|
1029 | 464 |
"add an item at the end; |
465 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
940 | 466 |
|
1029 | 467 |
self addItem:(MenuItem label:label value:value) |
940 | 468 |
|
469 |
"Created: / 27.10.1997 / 19:47:12 / cg" |
|
1029 | 470 |
"Modified: / 4.8.1998 / 17:34:44 / cg" |
940 | 471 |
! |
472 |
||
473 |
removeItem:aMenuItem |
|
474 |
"remove an item from the menu" |
|
475 |
||
476 |
|idx| |
|
477 |
||
478 |
items notNil ifTrue:[ |
|
479 |
idx := items identityIndexOf:aMenuItem. |
|
480 |
idx ~~ 0 ifTrue:[ |
|
481 |
items removeAtIndex:idx |
|
482 |
] |
|
483 |
]. |
|
484 |
||
485 |
"Created: / 13.9.1997 / 10:27:31 / cg" |
|
486 |
"Modified: / 2.2.1998 / 13:26:49 / cg" |
|
487 |
! |
|
488 |
||
489 |
removeItemAt:anIndex |
|
490 |
"remove item at an index |
|
491 |
" |
|
492 |
anIndex <= items size ifTrue:[ |
|
493 |
^ items removeAtIndex:anIndex |
|
494 |
]. |
|
495 |
^ nil |
|
496 |
! ! |
|
497 |
||
451 | 498 |
!Menu methodsFor:'converting'! |
499 |
||
500 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
|
501 |
"read my contents from a aLiteralEncodedArray" |
|
502 |
||
503 |
|items groups values| |
|
504 |
||
505 |
items := (aLiteralEncodedArray at:2) collect:[:item | item decodeAsLiteralArray]. |
|
506 |
groups := aLiteralEncodedArray at:3. |
|
452 | 507 |
values := aLiteralEncodedArray at:4. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
508 |
self menuItems:items menuItemGroups:groups values:values. |
451 | 509 |
|
510 |
"extract from PD folder.st: |
|
511 |
#(#Menu #( |
|
740 | 512 |
#(#MenuItem |
513 |
#rawLabel: 'left' |
|
514 |
#value: #left ) |
|
515 |
#(#MenuItem |
|
516 |
#rawLabel: 'center' |
|
517 |
#value: #center ) |
|
518 |
#(#MenuItem |
|
519 |
#rawLabel: 'right' |
|
520 |
#value: #right ) |
|
521 |
) |
|
522 |
#(3 ) |
|
523 |
nil |
|
451 | 524 |
) decodeAsLiteralArray |
525 |
" |
|
452 | 526 |
" |
527 |
#(#Menu #( |
|
740 | 528 |
#(#MenuItem |
529 |
#label: 'Straighten Up' ) |
|
530 |
#(#MenuItem |
|
531 |
#label: 'Inspect' ) |
|
532 |
#(#MenuItem |
|
533 |
#label: 'Coredump' ) |
|
534 |
) |
|
535 |
#(3 ) |
|
536 |
#(#straightenUp #inspect #halt ) |
|
452 | 537 |
) decodeAsLiteralArray startUp |
538 |
" |
|
457 | 539 |
|
454 | 540 |
"extract from iconicBrowser.st: |
452 | 541 |
#(#Menu #( |
740 | 542 |
#(#MenuItem |
543 |
#label: 'Straighten Up' ) |
|
544 |
#(#MenuItem |
|
545 |
#label: 'Inspect' ) |
|
546 |
#(#MenuItem |
|
547 |
#label: 'Coredump' ) |
|
548 |
) |
|
549 |
#(3 ) |
|
550 |
#(1 2 3 ) |
|
452 | 551 |
) decodeAsLiteralArray startUp |
552 |
" |
|
451 | 553 |
|
454 | 554 |
"extract from refactory213.st: |
555 |
#(#Menu #( |
|
740 | 556 |
#(#MenuItem |
557 |
#label: 'File List' |
|
558 |
#accessCharacterPosition: 1 ) |
|
559 |
#(#MenuItem #label: 'File Editor...' |
|
560 |
#accessCharacterPosition: 6 ) |
|
561 |
#(#MenuItem #label: 'Refactoring Tool...' |
|
562 |
#accessCharacterPosition: 1 ) |
|
563 |
#(#MenuItem #label: 'Workspace' |
|
564 |
#accessCharacterPosition: 1 ) |
|
565 |
#(#MenuItem #label: 'New Canvas' |
|
566 |
#accessCharacterPosition: 1 ) |
|
567 |
#(#MenuItem #label: 'Palette' |
|
568 |
#accessCharacterPosition: 1 ) |
|
569 |
#(#MenuItem #label: 'Canvas Tool' |
|
570 |
#accessCharacterPosition: 1 ) |
|
571 |
#(#MenuItem #label: 'Image Editor' |
|
572 |
#accessCharacterPosition: 1 ) |
|
573 |
#(#MenuItem #label: 'Menu Editor' |
|
574 |
#accessCharacterPosition: 1 ) |
|
575 |
#(#MenuItem #label: 'Advanced' |
|
576 |
#accessCharacterPosition: 1 ) |
|
577 |
#(#MenuItem #label: 'DLL and C Connect' |
|
578 |
#accessCharacterPosition: 1 ) |
|
579 |
#(#MenuItem #label: 'System Transcript' |
|
580 |
#accessCharacterPosition: 8 ) |
|
581 |
) |
|
582 |
#(4 5 2 1 ) |
|
583 |
#(#openFileList #openFileEditor #openRefactoringTool #toolsNewWorkspace #toolsNewCanvas #toolsPalette #toolsCanvasTool #toolsMaskEditor #toolsMenuEditor nil #openExternalFinder #toggleSystemTranscript ) |
|
584 |
) decodeAsLiteralArray startUp |
|
454 | 585 |
" |
586 |
||
457 | 587 |
"submenus: |
588 |
#(#Menu #( |
|
740 | 589 |
#(#MenuItem |
590 |
#label: 'Foo' |
|
591 |
#submenu: #(#Menu #( |
|
592 |
#(#MenuItem #label: 'foo 1') |
|
593 |
#(#MenuItem #label: 'foo 2') |
|
594 |
) |
|
595 |
nil |
|
596 |
#(11 22) |
|
597 |
) |
|
598 |
) |
|
599 |
#(#MenuItem |
|
600 |
#label: 'Inspect' ) |
|
601 |
#(#MenuItem |
|
602 |
#label: 'Coredump' ) |
|
603 |
) |
|
604 |
#(3 ) |
|
605 |
#(1 2 3 ) |
|
457 | 606 |
) decodeAsLiteralArray startUp |
607 |
" |
|
608 |
||
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
609 |
"Modified: 20.6.1997 / 10:45:51 / cg" |
489 | 610 |
! |
611 |
||
612 |
literalArrayEncoding |
|
613 |
"return myself encoded as a literal array" |
|
614 |
||
615 |
|coll| |
|
616 |
||
617 |
coll := OrderedCollection new. |
|
618 |
coll add:#Menu. |
|
619 |
coll add:(items literalArrayEncoding). |
|
620 |
coll add:(groupSizes literalArrayEncoding). |
|
621 |
coll add:nil. |
|
579 | 622 |
^ coll asArray |
451 | 623 |
! ! |
624 |
||
584 | 625 |
!Menu methodsFor:'enumerating'! |
626 |
||
665 | 627 |
allItemsDo:aOneArgBlock |
628 |
"evaluate block on each item and submenu items |
|
629 |
" |
|
630 |
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
|
631 |
|sub| |
724 | 632 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
633 |
aOneArgBlock value:anItem. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
634 |
(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
|
635 |
sub allItemsDo:aOneArgBlock |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
636 |
] |
665 | 637 |
] |
724 | 638 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
639 |
"Modified: / 19.6.1998 / 00:34:53 / cg" |
665 | 640 |
! |
641 |
||
940 | 642 |
detectItem:aBlock |
643 |
"evaluate the argument, aBlock for each item in the menu until the |
|
644 |
block returns true; in this case return the item which caused the |
|
645 |
true evaluation. |
|
646 |
If none of the evaluations returns true, return the result of the |
|
647 |
evaluation of the exceptionBlock |
|
648 |
" |
|
649 |
^ self detectItem:aBlock ifNone:[self errorNotFound] |
|
650 |
||
651 |
! |
|
652 |
||
653 |
detectItem:aBlock ifNone:exceptionBlock |
|
654 |
"evaluate the argument, aBlock for each item in the menu until the |
|
655 |
block returns true; in this case return the item which caused the |
|
656 |
true evaluation. |
|
657 |
If none of the evaluations returns true, return the result of the |
|
658 |
evaluation of the exceptionBlock |
|
659 |
" |
|
660 |
items notNil ifTrue:[ |
|
661 |
^ items detect:aBlock ifNone:exceptionBlock |
|
662 |
]. |
|
663 |
^ exceptionBlock value |
|
664 |
! |
|
665 |
||
589 | 666 |
itemsDo:aOneArgBlock |
667 |
"evaluate the block for each item in the current menu |
|
668 |
" |
|
669 |
items notNil ifTrue:[items do:aOneArgBlock] |
|
670 |
! |
|
671 |
||
584 | 672 |
menuAndSubmenusDetectItem:aOneArgBlock |
673 |
"evaluate the block for each item in the current menu and all |
|
674 |
submenus. In case that the block returns a non nil argument, |
|
675 |
the item will be returned |
|
676 |
" |
|
724 | 677 |
|item| |
584 | 678 |
|
679 |
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
|
680 |
items do:[:anItem| |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
681 |
|sub| |
724 | 682 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
683 |
(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
|
684 |
^ anItem |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
685 |
]. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
686 |
(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
|
687 |
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
|
688 |
item notNil ifTrue:[ |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
689 |
^ item |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
690 |
] |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
691 |
] |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
692 |
] |
584 | 693 |
]. |
724 | 694 |
^ nil |
695 |
||
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
696 |
"Modified: / 19.6.1998 / 00:35:00 / cg" |
584 | 697 |
! ! |
698 |
||
672
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
699 |
!Menu methodsFor:'kludged fixes'! |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
700 |
|
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
701 |
destroy |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
702 |
|
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
703 |
"Created: 28.7.1997 / 10:16:52 / cg" |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
704 |
! ! |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
705 |
|
584 | 706 |
!Menu methodsFor:'menu items'! |
707 |
||
740 | 708 |
someMenuItemLabeled:aLabel |
709 |
"get the menu item with that label; in case that the label |
|
710 |
is not found, nil is returned |
|
711 |
" |
|
712 |
^ self someMenuItemLabeled:aLabel ifNone:nil |
|
713 |
||
714 |
"Created: / 14.11.1997 / 20:55:17 / cg" |
|
715 |
! |
|
716 |
||
717 |
someMenuItemLabeled:aLabel ifNone:exceptionBlock |
|
718 |
"get the menu item labeled aLabel; in case that the value |
|
719 |
is not found, the given exceptionBlock is executed and its value returned |
|
720 |
" |
|
721 |
|item| |
|
722 |
||
723 |
item := self menuAndSubmenusDetectItem:[:anItem| anItem label = aLabel]. |
|
724 |
||
725 |
item notNil ifTrue:[ |
|
726 |
^ item |
|
727 |
]. |
|
728 |
^ exceptionBlock value |
|
729 |
||
730 |
"Created: / 14.11.1997 / 20:56:13 / cg" |
|
731 |
! |
|
732 |
||
584 | 733 |
someMenuItemWithValue:aValue |
734 |
"get the menu item assigned with the value; in case that the value |
|
735 |
is not found nil is returned |
|
736 |
" |
|
737 |
^ self someMenuItemWithValue:aValue ifNone:nil |
|
738 |
! |
|
739 |
||
740 |
someMenuItemWithValue:aValue ifNone:exceptionBlock |
|
741 |
"get the menu item assigned with the value; in case that the value |
|
742 |
is not found, the given exceptionBlock is executed and returned |
|
743 |
" |
|
744 |
|item| |
|
745 |
||
746 |
item := self menuAndSubmenusDetectItem:[:anItem| anItem value == aValue]. |
|
747 |
||
748 |
item notNil ifTrue:[ |
|
740 | 749 |
^ item |
584 | 750 |
]. |
751 |
^ exceptionBlock value |
|
752 |
! ! |
|
753 |
||
754 |
!Menu methodsFor:'queries'! |
|
755 |
||
724 | 756 |
hasHiddenItems |
757 |
"test whether any item is hidden" |
|
758 |
||
759 |
self allItemsDo:[:anItem| |
|
740 | 760 |
anItem isHidden ifTrue:[^ true] |
724 | 761 |
]. |
762 |
^ false |
|
763 |
||
764 |
"Modified: / 27.10.1997 / 15:12:44 / cg" |
|
765 |
! |
|
766 |
||
584 | 767 |
hasSubMenuAt:anIndex |
768 |
"test whether the menu item at the given index has a submenu |
|
769 |
" |
|
770 |
^ (self menuItemAt:anIndex) hasSubmenu |
|
771 |
! ! |
|
772 |
||
451 | 773 |
!Menu methodsFor:'startup'! |
774 |
||
729 | 775 |
show |
776 |
"realize the menu at its last position; returns the value associated with the |
|
777 |
selected item, 0 if none was selected" |
|
778 |
||
779 |
^ (MenuPanel menu:self) show ? 0 |
|
780 |
||
781 |
||
782 |
! |
|
783 |
||
784 |
showAt:aPoint |
|
785 |
"realize the menu at aPoint; returns the value associated with the |
|
786 |
selected item, 0 if none was selected" |
|
787 |
||
788 |
^ self showAt:aPoint resizing:true |
|
789 |
||
790 |
||
791 |
! |
|
792 |
||
793 |
showAt:aPoint resizing:aBoolean |
|
794 |
"realize the menu at aPoint; returns the value associated with the |
|
451 | 795 |
selected item, 0 if none was selected" |
796 |
||
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
797 |
^ ((MenuPanel menu:self) showAt:aPoint resizing:aBoolean) ? 0 |
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
798 |
|
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
799 |
"Modified: / 8.7.1998 / 19:57:55 / cg" |
729 | 800 |
! |
801 |
||
802 |
showAtPointer |
|
803 |
"realize the menu at the current pointer position; returns the value associated with the |
|
804 |
selected item, 0 if none was selected" |
|
805 |
||
806 |
^ self startUp |
|
807 |
! |
|
457 | 808 |
|
729 | 809 |
showCenteredIn:aView |
810 |
"realize the menu visible at the aView center; returns the value associated with the |
|
811 |
selected item, 0 if none was selected" |
|
812 |
||
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
813 |
^ ((MenuPanel menu:self) showCenteredIn:aView) ? 0 |
729 | 814 |
|
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
815 |
"Modified: / 8.7.1998 / 19:58:05 / cg" |
729 | 816 |
! |
817 |
||
818 |
startUp |
|
819 |
"display the menu as a popUp; returns the value associated with the |
|
820 |
selected item, 0 if none was selected" |
|
821 |
||
822 |
^ (MenuPanel menu:self) startUp ? 0 |
|
451 | 823 |
|
579 | 824 |
" |
740 | 825 |
|m| |
579 | 826 |
|
740 | 827 |
m := #(#Menu #( |
828 |
#(#MenuItem |
|
829 |
#rawLabel: 'left' |
|
830 |
#value: #left ) |
|
831 |
#(#MenuItem |
|
832 |
#rawLabel: 'center' |
|
833 |
#value: #center ) |
|
834 |
#(#MenuItem |
|
835 |
#rawLabel: 'right' |
|
836 |
#value: #right ) ) |
|
837 |
#(2) |
|
838 |
nil |
|
839 |
) decodeAsLiteralArray. |
|
451 | 840 |
|
579 | 841 |
Transcript showCR:(m startUp) |
842 |
" |
|
938
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
843 |
! |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
844 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
845 |
startUpAt:aPoint |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
846 |
"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
|
847 |
selected item, 0 if none was selected" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
848 |
|
939 | 849 |
^ ((MenuPanel menu:self) startUpAt:aPoint) ? 0 |
938
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
850 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
851 |
" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
852 |
|m| |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
853 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
854 |
m := #(#Menu #( |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
855 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
856 |
#rawLabel: 'left' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
857 |
#value: #left ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
858 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
859 |
#rawLabel: 'center' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
860 |
#value: #center ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
861 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
862 |
#rawLabel: 'right' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
863 |
#value: #right ) ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
864 |
#(2) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
865 |
nil |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
866 |
) decodeAsLiteralArray. |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
867 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
868 |
Transcript showCR:(m startUpAt:100@100) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
869 |
" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
870 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
871 |
"Created: / 21.5.1998 / 14:15:21 / cg" |
939 | 872 |
"Modified: / 21.5.1998 / 14:17:46 / cg" |
451 | 873 |
! ! |
874 |
||
875 |
!Menu class methodsFor:'documentation'! |
|
876 |
||
877 |
version |
|
1116 | 878 |
^ '$Header: /cvs/stx/stx/libview2/Menu.st,v 1.37 1999-03-05 17:06:22 tm Exp $' |
451 | 879 |
! ! |