Made drawing of NSScrollView backgrounds explicit on Mac OS X. This is what Interface Builder sets for NSTableViews, so we do that too for Listbox. This also means NSScrollView draws the background for our Areas, settling the clear clip rect TODO.

This commit is contained in:
Pietro Gagliardi 2014-05-17 20:21:48 -04:00
parent b9c12da838
commit 216b5c183c
2 changed files with 3 additions and 1 deletions

View File

@ -27,7 +27,7 @@ func areaInScrollView(scrollview C.id) C.id {
//export areaView_drawRect
func areaView_drawRect(self C.id, rect C.struct_xrect) {
s := getSysData(self)
// TODO clear clip rect
// no need to clear the clip rect; the NSScrollView does that for us (see the setDrawsBackground: call in objc_darwin.m)
// rectangles in Cocoa are origin/size, not point0/point1; if we don't watch for this, weird things will happen when scrolling
cliprect := image.Rect(int(rect.x), int(rect.y), int(rect.x + rect.width), int(rect.y + rect.height))
max := C.frame(self)

View File

@ -50,6 +50,8 @@ id makeScrollView(id content)
[scrollview setHasHorizontalScroller:YES];
[scrollview setHasVerticalScroller:YES];
[scrollview setAutohidesScrollers:YES];
// Interface Builder sets this for NSTableViews; we also want this on Areas
[scrollview setDrawsBackground:YES];
[scrollview setDocumentView:toNSView(content)];
return scrollview;
}