mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:40:47 +00:00
NSTable compiles.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4696 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8494d16d5b
commit
770ea17944
10 changed files with 292 additions and 26 deletions
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
* Source/NSMenu.m: commented out code which did multiple menu
|
* Source/NSMenu.m: commented out code which did multiple menu
|
||||||
movement as it was breaking things. Need to rethink that.
|
movement as it was breaking things. Need to rethink that.
|
||||||
|
* Headers/NSTableColumn.h
|
||||||
|
Headers/NSTableHeaderView.h
|
||||||
|
Headers/NSTableHeaderCell.h
|
||||||
|
Headers/NSTableView.h: added files.
|
||||||
|
* Source/GNUMakefile: compile in NSTable classes.
|
||||||
|
|
||||||
1999-07-31 Michael Hanni <mhanni@sprintmail.com>
|
1999-07-31 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
|
|
49
Headers/gnustep/gui/NSTableColumn.h
Normal file
49
Headers/gnustep/gui/NSTableColumn.h
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#ifndef _GNUstep_H_NSTableColumn
|
||||||
|
#define _GNUstep_H_NSTableColumn
|
||||||
|
|
||||||
|
#include <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#include <AppKit/NSTableHeaderCell.h>
|
||||||
|
#include <AppKit/NSTableView.h>
|
||||||
|
|
||||||
|
@interface NSTableColumn : NSObject
|
||||||
|
{
|
||||||
|
NSTableHeaderCell *tbcol_cell;
|
||||||
|
NSTableView *tbcol_tableview;
|
||||||
|
id tbcol_datacell;
|
||||||
|
id tbcol_identifier;
|
||||||
|
float tbcol_maxWidth;
|
||||||
|
float tbcol_minWidth;
|
||||||
|
float tbcol_width;
|
||||||
|
BOOL tbcol_resizable;
|
||||||
|
BOOL tbcol_editable;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithIdentifier:(id)anObject;
|
||||||
|
- (void)setIdentifier:(id)anObject;
|
||||||
|
- (id)identifier;
|
||||||
|
- (void)setTableView:(NSTableView *)aTableView;
|
||||||
|
- (NSTableView *)tableView;
|
||||||
|
|
||||||
|
// Sizing.
|
||||||
|
|
||||||
|
- (void)setWidth:(float)newWidth;
|
||||||
|
- (float)width;
|
||||||
|
- (void)setMinWidth:(float)minWidth;
|
||||||
|
- (float)minWidth;
|
||||||
|
- (void)setMaxWidth:(float)maxWidth;
|
||||||
|
- (float)maxWidth;
|
||||||
|
- (void)setResizable:(BOOL)flag;
|
||||||
|
- (BOOL)isResizable;
|
||||||
|
- (void)sizeToFit;
|
||||||
|
- (void)setEditable:(BOOL)flag;
|
||||||
|
- (BOOL)isEditable;
|
||||||
|
- (void)setHeaderCell:(NSCell *)aCell;
|
||||||
|
- (id)headerCell;
|
||||||
|
- (void)setDataCell:(NSCell *)aCell;
|
||||||
|
- (id)dataCell;
|
||||||
|
@end
|
||||||
|
|
||||||
|
extern NSString *NSTableViewColumnDidResizeNotification;
|
||||||
|
|
||||||
|
#endif
|
11
Headers/gnustep/gui/NSTableHeaderCell.h
Normal file
11
Headers/gnustep/gui/NSTableHeaderCell.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef _GNUstep_H_NSTableHeaderCell
|
||||||
|
#define _GNUstep_H_NSTableHeaderCell
|
||||||
|
|
||||||
|
#include <AppKit/NSTextFieldCell.h>
|
||||||
|
|
||||||
|
@interface NSTableHeaderCell : NSTextFieldCell
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
21
Headers/gnustep/gui/NSTableHeaderView.h
Normal file
21
Headers/gnustep/gui/NSTableHeaderView.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef _GNUstep_H_NSTableHeaderView
|
||||||
|
#define _GNUstep_H_NSTableHeaderView
|
||||||
|
|
||||||
|
#include <AppKit/NSView.h>
|
||||||
|
|
||||||
|
@class NSTableView;
|
||||||
|
|
||||||
|
@interface NSTableHeaderView : NSView
|
||||||
|
{
|
||||||
|
NSTableView *tbhv_tableview;
|
||||||
|
}
|
||||||
|
- (void)setTableView:(NSTableView *)aTableView;
|
||||||
|
- (NSTableView *)tableView;
|
||||||
|
- (int)draggedColumn;
|
||||||
|
- (float)draggedDistance;
|
||||||
|
- (int)resizedColumn;
|
||||||
|
- (int)columnAtPoint:(NSPoint)aPoint;
|
||||||
|
- (NSRect)headerRectOfColumn:(int)columnIndex;
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
147
Headers/gnustep/gui/NSTableView.h
Normal file
147
Headers/gnustep/gui/NSTableView.h
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
#ifndef _GNUstep_H_NSTableView
|
||||||
|
#define _GNUstep_H_NSTableView
|
||||||
|
|
||||||
|
#include <Foundation/Foundation.h>
|
||||||
|
#include <AppKit/NSControl.h>
|
||||||
|
|
||||||
|
@class NSColor;
|
||||||
|
@class NSTableColumn;
|
||||||
|
@class NSTableHeaderView;
|
||||||
|
@class NSView;
|
||||||
|
|
||||||
|
@interface NSTableView : NSControl
|
||||||
|
{
|
||||||
|
id delegate;
|
||||||
|
id tb_datasource;
|
||||||
|
BOOL tbv_allowsColumnReordering;
|
||||||
|
BOOL tbv_allowsColumnResizing;
|
||||||
|
BOOL tbv_allowsMultipleSelection;
|
||||||
|
BOOL tbv_allowsEmptySelection;
|
||||||
|
BOOL tbv_allowsColumnSelection;
|
||||||
|
BOOL tbv_autoresizesAllColumnsToFit;
|
||||||
|
NSSize tbv_interCellSpacing;
|
||||||
|
float tbv_rowHeight;
|
||||||
|
NSColor *tbv_backgroundColor;
|
||||||
|
NSMutableArray *tbv_columns;
|
||||||
|
NSMutableArray *tbv_selectedColumns;
|
||||||
|
NSMutableArray *tbv_selectedRows;
|
||||||
|
BOOL tbv_drawsGrid;
|
||||||
|
NSColor *tbv_gridColor;
|
||||||
|
NSTableHeaderView *tbv_headerView;
|
||||||
|
NSView *tbv_cornerView;
|
||||||
|
}
|
||||||
|
- (id)initWithFrame:(NSRect)frameRect;
|
||||||
|
- (void)setDataSource:(id)anObject;
|
||||||
|
- (id)dataSource;
|
||||||
|
- (void)reloadData;
|
||||||
|
- (void)setDoubleAction:(SEL)aSelector;
|
||||||
|
- (SEL)doubleAction;
|
||||||
|
- (int)clickedColumn;
|
||||||
|
- (int)clickedRow;
|
||||||
|
- (void)setAllowsColumnReordering:(BOOL)flag;
|
||||||
|
- (BOOL)allowsColumnReordering;
|
||||||
|
- (void)setAllowsColumnResizing:(BOOL)flag;
|
||||||
|
- (BOOL)allowsColumnResizing;
|
||||||
|
- (void)setAllowsMultipleSelection:(BOOL)flag;
|
||||||
|
- (BOOL)allowsMultipleSelection;
|
||||||
|
- (void)setAllowsEmptySelection:(BOOL)flag;
|
||||||
|
- (BOOL)allowsEmptySelection;
|
||||||
|
- (void)setAllowsColumnSelection:(BOOL)flag;
|
||||||
|
- (BOOL)allowsColumnSelection;
|
||||||
|
- (void)setIntercellSpacing:(NSSize)aSize;
|
||||||
|
- (NSSize)intercellSpacing;
|
||||||
|
- (void)setRowHeight:(float)rowHeight;
|
||||||
|
- (float)rowHeight;
|
||||||
|
- (void)setBackgroundColor:(NSColor *)aColor;
|
||||||
|
- (NSColor *)backgroundColor;
|
||||||
|
- (void)addTableColumn:(NSTableColumn *)aColumn;
|
||||||
|
- (void)removeTableColumn:(NSTableColumn *)aTableColumn;
|
||||||
|
- (void)moveColumn:(int)columnIndex
|
||||||
|
toColumn:(int)newIndex;
|
||||||
|
- (NSArray *)tableColumns;
|
||||||
|
- (int)columnWithIdentifier:(id)anObject;
|
||||||
|
- (NSTableColumn *)tableColumnWithIdentifier:(id)anObject;
|
||||||
|
- (void)selectColumn:(int)columnIndex byExtendingSelection:(BOOL)flag;
|
||||||
|
- (void)selectRow:(int)rowIndex byExtendingSelection:(BOOL)flag;
|
||||||
|
- (void)deselectColumn:(int)columnIndex;
|
||||||
|
- (void)deselectRow:(int)rowIndex;
|
||||||
|
- (int)numberOfSelectedColumns;
|
||||||
|
- (int)numberOfSelectedRows;
|
||||||
|
- (int)selectedColumn;
|
||||||
|
- (int)selectedRow;
|
||||||
|
- (BOOL)isColumnSelected:(int)columnIndex;
|
||||||
|
- (BOOL)isRowSelected:(int)rowIndex;
|
||||||
|
- (NSEnumerator *)selectedColumnEnumerator;
|
||||||
|
- (NSEnumerator *)selectedRowEnumerator;
|
||||||
|
- (void)selectAll:(id)sender;
|
||||||
|
- (void)deselectAll:(id)sender;
|
||||||
|
- (int)numberOfColumns;
|
||||||
|
- (int)numberOfRows;
|
||||||
|
- (void)setDrawsGrid:(BOOL)flag;
|
||||||
|
- (BOOL)drawsGrid;
|
||||||
|
- (void)setGridColor:(NSColor *)aColor ;
|
||||||
|
- (NSColor *)gridColor;
|
||||||
|
- (void)editColumn:(int)columnIndex
|
||||||
|
row:(int)rowIndex
|
||||||
|
withEvent:(NSEvent *)theEvent
|
||||||
|
select:(BOOL)flag;
|
||||||
|
- (int)editedRow;
|
||||||
|
- (int)editedColumn;
|
||||||
|
- (void)setHeaderView:(NSTableHeaderView *)aHeaderView;
|
||||||
|
- (NSTableHeaderView *)headerView;
|
||||||
|
- (void)setCornerView:(NSView *)aView;
|
||||||
|
- (NSView *)cornerView;
|
||||||
|
- (NSRect)rectOfColumn:(int)columnIndex;
|
||||||
|
- (NSRect)rectOfRow:(int)rowIndex;
|
||||||
|
- (NSRange)columnsInRect:(NSRect)aRect;
|
||||||
|
- (NSRange)rowsInRect:(NSRect)aRect;
|
||||||
|
- (int)columnAtPoint:(NSPoint)aPoint;
|
||||||
|
- (int)rowAtPoint:(NSPoint)aPoint;
|
||||||
|
- (NSRect)frameOfCellAtColumn:(int)columnIndex
|
||||||
|
row:(int)rowIndex;
|
||||||
|
- (void)setAutoresizesAllColumnsToFit:(BOOL)flag;
|
||||||
|
- (BOOL)autoresizesAllColumnsToFit;
|
||||||
|
- (void)sizeLastColumnToFit;
|
||||||
|
- (void)sizeToFit;
|
||||||
|
- (void)noteNumberOfRowsChanged;
|
||||||
|
- (void)tile;
|
||||||
|
- (void)drawRow:(int)rowIndex
|
||||||
|
clipRect:(NSRect)clipRect;
|
||||||
|
- (void)drawGridInClipRect:(NSRect)aRect;
|
||||||
|
- (void)highlightSelectionInClipRect:(NSRect)clipRect;
|
||||||
|
- (void)scrollRowToVisible:(int)rowIndex;
|
||||||
|
- (void)scrollColumnToVisible:(int)columnIndex;
|
||||||
|
- (BOOL)textShouldBeginEditing:(NSText *)textObject;
|
||||||
|
- (void)textDidBeginEditing:(NSNotification *)aNotification;
|
||||||
|
- (void)textDidChange:(NSNotification *)aNotification;
|
||||||
|
- (BOOL)textShouldEndEditing:(NSText *)textObject;
|
||||||
|
- (void)textDidEndEditing:(NSNotification *)aNotification;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSObject(NSTableViewDelegate)
|
||||||
|
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
|
||||||
|
- (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)row;
|
||||||
|
- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView;
|
||||||
|
- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(int)row;
|
||||||
|
- (BOOL)tableView:(NSTableView *)tableView shouldSelectTableColumn:(NSTableColumn *)tableColumn;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSObject(NSTableViewNotifications)
|
||||||
|
- (void)tableViewSelectionDidChange:(NSNotification *)notification;
|
||||||
|
- (void)tableViewColumnDidMove:(NSNotification *)notification;
|
||||||
|
- (void)tableViewColumnDidResize:(NSNotification *)notification;
|
||||||
|
- (void)tableViewSelectionIsChanging:(NSNotification *)notification;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSObject(NSTableDataSource)
|
||||||
|
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
|
||||||
|
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row;
|
||||||
|
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
|
||||||
|
@end
|
||||||
|
|
||||||
|
extern NSString *NSTableViewSelectionDidChangeNotification;
|
||||||
|
extern NSString *NSTableViewColumnDidMoveNotification; // @"NSOldColumn", @"NSNewColumn"
|
||||||
|
extern NSString *NSTableViewColumnDidResizeNotification; // @"NSTableColumn", @"NSOldWidth"
|
||||||
|
extern NSString *NSTableViewSelectionIsChangingNotification;
|
||||||
|
|
||||||
|
#endif
|
|
@ -109,6 +109,10 @@ NSSplitView.m \
|
||||||
NSStringDrawing.m \
|
NSStringDrawing.m \
|
||||||
NSTabView.m \
|
NSTabView.m \
|
||||||
NSTabViewItem.m \
|
NSTabViewItem.m \
|
||||||
|
NSTableColumn.m \
|
||||||
|
NSTableHeaderView.m \
|
||||||
|
NSTableHeaderCell.m \
|
||||||
|
NSTableView.m \
|
||||||
NSText.m \
|
NSText.m \
|
||||||
NSTextContainer.m \
|
NSTextContainer.m \
|
||||||
NSTextField.m \
|
NSTextField.m \
|
||||||
|
@ -212,6 +216,10 @@ AppKit/NSSplitView.h \
|
||||||
AppKit/NSStringDrawing.h \
|
AppKit/NSStringDrawing.h \
|
||||||
AppKit/NSTabView.h \
|
AppKit/NSTabView.h \
|
||||||
AppKit/NSTabViewItem.h \
|
AppKit/NSTabViewItem.h \
|
||||||
|
AppKit/NSTableColumn.m \
|
||||||
|
AppKit/NSTableHeaderView.m \
|
||||||
|
AppKit/NSTableHeaderCell.m \
|
||||||
|
AppKit/NSTableView.m \
|
||||||
AppKit/NSText.h \
|
AppKit/NSText.h \
|
||||||
AppKit/NSTextAttachment.h \
|
AppKit/NSTextAttachment.h \
|
||||||
AppKit/NSTextContainer.h \
|
AppKit/NSTextContainer.h \
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <AppKit/NSTableColumn.h>
|
||||||
|
|
||||||
@implementation NSTableColumn
|
@implementation NSTableColumn
|
||||||
- (id)initWithIdentifier:(id)anObject
|
- (id)initWithIdentifier:(id)anObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#include <AppKit/NSTableHeaderCell.h>
|
||||||
|
#include <AppKit/NSColor.h>
|
||||||
|
|
||||||
@implementation NSTableHeaderCell
|
@implementation NSTableHeaderCell
|
||||||
- (void)drawInteriorWithFrame:(NSRect)cellFrame
|
- (void)drawInteriorWithFrame:(NSRect)cellFrame
|
||||||
inView:(NSView *)controlView
|
inView:(NSView *)controlView
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <AppKit/NSTableHeaderView.h>
|
||||||
|
|
||||||
@implementation NSTableHeaderView
|
@implementation NSTableHeaderView
|
||||||
- (void)setTableView:(NSTableView *)aTableView
|
- (void)setTableView:(NSTableView *)aTableView
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
#include <AppKit/NSCell.h>
|
||||||
|
#include <AppKit/NSColor.h>
|
||||||
|
#include <AppKit/NSClipView.h>
|
||||||
#include <AppKit/NSTableView.h>
|
#include <AppKit/NSTableView.h>
|
||||||
|
#include <AppKit/NSTableColumn.h>
|
||||||
|
#include <AppKit/NSText.h>
|
||||||
|
|
||||||
@implementation NSTableView
|
@implementation NSTableView
|
||||||
- (id)initWithFrame:(NSRect)frameRect
|
- (id)initWithFrame:(NSRect)frameRect
|
||||||
|
@ -138,7 +143,7 @@
|
||||||
|
|
||||||
- (NSColor *)backgroundColor
|
- (NSColor *)backgroundColor
|
||||||
{
|
{
|
||||||
return aColor;
|
return tbv_backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)addTableColumn:(NSTableColumn *)aColumn
|
- (void)addTableColumn:(NSTableColumn *)aColumn
|
||||||
|
@ -168,6 +173,7 @@
|
||||||
- (int)columnWithIdentifier:(id)anObject
|
- (int)columnWithIdentifier:(id)anObject
|
||||||
{
|
{
|
||||||
int howMany = [tbv_columns count];
|
int howMany = [tbv_columns count];
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i=0;i<howMany;i++)
|
for (i=0;i<howMany;i++)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +218,7 @@
|
||||||
[tbv_selectedColumns addObject:[NSNumber numberWithInt:columnIndex]];
|
[tbv_selectedColumns addObject:[NSNumber numberWithInt:columnIndex]];
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSTableViewSelectionDidChangeNotification
|
postNotificationName: NSTableViewSelectionDidChangeNotification
|
||||||
object: self];
|
object: (id)self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +241,7 @@
|
||||||
[tbv_selectedRows addObject:[NSNumber numberWithInt:rowIndex]];
|
[tbv_selectedRows addObject:[NSNumber numberWithInt:rowIndex]];
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSTableViewSelectionDidChangeNotification
|
postNotificationName: NSTableViewSelectionDidChangeNotification
|
||||||
object: self];
|
object: (id)self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +250,7 @@
|
||||||
[tbv_selectedColumns removeObject:[NSNumber numberWithInt:columnIndex]];
|
[tbv_selectedColumns removeObject:[NSNumber numberWithInt:columnIndex]];
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSTableViewSelectionDidChangeNotification
|
postNotificationName: NSTableViewSelectionDidChangeNotification
|
||||||
object: self];
|
object: (id)self];
|
||||||
|
|
||||||
/* If the indicated column was the last column selected by the user, the
|
/* If the indicated column was the last column selected by the user, the
|
||||||
column nearest it effectively becomes the last selected column. In case of
|
column nearest it effectively becomes the last selected column. In case of
|
||||||
|
@ -257,7 +263,7 @@ a tie, priority is given to the column on the left. */
|
||||||
[tbv_selectedRows removeObject:[NSNumber numberWithInt:rowIndex]];
|
[tbv_selectedRows removeObject:[NSNumber numberWithInt:rowIndex]];
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSTableViewSelectionDidChangeNotification
|
postNotificationName: NSTableViewSelectionDidChangeNotification
|
||||||
object: self];
|
object: (id)self];
|
||||||
|
|
||||||
/* If the indicated row was the last row selected by the user, the row
|
/* If the indicated row was the last row selected by the user, the row
|
||||||
nearest it effectively becomes the last selected row. In case of a tie,
|
nearest it effectively becomes the last selected row. In case of a tie,
|
||||||
|
@ -310,7 +316,7 @@ priority is given to the row above. */
|
||||||
|
|
||||||
- (NSEnumerator *)selectedRowEnumerator
|
- (NSEnumerator *)selectedRowEnumerator
|
||||||
{
|
{
|
||||||
return [tbv_selecedRows objectEnumerator];
|
return [tbv_selectedRows objectEnumerator];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)selectAll:(id)sender
|
- (void)selectAll:(id)sender
|
||||||
|
@ -425,23 +431,25 @@ object with the NSTableView as the text delegate. */
|
||||||
|
|
||||||
//FIXME! 100 is a place keeper.
|
//FIXME! 100 is a place keeper.
|
||||||
|
|
||||||
return NSMakeRect(0,(rowIndex - 1) * tabColRows, [self frame].width,
|
return NSMakeRect(0,(rowIndex - 1) * tabColRows, [self frame].size.width,
|
||||||
tbv_rowHeight);
|
tbv_rowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSRange)columnsInRect:(NSRect)aRect
|
- (NSRange)columnsInRect:(NSRect)aRect
|
||||||
{
|
{
|
||||||
int howMany = [self numberOfColumns];
|
int howMany = [self numberOfColumns];
|
||||||
int location;
|
int location = 0;
|
||||||
int length;
|
int length = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (aRect.size.width > 0 && aRect.size.height > 0)
|
if (aRect.size.width > 0 && aRect.size.height > 0)
|
||||||
{
|
{
|
||||||
for (i=0;i<howMany;i++)
|
for (i=0;i<howMany;i++)
|
||||||
{
|
{
|
||||||
NSRect tabRect = [self rectOfColumn:i];
|
NSRect tabRect = [self rectOfColumn:i];
|
||||||
|
NSRect bRect = NSIntersectionRect(tabRect, aRect);
|
||||||
|
|
||||||
if (NSIntersectionRect(tabRect, aRect)
|
if (bRect.size.width > 0 && bRect.size.height > 0)
|
||||||
{
|
{
|
||||||
if (!location)
|
if (!location)
|
||||||
location = i;
|
location = i;
|
||||||
|
@ -455,22 +463,25 @@ object with the NSTableView as the text delegate. */
|
||||||
|
|
||||||
return NSMakeRange(location, length);
|
return NSMakeRange(location, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NSMakeRange(0, 0);
|
return NSMakeRange(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSRange)rowsInRect:(NSRect)aRect
|
- (NSRange)rowsInRect:(NSRect)aRect
|
||||||
{
|
{
|
||||||
int howMany = [self numberOfRows];
|
int howMany = [self numberOfRows];
|
||||||
int location;
|
int location = 0;
|
||||||
int length;
|
int length = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (aRect.size.width > 0 && aRect.size.height > 0)
|
if (aRect.size.width > 0 && aRect.size.height > 0)
|
||||||
{
|
{
|
||||||
for (i=0;i<howMany;i++)
|
for (i=0;i<howMany;i++)
|
||||||
{
|
{
|
||||||
NSRect tabRect = [self rectOfRow:i];
|
NSRect tabRect = [self rectOfRow:i];
|
||||||
|
NSRect bRect = NSIntersectionRect(tabRect, aRect);
|
||||||
|
|
||||||
if (NSIntersectionRect(tabRect, aRect)
|
if (bRect.size.width > 0 && bRect.size.height > 0)
|
||||||
{
|
{
|
||||||
if (!location)
|
if (!location)
|
||||||
location = i;
|
location = i;
|
||||||
|
@ -490,10 +501,11 @@ object with the NSTableView as the text delegate. */
|
||||||
- (int)columnAtPoint:(NSPoint)aPoint
|
- (int)columnAtPoint:(NSPoint)aPoint
|
||||||
{
|
{
|
||||||
int howMany = [tbv_columns count];
|
int howMany = [tbv_columns count];
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i=0;i<howMany;i++)
|
for (i=0;i<howMany;i++)
|
||||||
{
|
{
|
||||||
if (NSPointInRect([self rectOfColumn:i])
|
if (NSPointInRect(aPoint, [self rectOfColumn:i]))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,12 +516,11 @@ object with the NSTableView as the text delegate. */
|
||||||
- (int)rowAtPoint:(NSPoint)aPoint
|
- (int)rowAtPoint:(NSPoint)aPoint
|
||||||
{
|
{
|
||||||
int howMany = [self numberOfRows];
|
int howMany = [self numberOfRows];
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i=0;i<howMany;i++)
|
for (i=0;i<howMany;i++)
|
||||||
{
|
{
|
||||||
NSRect tabRect = [self rectOfRow:i];
|
if (NSPointInRect(aPoint, [self rectOfRow:i]))
|
||||||
|
|
||||||
if (NSPointInRect(aPoint, tabRect))
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,11 +569,12 @@ object with the NSTableView as the text delegate. */
|
||||||
clipRect:(NSRect)clipRect
|
clipRect:(NSRect)clipRect
|
||||||
{
|
{
|
||||||
NSRange colsToDraw = [self columnsInRect:clipRect];
|
NSRange colsToDraw = [self columnsInRect:clipRect];
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i=0;i<colsToDraw.length;i++)
|
for (i=0;i<colsToDraw.length;i++)
|
||||||
{
|
{
|
||||||
NSCell *aCell = [[tbv_columns objectAtIndex:i] dataCell];
|
NSCell *aCell = [[tbv_columns objectAtIndex:i] dataCell];
|
||||||
NSRect *colRect = [self rectOfColumn:i];
|
NSRect colRect = [self rectOfColumn:i];
|
||||||
|
|
||||||
colRect.size.height = tbv_rowHeight;
|
colRect.size.height = tbv_rowHeight;
|
||||||
colRect.origin.y = rowIndex * tbv_rowHeight;
|
colRect.origin.y = rowIndex * tbv_rowHeight;
|
||||||
|
@ -570,11 +582,11 @@ object with the NSTableView as the text delegate. */
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
colRect.origin.y += tbv_interCellSpacing.height;
|
colRect.origin.y += tbv_interCellSpacing.height;
|
||||||
|
|
||||||
[delegate tableView:self willDisplayCell:aCell forTableColumn:i
|
[delegate tableView:self willDisplayCell:aCell forTableColumn:[tbv_columns objectAtIndex:i]
|
||||||
row:rowIndex];
|
row:rowIndex];
|
||||||
|
|
||||||
[aCell setStringValue:[tbv_dataSource tableView: self
|
[aCell setStringValue:[tb_datasource tableView: self
|
||||||
objectValueForTableColumn: i
|
objectValueForTableColumn: [tbv_columns objectAtIndex:i]
|
||||||
row: rowIndex]];
|
row: rowIndex]];
|
||||||
|
|
||||||
[aCell drawWithFrame: colRect];
|
[aCell drawWithFrame: colRect];
|
||||||
|
@ -593,12 +605,12 @@ object with the NSTableView as the text delegate. */
|
||||||
|
|
||||||
- (void)scrollRowToVisible:(int)rowIndex
|
- (void)scrollRowToVisible:(int)rowIndex
|
||||||
{
|
{
|
||||||
[[self superview] scrollToPoint:NSZeroPoint];
|
[(NSClipView *)[self superview] scrollToPoint:NSZeroPoint];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)scrollColumnToVisible:(int)columnIndex
|
- (void)scrollColumnToVisible:(int)columnIndex
|
||||||
{
|
{
|
||||||
[[self superview] scrollToPoint:NSZeroPoint];
|
[(NSClipView *)[self superview] scrollToPoint:NSZeroPoint];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)textShouldBeginEditing:(NSText *)textObject
|
- (BOOL)textShouldBeginEditing:(NSText *)textObject
|
||||||
|
@ -622,19 +634,22 @@ object:self
|
||||||
|
|
||||||
- (void)textDidChange:(NSNotification *)aNotification
|
- (void)textDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
NSControlTextDidChangeNotification
|
NSControlTextDidChangeNotification
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)textShouldEndEditing:(NSText *)textObject
|
- (BOOL)textShouldEndEditing:(NSText *)textObject
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector: @selector (control:textShouldEndEditing:)])
|
if ([delegate respondsToSelector: @selector (control:textShouldEndEditing:)])
|
||||||
{
|
{
|
||||||
return [delegate control: self control:textShouldEndEditing:
|
return [delegate control: self textShouldEndEditing: textObject];
|
||||||
textObject];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (is new cell valid)
|
if (is new cell valid)
|
||||||
return YES;
|
return YES;
|
||||||
|
*/
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@ -650,8 +665,10 @@ information on this text delegate method. */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawRect:(NSRect)rect
|
- (void)ydrawRect:(NSRect)rect
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i=0; i<[self numberOfRows]; i++)
|
for (i=0; i<[self numberOfRows]; i++)
|
||||||
{
|
{
|
||||||
// FIXME this isn't really the clipRect now is it.
|
// FIXME this isn't really the clipRect now is it.
|
||||||
|
@ -659,3 +676,4 @@ information on this text delegate method. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue