home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / Palettes / TTools / TToolsPalette / SwitchView.subproj / SVConnector.m < prev    next >
Encoding:
Text File  |  1993-11-09  |  1.2 KB  |  81 lines

  1. /* SVConnector.m
  2.  * Written By:  Thomas Burkholder
  3.  *
  4.  * You may freely copy, distribute, and reuse the code in this example.
  5.  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
  6.  * fitness for any particular use.
  7.  */
  8.  
  9. #import "SVConnector.h"
  10. #import "SwitchView.h"
  11.  
  12. @implementation SVConnector
  13.  
  14. - setSource:anObject
  15. {
  16.     source = anObject;
  17.     return self;
  18. }
  19.  
  20. - source
  21. {
  22.     return source;
  23. }
  24.  
  25. - setDestination:anObject
  26. {
  27.     destination = anObject;
  28.     return self;
  29. }
  30.  
  31. - destination
  32. {
  33.     return destination;
  34. }
  35.  
  36. - establishConnection
  37. {
  38.     return self;
  39. }
  40.  
  41. - nibInstantiate
  42. {
  43.     // by experimentation, we know IB calls the connectors in the reverse
  44.     // order that the connections were added to the document.
  45.  
  46.     [[source views] insertObject:destination at:0];
  47.     return self;
  48. }
  49.  
  50. - renewObject:old to:new
  51. {
  52.     if (old == source)
  53.         source = new;
  54.     else if (old == destination)
  55.         destination = new;
  56.     return self;
  57. }
  58.  
  59. - read:(NXTypedStream *)stream
  60. {
  61.     [super read:stream];
  62.     source = NXReadObject(stream);
  63.     destination = NXReadObject(stream);
  64.     return self;
  65. }
  66.  
  67. - write:(NXTypedStream *)stream
  68. {
  69.     [super write:stream];
  70.     NXWriteObject(stream, source);
  71.     NXWriteObject(stream, destination);
  72.     return self;
  73. }
  74.  
  75. - free
  76. {
  77.     return [super free];
  78. }
  79.  
  80. @end
  81.