MenuItem.st
changeset 590 fb2c55428c52
parent 584 9a4c30f7586f
child 640 4e1c0d0a633b
--- a/MenuItem.st	Wed Jun 04 13:12:25 1997 +0200
+++ b/MenuItem.st	Wed Jun 04 13:12:51 1997 +0200
@@ -58,17 +58,6 @@
     ]
 !
 
-indication
-    "not yet supported
-    "
-    ^ true
-!
-
-indication:anIndication
-    "not yet supported
-    "
-!
-
 label
     ^ label
 
@@ -168,6 +157,18 @@
 
 !MenuItem methodsFor:'accessing behavior'!
 
+beOff
+    "set indication off
+    "
+    self indication:false
+!
+
+beOn
+    "set indication on
+    "
+    self indication:true
+!
+
 disable
     enabled := false
 
@@ -190,6 +191,24 @@
     "a boolean, valueHolder or block
     "
     enabled := something
+!
+
+indication
+    "test whether the menu item has an on/off indicator (CheckToggle)
+    "
+    adornment notNil ifTrue:[
+        ^ adornment indication
+    ].
+    ^ nil
+!
+
+indication:anIndication
+    "test whether the menu item has an on/off indicator (CheckToggle)
+    "
+    (anIndication notNil or:[adornment notNil]) ifTrue:[
+        self adornment indication:anIndication.
+    ].
+
 ! !
 
 !MenuItem methodsFor:'accessing resource'!
@@ -278,6 +297,12 @@
 
 !MenuItem methodsFor:'queries'!
 
+hasIndication
+    "test whether indication on/off exists
+    "
+  ^ self indication notNil
+!
+
 hasSubmenu
     ^ self submenu notNil
 
@@ -288,6 +313,24 @@
     ^ enabled value ? true
 
     "Created: 25.2.1997 / 19:39:17 / cg"
+!
+
+isOff
+    "test whether indication on/off exists and is off
+    "
+    |indication|
+
+    indication := self indication.
+  ^ indication value == false
+!
+
+isOn
+    "test whether indication on/off exists and is on
+    "
+    |indication|
+
+    indication := self indication.
+  ^ indication value == true
 ! !
 
 !MenuItem::MenuItemAdornment methodsFor:'accessing'!
@@ -319,16 +362,16 @@
 !
 
 indication
-    "return the value of the instance variable 'indication' (automatically generated)"
-
+    "test whether the menu item has an on/off indicator (CheckToggle)
+    "
     ^ indication
 
     "Created: 25.2.1997 / 20:59:28 / cg"
 !
 
 indication:something
-    "set the value of the instance variable 'indication' (automatically generated)"
-
+    "test whether the menu item has an on/off indicator (CheckToggle)
+    "
     indication := something.
 
     "Created: 25.2.1997 / 20:59:28 / cg"
@@ -387,5 +430,5 @@
 !MenuItem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.10 1997-05-27 09:11:29 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.11 1997-06-04 11:12:51 ca Exp $'
 ! !