Object
Object Hierarchy:
Description:
[ CCode ( get_value_function = "g_value_get_object" , marshaller_type_name = "OBJECT" , param_spec_function = "g_param_spec_object" , ref_function = "g_object_ref" , set_value_function = "g_value_set_object" , take_value_function = "g_value_take_object" , unref_function = "g_object_unref" ) ]
public class Object
The base object type.
`GObject` 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` class provides methods for object construction and destruction, property access methods, and signal
support. Signals are described in detail [here](signals.html).
For a tutorial on implementing a new `GObject` class, see [How to define and implement a new GObject](
tutorial.html#how-to-define-and-implement-a-new-gobject). For a list of naming conventions for GObjects and their methods, see the [GType
conventions](concepts.html#conventions). For the high-level concepts behind GObject, read [Instantiatable classed types: Objects](
concepts.html#instantiatable-classed-types-objects).
Since GLib 2.72, all `GObject`s are guaranteed to be aligned to at least the alignment of the largest basic GLib type (typically this is
`guint64` or `gdouble`). If you need larger alignment for an element in a `GObject`, you should allocate it on the heap (aligned), or
arrange for your `GObject` to be appropriately padded. This guarantee applies to the `GObject` (or derived) struct, the `GObjectClass` (or
derived) struct, and any private data allocated by `G_ADD_PRIVATE()`.
Content:
Static methods:
Creation methods:
Methods:
- public void @get (string first_property_name, ...)
Gets properties of an object.
- public unowned Object @ref ()
Increases the reference count of this
.
- public void @set (string first_property_name, ...)
Sets properties on an object.
- public void add_toggle_ref (ToggleNotify notify)
Increases the reference count of the object by one and sets a callback
to be called when all other references to the object are dropped, or when this is already the last reference to the object and
another reference is established.
- public void add_weak_pointer (void** weak_pointer_location)
Adds a weak reference from weak_pointer to
this to indicate that the pointer located at weak_pointer_location is only valid during the lifetime of
this.
- public unowned Binding bind_property (string source_property, Object target, string target_property, BindingFlags flags = DEFAULT, owned BindingTransformFunc? transform_to = null, owned BindingTransformFunc? transform_from = null)
Creates a binding between source_property on
this and target_property on target, allowing you to set the transformation
functions to be used by the binding.
- public unowned Object connect (string signal_spec, ...)
A convenience function to connect multiple signals at once.
- public virtual void constructed ()
the constructed function is called by
@new as the final step of the object creation process.
- public void disconnect (ulong handler_id)
- public virtual void dispose ()
Releases all references to other objects.
- public T dup_data<T> (string key, DuplicateFunc<T> dup_func)
This is a variant of
get_data which returns a 'duplicate' of the value.
- public T dup_qdata<T> (Quark quark, DuplicateFunc<T> dup_func)
This is a variant of
get_qdata which returns a 'duplicate' of the value.
- public void force_floating ()
This function is intended for Object
implementations to re-enforce a [floating](floating-refs.
- public void freeze_notify ()
Increases the freeze count on this.
- public unowned ObjectClass get_class ()
- public unowned T get_data<T> (string key)
Gets a named field from the objects table of associations (see
g_object_set_data).
- public void get_property (string property_name, ref Value value)
Gets a property of an object.
- public unowned T get_qdata<T> (Quark quark)
This function gets back user data pointers stored via
g_object_set_qdata.
- public Type get_type ()
- public void getv (string[] names, Value[] values)
Gets names.length properties for an
this.
- public bool is_floating ()
Checks whether this has a [floating
](floating-refs.
- public void notify_property (string property_name)
- public unowned Object ref_sink ()
Increase the reference count of this
, and possibly remove the [floating](floating-refs.
- public void remove_toggle_ref (ToggleNotify notify)
- public void remove_weak_pointer (void** weak_pointer_location)
Removes a weak reference from this
that was previously added using add_weak_pointer.
- public bool replace_data<G,T> (string key, G oldval, owned T newval, out DestroyNotify? old_destroy)
Compares the user data for the key key on
this with oldval, and if they are the same, replaces oldval with
newval.
- public bool replace_qdata<G,T> (Quark quark, G oldval, owned T newval, out DestroyNotify? old_destroy)
Compares the user data for the key quark on
this with oldval, and if they are the same, replaces oldval with
newval.
- public void set_data<T> (string key, owned T data)
- public void set_data_full (string key, void* data, DestroyNotify? destroy)
Like g_object_set_data except it adds notification for
when the association is destroyed, either by setting it to a different value or when the object is destroyed.
- public void set_property (string property_name, Value value)
Sets a property on an object.
- public void set_qdata<T> (Quark quark, owned T data)
- public void set_qdata_full (Quark quark, void* data, DestroyNotify? destroy)
This function works like g_object_set_qdata, but in
addition, a void (*destroy) (gpointer) function may be specified which is called with data as argument when the
this is finalized, or the data is being overwritten by a call to g_object_set_qdata
with the same quark.
- public void set_valist (string first_property_name, va_list var_args)
Sets properties on an object.
- public void setv (string[] names, Value[] values)
Sets names.length properties for an
this.
- public T steal_data<T> (string key)
Remove a specified datum from the object's data associations, without
invoking the association's destroy handler.
- public T steal_qdata<T> (Quark quark)
This function gets back user data pointers stored via
g_object_set_qdata and removes the data from object without invoking its destroy function (if any
was set).
- public void thaw_notify ()
- public void unref ()
Decreases the reference count of this
.
- public void watch_closure (Closure closure)
This function essentially limits the life time of the closure
to the life time of the object.
- public void weak_ref (WeakNotify notify)
Adds a weak reference callback to an object.
- public void weak_unref (WeakNotify notify)
Removes a weak reference callback to an object.
Signals:
- public virtual signal void notify (ParamSpec pspec)
The notify signal is emitted on an object when one of its properties
has its value set through set_property,
@set, et al.
Fields: