home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / YellowBox / Kits / MiscTableScroll-138.1 / Palettes / MiscTableScroll / Framework / MiscTableCell.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-31  |  5.8 KB  |  167 lines

  1. #ifndef __MiscTableCell_h
  2. #define __MiscTableCell_h
  3. //=============================================================================
  4. //
  5. //    Copyright (C) 1995-1997 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. //    -setSelectedTextColor:, or -setSelectedBackgroundColor:
  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.13 97/06/22 10:19:56 sunshine Exp $
  41. // $Log:    MiscTableCell.h,v $
  42. // Revision 1.13  97/06/22  10:19:56  sunshine
  43. // v127.1: Applied v0.127 NEXTSTEP 3.3 diffs.
  44. // 
  45. // Revision 1.12  97/06/18  10:24:28  sunshine
  46. // v125.9: Color-related methods changed name: "highlight" --> "selected".
  47. // 
  48. // Revision 1.11  97/04/15  09:02:17  sunshine
  49. // v0.125.8: Added "MiscTableScroll/" prefix to #import to facilitate new
  50. // framework organization.
  51. //-----------------------------------------------------------------------------
  52. #import <MiscTableScroll/MiscTableTypes.h>
  53. MISC_TS_EXTERN_BEGIN( "Objective-C" )
  54. #import <AppKit/NSCell.h>
  55. MISC_TS_EXTERN_END
  56. @class NSImage, NSPasteboard;
  57. @class MiscTableScroll;
  58.  
  59. #define MISC_TC1_HAS_TAG            (1 << 0)    // Obsolete.
  60. #define MISC_TC1_SELF_FONT            (1 << 1)
  61. #define MISC_TC1_SELF_TEXT_COLOR        (1 << 2)
  62. #define MISC_TC1_SELF_BACKGROUND_COLOR        (1 << 3)
  63. #define MISC_TC1_SELF_TEXT_COLOR_H        (1 << 4)
  64. #define MISC_TC1_SELF_BACKGROUND_COLOR_H    (1 << 5)
  65. #define MISC_TC1_IS_SELECTED            (1 << 6)
  66. #define MISC_TC1_SELF_DRAW            (1 << 7)    // !ownerDraw
  67. #define    MISC_TC1_LAST_BIT            (1 << 7)
  68.  
  69. @interface MiscTableCell : NSCell <NSCopying,NSCoding>
  70.     {
  71.     id owner;
  72.     int tag;
  73.     unsigned int tc1_flags;
  74.     void* tc1_data;
  75.     }
  76.  
  77. - (id)initTextCell:(NSString*)s;
  78. - (id)initImageCell:(NSImage*)s;
  79. - (void)dealloc;
  80. - (id)copyWithZone:(NSZone*)zone;
  81. - (id)initWithCoder:(NSCoder*)coder;
  82. - (void)encodeWithCoder:(NSCoder*)coder;
  83.  
  84. - (void)drawInteriorWithFrame:(NSRect)r inView:(NSView*)v;
  85. - (void)drawWithFrame:(NSRect)r inView:(NSView*)v;
  86. - (void)highlight:(BOOL)flag withFrame:(NSRect)r inView:(NSView*)v;
  87. - (BOOL)isOpaque;
  88.  
  89. - (void)setSelected:(BOOL)flag;
  90. - (BOOL)isSelected;
  91.  
  92. - (int)tag;
  93. - (void)setTag:(int)tag;
  94.  
  95. - (id)owner;
  96. - (void)setOwner:(id)obj;
  97.  
  98. - (NSFont*)font;
  99. - (void)setFont:(NSFont*)obj;        // Turns off -useOwnerFont
  100.  
  101. - (NSColor*)textColor;
  102. - (NSColor*)backgroundColor;
  103. - (NSColor*)selectedBackgroundColor;
  104. - (NSColor*)selectedTextColor;
  105. - (void)setTextColor:(NSColor*)c;    // All -set..Color: turn off equivalent
  106. - (void)setBackgroundColor:(NSColor*)c;    // -useOwner...Color flags.
  107. - (void)setSelectedTextColor:(NSColor*)c;
  108. - (void)setSelectedBackgroundColor:(NSColor*)c;
  109.  
  110. - (BOOL)ownerDraw;
  111. - (BOOL)useOwnerFont;
  112. - (BOOL)useOwnerTextColor;
  113. - (BOOL)useOwnerBackgroundColor;
  114. - (BOOL)useOwnerSelectedTextColor;
  115. - (BOOL)useOwnerSelectedBackgroundColor;
  116. - (void)setOwnerDraw:(BOOL)flag;
  117. - (void)setUseOwnerFont:(BOOL)flag;
  118. - (void)setUseOwnerTextColor:(BOOL)flag;
  119. - (void)setUseOwnerBackgroundColor:(BOOL)flag;
  120. - (void)setUseOwnerSelectedTextColor:(BOOL)flag;
  121. - (void)setUseOwnerSelectedBackgroundColor:(BOOL)flag;
  122.  
  123. - (void)setOwnerFont:(NSFont*)obj;
  124. - (void)setOwnerTextColor:(NSColor*)c;
  125. - (void)setOwnerBackgroundColor:(NSColor*)c;
  126. - (void)setOwnerSelectedTextColor:(NSColor*)c;
  127. - (void)setOwnerSelectedBackgroundColor:(NSColor*)c;
  128.  
  129. - (void*)tc1Data;
  130. - (unsigned int)tc1Flags;
  131. - (unsigned int)tc1DataSize;
  132. - (unsigned int)tc1TextColorPos;
  133. - (unsigned int)tc1BackgroundColorPos;
  134. - (unsigned int)tc1SelectedTextColorPos;
  135. - (unsigned int)tc1SelectedBackgroundColorPos;
  136. - (unsigned int)tc1TextColorLen;
  137. - (unsigned int)tc1BackgroundColorLen;
  138. - (unsigned int)tc1SelectedTextColorLen;
  139. - (unsigned int)tc1SelectedBackgroundColorLen;
  140. - (NSColor**)tc1TextColorPtr;
  141. - (NSColor**)tc1BackgroundColorPtr;
  142. - (NSColor**)tc1SelectedTextColorPtr;
  143. - (NSColor**)tc1SelectedBackgroundColorPtr;
  144. - (void*)tc1InsertData:(void const*)data
  145.     pos:(unsigned int)pos len:(unsigned int)len;
  146. - (void)tc1DeleteDataPos:(unsigned int)pos len:(unsigned int)len;
  147. - (void)tc1DestroyData;
  148. - (void)tc1FreeData;
  149.  
  150. - (NSColor*)fgColor;    // Returns appropriate color based upon -isSelected.
  151. - (NSColor*)bgColor;    // Returns appropriate color based upon -isSelected.
  152.  
  153. + (NSFont*)defaultFont;
  154. + (NSColor*)defaultTextColor;
  155. + (NSColor*)defaultBackgroundColor;
  156. + (NSColor*)defaultSelectedTextColor;
  157. + (NSColor*)defaultSelectedBackgroundColor;
  158.  
  159. - (id)tableScroll:(MiscTableScroll*)scroll
  160.     reviveAtRow:(int)row column:(int)col;
  161. - (id)tableScroll:(MiscTableScroll*)scroll
  162.     retireAtRow:(int)row column:(int)col;
  163.  
  164. @end
  165.  
  166. #endif // __MiscTableCell_h
  167.