gobject.object

Module for [ObjectWrap] class

Module Initializers 1

shared static this()

Types 4

The base object type.

[gobject.object.ObjectWrap] is the fundamental type providing the common attributes and methods for all object types in GTK, Pango and other libraries based on GObject. The [gobject.object.ObjectWrap] class provides methods for object construction and destruction, property access methods, and signal support. Signals are described in detail [here][gobject-Signals].

For a tutorial on implementing a new [gobject.object.ObjectWrap] class, see How to define and implement a new GObject. For a list of naming conventions for GObjects and their methods, see the

GType conventions. For the high-level concepts

behind GObject, read

Instantiatable classed types: Objects.

Since GLib 2.72, all [gobject.object.ObjectWrap]s are guaranteed to be aligned to at least the alignment of the largest basic GLib type (typically this is [gst.types.ulong] or gdouble). If you need larger alignment for an element in a [gobject.object.ObjectWrap], you should allocate it on the heap (aligned), or arrange for your [gobject.object.ObjectWrap] to be appropriately padded. This guarantee applies to the [gobject.object.ObjectWrap] (or derived) struct, the [gstpbutils.types.ObjectClass] (or derived) struct, and any private data allocated by G_ADD_PRIVATE().

Fields
GObject * _cInstancePtr
DClosure[gulong] signalClosures
Methods
void _setGObject(void * cObj, Flag!"Take" take)Set the GObject of a D ObjectWrap wrapper. Params: cObj = Pointer to the GObject take = Yes.Take if the D object should take ownership of the passed reference, No.Take to add a new reference
void _cObjToggleNotify(void * dObj, GObject * gObj, gboolean isLastRef)
void * _cPtr(Flag!"Dup" dup = No.Dup)Get a pointer to the underlying C object. Params: dup = Yes.Dup to add a reference with gobjectref(), No.Dup otherwise (default) Returns: The C object (reference added according to addRef parameter)
void * _ref(void * gObj)Calls gobjectref() on a GObject. Params: gObj = The GObject to reference Returns: The GObject
static _unref(void * gObj)Calls gobjectunref() on a GObject. Params: gObj = The GObject to reference
GType _getGType()Get the GType of an object. Returns: The GType
GType _gType() @propertyGObject GType property. Returns: The GType of the GObject class.
ObjectWrap self()Convenience method to return `this` cast to a type. For use in D with statements. Returns: The object instance
T _getDObject(T)(void * cptr, Flag!"Take" take)Template to get the D object from a C GObject and cast it to the given D object type. Params: T = The D object type cptr = The C GObject (can be null, in which case null is returned) take = If Yes....
gulong connectSignalClosure(string signalDetail, DClosure closure, Flag!"After" after = No.After)Connect a D closure to an object signal. Params: signalDetail = Signal name and optional detail separated by '::' closure = Closure to connect signal to after = Yes.After to invoke the signal after...
void setProperty(T)(string propertyName, T val)Template for setting a GObject property. Params: propertyName = Name of the GObject property val = The value to assign (must match the property value type)
T getProperty(T)(string propertyName) constTemplate for getting a GObject property. Params: propertyName = Name of the GObject property Returns: The property value (must match the property value type)
size_t compatControl(size_t what, void * data = null)
gobject.binding.Binding bindProperty(string sourceProperty, gobject.object.ObjectWrap target, string targetProperty, gobject.types.BindingFlags flags)Creates a binding between sourceproperty on source and targetproperty on target.
gobject.binding.Binding bindPropertyFull(string sourceProperty, gobject.object.ObjectWrap target, string targetProperty, gobject.types.BindingFlags flags, gobject.closure.Closure transformTo, gobject.closure.Closure transformFrom)Creates a binding between sourceproperty on source and targetproperty on target, allowing you to set the transformation functions to be used by the binding.
void forceFloating()This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating ...
void freezeNotify()Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Dup...
void * getData(string key)Gets a named field from the objects table of associations (see [gobject.object.ObjectWrap.setData]).
void getProperty(string propertyName, gobject.value.Value value)Gets a property of an object.
void * getQdata(glib.types.Quark quark)This function gets back user data pointers stored via [gobject.object.ObjectWrap.setQdata].
void getv(string[] names, gobject.value.Value[] values)Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid propertie...
bool isFloating()Checks whether object has a [floating][floating-ref] reference. Returns: true if object has a floating reference
void notify(string propertyName)Emits a "notify" signal for the property property_name on object.
void notifyByPspec(gobject.param_spec.ParamSpec pspec)Emits a "notify" signal for the property specified by pspec on object.
gobject.object.ObjectWrap refSink()Increase the reference count of object, and possibly remove the [floating][floating-ref] reference, if object has a floating reference.
void runDispose()Releases all references to other objects. This can be used to break reference cycles.
void setData(string key, void * data = null)Each object carries around a table of associations from strings to pointers. This function lets you set an association.
void setProperty(string propertyName, gobject.value.Value value)Sets a property on an object.
void * stealData(string key)Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
void * stealQdata(glib.types.Quark quark)This function gets back user data pointers stored via [gobject.object.ObjectWrap.setQdata] and removes the data from object without invoking its destroy() function (if any was set). Usually, callin...
void thawNotify()Reverts the effect of a previous call to [gobject.object.ObjectWrap.freezeNotify]. The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.
void watchClosure(gobject.closure.Closure closure)This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling [gobject.closure.Closure.i...
gulong connectNotify(T)(string detail = null, T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gobject.param_spec.ParamSpec))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gobject.object.ObjectWrap))) && Parameters!T.length < 3)Connect to `Notify` signal.
Constructors
this(GType type)Create an ObjectWrap which is wrapping a C GObject with the given GType. Useful for creating custom D classes which are derived from ObjectWrap. Params: type = The GType value to use for creating t...
this(void * cObj, Flag!"Take" take)Constructor to wrap a C GObject with a D proxy object. Params: cObj = Pointer to the GObject take = Yes.Take if the D object should take ownership of the passed reference, No.Take to add a new refe...
Destructors

Fluent builder for [gobject.object.ObjectWrap]

Methods

Interface proxy class - used to wrap unknown GObjects as a known interface

Constructors
this(void * ptr, Flag!"Take" take)

Functions 2

private fnObject _d_newclass(const TypeInfo_Class ci)
fnstring objectMixin()A convenient string mixin to be used for ObjectWrap derived classes to declare boilerplate constructors. Returns: A string value to use with mixin() within ObjectWrap derived classes.

Variables 4

varQuark gidObjectQuark
varTypeInfo_Class[GType] gtypeClasses
varTypeInfo_Class[TypeInfo_Interface] ifaceProxyClasses
varbool classMapsInitialized