Removed the control font code from bleh_darwin.m and rewrote it in Objective-C in sysdata_darwin.m.
This commit is contained in:
parent
999b553e39
commit
82101036b8
|
@ -172,19 +172,3 @@ struct xpoint getTranslatedEventPoint(id self, id event)
|
|||
ret.y = (int64_t) p.y;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
we don't need this here technically — it can be done in Go just fine — but it's easier here
|
||||
*/
|
||||
|
||||
static CGFloat (*objc_msgSend_cgfloatret)(id, SEL, ...) =
|
||||
(CGFloat (*)(id, SEL, ...)) objc_msgSend_fpret;
|
||||
|
||||
void objc_setFont(id what, unsigned int csize)
|
||||
{
|
||||
CGFloat size;
|
||||
|
||||
size = objc_msgSend_cgfloatret(c_NSFont, s_systemFontSizeForControlSize, (NSControlSize) csize);
|
||||
objc_msgSend(what, s_setFont,
|
||||
objc_msgSend(c_NSFont, s_systemFontOfSize, size));
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ id makeListboxTableColumn(id identifier)
|
|||
[column setEditable:NO];
|
||||
// to set the font for each item, we set the font of the "data cell", which is more aptly called the "cell template"
|
||||
dataCell = [column dataCell];
|
||||
// TODO pull the one from sysdata_darwin.m
|
||||
objc_setFont(dataCell, NSRegularControlSize);
|
||||
// technically not a NSControl, but still accepts the selector, so we can call it anyway
|
||||
applyStandardControlFont(dataCell);
|
||||
[column setDataCell:dataCell];
|
||||
// TODO other properties?
|
||||
return column;
|
||||
|
|
|
@ -62,7 +62,4 @@ extern struct xpoint getTranslatedEventPoint(id, id);
|
|||
/* for objc_darwin.go */
|
||||
extern char *encodedNSRect;
|
||||
|
||||
/* for sysdata_darwin.go */
|
||||
extern void objc_setFont(id, unsigned int);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <Foundation/NSGeometry.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSFont.h>
|
||||
#include <AppKit/NSControl.h>
|
||||
#include <AppKit/NSButton.h>
|
||||
#include <AppKit/NSPopUpButton.h>
|
||||
|
@ -49,10 +50,11 @@ void controlHide(id what)
|
|||
[toNSView(what) setHidden:YES];
|
||||
}
|
||||
|
||||
#define systemFontOfSize(s) ([NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:(s)]])
|
||||
|
||||
void applyStandardControlFont(id what)
|
||||
{
|
||||
// TODO inline this
|
||||
objc_setFont(what, NSRegularControlSize);
|
||||
[toNSControl(what) setFont:systemFontOfSize(NSRegularControlSize)];
|
||||
}
|
||||
|
||||
id makeWindow(id delegate)
|
||||
|
|
Loading…
Reference in New Issue