mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 10:51:06 +00:00
140 lines
2 KiB
Mathematica
140 lines
2 KiB
Mathematica
|
@implementation NSTableColumn
|
||
|
- (id)initWithIdentifier:(id)anObject
|
||
|
{
|
||
|
[super init];
|
||
|
|
||
|
tbcol_cell = [NSTableHeaderCell new];
|
||
|
|
||
|
if ([anObject isKindOfClass:[NSString class]])
|
||
|
[tbcol_cell setStringValue:anObject];
|
||
|
else
|
||
|
[tbcol_cell setImage:anObject];
|
||
|
|
||
|
ASSIGN(tbcol_identifier, anObject);
|
||
|
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)setIdentifier:(id)anObject
|
||
|
{
|
||
|
ASSIGN(tbcol_identifier, anObject);
|
||
|
}
|
||
|
|
||
|
- (id)identifier
|
||
|
{
|
||
|
return tbcol_identifier;
|
||
|
}
|
||
|
|
||
|
- (void)setTableView:(NSTableView *)aTableView
|
||
|
{
|
||
|
ASSIGN(tbcol_tableview, aTableView);
|
||
|
}
|
||
|
|
||
|
- (NSTableView *)tableView
|
||
|
{
|
||
|
return tbcol_tableview;
|
||
|
}
|
||
|
|
||
|
// Sizing.
|
||
|
|
||
|
- (void)setWidth:(float)newWidth
|
||
|
{
|
||
|
if (newWidth > tbcol_maxWidth)
|
||
|
tbcol_width = tbcol_maxWidth;
|
||
|
else if (newWidth < tbcol_minWidth)
|
||
|
tbcol_width = tbcol_minWidth;
|
||
|
else
|
||
|
tbcol_width = newWidth;
|
||
|
}
|
||
|
|
||
|
- (float)width
|
||
|
{
|
||
|
return tbcol_width;
|
||
|
}
|
||
|
|
||
|
- (void)setMinWidth:(float)minWidth
|
||
|
{
|
||
|
tbcol_minWidth = minWidth;
|
||
|
}
|
||
|
|
||
|
- (float)minWidth
|
||
|
{
|
||
|
return tbcol_minWidth;
|
||
|
}
|
||
|
|
||
|
- (void)setMaxWidth:(float)maxWidth
|
||
|
{
|
||
|
tbcol_maxWidth = maxWidth;
|
||
|
}
|
||
|
|
||
|
- (float)maxWidth
|
||
|
{
|
||
|
return maxWidth;
|
||
|
}
|
||
|
|
||
|
- (void)setResizable:(BOOL)flag
|
||
|
{
|
||
|
tbcol_resizable = flag;
|
||
|
}
|
||
|
|
||
|
- (BOOL)isResizable
|
||
|
{
|
||
|
return tbcol_resizable;
|
||
|
}
|
||
|
|
||
|
- (void)sizeToFit
|
||
|
{
|
||
|
NSSize cell_size = [tbcol_cell cellSize];
|
||
|
BOOL changed = NO;
|
||
|
|
||
|
if (tbcol_width != cell_size.width)
|
||
|
{
|
||
|
tbcol_width = cell_size.width;
|
||
|
changed = YES;
|
||
|
}
|
||
|
|
||
|
if (cellSize.width > tbcol_maxWidth)
|
||
|
tbcol_maxWidth = cellSize.width;
|
||
|
|
||
|
if (cellSize.width < tbcol_minWidth)
|
||
|
tbcol_minWidth = cellSize.width;
|
||
|
|
||
|
if (changed)
|
||
|
[tbcol_tableview setNeedsDisplay:YES];
|
||
|
}
|
||
|
|
||
|
- (void)setEditable:(BOOL)flag
|
||
|
{
|
||
|
tbcol_editable = flag;
|
||
|
}
|
||
|
|
||
|
- (BOOL)isEditable
|
||
|
{
|
||
|
return tbcol_editable;
|
||
|
}
|
||
|
|
||
|
// This cell is the cell used to draw the header.
|
||
|
|
||
|
- (void)setHeaderCell:(NSCell *)aCell
|
||
|
{
|
||
|
ASSIGN(tbcol_cell, aCell);
|
||
|
}
|
||
|
|
||
|
- (id)headerCell
|
||
|
{
|
||
|
return tbcol_cell;
|
||
|
}
|
||
|
|
||
|
// This cell is used to draw the items in this column.
|
||
|
|
||
|
- (void)setDataCell:(NSCell *)aCell
|
||
|
{
|
||
|
ASSIGN(tbcol_datacell, aCell);
|
||
|
}
|
||
|
|
||
|
- (id)dataCell
|
||
|
{
|
||
|
return tbcol_datacell;
|
||
|
}
|
||
|
@end
|