-
Notifications
You must be signed in to change notification settings - Fork 7
/
dialogs.lisp
109 lines (89 loc) · 3.58 KB
/
dialogs.lisp
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
;;; Generated from org-mode, do not edit
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload '("iup" "iup-scintilla")))
(defpackage #:iup-examples.dialogs
(:use #:common-lisp)
(:export #:dialogs))
(in-package #:iup-examples.dialogs)
(defun dialogs ()
(iup:with-iup ()
(iup-scintilla:open)
(flet ((button (title callback)
(iup:button :title title
:action callback
:expand :horizontal)))
(let* ((dialog (iup:dialog
(iup:vbox (list (button "File Dialog" 'file-dialog)
(button "Message Dialog" 'message-dialog)
(button "Color Dialog" 'color-dialog)
(button "Font Dialog" 'font-dialog)
(button "Scintilla Dialog" 'scintilla-dialog)
(button "Layout Dialog" 'layout-dialog)))
:title "IUP Predefined Dialogs")))
(iup:show dialog)
(iup:main-loop)))))
(defun file-dialog (handle)
(let ((dialog (iup:file-dialog)))
(unwind-protect
(progn
(iup:popup dialog iup:+center+ iup:+center+)
(iup:message "File Dialog Example"
(format nil "Selected ~A" (iup:attribute dialog :value))))
(iup:destroy dialog)))
iup:+default+)
(defun message-dialog (handle)
(let ((dialog (iup:message-dialog
:dialogtype :warning
:buttons :retrycancel)))
(unwind-protect
(progn
(setf (iup:attribute dialog :value) "Heap exhausted, game over.")
(iup:popup dialog iup:+center+ iup:+center+)
(iup:message "Message Dialog"
(format nil "Got button response ~S"
(iup:attribute dialog :buttonresponse))))
(iup:destroy dialog)))
iup:+default+)
(defun color-dialog (handle)
(let ((dialog (iup:color-dialog
:title "IUP Color Dialog"
:showhex "YES"
:showcolortable "YES"
:showalpha "YES")))
(unwind-protect
(progn
(iup:popup dialog iup:+center+ iup:+center+)
(iup:message "Result"
(format nil "Got button response ~S~%Got color ~A RGB (~A HSI, ~A)"
(iup:attribute dialog :status)
(iup:attribute dialog :value)
(iup:attribute dialog :valuehsi)
(iup:attribute dialog :valuehex))))))
iup:+default+)
(defun font-dialog (handle)
(let ((dialog (iup:font-dialog :title "IUP Font Dialog")))
(unwind-protect
(progn
(iup:popup dialog iup:+center+ iup:+center+)
(iup:message "Result"
(format nil "Got button response ~S~%Got font ~S"
(iup:attribute dialog :status)
(iup:attribute dialog :value))))
(iup:destroy dialog)))
iup:+default+)
(defun scintilla-dialog (handle)
(let ((dialog (iup-scintilla:scintilla-dialog :title "IUP Scintilla Dialog")))
(unwind-protect
(iup:popup dialog iup:+center+ iup:+center+)
(iup:destroy dialog))))
(defun layout-dialog (handle)
(let ((dialog (iup:layout-dialog nil)))
(unwind-protect
(iup:popup dialog iup:+center+ iup:+center+)
(iup:destroy dialog)))
iup:+default+)
#-sbcl (dialogs)
#+sbcl
(sb-int:with-float-traps-masked
(:divide-by-zero :invalid)
(dialogs))