ScrollView

class vanilla.ScrollView(posSize, nsView, hasHorizontalScroller=True, hasVerticalScroller=True, autohidesScrollers=False, backgroundColor=None, clipView=None, drawsBackground=True)

A view with scrollers for containing another view.:

from AppKit import NSView, NSColor, NSRectFill
from vanilla import *

class DemoView(NSView):

    def drawRect_(self, rect):
        NSColor.redColor().set()
        NSRectFill(self.bounds())


class ScrollViewDemo(object):

    def __init__(self):
        self.w = Window((200, 200))
        self.view = DemoView.alloc().init()
        self.view.setFrame_(((0, 0), (300, 300)))
        self.w.scrollView = ScrollView((10, 10, -10, -10),
                                self.view)
        self.w.open()

ScrollViewDemo()

posSize Tuple of form (left, top, width, height) representing the position and size of the scroll view.

nsView A NSView object.

hasHorizontalScroller Boolean representing if the scroll view has horizontal scrollers.

hasVerticalScroller Boolean representing if the scroll view has vertical scrollers.

autohidesScrollers Boolean representing if the scroll view auto-hides its scrollers.

backgroundColor A NSColor object representing the background color of the scroll view.

drawsBackground Boolean representing if the background should be drawn.

enable(onOff)

Enable or disable the object. onOff should be a boolean.

getNSScrollView()

Return the NSScrollView that this object wraps.

getPosSize()

The position and size of the object as a tuple of form (left, top, width, height).

isVisible()

Return a bool indicting if the object is visible or not.

move(x, y)

Move the object by x units and y units.

resize(width, height)

Change the size of the object to width and height.

setBackgroundColor(color)

Set the background of the scrol view to _color_.

setPosSize(posSize)

Set the postion and size of the object.

posSize A tuple of form (left, top, width, height).

show(onOff)

Show or hide the object.

onOff A boolean value representing if the object should be shown or not.