[gtk+] Paragraph explaining casting conventions via macro
- From: Bastian Ilsø Hougaard <bastianilso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Paragraph explaining casting conventions via macro
- Date: Tue, 27 Jan 2015 21:41:11 +0000 (UTC)
commit 9e85fcbe7cc3cf296b125f149d20645c821d4b62
Author: Bastian Ilsø <bastianilso src gnome org>
Date: Tue Jan 27 19:25:40 2015 +0000
Paragraph explaining casting conventions via macro
docs/reference/gtk/getting_started.xml | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/getting_started.xml b/docs/reference/gtk/getting_started.xml
index 63d79cd..892425b 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.</para>
+ <para>A window title is set using gtk_window_set_title(). This function
+ takes a GtkWindow* pointer and a string as input. As our
+ <varname>window</varname> pointer is a GtkWidget pointer, we need to cast it
+ to GtkWindow*.
+ But instead of casting <varname>window</varname> via
+ <varname>(GtkWindow*)</varname>,
+ <varname>window</varname> can be cast using the macro
+ <varname>GTK_WINDOW()</varname>.
+ <varname>GTK_WINDOW()</varname> 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
+ <ulink url="https://developer.gnome.org/gobject/stable/gtype-conventions.html">
+ here</ulink>.</para>
+
<para>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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]