summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-05-03 19:59:47 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-05-03 19:59:58 -0400
commit5a688b2200c0f91e36b791c375761c3158bbacda (patch)
tree0969e0d557d6a3282a96fe1ad63bceabc9cb20bf
parentc4bcb53934bc9ce0624affe877e2e7a0afa8d053 (diff)
gui: Add enabled? flag to <widget>.
-rw-r--r--starling/gui.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/starling/gui.scm b/starling/gui.scm
index 256cfd7..4698923 100644
--- a/starling/gui.scm
+++ b/starling/gui.scm
@@ -41,6 +41,7 @@
current-theme
<widget>
apply-theme
+ enabled?
focused?
hover?
left-pressed?
@@ -126,6 +127,7 @@
(define current-theme (make-parameter #f))
(define-class <widget> (<node-2d>)
+ (enabled? #:accessor enabled? #:init-value #t #:watch? #t)
(focused? #:accessor focused? #:init-value #f #:watch? #t)
(hover? #:accessor hover? #:init-value #f #:watch? #t)
(left-pressed? #:accessor left-pressed? #:init-value #f #:watch? #t)
@@ -301,7 +303,8 @@
(define-method (pick-widget (scene <gui-scene>) p)
(pick scene p (lambda (node)
- (and (visible? node)
+ (and (enabled? node)
+ (visible? node)
(is-a? node <widget>)))))
(define-method (on-mouse-move (scene <gui-scene>) x y x-rel y-rel buttons)