chiark / gitweb /
Added declaration to get rid of a couple of warnings.
[clg] / gdk / gdktypes.lisp
1 ;; Common Lisp bindings for GTK+ v2.0
2 ;; Copyright (C) 1999-2001 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.15 2005-02-26 18:53:33 espen Exp $
19
20 (in-package "GDK")
21
22 (eval-when (:compile-toplevel :load-toplevel :execute)
23   (init-types-in-library #.(concatenate 'string
24                             (pkg-config:pkg-variable "gtk+-2.0" "libdir")
25                             "/libgdk-x11-2.0.so") :prefix "gdk_")
26   (init-types-in-library #.(concatenate 'string
27                             (pkg-config:pkg-variable "gtk+-2.0" "libdir")
28                             "/libgdk-x11-2.0.so") :prefix "_gdk_")
29   (init-types-in-library #.(concatenate 'string
30                             (pkg-config:pkg-variable "gtk+-2.0" "libdir")
31                             "/libgdk_pixbuf-2.0.so") :prefix "gdk_"))
32
33
34 (defclass color (boxed)
35   ((pixel
36     :allocation :alien
37     :type unsigned-long)
38    (red
39     :allocation :alien
40     :accessor color-red
41     :type unsigned-short)
42    (green
43     :allocation :alien
44     :accessor color-green
45     :type unsigned-short)
46    (blue
47     :allocation :alien
48     :accessor color-blue
49     :type unsigned-short))
50   (:metaclass boxed-class)
51   (:alien-name "GdkColor"))
52
53
54 (deftype point () '(vector int 2))
55 (deftype segment () '(vector int 4))
56 (deftype trapezoid () '(vector double-float 6))
57 (deftype atom () 'unsigned-int)
58
59
60 ;; Could this just as well have been a vector?
61 (defclass rectangle (boxed)
62   ((x
63     :allocation :alien
64     :accessor rectangle-x
65     :initarg :x
66     :type int)
67    (y
68     :allocation :alien
69     :accessor rectangle-y
70     :initarg :y
71     :type int)
72    (width
73     :allocation :alien
74     :accessor rectangle-width
75     :initarg :width
76     :type int)
77    (height
78     :allocation :alien
79     :accessor rectangle-height
80     :initarg :height
81     :type int))
82   (:metaclass boxed-class)
83   (:alien-name "GdkRectangle"))
84
85
86 (define-types-by-introspection "Gdk"
87   ("GdkFunction" :type gc-function)
88   ("GdkWMDecoration" :type wm-decoration)
89   ("GdkWMFunction" :type wm-function)
90   ("GdkGC" :type gc)
91   ("GdkGCX11" :type gc-x11)
92   ("GdkGCValuesMask" :type gc-values-mask)
93   ("GdkDrawableImplX11" :ignore t)
94   ("GdkWindowImplX11" :ignore t)
95   ("GdkPixmapImplX11" :ignore t)
96   ("GdkGCX11" :ignore t)
97   ("GdkColor" :ignore t)
98   ("GdkEvent" :ignore t)
99   ("GdkRectngle" :ignore t)
100   ("GdkCursor" :ignore t)
101   ("GdkFont" :ignore t) ; deprecated
102   ("GdkEventMask" :ignore t) ; manually defined
103
104   ("GdkDisplay"
105    :slots
106    ((name
107      :allocation :virtual
108      :getter "gdk_display_get_name"
109      :reader display-name
110      :type (copy-of string))
111     (screens
112      :allocation :virtual
113      :getter display-screens)
114     (devices
115      :allocation :virtual
116      :getter "gdk_display_list_devices"
117      :reader display-devices
118      :type (copy-of (glist device)))))
119
120   ("GdkDrawable"
121    :slots
122    ((display
123      :allocation :virtual
124      :getter "gdk_drawable_get_display"
125      :reader drawable-display
126      :type display)
127     (screen
128      :allocation :virtual
129      :getter "gdk_drawable_get_screen"
130      :reader drawable-screen
131      :type screen)
132     (visual
133      :allocation :virtual
134      :getter "gdk_drawable_get_visual"
135      :reader drawable-visual
136      :type visual)
137     (colormap
138      :allocation :virtual
139      :getter "gdk_drawable_get_colormap"
140      :setter "gdk_drawable_set_colormap"
141      :unbound nil
142      :accessor drawable-colormap
143      :initarg :colormap
144      :type colormap)
145     (depth
146      :allocation :virtual
147      :getter "gdk_drawable_get_depth"
148      :reader drawable-depth
149      :type int)
150     (with 
151      :allocation :virtual
152      :getter drawable-width)
153     (height
154      :allocation :virtual
155      :getter drawable-height)))
156   
157   ("GdkWindow"
158    :slots
159    ((state
160      :allocation :virtual
161      :getter "gdk_window_get_state"
162      :reader window-state
163      :type window-state)
164     (parent
165      :allocation :virtual
166      :getter "gdk_window_get_parent"
167      :reader window-parent
168      :type window)
169     (toplevel
170      :allocation :virtual
171      :getter "gdk_window_get_toplevel"
172      :reader window-toplevel
173      :type window)
174     (children
175      :allocation :virtual
176      :getter "gdk_window_get_children"
177      :reader window-children
178      :type (glist window))
179     (events
180      :allocation :virtual
181      :getter "gdk_window_get_events"
182      :setter "gdk_window_set_events"
183      :accessor window-events
184      :type event-mask)
185     (group
186      :allocation :virtual
187      :getter "gdk_window_get_group"
188      :setter "gdk_window_set_group"
189      :unbound nil
190      :accessor window-group
191      :type window))))
192
193
194 (deftype bitmap () 'pixmap)
195
196 (defclass cursor (boxed)
197   ((type
198     :allocation :alien
199     :reader cursor-type
200     :type cursor-type)
201    (ref-count
202     :allocation :alien
203     :type unsigned-int)
204    (display
205     :allocation :virtual
206     :getter "gdk_cursor_get_display"
207     :reader cursor-display
208     :type display))
209   (:metaclass boxed-class)
210   (:alien-name "GdkCursor"))
211
212
213 (defclass geometry (struct)
214   ((min-width 
215     :allocation :alien
216     :accessor geometry-min-width
217     :initarg :min-width
218     :type int)
219    (min-height 
220     :allocation :alien
221     :accessor geometry-min-height
222     :initarg :min-height
223     :type int)
224    (max-width 
225     :allocation :alien
226     :accessor geometry-max-width
227     :initarg :max-width
228     :type int)
229    (max-height 
230     :allocation :alien
231     :accessor geometry-max-height
232     :initarg :max-height
233     :type int)
234    (base-width 
235     :allocation :alien
236     :accessor geometry-base-width
237     :initarg :base-width
238     :type int)
239    (base-height 
240     :allocation :alien
241     :accessor geometry-base-height
242     :initarg :base-height
243     :type int)
244    (width-inc
245     :allocation :alien
246     :accessor geometry-width-inc
247     :initarg :width-inc
248     :type int)
249    (height-inc
250     :allocation :alien
251     :accessor geometry-height-inc
252     :initarg :height-inc
253     :type int)
254    (min-aspect
255     :allocation :alien
256     :accessor geometry-min-aspect
257     :initarg :min-aspect
258     :type double-float)
259    (max-aspect
260     :allocation :alien
261     :accessor geometry-max-aspect
262     :initarg :max-aspect
263     :type double-float)
264    (gravity
265     :allocation :alien
266     :accessor geometry-gravity
267     :initarg :gravity
268     :type gravity))
269   (:metaclass struct-class))