Implement #displayOn: instead of #displayString
authorStefan Vogel <sv@exept.de>
Fri, 03 Aug 2012 17:52:57 +0200
changeset 14287 d172b79d6ebb
parent 14286 2998078bc2aa
child 14288 d30ff513d793
Implement #displayOn: instead of #displayString
Message.st
--- a/Message.st	Fri Aug 03 17:52:54 2012 +0200
+++ b/Message.st	Fri Aug 03 17:52:57 2012 +0200
@@ -219,12 +219,25 @@
 
 !Message 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 , '(' , selector printString , ')'
+    "/ 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: 28.10.1996 / 17:04:29 / cg"
+    aGCOrStream 
+        nextPutAll:self class name;
+        nextPut:$(.
+    selector storeOn:aGCOrStream. 
+    aGCOrStream nextPut:$)
 !
 
 printOn:aStream
@@ -258,5 +271,5 @@
 !Message class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Message.st,v 1.33 2007-05-31 15:51:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Message.st,v 1.34 2012-08-03 15:52:57 stefan Exp $'
 ! !