summaryrefslogtreecommitdiffstats
path: root/demo2
diff options
context:
space:
mode:
Diffstat (limited to 'demo2')
-rw-r--r--demo241
1 files changed, 41 insertions, 0 deletions
diff --git a/demo2 b/demo2
new file mode 100644
index 0000000..3e6ef61
--- /dev/null
+++ b/demo2
@@ -0,0 +1,41 @@
+#!/bin/bash
+sbcl --script << 'EOF' 2> >(sed '/^Backtrace/,$d;/^; /d')
+
+; Refer to the demostuff file for definitions and descriptions.
+
+(load "demostuff")
+
+(defun main ()
+ (gapp demo2
+ (window win demo2 "Numerals Demo" 250 250)
+ (box h outerbox win)
+ (box v mainbox outerbox)
+ (box h numbox mainbox)
+ (button but1 (bnt 1) mainbox (xnum (bn 1)))
+ (button but2 (bnt 2) mainbox (xnum (bn 2)))
+ (button but3 (bnt 3) mainbox (xnum (bn 3)))
+ (button but4 (bnt 4) mainbox (xnum (bn 4)))
+ (button but5 (bnt 5) mainbox (xnum (bn 5)))
+ (button numeralbutton "Numerals" mainbox (togglenumar))
+ (text thenum "zero" numbox)
+ (gtk_widget_show_all win))
+ (g_application_run demo2 0 nil)
+ (g_object_unref demo2))
+
+(defparameter numar 'a) ; 'r = I II II IV V. 'a = 1 2 3 4 5.
+
+; Button number (bn) and button number text (bnt):
+(defun bn (n) (nth (1- n) '(11 22 33 44 55)))
+(defun bnt (n) (format nil (if (eq numar 'a) "~d" "~@R") (bn n)))
+
+(defun togglenumar ()
+ (setq numar (if (eq numar 'a) 'r 'a))
+ (loop as button in (list but1 but2 but3 but4 but5)
+ as n from 1 to 5
+ do (xlabel button (bnt n))))
+
+(defun xnum (n) (xtext thenum (format nil "~R" n)))
+
+(main)
+
+EOF