01ddf68881f0ab77d8c1353d8a933e85ab62c38a
[clg] / gdk / gdktypes.lisp
1 ;; Common Lisp bindings for GTK+ v2.x
2 ;; Copyright 2000-2005 Espen S. Johnsen <espen@users.sf.net>
3 ;;
4 ;; Permission is hereby granted, free of charge, to any person obtaining
5 ;; a copy of this software and associated documentation files (the
6 ;; "Software"), to deal in the Software without restriction, including
7 ;; without limitation the rights to use, copy, modify, merge, publish,
8 ;; distribute, sublicense, and/or sell copies of the Software, and to
9 ;; permit persons to whom the Software is furnished to do so, subject to
10 ;; the following conditions:
11 ;;
12 ;; The above copyright notice and this permission notice shall be
13 ;; included in all copies or substantial portions of the Software.
14 ;;
15 ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 ;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 ;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 ;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 ;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 ;; $Id: gdktypes.lisp,v 1.19 2005-04-23 16:48:50 espen Exp $
24
25 (in-package "GDK")
26
27 (eval-when (:compile-toplevel :load-toplevel :execute)
28 (init-types-in-library #.(concatenate 'string
29 (pkg-config:pkg-variable "gtk+-2.0" "libdir")
30 "/libgdk-x11-2.0.so") :prefix ("gdk_" "_gdk_"))
31 (init-types-in-library #.(concatenate 'string
32 (pkg-config:pkg-variable "gtk+-2.0" "libdir")
33 "/libgdk_pixbuf-2.0.so") :prefix "gdk_"))
34
35
36 (defclass color (boxed)
37 ((pixel
38 :allocation :alien
39 :type unsigned-long)
40 (red
41 :allocation :alien
42 :accessor color-red
43 :type unsigned-short)
44 (green
45 :allocation :alien
46 :accessor color-green
47 :type unsigned-short)
48 (blue
49 :allocation :alien
50 :accessor color-blue
51 :type unsigned-short))
52 (:metaclass boxed-class))
53
54
55 (deftype point () '(vector int 2))
56 (deftype segment () '(vector int 4))
57 (deftype trapezoid () '(vector double-float 6))
58 (deftype atom () 'unsigned-int)
59
60
61 ;; Could this just as well have been a vector?
62 (defclass rectangle (boxed)
63 ((x
64 :allocation :alien
65 :accessor rectangle-x
66 :initarg :x
67 :type int)
68 (y
69 :allocation :alien
70 :accessor rectangle-y
71 :initarg :y
72 :type int)
73 (width
74 :allocation :alien
75 :accessor rectangle-width
76 :initarg :width
77 :type int)
78 (height
79 :allocation :alien
80 :accessor rectangle-height
81 :initarg :height
82 :type int))
83 (:metaclass boxed-class))
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
211
212 (defclass geometry (struct)
213 ((min-width
214 :allocation :alien
215 :accessor geometry-min-width
216 :initarg :min-width
217 :type int)
218 (min-height
219 :allocation :alien
220 :accessor geometry-min-height
221 :initarg :min-height
222 :type int)
223 (max-width
224 :allocation :alien
225 :accessor geometry-max-width
226 :initarg :max-width
227 :type int)
228 (max-height
229 :allocation :alien
230 :accessor geometry-max-height
231 :initarg :max-height
232 :type int)
233 (base-width
234 :allocation :alien
235 :accessor geometry-base-width
236 :initarg :base-width
237 :type int)
238 (base-height
239 :allocation :alien
240 :accessor geometry-base-height
241 :initarg :base-height
242 :type int)
243 (width-inc
244 :allocation :alien
245 :accessor geometry-width-inc
246 :initarg :width-inc
247 :type int)
248 (height-inc
249 :allocation :alien
250 :accessor geometry-height-inc
251 :initarg :height-inc
252 :type int)
253 (min-aspect
254 :allocation :alien
255 :accessor geometry-min-aspect
256 :initarg :min-aspect
257 :type double-float)
258 (max-aspect
259 :allocation :alien
260 :accessor geometry-max-aspect
261 :initarg :max-aspect
262 :type double-float)
263 (gravity
264 :allocation :alien
265 :accessor geometry-gravity
266 :initarg :gravity
267 :type gravity))
268 (:metaclass struct-class))