-
Notifications
You must be signed in to change notification settings - Fork 7
/
detached.lisp
64 lines (54 loc) · 2.34 KB
/
detached.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
;;; Generated from org-mode, do not edit
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload "iup"))
(defpackage #:iup-examples.detached
(:use #:common-lisp)
(:export #:detached))
(in-package #:iup-examples.detached)
(defun detached ()
(iup:with-iup ()
(let* ((button1 (iup:button :title "Detach Me!"
:action 'button-detach-callback
:expand :yes
:handlename "detach"))
(multi-line (iup:multi-line :expand :yes
:visiblelines 5))
(hbox (iup:hbox (list button1 multi-line) :margin "10x0"))
(dbox (iup:detach-box hbox :orientation :vertical
:detached_cb 'detached-callback
:handlename "dbox"))
(label (iup:label :title "Label"
:expand :vertical))
(button2 (iup:button :title "Restore me!"
:expand :yes
:active :no
:action 'button-restore-callback
:handlename "restore"))
(text (iup:text :expand :horizontal))
(dialog (iup:dialog (iup:vbox (list dbox label button2 text)
:margin "10x10"
:gap 10)
:title "IupDetachBox Example"
:rastersize "300x300")))
(iup:show dialog)
(iup:main-loop))))
(defun detached-callback (handle new-parent x y)
(setf (iup:attribute new-parent :title) "New Dialog"
(iup:attribute (iup:handle "restore") :active) :yes
(iup:attribute (iup:handle "detach") :active) :no)
iup:+default+)
(defun button-restore-callback (button)
(setf (iup:attribute (iup:handle "dbox") :restore) nil
(iup:attribute button :active) :no
(iup:attribute (iup:handle "detach") :active) :yes)
iup:+default+)
(defun button-detach-callback (button)
(setf (iup:attribute (iup:handle "dbox") :detach) nil
(iup:attribute button :active) :no
(iup:attribute (iup:handle "restore") :active) :yes)
iup:+default+)
#-sbcl (detached)
#+sbcl
(sb-int:with-float-traps-masked
(:divide-by-zero :invalid)
(detached))