Fixed table.m to line up with the changes on master that have since been merged in.
This commit is contained in:
parent
3b5ef559f5
commit
5ac579df35
|
@ -63,7 +63,7 @@ struct uiTable {
|
||||||
uiDarwinControl c;
|
uiDarwinControl c;
|
||||||
NSScrollView *sv;
|
NSScrollView *sv;
|
||||||
tableView *tv;
|
tableView *tv;
|
||||||
struct scrollViewData *d;
|
uiprivScrollViewData *d;
|
||||||
int backgroundColumn;
|
int backgroundColumn;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ struct uiTable {
|
||||||
[v addSubview:view];
|
[v addSubview:view];
|
||||||
// TODO set [v imageView] and [v textField] as appropriate?
|
// TODO set [v imageView] and [v textField] as appropriate?
|
||||||
if (prev == nil) { // first view
|
if (prev == nil) { // first view
|
||||||
[v addConstraint:mkConstraint(v, NSLayoutAttributeLeading,
|
[v addConstraint:uiprivMkConstraint(v, NSLayoutAttributeLeading,
|
||||||
NSLayoutRelationEqual,
|
NSLayoutRelationEqual,
|
||||||
view, NSLayoutAttributeLeading,
|
view, NSLayoutAttributeLeading,
|
||||||
1, -xleft,
|
1, -xleft,
|
||||||
|
@ -119,14 +119,14 @@ struct uiTable {
|
||||||
prev = view;
|
prev = view;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
[v addConstraint:mkConstraint(prev, NSLayoutAttributeTrailing,
|
[v addConstraint:uiprivMkConstraint(prev, NSLayoutAttributeTrailing,
|
||||||
NSLayoutRelationEqual,
|
NSLayoutRelationEqual,
|
||||||
view, NSLayoutAttributeLeading,
|
view, NSLayoutAttributeLeading,
|
||||||
1, -xmiddle,
|
1, -xmiddle,
|
||||||
@"uiTableColumn middle horizontal constraint")];
|
@"uiTableColumn middle horizontal constraint")];
|
||||||
prev = view;
|
prev = view;
|
||||||
}
|
}
|
||||||
[v addConstraint:mkConstraint(prev, NSLayoutAttributeTrailing,
|
[v addConstraint:uiprivMkConstraint(prev, NSLayoutAttributeTrailing,
|
||||||
NSLayoutRelationEqual,
|
NSLayoutRelationEqual,
|
||||||
v, NSLayoutAttributeTrailing,
|
v, NSLayoutAttributeTrailing,
|
||||||
1, -xright,
|
1, -xright,
|
||||||
|
@ -134,14 +134,14 @@ struct uiTable {
|
||||||
|
|
||||||
// and vertically
|
// and vertically
|
||||||
for (view in views) {
|
for (view in views) {
|
||||||
[v addConstraint:mkConstraint(view, NSLayoutAttributeCenterY,
|
[v addConstraint:uiprivMkConstraint(view, NSLayoutAttributeCenterY,
|
||||||
NSLayoutRelationEqual,
|
NSLayoutRelationEqual,
|
||||||
v, NSLayoutAttributeCenterY,
|
v, NSLayoutAttributeCenterY,
|
||||||
1, 0,
|
1, 0,
|
||||||
@"uiTableColumn part vertical constraint")];
|
@"uiTableColumn part vertical constraint")];
|
||||||
// TODO avoid the need for this hack
|
// TODO avoid the need for this hack
|
||||||
if ([view isKindOfClass:[NSImageView class]])
|
if ([view isKindOfClass:[NSImageView class]])
|
||||||
[v addConstraint:mkConstraint(view, NSLayoutAttributeTop,
|
[v addConstraint:uiprivMkConstraint(view, NSLayoutAttributeTop,
|
||||||
NSLayoutRelationEqual,
|
NSLayoutRelationEqual,
|
||||||
v, NSLayoutAttributeTop,
|
v, NSLayoutAttributeTop,
|
||||||
1, 0,
|
1, 0,
|
||||||
|
@ -239,9 +239,9 @@ if(1); else
|
||||||
switch (self.type) {
|
switch (self.type) {
|
||||||
case partText:
|
case partText:
|
||||||
data = (*(m->mh->CellValue))(m->mh, m, row, self.textColumn);
|
data = (*(m->mh->CellValue))(m->mh, m, row, self.textColumn);
|
||||||
str = toNSString((char *) data);
|
str = uiprivToNSString((char *) data);
|
||||||
uiprivFree(data);
|
uiprivFree(data);
|
||||||
tf = newLabel(str);
|
tf = uiprivNewLabel(str);
|
||||||
// TODO set wrap and ellipsize modes?
|
// TODO set wrap and ellipsize modes?
|
||||||
if (self.textColorColumn != -1) {
|
if (self.textColorColumn != -1) {
|
||||||
NSColor *color;
|
NSColor *color;
|
||||||
|
@ -262,13 +262,13 @@ if(1); else
|
||||||
case partImage:
|
case partImage:
|
||||||
data = (*(m->mh->CellValue))(m->mh, m, row, self.imageColumn);
|
data = (*(m->mh->CellValue))(m->mh, m, row, self.imageColumn);
|
||||||
iv = [[NSImageView alloc] initWithFrame:NSZeroRect];
|
iv = [[NSImageView alloc] initWithFrame:NSZeroRect];
|
||||||
[iv setImage:imageImage((uiImage *) data)];
|
[iv setImage:uiprivImageNSImage((uiImage *) data)];
|
||||||
[iv setImageFrameStyle:NSImageFrameNone];
|
[iv setImageFrameStyle:NSImageFrameNone];
|
||||||
[iv setImageAlignment:NSImageAlignCenter];
|
[iv setImageAlignment:NSImageAlignCenter];
|
||||||
[iv setImageScaling:NSImageScaleProportionallyDown];
|
[iv setImageScaling:NSImageScaleProportionallyDown];
|
||||||
[iv setAnimates:NO];
|
[iv setAnimates:NO];
|
||||||
[iv setEditable:NO];
|
[iv setEditable:NO];
|
||||||
[iv addConstraint:mkConstraint(iv, NSLayoutAttributeWidth,
|
[iv addConstraint:uiprivMkConstraint(iv, NSLayoutAttributeWidth,
|
||||||
NSLayoutRelationEqual,
|
NSLayoutRelationEqual,
|
||||||
iv, NSLayoutAttributeHeight,
|
iv, NSLayoutAttributeHeight,
|
||||||
1, 0,
|
1, 0,
|
||||||
|
@ -279,7 +279,7 @@ if(1); else
|
||||||
case partButton:
|
case partButton:
|
||||||
// TODO buttons get clipped
|
// TODO buttons get clipped
|
||||||
data = (*(m->mh->CellValue))(m->mh, m, row, self.textColumn);
|
data = (*(m->mh->CellValue))(m->mh, m, row, self.textColumn);
|
||||||
str = toNSString((char *) data);
|
str = uiprivToNSString((char *) data);
|
||||||
b = [[NSButton alloc] initWithFrame:NSZeroRect];
|
b = [[NSButton alloc] initWithFrame:NSZeroRect];
|
||||||
[b setTitle:str];
|
[b setTitle:str];
|
||||||
[b setButtonType:NSMomentaryPushInButton];
|
[b setButtonType:NSMomentaryPushInButton];
|
||||||
|
@ -525,7 +525,7 @@ uiTableColumn *uiTableAppendColumn(uiTable *t, const char *name)
|
||||||
// via Interface Builder
|
// via Interface Builder
|
||||||
[c->c setResizingMask:(NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask)];
|
[c->c setResizingMask:(NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask)];
|
||||||
// 10.10 adds -[NSTableColumn setTitle:]; before then we have to do this
|
// 10.10 adds -[NSTableColumn setTitle:]; before then we have to do this
|
||||||
[[c->c headerCell] setStringValue:toNSString(name)];
|
[[c->c headerCell] setStringValue:uiprivToNSString(name)];
|
||||||
// TODO is this sufficient?
|
// TODO is this sufficient?
|
||||||
[[c->c headerCell] setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
[[c->c headerCell] setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
||||||
c->parts = [NSMutableArray new];
|
c->parts = [NSMutableArray new];
|
||||||
|
@ -541,7 +541,7 @@ void uiTableSetRowBackgroundColorModelColumn(uiTable *t, int modelColumn)
|
||||||
uiTable *uiNewTable(uiTableModel *model)
|
uiTable *uiNewTable(uiTableModel *model)
|
||||||
{
|
{
|
||||||
uiTable *t;
|
uiTable *t;
|
||||||
struct scrollViewCreateParams p;
|
uiprivScrollViewCreateParams p;
|
||||||
|
|
||||||
uiDarwinNewControl(uiTable, t);
|
uiDarwinNewControl(uiTable, t);
|
||||||
|
|
||||||
|
@ -565,7 +565,7 @@ uiTable *uiNewTable(uiTableModel *model)
|
||||||
[t->tv setAllowsTypeSelect:YES];
|
[t->tv setAllowsTypeSelect:YES];
|
||||||
// TODO floatsGroupRows — do we even allow group rows?
|
// TODO floatsGroupRows — do we even allow group rows?
|
||||||
|
|
||||||
memset(&p, 0, sizeof (struct scrollViewCreateParams));
|
memset(&p, 0, sizeof (uiprivScrollViewCreateParams));
|
||||||
p.DocumentView = t->tv;
|
p.DocumentView = t->tv;
|
||||||
// this is what Interface Builder sets it to
|
// this is what Interface Builder sets it to
|
||||||
// TODO verify
|
// TODO verify
|
||||||
|
@ -574,7 +574,7 @@ uiTable *uiNewTable(uiTableModel *model)
|
||||||
p.Bordered = YES;
|
p.Bordered = YES;
|
||||||
p.HScroll = YES;
|
p.HScroll = YES;
|
||||||
p.VScroll = YES;
|
p.VScroll = YES;
|
||||||
t->sv = mkScrollView(&p, &(t->d));
|
t->sv = uiprivMkScrollView(&p, &(t->d));
|
||||||
|
|
||||||
t->backgroundColumn = -1;
|
t->backgroundColumn = -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue