Communicate setting of width to the table view; tidied

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6308 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 2000-03-18 00:27:49 +00:00
parent 546ed77cd9
commit f686e3b5a8

View file

@ -70,20 +70,19 @@
_headerCell = [NSTableHeaderCell new]; _headerCell = [NSTableHeaderCell new];
_dataCell = [NSTextFieldCell new]; _dataCell = [NSTextFieldCell new];
// TODO: When things start to work with the other NSTable* classes,
// set here default properties for the default cells to have them
// display with the default table appearance.
ASSIGN (_identifier, anObject); ASSIGN (_identifier, anObject);
return self; return self;
} }
- (void)dealloc - (void)dealloc
{ {
[_headerCell release]; RELEASE (_headerCell);
[_dataCell release]; RELEASE (_dataCell);
TEST_RELEASE (_identifier); TEST_RELEASE (_identifier);
[super dealloc]; [super dealloc];
} }
/* /*
* Managing the Identifier * Managing the Identifier
*/ */
@ -91,6 +90,7 @@
{ {
ASSIGN (_identifier, anObject); ASSIGN (_identifier, anObject);
} }
- (id)identifier - (id)identifier
{ {
return _identifier; return _identifier;
@ -104,10 +104,12 @@
// On the contrary, aTableView is supposed to RETAIN us. // On the contrary, aTableView is supposed to RETAIN us.
_tableView = aTableView; _tableView = aTableView;
} }
- (NSTableView *)tableView - (NSTableView *)tableView
{ {
return _tableView; return _tableView;
} }
/* /*
* Controlling size * Controlling size
*/ */
@ -125,45 +127,54 @@
if (_tableView) if (_tableView)
{ {
[_tableView setNeedsDisplay: YES]; // Tiling also marks it as needing redisplay
[_tableView tile];
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
postNotificationName: NSTableViewColumnDidResizeNotification postNotificationName: NSTableViewColumnDidResizeNotification
object: _tableView]; object: _tableView];
} }
} }
- (float)width - (float)width
{ {
return _width; return _width;
} }
- (void)setMinWidth: (float)minWidth - (void)setMinWidth: (float)minWidth
{ {
_min_width = minWidth; _min_width = minWidth;
if (_width < _min_width) if (_width < _min_width)
[self setWidth: _min_width]; [self setWidth: _min_width];
} }
- (float)minWidth - (float)minWidth
{ {
return _min_width; return _min_width;
} }
- (void)setMaxWidth: (float)maxWidth - (void)setMaxWidth: (float)maxWidth
{ {
_max_width = maxWidth; _max_width = maxWidth;
if (_width > _max_width) if (_width > _max_width)
[self setWidth: _max_width]; [self setWidth: _max_width];
} }
- (float)maxWidth - (float)maxWidth
{ {
return _max_width; return _max_width;
} }
- (void)setResizable: (BOOL)flag - (void)setResizable: (BOOL)flag
{ {
_is_resizable = flag; _is_resizable = flag;
} }
- (BOOL)isResizable - (BOOL)isResizable
{ {
return _is_resizable; return _is_resizable;
} }
- (void)sizeToFit - (void)sizeToFit
{ {
float new_width; float new_width;
@ -179,6 +190,7 @@
// For easier subclassing we dont do it directly // For easier subclassing we dont do it directly
[self setWidth: new_width]; [self setWidth: new_width];
} }
/* /*
* Controlling editability * Controlling editability
*/ */
@ -186,10 +198,12 @@
{ {
_is_editable = flag; _is_editable = flag;
} }
- (BOOL)isEditable - (BOOL)isEditable
{ {
return _is_editable; return _is_editable;
} }
/* /*
* Setting component cells * Setting component cells
*/ */
@ -202,10 +216,12 @@
} }
ASSIGN (_headerCell, aCell); ASSIGN (_headerCell, aCell);
} }
- (NSCell*)headerCell - (NSCell*)headerCell
{ {
return _headerCell; return _headerCell;
} }
- (void)setDataCell: (NSCell*)aCell - (void)setDataCell: (NSCell*)aCell
{ {
if (aCell == nil) if (aCell == nil)
@ -215,6 +231,7 @@
} }
ASSIGN (_dataCell, aCell); ASSIGN (_dataCell, aCell);
} }
- (NSCell*)dataCell - (NSCell*)dataCell
{ {
return _dataCell; return _dataCell;