X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/73572c12ccd49c661d06287903bfa725f5fd93a5..a7d19b2a6d3e11b28842476b80ef68d81fb6b8ac:/glib/gparam.lisp diff --git a/glib/gparam.lisp b/glib/gparam.lisp index d2a4b01..86fe82c 100644 --- a/glib/gparam.lisp +++ b/glib/gparam.lisp @@ -1,27 +1,32 @@ -;; Common Lisp bindings for GTK+ v2.0 -;; Copyright (C) 2000 Espen S. Johnsen +;; Common Lisp bindings for GTK+ v2.x +;; Copyright 2000-2005 Espen S. Johnsen ;; -;; This library is free software; you can redistribute it and/or -;; modify it under the terms of the GNU Lesser General Public -;; License as published by the Free Software Foundation; either -;; version 2 of the License, or (at your option) any later version. +;; Permission is hereby granted, free of charge, to any person obtaining +;; a copy of this software and associated documentation files (the +;; "Software"), to deal in the Software without restriction, including +;; without limitation the rights to use, copy, modify, merge, publish, +;; distribute, sublicense, and/or sell copies of the Software, and to +;; permit persons to whom the Software is furnished to do so, subject to +;; the following conditions: ;; -;; This library is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; Lesser General Public License for more details. +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. ;; -;; You should have received a copy of the GNU Lesser General Public -;; License along with this library; if not, write to the Free Software -;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: gparam.lisp,v 1.15 2005-02-03 23:09:04 espen Exp $ +;; $Id: gparam.lisp,v 1.20 2006-02-15 09:55:50 espen Exp $ (in-package "GLIB") (deftype gvalue () 'pointer) -(register-type 'gvalue "GValue") +(register-type 'gvalue '|g_value_get_type|) (eval-when (:compile-toplevel :load-toplevel :execute) (defbinding (size-of-gvalue "size_of_gvalue") () unsigned-int)) @@ -59,9 +64,9 @@ (defun gvalue-free (gvalue &optional (unset-p t)) (defun gvalue-type (gvalue) (type-from-number (sap-ref-32 gvalue 0))) -(defun gvalue-get (gvalue) +(defun gvalue-get (gvalue &optional weak-p) (funcall (reader-function (gvalue-type gvalue)) - gvalue +gvalue-value-offset+)) + gvalue +gvalue-value-offset+ weak-p)) (defun gvalue-set (gvalue value) (funcall (writer-function (gvalue-type gvalue)) @@ -72,15 +77,12 @@ (defbinding (gvalue-p "g_type_check_value") () boolean (location pointer)) (defmacro with-gvalue ((gvalue &optional type (value nil value-p)) &body body) - `(let ((,gvalue ,(cond - ((and type value-p) `(gvalue-new ,type ,value)) - (type `(gvalue-new ,type)) - (`(gvalue-new))))) - (unwind-protect - (progn - ,@body - ,(unless value-p `(gvalue-get ,gvalue))) - (gvalue-free ,gvalue)))) + `(with-allocated-memory (,gvalue +gvalue-size+) + ,(cond + ((and type value-p) `(gvalue-init ,gvalue ,type ,value)) + (type `(gvalue-init ,gvalue ,type))) + ,@body + ,(unless value-p `(gvalue-get ,gvalue)))) (deftype param-flag-type () @@ -145,7 +147,8 @@ (defclass param (ginstance) :getter "g_param_spec_get_blurb" :reader param-documentation :type (copy-of string))) - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParam")) (defclass param-char (param) @@ -161,7 +164,8 @@ (default-value :allocation :alien :reader param-char-default-value :type char)) - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamChar")) (defclass param-unsigned-char (param) ( @@ -179,14 +183,15 @@ (defclass param-unsigned-char (param) ; :type unsigned-char) ) (:metaclass param-spec-class) - (:alien-name "GParamUChar")) + (:gtype "GParamUChar")) (defclass param-boolean (param) ((default-value :allocation :alien :reader param-boolean-default-value :type boolean)) - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamBoolean")) (defclass param-int (param) ((minimum @@ -201,7 +206,8 @@ (default-value :allocation :alien :reader param-int-default-value :type int)) - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamInt")) (defclass param-unsigned-int (param) ((minimum @@ -217,7 +223,7 @@ (default-value :reader param-unsigned-int-default-value :type unsigned-int)) (:metaclass param-spec-class) - (:alien-name "GParamUInt")) + (:gtype "GParamUInt")) (defclass param-long (param) ((minimum @@ -232,7 +238,8 @@ (default-value :allocation :alien :reader param-long-default-value :type long)) - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParam")) (defclass param-unsigned-long (param) ((minimum @@ -248,11 +255,12 @@ (default-value :reader param-unsigned-long-default-value :type unsigned-long)) (:metaclass param-spec-class) - (:alien-name "GParamULong")) + (:gtype "GParamULong")) (defclass param-unichar (param) () - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamUnichar")) (defclass param-enum (param) ((class @@ -263,7 +271,8 @@ (default-value :allocation :alien :reader param-enum-default-value :type long)) - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamEnum")) (defclass param-flags (param) ((class @@ -274,7 +283,8 @@ (default-value :allocation :alien :reader param-flags-default-value :type long)) - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamFlags")) (defclass param-single-float (param) ((minimum @@ -294,7 +304,7 @@ (default-value :reader param-single-float-epsilon :type single-float)) (:metaclass param-spec-class) - (:alien-name "GParamFloat")) + (:gtype "GParamFloat")) (defclass param-double-float (param) ((minimum @@ -314,26 +324,30 @@ (default-value :reader param-double-float-epsilon :type double-float)) (:metaclass param-spec-class) - (:alien-name "GParamDouble")) + (:gtype "GParamDouble")) (defclass param-string (param) ((default-value :allocation :alien :reader param-string-default-value :type string)) - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamString")) (defclass param-param (param) () - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamParam")) (defclass param-boxed (param) () - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamBoxed")) (defclass param-pointer (param) () - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamPointer")) (defclass param-value-array (param) ((element-spec @@ -344,12 +358,15 @@ (defclass param-value-array (param) :allocation :alien :reader param-value-array-length :type unsigned-int)) - (:metaclass param-spec-class)) - -;; (defclass param-closure (param) -;; () -;; (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamValueArray")) (defclass param-object (param) () - (:metaclass param-spec-class)) + (:metaclass param-spec-class) + (:gtype "GParamObject")) + +(defclass param-overrride (param) + () + (:metaclass param-spec-class) + (:gtype "GParamOverride"))