Launcher.st
changeset 658 39ffd3412779
parent 638 5541c2f7836f
child 659 324b82dad016
--- a/Launcher.st	Wed Jul 03 15:48:33 1996 +0200
+++ b/Launcher.st	Fri Jul 05 15:08:02 1996 +0200
@@ -11,8 +11,9 @@
 "
 
 ApplicationModel subclass:#NewLauncher
-	instanceVariableNames:'myMenu buttonPanel transcript infoView infoProcess helpIsOn'
-	classVariableNames:'CachedAboutIcon'
+	instanceVariableNames:'myMenu buttonPanel transcript infoView infoProcess helpIsOn
+		isMainLauncher'
+	classVariableNames:'CachedAboutIcon OpenLaunchers'
 	poolDictionaries:''
 	category:'Interface-Smalltalk'
 !
@@ -2020,6 +2021,52 @@
     ].
 ! !
 
+!NewLauncher methodsFor:'dynamic menus'!
+
+addMenu:name withItems:items actions:actions
+    "dynamically add a new (user-)menu to the menu panel.
+     This allows applications to install items for themself
+     dynamically in the launcher."
+
+    |subMenu|
+
+    myMenu add:name selector:(name asSymbol) before:#help.
+    subMenu := MenuView forMenu:myMenu.
+    subMenu labels:items.
+    subMenu actions:actions.
+    myMenu at:name putMenu:subMenu
+
+    "
+     |launcher actionBlocks|
+
+     actionBlocks := Array new:3.
+     actionBlocks at:1 put:[Transcript showCR:'foo'].
+     actionBlocks at:2 put:[Transcript showCR:'bar'].
+
+     launcher := Transcript topView application.
+     launcher 
+        addMenu:'misc' 
+        withItems:#('foo' 'bar')
+        actions:actionBlocks
+    "
+
+    "
+     |launcher actionBlocks|
+
+     actionBlocks := Array new:3.
+     actionBlocks at:1 put:[RDoItServer startServer].
+     actionBlocks at:2 put:[RDoItServer killServer].
+                
+     launcher := Transcript topView application.
+     launcher 
+        addMenu:'misc' 
+        withItems:#('start rdoit server' 'stop rdoit server')
+        actions:actionBlocks
+    "
+
+    "Modified: 5.7.1996 / 11:45:19 / cg"
+! !
+
 !NewLauncher methodsFor:'help'!
 
 helpTextFor:aComponent
@@ -2993,5 +3040,5 @@
 !NewLauncher  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.160 1996-06-22 16:33:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.161 1996-07-05 13:08:02 cg Exp $'
 ! !