comments added;
added inst-creation #label:value:
use this new inst-creation message.
--- a/Menu.st Tue Aug 04 02:37:47 1998 +0200
+++ b/Menu.st Tue Aug 04 17:38:22 1998 +0200
@@ -369,17 +369,31 @@
!Menu methodsFor:'adding & removing'!
addItem:aMenuItem
+ "add a menuItem at the end;
+ useful to build a menu programmatically (or, to add more items dynamically)"
+
items isNil ifTrue:[
- items := OrderedCollection new
+ items := OrderedCollection new
+ ] ifFalse:[
+ items := items asOrderedCollection
].
items add:aMenuItem.
+
+ "Modified: / 4.8.1998 / 17:31:13 / cg"
!
addItem:aMenuItem beforeIndex:anIndex
+ "add a menuItem at some position;
+ useful to build a menu programmatically (or, to add more items dynamically)"
+
items isNil ifTrue:[
items := OrderedCollection new
+ ] ifFalse:[
+ items := items asOrderedCollection
].
items add:aMenuItem beforeIndex:anIndex.
+
+ "Modified: / 4.8.1998 / 17:31:39 / cg"
!
addItem:aMenuItem value:aValue
@@ -388,54 +402,62 @@
!
addItemGroup:aCollectionOfItems
+ "add a group of items at the end;
+ useful to build a menu programmatically (or, to add more items dynamically)"
+
groupSizes isNil ifTrue:[
- groupSizes := OrderedCollection new
+ groupSizes := OrderedCollection new
].
groupSizes add:aCollectionOfItems size.
aCollectionOfItems do:[:item |
- self addItem:item
+ self addItem:item
].
"Created: / 27.10.1997 / 15:02:15 / cg"
+ "Modified: / 4.8.1998 / 17:32:06 / cg"
!
addItemGroup:aGroup values:values
+ "add a group of items at the end;
+ useful to build a menu programmatically (or, to add more items dynamically)"
+
groupSizes isNil ifTrue:[
- groupSizes := OrderedCollection new
+ groupSizes := OrderedCollection new
].
groupSizes add:items size.
aGroup with:values do:[:item :value |
- self addItem:item value:value
+ self addItem:item value:value
].
+
+ "Modified: / 4.8.1998 / 17:32:18 / cg"
!
addItemGroupLabels:labels values:values
+ "add a group of items at the end;
+ useful to build a menu programmatically (or, to add more items dynamically)"
+
|items|
items := labels with:values
- collect:[:label :value |
- |item|
-
- item := MenuItem new.
- item label:label.
- item value:value.
- ].
+ collect:[:label :value |
+ MenuItem label:label value:value
+ ].
self addItemGroup:items
"Created: / 27.10.1997 / 19:49:27 / cg"
+ "Modified: / 4.8.1998 / 17:35:22 / cg"
!
addItemLabel:label value:value
- |item|
+ "add an item at the end;
+ useful to build a menu programmatically (or, to add more items dynamically)"
- item := MenuItem new.
- item label:label.
- item value:value.
- self addItem:item
+ self addItem:(MenuItem label:label value:value)
"Created: / 27.10.1997 / 19:47:12 / cg"
+ "Modified: / 4.8.1998 / 17:34:44 / cg"
!
removeItem:aMenuItem
@@ -843,5 +865,5 @@
!Menu class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Menu.st,v 1.34 1998-07-08 18:04:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Menu.st,v 1.35 1998-08-04 15:38:22 cg Exp $'
! !