home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscTableScroll / MiscTableScroll.subproj / MiscTableCell.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-11  |  6.0 KB  |  169 lines

  1. #ifndef __MiscTableCell_h
  2. #define __MiscTableCell_h
  3. //=============================================================================
  4. //
  5. //        Copyright (C) 1995, 1996 by Paul S. McCarthy and Eric Sunshine.
  6. //                Written by Paul S. McCarthy and Eric Sunshine.
  7. //                            All Rights Reserved.
  8. //
  9. //        This notice may not be removed from this source code.
  10. //
  11. //        This object is included in the MiscKit by permission from the authors
  12. //        and its use is governed by the MiscKit license, found in the file
  13. //        "License.rtf" in the MiscKit distribution.    Please refer to that file
  14. //        for a list of all applicable permissions and restrictions.
  15. //        
  16. //=============================================================================
  17. //-----------------------------------------------------------------------------
  18. // MiscTableCell.h
  19. //
  20. //        Default cell class used by MiscTableScroll to display text.
  21. //
  22. // NOTE:
  23. //        By default, new cells are initialized to useOwner... everything.
  24. //
  25. //        Calling any of the -setFont:, -setTextColor:, -setBackgroundColor:
  26. //        -setHighlightTextColor:, or -setHighlightBackgroundColor:
  27. //        methods implicitly turns off the corresponding "useOwner" value.  In
  28. //        the case of colors, this also causes space to be allocated to store
  29. //        the corresponding color.
  30. //
  31. //        Calling any of the -setOwnerFont:, -setOwnerTextColor:, or 
  32. //        -setOwnerBackgroundColor: methods do *NOT* set these values in the
  33. //        owner, and do not necessarily make any changes in the object.  They
  34. //        are primarily notification messages.  They give the cell the ability
  35. //        to distinguish between cell-specific -setXxx messages and ones that
  36. //        are propagated globally by the owner.
  37. //
  38. //-----------------------------------------------------------------------------
  39. //-----------------------------------------------------------------------------
  40. // $Id: MiscTableCell.h,v 1.6 96/01/13 23:40:29 zarnuk Exp $
  41. // $Log:        MiscTableCell.h,v $
  42. // Revision 1.6     96/01/13  23:40:29     zarnuk
  43. // Tag is no longer optional.
  44. // 
  45. // Revision 1.5     95/10/03  05:01:44     sunshine
  46. // Implemented -copyFromZone: instead of -copy.     Now all allocations are made
  47. // from [self zone] instead of default-malloc-zone.
  48. // 
  49. // Revision 1.4     95/10/01  15:03:30     sunshine
  50. // Added highlightTextColor and highlightBackgroundColor and corresponding
  51. // manipulation methods and 'gray' methods.
  52. // 
  53. // Revision 1.3     95/09/29  16:01:27     zarnuk
  54. // lazy-allocation for tags, colors.
  55. // useOwner options for font, colors.
  56. //-----------------------------------------------------------------------------
  57.  
  58. #import <misckit/MiscTableTypes.h>
  59. MISC_TS_EXTERN_BEGIN( "Objective-C" )
  60. #import <appkit/Cell.h>
  61. MISC_TS_EXTERN_END
  62.  
  63. #define MISC_TC1_HAS_TAG                        (1 << 0)        // Obsolete.
  64. #define MISC_TC1_SELF_FONT                        (1 << 1)
  65. #define MISC_TC1_SELF_TEXT_COLOR                (1 << 2)
  66. #define MISC_TC1_SELF_BACKGROUND_COLOR            (1 << 3)
  67. #define MISC_TC1_SELF_TEXT_COLOR_H                (1 << 4)
  68. #define MISC_TC1_SELF_BACKGROUND_COLOR_H        (1 << 5)
  69. #define MISC_TC1_LAST_BIT                        (1 << 5)
  70.  
  71. @interface MiscTableCell : Cell
  72.     {
  73.     id owner;
  74.     int tag;
  75.     unsigned int tc1_flags;
  76.     void* tc1_data;
  77.     }
  78.  
  79. - initTextCell: (char const*) s;
  80. - initIconCell: (char const*) s;
  81. - free;
  82. - copyFromZone: (NXZone*) zone;
  83. - read: (NXTypedStream*) stream;
  84. - write: (NXTypedStream*) stream;
  85.  
  86. - calcCellSize: (NXSize*)theSize inRect: (NXRect const*)aRect;
  87. - drawInside: (NXRect const*)cellFrame inView: controlView;
  88. - drawSelf: (NXRect const*)cellFrame inView: aView;
  89.  
  90. - (int) tag;
  91. - setTag: (int) tag;
  92.  
  93. - image;
  94. - setImage: image;
  95.  
  96. - owner;
  97. - setOwner:obj;
  98.  
  99. - font;
  100. - setFont:fontObj;                        // Turns off -useOwnerFont
  101.  
  102. - (NXColor) textColor;
  103. - (NXColor) backgroundColor;
  104. - (NXColor) highlightBackgroundColor;
  105. - (NXColor) highlightTextColor;
  106. - setTextColor: (NXColor) c;            // Turns off -useOwnerTextColor
  107. - setBackgroundColor: (NXColor) c;        // Turns off -useOwnerBackgroundColor
  108. - setHighlightTextColor: (NXColor) c;    // Turns off -useOwnerHighlightTextColor
  109. - setHighlightBackgroundColor: (NXColor) c;        // Turns off -useOwnerHighli...
  110.  
  111. - (float) textGray;                        // Gray values are translated 
  112. - (float) backgroundGray;                // to/from color values.
  113. - (float) highlightTextGray;
  114. - (float) highlightBackgroundGray;
  115. - setTextGray:(float)value;                // calls setTextColor:
  116. - setBackgroundGray:(float)value;        // calls setBackgroundColor:
  117. - setHighlightTextGray:(float)value;    // calls setHighlightTextColor:
  118. - setHighlightBackgroundGray:(float)value;        // calls setHighlightBack...
  119.  
  120. - (BOOL) useOwnerFont;
  121. - (BOOL) useOwnerTextColor;
  122. - (BOOL) useOwnerBackgroundColor;
  123. - (BOOL) useOwnerHighlightTextColor;
  124. - (BOOL) useOwnerHighlightBackgroundColor;
  125. - setUseOwnerFont: (BOOL) flag;
  126. - setUseOwnerTextColor: (BOOL) flag;
  127. - setUseOwnerBackgroundColor: (BOOL) flag;
  128. - setUseOwnerHighlightTextColor: (BOOL) flag;
  129. - setUseOwnerHighlightBackgroundColor: (BOOL) flag;
  130.  
  131. - setOwnerFont:fontObj;
  132. - setOwnerTextColor: (NXColor) pcolor;
  133. - setOwnerBackgroundColor: (NXColor) pcolor;
  134. - setOwnerHighlightTextColor: (NXColor) pcolor;
  135. - setOwnerHighlightBackgroundColor: (NXColor) pcolor;
  136.  
  137. - (unsigned int) tc1Flags;
  138. - (unsigned int) tc1DataSize;
  139. - (unsigned int) tc1TextColorPos;
  140. - (unsigned int) tc1BackgroundColorPos;
  141. - (unsigned int) tc1HighlightTextColorPos;
  142. - (unsigned int) tc1HighlightBackgroundColorPos;
  143. - (unsigned int) tc1TextColorLen;
  144. - (unsigned int) tc1BackgroundColorLen;
  145. - (unsigned int) tc1HighlightTextColorLen;
  146. - (unsigned int) tc1HighlightBackgroundColorLen;
  147. - (NXColor*) tc1TextColorPtr;
  148. - (NXColor*) tc1BackgroundColorPtr;
  149. - (NXColor*) tc1HighlightTextColorPtr;
  150. - (NXColor*) tc1HighlightBackgroundColorPtr;
  151. - (void*) tc1InsertData:(void const*)data
  152.         pos:(unsigned int)pos len:(unsigned int)len;
  153. - (void) tc1DeleteDataPos:(unsigned int)pos len:(unsigned int)len;
  154. - (void) tc1DestroyData;
  155. - (void) tc1FreeData;
  156.  
  157. - (NXColor) fgColor;    // For drawing: adjusts color based on state/highlight
  158. - (NXColor) bgColor;    // For drawing: adjusts color based on state/highlight
  159.  
  160. + defaultFont;
  161. + (NXColor) defaultTextColor;
  162. + (NXColor) defaultBackgroundColor;
  163. + (NXColor) defaultHighlightTextColor;
  164. + (NXColor) defaultHighlightBackgroundColor;
  165.  
  166. @end
  167.  
  168. #endif // __MiscTableCell_h
  169.