//
//  iTableView.h
//  ColoredRowTableViewExample
//
//  Created by Bradford Brack on Tue May 14 2002.
//  Copyright (c) 2002 Apple. All rights reserved.
//
//  Modified by Tony Arnold on Sun Apr 27 2003.
//	Updated using code from http://www.cocoadev.com/index.pl?AlternatingRowColors created by Dave Thorup.
//	This should fix the resize problems.
//
//  Modified by Tony Arnold on Sun Aug 25 2002.
//	I've added:
//		* coloring of rows to reflect the current system preference;
//		* iTunes style row hightlighting.
//
//	Problems/Comments on this version, please contact tonyarnold@objc-source.org
//
//  Modified by Noah Sorscher on Sat Jun 12 2003
//	I've added:
//		* enter key exits editing without changing row selection
//		* column selection highlights all the cells in the column
//		* restored keyboard focus ring
//		* now asks NSApp delegate for color instead of data source (#define)
//		* allows delegate to set text color of cells (except selected row)
//	Sun Jun 29 2003:
//		* keep state variables for various respondsToSelector calls
//		so they don't have to be called for every redraw
//		(suggested by h.friederich@gmx.ch)
//      Sat Nov 29 2003:
//              * tableHeaderView sends optional tableView:rightClickWithEvent: to table delegate
//      Sat Dec 13 2003:
//              * pressing Delete or Command-Delete while the tableview is key sends the delegate
//              deleteForTableView: or commandDeleteForTableView: methods, respectively.  Also
//              clicking a table header now makes the table view key.

#import <Cocoa/Cocoa.h>
#import "tdTableView.h"


@interface iTableView : tdTableView {
    int rowFocus, colFocus, lastEditedColumn;
    BOOL colorSourceBackgroundColor, colorSourceHighlightColor, delegateWillDisplayCell;
    BOOL /*sorting,*/ sizesToFit, editsOnEnter/*, grows*/;
//    NSString *curEditedText;
    //id oldDelegate, oldDataSource;
    //NSString *partialString;
}
- (NSRect)smallFrameOfCellAtColumn:(int)c row:(int)r;
- (void)setGrowsFrames:(BOOL)flag;
- (BOOL)growsFrames;
- (void)setSizesToFit:(BOOL)flag;
- (BOOL)sizesToFit;
- (void)edit:(NSNumber *)row;
- (void)setEditsOnEnter:(BOOL)flag;
- (void)setEditsOnEnterObj:(NSNumber *)flag;
@end

@interface iTableHeaderView : NSTableHeaderView
@end

// so we don't get pesky compiler warnings on new dataSource selectors
@interface NSObject (ColoredRowAdditions)
- (NSColor *) tableView: (NSTableView *)tableView backgroundColorForRow: (int) row;
- (NSColor *) tableView: (NSTableView *)tableView highlightColorForRow: (int) row;
- (void) tableView: (NSTableView *)tableView rightClickWithEvent: (NSEvent *)anEvent;
- (void) tableViewSelectionWontChange:(NSNotification *)notification;
- (void) tableViewSelectionWillChangeAgain:(NSNotification *)notification;
- (void) tableView:(NSTableView *)tv didEndEditingTableColumn:(NSTableColumn *)col row:(int)rowIndex;
- (void)queryDataAndColorSources;
- (BOOL)deleteForTableView:(NSTableView *)tableView;
- (BOOL)commandDeleteForTableView:(NSTableView *)tableView;
- (NSSize)sizeOfString:(NSAttributedString *)string;
- (NSRect)tableView:(NSTableView *)inTableView rectOfRow:(int)inRowIndex defaultRect:(NSRect)inDefaultRect;
- (NSRange)tableView:(NSTableView *)inTableView rowsInRect:(NSRect)inRect defaultRange:(NSRange)inDefaultRange;
- (void)cutTableView:(NSTableView *)tableView;
- (void)clearTableView:(NSTableView *)tableView;
- (id)delegate2;
- (BOOL) shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;
- (void)tableView:didEndEditingTableColumn:(NSTableColumn *)col row:(int)rowIndex;
@end