Logo Search packages:      
Sourcecode: ardour version File versions

bool Gtk::Window::parse_geometry ( const Glib::ustring geometry  ) 

Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this. parse_geometry() does work on all GTK+ ports including Win32 but is primarily intended for an X environment.

If either a size or a position can be extracted from the geometry string, parse_geometry() returns true and calls set_default_size() and/or move() to resize/move the window.

If parse_geometry() returns true, it will also set the Gdk::HINT_USER_POS and/or Gdk::HINT_USER_SIZE hints 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 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 set_geometry_hints() on the window.

 int
 main (int argc, char *argv[])
 {
 GtkWidget *window, vbox;
 GdkGeometry size_hints;
 
 gtk_init (&argc, &argv);
 
 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 vbox = gtk_vbox_new (<tt>false</tt>, 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'<tt>\\n</tt>", argv[1]);
 }
 
 gtk_widget_show_all (window);
 gtk_main();
 
 return 0;
 }
Parameters:
geometry Geometry string.
Returns:
true if string was parsed successfully.

Definition at line 887 of file window.cc.

References Glib::ustring::c_str(), and gobj().

{
  return gtk_window_parse_geometry(gobj(), geometry.c_str());
}


Generated by  Doxygen 1.6.0   Back to index