summaryrefslogtreecommitdiffstats
path: root/demo2
blob: f19907535dd5578a8f0ec29be2497fda75d83d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
; Refer to the demostuff file for definitions and descriptions.

(defun demo2 ()
  (window demo2 demos "Numerals Demo" 250 250)
  (box h outerbox2 demo2)
  (box v mainbox2 outerbox2)
  (box h numbox2 mainbox2)
  (button b21 (bnt 1) mainbox2 (xnum (bn 1)))
  (button b22 (bnt 2) mainbox2 (xnum (bn 2)))
  (button b23 (bnt 3) mainbox2 (xnum (bn 3)))
  (button b24 (bnt 4) mainbox2 (xnum (bn 4)))
  (button b25 (bnt 5) mainbox2 (xnum (bn 5)))
  (button numeralbutton2 "Numerals" mainbox2 (togglenumar))
  (text num2 "zero" numbox2)
  (gtk_widget_show_all 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 b21 b22 b23 b24 b25)
        as n from 1 to 5
        do (xlabel button (bnt n))))

(defun xnum (n) (xtext num2 (format nil "~R" n)))