Fixed up attributes of Table on Mac OS X.

This commit is contained in:
Pietro Gagliardi 2014-07-30 13:10:19 -04:00
parent d21bd30583
commit 3d922c87fa
3 changed files with 14 additions and 4 deletions

View File

@ -10,6 +10,8 @@
#define toNSButton(x) ((NSButton *) (x))
#define toNSTextField(x) ((NSTextField *) (x))
// TODO move to control_darwin.m
void parent(id control, id parentid)
{
[toNSView(parentid) addSubview:toNSView(control)];
@ -20,11 +22,18 @@ void controlSetHidden(id control, BOOL hidden)
[toNSView(control) setHidden:hidden];
}
// also fine for NSCells
void setStandardControlFont(id control)
{
[toNSControl(control) setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
}
// also fine for NSCells
void setSmallControlFont(id control)
{
[toNSControl(control) setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
}
@interface goControlDelegate : NSObject {
@public
void *gocontrol;

View File

@ -35,6 +35,7 @@ extern void windowRedraw(id);
extern void parent(id, id);
extern void controlSetHidden(id, BOOL);
extern void setStandardControlFont(id);
extern void setSmallControlFont(id);
extern id newButton(void);
extern void buttonSetDelegate(id, void *);
extern const char *buttonText(id);

View File

@ -45,12 +45,10 @@ id newTable(void)
[t setAllowsMultipleSelection:NO];
[t setAllowsEmptySelection:YES];
[t setAllowsColumnSelection:NO];
// TODO check against interface builder
return (id) t;
}
// TODO scroll view
// TODO other types
void tableAppendColumn(id t, char *name)
{
NSTableColumn *c;
@ -58,7 +56,9 @@ void tableAppendColumn(id t, char *name)
c = [[NSTableColumn alloc] initWithIdentifier:nil];
[c setEditable:NO];
[[c headerCell] setStringValue:[NSString stringWithUTF8String:name]];
// TODO other options
setSmallControlFont((id) [c headerCell]);
setStandardControlFont((id) [c dataCell]);
// TODO text layout options
[toNSTableView(t) addTableColumn:c];
}