#
#   Python GUI - Scroll bars - Generic
#

from Properties import overridable_property

class ScrollBar:
    """Mixin class providing generic ScrollBar functionality."""

    client = overridable_property('client', "The View being scrolled.")

    _client = None	# View being scrolled

    def destroy(self):
        c = self._client
        if c:
            c._scroll_bars.remove(self)
        self._client = None

    def get_client(self):
        return self._client

    def set_client(self, c):
        old_c = self._client
        if old_c is not c:
            if old_c:
                old_c._scroll_bars.remove(self)
            self._client = c
            if c:
                c._scroll_bars.append(self)
                self.update()

    def update(self):
        pass
