112ac1d3 |
1 | ;; Common Lisp bindings for GTK+ v2.x |
4bd4e583 |
2 | ;; Copyright 2000-2006 Espen S. Johnsen <espen@users.sf.net> |
560af5c5 |
3 | ;; |
112ac1d3 |
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: |
560af5c5 |
11 | ;; |
112ac1d3 |
12 | ;; The above copyright notice and this permission notice shall be |
13 | ;; included in all copies or substantial portions of the Software. |
560af5c5 |
14 | ;; |
112ac1d3 |
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. |
560af5c5 |
22 | |
4bd4e583 |
23 | ;; $Id: gdktypes.lisp,v 1.24 2006-04-26 09:21:39 espen Exp $ |
560af5c5 |
24 | |
25 | (in-package "GDK") |
26 | |
5681ca3c |
27 | (eval-when (:compile-toplevel :load-toplevel :execute) |
9adccb27 |
28 | (init-types-in-library #.(concatenate 'string |
29 | (pkg-config:pkg-variable "gtk+-2.0" "libdir") |
c046c2f6 |
30 | "/libgdk-x11-2.0.so") :prefix ("gdk_" "_gdk_")) |
9adccb27 |
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 | |
560af5c5 |
35 | |
e34e751a |
36 | (defclass color (boxed) |
560af5c5 |
37 | ((pixel |
38 | :allocation :alien |
d02a77d7 |
39 | :type (unsigned 32)) |
560af5c5 |
40 | (red |
41 | :allocation :alien |
42 | :accessor color-red |
d02a77d7 |
43 | :type (unsigned 16)) |
560af5c5 |
44 | (green |
4bd4e583 |
45 | :allocation :alien |
ceebb351 |
46 | :accessor color-green |
d02a77d7 |
47 | :type (unsigned 16)) |
560af5c5 |
48 | (blue |
4bd4e583 |
49 | :allocation :alien |
560af5c5 |
50 | :accessor color-blue |
d02a77d7 |
51 | :type (unsigned 16))) |
4bd4e583 |
52 | (:metaclass boxed-class) |
53 | (:packed t)) |
560af5c5 |
54 | |
55 | |
06cb4af7 |
56 | (deftype point () '(vector int 2)) |
57 | (deftype segment () '(vector int 4)) |
58 | (deftype trapezoid () '(vector double-float 6)) |
628fd576 |
59 | (deftype atom () 'unsigned-int) |
06cb4af7 |
60 | |
61 | |
62 | ;; Could this just as well have been a vector? |
63 | (defclass rectangle (boxed) |
64 | ((x |
65 | :allocation :alien |
66 | :accessor rectangle-x |
67 | :initarg :x |
68 | :type int) |
69 | (y |
70 | :allocation :alien |
71 | :accessor rectangle-y |
72 | :initarg :y |
73 | :type int) |
74 | (width |
75 | :allocation :alien |
76 | :accessor rectangle-width |
77 | :initarg :width |
78 | :type int) |
79 | (height |
80 | :allocation :alien |
81 | :accessor rectangle-height |
82 | :initarg :height |
83 | :type int)) |
dfa4f314 |
84 | (:metaclass boxed-class)) |
06cb4af7 |
85 | |
4bd4e583 |
86 | (register-type 'event-mask '|gdk_event_mask_get_type|) |
87 | (define-flags-type event-mask |
88 | (:exposure 2) |
89 | :pointer-motion |
90 | :pointer-motion-hint |
91 | :button-motion |
92 | :button1-motion |
93 | :button2-motion |
94 | :button3-motion |
95 | :button-press |
96 | :button-release |
97 | :key-press |
98 | :key-release |
99 | :enter-notify |
100 | :leave-notify |
101 | :focus-change |
102 | :structure |
103 | :property-change |
104 | :visibility-notify |
105 | :proximity-in |
106 | :proximity-out |
107 | :substructure |
108 | :scroll |
109 | (:all-events #x3FFFFE)) |
06cb4af7 |
110 | |
4bd4e583 |
111 | (register-type 'event-mask '|gdk_modifier_type_get_type|) |
112 | (define-flags-type modifier-type |
113 | :shift :lock :control :mod1 :mod2 :mod3 :mod4 :mod5 |
114 | :button1 :button2 :button3 :button4 :button5 |
115 | (:release #.(ash 1 30))) |
906b440e |
116 | |
117 | |
73572c12 |
118 | (define-types-by-introspection "Gdk" |
119 | ("GdkFunction" :type gc-function) |
120 | ("GdkWMDecoration" :type wm-decoration) |
121 | ("GdkWMFunction" :type wm-function) |
122 | ("GdkGC" :type gc) |
123 | ("GdkGCX11" :type gc-x11) |
124 | ("GdkGCValuesMask" :type gc-values-mask) |
125 | ("GdkDrawableImplX11" :ignore t) |
126 | ("GdkWindowImplX11" :ignore t) |
127 | ("GdkPixmapImplX11" :ignore t) |
128 | ("GdkGCX11" :ignore t) |
129 | ("GdkColor" :ignore t) |
130 | ("GdkEvent" :ignore t) |
1f091d01 |
131 | ("GdkRectangle" :ignore t) |
73572c12 |
132 | ("GdkCursor" :ignore t) |
133 | ("GdkFont" :ignore t) ; deprecated |
4280ef98 |
134 | ("GdkEventMask" :ignore t) ; manually defined |
906b440e |
135 | ("GdkModifierType" :ignore t) ; manually defined |
4280ef98 |
136 | |
4fac77f8 |
137 | ("GdkDisplay" |
138 | :slots |
139 | ((name |
140 | :allocation :virtual |
141 | :getter "gdk_display_get_name" |
142 | :reader display-name |
143 | :type (copy-of string)) |
144 | (screens |
145 | :allocation :virtual |
146 | :getter display-screens) |
147 | (devices |
148 | :allocation :virtual |
149 | :getter "gdk_display_list_devices" |
150 | :reader display-devices |
151 | :type (copy-of (glist device))))) |
152 | |
73572c12 |
153 | ("GdkDrawable" |
154 | :slots |
155 | ((display |
156 | :allocation :virtual |
157 | :getter "gdk_drawable_get_display" |
158 | :reader drawable-display |
159 | :type display) |
160 | (screen |
161 | :allocation :virtual |
162 | :getter "gdk_drawable_get_screen" |
163 | :reader drawable-screen |
164 | :type screen) |
165 | (visual |
166 | :allocation :virtual |
167 | :getter "gdk_drawable_get_visual" |
168 | :reader drawable-visual |
169 | :type visual) |
170 | (colormap |
171 | :allocation :virtual |
172 | :getter "gdk_drawable_get_colormap" |
173 | :setter "gdk_drawable_set_colormap" |
174 | :unbound nil |
175 | :accessor drawable-colormap |
176 | :initarg :colormap |
177 | :type colormap) |
178 | (depth |
179 | :allocation :virtual |
180 | :getter "gdk_drawable_get_depth" |
181 | :reader drawable-depth |
182 | :type int) |
183 | (with |
184 | :allocation :virtual |
185 | :getter drawable-width) |
186 | (height |
187 | :allocation :virtual |
188 | :getter drawable-height))) |
189 | |
190 | ("GdkWindow" |
191 | :slots |
192 | ((state |
193 | :allocation :virtual |
194 | :getter "gdk_window_get_state" |
195 | :reader window-state |
196 | :type window-state) |
197 | (parent |
198 | :allocation :virtual |
199 | :getter "gdk_window_get_parent" |
200 | :reader window-parent |
201 | :type window) |
202 | (toplevel |
203 | :allocation :virtual |
204 | :getter "gdk_window_get_toplevel" |
205 | :reader window-toplevel |
206 | :type window) |
207 | (children |
208 | :allocation :virtual |
209 | :getter "gdk_window_get_children" |
210 | :reader window-children |
211 | :type (glist window)) |
212 | (events |
213 | :allocation :virtual |
214 | :getter "gdk_window_get_events" |
215 | :setter "gdk_window_set_events" |
216 | :accessor window-events |
217 | :type event-mask) |
218 | (group |
219 | :allocation :virtual |
220 | :getter "gdk_window_get_group" |
221 | :setter "gdk_window_set_group" |
222 | :unbound nil |
223 | :accessor window-group |
224 | :type window)))) |
560af5c5 |
225 | |
560af5c5 |
226 | |
e34e751a |
227 | (deftype bitmap () 'pixmap) |
560af5c5 |
228 | |
73572c12 |
229 | (defclass cursor (boxed) |
560af5c5 |
230 | ((type |
231 | :allocation :alien |
06cb4af7 |
232 | :reader cursor-type |
233 | :type cursor-type) |
234 | (ref-count |
235 | :allocation :alien |
236 | :type unsigned-int) |
237 | (display |
238 | :allocation :virtual |
239 | :getter "gdk_cursor_get_display" |
240 | :reader cursor-display |
241 | :type display)) |
4bd4e583 |
242 | (:metaclass boxed-class) |
243 | (:ref %cursor-ref) |
244 | (:unref %cursor-unref)) |
4fc1b6fe |
245 | |
3a63ef2a |
246 | |
247 | (defclass geometry (struct) |
248 | ((min-width |
249 | :allocation :alien |
250 | :accessor geometry-min-width |
251 | :initarg :min-width |
252 | :type int) |
253 | (min-height |
254 | :allocation :alien |
255 | :accessor geometry-min-height |
256 | :initarg :min-height |
257 | :type int) |
258 | (max-width |
259 | :allocation :alien |
260 | :accessor geometry-max-width |
261 | :initarg :max-width |
262 | :type int) |
263 | (max-height |
264 | :allocation :alien |
265 | :accessor geometry-max-height |
266 | :initarg :max-height |
267 | :type int) |
268 | (base-width |
269 | :allocation :alien |
270 | :accessor geometry-base-width |
271 | :initarg :base-width |
272 | :type int) |
273 | (base-height |
274 | :allocation :alien |
275 | :accessor geometry-base-height |
276 | :initarg :base-height |
277 | :type int) |
278 | (width-inc |
279 | :allocation :alien |
280 | :accessor geometry-width-inc |
281 | :initarg :width-inc |
282 | :type int) |
283 | (height-inc |
284 | :allocation :alien |
285 | :accessor geometry-height-inc |
286 | :initarg :height-inc |
287 | :type int) |
288 | (min-aspect |
289 | :allocation :alien |
290 | :accessor geometry-min-aspect |
291 | :initarg :min-aspect |
292 | :type double-float) |
293 | (max-aspect |
294 | :allocation :alien |
295 | :accessor geometry-max-aspect |
296 | :initarg :max-aspect |
297 | :type double-float) |
298 | (gravity |
299 | :allocation :alien |
300 | :accessor geometry-gravity |
301 | :initarg :gravity |
302 | :type gravity)) |
303 | (:metaclass struct-class)) |
906b440e |
304 | |
4b2733dc |
305 | (deftype native-window () '(unsigned 32)) |