MenuItem.st
changeset 578 7e0f62d9bc47
parent 490 ebe88e50b29a
child 579 77f6d490f1ac
--- a/MenuItem.st	Tue May 20 09:06:17 1997 +0200
+++ b/MenuItem.st	Tue May 20 09:08:02 1997 +0200
@@ -6,7 +6,7 @@
 !
 
 Object subclass:#MenuItemAdornment
-	instanceVariableNames:'color indication submenu'
+	instanceVariableNames:'color indication submenu shortcutKey labelText'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:MenuItem
@@ -65,7 +65,7 @@
 !
 
 hasSubmenu
-    ^ self adornment submenu notNil
+    ^ self subMenu notNil
 
     "Created: 25.2.1997 / 20:56:20 / cg"
 !
@@ -88,6 +88,18 @@
     "Created: 25.2.1997 / 19:55:16 / cg"
 !
 
+nameKey
+    ^ nameKey
+
+
+!
+
+nameKey:aNameKey
+    nameKey := aNameKey
+
+
+!
+
 rawLabel
     ^ label
 
@@ -103,11 +115,23 @@
 shortcutKeyCharacter
     "ignored for now"
 
+    adornment notNil ifTrue:[
+        ^ adornment shortcutKeyCharacter
+    ].
     ^ nil
 !
 
+shortcutKeyCharacter:aKey
+    "set the  key to press to select the menu item from the keyboard
+    "
+    self adornment shortcutKeyCharacter:aKey
+!
+
 submenu
-    ^ self adornment submenu
+    adornment notNil ifTrue:[
+        ^ adornment submenu
+    ].
+    ^ nil
 
     "Created: 25.2.1997 / 20:57:24 / cg"
 !
@@ -145,7 +169,7 @@
     ].
 
     "
-     #( #MenuItem #rawLabel: 'left' #value: #left )
+     #( #MenuItem #rawLabel: 'left' #nameKey: 'identifier'  #value: #left )
          decodeAsLiteralArray
     "
 
@@ -161,7 +185,7 @@
     coll add:#MenuItem.
     coll add:#label: ; add:(label literalArrayEncoding).
     coll add:#value: ; add:(value literalArrayEncoding).
-"/    coll add:#nameKey: ; add:(nameKey literalArrayEncoding).
+    coll add:#nameKey: ; add:(nameKey literalArrayEncoding).
     coll add:#enabled: ; add:(enabled literalArrayEncoding).
     ^ coll asArray
 ! !
@@ -211,17 +235,41 @@
     "Created: 25.2.1997 / 20:59:28 / cg"
 !
 
+labelText
+    "get the text appear as the menu label
+    "
+    ^ labelText
+!
+
+labelText:something
+    "set the text appear as the menu label
+    "
+    labelText := something.
+!
+
+shortcutKeyCharacter
+    "get the  key to press to select the menu item from the keyboard
+    "
+    ^ shortcutKey
+!
+
+shortcutKeyCharacter:something
+    "set the  key to press to select the menu item from the keyboard
+    "
+    shortcutKey := something.
+!
+
 submenu
-    "return the value of the instance variable 'submenu' (automatically generated)"
-
+    "get the submenu or nil
+    "
     ^ submenu
 
     "Created: 25.2.1997 / 20:59:28 / cg"
 !
 
 submenu:something
-    "set the value of the instance variable 'submenu' (automatically generated)"
-
+    "set the submenu or nil
+    "
     submenu := something.
 
     "Created: 25.2.1997 / 20:59:28 / cg"
@@ -230,5 +278,5 @@
 !MenuItem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.5 1997-03-05 16:06:31 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.6 1997-05-20 07:07:22 ca Exp $'
 ! !