summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bleh_darwin.m16
-rw-r--r--listbox_darwin.m4
-rw-r--r--objc_darwin.h3
-rw-r--r--sysdata_darwin.m6
4 files changed, 6 insertions, 23 deletions
diff --git a/bleh_darwin.m b/bleh_darwin.m
index 41bf839..ca98ffd 100644
--- a/bleh_darwin.m
+++ b/bleh_darwin.m
@@ -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));
-}
diff --git a/listbox_darwin.m b/listbox_darwin.m
index 0a5ba97..60cc25e 100644
--- a/listbox_darwin.m
+++ b/listbox_darwin.m
@@ -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;
diff --git a/objc_darwin.h b/objc_darwin.h
index fb12203..5eb9b6c 100644
--- a/objc_darwin.h
+++ b/objc_darwin.h
@@ -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
diff --git a/sysdata_darwin.m b/sysdata_darwin.m
index e2684cb..3c1124b 100644
--- a/sysdata_darwin.m
+++ b/sysdata_darwin.m
@@ -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)