Added event classes
[clg] / gdk / gdktypes.lisp
1 ;; Common Lisp bindings for GTK+ v2.0
2 ;; Copyright (C) 1999-2000 Espen S. Johnsen <esj@stud.cs.uit.no>
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
18 ;; $Id: gdktypes.lisp,v 1.2 2001-02-11 20:28:07 espen Exp $
19
20 (in-package "GDK")
21
22
23 (defclass color (alien-structure)
24 ((pixel
25 :allocation :alien
26 :type unsigned-long)
27 (red
28 :allocation :alien
29 :accessor color-red
30 :type unsigned-short)
31 (green
32 :allocation :alien
33 :accessor color-grenn
34 :type unsigned-short)
35 (blue
36 :allocation :alien
37 :accessor color-blue
38 :type unsigned-short))
39 (:metaclass alien-class)
40 (:alien-name "GdkColor"))
41
42
43 (defclass visual (static-structure)
44 ()
45 (:metaclass alien-class)
46 (:alien-name "GdkVisual"))
47
48
49 (defclass colormap (gobject)
50 ()
51 (:metaclass gobject-class)
52 (:alien-name "GdkColormap"))
53
54
55 (defclass drawable (gobject)
56 ()
57 (:metaclass gobject-class)
58 (:alien-name "GdkDrawable"))
59
60
61 (defclass window (drawable)
62 ()
63 (:metaclass gobject-class)
64 (:alien-name "GdkWindow")
65 (:type-init "gdk_window_object_get_type"))
66
67
68 (defclass pixmap (drawable)
69 ()
70 (:metaclass gobject-class)
71 (:alien-name "GdkPixmap"))
72
73 ;; Bitmaps is not defined as a propper type in gdk, only as an alias for
74 ;; GdkDrawable, so we have to define it this way as a workaround
75 (defclass bitmap (alien-object)
76 ()
77 (:metaclass alien-class))
78
79
80 ; (defclass geometry (alien-structure)
81 ; ((min-width
82 ; :allocation :alien
83 ; :accessor geometry-min-width
84 ; :initarg :min-width
85 ; :type int)
86 ; (min-height
87 ; :allocation :alien
88 ; :accessor geometry-min-height
89 ; :initarg :min-heigth
90 ; :type int)
91 ; (max-width
92 ; :allocation :alien
93 ; :accessor geometry-max-width
94 ; :initarg :max-width
95 ; :type int)
96 ; (max-height
97 ; :allocation :alien
98 ; :accessor geometry-max-height
99 ; :initarg :max-heigth
100 ; :type int)
101 ; (base-width
102 ; :allocation :alien
103 ; :accessor geometry-base-width
104 ; :initarg :base-width
105 ; :type int)
106 ; (base-height
107 ; :allocation :alien
108 ; :accessor geometry-base-height
109 ; :initarg :base-heigth
110 ; :type int)
111 ; (width-inc
112 ; :allocation :alien
113 ; :accessor geometry-width-inc
114 ; :initarg :width-inc
115 ; :type int)
116 ; (height-inc
117 ; :allocation :alien
118 ; :accessor geometry-height-inc
119 ; :initarg :heigth-inc
120 ; :type int)
121 ; (min-aspect
122 ; :allocation :alien
123 ; :accessor geometry-min-aspect
124 ; :initarg :min-aspect
125 ; :type double-float)
126 ; (max-aspect
127 ; :allocation :alien
128 ; :accessor geometry-max-aspect
129 ; :initarg :max-aspect
130 ; :type double-float))
131 ; (:metaclass alien-class))
132
133
134 (defclass image (gobject)
135 ()
136 (:metaclass gobject-class)
137 (:alien-name "GdkImage"))
138
139
140 (defclass gc (gobject)
141 ()
142 (:metaclass gobject-class)
143 (:alien-name "GdkGC"))
144
145
146 (defclass font (alien-object)
147 ()
148 (:metaclass alien-class)
149 (:alien-name "GdkFont"))
150
151
152 (defclass cursor (alien-object)
153 ((type
154 :allocation :alien
155 :accessor cursor-type
156 :initarg :type
157 :type cursor-type))
158 (:metaclass alien-class))
159
160
161 (defclass drag-context (gobject)
162 ()
163 (:metaclass gobject-class)
164 (:alien-name "GdkDragContext"))
165
166
167 (defclass device (alien-structure)
168 ()
169 (:metaclass alien-class))
170
171 (defclass event (alien-structure)
172 ((window
173 :allocation :alien
174 :offset #.(size-of 'pointer)
175 :accessor event-window
176 :initarg :window
177 :type window)
178 (send-event
179 :allocation :alien
180 :accessor event-send-event
181 :initarg :send-event
182 :type (boolean 8))
183 (%align :allocation :alien :offset 2 :type (unsigned 8)))
184 (:metaclass alien-class)
185 (:alien-name "GdkEvent"))
186
187 (defclass timed-event (event)
188 ((time
189 :allocation :alien
190 :accessor event-time
191 :initarg :time
192 :type (unsigned 32)))
193 (:metaclass alien-class))
194
195 (defclass delete-event (event)
196 ()
197 (:metaclass alien-class))
198
199 (defclass destroy-event (event)
200 ()
201 (:metaclass alien-class))
202
203 (defclass expose-event (event)
204 ((x
205 :allocation :alien
206 :accessor event-x
207 :initarg :x
208 :type int)
209 (y
210 :allocation :alien
211 :accessor event-y
212 :initarg :y
213 :type int)
214 (width
215 :allocation :alien
216 :accessor event-width
217 :initarg :width
218 :type int)
219 (height
220 :allocation :alien
221 :accessor event-height
222 :initarg :height
223 :type int)
224 (count
225 :allocation :alien
226 :accessor event-count
227 :initarg :count
228 :type int))
229 (:metaclass alien-class))
230
231 (defclass motion-notify-event (timed-event)
232 ((x
233 :allocation :alien
234 :accessor event-x
235 :initarg :x
236 :type double-float)
237 (y
238 :allocation :alien
239 :accessor event-y
240 :initarg :y
241 :type double-float)
242 (state
243 :allocation :alien
244 :offset #.(size-of 'pointer)
245 :accessor event-state
246 :initarg :state
247 :type unsigned-int)
248 (is-hint
249 :allocation :alien
250 :accessor event-is-hint
251 :initarg :is-hint
252 :type (signed 16) ; should it be (boolean 16)?
253 )
254 (device
255 :allocation :alien
256 :offset 2
257 :accessor event-device
258 :initarg :device
259 :type device)
260 (root-x
261 :allocation :alien
262 :accessor event-root-x
263 :initarg :root-x
264 :type double-float)
265 (root-y
266 :allocation :alien
267 :accessor event-root-y
268 :initarg :root-y
269 :type double-float))
270 (:metaclass alien-class))
271
272 (defclass button-press-event (timed-event)
273 ((x
274 :allocation :alien
275 :accessor event-x
276 :initarg :x
277 :type double-float)
278 (y
279 :allocation :alien
280 :accessor event-y
281 :initarg :y
282 :type double-float)
283 (state
284 :allocation :alien
285 :offset #.(size-of 'pointer)
286 :accessor event-state
287 :initarg :state
288 :type modifier-type)
289 (button
290 :allocation :alien
291 :accessor event-button
292 :initarg :button
293 :type unsigned-int)
294 (device
295 :allocation :alien
296 :accessor event-device
297 :initarg :device
298 :type device)
299 (root-x
300 :allocation :alien
301 :accessor event-root-x
302 :initarg :root-x
303 :type double-float)
304 (root-y
305 :allocation :alien
306 :accessor event-root-y
307 :initarg :root-y
308 :type double-float))
309 (:metaclass alien-class))
310
311 (defclass 2-button-press-event (button-press-event)
312 ()
313 (:metaclass alien-class))
314
315 (defclass 3-button-press-event (button-press-event)
316 ()
317 (:metaclass alien-class))
318
319 (defclass button-release-event (button-press-event)
320 ()
321 (:metaclass alien-class))
322
323 (defclass key-press-event (event)
324 ()
325 (:metaclass alien-class))
326
327 (defclass key-release-event (event)
328 ()
329 (:metaclass alien-class))
330
331 (defclass enter-notify-event (event)
332 ()
333 (:metaclass alien-class))
334
335 (defclass leave-notify-event (event)
336 ()
337 (:metaclass alien-class))
338
339 (defclass focus-change-event (event)
340 ()
341 (:metaclass alien-class))
342
343 (defclass configure-event (event)
344 ((x
345 :allocation :alien
346 :accessor event-x
347 :initarg :x
348 :type int)
349 (y
350 :allocation :alien
351 :accessor event-y
352 :initarg :y
353 :type int)
354 (width
355 :allocation :alien
356 :accessor event-width
357 :initarg :width
358 :type int)
359 (height
360 :allocation :alien
361 :accessor event-height
362 :initarg :height
363 :type int))
364 (:metaclass alien-class))
365
366 (defclass map-event (event)
367 ()
368 (:metaclass alien-class))
369
370 (defclass unmap-event (event)
371 ()
372 (:metaclass alien-class))
373
374 (defclass property-notify-event (event)
375 ()
376 (:metaclass alien-class))
377
378 (defclass selection-clear-event (event)
379 ()
380 (:metaclass alien-class))
381
382 (defclass selection-request-event (event)
383 ()
384 (:metaclass alien-class))
385
386 (defclass selection-notify-event (event)
387 ()
388 (:metaclass alien-class))
389
390 (defclass drag-enter-event (event)
391 ()
392 (:metaclass alien-class))
393
394 (defclass drag-leave-event (event)
395 ()
396 (:metaclass alien-class))
397
398 (defclass drag-motion-event (event)
399 ()
400 (:metaclass alien-class))
401
402 (defclass drag-status-event (event)
403 ()
404 (:metaclass alien-class))
405
406 (defclass drag-start-event (event)
407 ()
408 (:metaclass alien-class))
409
410 (defclass drag-finished-event (event)
411 ()
412 (:metaclass alien-class))
413
414 (defclass client-event (event)
415 ()
416 (:metaclass alien-class))
417
418 (defclass visibility-notify-event (event)
419 ((state
420 :allocation :alien
421 :accessor event-state
422 :initarg :state
423 :type visibility-state))
424 (:metaclass alien-class))
425
426 (defclass no-expose-event (event)
427 ()
428 (:metaclass alien-class))
429
430 (defclass scroll-event (timed-event)
431 ()
432 (:metaclass alien-class))
433