summaryrefslogtreecommitdiff
path: root/gtk/gtkwindow.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2003-05-31 23:33:09 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2003-05-31 23:33:09 +0000
commiteed0e982f57fd6551eff8c526b59925ca10fbad2 (patch)
tree8f06402c1d4f0d7d9e4da78e6f2d963f7b0bc670 /gtk/gtkwindow.c
parent328b5872a4d680fddf8465a83f8a68a680d06ab8 (diff)
downloadgdk-pixbuf-eed0e982f57fd6551eff8c526b59925ca10fbad2.tar.gz
Add some hints and an example to the docs. (#98427)
2003-06-01 Matthias Clasen <maclas@gmx.de> * gtk/gtkwindow.c (gtk_window_parse_geometry): Add some hints and an example to the docs. (#98427)
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r--gtk/gtkwindow.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 082299a0c..f587d6104 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6504,7 +6504,52 @@ gtk_XParseGeometry (const char *string,
* indicating to the window manager that the size/position of
* the window was user-specified. This causes most window
* managers to honor the geometry.
+ *
+ * Note that for gtk_window_parse_geometry() to work as expected, it has
+ * to be called when the window has its "final" size, i.e. after calling
+ * gtk_widget_show_all() on the contents and gtk_window_set_geometry_hints()
+ * on the window.
*
+ * <informalexample><programlisting>
+ * int
+ * main (int argc, char *argv[])
+ * {
+ * GtkWidget *window, vbox;
+ * GdkGeometry size_hints;
+ *
+ * gtk_init (&amp;argc, &amp;argv);
+ *
+ * window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ * vbox = gtk_vbox_new (FALSE, 0);
+ *
+ * gtk_container_add (GTK_CONTAINER (window), vbox);
+ * fill_with_content (vbox);
+ * gtk_widget_show_all (vbox);
+ *
+ * size_hints = {
+ * 100, 50, 0, 0, 100, 50, 10, 10, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST
+ * };
+ *
+ * gtk_window_set_geometry_hints (GTK_WINDOW (window),
+ * window,
+ * &amp;size_hints,
+ * GDK_HINT_MIN_SIZE |
+ * GDK_HINT_BASE_SIZE |
+ * GDK_HINT_RESIZE_INC);
+ *
+ * if (argc &gt; 1)
+ * {
+ * if (!gtk_window_parse_geometry (GTK_WINDOW (window), argv[1]))
+ * fprintf (stderr, "Failed to parse '&percnt;s'\n", argv[1]);
+ * }
+ *
+ * gtk_widget_show_all (window);
+ * gtk_main ();
+ *
+ * return 0;
+ * }
+ * </programlisting></informalexample>
+ *
* Return value: %TRUE if string was parsed successfully
**/
gboolean