diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-03 14:57:20 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-03 14:57:20 -0500 |
| commit | 874491a87142742ac726b12d8433d5c0fb64a85e (patch) | |
| tree | 1726910987aa7ff0bccec3e4232aa20c9f048cc0 | |
| parent | 8bacbf8cd6bbdc89ef8f596c2310c147ccdbc509 (diff) | |
Added the scrollbars themselves to the NSScrollView backing the Mac OS X Listboxes. Also added a few TODOs. I think the Mac OS X Listbox implementation is now finished.
| -rw-r--r-- | listbox_darwin.go | 8 | ||||
| -rw-r--r-- | todo.md | 1 |
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 } @@ -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 |
