And added button columns. Now to start writing the rest of the uiTable glue.

This commit is contained in:
Pietro Gagliardi 2018-06-03 19:21:01 -04:00
parent b74b987fff
commit 8ee5c61fe8
1 changed files with 66 additions and 1 deletions

View File

@ -253,7 +253,7 @@ struct textColumnCreateParams {
data = (*(self->m->mh->CellValue))(self->m->mh, self->m, row, self->textParams.ColorModelColumn);
uiTableDataColor(data, &r, &g, &b, &a);
uiFreeTableData(data);
xx TODO
// TODO
}
if (color == nil)
color = [NSColor controlTextColor];
@ -374,6 +374,71 @@ struct textColumnCreateParams {
@end
@interface uiprivButtonColumnCellView : uiprivColumnCellView {
uiTable *t;
uiTableModel *m;
NSButton *b;
int modelColumn;
int editableColumn;
}
- (id)initWithFrame:(NSRect)r table:(uiTable *)table model:(uiTableModel *)model modelColumn:(int)mc editableColumn:(int)ec;
- (IBAction)uiprivOnClicked:(id)sender;
@end
@implementation uiprivProgressBarColumnCellView
- (id)initWithFrame:(NSRect)r table:(uiTable *)table model:(uiTableModel *)model modelColumn:(int)mc editableColumn:(int)ec
{
self = [super initWithFrame:r];
if (self) {
self->t = table;
self->m = model;
self->modelColumn = mc;
self->editableColumn = ec;
self->b = [[NSButton alloc] initWithFrame:NSZeroRect];
[self->b setButtonType:NSMomentaryPushInButton];
[self->b setBordered:YES];
[self->b setBezelStyle:NSRoundRectBezelStyle];
uiDarwinSetControlFont(self->b, NSRegularControlSize);
[self->b setTarget:self];
[self->b setAction:@selector(uiprivOnClicked:)];
layoutCellSubview(self, self->b,
self, progressBarColumnLeading,
self, progressBarColumnTrailing,
YES);
}
return self;
}
- (void)dealloc
{
[self->p release];
self->p = nil;
[super dealloc];
}
- (void)uiprivUpdate:(NSInteger)row
{
uiTableData *data;
NSString *str;
BOOL editable;
data = (*(self->m->mh->CellValue))(self->m->mh, self->m, row, self->modelColumn);
str = uiprivToNSString(uiTableDataString(data));
uiFreeTableData(data);
[self->b setTitle:str];
[self->b setEditable:isCellEditable(self->m, row, self->editableColumn)];
}
- (id)uiprivOnClicked:(id)sender
{
// TODO
}
@end
void uiTableAppendTextColumn(uiTable *t,
const char *name,
int textModelColumn,