chiark / gitweb /
Automatic definition of EVENT-MASK overridden with manual definition
[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.14 2005/02/26 10:44:09 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   ("GdkDrawable"
105    :slots
106    ((display
107      :allocation :virtual
108      :getter "gdk_drawable_get_display"
109      :reader drawable-display
110      :type display)
111     (screen
112      :allocation :virtual
113      :getter "gdk_drawable_get_screen"
114      :reader drawable-screen
115      :type screen)
116     (visual
117      :allocation :virtual
118      :getter "gdk_drawable_get_visual"
119      :reader drawable-visual
120      :type visual)
121     (colormap
122      :allocation :virtual
123      :getter "gdk_drawable_get_colormap"
124      :setter "gdk_drawable_set_colormap"
125      :unbound nil
126      :accessor drawable-colormap
127      :initarg :colormap
128      :type colormap)
129     (depth
130      :allocation :virtual
131      :getter "gdk_drawable_get_depth"
132      :reader drawable-depth
133      :type int)
134     (with 
135      :allocation :virtual
136      :getter drawable-width)
137     (height
138      :allocation :virtual
139      :getter drawable-height)))
140   
141   ("GdkWindow"
142    :slots
143    ((state
144      :allocation :virtual
145      :getter "gdk_window_get_state"
146      :reader window-state
147      :type window-state)
148     (parent
149      :allocation :virtual
150      :getter "gdk_window_get_parent"
151      :reader window-parent
152      :type window)
153     (toplevel
154      :allocation :virtual
155      :getter "gdk_window_get_toplevel"
156      :reader window-toplevel
157      :type window)
158     (children
159      :allocation :virtual
160      :getter "gdk_window_get_children"
161      :reader window-children
162      :type (glist window))
163     (events
164      :allocation :virtual
165      :getter "gdk_window_get_events"
166      :setter "gdk_window_set_events"
167      :accessor window-events
168      :type event-mask)
169     (group
170      :allocation :virtual
171      :getter "gdk_window_get_group"
172      :setter "gdk_window_set_group"
173      :unbound nil
174      :accessor window-group
175      :type window))))
176
177
178 (deftype bitmap () 'pixmap)
179
180 (defclass cursor (boxed)
181   ((type
182     :allocation :alien
183     :reader cursor-type
184     :type cursor-type)
185    (ref-count
186     :allocation :alien
187     :type unsigned-int)
188    (display
189     :allocation :virtual
190     :getter "gdk_cursor_get_display"
191     :reader cursor-display
192     :type display))
193   (:metaclass boxed-class)
194   (:alien-name "GdkCursor"))
195
196
197 (defclass geometry (struct)
198   ((min-width 
199     :allocation :alien
200     :accessor geometry-min-width
201     :initarg :min-width
202     :type int)
203    (min-height 
204     :allocation :alien
205     :accessor geometry-min-height
206     :initarg :min-height
207     :type int)
208    (max-width 
209     :allocation :alien
210     :accessor geometry-max-width
211     :initarg :max-width
212     :type int)
213    (max-height 
214     :allocation :alien
215     :accessor geometry-max-height
216     :initarg :max-height
217     :type int)
218    (base-width 
219     :allocation :alien
220     :accessor geometry-base-width
221     :initarg :base-width
222     :type int)
223    (base-height 
224     :allocation :alien
225     :accessor geometry-base-height
226     :initarg :base-height
227     :type int)
228    (width-inc
229     :allocation :alien
230     :accessor geometry-width-inc
231     :initarg :width-inc
232     :type int)
233    (height-inc
234     :allocation :alien
235     :accessor geometry-height-inc
236     :initarg :height-inc
237     :type int)
238    (min-aspect
239     :allocation :alien
240     :accessor geometry-min-aspect
241     :initarg :min-aspect
242     :type double-float)
243    (max-aspect
244     :allocation :alien
245     :accessor geometry-max-aspect
246     :initarg :max-aspect
247     :type double-float)
248    (gravity
249     :allocation :alien
250     :accessor geometry-gravity
251     :initarg :gravity
252     :type gravity))
253   (:metaclass struct-class))