view pyntnclick/widgets/overlay.py @ 585:ec13a5a0b213 pyntnclick

FIXED: Yes, thank you.
author Simon Cross <hodgestar+bzr@gmail.com>
date Sat, 11 Feb 2012 16:51:39 +0200
parents f9f04cb35697
children 1aac5a3b17e1
line wrap: on
line source

from pyntnclick.widgets.base import Button


class OverlayOnFocusButton(Button):
    """A non-visiable clickable area, that causes an overlay to be
       displayed when focussed"""

    def __init__(self, rect, image):
        self.image = image
        super(OverlayOnFocusButton, self).__init__(rect)
        self.focussable = True

    def draw(self, surface):
        if self.focussed:
            surface.blit(self.image, surface.get_rect())


class OverlayButton(Button):
    """A non-visiable clickable area, that causes an overlay to be
    displayed. Doesn't really understand this focus thing."""

    def __init__(self, rect, image):
        self.image = image
        super(OverlayButton, self).__init__(rect)
        self.focussable = True

    def draw(self, surface):
        if not self.disabled:
            surface.blit(self.image, surface.get_rect())