added choice type menu items (i.e. radioButton behavior)
authorClaus Gittinger <cg@exept.de>
Fri, 14 Aug 1998 17:22:19 +0200
changeset 1041 d28f0375cd26
parent 1040 4a395c06a985
child 1042 1cac718b8cc0
added choice type menu items (i.e. radioButton behavior)
MenuItem.st
--- a/MenuItem.st	Fri Aug 14 13:04:21 1998 +0200
+++ b/MenuItem.st	Fri Aug 14 17:22:19 1998 +0200
@@ -8,7 +8,7 @@
 
 Object subclass:#MenuItemAdornment
 	instanceVariableNames:'color indication submenu submenuChannel shortcutKey labelText
-		labelImage accessCharacterPosition argument'
+		labelImage accessCharacterPosition argument choice choiceValue'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:MenuItem
@@ -263,6 +263,50 @@
     self indication:true
 !
 
+choice
+    "return the menu items choice indicator (RadioButton)
+    "
+    adornment notNil ifTrue:[
+        ^ adornment choice
+    ].
+    ^ nil
+
+    "Created: / 14.8.1998 / 14:34:55 / cg"
+    "Modified: / 14.8.1998 / 15:11:57 / cg"
+!
+
+choice:aChoice
+    "set the menu items choice indicator (RadioButton)
+    "
+    (aChoice notNil or:[adornment notNil]) ifTrue:[
+        self adornment choice:aChoice.
+    ].
+
+    "Created: / 14.8.1998 / 15:11:17 / cg"
+!
+
+choiceValue
+    "return the menu items choiceValue (RadioButton)
+    "
+    adornment notNil ifTrue:[
+        ^ adornment choiceValue
+    ].
+    ^ nil
+
+    "Modified: / 14.8.1998 / 15:11:57 / cg"
+    "Created: / 14.8.1998 / 15:38:05 / cg"
+!
+
+choiceValue:something
+    "set the menu items choiceValue (RadioButton)
+    "
+    (something notNil or:[adornment notNil]) ifTrue:[
+        self adornment choiceValue:something.
+    ].
+
+    "Created: / 14.8.1998 / 15:39:12 / cg"
+!
+
 disable
     enabled := false
 
@@ -288,21 +332,24 @@
 !
 
 indication
-    "test whether the menu item has an on/off indicator (CheckToggle)
+    "return the menu items on/off indicator (CheckToggle)
     "
     adornment notNil ifTrue:[
         ^ adornment indication
     ].
     ^ nil
+
+    "Modified: / 14.8.1998 / 15:11:37 / cg"
 !
 
 indication:anIndication
-    "test whether the menu item has an on/off indicator (CheckToggle)
+    "set the menu items an on/off indicator (CheckToggle)
     "
     (anIndication notNil or:[adornment notNil]) ifTrue:[
         self adornment indication:anIndication.
     ].
 
+    "Modified: / 14.8.1998 / 15:11:25 / cg"
 !
 
 isButton
@@ -444,6 +491,12 @@
         (something := self indication) notNil ifTrue:[
             coll add:#indication: ; add:(something literalArrayEncoding)
         ].
+        (something := self choice) notNil ifTrue:[
+            coll add:#choice: ; add:(something literalArrayEncoding)
+        ].
+        (something := self choiceValue) notNil ifTrue:[
+            coll add:#choiceValue: ; add:(something literalArrayEncoding)
+        ].
 
         (something := self submenuChannel) notNil ifTrue:[
             coll add:#submenuChannel: ; add:(something literalArrayEncoding)
@@ -455,6 +508,8 @@
     ].
 
   ^ coll asArray
+
+    "Modified: / 14.8.1998 / 15:44:53 / cg"
 ! !
 
 !MenuItem methodsFor:'private - accessing'!
@@ -515,6 +570,14 @@
 
 !MenuItem methodsFor:'queries'!
 
+hasChoice
+    "test whether choice exists
+    "
+  ^ self choice notNil
+
+    "Created: / 14.8.1998 / 14:34:29 / cg"
+!
+
 hasIndication
     "test whether indication on/off exists
     "
@@ -587,6 +650,38 @@
     "Created: 25.2.1997 / 20:59:28 / cg"
 !
 
+choice
+    "return the value of the instance variable 'choice' (automatically generated)"
+
+    ^ choice
+
+    "Created: / 14.8.1998 / 14:32:06 / cg"
+!
+
+choice:something
+    "set the value of the instance variable 'choice' (automatically generated)"
+
+    choice := something.
+
+    "Created: / 14.8.1998 / 14:32:06 / cg"
+!
+
+choiceValue
+    "return the value of the instance variable 'choiceValue' (automatically generated)"
+
+    ^ choiceValue
+
+    "Created: / 14.8.1998 / 15:39:26 / cg"
+!
+
+choiceValue:something
+    "set the value of the instance variable 'choiceValue' (automatically generated)"
+
+    choiceValue := something.
+
+    "Created: / 14.8.1998 / 15:39:26 / cg"
+!
+
 color
     "return the value of the instance variable 'color' (automatically generated)"
 
@@ -694,5 +789,5 @@
 !MenuItem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.24 1998-08-04 15:38:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.25 1998-08-14 15:22:19 cg Exp $'
 ! !