Export g-object-call-constructor, g-object-call-get-property,
[cl-gtk2.git] / glib / gobject.package.lisp
1 (defpackage :gobject
2   (:use :cl :glib :cffi :tg :bordeaux-threads :iter :closer-mop :gobject.ffi)
3   (:export #:g-type
4            #:g-type-string
5            #:g-type-numeric
6            #:g-type-children
7            #:g-type-parent
8            #:g-type-designator
9            #:g-type-fundamental
10            #:g-type-depth
11            #:g-type-next-base
12            #:g-type-is-a
13            #:g-type-interfaces
14            #:g-type-interface-prerequisites
15            #:g-strv-get-type
16            #:g-closure-get-type
17            #:g-class-property-definition
18            #:g-class-property-definition-name
19            #:g-class-property-definition-type
20            #:g-class-property-definition-readable
21            #:g-class-property-definition-writable
22            #:g-class-property-definition-constructor
23            #:g-class-property-definition-constructor-only
24            #:g-class-property-definition-owner-type
25            #:parse-g-param-spec
26            #:class-properties
27            #:interface-properties
28            #:enum-item
29            #:enum-item-name
30            #:enum-item-value
31            #:enum-item-nick
32            #:get-enum-items
33            #:flags-item
34            #:flags-item-name
35            #:flags-item-value
36            #:flags-item-nick
37            #:get-flags-items
38            #:signal-info
39            #:signal-info-id
40            #:signal-info-name
41            #:signal-info-owner-type
42            #:signal-info-flags
43            #:signal-info-return-type
44            #:signal-info-param-types
45            #:signal-info-detail
46            #:query-signal-info
47            #:type-signals
48            #:parse-signal-name
49            #:class-property-info
50            #:+g-type-invalid+
51            #:+g-type-void+
52            #:+g-type-interface+
53            #:+g-type-char+
54            #:+g-type-uchar+
55            #:+g-type-boolean+
56            #:+g-type-int+
57            #:+g-type-uint+
58            #:+g-type-long+
59            #:+g-type-ulong+
60            #:+g-type-int64+
61            #:+g-type-uint64+
62            #:+g-type-enum+
63            #:+g-type-flags+
64            #:+g-type-float+
65            #:+g-type-double+
66            #:+g-type-string+
67            #:+g-type-pointer+
68            #:+g-type-boxed+
69            #:+g-type-param+
70            #:+g-type-object+
71            #:g-object
72            #:pointer
73            #:g-type-from-object
74            #:g-type-name
75            #:g-type-from-name
76            #:g-signal-connect
77            #:define-g-object-class
78            #:g-initially-unowned
79            #:define-g-enum
80            #:*lisp-name-package*
81            #:define-g-boxed-class
82            #:define-g-flags
83            #:fixed-array
84            #:g-boxed-inline
85            #:g-boxed-ptr
86            #:define-g-interface
87            #:release
88            #:using
89            #:using*
90            #:define-g-boxed-ref
91            #:g-boxed-ref
92            #:allocate-stable-pointer
93            #:free-stable-pointer
94            #:get-stable-pointer-value
95            #:with-stable-pointer
96            #:release*
97            #:disown-boxed-ref
98            #:g-type-interface
99            #:g-value
100            #:register-object-type-implementation
101            #:ensure-g-type
102            #:define-vtable
103            #:g-type
104            #:set-g-value
105            #:parse-g-value
106            #:emit-signal
107            #:g-value-unset
108            #:g-value-zero
109            #:g-value-init
110            #:g-type-class-ref
111            #:g-object-class
112            #:gobject-class
113            #:g-param-spec
114            #:type-instance
115            #:g-type-class-unref
116            #:registered-object-type-by-name
117            #:g-type-children
118            #:g-signal-lookup
119            #:g-type-parent
120            #:connect-signal
121            #:boxed-c-structure-name
122            #:g-type-designator
123            #:g-type-fundamental
124            #:g-type-depth
125            #:g-type-next-base
126            #:g-type-is-a
127            #:g-type-interfaces
128            #:g-type-interface-prerequisites
129            #:g-type-name
130            #:g-type-from-name
131            #:g-type
132            #:g-type-children
133            #:g-type-parent
134            #:g-type-designator
135            #:g-type-fundamental
136            #:g-type-depth
137            #:g-type-next-base
138            #:g-type-is-a
139            #:g-type-interfaces
140            #:g-type-interface-prerequisites
141            #:g-strv-get-type
142            #:g-closure-get-type
143            #:g-class-property-definition
144            #:g-class-property-definition-name
145            #:g-class-property-definition-type
146            #:g-class-property-definition-readable
147            #:g-class-property-definition-writable
148            #:g-class-property-definition-constructor
149            #:g-class-property-definition-constructor-only
150            #:g-class-property-definition-owner-type
151            #:parse-g-param-spec
152            #:class-properties
153            #:interface-properties
154            #:enum-item
155            #:enum-item-name
156            #:enum-item-value
157            #:enum-item-nick
158            #:get-enum-items
159            #:flags-item
160            #:flags-item-name
161            #:flags-item-value
162            #:flags-item-nick
163            #:get-flags-items
164            #:stable-pointer-value
165            #:g-value-type
166            #:create-g-closure
167            #:g-object-call-constructor
168            #:g-object-call-get-property
169            #:g-object-call-set-property)
170   (:documentation
171    "CL-GTK2-GOBJECT is a binding to GObject type system.
172 For information on GObject, see its @a[http://library.gnome.org/devel/gobject/stable/]{documentation}.
173
174 CL-GTK2-GOBJECT is structured as follows:
175 @itemize{
176 @item{Binding to GObject API, providing low-level means to use functionality of GObject. This includes introspection facilities and means to invoke functionality of GObject.}
177 @item{GObject wrapper that bridges Lisp language with GObject API.}
178 }
179
180 @begin[GObject instrospection API]{section}
181 The base of GObject type system is GType. GType is a numerical value that is the unique identifier of a registered type.
182 Each GType has a name that is retrieved with @fun{g-type-name}. Conversely, GType can be retrieved from its name via @fun{g-type-from-name}.
183
184 There are several predefined GType values that correspond to fundamental or base types.
185 @begin{itemize}
186 @item{@variable{+g-type-invalid+}}
187 @item{@variable{+g-type-void+}}
188 @item{@variable{+g-type-interface+}}
189 @item{@variable{+g-type-char+}}
190 @item{@variable{+g-type-uchar+}}
191 @item{@variable{+g-type-boolean+}}
192 @item{@variable{+g-type-int+}}
193 @item{@variable{+g-type-uint+}}
194 @item{@variable{+g-type-long+}}
195 @item{@variable{+g-type-ulong+}}
196 @item{@variable{+g-type-int64+}}
197 @item{@variable{+g-type-uint64+}}
198 @item{@variable{+g-type-enum+}}
199 @item{@variable{+g-type-flags+}}
200 @item{@variable{+g-type-float+}}
201 @item{@variable{+g-type-double+}}
202 @item{@variable{+g-type-string+}}
203 @item{@variable{+g-type-pointer+}}
204 @item{@variable{+g-type-boxed+}}
205 @item{@variable{+g-type-param+}}
206 @item{@variable{+g-type-object+}}
207 @end{itemize}
208
209 GType values form type hierarchies via signle inheritance. Functions @fun{g-type-parent} and @fun{g-type-children} enable to traverse through the type hierarchy.
210
211 For some types, additional information is available. Functions @fun{class-properties} and @fun{interface-properties} return properties of classes and interfaces. Functions @fun{get-enum-items} and @fun{get-flags-items} return members of enum and flags types.
212
213 //TODO: document and refactor signals
214
215 @end{section}
216
217 @begin[GValue]{section}
218 GObject uses GValues as a generic way to pass values. It is used when calling closures, emitting signals, setting and getting properties' values, passing values to object constructors. @class{g-value} foreign structure is used for holding GValue. It used like all foreign structures: either with @code{cffi:foreign-alloc} or with @code{cffi:with-foreign-object}. Before first use, @class{g-value} should be zeroed with @fun{g-value-zero}. Zeroed @class{g-value} may be configured to hold a GValue of a given type with @fun{g-value-init}. @fun{parse-g-value} retrieves the Lisp object corresponding to the value stored in GValue. @fun{set-g-value} sets the GValue from Lisp object.
219 @end{section}"))
220
221 (in-package :gobject)
222
223 (defvar *gobject-debug* nil)
224
225 (defun debugf (&rest args)
226   (when *gobject-debug*
227     (apply 'format t args)))