summaryrefslogtreecommitdiff
path: root/redo/table_darwin.m
diff options
context:
space:
mode:
Diffstat (limited to 'redo/table_darwin.m')
-rw-r--r--redo/table_darwin.m61
1 files changed, 61 insertions, 0 deletions
diff --git a/redo/table_darwin.m b/redo/table_darwin.m
new file mode 100644
index 0000000..45e9b0b
--- /dev/null
+++ b/redo/table_darwin.m
@@ -0,0 +1,61 @@
+// 29 july 2014
+
+#import "objc_darwin.h"
+#import "_cgo_export.h"
+#import <Cocoa/Cocoa.h>
+
+#define toNSTableView(x) ((NSTableView *) (x))
+#define toNSView(x) ((NSView *) (x))
+
+@interface goTableDataSource : NSObject <NSTableViewDataSource> {
+@public
+ void *gotable;
+}
+@end
+
+@implementation goTableDataSource
+@end
+
+id newTable(void)
+{
+ NSTableView *t;
+
+ // TODO makerect
+ t = [[NSTableView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
+ [t setAllowsColumnReordering:NO];
+ [t setAllowsColumnResizing:YES];
+ // TODO make this an option on all platforms
+ [t setAllowsMultipleSelection:NO];
+ [t setAllowsEmptySelection:YES];
+ [t setAllowsColumnSelection:NO];
+ // TODO check against interface builder
+ return (id) t;
+}
+
+// TODO scroll view
+
+void tableAppendColumn(id t, char *name)
+{
+ NSTableColumn *c;
+
+ c = [[NSTableColumn alloc] initWithIdentifier:nil];
+ [c setEditable:NO];
+ [[c headerCell] setStringValue:[NSString stringWithUTF8String:name]];
+ // TODO other options
+ [toNSTableView(t) addTableColumn:c];
+}
+
+void tableUpdate(id t)
+{
+ [toNSTableView(t) reloadData];
+}
+
+// TODO SPLIT
+id newScrollView(id content)
+{
+ NSScrollView *sv;
+
+ sv = [[NSScrollView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
+ [sv setDocumentView:toNSView(content)];
+ return (id) sv;
+}