home *** CD-ROM | disk | FTP | other *** search
- #ifndef __MiscTableCell_h
- #define __MiscTableCell_h
- //=============================================================================
- //
- // Copyright (C) 1995, 1996 by Paul S. McCarthy and Eric Sunshine.
- // Written by Paul S. McCarthy and Eric Sunshine.
- // All Rights Reserved.
- //
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the authors
- // and its use is governed by the MiscKit license, found in the file
- // "License.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
- //=============================================================================
- //-----------------------------------------------------------------------------
- // MiscTableCell.h
- //
- // Default cell class used by MiscTableScroll to display text.
- //
- // NOTE:
- // By default, new cells are initialized to useOwner... everything.
- //
- // Calling any of the -setFont:, -setTextColor:, -setBackgroundColor:
- // -setHighlightTextColor:, or -setHighlightBackgroundColor:
- // methods implicitly turns off the corresponding "useOwner" value. In
- // the case of colors, this also causes space to be allocated to store
- // the corresponding color.
- //
- // Calling any of the -setOwnerFont:, -setOwnerTextColor:, or
- // -setOwnerBackgroundColor: methods do *NOT* set these values in the
- // owner, and do not necessarily make any changes in the object. They
- // are primarily notification messages. They give the cell the ability
- // to distinguish between cell-specific -setXxx messages and ones that
- // are propagated globally by the owner.
- //
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // $Id: MiscTableCell.h,v 1.6 96/01/13 23:40:29 zarnuk Exp $
- // $Log: MiscTableCell.h,v $
- // Revision 1.6 96/01/13 23:40:29 zarnuk
- // Tag is no longer optional.
- //
- // Revision 1.5 95/10/03 05:01:44 sunshine
- // Implemented -copyFromZone: instead of -copy. Now all allocations are made
- // from [self zone] instead of default-malloc-zone.
- //
- // Revision 1.4 95/10/01 15:03:30 sunshine
- // Added highlightTextColor and highlightBackgroundColor and corresponding
- // manipulation methods and 'gray' methods.
- //
- // Revision 1.3 95/09/29 16:01:27 zarnuk
- // lazy-allocation for tags, colors.
- // useOwner options for font, colors.
- //-----------------------------------------------------------------------------
-
- #import <misckit/MiscTableTypes.h>
- MISC_TS_EXTERN_BEGIN( "Objective-C" )
- #import <appkit/Cell.h>
- MISC_TS_EXTERN_END
-
- #define MISC_TC1_HAS_TAG (1 << 0) // Obsolete.
- #define MISC_TC1_SELF_FONT (1 << 1)
- #define MISC_TC1_SELF_TEXT_COLOR (1 << 2)
- #define MISC_TC1_SELF_BACKGROUND_COLOR (1 << 3)
- #define MISC_TC1_SELF_TEXT_COLOR_H (1 << 4)
- #define MISC_TC1_SELF_BACKGROUND_COLOR_H (1 << 5)
- #define MISC_TC1_LAST_BIT (1 << 5)
-
- @interface MiscTableCell : Cell
- {
- id owner;
- int tag;
- unsigned int tc1_flags;
- void* tc1_data;
- }
-
- - initTextCell: (char const*) s;
- - initIconCell: (char const*) s;
- - free;
- - copyFromZone: (NXZone*) zone;
- - read: (NXTypedStream*) stream;
- - write: (NXTypedStream*) stream;
-
- - calcCellSize: (NXSize*)theSize inRect: (NXRect const*)aRect;
- - drawInside: (NXRect const*)cellFrame inView: controlView;
- - drawSelf: (NXRect const*)cellFrame inView: aView;
-
- - (int) tag;
- - setTag: (int) tag;
-
- - image;
- - setImage: image;
-
- - owner;
- - setOwner:obj;
-
- - font;
- - setFont:fontObj; // Turns off -useOwnerFont
-
- - (NXColor) textColor;
- - (NXColor) backgroundColor;
- - (NXColor) highlightBackgroundColor;
- - (NXColor) highlightTextColor;
- - setTextColor: (NXColor) c; // Turns off -useOwnerTextColor
- - setBackgroundColor: (NXColor) c; // Turns off -useOwnerBackgroundColor
- - setHighlightTextColor: (NXColor) c; // Turns off -useOwnerHighlightTextColor
- - setHighlightBackgroundColor: (NXColor) c; // Turns off -useOwnerHighli...
-
- - (float) textGray; // Gray values are translated
- - (float) backgroundGray; // to/from color values.
- - (float) highlightTextGray;
- - (float) highlightBackgroundGray;
- - setTextGray:(float)value; // calls setTextColor:
- - setBackgroundGray:(float)value; // calls setBackgroundColor:
- - setHighlightTextGray:(float)value; // calls setHighlightTextColor:
- - setHighlightBackgroundGray:(float)value; // calls setHighlightBack...
-
- - (BOOL) useOwnerFont;
- - (BOOL) useOwnerTextColor;
- - (BOOL) useOwnerBackgroundColor;
- - (BOOL) useOwnerHighlightTextColor;
- - (BOOL) useOwnerHighlightBackgroundColor;
- - setUseOwnerFont: (BOOL) flag;
- - setUseOwnerTextColor: (BOOL) flag;
- - setUseOwnerBackgroundColor: (BOOL) flag;
- - setUseOwnerHighlightTextColor: (BOOL) flag;
- - setUseOwnerHighlightBackgroundColor: (BOOL) flag;
-
- - setOwnerFont:fontObj;
- - setOwnerTextColor: (NXColor) pcolor;
- - setOwnerBackgroundColor: (NXColor) pcolor;
- - setOwnerHighlightTextColor: (NXColor) pcolor;
- - setOwnerHighlightBackgroundColor: (NXColor) pcolor;
-
- - (unsigned int) tc1Flags;
- - (unsigned int) tc1DataSize;
- - (unsigned int) tc1TextColorPos;
- - (unsigned int) tc1BackgroundColorPos;
- - (unsigned int) tc1HighlightTextColorPos;
- - (unsigned int) tc1HighlightBackgroundColorPos;
- - (unsigned int) tc1TextColorLen;
- - (unsigned int) tc1BackgroundColorLen;
- - (unsigned int) tc1HighlightTextColorLen;
- - (unsigned int) tc1HighlightBackgroundColorLen;
- - (NXColor*) tc1TextColorPtr;
- - (NXColor*) tc1BackgroundColorPtr;
- - (NXColor*) tc1HighlightTextColorPtr;
- - (NXColor*) tc1HighlightBackgroundColorPtr;
- - (void*) tc1InsertData:(void const*)data
- pos:(unsigned int)pos len:(unsigned int)len;
- - (void) tc1DeleteDataPos:(unsigned int)pos len:(unsigned int)len;
- - (void) tc1DestroyData;
- - (void) tc1FreeData;
-
- - (NXColor) fgColor; // For drawing: adjusts color based on state/highlight
- - (NXColor) bgColor; // For drawing: adjusts color based on state/highlight
-
- + defaultFont;
- + (NXColor) defaultTextColor;
- + (NXColor) defaultBackgroundColor;
- + (NXColor) defaultHighlightTextColor;
- + (NXColor) defaultHighlightBackgroundColor;
-
- @end
-
- #endif // __MiscTableCell_h
-