added: #displayOn: (instead of #displaySting)
authorStefan Vogel <sv@exept.de>
Tue, 24 Apr 2012 14:01:05 +0200
changeset 14119 26e51066f338
parent 14118 c4375f1867f6
child 14120 fdf215af772c
added: #displayOn: (instead of #displaySting)
LookupKey.st
--- a/LookupKey.st	Tue Apr 24 14:00:50 2012 +0200
+++ b/LookupKey.st	Tue Apr 24 14:01:05 2012 +0200
@@ -9,6 +9,7 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
+"{ Package: 'stx:libbasic' }"
 
 Magnitude subclass:#LookupKey
 	instanceVariableNames:'key'
@@ -103,12 +104,25 @@
 
 !LookupKey methodsFor:'printing & storing'!
 
-displayString
-    "return a string containing a printable representation
-     of the receiver for displaying - redefined to use display string on
-     the components for nicer look"
+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 , '(' , key 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 and:[aGCOrStream ~~ Transcript]) ifFalse:[
+        ^ super displayOn:aGCOrStream
+    ].
+
+    aGCOrStream 
+        nextPutAll:self className; 
+        nextPut:$(.
+    key displayOn:aGCOrStream.
+    aGCOrStream nextPut:$)
 !
 
 printOn:aStream
@@ -118,8 +132,9 @@
     key printOn:aStream.
 ! !
 
+
 !LookupKey class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/LookupKey.st,v 1.9 1999-07-15 19:44:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/LookupKey.st,v 1.10 2012-04-24 12:01:05 stefan Exp $'
 ! !