objects.sgml
来自「linux下电话本所依赖的库文件」· SGML 代码 · 共 872 行 · 第 1/2 页
SGML
872 行
<!-- ##### SECTION Title ##### -->GObject<!-- ##### SECTION Short_Description ##### -->The base object type<!-- ##### SECTION Long_Description ##### --><para></para><!-- ##### SECTION See_Also ##### --><para></para><!-- ##### SECTION Stability_Level ##### --><!-- ##### STRUCT GObject ##### --><para>All the fields in the <structname>GObject</structname> structure are private to the #GObject implementation and should never be accessed directly.</para><!-- ##### SIGNAL GObject::notify ##### --><para>The notify signal is emitted on an object when one of its properties has been changed. Note that getting this signal doesn't guarantee that thevalue of the property has actually changed, it may also be emitted whenthe setter for the property is called to reinstate the previous value.</para>@gobject: the object which received the signal.@pspec: the #GParamSpec of the property which changed<!-- ##### STRUCT GObjectClass ##### --><para>The class structure for the <structname>GObject</structname> type.</para>@g_type_class: the parent class@constructor: the @constructor function is called by g_object_new () to complete the object initialization after all the construction properties are set. The first thing a @constructor implementation must do is chain up to the @constructor of the parent class. Overriding @constructor should be rarely needed.@set_property: the generic setter for all properties of this type. Should be overridden for every type with properties. Implementations of @set_property don't need to emit property change notification explicitly, this is handled by the type system.@get_property: the generic getter for all properties of this type. Should be overridden for every type with properties.@dispose: the @dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to reference loops). Before returning, @dispose should chain up to the @dispose method of the parent class.@finalize: instance finalization function, should finish the finalization of the instance begun in @dispose and chain up to the @finalize method of the parent class.@dispatch_properties_changed: emits property change notification for a bunch of properties. Overriding @dispatch_properties_changed should be rarely needed.@notify: the class closure for the notify signal<!-- ##### STRUCT GObjectConstructParam ##### --><para>The <structname>GObjectConstructParam</structname> struct is an auxiliary structure used to hand #GParamSpec/#GValue pairs to the @constructor ofa #GObjectClass.</para>@pspec: the #GParamSpec of the construct parameter@value: the value to set the parameter to<!-- ##### USER_FUNCTION GObjectGetPropertyFunc ##### --><para>The type of the @get_property function of #GObjectClass. </para>@object: a #GObject@property_id: the numeric id under which the property was registered with g_object_class_install_property().@value: a #GValue to return the property value in@pspec: the #GParamSpec describing the property<!-- ##### USER_FUNCTION GObjectSetPropertyFunc ##### --><para>The type of the @set_property function of #GObjectClass. </para>@object: a #GObject@property_id: the numeric id under which the property was registered with g_object_class_install_property().@value: the new value for the property@pspec: the #GParamSpec describing the property<!-- ##### USER_FUNCTION GObjectFinalizeFunc ##### --><para>The type of the @finalize function of #GObjectClass.</para>@object: the #GObject being finalized<!-- ##### MACRO G_TYPE_IS_OBJECT ##### --><para>Returns a boolean value of %FALSE or %TRUE indicating whetherthe passed in type id is a %G_TYPE_OBJECT or derived from it.</para>@type: Type id to check for is a %G_TYPE_OBJECT relationship.@Returns: %FALSE or %TRUE, indicating whether @type is a %G_TYPE_OBJECT.<!-- ##### MACRO G_OBJECT ##### --><para>Casts a #GObject or derived pointer into a (GObject*) pointer.Depending on the current debugging level, this function may invokecertain runtime checks to identify invalid casts.</para>@object: Object which is subject to casting.<!-- ##### MACRO G_IS_OBJECT ##### --><para>Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_OBJECT.</para>@object: Instance to check for being a %G_TYPE_OBJECT.<!-- ##### MACRO G_OBJECT_CLASS ##### --><para>Casts a derived #GObjectClass structure into a #GObjectClass structure.</para>@class: a valid #GObjectClass<!-- ##### MACRO G_IS_OBJECT_CLASS ##### --><para>Checks whether @class "is a" valid #GObjectClass structure of type%G_TYPE_OBJECT or derived.</para>@class: a #GObjectClass<!-- ##### MACRO G_OBJECT_GET_CLASS ##### --><para>Returns the class structure associated to a #GObject instance.</para>@object: a #GObject instance.<!-- ##### MACRO G_OBJECT_TYPE ##### --><para>Return the type id of an object.</para>@object: Object to return the type id for.@Returns: Type id of @object.<!-- ##### MACRO G_OBJECT_TYPE_NAME ##### --><para>Returns the name of an object's type.</para>@object: Object to return the type name for.@Returns: Type name of @object. The string is owned by the type system and should not be freed.<!-- ##### MACRO G_OBJECT_CLASS_TYPE ##### --><para>Return the type id of a class structure.</para>@class: a valid #GObjectClass@Returns: Type id of @class.<!-- ##### MACRO G_OBJECT_CLASS_NAME ##### --><para>Return the name of a class structure's type.</para>@class: a valid #GObjectClass@Returns: Type name of @class. The string is owned by the type system and should not be freed.<!-- ##### FUNCTION g_object_class_install_property ##### --><para>Installs a new property. This is usually done in the class initializer.</para>@oclass: a #GObjectClass@property_id: the id for the new property@pspec: the #GParamSpec for the new property<!-- ##### FUNCTION g_object_class_find_property ##### --><para>Looks up the #GParamSpec for a property of a class.</para>@oclass: a #GObjectClass@property_name: the name of the property to look up@Returns: the #GParamSpec for the property, or %NULL if the class doesn't havea property of that name<!-- ##### FUNCTION g_object_class_list_properties ##### --><para>Returns an array of #GParamSpec* for all properties of a class.</para>@oclass: a #GObjectClass@n_properties: return location for the length of the returned array@Returns: an array of #GParamSpec* which should be freed after use<!-- ##### FUNCTION g_object_class_override_property ##### --><para>Registers @property_id as referring to a property with thename @name in a parent class or in an interface implementedby @oclass. This allows this class to <firstterm>override</firstterm>a property implementation in a parent class or to providethe implementation of a property from an interface.</para><note><para>Internally, overriding is implemented by creating a property of type#GParamSpecOverride; generally operations that query the properties ofthe object class, such as g_object_class_find_property() org_object_class_list_properties() will return the overriddenproperty. However, in one case, the @construct_properties argument ofthe @constructor virtual function, the #GParamSpecOverride is passedinstead, so that the @param_id field of the #GParamSpec will becorrect. For virtually all uses, this makes no difference. If youneed to get the overridden property, you can callg_param_spec_get_redirect_target().</para></note>@oclass: a #GObjectClass@property_id: the new property ID@name: the name of a property registered in a parent class or in an interface of this class.<!-- ##### FUNCTION g_object_interface_install_property ##### --><para>Add a property to an interface; this is only useful for interfacesthat are added to GObject-derived types. Adding a property to aninterface forces all objects classes with that interface to have acompatible property. The compatible property could be a newlycreated #GParamSpec, but normallyg_object_class_override_property() will be used so that the objectclass only needs to provide an implementation and inherits theproperty description, default value, bounds, and so forth from theinterface property.</para><para>This function is meant to be called from the interface's defaultvtable initialization function (the @class_init member of#GTypeInfo.) It must not be called after after @class_init hasbeen called for any object types implementing this interface.</para>@g_iface: any interface vtable for the interface, or the default vtable for the interface.@pspec: the #GParamSpec for the new property@Since: 2.4<!-- ##### FUNCTION g_object_interface_find_property ##### --><para>Find the #GParamSpec with the given name for aninterface. Generally, the interface vtable passed in as @g_ifacewill be the default vtable from g_type_default_interface_ref(), or,if you know the interface has already been loaded,g_type_default_interface_peek().</para>@g_iface: any interface vtable for the interface, or the default vtable for the interface@property_name: name of a property to lookup.@Returns: the #GParamSpec for the property of the interface with the name @property_name, or %NULL if no such property exists.@Since: 2.4<!-- ##### FUNCTION g_object_interface_list_properties ##### --><para>Lists the properties of an interface.Generally, the interfacevtable passed in as @g_iface will be the default vtable fromg_type_default_interface_ref(), or, if you know the interface hasalready been loaded, g_type_default_interface_peek().</para>@g_iface: any interface vtable for the interface, or the default vtable for the interface@n_properties_p: location to store number of properties returned.@Returns: a pointer to an array of pointers to #GParamSpec structures. The paramspecs are owned by GLib, but the array should be freed with g_free() when you are done with it.@Since: 2.4<!-- ##### FUNCTION g_object_new ##### --><para>Creates a new instance of a #GObject subtype and sets its properties.</para><para>Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.</para>@object_type: the type id of the #GObject subtype to instantiate@first_property_name: the name of the first property@Varargs: the value of the first property, followed optionally by more name/value pairs, followed by %NULL@Returns: a new instance of @object_type<!-- ##### FUNCTION g_object_newv ##### --><para>Creates a new instance of a #GObject subtype and sets its properties.</para><para>Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.</para>@object_type: the type id of the #GObject subtype to instantiate@n_parameters: the length of the @parameters array@parameters: an array of #GParameter@Returns: a new instance of @object_type<!-- ##### STRUCT GParameter ##### --><para>The <structname>GParameter</structname> struct is an auxiliary structure usedto hand parameter name/value pairs to g_object_newv().</para>@name: the parameter name@value: the parameter value<!-- ##### FUNCTION g_object_ref ##### --><para>Increases the reference count of @object.</para>@object: a #GObject@Returns: @object<!-- ##### FUNCTION g_object_unref ##### --><para>Decreases the reference count if @object.When its reference count drops to 0, the object is finalized (i.e. its memory is freed).</para>@object: a #GObject<!-- ##### USER_FUNCTION GWeakNotify ##### --><para>A #GWeakNotify function can be added to an object as a callback that getstriggered when the object is finalized. Since the object is already beingfinalized when the #GWeakNotify is called, there's not much you could do with the object, apart from e.g. using its adress as hash-index or the like. </para>@data: data that was provided when the weak reference was established@where_the_object_was: the object being finalized<!-- ##### FUNCTION g_object_weak_ref ##### --><para>Adds a weak reference callback to an object. Weak references are used fornotification when an object is finalized. They are called "weak references" because they allow you to safely hold a pointer to an object without calling g_object_ref() (g_object_ref() adds a strong reference, that is, forces the object to stay alive).</para>@object: #GObject to reference weakly@notify: callback to invoke before the object is freed@data: extra data to pass to notify<!-- ##### FUNCTION g_object_weak_unref ##### --><para>Removes a weak reference callback to an object.</para>@object: #GObject to remove a weak reference from@notify: callback to search for@data: data to search for<!-- ##### FUNCTION g_object_add_weak_pointer ##### --><para>Adds a weak reference from weak_pointer to @object to indicate thatthe pointer located at @weak_pointer_location is only valid during the lifetime of @object. When the @object is finalized, @weak_pointer will be set to %NULL.</para>@object: The object that should be weak referenced.@weak_pointer_location: The memory address of a pointer.<!-- ##### FUNCTION g_object_remove_weak_pointer ##### --><para>Removes a weak reference from @object that was previously addedusing g_object_add_weak_pointer(). The @weak_pointer_location hasto match the one used with g_object_add_weak_pointer().</para>@object: The object that is weak referenced.@weak_pointer_location: The memory address of a pointer.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?