home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / Palettes / ColorBrowser / ColorBrowserCell.m < prev    next >
Encoding:
Text File  |  1993-01-18  |  2.6 KB  |  95 lines

  1. //---------------------------------------------------------------------------------------------------------
  2. //
  3. //    ColorBrowserCell
  4. //
  5. //    Inherits From:        NXBrowserCell
  6. //
  7. //    Declared In:        ColorBrowserCell.h
  8. //
  9. //    Disclaimer
  10. //
  11. //        You may freely copy, distribute and reuse this software and its
  12. //        associated documentation. I disclaim any warranty of any kind, 
  13. //        expressed or implied, as to its fitness for any particular use.
  14. //
  15. //---------------------------------------------------------------------------------------------------------
  16. #import "ColorBrowserCell.h"
  17.  
  18.  
  19. @implementation ColorBrowserCell
  20.  
  21. //---------------------------------------------------------------------------------------------------------
  22. //    Initialization and Freeing
  23. //---------------------------------------------------------------------------------------------------------
  24. - init
  25. {
  26.     //  Answers a new instance of ColorBrowserCell.
  27.     
  28.     [super init];
  29.     [self setTextColor: NX_COLORBLACK];
  30.     return self;
  31. }
  32.  
  33.  
  34. - initTextCell:(const char *)aString
  35. {
  36.     //  Answers a new instance of ColorBrowserCell.
  37.     
  38.     [super initTextCell: aString];
  39.     [self setTextColor: NX_COLORBLACK];
  40.     return self;
  41. }
  42.  
  43.  
  44. //---------------------------------------------------------------------------------------------------------
  45. //    Accessor Methods
  46. //---------------------------------------------------------------------------------------------------------
  47. - (NXColor) textColor
  48. {
  49.     return textColor;
  50. }
  51.  
  52.  
  53. - setTextColor: (NXColor) aColor
  54. {
  55.     textColor = aColor;
  56.     return self;
  57. }
  58.  
  59.  
  60. //---------------------------------------------------------------------------------------------------------
  61. //    Archiving
  62. //---------------------------------------------------------------------------------------------------------
  63. - read: (NXTypedStream*) stream
  64. {
  65.     [super read: stream];
  66.     textColor = NXReadColor (stream);
  67.     return self;
  68. }
  69.  
  70.  
  71. - write: (NXTypedStream*) stream
  72. {
  73.     [super write: stream];
  74.     NXWriteColor (stream, textColor);
  75.     return self;
  76. }
  77.     
  78.  
  79. //---------------------------------------------------------------------------------------------------------
  80. //
  81. //---------------------------------------------------------------------------------------------------------
  82. - setTextAttributes: aTextObject
  83. {
  84.     //  This method is the key to this class' behavior.  This method is called during
  85.     //  every drawInside: inView call.  It asks for the current Text object.  This 
  86.     //  determines how the Cell's text will be displayed.  Subclasses of Cell
  87.     //  override this method to get unique characteristics. 
  88.     
  89.     [super setTextAttributes: aTextObject];
  90.     [aTextObject setTextColor: textColor];
  91.     return aTextObject;
  92. }
  93.     
  94.  
  95. @end