summaryrefslogtreecommitdiff
path: root/objc_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-04-13 12:52:10 -0400
committerPietro Gagliardi <[email protected]>2014-04-13 12:52:10 -0400
commit417bdb89492dc1eb2ca53535fd9891e3cb5bb7d7 (patch)
tree7e1142265c6130a130c740001cfa729b18d3e19d /objc_darwin.go
parent136ddf5a5ba68aded74df105ad5b0d37026cc7ea (diff)
Consolidated NSScrollView code on Mac OS X to be all in one place.
Diffstat (limited to 'objc_darwin.go')
-rw-r--r--objc_darwin.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/objc_darwin.go b/objc_darwin.go
index 855dc58..b8d5f8f 100644
--- a/objc_darwin.go
+++ b/objc_darwin.go
@@ -54,6 +54,32 @@ func fromNSString(str C.id) string {
return C.GoString((*C.char)(unsafe.Pointer(cstr)))
}
+// These consolidate the NSScrollView code (used by listbox_darwin.go and area_darwin.go) into a single place.
+
+var (
+ _NSScrollView = objc_getClass("NSScrollView")
+
+ _setHasHorizontalScroller = sel_getUid("setHasHorizontalScroller:")
+ _setHasVerticalScroller = sel_getUid("setHasVerticalScroller:")
+ _setAutohidesScrollers = sel_getUid("setAutohidesScrollers:")
+ _setDocumentView = sel_getUid("setDocumentView:")
+ _documentView = sel_getUid("documentView")
+)
+
+func newScrollView(content C.id) C.id {
+ scrollview := C.objc_msgSend_noargs(_NSScrollView, _alloc)
+ scrollview = initWithDummyFrame(scrollview)
+ C.objc_msgSend_bool(scrollview, _setHasHorizontalScroller, C.BOOL(C.YES))
+ C.objc_msgSend_bool(scrollview, _setHasVerticalScroller, C.BOOL(C.YES))
+ C.objc_msgSend_bool(scrollview, _setAutohidesScrollers, C.BOOL(C.YES))
+ C.objc_msgSend_id(scrollview, _setDocumentView, content)
+ return scrollview
+}
+
+func getScrollViewContent(scrollview C.id) C.id {
+ return C.objc_msgSend_noargs(scrollview, _documentView)
+}
+
// These create new classes.
// selector contains the information for a new selector.