Synopsis
#include <gtk/gtk.h>
GtkObject;
#define GTK_OBJECT_TYPE (object)
#define GTK_OBJECT_TYPE_NAME (object)
enum GtkObjectFlags;
#define GTK_OBJECT_FLAGS (obj)
#define GTK_OBJECT_FLOATING (obj)
enum GtkArgFlags;
GtkObject* gtk_object_new (GtkType type,
const gchar *first_property_name,
...);
void gtk_object_sink (GtkObject *object);
GtkObject* gtk_object_ref (GtkObject *object);
void gtk_object_unref (GtkObject *object);
void gtk_object_weakref (GtkObject *object,
GDestroyNotify notify,
gpointer data);
void gtk_object_weakunref (GtkObject *object,
GDestroyNotify notify,
gpointer data);
void gtk_object_destroy (GtkObject *object);
void gtk_object_get (GtkObject *object,
const gchar *first_property_name,
...);
void gtk_object_set (GtkObject *object,
const gchar *first_property_name,
...);
void gtk_object_set_data (GtkObject *object,
const gchar *key,
gpointer data);
void gtk_object_set_data_full (GtkObject *object,
const gchar *key,
gpointer data,
GDestroyNotify destroy);
void gtk_object_remove_data (GtkObject *object,
const gchar *key);
gpointer gtk_object_get_data (GtkObject *object,
const gchar *key);
void gtk_object_remove_no_notify (GtkObject *object,
const gchar *key);
void gtk_object_set_user_data (GtkObject *object,
gpointer data);
gpointer gtk_object_get_user_data (GtkObject *object);
void gtk_object_add_arg_type (const gchar *arg_name,
GtkType arg_type,
guint arg_flags,
guint arg_id);
void gtk_object_set_data_by_id (GtkObject *object,
GQuark data_id,
gpointer data);
void gtk_object_set_data_by_id_full (GtkObject *object,
GQuark data_id,
gpointer data,
GDestroyNotify destroy);
gpointer gtk_object_get_data_by_id (GtkObject *object,
GQuark data_id);
void gtk_object_remove_data_by_id (GtkObject *object,
GQuark data_id);
void gtk_object_remove_no_notify_by_id (GtkObject *object,
GQuark key_id);
#define gtk_object_data_try_key
#define gtk_object_data_force_id
Object Hierarchy
GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----GtkAdjustment
+----GtkCellRenderer
+----GtkFileFilter
+----GtkItemFactory
+----GtkTooltips
+----GtkTreeViewColumn
+----GtkRecentFilter
DescriptionDescriptionGtkObject is the base class for all widgets, and for a few non-widget objects such as GtkAdjustment. GtkObject predates GObject; non-widgets that derive from GtkObject rather than GObject do so for backward compatibility reasons.
GtkObjects are created with a "floating" reference count.
This means that the initial reference is not owned by anyone. Calling
When you add a widget to its parent container, the parent container will do this: g_object_ref_sink (G_OBJECT (child_widget)); This means that the container now owns a reference to the child widget and the child widget has no floating reference. The purpose of the floating reference is to keep the child widget alive until you add it to a parent container: button = gtk_button_new (); /* button has one floating reference to keep it alive */ gtk_container_add (GTK_CONTAINER (container), button); /* button has one non-floating reference owned by the container */
GtkWindow is a special case, because GTK+ itself will ref/sink it on creation.
That is, after calling
One more factor comes into play: the "destroy" signal, emitted by the
Some simple rules for handling ""
DetailsGtkObjecttypedef struct _GtkObject GtkObject; The object itself. You should never use these members directly - use the accessing macros instead. GTK_OBJECT_TYPE()#define GTK_OBJECT_TYPE(object) (G_TYPE_FROM_INSTANCE (object)) Gets the type of an object.
GTK_OBJECT_TYPE_NAME()#define GTK_OBJECT_TYPE_NAME(object) (g_type_name (GTK_OBJECT_TYPE (object))) Gets the name of an objects type.
enum GtkObjectFlagstypedef enum
{
GTK_IN_DESTRUCTION = 1 << 0, /* Used internally during dispose */
#if !defined (GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
GTK_FLOATING = 1 << 1,
#endif
GTK_RESERVED_1 = 1 << 2,
GTK_RESERVED_2 = 1 << 3
} GtkObjectFlags;
Tells about the state of the object. GTK_OBJECT_FLAGS()#define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags) Gets the GtkObjectFlags for an object without directly accessing its members.
GTK_OBJECT_FLOATING()#define GTK_OBJECT_FLOATING(obj) (g_object_is_floating (obj)) Warning
Evaluates to
enum GtkArgFlagstypedef enum
{
GTK_ARG_READABLE = G_PARAM_READABLE,
GTK_ARG_WRITABLE = G_PARAM_WRITABLE,
GTK_ARG_CONSTRUCT = G_PARAM_CONSTRUCT,
GTK_ARG_CONSTRUCT_ONLY = G_PARAM_CONSTRUCT_ONLY,
GTK_ARG_CHILD_ARG = 1 << 4
} GtkArgFlags;
Warning
Possible flags indicating how an argument should be treated.
gtk_object_new ()GtkObject* gtk_object_new (GtkType type, const gchar *first_property_name, ...); Warning
Constructs an object given its arguments, enumerated in the call to the function.
gtk_object_sink ()void gtk_object_sink (GtkObject *object); Warning
Removes the floating reference from a GtkObject, if it exists; otherwise does nothing. See the GtkObject overview documentation at the top of the page.
gtk_object_ref ()GtkObject* gtk_object_ref (GtkObject *object); Warning
Increases the reference count of the object.
gtk_object_unref ()void gtk_object_unref (GtkObject *object); Warning
Decreases the reference count of an object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).
gtk_object_weakref ()void gtk_object_weakref (GtkObject *object, GDestroyNotify notify, gpointer data); Warning
Adds a weak reference callback to an object. Weak references are used for notification when an object is
finalized. They are called "weak references" because they allow you to safely
hold a pointer to an object without calling
gtk_object_weakunref ()void gtk_object_weakunref (GtkObject *object, GDestroyNotify notify, gpointer data); Warning
Removes a weak reference callback to an object.
gtk_object_destroy ()void gtk_object_destroy (GtkObject *object); Emits the "destroy" signal notifying all reference holders that they should release the GtkObject. See the overview documentation at the top of the page for more details.
The memory for the object itself won't be deleted until
its reference count actually drops to 0;
gtk_object_get ()void gtk_object_get (GtkObject *object, const gchar *first_property_name, ...); Warning
Gets properties of an object.
gtk_object_set ()void gtk_object_set (GtkObject *object, const gchar *first_property_name, ...); Warning
Sets properties on an object.
void set_box_properties (GtkBox* box)
{
gtk_object_set (GTK_OBJECT (box), "homogeneous", TRUE,
"spacing", 8,
NULL);
}
gtk_object_set_data ()void gtk_object_set_data (GtkObject *object, const gchar *key, gpointer data); Warning
Each object carries around a table of associations from strings to pointers. This function lets you set an association. If the object already had an association with that name, the old association will be destroyed.
gtk_object_set_data_full ()void gtk_object_set_data_full (GtkObject *object, const gchar *key, gpointer data, GDestroyNotify destroy); Warning
Like
gtk_object_remove_data ()void gtk_object_remove_data (GtkObject *object, const gchar *key); Warning
Removes a specified datum from the object's data associations (the object_data).
Subsequent calls to
If you specified a destroy handler with
gtk_object_get_data ()gpointer gtk_object_get_data (GtkObject *object, const gchar *key); Warning
Get a named field from the object's table of associations (the object_data).
gtk_object_remove_no_notify ()void gtk_object_remove_no_notify (GtkObject *object, const gchar *key); Warning
Remove a specified datum from the object's data associations (the object_data), without invoking the association's destroy handler.
Just like
gtk_object_set_user_data ()void gtk_object_set_user_data (GtkObject *object, gpointer data); Warning
For convenience, every object offers a generic user data pointer. This function sets it.
gtk_object_get_user_data ()gpointer gtk_object_get_user_data (GtkObject *object); Warning
Get the object's user data pointer. This is intended to be a pointer for your convenience in writing applications.
gtk_object_add_arg_type ()void gtk_object_add_arg_type (const gchar *arg_name,
GtkType arg_type,
guint arg_flags,
guint arg_id);
Warning
Deprecated in favor of the GObject property system including GParamSpec. Add a new type of argument to an object class. Usually this is called when registering a new type of object.
gtk_object_set_data_by_id ()void gtk_object_set_data_by_id (GtkObject *object, GQuark data_id, gpointer data); Warning
Just like
Use
gtk_object_set_data_by_id_full ()void gtk_object_set_data_by_id_full (GtkObject *object, GQuark data_id, gpointer data, GDestroyNotify destroy); Warning
Just like
Use
gtk_object_get_data_by_id ()gpointer gtk_object_get_data_by_id (GtkObject *object, GQuark data_id); Warning
Just like
Use
gtk_object_remove_data_by_id ()void gtk_object_remove_data_by_id (GtkObject *object, GQuark data_id); Warning
Just like
Remove a specified datum from the object's data associations.
Subsequent calls to
Use
gtk_object_remove_no_notify_by_id ()void gtk_object_remove_no_notify_by_id (GtkObject *object, GQuark key_id); Warning
Just like
Use
gtk_object_data_try_key#define gtk_object_data_try_key g_quark_try_string Warning
Useless deprecated macro. Ignore it. Signal DetailsThe
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
the object which received the signal. |
|
user data set when the signal handler was connected. |