Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List

Xfc::Gdk::Geometry Class Reference

A GdkGeometry C++ wrapper class. More...

#include <xfc/gdk/window.hh>

Inheritance diagram for Xfc::Gdk::Geometry:

Xfc::StackObject List of all members.

Public Member Functions


Detailed Description

A GdkGeometry C++ wrapper class.

The Geometry object gives the window manager information about a window's geometry constraints. Normally you would set these using Gtk::Window::set_geometry_hints(). Gtk::Window then sets the hints on the Gdk::Window it creates.

Gdk::Window::set_geometry_hints() expects the hints to be fully valid already and simply passes them to the window manager. In contrast, Gtk::Window::set_geometry_hints() performs some interpretation. For example, Gtk::Window will apply the hints to the geometry widget instead of the toplevel window, if you set a geometry widget. Also, if the min_width, min_height, max_width and max_height fields may be set to -1, Gtk::Window will substitute the size request of the window or geometry widget. If the minimum size hint is not provided, Gtk::Window will use its requisition as the minimum size. If the minimum size is provided and a geometry widget is set, Gtk::Window will take the minimum size as the minimum size of the geometry widget rather than the entire window. The base size is treated similarly.

The canonical use-case for Gtk::Window::set_geometry_hints() is to get a terminal widget to resize properly. Here, the terminal text area should be the geometry widget; Gtk::Window will then automatically set the base size to the size of other widgets in the terminal window, such as the menubar and scrollbar. Then, the width_inc and height_inc fields should be set to the size of one character in the terminal. Finally, the base size should be set to the size of one character. The net effect is that the minimum size of the terminal will have a 1x1 character terminal area, and only terminal sizes on the "character grid" will be allowed.

Example: How the terminal would be implemented.

 Gtk::Widget *terminal; // Assume a terminal area widget exists.
 Gtk::Window *toplevel; // Assume a toplevel window exists.
 Geometry hints;

 hints.set_base_size(terminal->char_width, terminal->char_height);
 hints.set_min_size(terminal->char_width, terminal->char_height);
 hints.set_resize_increments(terminal->char_width, terminal->char_height);
 toplevel->set_geometry_hints(terminal, hints);

Geometry uses default copy, assignment and destruction.

Member Function Documentation

void Xfc::Gdk::Geometry::set_min_size ( int  width,
int  height 

Sets the minimum window size.

width The minimum window width.
height The minimum window height.

void Xfc::Gdk::Geometry::set_max_size ( int  width,
int  height 

Sets the maximum window size.

width The maximum window width.
height The maximum window height.

void Xfc::Gdk::Geometry::set_base_size ( int  width,
int  height 

Sets the base window size.

width The base window width.
height The base window height.

void Xfc::Gdk::Geometry::set_resize_increments ( int  width_inc,
int  height_inc 

Sets the resize increments.

width_inc The resize increment for the width.
height_inc The resize increment for the height.

void Xfc::Gdk::Geometry::set_aspect_range ( double  min_aspect_ratio,
double  max_aspect_ratio 

Sets the aspect range.

min_aspect_ratio The minimum width/height aspect ratio.
max_aspect_ratio The maximum width/height aspect ratio.

void Xfc::Gdk::Geometry::constrain_size ( unsigned int  flags,
int  width,
int  height,
int *  new_width,
int *  new_height 

Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size).

flags A mask indicating what portions of geometry are set.
width The desired width of the window.
height The desired height of the window.
new_width The location to store resulting width.
new_height The location to store resulting height.

The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3