Skip to content

Commit

Permalink
Merge pull request #39 from tmc/tmc-add-some-methods
Browse files Browse the repository at this point in the history
cocoa: Add NSScreen and NSTextView methods
  • Loading branch information
progrium authored Apr 4, 2021
2 parents 87b2fbe + 5560e65 commit c4bbe13
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cocoa/NSScreen.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ func NSScreen_Main() NSScreen {
return NSScreen{objc.Get("NSScreen").Send("mainScreen")}
}

func NSScreen_Screens() []NSScreen {
var result []NSScreen
screens := core.NSArray{objc.Get("NSScreen").Send("screens")}
for i := uint64(0); i < screens.Count(); i++ {
result = append(result, NSScreen{screens.ObjectAtIndex(i)})
}
return result
}

func (s NSScreen) Frame() (frame core.NSRect) {
s.Send("frame", &frame)
return frame
Expand Down
4 changes: 4 additions & 0 deletions cocoa/NSTextView.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ func (v NSTextView) SetFont(f NSFont) {
v.Set("font:", f)
}

func (v NSTextView) SetTextColor(c NSColor) {
v.Set("textColor:", c)
}

func (v NSTextView) Alignment() NSTextAlignment {
return NSTextAlignment(v.Get("alignment").Int())
}
Expand Down

0 comments on commit c4bbe13

Please sign in to comment.