diff pyntnclick/widgets/overlay.py @ 555:c0474fe18b96 pyntnclick

Copy in widgets from mamba (currently unused)
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 11 Feb 2012 14:09:46 +0200
parents
children f9f04cb35697
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyntnclick/widgets/overlay.py	Sat Feb 11 14:09:46 2012 +0200
@@ -0,0 +1,29 @@
+from mamba.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())