Gtk-- Reference: Gtk::Object

Class Index | Cross Index | Namespace Index

# Class Gtk::Object

The base class of the whole hierarchy
Contained in: Gtk
Derived from: Gtk::Base
Derived by: Gtk::Data Gtk::Widget

#include <gtk--/object.h>

### public function member index:
``emitable` `signal` `void`` | `destroy` | `()`;
``void`` | `destroy_` | `()`;
``gpointer`` | `get_data` | `(`const` `string`& `key`) `const``;
``gpointer`` | `get_data_by_id` | `(`GQuark` `data_id`) `const``;
``gpointer`` | `get_user_data` | `() `const``;
``GtkObject`*` | `gtkobj` | `()`;
``const` `GtkObject`*` | `gtkobj` | `() `const``;
``static` `bool`` | `isA` | `(`Object`* `object`)`;
``gint`` | `nsignals` | `()`;
``void`` | `remove_data` | `(`const` `string`& `key`)`;
``void`` | `remove_data_by_id` | `(`GQuark` `data_id`)`;
``void`` | `remove_no_notify` | `(`const` `string`& `key`)`;
``void`` | `remove_no_notify_by_id` | `(`GQuark` `data_id`)`;
``void`` | `set_data` | `(`const` `string`& `key`, `gpointer` `data`)`;
``void`` | `set_data_by_id` | `(`GQuark` `data_id`, `gpointer` `data`)`;
``void`` | `set_data_by_id_full` | `(`GQuark` `data_id`, `gpointer` `data`, `GtkDestroyNotify` `destroy`)`;
``void`` | `set_data_full` | `(`const` `string`& `key`, `gpointer` `data`, `GtkDestroyNotify` `destroy`)`;
``virtual` `void`` | `set_dynamic` | `()`;
``void`` | `set_user_data` | `(`gpointer` `data`)`;
``guint`*` | `signals` | `()`;
``guint`` | `type` | `()`;
``virtual`` | `~Object` | `()`;
### protected function member index:
``static` `void`` | `destroy_notify_` | `(`gpointer` `s`)`;
``static` `void`` | `gtkmm_sigsegv` | `(`const` `char`* `name`)`;
``virtual` `void`` | `reference` | `()`;
``void`` | `set_type` | `(`GtkType` `type`)`;
``virtual` `void`` | `unreference` | `()`;
``void`` | `weakref` | `(`GtkDestroyNotify` `notify`, `gpointer` `data`)`;
``void`` | `weakunref` | `(`GtkDestroyNotify` `notify`, `gpointer` `data`)`;

## Description:

`Gtk::Object` is the root of the gtkmm type hierarchy. It serves a similar roles as java's Object class. It is used by the type-casting system to represent the base composite type.

Objects have arguments that are name/typed-value pairs. They may be readable or writable (or both or neither). The special handlers in every object are responsible for setting and getting these parameters. If the handler for a given argument must be called before the object may be used, be sure the `GTK_ARG_CONSTRUCT` or `GTK_ARG_CONSTRUCT_ONLY` flags are set; otherwise they are set only when the user does so.

Object also store a simpler association table, sometimes called the object_data. This is just an efficient mapping from a fixed set of strings to a gpointer. This can be used as arbitrary extra members. Notice that each new field name allocates a new quark, so it is probably best only to use this for fields with fixed names.

The primary difference between object_data and arguments is that the object defines two functions which set and get each type of argument. The object just has a table to store its object data in: it does not receive notice when data changes.

## Function Member Descriptions:

Gtk::Object::destroy - destroy object

``emitable` `signal` `void`` `destroy``()`;

> This can be used to tell toplevel widgets that they should die if they are managed(). You should never connect a slot which references "this" because destroy is called during dtor.

Gtk::Object::get_data - Get a named field from the object's table of associations (the object_data).

``gpointer`` `get_data``(`const` `string`& `key`) `const``;

> key: Name of the key for that association.

> Returns: The data if found, or NULL if no such data exists.

Gtk::Object::get_data_by_id - Just like `get_data` except that it takes a GQuark instead of a string, so it is slightly faster.

``gpointer`` `get_data_by_id``(`GQuark` `data_id`) `const``;

> Use `` and `` to get an id from a string.

Gtk::Object::get_user_data - Get the object's user data pointer.

``gpointer`` `get_user_data``() `const``;

> This is intended to be a pointer for your convenience in writing applications.

Gtk::Object::gtkobj - Returns the underlaying gtk+ object.

``GtkObject`*` `gtkobj``()`;
Gtk::Object::isA - Returns true if object is this type.

``static` `bool`` `isA``(`Object`* `object`)`;
Gtk::Object::remove_data - Remove a specified datum from the object's data associations (the object_data).

``void`` `remove_data``(`const` `string`& `key`)`;

> Subsequent calls to `get_data` will return NULL.

> If you specified a destroy handler with `set_data_full`, it will be invoked.

> key: Name of the key for that association.

Gtk::Object::remove_data_by_id - Just like `remove_data` except that it takes a GQuark instead of a string, so it is slightly faster.

``void`` `remove_data_by_id``(`GQuark` `data_id`)`;

> Remove a specified datum from the object's data associations. Subsequent calls to `get_data` will return NULL.

> Use `` and `` to get an id from a string.

> data_id: Quark of the key.

Gtk::Object::remove_no_notify - Remove a specified datum from the object's data associations (the object_data), without invoking the association's destroy handler.

``void`` `remove_no_notify``(`const` `string`& `key`)`;

> Just like `remove_data` except that any destroy handler will be ignored. Therefore this only affects data set using `set_data_full`.

> key: Name of the key for that association.

Gtk::Object::remove_no_notify_by_id - Just like `remove_no_notify` except that it takes a GQuark instead of a string, so it is slightly faster.

``void`` `remove_no_notify_by_id``(`GQuark` `data_id`)`;

> Use `` and `` to get an id from a string.

> data_id: Quark of the key.

Gtk::Object::set_data - Each object carries around a table of associations from strings to pointers. This function lets you set an association.

``void`` `set_data``(`const` `string`& `key`, `gpointer` `data`)`;

> If the object already had an association with that name, the old association will be destroyed. key: Name of the key.

> data: Data to associate with that key.

Gtk::Object::set_data_by_id - Just like `set_data` except that it takes a GQuark instead of a string, so it is slightly faster.

``void`` `set_data_by_id``(`GQuark` `data_id`, `gpointer` `data`)`;

> Use `` and `` to get an id from a string.

> data_id: Quark of the key.

> data: Data to associate with that key.

Gtk::Object::set_data_by_id_full - Just like `set_data_full` except that it takes a GQuark instead of a string, so it is slightly faster.

``void`` `set_data_by_id_full``(`GQuark` `data_id`, `gpointer` `data`, `GtkDestroyNotify` `destroy`)`;

> Use `` and `` to get an id from a string.

> data_id: Quark of the key.

> data: Data to associate with that key.

> destroy: Function to call when the association is destroyed.

Gtk::Object::set_data_full - Like `set_data` except it adds notification for when the association is destroyed, either by `remove_data` or when the object is destroyed.

``void`` `set_data_full``(`const` `string`& `key`, `gpointer` `data`, `GtkDestroyNotify` `destroy`)`;

> key: Name of the key.

> data: Data to associate with that key.

> destroy: Function to call when the association is destroyed.

Gtk::Object::set_user_data - For convenience, every object offers a generic user data pointer. This function sets it.

``void`` `set_user_data``(`gpointer` `data`)`;
Gtk::Object::weakref - Adds a weak reference callback to an object.

``void`` `weakref``(`GtkDestroyNotify` `notify`, `gpointer` `data`)`;

> Weak references are a mechanism to safely keep a pointer to an object without using the reference counting mechansim. They use a callback function to receive notice that the object is about to be freed (aka finalized). This happens after the destroy callback has been run.

> notify: Callback to invoke before the object is freed. data: Extra data to pass to notify.

Gtk::Object::weakunref - Removes a weak reference callback to an object.

``void`` `weakunref``(`GtkDestroyNotify` `notify`, `gpointer` `data`)`;

> notify: Callback to search for. data: Data to search for.

## Variable Member Descriptions: