Implement #displayOn: instead of #displayString
authorStefan Vogel <sv@exept.de>
Fri, 03 Aug 2012 17:52:54 +0200
changeset 14286 2998078bc2aa
parent 14285 31f229c1f4d1
child 14287 d172b79d6ebb
Implement #displayOn: instead of #displayString
InterestConverter.st
--- a/InterestConverter.st	Fri Aug 03 17:52:51 2012 +0200
+++ b/InterestConverter.st	Fri Aug 03 17:52:54 2012 +0200
@@ -202,8 +202,28 @@
 
 !InterestConverter methodsFor:'printing'!
 
-displayString
-    ^ self className , '(sending ' , selector storeString , ' to ' , destination printString , ')'
+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 ...)"
+
+    "/ 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;
+        nextPutAll:'(sending '.
+
+    selector storeOn:aGCOrStream.
+    aGCOrStream nextPutAll:' to '.
+    destination printOn:aGCOrStream.
+    aGCOrStream nextPut:$).
 ! !
 
 !InterestConverter methodsFor:'testing'!
@@ -215,5 +235,5 @@
 !InterestConverter class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/InterestConverter.st,v 1.15 2009-05-28 06:01:29 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/InterestConverter.st,v 1.16 2012-08-03 15:52:54 stefan Exp $'
 ! !