Implement #displayOn: instead of #displayString
authorStefan Vogel <sv@exept.de>
Fri, 03 Aug 2012 17:53:12 +0200
changeset 3015 9fb23acffeb9
parent 3014 e6d9a204da08
child 3016 e2374dddc45f
Implement #displayOn: instead of #displayString
ValueHolder.st
--- a/ValueHolder.st	Sun Jul 29 13:14:28 2012 +0200
+++ b/ValueHolder.st	Fri Aug 03 17:53:12 2012 +0200
@@ -129,12 +129,25 @@
 
 !ValueHolder methodsFor:'printing & storing'!
 
-displayString
-    "return a string for display in inspectors etc."
+displayOn:aGCOrStream
+    "Compatibility
+     append a printed desription on some stream (Dolphin,  Squeak)
+     OR:
+     display the receiver in a graphicsContext at 0@0 (ST80).
+     This method allows for any object to be displayed in some view
+     (although the fallBack is to display its printString ...)"
 
-    ^ self class name , '(' , value displayString , ')'
+    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
+    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
+    aGCOrStream isStream ifFalse:[
+        ^ super displayOn:aGCOrStream.
+    ].
 
-    "Modified: 20.9.1997 / 11:42:02 / cg"
+    aGCOrStream 
+        nextPutAll:self class name;
+        nextPut:$(.
+    value displayOn:aGCOrStream. 
+    aGCOrStream nextPut:$)
 !
 
 printOn:aStream
@@ -149,9 +162,9 @@
 !ValueHolder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ValueHolder.st,v 1.19 2009-10-22 19:09:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ValueHolder.st,v 1.20 2012-08-03 15:53:12 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/ValueHolder.st,v 1.19 2009-10-22 19:09:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ValueHolder.st,v 1.20 2012-08-03 15:53:12 stefan Exp $'
 ! !