summaryrefslogtreecommitdiff
path: root/redo/control_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'redo/control_darwin.m')
-rw-r--r--redo/control_darwin.m17
1 files changed, 17 insertions, 0 deletions
diff --git a/redo/control_darwin.m b/redo/control_darwin.m
index a939583..f34f3c2 100644
--- a/redo/control_darwin.m
+++ b/redo/control_darwin.m
@@ -3,9 +3,26 @@
#import "objc_darwin.h"
#import <Cocoa/Cocoa.h>
+#define toNSControl(x) ((NSControl *) (x))
#define toNSView(x) ((NSView *) (x))
+// also good for NSTableView (TODO might not do what we want) and NSProgressIndicator
+struct xsize controlPreferredSize(id control)
+{
+ NSControl *c;
+ NSRect r;
+ struct xsize s;
+
+ c = toNSControl(control);
+ [c sizeToFit];
+ r = [c frame];
+ s.width = (intptr_t) r.size.width;
+ s.height = (intptr_t) r.size.height;
+ return s;
+}
+
// TODO verify this when we add more scrolling controls
+// TODO no borders on Area
id newScrollView(id content)
{
NSScrollView *sv;