support setting font in MenuPanel and Editor
authorca
Fri, 25 Feb 2000 18:53:54 +0100
changeset 1360 2b17ce81a790
parent 1359 f40bfb94f862
child 1361 41a53daee5cb
support setting font in MenuPanel and Editor
MenuItem.st
--- a/MenuItem.st	Wed Feb 23 22:31:30 2000 +0100
+++ b/MenuItem.st	Fri Feb 25 18:53:54 2000 +0100
@@ -22,7 +22,7 @@
 Object subclass:#MenuItemAdornment
 	instanceVariableNames:'color indication submenu submenuChannel shortcutKey labelText
 		labelImage accessCharacterPosition argument choice choiceValue
-		auxValue showBusyCursorWhilePerforming'
+		font auxValue showBusyCursorWhilePerforming'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:MenuItem
@@ -171,6 +171,24 @@
     "Modified: / 4.2.2000 / 12:38:44 / cg"
 !
 
+font
+    "get the specific font for an item or nil
+    "
+    adornment notNil ifTrue:[
+        ^ adornment font
+    ].
+    ^ nil
+!
+
+font:aFont
+    "set the index of the access character in the label text or string, or nil if none
+    "
+
+    (aFont isNil and:[adornment isNil]) ifFalse:[
+        self adornment font:aFont
+    ]
+!
+
 hideMenuOnActivated
     "hide the menu when the item was activated; the default is true
     "
@@ -580,6 +598,9 @@
         (something := self shortcutKeyCharacter) notNil ifTrue:[
             coll add:#shortcutKeyCharacter: ; add:(something literalArrayEncoding)
         ].
+        (something := self font) notNil ifTrue:[
+            coll add:#font: ; add:(something literalArrayEncoding)
+        ].
 
         (something := self accessCharacterPosition) notNil ifTrue:[
             coll add:#accessCharacterPosition: ; add:(something literalArrayEncoding)
@@ -825,6 +846,18 @@
     "Created: 25.2.1997 / 20:59:28 / cg"
 !
 
+font
+    "get the specific font for an item or nil
+    "
+    ^ font
+!
+
+font:aFont
+    "set a specific font for an item
+    "
+    font := aFont.
+!
+
 indication
     "test whether the menu item has an on/off indicator (CheckToggle)
     "
@@ -956,5 +989,5 @@
 !MenuItem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.37 2000-02-12 13:24:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.38 2000-02-25 17:53:54 ca Exp $'
 ! !