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