From 8fc01b81e0f95c8ea187d179b6f6a6b9afc4e79e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 25 Apr 2021 14:51:00 -0400 Subject: Break code up into modules. --- test-subject/text-box.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 test-subject/text-box.scm (limited to 'test-subject/text-box.scm') diff --git a/test-subject/text-box.scm b/test-subject/text-box.scm new file mode 100644 index 0000000..e46b396 --- /dev/null +++ b/test-subject/text-box.scm @@ -0,0 +1,37 @@ +(define-module (test-subject text-box) + #:use-module (chickadee graphics font) + #:use-module (chickadee math vector) + #:use-module (oop goops) + #:use-module (starling asset) + #:use-module (starling gui) + #:use-module (starling node) + #:use-module (starling node-2d) + #:duplicates (merge-generics replace warn-override-core warn last) + #:export ( + text-box-text)) + +(define-class () + (text #:accessor text-box-text #:init-keyword #:text #:init-value "" #:watch? #t)) + +(define-method (on-change (text-box ) slot-name old new) + (case slot-name + ((text) + (let ((l (& text-box text))) + (when l + (set! (text l) new)))) + (else + (next-method)))) + +(define-method (apply-theme (text-box )) + (next-method) + (replace text-box + (make