fetch device resources early
authorClaus Gittinger <cg@exept.de>
Mon, 13 Jan 1997 23:47:18 +0100
changeset 936 0e8811726930
parent 935 2a105c61d86c
child 937 a40b299d30c8
fetch device resources early
Toggle.st
--- a/Toggle.st	Mon Jan 13 23:37:06 1997 +0100
+++ b/Toggle.st	Mon Jan 13 23:47:18 1997 +0100
@@ -418,22 +418,34 @@
     ^ ToggleController
 !
 
+fetchDeviceResources
+    "fetch device colors, to avoid reallocation at redraw time"
+
+    super fetchDeviceResources.
+
+    lampColor notNil ifTrue:[lampColor := lampColor on:device].
+
+    "Created: 13.1.1997 / 23:46:31 / cg"
+!
+
 initStyle
     super initStyle.
 
     showLamp := DefaultShowLamp.
     showLamp ifTrue:[
-	onLevel := offLevel.
+        onLevel := offLevel.
 
-	"dont know, if I like this ..."
-	"
-	activeBgColor := bgColor
-	"
+        "dont know, if I like this ..."
+        "
+        activeBgColor := bgColor
+        "
     ].
 
-    lampColor := DefaultLampColor on:device.
+    lampColor := DefaultLampColor.
     lampWidth := (device horizontalPixelPerMillimeter * 1.8) rounded.
     lampHeight := (device verticalPixelPerMillimeter * 3.5) rounded.
+
+    "Modified: 13.1.1997 / 23:46:35 / cg"
 !
 
 realize
@@ -512,5 +524,5 @@
 !Toggle class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.31 1996-05-28 20:10:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.32 1997-01-13 22:47:18 cg Exp $'
 ! !