3 (defcfun gtk-container-child-get-property
:void
6 (property-name :string
)
7 (value (:pointer g-value
)))
9 (defcfun gtk-container-child-set-property
:void
12 (property-name :string
)
13 (value (:pointer g-value
)))
15 (defcfun gtk-container-class-find-child-property
:pointer
17 (property-name :string
))
19 (defun container-child-property-info (type property-name
)
20 (let ((class (g-type-class-ref type
)))
22 (let ((g-param-spec (gtk-container-class-find-child-property class property-name
)))
23 (parse-g-param-spec g-param-spec
))
24 (g-type-class-unref class
))))
26 (export 'container-child-property-info
)
28 (defun container-call-get-property (container child property-name type
)
29 (with-foreign-object (gvalue 'g-value
)
31 (g-value-init gvalue
(ensure-g-type type
))
32 (gtk-container-child-get-property container child property-name gvalue
)
33 (prog1 (parse-g-value gvalue
)
34 (g-value-unset gvalue
))))
36 (defun container-call-set-property (container child property-name new-value type
)
37 (with-foreign-object (gvalue 'g-value
)
38 (set-g-value gvalue new-value
(ensure-g-type type
) :zero-g-value t
)
39 (gtk-container-child-set-property container child property-name gvalue
)
40 (g-value-unset gvalue
)
43 (export '(container-call-get-property container-call-set-property
))
45 (defmacro define-child-property
(container-type property-name property-gname property-type readable writable export
)
46 (when (stringp container-type
) (setf container-type
(registered-object-type-by-name container-type
)))
49 (list `(defun ,property-name
(container child
)
50 (assert (typep container
',container-type
))
51 (container-call-get-property container child
,property-gname
,property-type
))))
53 (list `(defun (setf ,property-name
) (new-value container child
)
54 (assert (typep container
',container-type
))
55 (container-call-set-property container child
,property-gname new-value
,property-type
))))
57 (list `(export ',property-name
)))))
59 (defcfun gtk-container-class-list-child-properties
(:pointer
(:pointer g-param-spec
))
60 (class (:pointer g-object-class
))
61 (n-properties (:pointer
:int
)))
63 (defun container-class-child-properties (g-type)
64 (setf g-type
(ensure-g-type g-type
))
65 (let ((g-class (g-type-class-ref g-type
)))
67 (with-foreign-object (n-properties :uint
)
68 (let ((params (gtk-container-class-list-child-properties g-class n-properties
)))
71 for i from
0 below
(mem-ref n-properties
:uint
)
72 for param
= (mem-aref params
:pointer i
)
73 collect
(parse-g-param-spec param
))
75 (g-type-class-unref g-class
))))
77 (defun child-property-name (type-name property-name package-name
)
78 (intern (format nil
"~A-CHILD-~A" (symbol-name (registered-object-type-by-name type-name
)) (string-upcase property-name
)) (find-package package-name
)))
80 (defun generate-child-properties (&optional
(type-root "GtkContainer") (package-name "GTK"))
81 (setf type-root
(ensure-g-type type-root
))
83 for property in
(container-class-child-properties type-root
)
85 `(define-child-property
86 ,(g-type-name type-root
)
87 ,(child-property-name (g-type-name type-root
) (g-class-property-definition-name property
) package-name
)
88 ,(g-class-property-definition-name property
)
89 ,(g-type-name (g-class-property-definition-type property
))
90 ,(g-class-property-definition-readable property
)
91 ,(g-class-property-definition-writable property
)
94 for subclass in
(g-type-children type-root
)
95 appending
(generate-child-properties subclass package-name
))))