3 (defcfun gtk-builder-add-from-file
:uint
8 (defun builder-add-from-file (builder filename
)
9 (gtk-builder-add-from-file builder filename
(null-pointer)))
11 (export 'builder-add-from-file
)
13 (defcfun gtk-builder-add-from-string
:uint
19 (defun builder-add-from-string (builder string
)
20 (gtk-builder-add-from-string builder string -
1 (null-pointer)))
22 (export 'builder-add-from-string
)
24 (defcfun gtk-builder-add-objects-from-file
:uint
30 (defun builder-add-objects-from-file (builder filename object-ids
)
31 (let ((l (foreign-alloc :pointer
:count
(1+ (length object-ids
)))))
34 for object-id in object-ids
35 do
(setf (mem-aref l
:pointer i
) (foreign-string-alloc object-id
)))
37 (gtk-builder-add-objects-from-file builder filename l
(null-pointer))
40 repeat
(1- (length object-ids
))
41 do
(foreign-string-free (mem-aref l
:pointer i
)))
44 (export 'builder-add-objects-from-file
)
46 (defcfun gtk-builder-add-objects-from-string
:uint
53 (defun builder-add-objects-from-string (builder string object-ids
)
54 (let ((l (foreign-alloc :pointer
:count
(1+ (length object-ids
)))))
57 for object-id in object-ids
58 do
(setf (mem-aref l
:pointer i
) (foreign-string-alloc object-id
)))
60 (gtk-builder-add-objects-from-string builder string -
1 l
(null-pointer))
63 repeat
(1- (length object-ids
))
64 do
(foreign-string-free (mem-aref l
:pointer i
)))
67 (export 'builder-add-objects-from-string
)
69 (defcfun (builder-get-object "gtk_builder_get_object") g-object
73 (export 'builder-get-object
)
75 ; TODO: gtk_builder_get_objects
77 ; TOOD: move connect-flags to gobject
79 (defbitfield connect-flags
:after
:swapped
)
81 (defcallback builder-connect-func-callback
:void
82 ((builder g-object
) (object g-object
) (signal-name (:string
:free-from-foreign nil
))
83 (handler-name (:string
:free-from-foreign nil
)) (connect-object g-object
)
84 (flags connect-flags
) (data :pointer
))
86 (funcall (get-stable-pointer-value data
)
87 builder object signal-name handler-name connect-object flags
)
90 (defcfun gtk-builder-connect-signals-full
:void
95 (defun builder-connect-signals-full (builder func
)
96 (with-stable-pointer (ptr func
)
97 (gtk-builder-connect-signals-full builder
(callback builder-connect-func-callback
) ptr
)))
99 (export 'builder-connect-signals-full
)
101 (defun builder-connect-signals-simple (builder handlers-list
)
102 (flet ((connect-func (builder object signal-name handler-name connect-object flags
)
103 (declare (ignore builder connect-object
))
104 (let ((handler (find handler-name handlers-list
:key
'first
:test
'string
=)))
106 (g-signal-connect object signal-name
(second handler
) :after
(member :after flags
))))))
107 (builder-connect-signals-full builder
#'connect-func
)))
109 (export 'builder-connect-signals-simple
)
111 ; TODO: gtk_builder_get_type_from_name
113 ; TODO: gtk_builder_value_from_string
115 ; TODO: gtk_builder_value_from_string_type
117 (defmethod initialize-instance :after
((builder builder
) &key from-file from-string
)
119 (builder-add-from-file builder from-file
))
121 (builder-add-from-string builder from-string
)))