+ :specializers (list (find-class t) (find-class 'widget))
+ :lambda-list '(value widget)
+ :documentation (or #?(sbcl>= 1 0 2)slot-documentation "automatically generated reader method")
+ :function #'(lambda (args next-methods)
+ (declare (ignore next-methods))
+ (destructuring-bind (value widget) args
+ (setf (child-property-value widget slot-name) value))))))
+
+
+(defmethod validate-superclass ((class container-child-class) (super standard-class))
+ ;(subtypep (class-name super) 'container-child)
+ t)
+
+
+(defclass container-child (virtual-slots-object)
+ ((parent :initarg :parent :type container)
+ (child :initarg :child :type widget)))
+
+
+;;;;
+
+(defbinding %container-class-list-child-properties () pointer
+ (class pointer)
+ (n-properties unsigned-int :out))
+
+(defun query-container-class-child-properties (type-number &optional owner-only-p)
+ (let ((class (type-class-ref type-number)))
+ (multiple-value-bind (array length)
+ (%container-class-list-child-properties class)
+ (unwind-protect
+ (let ((properties (map-c-vector 'list #'identity array 'param length)))
+ (if owner-only-p
+ (delete-if
+ #'(lambda (property)
+ (not (eql (slot-value property 'glib::owner-type) type-number)))
+ properties)
+ properties))
+ (deallocate-memory array)))))
+
+(defun default-container-child-name (container-class)
+ (intern (format nil "~A-CHILD" container-class)))
+
+(defun expand-container-type (type forward-p options)
+ (let* ((class (type-from-number type))
+ (super (supertype type))
+ (child-class (default-container-child-name class)))
+ (if forward-p
+ (expand-gobject-type type t options)
+ `(progn
+ ,(expand-gobject-type type nil options)
+ ,(let ((child-properties (query-container-class-child-properties type t)))
+ (when child-properties
+ `(defclass ,child-class (,(default-container-child-name super))
+ ,(slot-definitions child-class child-properties nil)
+ (:metaclass container-child-class)
+ (:container ,class))))))))
+
+(defun container-dependencies (type options)
+ (delete-duplicates
+ (append
+ (gobject-dependencies type options)
+ (mapcar #'param-value-type (query-container-class-child-properties type)))))
+
+(register-derivable-type 'container "GtkContainer" 'expand-container-type 'container-dependencies)
+
+
+(defmacro define-callback-setter (name arg return-type &rest rest-args)
+ (let ((callback (gensym)))
+ (if arg
+ `(progn
+ (define-callback-marshal ,callback ,return-type
+ ,(cons arg rest-args))
+ (defbinding ,name () nil
+ ,arg
+ (,callback callback)
+ (function user-callback)
+ (user-data-destroy-callback callback)))
+ `(progn
+ (define-callback-marshal ,callback ,return-type ,rest-args)
+ (defbinding ,name () nil
+ (,callback callback)
+ (function user-callback)
+ (user-data-destroy-callback callback))))))