Retrieve root window the correct way
[clg] / glib / gparam.lisp
index 530e0a2..c589a18 100644 (file)
 ;; License along with this library; if not, write to the Free Software
 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-;; $Id: gparam.lisp,v 1.2 2001-04-29 20:17:52 espen Exp $
+;; $Id: gparam.lisp,v 1.7 2004-10-27 14:59:00 espen Exp $
 
 (in-package "GLIB")
 
 (deftype gvalue () 'pointer)
 
-(defconstant +gvalue-size+ (+ (size-of 'type-number) (* 4 (size-of 'double-float))))
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (defbinding (size-of-gvalue "size_of_gvalue") () unsigned-int))
+
+(defconstant +gvalue-size+ (+ (size-of 'type-number) (* 2 (size-of 'double-float))))
+(defconstant +gvalue-size+ #.(size-of-gvalue))
+
 (defconstant +gvalue-value-offset+ (size-of 'type-number))
 
-(define-foreign ("g_value_init" gvalue-init) () nil
+(defbinding (gvalue-init "g_value_init") () nil
+  (value gvalue)
   (type type-number))
 
-(defun gvalue-new (type)
+(defun gvalue-new (type &optional (value nil value-p))
   (let ((gvalue (allocate-memory +gvalue-size+)))
-    (setf (system:sap-ref-32 gvalue 0) type)
-;    (gvalue-init (type-number-of type))
+    (gvalue-init gvalue (find-type-number type))
+    (when value-p
+      (gvalue-set gvalue value))
     gvalue))
 
 (defun gvalue-free (gvalue free-content)
   value)
 
 
+(deftype-method unreference-alien gvalue (type-spec location)
+  `(gvalue-free ,location nil))
+
+
+
 (deftype param-flag-type ()
   '(flags
-    :readable
-    :writable
-    :construct
-    :construct-only
-    :lax-validation
-    :private))
-
-(eval-when (:compile-toplevel :load-toplevel :execute)
+    (:readable 1)
+    (:writable 2)
+    (:construct 4)
+    (:construct-only 8)
+    (:lax-validation 16)
+    (:private 32)))
+
+;(eval-when (:compile-toplevel :load-toplevel :execute)
+;; TODO: rename to param-spec
   (defclass param (ginstance)
     ((name
       :allocation :alien
       :reader param-name
       :type string)
-     (nickname
-      :allocation :alien
-      :reader param-nickname
-      :type string)
-     (documentation
-      :allocation :alien
-      :reader param-documentation
-      :type string)
      (flags
       :allocation :alien
       :reader param-flags
       :type param-flag-type)
-     (type
+     (value-type
       :allocation :alien
-      :reader param-type
-      :type type-number))
+      :reader param-value-type
+      :type type-number)
+     (owner-type
+      :allocation :alien
+      :reader param-owner-type
+      :type type-number)
+     (nickname
+      :allocation :virtual
+      :getter "g_param_spec_get_nick"
+      :reader param-nickname
+      :type string)
+     (documentation
+      :allocation :virtual
+      :getter "g_param_spec_get_blurb"
+      :reader param-documentation
+      :type string))
     (:metaclass ginstance-class)
     (:ref "g_param_spec_ref")
-    (:unref "g_param_spec_unref")))
+    (:unref "g_param_spec_unref"));)
 
 
 (defclass param-char (param)
     :type unsigned-int))
   (:metaclass ginstance-class))
 
-(defclass param-closure (param)
-  ()
-  (:metaclass ginstance-class))
+;; (defclass param-closure (param)
+;;   ()
+;;   (:metaclass ginstance-class))
 
 (defclass param-object (param)
   ()
   (:metaclass ginstance-class))
-
-
-