forked from mojbro/gocoa
-
Notifications
You must be signed in to change notification settings - Fork 1
/
textview.m
28 lines (22 loc) · 820 Bytes
/
textview.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#import "textview.h"
#include "_cgo_export.h"
@implementation TextViewHandler
@end
TextViewPtr TextView_New(int goTextViewId, int x, int y, int w, int h) {
/* create the NSTextView and add it to the window */
id nsTextView = [[[NSTextView alloc] initWithFrame:NSMakeRect(x, y, w, h)] autorelease];
return (TextViewPtr)nsTextView;
}
void TextView_SetText(TextViewPtr textViewPtr, const char* text) {
NSTextView* tv = (NSTextView*)textViewPtr;
[tv setString:[NSString stringWithUTF8String:text]];
}
void TextView_Remove(TextViewPtr textViewPtr) {
NSTextView* tv = (NSTextView*)textViewPtr;
[tv removeFromSuperview];
}
void TextView_SetFontSize(TextViewPtr textViewPtr, int size) {
NSTextView* tv = (NSTextView*)textViewPtr;
NSFont* font = [NSFont fontWithName:@"Helvetica" size:size];
[tv setFont:font];
}