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