-
Notifications
You must be signed in to change notification settings - Fork 17
/
imageview.m
41 lines (32 loc) · 1.58 KB
/
imageview.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
29
30
31
32
33
34
35
36
37
38
39
40
41
#import "imageview.h"
#include "_cgo_export.h"
ButtonPtr ImageView_New(int goButtonID, int x, int y, int w, int h, const char* url) {
NSImage *theImage = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithUTF8String:url]]];
id nsImageView = [[[NSImageView alloc] initWithFrame:NSMakeRect(x, y, w, h)] autorelease];
[nsImageView setImage:theImage];
return (ImageViewPtr)nsImageView;
}
void ImageView_SetFrameStyle(ImageViewPtr imageViewPtr, int frameStyle) {
NSImageView* nsImageView = (NSImageView*)imageViewPtr;
[nsImageView setImageFrameStyle:frameStyle];
}
void ImageView_SetImageAlignment(ImageViewPtr imageViewPtr, int imageAlignment) {
NSImageView* nsImageView = (NSImageView*)imageViewPtr;
[nsImageView setImageAlignment:imageAlignment];
}
void ImageView_SetImageScaling(ImageViewPtr imageViewPtr, int imageScaling) {
NSImageView* nsImageView = (NSImageView*)imageViewPtr;
[nsImageView setImageScaling:imageScaling];
}
void ImageView_SetAnimates(ImageViewPtr imageViewPtr, int animates) {
NSImageView* nsImageView = (NSImageView*)imageViewPtr;
[nsImageView setAnimates:animates];
}
void ImageView_SetContentTintColor(ImageViewPtr imageViewPtr, int r, int g, int b, int a) {
NSImageView* nsImageView = (NSImageView*)imageViewPtr;
[nsImageView setContentTintColor:[NSColor colorWithCalibratedRed:r/255.f green:g/255.f blue:b/255.f alpha:a/255.f]];
}
void ImageView_SetEditable(ImageViewPtr imageViewPtr, int editable) {
NSImageView* nsImageView = (NSImageView*)imageViewPtr;
[nsImageView setEditable:editable];
}