Implement #displayOn: instead of #displayString
authorStefan Vogel <sv@exept.de>
Fri, 03 Aug 2012 17:53:30 +0200
changeset 14290 1561011a34fd
parent 14289 1b8f3e94952a
child 14291 32d444cbde13
Implement #displayOn: instead of #displayString
MessageSend.st
--- a/MessageSend.st	Fri Aug 03 17:53:25 2012 +0200
+++ b/MessageSend.st	Fri Aug 03 17:53:30 2012 +0200
@@ -269,10 +269,27 @@
 
 !MessageSend 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 , '(' , receiver displayString , '>>' , selector , ')'
+    "/ 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.
+    ].
+
+    aGCOrStream 
+        nextPutAll:self class name;
+        nextPut:$(.
+    receiver displayOn:aGCOrStream. 
+    aGCOrStream nextPutAll:'>>'.
+    selector storeOn:aGCOrStream. 
+    aGCOrStream nextPut:$)
 !
 
 printOn:aStream
@@ -289,9 +306,9 @@
 !MessageSend class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.23 2010-12-22 12:50:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.24 2012-08-03 15:53:30 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.23 2010-12-22 12:50:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/MessageSend.st,v 1.24 2012-08-03 15:53:30 stefan Exp $'
 ! !