X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=glib%2Fgobject.package.lisp;h=25b6c6b7f22e071f371fffaaf2ea6e8ffd868d3b;hb=6ee86a7254b0a8c1aa6e39795593a40966e4a3d9;hp=b02a772d9830bc588d8fb51e8fe63a64309b7b01;hpb=af90ac5cff9dbb5f44677cc4726eee60ab88bc5d;p=cl-gtk2.git diff --git a/glib/gobject.package.lisp b/glib/gobject.package.lisp index b02a772..25b6c6b 100644 --- a/glib/gobject.package.lisp +++ b/glib/gobject.package.lisp @@ -1,6 +1,27 @@ (defpackage :gobject - (:use :cl :glib :cffi :tg :bordeaux-threads :iter :closer-mop) - (:export #:g-object + (: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 @@ -39,62 +60,113 @@ #:g-value-unset #:g-value-zero #:g-value-init - #:g-class-property-definition - #:g-class-property-definition-name - #:g-class-property-definition-type - #:g-class-property-definition-readable - #:g-class-property-definition-writable - #:g-class-property-definition-constructor - #:g-class-property-definition-constructor-only - #:g-class-property-definition-owner-type #:g-type-class-ref #:g-object-class #:gobject-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 #:g-type-parent #:connect-signal - #:boxed-c-structure-name) + #: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 + #:g-class-property-definition-readable + #:g-class-property-definition-writable + #:g-class-property-definition-constructor + #:g-class-property-definition-constructor-only + #:g-class-property-definition-owner-type + #:parse-g-param-spec + #: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 -"This package contains bindings to GLib object system called GObject. + "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}. -It contains: +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.} +} + +@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}. + +There are several predefined GType values that correspond to fundamental or base types. @begin{itemize} -@item{type system} -@item{object system} -@item{utilities for memory management} +@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} -@begin[GObject type system querying]{section} -GObject type information can queried. Type is identified by GType — an integer. +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. -Function @fun{g-type-from-name} returns GType by its name, and function @fun{g-type-name} returns the name of a GType. Function @fun{ensure-g-type} is a convenience function that returns GType from either GType or its name. +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. -Functions @fun{g-type-parent} and @fun{g-type-children} inspect type hierarchy. -@end{section} +//TODO: document and refactor signals -@begin[GValue]{section} -GValue is a GObject's \"variant\"-like type. It can contain value of any type that GObject supports. The GValue is used for passing parameters to signal handlers, properties' getters and setters. Functions @fun{g-value-init}, @fun{g-value-unset}, @fun{g-value-zero}, @fun{parse-gvalue} and @fun{set-g-value} are used to init, reset, retrieve and assign GValue structures. @end{section} -@begin[Utilities]{section} -GObject contains implementation of stable pointers. Stable pointer is a reference that can be passed between FFI boundaries. Stable pointer is an integer that is allocated with @fun{allocate-stable-pointer}. This integer can be passed to other code and back. The value of this pointer (that is retrieved with @fun{get-stable-pointer-value}) is stable, staying the same until the pointer is freed with @fun{free-stable-pointer}. For convenience, @fun{with-stable-pointer} macro is provided. +@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) -(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"))) - -(use-foreign-library gobject) - (defvar *gobject-debug* nil) (defun debugf (&rest args)