author | Claus Gittinger <cg@exept.de> |
Tue, 04 Aug 1998 17:38:22 +0200 | |
changeset 1029 | c77fe01f61a4 |
parent 996 | 1e10d01c90b8 |
child 1111 | 6c1084c56d7f |
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 |
||
494 | 263 |
numberOfItems |
801 | 264 |
"return the number of items in this menu" |
265 |
||
494 | 266 |
^ items size |
267 |
||
801 | 268 |
"Created: / 6.3.1997 / 15:15:53 / cg" |
269 |
"Modified: / 2.2.1998 / 13:26:40 / cg" |
|
494 | 270 |
! |
271 |
||
579 | 272 |
receiver |
801 | 273 |
"return the receiver of the menu messages" |
579 | 274 |
|
801 | 275 |
^ receiver |
276 |
||
277 |
"Modified: / 2.2.1998 / 13:26:20 / cg" |
|
278 |
! |
|
579 | 279 |
|
280 |
receiver:something |
|
801 | 281 |
"set the receiver of the menu messages" |
579 | 282 |
|
801 | 283 |
receiver := something. |
284 |
||
285 |
"Modified: / 2.2.1998 / 13:26:29 / cg" |
|
286 |
! |
|
579 | 287 |
|
451 | 288 |
valueAt:index |
289 |
"return a collection of values from my items" |
|
290 |
||
291 |
^ (items at:index) value |
|
292 |
||
293 |
"Created: 25.2.1997 / 19:49:41 / cg" |
|
294 |
! |
|
295 |
||
494 | 296 |
valueAt:anIndex put:aValue |
297 |
"put value an an index" |
|
298 |
||
299 |
(items at:anIndex) value:aValue |
|
300 |
||
301 |
"Created: 6.3.1997 / 15:15:48 / cg" |
|
302 |
! |
|
303 |
||
451 | 304 |
values |
305 |
"return a collection of values from my items" |
|
306 |
||
307 |
^ items collect:[:anItem | anItem value] |
|
308 |
||
309 |
"Created: 25.2.1997 / 19:49:29 / cg" |
|
724 | 310 |
! |
311 |
||
312 |
values:aCollectionOfValues |
|
313 |
"return a collection of values from my items" |
|
314 |
||
315 |
|s| |
|
316 |
||
317 |
s := aCollectionOfValues readStream. |
|
318 |
self itemsDo:[:item | |
|
740 | 319 |
|val| |
724 | 320 |
|
740 | 321 |
val := s next. |
322 |
item value:val |
|
724 | 323 |
]. |
324 |
s atEnd ifFalse:[self halt] |
|
325 |
||
326 |
"Created: / 27.10.1997 / 15:15:47 / cg" |
|
327 |
! |
|
328 |
||
329 |
visibleMenuItemGroups |
|
801 | 330 |
|itemGroups visibleItemGroups nextItem| |
724 | 331 |
|
801 | 332 |
itemGroups := OrderedCollection new. |
333 |
nextItem := 1. |
|
334 |
groupSizes do:[:groupSize | |
|
335 |
itemGroups addLast: (items copyFrom:nextItem to:nextItem + groupSize - 1). |
|
336 |
nextItem := nextItem + groupSize |
|
337 |
]. |
|
338 |
self hasHiddenItems ifFalse:[^ itemGroups]. |
|
724 | 339 |
|
801 | 340 |
"Remove the hidden items." |
341 |
visibleItemGroups := OrderedCollection new. |
|
342 |
itemGroups do:[:eachItemGroup | |
|
343 |
|visibleItemGroup| |
|
344 |
||
345 |
visibleItemGroup := eachItemGroup reject:[:eachMenuItem | eachMenuItem hidden]. |
|
346 |
visibleItemGroup isEmpty ifFalse:[ |
|
347 |
visibleItemGroups addLast: visibleItemGroup |
|
348 |
] |
|
349 |
]. |
|
350 |
^ visibleItemGroups |
|
724 | 351 |
|
352 |
"Created: / 27.10.1997 / 15:07:50 / cg" |
|
801 | 353 |
"Modified: / 2.2.1998 / 13:25:52 / cg" |
451 | 354 |
! ! |
355 |
||
582 | 356 |
!Menu methodsFor:'accessing resource'! |
357 |
||
584 | 358 |
findGuiResourcesIn:aResourceContainerOrApplication |
582 | 359 |
"setup a resource owner |
360 |
" |
|
584 | 361 |
aResourceContainerOrApplication notNil ifTrue:[ |
740 | 362 |
items notNil ifTrue:[ |
363 |
items do:[:anItem| anItem findGuiResourcesIn:aResourceContainerOrApplication ] |
|
364 |
] |
|
582 | 365 |
] |
366 |
||
367 |
! ! |
|
368 |
||
940 | 369 |
!Menu methodsFor:'adding & removing'! |
370 |
||
371 |
addItem:aMenuItem |
|
1029 | 372 |
"add a menuItem at the end; |
373 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
374 |
||
940 | 375 |
items isNil ifTrue:[ |
1029 | 376 |
items := OrderedCollection new |
377 |
] ifFalse:[ |
|
378 |
items := items asOrderedCollection |
|
940 | 379 |
]. |
380 |
items add:aMenuItem. |
|
1029 | 381 |
|
382 |
"Modified: / 4.8.1998 / 17:31:13 / cg" |
|
940 | 383 |
! |
384 |
||
385 |
addItem:aMenuItem beforeIndex:anIndex |
|
1029 | 386 |
"add a menuItem at some position; |
387 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
388 |
||
940 | 389 |
items isNil ifTrue:[ |
390 |
items := OrderedCollection new |
|
1029 | 391 |
] ifFalse:[ |
392 |
items := items asOrderedCollection |
|
940 | 393 |
]. |
394 |
items add:aMenuItem beforeIndex:anIndex. |
|
1029 | 395 |
|
396 |
"Modified: / 4.8.1998 / 17:31:39 / cg" |
|
940 | 397 |
! |
398 |
||
399 |
addItem:aMenuItem value:aValue |
|
400 |
aMenuItem value:aValue. |
|
401 |
self addItem:aMenuItem. |
|
402 |
! |
|
403 |
||
404 |
addItemGroup:aCollectionOfItems |
|
1029 | 405 |
"add a group of items at the end; |
406 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
407 |
||
940 | 408 |
groupSizes isNil ifTrue:[ |
1029 | 409 |
groupSizes := OrderedCollection new |
940 | 410 |
]. |
411 |
groupSizes add:aCollectionOfItems size. |
|
412 |
||
413 |
aCollectionOfItems do:[:item | |
|
1029 | 414 |
self addItem:item |
940 | 415 |
]. |
416 |
||
417 |
"Created: / 27.10.1997 / 15:02:15 / cg" |
|
1029 | 418 |
"Modified: / 4.8.1998 / 17:32:06 / cg" |
940 | 419 |
! |
420 |
||
421 |
addItemGroup:aGroup values:values |
|
1029 | 422 |
"add a group of items at the end; |
423 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
424 |
||
940 | 425 |
groupSizes isNil ifTrue:[ |
1029 | 426 |
groupSizes := OrderedCollection new |
940 | 427 |
]. |
428 |
groupSizes add:items size. |
|
429 |
||
430 |
aGroup with:values do:[:item :value | |
|
1029 | 431 |
self addItem:item value:value |
940 | 432 |
]. |
1029 | 433 |
|
434 |
"Modified: / 4.8.1998 / 17:32:18 / cg" |
|
940 | 435 |
! |
436 |
||
437 |
addItemGroupLabels:labels values:values |
|
1029 | 438 |
"add a group of items at the end; |
439 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
440 |
||
940 | 441 |
|items| |
442 |
||
443 |
items := labels with:values |
|
1029 | 444 |
collect:[:label :value | |
445 |
MenuItem label:label value:value |
|
446 |
]. |
|
940 | 447 |
self addItemGroup:items |
448 |
||
449 |
"Created: / 27.10.1997 / 19:49:27 / cg" |
|
1029 | 450 |
"Modified: / 4.8.1998 / 17:35:22 / cg" |
940 | 451 |
! |
452 |
||
453 |
addItemLabel:label value:value |
|
1029 | 454 |
"add an item at the end; |
455 |
useful to build a menu programmatically (or, to add more items dynamically)" |
|
940 | 456 |
|
1029 | 457 |
self addItem:(MenuItem label:label value:value) |
940 | 458 |
|
459 |
"Created: / 27.10.1997 / 19:47:12 / cg" |
|
1029 | 460 |
"Modified: / 4.8.1998 / 17:34:44 / cg" |
940 | 461 |
! |
462 |
||
463 |
removeItem:aMenuItem |
|
464 |
"remove an item from the menu" |
|
465 |
||
466 |
|idx| |
|
467 |
||
468 |
items notNil ifTrue:[ |
|
469 |
idx := items identityIndexOf:aMenuItem. |
|
470 |
idx ~~ 0 ifTrue:[ |
|
471 |
items removeAtIndex:idx |
|
472 |
] |
|
473 |
]. |
|
474 |
||
475 |
"Created: / 13.9.1997 / 10:27:31 / cg" |
|
476 |
"Modified: / 2.2.1998 / 13:26:49 / cg" |
|
477 |
! |
|
478 |
||
479 |
removeItemAt:anIndex |
|
480 |
"remove item at an index |
|
481 |
" |
|
482 |
anIndex <= items size ifTrue:[ |
|
483 |
^ items removeAtIndex:anIndex |
|
484 |
]. |
|
485 |
^ nil |
|
486 |
! ! |
|
487 |
||
451 | 488 |
!Menu methodsFor:'converting'! |
489 |
||
490 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
|
491 |
"read my contents from a aLiteralEncodedArray" |
|
492 |
||
493 |
|items groups values| |
|
494 |
||
495 |
items := (aLiteralEncodedArray at:2) collect:[:item | item decodeAsLiteralArray]. |
|
496 |
groups := aLiteralEncodedArray at:3. |
|
452 | 497 |
values := aLiteralEncodedArray at:4. |
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
498 |
self menuItems:items menuItemGroups:groups values:values. |
451 | 499 |
|
500 |
"extract from PD folder.st: |
|
501 |
#(#Menu #( |
|
740 | 502 |
#(#MenuItem |
503 |
#rawLabel: 'left' |
|
504 |
#value: #left ) |
|
505 |
#(#MenuItem |
|
506 |
#rawLabel: 'center' |
|
507 |
#value: #center ) |
|
508 |
#(#MenuItem |
|
509 |
#rawLabel: 'right' |
|
510 |
#value: #right ) |
|
511 |
) |
|
512 |
#(3 ) |
|
513 |
nil |
|
451 | 514 |
) decodeAsLiteralArray |
515 |
" |
|
452 | 516 |
" |
517 |
#(#Menu #( |
|
740 | 518 |
#(#MenuItem |
519 |
#label: 'Straighten Up' ) |
|
520 |
#(#MenuItem |
|
521 |
#label: 'Inspect' ) |
|
522 |
#(#MenuItem |
|
523 |
#label: 'Coredump' ) |
|
524 |
) |
|
525 |
#(3 ) |
|
526 |
#(#straightenUp #inspect #halt ) |
|
452 | 527 |
) decodeAsLiteralArray startUp |
528 |
" |
|
457 | 529 |
|
454 | 530 |
"extract from iconicBrowser.st: |
452 | 531 |
#(#Menu #( |
740 | 532 |
#(#MenuItem |
533 |
#label: 'Straighten Up' ) |
|
534 |
#(#MenuItem |
|
535 |
#label: 'Inspect' ) |
|
536 |
#(#MenuItem |
|
537 |
#label: 'Coredump' ) |
|
538 |
) |
|
539 |
#(3 ) |
|
540 |
#(1 2 3 ) |
|
452 | 541 |
) decodeAsLiteralArray startUp |
542 |
" |
|
451 | 543 |
|
454 | 544 |
"extract from refactory213.st: |
545 |
#(#Menu #( |
|
740 | 546 |
#(#MenuItem |
547 |
#label: 'File List' |
|
548 |
#accessCharacterPosition: 1 ) |
|
549 |
#(#MenuItem #label: 'File Editor...' |
|
550 |
#accessCharacterPosition: 6 ) |
|
551 |
#(#MenuItem #label: 'Refactoring Tool...' |
|
552 |
#accessCharacterPosition: 1 ) |
|
553 |
#(#MenuItem #label: 'Workspace' |
|
554 |
#accessCharacterPosition: 1 ) |
|
555 |
#(#MenuItem #label: 'New Canvas' |
|
556 |
#accessCharacterPosition: 1 ) |
|
557 |
#(#MenuItem #label: 'Palette' |
|
558 |
#accessCharacterPosition: 1 ) |
|
559 |
#(#MenuItem #label: 'Canvas Tool' |
|
560 |
#accessCharacterPosition: 1 ) |
|
561 |
#(#MenuItem #label: 'Image Editor' |
|
562 |
#accessCharacterPosition: 1 ) |
|
563 |
#(#MenuItem #label: 'Menu Editor' |
|
564 |
#accessCharacterPosition: 1 ) |
|
565 |
#(#MenuItem #label: 'Advanced' |
|
566 |
#accessCharacterPosition: 1 ) |
|
567 |
#(#MenuItem #label: 'DLL and C Connect' |
|
568 |
#accessCharacterPosition: 1 ) |
|
569 |
#(#MenuItem #label: 'System Transcript' |
|
570 |
#accessCharacterPosition: 8 ) |
|
571 |
) |
|
572 |
#(4 5 2 1 ) |
|
573 |
#(#openFileList #openFileEditor #openRefactoringTool #toolsNewWorkspace #toolsNewCanvas #toolsPalette #toolsCanvasTool #toolsMaskEditor #toolsMenuEditor nil #openExternalFinder #toggleSystemTranscript ) |
|
574 |
) decodeAsLiteralArray startUp |
|
454 | 575 |
" |
576 |
||
457 | 577 |
"submenus: |
578 |
#(#Menu #( |
|
740 | 579 |
#(#MenuItem |
580 |
#label: 'Foo' |
|
581 |
#submenu: #(#Menu #( |
|
582 |
#(#MenuItem #label: 'foo 1') |
|
583 |
#(#MenuItem #label: 'foo 2') |
|
584 |
) |
|
585 |
nil |
|
586 |
#(11 22) |
|
587 |
) |
|
588 |
) |
|
589 |
#(#MenuItem |
|
590 |
#label: 'Inspect' ) |
|
591 |
#(#MenuItem |
|
592 |
#label: 'Coredump' ) |
|
593 |
) |
|
594 |
#(3 ) |
|
595 |
#(1 2 3 ) |
|
457 | 596 |
) decodeAsLiteralArray startUp |
597 |
" |
|
598 |
||
610
72dbf392e888
ST80 compatible inst creation method..
Claus Gittinger <cg@exept.de>
parents:
589
diff
changeset
|
599 |
"Modified: 20.6.1997 / 10:45:51 / cg" |
489 | 600 |
! |
601 |
||
602 |
literalArrayEncoding |
|
603 |
"return myself encoded as a literal array" |
|
604 |
||
605 |
|coll| |
|
606 |
||
607 |
coll := OrderedCollection new. |
|
608 |
coll add:#Menu. |
|
609 |
coll add:(items literalArrayEncoding). |
|
610 |
coll add:(groupSizes literalArrayEncoding). |
|
611 |
coll add:nil. |
|
579 | 612 |
^ coll asArray |
451 | 613 |
! ! |
614 |
||
584 | 615 |
!Menu methodsFor:'enumerating'! |
616 |
||
665 | 617 |
allItemsDo:aOneArgBlock |
618 |
"evaluate block on each item and submenu items |
|
619 |
" |
|
620 |
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
|
621 |
|sub| |
724 | 622 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
623 |
aOneArgBlock value:anItem. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
624 |
(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
|
625 |
sub allItemsDo:aOneArgBlock |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
626 |
] |
665 | 627 |
] |
724 | 628 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
629 |
"Modified: / 19.6.1998 / 00:34:53 / cg" |
665 | 630 |
! |
631 |
||
940 | 632 |
detectItem:aBlock |
633 |
"evaluate the argument, aBlock for each item in the menu until the |
|
634 |
block returns true; in this case return the item which caused the |
|
635 |
true evaluation. |
|
636 |
If none of the evaluations returns true, return the result of the |
|
637 |
evaluation of the exceptionBlock |
|
638 |
" |
|
639 |
^ self detectItem:aBlock ifNone:[self errorNotFound] |
|
640 |
||
641 |
! |
|
642 |
||
643 |
detectItem:aBlock ifNone:exceptionBlock |
|
644 |
"evaluate the argument, aBlock for each item in the menu until the |
|
645 |
block returns true; in this case return the item which caused the |
|
646 |
true evaluation. |
|
647 |
If none of the evaluations returns true, return the result of the |
|
648 |
evaluation of the exceptionBlock |
|
649 |
" |
|
650 |
items notNil ifTrue:[ |
|
651 |
^ items detect:aBlock ifNone:exceptionBlock |
|
652 |
]. |
|
653 |
^ exceptionBlock value |
|
654 |
! |
|
655 |
||
589 | 656 |
itemsDo:aOneArgBlock |
657 |
"evaluate the block for each item in the current menu |
|
658 |
" |
|
659 |
items notNil ifTrue:[items do:aOneArgBlock] |
|
660 |
! |
|
661 |
||
584 | 662 |
menuAndSubmenusDetectItem:aOneArgBlock |
663 |
"evaluate the block for each item in the current menu and all |
|
664 |
submenus. In case that the block returns a non nil argument, |
|
665 |
the item will be returned |
|
666 |
" |
|
724 | 667 |
|item| |
584 | 668 |
|
669 |
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
|
670 |
items do:[:anItem| |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
671 |
|sub| |
724 | 672 |
|
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
673 |
(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
|
674 |
^ anItem |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
675 |
]. |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
676 |
(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
|
677 |
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
|
678 |
item notNil ifTrue:[ |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
679 |
^ item |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
680 |
] |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
681 |
] |
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
682 |
] |
584 | 683 |
]. |
724 | 684 |
^ nil |
685 |
||
972
09bc0765dbc1
no need to send submenu value - the item does it now.
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
686 |
"Modified: / 19.6.1998 / 00:35:00 / cg" |
584 | 687 |
! ! |
688 |
||
672
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
689 |
!Menu methodsFor:'kludged fixes'! |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
690 |
|
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
691 |
destroy |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
692 |
|
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
693 |
"Created: 28.7.1997 / 10:16:52 / cg" |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
694 |
! ! |
2db4bb41aa93
added dummy #destroy (q&d hack)
Claus Gittinger <cg@exept.de>
parents:
665
diff
changeset
|
695 |
|
584 | 696 |
!Menu methodsFor:'menu items'! |
697 |
||
740 | 698 |
someMenuItemLabeled:aLabel |
699 |
"get the menu item with that label; in case that the label |
|
700 |
is not found, nil is returned |
|
701 |
" |
|
702 |
^ self someMenuItemLabeled:aLabel ifNone:nil |
|
703 |
||
704 |
"Created: / 14.11.1997 / 20:55:17 / cg" |
|
705 |
! |
|
706 |
||
707 |
someMenuItemLabeled:aLabel ifNone:exceptionBlock |
|
708 |
"get the menu item labeled aLabel; in case that the value |
|
709 |
is not found, the given exceptionBlock is executed and its value returned |
|
710 |
" |
|
711 |
|item| |
|
712 |
||
713 |
item := self menuAndSubmenusDetectItem:[:anItem| anItem label = aLabel]. |
|
714 |
||
715 |
item notNil ifTrue:[ |
|
716 |
^ item |
|
717 |
]. |
|
718 |
^ exceptionBlock value |
|
719 |
||
720 |
"Created: / 14.11.1997 / 20:56:13 / cg" |
|
721 |
! |
|
722 |
||
584 | 723 |
someMenuItemWithValue:aValue |
724 |
"get the menu item assigned with the value; in case that the value |
|
725 |
is not found nil is returned |
|
726 |
" |
|
727 |
^ self someMenuItemWithValue:aValue ifNone:nil |
|
728 |
! |
|
729 |
||
730 |
someMenuItemWithValue:aValue ifNone:exceptionBlock |
|
731 |
"get the menu item assigned with the value; in case that the value |
|
732 |
is not found, the given exceptionBlock is executed and returned |
|
733 |
" |
|
734 |
|item| |
|
735 |
||
736 |
item := self menuAndSubmenusDetectItem:[:anItem| anItem value == aValue]. |
|
737 |
||
738 |
item notNil ifTrue:[ |
|
740 | 739 |
^ item |
584 | 740 |
]. |
741 |
^ exceptionBlock value |
|
742 |
! ! |
|
743 |
||
744 |
!Menu methodsFor:'queries'! |
|
745 |
||
724 | 746 |
hasHiddenItems |
747 |
"test whether any item is hidden" |
|
748 |
||
749 |
self allItemsDo:[:anItem| |
|
740 | 750 |
anItem isHidden ifTrue:[^ true] |
724 | 751 |
]. |
752 |
^ false |
|
753 |
||
754 |
"Modified: / 27.10.1997 / 15:12:44 / cg" |
|
755 |
! |
|
756 |
||
584 | 757 |
hasSubMenuAt:anIndex |
758 |
"test whether the menu item at the given index has a submenu |
|
759 |
" |
|
760 |
^ (self menuItemAt:anIndex) hasSubmenu |
|
761 |
! ! |
|
762 |
||
451 | 763 |
!Menu methodsFor:'startup'! |
764 |
||
729 | 765 |
show |
766 |
"realize the menu at its last position; returns the value associated with the |
|
767 |
selected item, 0 if none was selected" |
|
768 |
||
769 |
^ (MenuPanel menu:self) show ? 0 |
|
770 |
||
771 |
||
772 |
! |
|
773 |
||
774 |
showAt:aPoint |
|
775 |
"realize the menu at aPoint; returns the value associated with the |
|
776 |
selected item, 0 if none was selected" |
|
777 |
||
778 |
^ self showAt:aPoint resizing:true |
|
779 |
||
780 |
||
781 |
! |
|
782 |
||
783 |
showAt:aPoint resizing:aBoolean |
|
784 |
"realize the menu at aPoint; returns the value associated with the |
|
451 | 785 |
selected item, 0 if none was selected" |
786 |
||
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
787 |
^ ((MenuPanel menu:self) showAt:aPoint resizing:aBoolean) ? 0 |
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
788 |
|
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
789 |
"Modified: / 8.7.1998 / 19:57:55 / cg" |
729 | 790 |
! |
791 |
||
792 |
showAtPointer |
|
793 |
"realize the menu at the current pointer position; returns the value associated with the |
|
794 |
selected item, 0 if none was selected" |
|
795 |
||
796 |
^ self startUp |
|
797 |
! |
|
457 | 798 |
|
729 | 799 |
showCenteredIn:aView |
800 |
"realize the menu visible at the aView center; returns the value associated with the |
|
801 |
selected item, 0 if none was selected" |
|
802 |
||
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
803 |
^ ((MenuPanel menu:self) showCenteredIn:aView) ? 0 |
729 | 804 |
|
996
1e10d01c90b8
careful: ? is a binary selector.
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
805 |
"Modified: / 8.7.1998 / 19:58:05 / cg" |
729 | 806 |
! |
807 |
||
808 |
startUp |
|
809 |
"display the menu as a popUp; returns the value associated with the |
|
810 |
selected item, 0 if none was selected" |
|
811 |
||
812 |
^ (MenuPanel menu:self) startUp ? 0 |
|
451 | 813 |
|
579 | 814 |
" |
740 | 815 |
|m| |
579 | 816 |
|
740 | 817 |
m := #(#Menu #( |
818 |
#(#MenuItem |
|
819 |
#rawLabel: 'left' |
|
820 |
#value: #left ) |
|
821 |
#(#MenuItem |
|
822 |
#rawLabel: 'center' |
|
823 |
#value: #center ) |
|
824 |
#(#MenuItem |
|
825 |
#rawLabel: 'right' |
|
826 |
#value: #right ) ) |
|
827 |
#(2) |
|
828 |
nil |
|
829 |
) decodeAsLiteralArray. |
|
451 | 830 |
|
579 | 831 |
Transcript showCR:(m startUp) |
832 |
" |
|
938
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
833 |
! |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
834 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
835 |
startUpAt:aPoint |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
836 |
"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
|
837 |
selected item, 0 if none was selected" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
838 |
|
939 | 839 |
^ ((MenuPanel menu:self) startUpAt:aPoint) ? 0 |
938
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
840 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
841 |
" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
842 |
|m| |
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 |
m := #(#Menu #( |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
845 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
846 |
#rawLabel: 'left' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
847 |
#value: #left ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
848 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
849 |
#rawLabel: 'center' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
850 |
#value: #center ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
851 |
#(#MenuItem |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
852 |
#rawLabel: 'right' |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
853 |
#value: #right ) ) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
854 |
#(2) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
855 |
nil |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
856 |
) decodeAsLiteralArray. |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
857 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
858 |
Transcript showCR:(m startUpAt:100@100) |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
859 |
" |
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
860 |
|
dfa1b1666cfa
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
861 |
"Created: / 21.5.1998 / 14:15:21 / cg" |
939 | 862 |
"Modified: / 21.5.1998 / 14:17:46 / cg" |
451 | 863 |
! ! |
864 |
||
865 |
!Menu class methodsFor:'documentation'! |
|
866 |
||
867 |
version |
|
1029 | 868 |
^ '$Header: /cvs/stx/stx/libview2/Menu.st,v 1.35 1998-08-04 15:38:22 cg Exp $' |
451 | 869 |
! ! |