X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=glib%2Fgobject.package.lisp;h=25b6c6b7f22e071f371fffaaf2ea6e8ffd868d3b;hb=83211c074addf8951dab479ef7f319a85136bf88;hp=cbffca7118cd4147edcf917a6918c87dbef1abad;hpb=8b6767cf4830672f2d929b66031f561857b9f1cd;p=cl-gtk2.git diff --git a/glib/gobject.package.lisp b/glib/gobject.package.lisp index cbffca7..25b6c6b 100644 --- a/glib/gobject.package.lisp +++ b/glib/gobject.package.lisp @@ -1,10 +1,28 @@ (defpackage :gobject - (:use :cl :glib :cffi :tg :bordeaux-threads :iter :closer-mop) - (:export #:g-object - #:register-object-type - #:g-object-call-constructor - #:register-flags-type - #:register-enum-type + (:use :cl :glib :cffi :tg :bordeaux-threads :iter :closer-mop :gobject.ffi :gobject.type-info) + (:export #:+g-type-invalid+ + #:+g-type-void+ + #:+g-type-interface+ + #:+g-type-char+ + #:+g-type-uchar+ + #:+g-type-boolean+ + #:+g-type-int+ + #:+g-type-uint+ + #:+g-type-long+ + #:+g-type-ulong+ + #:+g-type-int64+ + #:+g-type-uint64+ + #:+g-type-enum+ + #:+g-type-flags+ + #:+g-type-float+ + #:+g-type-double+ + #:+g-type-string+ + #:+g-type-pointer+ + #:+g-type-boxed+ + #:+g-type-param+ + #:+g-type-object+ + #:g-object + #:pointer #:g-type-from-object #:g-type-name #:g-type-from-name @@ -17,8 +35,7 @@ #:define-g-flags #:fixed-array #:g-boxed-inline - #:g-boxed-ptr - #:boxed-c-structure-name + #:g-boxed-ptr #:define-g-interface #:release #:using @@ -31,7 +48,6 @@ #:with-stable-pointer #:release* #:disown-boxed-ref - #:pointer #:g-type-interface #:g-value #:register-object-type-implementation @@ -43,8 +59,40 @@ #:emit-signal #:g-value-unset #:g-value-zero - #:g-value-take-boxed #:g-value-init + #:g-type-class-ref + #:g-object-class + #:gobject-class + #:g-param-spec + #:type-instance + #:g-type-class-unref + #:registered-object-type-by-name + #:g-type-children + #:g-signal-lookup + #:g-type-parent + #:connect-signal + #:boxed-c-structure-name + #:g-type-designator + #:g-type-fundamental + #:g-type-depth + #:g-type-next-base + #:g-type-is-a + #:g-type-interfaces + #:g-type-interface-prerequisites + #:g-type-name + #:g-type-from-name + #:g-type + #:g-type-children + #:g-type-parent + #:g-type-designator + #:g-type-fundamental + #:g-type-depth + #:g-type-next-base + #:g-type-is-a + #:g-type-interfaces + #:g-type-interface-prerequisites + #:g-strv-get-type + #:g-closure-get-type #:g-class-property-definition #:g-class-property-definition-name #:g-class-property-definition-type @@ -53,24 +101,71 @@ #:g-class-property-definition-constructor #:g-class-property-definition-constructor-only #:g-class-property-definition-owner-type - #:g-type-class-ref - #:g-object-class - #:g-param-spec - #:type-instance #:parse-g-param-spec - #:g-type-class-unref - #:registered-object-type-by-name - #:g-type-children - #:g-signal-lookup)) + #:class-properties + #:interface-properties + #:enum-item + #:enum-item-name + #:enum-item-value + #:enum-item-nick + #:get-enum-items + #:flags-item + #:flags-item-name + #:flags-item-value + #:flags-item-nick + #:get-flags-items) + (:documentation + "CL-GTK2-GOBJECT is a binding to GObject type system. +For information on GObject, see its @a[http://library.gnome.org/devel/gobject/stable/]{documentation}. -(in-package :gobject) +CL-GTK2-GOBJECT is structured as follows: +@itemize{ +@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.} +@item{GObject wrapper that bridges Lisp language with GObject API.} +} -(eval-when (:compile-toplevel :load-toplevel :execute) - (define-foreign-library gobject - (:unix (:or "libgobject-2.0.so.0" "libgobject-2.0.so")) - (t "libgobject-2.0"))) +@begin[GObject instrospection API]{section} +The base of GObject type system is GType. GType is a numerical value that is the unique identifier of a registered type. +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}. -(use-foreign-library gobject) +There are several predefined GType values that correspond to fundamental or base types. +@begin{itemize} +@item{@variable{+g-type-invalid+}} +@item{@variable{+g-type-void+}} +@item{@variable{+g-type-interface+}} +@item{@variable{+g-type-char+}} +@item{@variable{+g-type-uchar+}} +@item{@variable{+g-type-boolean+}} +@item{@variable{+g-type-int+}} +@item{@variable{+g-type-uint+}} +@item{@variable{+g-type-long+}} +@item{@variable{+g-type-ulong+}} +@item{@variable{+g-type-int64+}} +@item{@variable{+g-type-uint64+}} +@item{@variable{+g-type-enum+}} +@item{@variable{+g-type-flags+}} +@item{@variable{+g-type-float+}} +@item{@variable{+g-type-double+}} +@item{@variable{+g-type-string+}} +@item{@variable{+g-type-pointer+}} +@item{@variable{+g-type-boxed+}} +@item{@variable{+g-type-param+}} +@item{@variable{+g-type-object+}} +@end{itemize} + +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. + +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. + +//TODO: document and refactor signals + +@end{section} + +@begin[GValue]{section} +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. +@end{section}")) + +(in-package :gobject) (defvar *gobject-debug* nil)