|
This section catalogs the functions in GtkWidgetClass more rigorously, and
describes the default implementation of each.
Widget destruction is not significantly different from
object destruction in general, as described in the section called Object
Finalization in the chapter called The GTK+ Object
and Type System. As always, there are three
phases: shutdown, destroy, and finalize. Only the destroy
method is a signal; the others are class functions only.
If you override any of the three, you must "chain up" to
the parent class implementation.
GtkWidget has default
implementations of all three; you should know what they
do:
-
In its shutdown method, a
GtkWidget removes itself from its parent
container (if any), and then unrealizes itself. This
implies that widgets are always unrealized inside
their destroy methods. It chains up to the GtkObject shutdown method
which emits the "destroy"
signal.
-
In its destroy method, a
GtkWidget releases the grab if it has it,
unreferences its style and sets widget->style to NULL, and gives up any
connections it had to the current selection. (GtkEntry and other
editable-text widgets allow you to select and paste
text.) It chains up to the
GtkObject destroy method which disconnects any
signal handlers for the object.
-
In its finalize method, a
GtkWidget frees a number of private data
structures (stored as object data, see the section called Attaching
Data to Objects in the chapter called The GTK+
Object and Type System), and frees widget->name. It chains
up to the GtkObject
finalize method which frees the instance struct.
|
|