Verified Mac OS X control appearance and fonts with Interface Builder.

This commit is contained in:
Pietro Gagliardi 2014-07-26 10:05:18 -04:00
parent e8df54cb82
commit 2c810e7165
3 changed files with 9 additions and 8 deletions

View File

@ -30,7 +30,7 @@ id newTab(void *gotab)
goTabView *t; goTabView *t;
t = [[goTabView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]; t = [[goTabView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
// TODO font setStandardControlFont((id) t); // safe; same selector provided by NSTabView
t->gotab = gotab; t->gotab = gotab;
return (id) t; return (id) t;
} }

View File

@ -20,7 +20,7 @@ void controlSetHidden(id control, BOOL hidden)
[toNSView(control) setHidden:hidden]; [toNSView(control) setHidden:hidden];
} }
static inline void setStandardControlFont(id control) void setStandardControlFont(id control)
{ {
[toNSControl(control) setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]]; [toNSControl(control) setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
} }
@ -46,11 +46,10 @@ id newButton(void)
// TODO cache the initial rect? // TODO cache the initial rect?
b = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]; b = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
// TODO verify all of these against Interface Builder [b setButtonType:NSMomentaryPushInButton];
[b setButtonType:NSMomentaryLightButton];
[b setBordered:YES]; [b setBordered:YES];
[b setBezelStyle:NSRoundedBezelStyle]; [b setBezelStyle:NSRoundedBezelStyle];
setStandardControlFont(b); setStandardControlFont((id) b);
return (id) b; return (id) b;
} }
@ -79,10 +78,9 @@ id newCheckbox(void)
NSButton *c; NSButton *c;
c = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]; c = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
// TODO verify all of these against Interface Builder
[c setButtonType:NSSwitchButton]; [c setButtonType:NSSwitchButton];
[c setBordered:NO]; [c setBordered:NO];
setStandardControlFont(c); setStandardControlFont((id) c);
return (id) c; return (id) c;
} }
@ -105,7 +103,9 @@ void checkboxSetChecked(id c, BOOL checked)
static id finishNewTextField(NSTextField *t) static id finishNewTextField(NSTextField *t)
{ {
// TODO font // same for text fields and password fields
setStandardControlFont((id) t);
// TODO border (Interface Builder setting is confusing)
// TODO smart quotes // TODO smart quotes
// Interface Builder does this to make the text box behave properly // Interface Builder does this to make the text box behave properly
// this disables both word wrap AND ellipsizing in one fell swoop // this disables both word wrap AND ellipsizing in one fell swoop

View File

@ -34,6 +34,7 @@ extern void windowRedraw(id);
/* controls_darwin.m */ /* controls_darwin.m */
extern void parent(id, id); extern void parent(id, id);
extern void controlSetHidden(id, BOOL); extern void controlSetHidden(id, BOOL);
extern void setStandardControlFont(id);
extern id newButton(void); extern id newButton(void);
extern void buttonSetDelegate(id, void *); extern void buttonSetDelegate(id, void *);
extern const char *buttonText(id); extern const char *buttonText(id);