Added documentation for GtkWindowGroup
[cl-gtk2.git] / gtk / gtk.misc.lisp
blob1dfa2cb664f6a82b56675352366d2169acf37836
1 (in-package :gtk)
3 (defcallback stable-pointer-free-destroy-notify-callback :void ((data :pointer))
4 (free-stable-pointer data))
6 (defcfun (get-clipboard "gtk_clipboard_get") g-object
7 (selection gdk-atom-as-string))
9 (export 'get-clipboard)
11 (defcallback call-from-main-loop-callback :boolean
12 ((data :pointer))
13 (restart-case
14 (progn (funcall (get-stable-pointer-value data))
15 nil)
16 (return-from-callback () nil)))
18 (defun call-from-gtk-main-loop (function &key (priority +g-priority-default-idle+))
19 (g-idle-add-full priority
20 (callback call-from-main-loop-callback)
21 (allocate-stable-pointer function)
22 (callback stable-pointer-free-destroy-notify-callback))
23 (ensure-gtk-main))
25 (export 'call-from-gtk-main-loop)
27 (defcallback call-timeout-from-main-loop-callback :boolean
28 ((data :pointer))
29 (restart-case
30 (progn (funcall (get-stable-pointer-value data)))
31 (return-from-callback () nil)))
33 (defun gtk-main-add-timeout (milliseconds function &key (priority +g-priority-default+))
34 (g-timeout-add-full priority milliseconds
35 (callback call-timeout-from-main-loop-callback)
36 (allocate-stable-pointer function)
37 (callback stable-pointer-free-destroy-notify-callback)))
39 (export 'gtk-main-add-timeout)
41 (defmacro within-main-loop (&body body)
42 `(call-from-gtk-main-loop (lambda () ,@body)))
44 (export 'within-main-loop)
46 #+thread-support
47 (defmacro with-main-loop (&body body)
48 `(progn
49 (ensure-gtk-main)
50 (within-main-loop ,@body)))
52 #-thread-support
53 (defmacro with-main-loop (&body body)
54 `(progn
55 ,@body
56 (gtk-main)))
58 (export 'with-main-loop)