SystemStatusMonitor.st
branchjv
changeset 17277 11e4a5ca80a5
parent 17215 4a42de8e888a
parent 17225 2313780b08fb
--- a/SystemStatusMonitor.st	Mon Jan 16 19:58:08 2017 +0000
+++ b/SystemStatusMonitor.st	Tue Jan 17 11:18:31 2017 +0000
@@ -61,6 +61,46 @@
     "Created: 23.1.1997 / 02:52:43 / cg"
 ! !
 
+!SystemStatusMonitor class methodsFor:'menu specs'!
+
+mainMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+
+    "
+     MenuEditor new openOnClass:SystemStatusMonitor andSelector:#mainMenu
+     (Menu new fromLiteralArrayEncoding:(SystemStatusMonitor mainMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            label: 'File'
+            submenu: 
+           (Menu
+              (
+               (MenuItem
+                  label: 'Exit'
+                  itemValue: closeRequestToTopView
+                )
+               )
+              nil
+              nil
+            )
+          )
+         )
+        nil
+        nil
+      )
+! !
+
 !SystemStatusMonitor class methodsFor:'startup'!
 
 isAbstract
@@ -80,10 +120,29 @@
 !
 
 open
-    |top monitor|
+    |top menuPanel menu monitor|
 
     top := StandardSystemView new.
-    monitor := self origin:0.0@0.0 corner:1.0@1.0 in:top.
+
+    monitor := self in:top.
+    monitor layout:(LayoutFrame
+        leftFraction:0 offset:0
+        rightFraction:1 offset:0
+        topFraction:0 offset:30
+        bottomFraction:1 offset:0).
+
+    menuPanel := MenuPanel in:top.
+    menuPanel layout:(LayoutFrame
+        leftFraction:0 offset:0
+        rightFraction:1 offset:0
+        topFraction:0 offset:0
+        bottomFraction:0 offset:30).
+    menuPanel verticalLayout:false.
+    menu := self mainMenu decodeAsLiteralArray.
+    menu findGuiResourcesIn:monitor.
+    menu receiver:monitor.
+    menuPanel menu:menu.
+
     top extent:monitor preferredExtent.
     top label:self defaultLabel.
     top icon:self defaultIcon.
@@ -264,12 +323,44 @@
     "Modified: / 14.12.1999 / 20:47:50 / cg"
 ! !
 
+!SystemStatusMonitor methodsFor:'menu'!
+
+closeRequestToTopView
+    self topView closeRequest
+!
+
+selectionIndicesDo:aBlock
+    "evaluate aBlock on all selected indices"
+
+    |sel|
+
+    sel := listView selection.
+    sel isNil ifTrue:[^ self].
+
+    (sel isKindOf:Collection) ifTrue:[
+        sel do:aBlock
+    ] ifFalse:[
+        aBlock value:sel.
+    ].
+
+    "Created: 23.1.1997 / 03:11:24 / cg"
+! !
+
+!SystemStatusMonitor methodsFor:'private'!
+
+installDelayedUpdate
+    updateBlock notNil ifTrue:[
+        Processor removeTimedBlock:listUpdateBlock.
+        Processor addTimedBlock:listUpdateBlock afterSeconds:listUpdateDelay
+    ].
+! !
+
 !SystemStatusMonitor methodsFor:'queries'!
 
 preferredExtent
     "return my preferred extent"
 
-    ^ ((self font widthOf:self titleLine) + 40) @ 250
+    ^ ((self font widthOf:self titleLine) + 400) @ 250
 
     "Modified: 23.1.1997 / 02:35:01 / cg"
     "Created: 23.1.1997 / 02:51:24 / cg"