support of arguments
authorca
Tue, 26 Aug 1997 17:44:30 +0200
changeset 684 184dd159d02e
parent 683 f50084bd3925
child 685 49bff60514bc
support of arguments
MenuItem.st
--- a/MenuItem.st	Wed Aug 20 20:28:36 1997 +0200
+++ b/MenuItem.st	Tue Aug 26 17:44:30 1997 +0200
@@ -7,7 +7,7 @@
 
 Object subclass:#MenuItemAdornment
 	instanceVariableNames:'color indication submenu submenuChannel shortcutKey labelText
-		labelImage accessCharacterPosition'
+		labelImage accessCharacterPosition argument'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:MenuItem
@@ -66,6 +66,33 @@
     activeHelpKey := aKey
 !
 
+argument
+    "get argument given to the value (selector)
+    "
+    adornment notNil ifTrue:[
+        ^ adornment argument
+    ].
+    ^ nil
+!
+
+argument:something
+    "set argument given to the value (selector)
+    "
+    |arg|
+
+    (arg := something) notNil ifTrue:[
+        arg isString ifTrue:[
+            (arg size == 0 or:[(arg indexOfNonSeparatorStartingAt:1) == 0]) ifTrue:[
+                arg := nil
+            ]
+        ]
+    ].
+
+    (arg isNil and:[adornment isNil]) ifFalse:[
+        self adornment argument:arg
+    ]
+!
+
 label
     ^ label
 
@@ -299,6 +326,10 @@
             coll add:#accessCharacterPosition: ; add:(something literalArrayEncoding)
         ].
 
+        (something := self argument) notNil ifTrue:[
+            coll add:#argument: ; add:(something literalArrayEncoding)
+        ].
+
         adornment labelImage notNil ifTrue:[
             coll add:#labelImage: ; add:(adornment labelImage literalArrayEncoding)
         ].
@@ -379,6 +410,22 @@
 
     accessCharacterPosition := something.!
 
+argument
+    "return the value of the instance variable 'argument' (automatically generated)"
+
+    ^ argument
+
+    "Created: 25.2.1997 / 20:59:28 / cg"
+!
+
+argument:something
+    "set the value of the instance variable 'argument' (automatically generated)"
+
+    argument := something.
+
+    "Created: 25.2.1997 / 20:59:28 / cg"
+!
+
 color
     "return the value of the instance variable 'color' (automatically generated)"
 
@@ -476,5 +523,5 @@
 !MenuItem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.15 1997-07-17 10:07:02 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.16 1997-08-26 15:44:30 ca Exp $'
 ! !