Add prototype cell view support, remove code that forces prototypeCellView to be NSView

This commit is contained in:
Gregory John Casamento 2024-02-11 09:19:40 -05:00
parent b06b23c97c
commit e4c7bb540c
4 changed files with 26 additions and 11 deletions

View file

@ -37,6 +37,7 @@
@class NSSortDescriptor;
@class NSCell;
@class NSTableView;
@class NSMutableArray;
// TODO: Finish to implement hidden, header tool tip and resizing mask
// and update the archiving code to support them.
@ -72,6 +73,7 @@ APPKIT_EXPORT_CLASS
NSCell *_dataCell;
NSString *_headerToolTip;
NSSortDescriptor *_sortDescriptorPrototype;
NSMutableArray *_prototypeCellViews;
}
/*
* Initializing an NSTableColumn instance

View file

@ -3539,18 +3539,19 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
view = [delegate tableView: tableView
viewForTableColumn: tb
row: rowIndex];
NSDebugLog(@"View = %@", view);
drawingRect = [tableView frameOfCellAtColumn: i
row: rowIndex];
[view setFrame: drawingRect];
[tableView addSubview: view];
}
/*
else
{
view = AUTORELEASE([[NSTableCellView alloc] init]);
}
NSDebugLog(@"View = %@", view);
drawingRect = [tableView frameOfCellAtColumn: i
row: rowIndex];
[view setFrame: drawingRect];
[tableView addSubview: view];
*/
}
}

View file

@ -221,7 +221,6 @@ static NSArray *XmlBoolDefaultYes = nil;
@"IBActionConnection", @"action",
@"NSNibBindingConnector", @"binding",
@"NSWindowTemplate", @"window",
@"NSView", @"tableCellView",
@"IBUserDefinedRuntimeAttribute5", @"userDefinedRuntimeAttribute",
@"NSURL", @"url",
@"NSLayoutConstraint", @"constraint",

View file

@ -89,7 +89,7 @@
{
if (self == [NSTableColumn class])
{
[self setVersion: 3];
[self setVersion: 4];
[self exposeBinding: NSValueBinding];
[self exposeBinding: NSEnabledBinding];
}
@ -127,8 +127,9 @@
_headerToolTip = nil;
_sortDescriptorPrototype = nil;
ASSIGN (_identifier, anObject);
_prototypeCellViews = nil;
ASSIGN (_identifier, anObject);
return self;
}
@ -141,6 +142,7 @@
RELEASE(_headerToolTip);
RELEASE(_dataCell);
RELEASE(_sortDescriptorPrototype);
RELEASE(_prototypeCellViews);
TEST_RELEASE(_identifier);
[super dealloc];
}
@ -491,6 +493,7 @@ to YES. */
[aCoder encodeObject: _headerToolTip forKey: @"NSHeaderToolTip"];
[aCoder encodeBool: _is_hidden forKey: @"NSHidden"];
[aCoder encodeObject: _tableView forKey: @"NSTableView"];
[aCoder encodeObject: _prototypeCellViews forKey: @"NSPrototypeCellViews"];
}
else
{
@ -506,6 +509,7 @@ to YES. */
[aCoder encodeObject: _dataCell];
[aCoder encodeObject: _sortDescriptorPrototype];
[aCoder encodeObject: _prototypeCellViews];
}
}
@ -572,6 +576,10 @@ to YES. */
{
[self setTableView: [aDecoder decodeObjectForKey: @"NSTableView"]];
}
if ([aDecoder containsValueForKey: @"NSPrototypeCellViews"])
{
ASSIGN(_prototypeCellViews, [aDecoder decodeObjectForKey: @"NSPrototypeCellViews"]);
}
}
else
{
@ -597,6 +605,11 @@ to YES. */
{
_sortDescriptorPrototype = RETAIN([aDecoder decodeObject]);
}
if (version >= 4)
{
_prototypeCellViews = RETAIN([aDecoder decodeObject]);
}
}
else
{