chiark / gitweb /
Added UNSET-USER-DATA
[clg] / gdk / gdk.lisp
CommitLineData
8bb8ead0 1;; Common Lisp bindings for GTK+ v2.0
2;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no>
560af5c5 3;;
4;; This library is free software; you can redistribute it and/or
5;; modify it under the terms of the GNU Lesser General Public
6;; License as published by the Free Software Foundation; either
7;; version 2 of the License, or (at your option) any later version.
8;;
9;; This library is distributed in the hope that it will be useful,
10;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12;; Lesser General Public License for more details.
13;;
14;; You should have received a copy of the GNU Lesser General Public
15;; License along with this library; if not, write to the Free Software
16;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
8f30d7da 18;; $Id: gdk.lisp,v 1.12 2004-12-20 00:32:15 espen Exp $
560af5c5 19
20
21(in-package "GDK")
22
13b24566 23;;; Initialization
24
25(defbinding (gdk-init "gdk_parse_args") () nil
26 "Initializes the library without opening the display."
27 (nil null)
28 (nil null))
560af5c5 29
560af5c5 30
13b24566 31;;; Display
32
9adccb27 33(defbinding (display-manager "gdk_display_manager_get") () display-manager)
34
13b24566 35
36(defbinding (display-set-default "gdk_display_manager_set_default_display")
37 (display) nil
9adccb27 38 ((display-manager) display-manager)
13b24566 39 (display display))
40
41(defbinding display-get-default () display)
42
43(defbinding %display-open () display
44 (display-name (or null string)))
45
46(defun display-open (&optional display-name)
47 (let ((display (%display-open display-name)))
48 (unless (display-get-default)
49 (display-set-default display))
50 display))
51
52(defbinding (display-connection-number "clg_gdk_connection_number")
53 (&optional (display (display-get-default))) int
54 (display display))
55
56
57;;; Events
560af5c5 58
8bb8ead0 59(defbinding (events-pending-p "gdk_events_pending") () boolean)
560af5c5 60
8bb8ead0 61(defbinding event-get () event)
560af5c5 62
8bb8ead0 63(defbinding event-peek () event)
560af5c5 64
8bb8ead0 65(defbinding event-get-graphics-expose () event
560af5c5 66 (window window))
67
8bb8ead0 68(defbinding event-put () event
560af5c5 69 (event event))
70
8bb8ead0 71;(defbinding event-handler-set () ...)
560af5c5 72
8bb8ead0 73(defbinding set-show-events () nil
560af5c5 74 (show-events boolean))
75
76;;; Misc
77
8bb8ead0 78(defbinding set-use-xshm () nil
560af5c5 79 (use-xshm boolean))
80
8bb8ead0 81(defbinding get-show-events () boolean)
560af5c5 82
8bb8ead0 83(defbinding get-use-xshm () boolean)
560af5c5 84
8bb8ead0 85(defbinding get-display () string)
560af5c5 86
8bb8ead0 87; (defbinding time-get () (unsigned 32))
560af5c5 88
8bb8ead0 89; (defbinding timer-get () (unsigned 32))
560af5c5 90
8bb8ead0 91; (defbinding timer-set () nil
560af5c5 92; (milliseconds (unsigned 32)))
93
8bb8ead0 94; (defbinding timer-enable () nil)
560af5c5 95
8bb8ead0 96; (defbinding timer-disable () nil)
560af5c5 97
98; input ...
99
8bb8ead0 100(defbinding pointer-grab () int
560af5c5 101 (window window)
102 (owner-events boolean)
103 (event-mask event-mask)
104 (confine-to (or null window))
105 (cursor (or null cursor))
106 (time (unsigned 32)))
107
8bb8ead0 108(defbinding pointer-ungrab () nil
560af5c5 109 (time (unsigned 32)))
110
8bb8ead0 111(defbinding keyboard-grab () int
560af5c5 112 (window window)
113 (owner-events boolean)
114 (time (unsigned 32)))
115
8bb8ead0 116(defbinding keyboard-ungrab () nil
560af5c5 117 (time (unsigned 32)))
118
8bb8ead0 119(defbinding (pointer-is-grabbed-p "gdk_pointer_is_grabbed") () boolean)
560af5c5 120
8bb8ead0 121(defbinding screen-width () int)
122(defbinding screen-height () int)
560af5c5 123
8bb8ead0 124(defbinding screen-width-mm () int)
125(defbinding screen-height-mm () int)
560af5c5 126
8bb8ead0 127(defbinding flush () nil)
128(defbinding beep () nil)
560af5c5 129
130
131
132;;; Visuals
133
8bb8ead0 134(defbinding visual-get-best-depth () int)
560af5c5 135
8bb8ead0 136(defbinding visual-get-best-type () visual-type)
560af5c5 137
8bb8ead0 138(defbinding visual-get-system () visual)
560af5c5 139
140
8bb8ead0 141(defbinding (%visual-get-best-with-nothing "gdk_visual_get_best") () visual)
560af5c5 142
8bb8ead0 143(defbinding %visual-get-best-with-depth () visual
560af5c5 144 (depth int))
145
8bb8ead0 146(defbinding %visual-get-best-with-type () visual
560af5c5 147 (type visual-type))
148
8bb8ead0 149(defbinding %visual-get-best-with-both () visual
560af5c5 150 (depth int)
151 (type visual-type))
152
153(defun visual-get-best (&key depth type)
154 (cond
155 ((and depth type) (%visual-get-best-with-both depth type))
156 (depth (%visual-get-best-with-depth depth))
157 (type (%visual-get-best-with-type type))
158 (t (%visual-get-best-with-nothing))))
159
8bb8ead0 160;(defbinding query-depths ..)
560af5c5 161
8bb8ead0 162;(defbinding query-visual-types ..)
560af5c5 163
8bb8ead0 164(defbinding list-visuals () (glist visual))
560af5c5 165
166
167;;; Windows
168
8bb8ead0 169(defbinding window-destroy () nil
560af5c5 170 (window window))
171
172
8f30d7da 173(defbinding window-at-pointer () window
174 (x int :out)
175 (y int :out))
560af5c5 176
8bb8ead0 177(defbinding window-show () nil
560af5c5 178 (window window))
179
8f30d7da 180(defbinding window-show-unraised () nil
181 (window window))
182
8bb8ead0 183(defbinding window-hide () nil
560af5c5 184 (window window))
185
8f30d7da 186(defbinding window-is-visible-p () boolean
187 (window window))
188
189(defbinding window-is-viewable-p () boolean
190 (window window))
191
8bb8ead0 192(defbinding window-withdraw () nil
560af5c5 193 (window window))
194
8f30d7da 195(defbinding window-iconify () nil
196 (window window))
197
198(defbinding window-deiconify () nil
199 (window window))
200
201(defbinding window-stick () nil
202 (window window))
203
204(defbinding window-unstick () nil
205 (window window))
206
207(defbinding window-maximize () nil
208 (window window))
209
210(defbinding window-unmaximize () nil
211 (window window))
212
213(defbinding window-fullscreen () nil
214 (window window))
215
216(defbinding window-unfullscreen () nil
217 (window window))
218
219(defbinding window-set-keep-above () nil
220 (window window)
221 (setting boolean))
222
223(defbinding window-set-keep-below () nil
224 (window window)
225 (setting boolean))
226
8bb8ead0 227(defbinding window-move () nil
560af5c5 228 (window window)
229 (x int)
230 (y int))
231
8bb8ead0 232(defbinding window-resize () nil
560af5c5 233 (window window)
234 (width int)
235 (height int))
236
8bb8ead0 237(defbinding window-move-resize () nil
560af5c5 238 (window window)
239 (x int)
240 (y int)
241 (width int)
242 (height int))
243
8f30d7da 244(defbinding window-scroll () nil
245 (window window)
246 (dx int)
247 (dy int))
248
8bb8ead0 249(defbinding window-reparent () nil
560af5c5 250 (window window)
251 (new-parent window)
252 (x int)
253 (y int))
254
8bb8ead0 255(defbinding window-clear () nil
560af5c5 256 (window window))
257
8f30d7da 258(defbinding %window-clear-area () nil
560af5c5 259 (window window)
260 (x int) (y int) (width int) (height int))
261
8f30d7da 262(defbinding %window-clear-area-e () nil
560af5c5 263 (window window)
264 (x int) (y int) (width int) (height int))
265
266(defun window-clear-area (window x y width height &optional expose)
267 (if expose
8f30d7da 268 (%window-clear-area-e window x y width height)
269 (%window-clear-area window x y width height)))
560af5c5 270
8bb8ead0 271(defbinding window-raise () nil
560af5c5 272 (window window))
273
8bb8ead0 274(defbinding window-lower () nil
560af5c5 275 (window window))
276
8f30d7da 277(defbinding window-focus () nil
278 (window window)
279 (timestamp unsigned-int))
280
281(defbinding window-register-dnd () nil
282 (window window))
283
284(defbinding window-begin-resize-drag () nil
285 (window window)
286 (edge window-edge)
287 (button int)
288 (root-x int)
289 (root-y int)
290 (timestamp unsigned-int))
291
292(defbinding window-begin-move-drag () nil
293 (window window)
294 (button int)
295 (root-x int)
296 (root-y int)
297 (timestamp unsigned-int))
298
299