Classes
The following classes are available globally.
-
GBinding
is the representation of a binding between a property on aGObject
instance (or source) and another property on anotherGObject
instance (or target).Whenever the source property changes, the same value is applied to the target property; for instance, the following binding:
(C Language Example):
g_object_bind_property (object1, "property-a", object2, "property-b", G_BINDING_DEFAULT);
will cause the property named “property-b” of
object2
to be updated every timeg_object_set()
or the specific accessor changes the value of the property “property-a” ofobject1
.It is possible to create a bidirectional binding between two properties of two
GObject
instances, so that if either property changes, the other is updated as well, for instance:(C Language Example):
g_object_bind_property (object1, "property-a", object2, "property-b", G_BINDING_BIDIRECTIONAL);
will keep the two properties in sync.
It is also possible to set a custom transformation function (in both directions, in case of a bidirectional binding) to apply a custom transformation from the source value to the target value before applying it; for instance, the following binding:
(C Language Example):
g_object_bind_property_full (adjustment1, "value", adjustment2, "value", G_BINDING_BIDIRECTIONAL, celsius_to_fahrenheit, fahrenheit_to_celsius, NULL, NULL);
will keep the “value” property of the two adjustments in sync; the
celsius_to_fahrenheit
function will be called whenever the “value” property ofadjustment1
changes and will transform the current value of the property before applying it to the “value” property ofadjustment2
.Vice versa, the
fahrenheit_to_celsius
function will be called whenever the “value” property ofadjustment2
changes, and will transform the current value of the property before applying it to the “value” property ofadjustment1
.Note that
GBinding
does not resolve cycles by itself; a cycle likeobject1:propertyA -> object2:propertyB object2:propertyB -> object3:propertyC object3:propertyC -> object1:propertyA
might lead to an infinite loop. The loop, in this particular case, can be avoided if the objects emit the
GObject::notify
signal only if the value has effectively been changed. A binding is implemented using theGObject::notify
signal, so it is susceptible to all the various ways of blocking a signal emission, likeg_signal_stop_emission()
org_signal_handler_block()
.A binding will be severed, and the resources it allocates freed, whenever either one of the
GObject
instances it refers to are finalized, or when theGBinding
instance loses its last reference.Bindings for languages with garbage collection can use
g_binding_unbind()
to explicitly release a binding between the source and target properties, instead of relying on the last reference on the binding, source, and target instances to drop.GBinding
is available since GObject 2.26The
See moreBinding
type acts as a reference-counted owner of an underlyingGBinding
instance. It provides the methods that can operate on this data type throughBindingProtocol
conformance. UseBinding
as a strong reference or owner of aGBinding
instance.Declaration
Swift
open class Binding : Object, BindingProtocol
-
A
GCClosure
is a specialization ofGClosure
for C function callbacks.The
See moreCClosure
type acts as an owner of an underlyingGCClosure
instance. It provides the methods that can operate on this data type throughCClosureProtocol
conformance. UseCClosure
as a strong reference or owner of aGCClosure
instance.Declaration
Swift
open class CClosure : CClosureProtocol
-
A
GClosure
represents a callback supplied by the programmer.It will generally comprise a function of some kind and a marshaller used to call it. It is the responsibility of the marshaller to convert the arguments for the invocation from
GValues
into a suitable form, perform the callback on the converted arguments, and transform the return value back into aGValue
.In the case of C programs, a closure usually just holds a pointer to a function and maybe a data argument, and the marshaller converts between
GValue
and native C types. The GObject library provides theGCClosure
type for this purpose. Bindings for other languages need marshallers which convert betweenGValues
and suitable representations in the runtime of the language in order to use functions written in that language as callbacks. Useg_closure_set_marshal()
to set the marshaller on such a custom closure implementation.Within GObject, closures play an important role in the implementation of signals. When a signal is registered, the
c_marshaller
argument tog_signal_new()
specifies the default C marshaller for any closure which is connected to this signal. GObject provides a number of C marshallers for this purpose, see the g_cclosure_marshal_() functions. Additional C marshallers can be generated with the glib-genmarshal utility. Closures can be explicitly connected to signals withg_signal_connect_closure()
, but it usually more convenient to let GObject create a closure automatically by using one of the g_signal_connect_() functions which take a callback function/user data pair.Using closures has a number of important advantages over a simple callback function/data pointer combination:
Closures allow the callee to get the types of the callback parameters, which means that language bindings don’t have to write individual glue for each callback type.
The reference counting of
GClosure
makes it easy to handle reentrancy right; if a callback is removed while it is being invoked, the closure and its parameters won’t be freed until the invocation finishes.g_closure_invalidate()
and invalidation notifiers allow callbacks to be automatically removed when the objects they point to go away.
The
See moreClosure
type acts as a reference-counted owner of an underlyingGClosure
instance. It provides the methods that can operate on this data type throughClosureProtocol
conformance. UseClosure
as a strong reference or owner of aGClosure
instance.Declaration
Swift
open class Closure : ClosureProtocol
-
The
See moreClosureNotifyData
type acts as an owner of an underlyingGClosureNotifyData
instance. It provides the methods that can operate on this data type throughClosureNotifyDataProtocol
conformance. UseClosureNotifyData
as a strong reference or owner of aGClosureNotifyData
instance.Declaration
Swift
open class ClosureNotifyData : ClosureNotifyDataProtocol
-
The class of an enumeration type holds information about its possible values.
The
See moreEnumClass
type acts as an owner of an underlyingGEnumClass
instance. It provides the methods that can operate on this data type throughEnumClassProtocol
conformance. UseEnumClass
as a strong reference or owner of aGEnumClass
instance.Declaration
Swift
open class EnumClass : EnumClassProtocol
-
A structure which contains a single enum value, its name, and its nickname.
The
See moreEnumValue
type acts as an owner of an underlyingGEnumValue
instance. It provides the methods that can operate on this data type throughEnumValueProtocol
conformance. UseEnumValue
as a strong reference or owner of aGEnumValue
instance.Declaration
Swift
open class EnumValue : EnumValueProtocol
-
The class of a flags type holds information about its possible values.
The
See moreFlagsClass
type acts as an owner of an underlyingGFlagsClass
instance. It provides the methods that can operate on this data type throughFlagsClassProtocol
conformance. UseFlagsClass
as a strong reference or owner of aGFlagsClass
instance.Declaration
Swift
open class FlagsClass : FlagsClassProtocol
-
A structure which contains a single flags value, its name, and its nickname.
The
See moreFlagsValue
type acts as an owner of an underlyingGFlagsValue
instance. It provides the methods that can operate on this data type throughFlagsValueProtocol
conformance. UseFlagsValue
as a strong reference or owner of aGFlagsValue
instance.Declaration
Swift
open class FlagsValue : FlagsValueProtocol
-
A type for objects that have an initially floating reference.
All the fields in the
GInitiallyUnowned
structure are private to the implementation and should never be accessed directly.The
See moreInitiallyUnowned
type acts as a reference-counted owner of an underlyingGInitiallyUnowned
instance. It provides the methods that can operate on this data type throughInitiallyUnownedProtocol
conformance. UseInitiallyUnowned
as a strong reference or owner of aGInitiallyUnowned
instance.Declaration
Swift
open class InitiallyUnowned : Object, InitiallyUnownedProtocol
-
A structure that provides information to the type system which is used specifically for managing interface types.
The
See moreInterfaceInfo
type acts as an owner of an underlyingGInterfaceInfo
instance. It provides the methods that can operate on this data type throughInterfaceInfoProtocol
conformance. UseInterfaceInfo
as a strong reference or owner of aGInterfaceInfo
instance.Declaration
Swift
open class InterfaceInfo : InterfaceInfoProtocol
-
The GObjectConstructParam struct is an auxiliary structure used to hand
GParamSpec
/GValue
pairs to theconstructor
of aGObjectClass
.The
See moreObjectConstructParam
type acts as an owner of an underlyingGObjectConstructParam
instance. It provides the methods that can operate on this data type throughObjectConstructParamProtocol
conformance. UseObjectConstructParam
as a strong reference or owner of aGObjectConstructParam
instance.Declaration
Swift
open class ObjectConstructParam : ObjectConstructParamProtocol
-
The base object type.
All the fields in the
GObject
structure are private to the implementation and should never be accessed directly.The
See moreObject
type acts as a reference-counted owner of an underlyingGObject
instance. It provides the methods that can operate on this data type throughObjectProtocol
conformance. UseObject
as a strong reference or owner of aGObject
instance.Declaration
Swift
open class Object : ObjectProtocol
-
The class structure for the GParamSpec type. Normally, GParamSpec classes are filled by
g_param_type_register_static()
.The
See moreParamSpecClass
type acts as an owner of an underlyingGParamSpecClass
instance. It provides the methods that can operate on this data type throughParamSpecClassProtocol
conformance. UseParamSpecClass
as a strong reference or owner of aGParamSpecClass
instance.Declaration
Swift
open class ParamSpecClass : ParamSpecClassProtocol
-
A
GParamSpecPool
maintains a collection ofGParamSpecs
which can be quickly accessed by owner and name.The implementation of the
GObject
property system uses such a pool to store theGParamSpecs
of the properties all object types.The
See moreParamSpecPool
type acts as an owner of an underlyingGParamSpecPool
instance. It provides the methods that can operate on this data type throughParamSpecPoolProtocol
conformance. UseParamSpecPool
as a strong reference or owner of aGParamSpecPool
instance.Declaration
Swift
open class ParamSpecPool : ParamSpecPoolProtocol
-
This structure is used to provide the type system with the information required to initialize and destruct (finalize) a parameter’s class and instances thereof.
The initialized structure is passed to the
g_param_type_register_static()
The type system will perform a deep copy of this structure, so its memory does not need to be persistent across invocation ofg_param_type_register_static()
.The
See moreParamSpecTypeInfo
type acts as an owner of an underlyingGParamSpecTypeInfo
instance. It provides the methods that can operate on this data type throughParamSpecTypeInfoProtocol
conformance. UseParamSpecTypeInfo
as a strong reference or owner of aGParamSpecTypeInfo
instance.Declaration
Swift
open class ParamSpecTypeInfo : ParamSpecTypeInfoProtocol
-
The GParameter struct is an auxiliary structure used to hand parameter name/value pairs to
g_object_newv()
.The
See moreParameter
type acts as an owner of an underlyingGParameter
instance. It provides the methods that can operate on this data type throughParameterProtocol
conformance. UseParameter
as a strong reference or owner of aGParameter
instance.Declaration
Swift
open class Parameter : ParameterProtocol
-
GParamSpec
is an object structure that encapsulates the metadata required to specify parameters, such as e.g.GObject
properties.Parameter names #
A property name consists of one or more segments consisting of ASCII letters and digits, separated by either the
-
or_
character. The first character of a property name must be a letter. These are the same rules as for signal naming (seeg_signal_new()
).When creating and looking up a
GParamSpec
, either separator can be used, but they cannot be mixed. Using-
is considerably more efficient, and is the ‘canonical form’. Using_
is discouraged.The
See moreParamSpec
type acts as a reference-counted owner of an underlyingGParamSpec
instance. It provides the methods that can operate on this data type throughParamSpecProtocol
conformance. UseParamSpec
as a strong reference or owner of aGParamSpec
instance.Declaration
Swift
open class ParamSpec : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for boolean properties.The
See moreParamSpecBoolean
type acts as a reference-counted owner of an underlyingGParamSpecBoolean
instance. It provides the methods that can operate on this data type throughParamSpecBooleanProtocol
conformance. UseParamSpecBoolean
as a strong reference or owner of aGParamSpecBoolean
instance.Declaration
Swift
open class ParamSpecBoolean : ParamSpec, ParamSpecBooleanProtocol
-
A
GParamSpec
derived structure that contains the meta data for boxed properties.The
See moreParamSpecBoxed
type acts as a reference-counted owner of an underlyingGParamSpecBoxed
instance. It provides the methods that can operate on this data type throughParamSpecBoxedProtocol
conformance. UseParamSpecBoxed
as a strong reference or owner of aGParamSpecBoxed
instance.Declaration
Swift
open class ParamSpecBoxed : ParamSpec, ParamSpecBoxedProtocol
-
A
GParamSpec
derived structure that contains the meta data for character properties.The
See moreParamSpecChar
type acts as a reference-counted owner of an underlyingGParamSpecChar
instance. It provides the methods that can operate on this data type throughParamSpecCharProtocol
conformance. UseParamSpecChar
as a strong reference or owner of aGParamSpecChar
instance.Declaration
Swift
open class ParamSpecChar : ParamSpec, ParamSpecCharProtocol
-
A
GParamSpec
derived structure that contains the meta data for double properties.The
See moreParamSpecDouble
type acts as a reference-counted owner of an underlyingGParamSpecDouble
instance. It provides the methods that can operate on this data type throughParamSpecDoubleProtocol
conformance. UseParamSpecDouble
as a strong reference or owner of aGParamSpecDouble
instance.Declaration
Swift
open class ParamSpecDouble : ParamSpec, ParamSpecDoubleProtocol
-
A
GParamSpec
derived structure that contains the meta data for enum properties.The
See moreParamSpecEnum
type acts as a reference-counted owner of an underlyingGParamSpecEnum
instance. It provides the methods that can operate on this data type throughParamSpecEnumProtocol
conformance. UseParamSpecEnum
as a strong reference or owner of aGParamSpecEnum
instance.Declaration
Swift
open class ParamSpecEnum : ParamSpec, ParamSpecEnumProtocol
-
A
GParamSpec
derived structure that contains the meta data for flags properties.The
See moreParamSpecFlags
type acts as a reference-counted owner of an underlyingGParamSpecFlags
instance. It provides the methods that can operate on this data type throughParamSpecFlagsProtocol
conformance. UseParamSpecFlags
as a strong reference or owner of aGParamSpecFlags
instance.Declaration
Swift
open class ParamSpecFlags : ParamSpec, ParamSpecFlagsProtocol
-
A
GParamSpec
derived structure that contains the meta data for float properties.The
See moreParamSpecFloat
type acts as a reference-counted owner of an underlyingGParamSpecFloat
instance. It provides the methods that can operate on this data type throughParamSpecFloatProtocol
conformance. UseParamSpecFloat
as a strong reference or owner of aGParamSpecFloat
instance.Declaration
Swift
open class ParamSpecFloat : ParamSpec, ParamSpecFloatProtocol
-
A
GParamSpec
derived structure that contains the meta data forGType
properties.The
See moreParamSpecGType
type acts as a reference-counted owner of an underlyingGParamSpecGType
instance. It provides the methods that can operate on this data type throughParamSpecGTypeProtocol
conformance. UseParamSpecGType
as a strong reference or owner of aGParamSpecGType
instance.Declaration
Swift
open class ParamSpecGType : ParamSpec, ParamSpecGTypeProtocol
-
A
GParamSpec
derived structure that contains the meta data for integer properties.The
See moreParamSpecInt
type acts as a reference-counted owner of an underlyingGParamSpecInt
instance. It provides the methods that can operate on this data type throughParamSpecIntProtocol
conformance. UseParamSpecInt
as a strong reference or owner of aGParamSpecInt
instance.Declaration
Swift
open class ParamSpecInt : ParamSpec, ParamSpecIntProtocol
-
A
GParamSpec
derived structure that contains the meta data for 64bit integer properties.The
See moreParamSpecInt64
type acts as a reference-counted owner of an underlyingGParamSpecInt64
instance. It provides the methods that can operate on this data type throughParamSpecInt64Protocol
conformance. UseParamSpecInt64
as a strong reference or owner of aGParamSpecInt64
instance.Declaration
Swift
open class ParamSpecInt64 : ParamSpec, ParamSpecInt64Protocol
-
A
GParamSpec
derived structure that contains the meta data for long integer properties.The
See moreParamSpecLong
type acts as a reference-counted owner of an underlyingGParamSpecLong
instance. It provides the methods that can operate on this data type throughParamSpecLongProtocol
conformance. UseParamSpecLong
as a strong reference or owner of aGParamSpecLong
instance.Declaration
Swift
open class ParamSpecLong : ParamSpec, ParamSpecLongProtocol
-
A
GParamSpec
derived structure that contains the meta data for object properties.The
See moreParamSpecObject
type acts as a reference-counted owner of an underlyingGParamSpecObject
instance. It provides the methods that can operate on this data type throughParamSpecObjectProtocol
conformance. UseParamSpecObject
as a strong reference or owner of aGParamSpecObject
instance.Declaration
Swift
open class ParamSpecObject : ParamSpec, ParamSpecObjectProtocol
-
A
GParamSpec
derived structure that redirects operations to other types ofGParamSpec
.All operations other than getting or setting the value are redirected, including accessing the nick and blurb, validating a value, and so forth.
See
g_param_spec_get_redirect_target()
for retrieving the overridden property.GParamSpecOverride
is used in implementingg_object_class_override_property()
, and will not be directly useful unless you are implementing a new base type similar to GObject.The
See moreParamSpecOverride
type acts as a reference-counted owner of an underlyingGParamSpecOverride
instance. It provides the methods that can operate on this data type throughParamSpecOverrideProtocol
conformance. UseParamSpecOverride
as a strong reference or owner of aGParamSpecOverride
instance.Declaration
Swift
open class ParamSpecOverride : ParamSpec, ParamSpecOverrideProtocol
-
A
GParamSpec
derived structure that contains the meta data forG_TYPE_PARAM
properties.The
See moreParamSpecParam
type acts as a reference-counted owner of an underlyingGParamSpecParam
instance. It provides the methods that can operate on this data type throughParamSpecParamProtocol
conformance. UseParamSpecParam
as a strong reference or owner of aGParamSpecParam
instance.Declaration
Swift
open class ParamSpecParam : ParamSpec, ParamSpecParamProtocol
-
A
GParamSpec
derived structure that contains the meta data for pointer properties.The
See moreParamSpecPointer
type acts as a reference-counted owner of an underlyingGParamSpecPointer
instance. It provides the methods that can operate on this data type throughParamSpecPointerProtocol
conformance. UseParamSpecPointer
as a strong reference or owner of aGParamSpecPointer
instance.Declaration
Swift
open class ParamSpecPointer : ParamSpec, ParamSpecPointerProtocol
-
A
GParamSpec
derived structure that contains the meta data for string properties.The
See moreParamSpecString
type acts as a reference-counted owner of an underlyingGParamSpecString
instance. It provides the methods that can operate on this data type throughParamSpecStringProtocol
conformance. UseParamSpecString
as a strong reference or owner of aGParamSpecString
instance.Declaration
Swift
open class ParamSpecString : ParamSpec, ParamSpecStringProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned character properties.The
See moreParamSpecUChar
type acts as a reference-counted owner of an underlyingGParamSpecUChar
instance. It provides the methods that can operate on this data type throughParamSpecUCharProtocol
conformance. UseParamSpecUChar
as a strong reference or owner of aGParamSpecUChar
instance.Declaration
Swift
open class ParamSpecUChar : ParamSpec, ParamSpecUCharProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned integer properties.The
See moreParamSpecUInt
type acts as a reference-counted owner of an underlyingGParamSpecUInt
instance. It provides the methods that can operate on this data type throughParamSpecUIntProtocol
conformance. UseParamSpecUInt
as a strong reference or owner of aGParamSpecUInt
instance.Declaration
Swift
open class ParamSpecUInt : ParamSpec, ParamSpecUIntProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned 64bit integer properties.The
See moreParamSpecUInt64
type acts as a reference-counted owner of an underlyingGParamSpecUInt64
instance. It provides the methods that can operate on this data type throughParamSpecUInt64Protocol
conformance. UseParamSpecUInt64
as a strong reference or owner of aGParamSpecUInt64
instance.Declaration
Swift
open class ParamSpecUInt64 : ParamSpec, ParamSpecUInt64Protocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned long integer properties.The
See moreParamSpecULong
type acts as a reference-counted owner of an underlyingGParamSpecULong
instance. It provides the methods that can operate on this data type throughParamSpecULongProtocol
conformance. UseParamSpecULong
as a strong reference or owner of aGParamSpecULong
instance.Declaration
Swift
open class ParamSpecULong : ParamSpec, ParamSpecULongProtocol
-
A
GParamSpec
derived structure that contains the meta data for unichar (unsigned integer) properties.The
See moreParamSpecUnichar
type acts as a reference-counted owner of an underlyingGParamSpecUnichar
instance. It provides the methods that can operate on this data type throughParamSpecUnicharProtocol
conformance. UseParamSpecUnichar
as a strong reference or owner of aGParamSpecUnichar
instance.Declaration
Swift
open class ParamSpecUnichar : ParamSpec, ParamSpecUnicharProtocol
-
A
GParamSpec
derived structure that contains the meta data forGValueArray
properties.The
See moreParamSpecValueArray
type acts as a reference-counted owner of an underlyingGParamSpecValueArray
instance. It provides the methods that can operate on this data type throughParamSpecValueArrayProtocol
conformance. UseParamSpecValueArray
as a strong reference or owner of aGParamSpecValueArray
instance.Declaration
Swift
open class ParamSpecValueArray : ParamSpec, ParamSpecValueArrayProtocol
-
A
GParamSpec
derived structure that contains the meta data forGVariant
properties.When comparing values with
g_param_values_cmp()
, scalar values with the same type will be compared withg_variant_compare()
. Other non-nil
variants will be checked for equality withg_variant_equal()
, and their sort order is otherwise undefined.nil
is ordered before non-nil
variants. Twonil
values compare equal.The
See moreParamSpecVariant
type acts as a reference-counted owner of an underlyingGParamSpecVariant
instance. It provides the methods that can operate on this data type throughParamSpecVariantProtocol
conformance. UseParamSpecVariant
as a strong reference or owner of aGParamSpecVariant
instance.Declaration
Swift
open class ParamSpecVariant : ParamSpec, ParamSpecVariantProtocol
-
The
GSignalInvocationHint
structure is used to pass on additional information to callbacks during a signal emission.The
See moreSignalInvocationHint
type acts as an owner of an underlyingGSignalInvocationHint
instance. It provides the methods that can operate on this data type throughSignalInvocationHintProtocol
conformance. UseSignalInvocationHint
as a strong reference or owner of aGSignalInvocationHint
instance.Declaration
Swift
open class SignalInvocationHint : SignalInvocationHintProtocol
-
A structure holding in-depth information for a specific signal.
See also:
g_signal_query()
The
See moreSignalQuery
type acts as an owner of an underlyingGSignalQuery
instance. It provides the methods that can operate on this data type throughSignalQueryProtocol
conformance. UseSignalQuery
as a strong reference or owner of aGSignalQuery
instance.Declaration
Swift
open class SignalQuery : SignalQueryProtocol
-
An interface that handles the lifecycle of dynamically loaded types.
The GObject type system supports dynamic loading of types. It goes as follows:
- The type is initially introduced (usually upon loading the module the first time, or by your main application that knows what modules introduces what types), like this:
(C Language Example):
new_type_id = g_type_register_dynamic (parent_type_id, "TypeName", new_type_plugin, type_flags);
where
new_type_plugin
is an implementation of theGTypePlugin
interface.The type’s implementation is referenced, e.g. through
g_type_class_ref()
or throughg_type_create_instance()
(this is being called byg_object_new()
) or through one of the above done on a type derived fromnew_type_id
.This causes the type system to load the type’s implementation by calling
g_type_plugin_use()
andg_type_plugin_complete_type_info()
onnew_type_plugin
.At some point the type’s implementation isn’t required anymore, e.g. after
g_type_class_unref()
org_type_free_instance()
(called when the reference count of an instance drops to zero).This causes the type system to throw away the information retrieved from
g_type_plugin_complete_type_info()
and then it callsg_type_plugin_unuse()
onnew_type_plugin
.Things may repeat from the second step.
So basically, you need to implement a
GTypePlugin
type that carries a use_count, once use_count goes from zero to one, you need to load the implementation to successfully handle the upcomingg_type_plugin_complete_type_info()
call. Later, maybe after succeeding use/unuse calls, once use_count drops to zero, you can unload the implementation again. The type system makes sure to callg_type_plugin_use()
andg_type_plugin_complete_type_info()
again when the type is needed again.GTypeModule
is an implementation ofGTypePlugin
that already implements most of this except for the actual module loading and unloading. It even handles multiple registered types per module.The
See moreTypePlugin
type acts as an owner of an underlyingGTypePlugin
instance. It provides the methods that can operate on this data type throughTypePluginProtocol
conformance. UseTypePlugin
as a strong reference or owner of aGTypePlugin
instance.Declaration
Swift
open class TypePlugin : TypePluginProtocol
-
An opaque structure used as the base of all classes.
The
See moreTypeClass
type acts as an owner of an underlyingGTypeClass
instance. It provides the methods that can operate on this data type throughTypeClassProtocol
conformance. UseTypeClass
as a strong reference or owner of aGTypeClass
instance.Declaration
Swift
open class TypeClass : TypeClassProtocol
-
A structure that provides information to the type system which is used specifically for managing fundamental types.
The
See moreTypeFundamentalInfo
type acts as an owner of an underlyingGTypeFundamentalInfo
instance. It provides the methods that can operate on this data type throughTypeFundamentalInfoProtocol
conformance. UseTypeFundamentalInfo
as a strong reference or owner of aGTypeFundamentalInfo
instance.Declaration
Swift
open class TypeFundamentalInfo : TypeFundamentalInfoProtocol
-
This structure is used to provide the type system with the information required to initialize and destruct (finalize) a type’s class and its instances.
The initialized structure is passed to the
g_type_register_static()
function (or is copied into the providedGTypeInfo
structure in theg_type_plugin_complete_type_info()
). The type system will perform a deep copy of this structure, so its memory does not need to be persistent across invocation ofg_type_register_static()
.The
See moreTypeInfo
type acts as an owner of an underlyingGTypeInfo
instance. It provides the methods that can operate on this data type throughTypeInfoProtocol
conformance. UseTypeInfo
as a strong reference or owner of aGTypeInfo
instance.Declaration
Swift
open class TypeInfo : TypeInfoProtocol
-
An opaque structure used as the base of all type instances.
The
See moreTypeInstance
type acts as an owner of an underlyingGTypeInstance
instance. It provides the methods that can operate on this data type throughTypeInstanceProtocol
conformance. UseTypeInstance
as a strong reference or owner of aGTypeInstance
instance.Declaration
Swift
open class TypeInstance : TypeInstanceProtocol
-
An opaque structure used as the base of all interface types.
The
See moreTypeInterface
type acts as an owner of an underlyingGTypeInterface
instance. It provides the methods that can operate on this data type throughTypeInterfaceProtocol
conformance. UseTypeInterface
as a strong reference or owner of aGTypeInterface
instance.Declaration
Swift
open class TypeInterface : TypeInterfaceProtocol
-
The
GTypePlugin
interface is used by the type system in order to handle the lifecycle of dynamically loaded types.The
See moreTypePluginClass
type acts as an owner of an underlyingGTypePluginClass
instance. It provides the methods that can operate on this data type throughTypePluginClassProtocol
conformance. UseTypePluginClass
as a strong reference or owner of aGTypePluginClass
instance.Declaration
Swift
open class TypePluginClass : TypePluginClassProtocol
-
A structure holding information for a specific type.
See also:
g_type_query()
The
See moreTypeQuery
type acts as an owner of an underlyingGTypeQuery
instance. It provides the methods that can operate on this data type throughTypeQueryProtocol
conformance. UseTypeQuery
as a strong reference or owner of aGTypeQuery
instance.Declaration
Swift
open class TypeQuery : TypeQueryProtocol
-
The
GTypeValueTable
provides the functions required by theGValue
implementation, to serve as a container for values of a type.The
See moreTypeValueTable
type acts as an owner of an underlyingGTypeValueTable
instance. It provides the methods that can operate on this data type throughTypeValueTableProtocol
conformance. UseTypeValueTable
as a strong reference or owner of aGTypeValueTable
instance.Declaration
Swift
open class TypeValueTable : TypeValueTableProtocol
-
GTypeModule
provides a simple implementation of theGTypePlugin
interface.The model of
GTypeModule
is a dynamically loaded module which implements some number of types and interface implementations.When the module is loaded, it registers its types and interfaces using
g_type_module_register_type()
andg_type_module_add_interface()
. As long as any instances of these types and interface implementations are in use, the module is kept loaded. When the types and interfaces are gone, the module may be unloaded. If the types and interfaces become used again, the module will be reloaded. Note that the last reference cannot be released from within the module code, since that would lead to the caller’s code being unloaded beforeg_object_unref()
returns to it.Keeping track of whether the module should be loaded or not is done by using a use count - it starts at zero, and whenever it is greater than zero, the module is loaded. The use count is maintained internally by the type system, but also can be explicitly controlled by
g_type_module_use()
andg_type_module_unuse()
. Typically, when loading a module for the first type,g_type_module_use()
will be used to load it so that it can initialize its types. At some later point, when the module no longer needs to be loaded except for the type implementations it contains,g_type_module_unuse()
is called.GTypeModule
does not actually provide any implementation of module loading and unloading. To create a particular module type you must derive fromGTypeModule
and implement the load and unload functions inGTypeModuleClass
.The
See moreTypeModule
type acts as a reference-counted owner of an underlyingGTypeModule
instance. It provides the methods that can operate on this data type throughTypeModuleProtocol
conformance. UseTypeModule
as a strong reference or owner of aGTypeModule
instance.Declaration
Swift
open class TypeModule : Object, TypeModuleProtocol
-
An opaque structure used to hold different types of values.
The data within the structure has protected scope: it is accessible only to functions within a
GTypeValueTable
structure, or implementations of the g_value_*() API. That is, code portions which implement new fundamental types.GValue
users cannot make any assumptions about how data is stored within the 2 elementdata
union, and theg_type
member should only be accessed through theG_VALUE_TYPE()
macro.The
See moreValue
type acts as an owner of an underlyingGValue
instance. It provides the methods that can operate on this data type throughValueProtocol
conformance. UseValue
as a strong reference or owner of aGValue
instance.Declaration
Swift
open class ValueBase : ValueProtocol
-
A
GValueArray
contains an array ofGValue
elements.The
See moreValueArray
type acts as an owner of an underlyingGValueArray
instance. It provides the methods that can operate on this data type throughValueArrayProtocol
conformance. UseValueArray
as a strong reference or owner of aGValueArray
instance.Declaration
Swift
open class ValueArray : ValueArrayProtocol
-
A structure containing a weak reference to a
GObject
.A
GWeakRef
can either be empty (i.e. point tonil
), or point to an object for as long as at least one “strong” reference to that object exists. Before the object’sGObjectClass.dispose
method is called, everyGWeakRef
associated with becomes empty (i.e. points tonil
).Like
GValue
,GWeakRef
can be statically allocated, stack- or heap-allocated, or embedded in larger structures.Unlike
g_object_weak_ref()
andg_object_add_weak_pointer()
, this weak reference is thread-safe: converting a weak pointer to a reference is atomic with respect to invalidation of weak pointers to destroyed objects.If the object’s
GObjectClass.dispose
method results in additional references to the object being held (‘re-referencing’), anyGWeakRefs
taken before it was disposed will continue to point tonil
. AnyGWeakRefs
taken during disposal and after re-referencing, or after disposal has returned due to the re-referencing, will continue to point to the object until its refcount goes back to zero, at which point they too will be invalidated.It is invalid to take a
GWeakRef
on an object duringGObjectClass.dispose
without first having or creating a strong reference to the object.The
See moreWeakRef
type acts as an owner of an underlyingGWeakRef
instance. It provides the methods that can operate on this data type throughWeakRefProtocol
conformance. UseWeakRef
as a strong reference or owner of aGWeakRef
instance.Declaration
Swift
open class WeakRef : WeakRefProtocol
-
The
See moreTypeCValue
type acts as an owner of an underlyingGTypeCValue
instance. It provides the methods that can operate on this data type throughTypeCValueProtocol
conformance. UseTypeCValue
as a strong reference or owner of aGTypeCValue
instance.Declaration
Swift
open class TypeCValue : TypeCValueProtocol
-
The
See more_Value__data__union
type acts as an owner of an underlying_Value__data__union
instance. It provides the methods that can operate on this data type through_Value__data__unionProtocol
conformance. Use_Value__data__union
as a strong reference or owner of a_Value__data__union
instance.Declaration
Swift
open class _Value__data__union : _Value__data__unionProtocol
-
Internal Class that wraps a binding to make sure it is retained until no longer required
See moreDeclaration
Swift
public class BindingHolder<S, T>
-
This class is the main Swift wrapper with memory management for underlying
GValues
(the opaque GLib structure used to hold different types of values.Note
this class conforms to ExpressibleBy*Literal for storage of primitive types such asString
,Int
,Double
, orBool
Declaration
Swift
open class Value : ValueBase, ExpressibleByStringLiteral, ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, ExpressibleByBooleanLiteral
-
Storage for weak references of GObject reference counting. Use only unowning wrappers as a generic parameter T.
See moreDeclaration
Swift
@propertyWrapper public final class GWeak<T> where T : GWeakCapturing, T : ObjectProtocol