More implementation of NSGridView

This commit is contained in:
Gregory John Casamento 2020-08-23 00:57:29 -04:00
parent 31432274a6
commit dbd46a5839
3 changed files with 33 additions and 11 deletions

View file

@ -56,15 +56,18 @@ typedef NSInteger NSGridRowAlignment;
APPKIT_EXPORT const CGFloat NSGridViewSizeForContent;
@class NSGridColumn, NSGridRow, NSGridCell;
@class NSGridColumn, NSGridRow, NSGridCell, NSArray, NSMutableArray;
@interface NSGridView : NSView
{
NSMutableArray *_rows;
}
- (instancetype) initWithFrame: (NSRect)frameRect;
- (instancetype) initWithCoder: (NSCoder *)coder;
+ (instancetype) gridViewWithNumberOfColumns: (NSInteger)columnCount rows: (NSInteger)rowCount;
+ (instancetype) gridViewWithViews: (NSArray *)rows; // an array containing an array of NSViews
+ (instancetype) gridViewWithViews: (NSArray *)rows; // an NSArray containing an NSArray of NSViews
- (NSInteger) numberOfRows;
- (NSInteger) numberOfColumns;

View file

@ -13,11 +13,9 @@ MISSING HEADERS ( * = difficult, - = quick, + = placeholder )
> NSFilePromiseProvider.h -
> NSFilePromiseReceiver.h -
> NSGlyphInfo.h
> NSGridView.h *
> NSItemProvider.h +
> NSMenuToolbarItem.h -
> NSOpenGLLayer.h
> NSStackView.h *
> NSTableCellView.h *
> NSTableRowView.h *
> NSTableViewRowAction.h *

View file

@ -28,27 +28,48 @@
- (instancetype) initWithFrame: (NSRect)frameRect
{
return nil;
self = [super initWithFrame: frameRect];
if (self != nil)
{
_rows = [[NSMutableArray alloc] initWithCapacity: 10];
}
return self;
}
+ (instancetype) gridViewWithNumberOfColumns: (NSInteger)columnCount rows: (NSInteger)rowCount
{
return nil;
NSUInteger r = 0;
NSUInteger c = 0;
NSMutableArray *rows = [[NSMutableArray alloc] initWithCapacity: rowCount];
for (r = 0; r < rowCount; r++)
{
NSMutableArray *col = [NSMutableArray arrayWithCapacity: columnCount];
for (c = 0; c < columnCount; c++)
{
NSGridCell *gc = [[NSGridCell alloc] init];
[col addObject: gc];
RELEASE(gc);
}
[rows addObject: col];
}
return AUTORELEASE([self gridViewWithViews: rows]);
}
+ (instancetype) gridViewWithViews: (NSArray *)rows
{
return nil;
return nil; // ASSIGNCOPY(_rows, rows);
}
- (NSInteger) numberOfRows
{
return 0;
return [_rows count];
}
- (NSInteger) numberOfColumns
{
return 0;
return [[_rows objectAtIndex: 0] count];
}
- (NSGridRow *) rowAtIndex: (NSInteger)index
@ -195,7 +216,7 @@
+ (NSView *) emptyContentView
{
return nil;
return AUTORELEASE([[NSView alloc] initWithFrame: NSZeroRect]);
}
// Weak references to row/column