8bb8ead0 |
1 | ;; Common Lisp bindings for GTK+ v2.0 |
580820d8 |
2 | ;; Copyright (C) 1999-2005 Espen S. Johnsen <espen@users.sf.net> |
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 | |
580820d8 |
18 | ;; $Id: gdk.lisp,v 1.16 2005-04-21 12:28:20 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 | |
a02fc41f |
32 | ;;; Display |
13b24566 |
33 | |
34 | (defbinding %display-open () display |
35 | (display-name (or null string))) |
36 | |
37 | (defun display-open (&optional display-name) |
38 | (let ((display (%display-open display-name))) |
39 | (unless (display-get-default) |
40 | (display-set-default display)) |
41 | display)) |
42 | |
a02fc41f |
43 | (defbinding %display-get-n-screens () int |
44 | (display display)) |
45 | |
46 | (defbinding %display-get-screen () screen |
47 | (display display) |
48 | (screen-num int)) |
49 | |
50 | (defun display-screens (&optional (display (display-get-default))) |
51 | (loop |
52 | for i from 0 below (%display-get-n-screens display) |
53 | collect (%display-get-screen display i))) |
54 | |
55 | (defbinding display-get-default-screen |
56 | (&optional (display (display-get-default))) screen |
57 | (display display)) |
58 | |
59 | (defbinding display-beep (&optional (display (display-get-default))) nil |
60 | (display display)) |
61 | |
62 | (defbinding display-sync (&optional (display (display-get-default))) nil |
63 | (display display)) |
64 | |
65 | (defbinding display-flush (&optional (display (display-get-default))) nil |
66 | (display display)) |
67 | |
68 | (defbinding display-close (&optional (display (display-get-default))) nil |
69 | (display display)) |
70 | |
71 | (defbinding display-get-event |
72 | (&optional (display (display-get-default))) event |
73 | (display display)) |
74 | |
75 | (defbinding display-peek-event |
76 | (&optional (display (display-get-default))) event |
77 | (display display)) |
78 | |
79 | (defbinding display-put-event |
80 | (event &optional (display (display-get-default))) event |
81 | (display display) |
82 | (event event)) |
83 | |
13b24566 |
84 | (defbinding (display-connection-number "clg_gdk_connection_number") |
85 | (&optional (display (display-get-default))) int |
86 | (display display)) |
87 | |
88 | |
a02fc41f |
89 | |
90 | ;;; Display manager |
91 | |
92 | (defbinding display-get-default () display) |
93 | |
94 | (defbinding (display-manager "gdk_display_manager_get") () display-manager) |
95 | |
96 | (defbinding (display-set-default "gdk_display_manager_set_default_display") |
97 | (display) nil |
98 | ((display-manager) display-manager) |
99 | (display display)) |
100 | |
101 | |
102 | |
13b24566 |
103 | ;;; Events |
560af5c5 |
104 | |
8bb8ead0 |
105 | (defbinding (events-pending-p "gdk_events_pending") () boolean) |
560af5c5 |
106 | |
8bb8ead0 |
107 | (defbinding event-get () event) |
560af5c5 |
108 | |
8bb8ead0 |
109 | (defbinding event-peek () event) |
560af5c5 |
110 | |
8bb8ead0 |
111 | (defbinding event-get-graphics-expose () event |
560af5c5 |
112 | (window window)) |
113 | |
8bb8ead0 |
114 | (defbinding event-put () event |
560af5c5 |
115 | (event event)) |
116 | |
8bb8ead0 |
117 | ;(defbinding event-handler-set () ...) |
560af5c5 |
118 | |
8bb8ead0 |
119 | (defbinding set-show-events () nil |
560af5c5 |
120 | (show-events boolean)) |
121 | |
8bb8ead0 |
122 | (defbinding get-show-events () boolean) |
560af5c5 |
123 | |
560af5c5 |
124 | |
a02fc41f |
125 | ;;; Miscellaneous functions |
560af5c5 |
126 | |
a02fc41f |
127 | (defbinding screen-width () int) |
128 | (defbinding screen-height () int) |
560af5c5 |
129 | |
a02fc41f |
130 | (defbinding screen-width-mm () int) |
131 | (defbinding screen-height-mm () int) |
560af5c5 |
132 | |
a02fc41f |
133 | (defbinding pointer-grab |
134 | (window &key owner-events events confine-to cursor time) grab-status |
560af5c5 |
135 | (window window) |
136 | (owner-events boolean) |
a02fc41f |
137 | (events event-mask) |
560af5c5 |
138 | (confine-to (or null window)) |
139 | (cursor (or null cursor)) |
580820d8 |
140 | ((or time 0) (unsigned 32))) |
560af5c5 |
141 | |
a02fc41f |
142 | (defbinding (pointer-ungrab "gdk_display_pointer_ungrab") |
580820d8 |
143 | (&optional time (display (display-get-default))) nil |
a02fc41f |
144 | (display display) |
580820d8 |
145 | ((or time 0) (unsigned 32))) |
560af5c5 |
146 | |
a02fc41f |
147 | (defbinding (pointer-is-grabbed-p "gdk_display_pointer_is_grabbed") |
148 | (&optional (display (display-get-default))) boolean) |
149 | |
150 | (defbinding keyboard-grab (window &key owner-events time) grab-status |
560af5c5 |
151 | (window window) |
152 | (owner-events boolean) |
580820d8 |
153 | ((or time 0) (unsigned 32))) |
560af5c5 |
154 | |
a02fc41f |
155 | (defbinding (keyboard-ungrab "gdk_display_keyboard_ungrab") |
580820d8 |
156 | (&optional time (display (display-get-default))) nil |
a02fc41f |
157 | (display display) |
580820d8 |
158 | ((or time 0) (unsigned 32))) |
560af5c5 |
159 | |
560af5c5 |
160 | |
560af5c5 |
161 | |
628fd576 |
162 | (defbinding atom-intern (atom-name &optional only-if-exists) atom |
163 | ((string atom-name) string) |
164 | (only-if-exists boolean)) |
165 | |
166 | (defbinding atom-name () string |
167 | (atom atom)) |
168 | |
560af5c5 |
169 | |
170 | |
171 | ;;; Visuals |
172 | |
8bb8ead0 |
173 | (defbinding visual-get-best-depth () int) |
560af5c5 |
174 | |
8bb8ead0 |
175 | (defbinding visual-get-best-type () visual-type) |
560af5c5 |
176 | |
8bb8ead0 |
177 | (defbinding visual-get-system () visual) |
560af5c5 |
178 | |
179 | |
8bb8ead0 |
180 | (defbinding (%visual-get-best-with-nothing "gdk_visual_get_best") () visual) |
560af5c5 |
181 | |
8bb8ead0 |
182 | (defbinding %visual-get-best-with-depth () visual |
560af5c5 |
183 | (depth int)) |
184 | |
8bb8ead0 |
185 | (defbinding %visual-get-best-with-type () visual |
560af5c5 |
186 | (type visual-type)) |
187 | |
8bb8ead0 |
188 | (defbinding %visual-get-best-with-both () visual |
560af5c5 |
189 | (depth int) |
190 | (type visual-type)) |
191 | |
192 | (defun visual-get-best (&key depth type) |
193 | (cond |
194 | ((and depth type) (%visual-get-best-with-both depth type)) |
195 | (depth (%visual-get-best-with-depth depth)) |
196 | (type (%visual-get-best-with-type type)) |
197 | (t (%visual-get-best-with-nothing)))) |
198 | |
8bb8ead0 |
199 | ;(defbinding query-depths ..) |
560af5c5 |
200 | |
8bb8ead0 |
201 | ;(defbinding query-visual-types ..) |
560af5c5 |
202 | |
8bb8ead0 |
203 | (defbinding list-visuals () (glist visual)) |
560af5c5 |
204 | |
205 | |
206 | ;;; Windows |
207 | |
8bb8ead0 |
208 | (defbinding window-destroy () nil |
560af5c5 |
209 | (window window)) |
210 | |
211 | |
8f30d7da |
212 | (defbinding window-at-pointer () window |
213 | (x int :out) |
214 | (y int :out)) |
560af5c5 |
215 | |
8bb8ead0 |
216 | (defbinding window-show () nil |
560af5c5 |
217 | (window window)) |
218 | |
8f30d7da |
219 | (defbinding window-show-unraised () nil |
220 | (window window)) |
221 | |
8bb8ead0 |
222 | (defbinding window-hide () nil |
560af5c5 |
223 | (window window)) |
224 | |
8f30d7da |
225 | (defbinding window-is-visible-p () boolean |
226 | (window window)) |
227 | |
228 | (defbinding window-is-viewable-p () boolean |
229 | (window window)) |
230 | |
8bb8ead0 |
231 | (defbinding window-withdraw () nil |
560af5c5 |
232 | (window window)) |
233 | |
8f30d7da |
234 | (defbinding window-iconify () nil |
235 | (window window)) |
236 | |
237 | (defbinding window-deiconify () nil |
238 | (window window)) |
239 | |
240 | (defbinding window-stick () nil |
241 | (window window)) |
242 | |
243 | (defbinding window-unstick () nil |
244 | (window window)) |
245 | |
246 | (defbinding window-maximize () nil |
247 | (window window)) |
248 | |
249 | (defbinding window-unmaximize () nil |
250 | (window window)) |
251 | |
252 | (defbinding window-fullscreen () nil |
253 | (window window)) |
254 | |
255 | (defbinding window-unfullscreen () nil |
256 | (window window)) |
257 | |
258 | (defbinding window-set-keep-above () nil |
259 | (window window) |
260 | (setting boolean)) |
261 | |
262 | (defbinding window-set-keep-below () nil |
263 | (window window) |
264 | (setting boolean)) |
265 | |
8bb8ead0 |
266 | (defbinding window-move () nil |
560af5c5 |
267 | (window window) |
268 | (x int) |
269 | (y int)) |
270 | |
8bb8ead0 |
271 | (defbinding window-resize () nil |
560af5c5 |
272 | (window window) |
273 | (width int) |
274 | (height int)) |
275 | |
8bb8ead0 |
276 | (defbinding window-move-resize () nil |
560af5c5 |
277 | (window window) |
278 | (x int) |
279 | (y int) |
280 | (width int) |
281 | (height int)) |
282 | |
8f30d7da |
283 | (defbinding window-scroll () nil |
284 | (window window) |
285 | (dx int) |
286 | (dy int)) |
287 | |
8bb8ead0 |
288 | (defbinding window-reparent () nil |
560af5c5 |
289 | (window window) |
290 | (new-parent window) |
291 | (x int) |
292 | (y int)) |
293 | |
8bb8ead0 |
294 | (defbinding window-clear () nil |
560af5c5 |
295 | (window window)) |
296 | |
8f30d7da |
297 | (defbinding %window-clear-area () nil |
560af5c5 |
298 | (window window) |
299 | (x int) (y int) (width int) (height int)) |
300 | |
8f30d7da |
301 | (defbinding %window-clear-area-e () nil |
560af5c5 |
302 | (window window) |
303 | (x int) (y int) (width int) (height int)) |
304 | |
305 | (defun window-clear-area (window x y width height &optional expose) |
306 | (if expose |
8f30d7da |
307 | (%window-clear-area-e window x y width height) |
308 | (%window-clear-area window x y width height))) |
560af5c5 |
309 | |
8bb8ead0 |
310 | (defbinding window-raise () nil |
560af5c5 |
311 | (window window)) |
312 | |
8bb8ead0 |
313 | (defbinding window-lower () nil |
560af5c5 |
314 | (window window)) |
315 | |
8f30d7da |
316 | (defbinding window-focus () nil |
317 | (window window) |
318 | (timestamp unsigned-int)) |
319 | |
320 | (defbinding window-register-dnd () nil |
321 | (window window)) |
322 | |
323 | (defbinding window-begin-resize-drag () nil |
324 | (window window) |
325 | (edge window-edge) |
326 | (button int) |
327 | (root-x int) |
328 | (root-y int) |
329 | (timestamp unsigned-int)) |
330 | |
331 | (defbinding window-begin-move-drag () nil |
332 | (window window) |
333 | (button int) |
334 | (root-x int) |
335 | (root-y int) |
336 | (timestamp unsigned-int)) |
337 | |
338 |