summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--listbox_darwin.go8
-rw-r--r--todo.md1
2 files changed, 9 insertions, 0 deletions
diff --git a/listbox_darwin.go b/listbox_darwin.go
index 71227af..6f81f5f 100644
--- a/listbox_darwin.go
+++ b/listbox_darwin.go
@@ -12,6 +12,8 @@ The Cocoa API was not designed to be used directly in code; you were intended to
Under normal circumstances we would have to build our own data source class, as Cocoa doesn't provide premade data sources. Thankfully, Mac OS X 10.3 introduced the bindings system, which avoids all that. It's just not documented too well (again, because you're supposed to use Interface Builder). Bear with me here.
PERSONAL TODO - make a post somewhere that does all this in Objective-C itself, for the benefit of the programming community.
+
+TODO - change the name of some of these functions? specifically the functions that get data about the NSTableView?
*/
// #cgo LDFLAGS: -lobjc -framework Foundation -framework AppKit
@@ -176,6 +178,9 @@ The NSTableViews don't draw their own scrollbars; we have to drop our NSTableVie
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")
)
@@ -184,6 +189,9 @@ func newListboxScrollView(listbox C.id) C.id {
scrollview := objc_alloc(_NSScrollView)
scrollview = objc_msgSend_rect(scrollview, _initWithFrame,
0, 0, 100, 100)
+ 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, listbox)
return scrollview
}
diff --git a/todo.md b/todo.md
index 98e1176..87d7abd 100644
--- a/todo.md
+++ b/todo.md
@@ -40,6 +40,7 @@ important things:
- Cocoa has similar margining issues (like on Comboboxes)
- sometimes the size of the drop-down part of a Combobox becomes 0 or 1 or some other impossibly small value on Windows
- make gcc (Unix)/clang (Mac OS X) pedantic about warnings/errors; also -Werror
+- make sure scrollbars in Listbox work identically on all platforms (specifically the existence and autohiding of both horizontal and vertical scrollbars)
super ultra important things:
- for some reason events are now delayed on windows