forked from progrium/darwinkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNSView.go
76 lines (58 loc) · 1.53 KB
/
NSView.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package cocoa
import (
"github.com/progrium/macdriver/core"
"github.com/progrium/macdriver/objc"
)
type NSView struct {
objc.Object
}
func NSView_Init(frame core.NSRect) NSView {
return NSView{objc.Get("NSView").Alloc().Send("initWithFrame:", frame)}
}
func (v NSView) Frame() (frame core.NSRect) {
v.Send("frame", &frame)
return frame
}
func (v NSView) Bounds() (frame core.NSRect) {
v.Send("bounds", &frame)
return frame
}
func (v NSView) BackgroundColor() NSColor {
return NSColor{v.Get("backgroundColor")}
}
func (v NSView) SetBackgroundColor(color NSColor) {
v.Set("backgroundColor:", color)
}
func (v NSView) WantsLayer() bool {
return v.Get("wantsLayer").Bool()
}
func (v NSView) SetWantsLayer(b bool) {
v.Set("wantsLayer:", b)
}
func (v NSView) Layer() core.CALayer {
return core.CALayer{Object: v.Get("layer")}
}
func (v NSView) AddSubviewPositionedRelativeTo(subview objc.Object, positioned int, relativeTo objc.Object) {
v.Send("addSubview:positioned:relativeTo:", subview, positioned, relativeTo)
}
func (v NSView) SetFrameOrigin(p core.NSPoint) {
v.Set("frameOrigin:", p)
}
func (v NSView) SetFrameSize(s core.NSSize) {
v.Set("frameSize:", s)
}
func (v NSView) SetBoundsOrigin(p core.NSPoint) {
v.Set("boundsOrigin:", p)
}
func (v NSView) SetBoundsSize(s core.NSSize) {
v.Set("boundsSize:", s)
}
func (v NSView) SetOpaque(b bool) {
v.Set("opaque:", b)
}
func (v NSView) Opaque() bool {
return v.Get("opaque").Bool()
}
func (v NSView) SetValueForKey(value, key objc.Object) {
v.Send("setValue:forKey:", value, key)
}