From 9e85fcbe7cc3cf296b125f149d20645c821d4b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20Ils=C3=B8?= Date: Tue, 27 Jan 2015 19:25:40 +0000 Subject: [PATCH] Paragraph explaining casting conventions via macro --- docs/reference/gtk/getting_started.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/reference/gtk/getting_started.xml b/docs/reference/gtk/getting_started.xml index 63d79cdc95..892425b329 100644 --- a/docs/reference/gtk/getting_started.xml +++ b/docs/reference/gtk/getting_started.xml @@ -75,6 +75,21 @@ by the windowing system: it will have a frame, a title bar and window controls, depending on the platform. + A window title is set using gtk_window_set_title(). This function + takes a GtkWindow* pointer and a string as input. As our + window pointer is a GtkWidget pointer, we need to cast it + to GtkWindow*. + But instead of casting window via + (GtkWindow*), + window can be cast using the macro + GTK_WINDOW(). + GTK_WINDOW() will check if the + pointer is an instance of the GtkWindow class, before casting, and emit a + warning if the check fails. More information about this convention + can be found + + here. + In order to terminate the application when the #GtkWindow is destroyed, we connect the #GtkWidget::destroy signal to the gtk_main_quit() function. This function will terminate the GTK+ main loop started by calling