Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gdk::Geometry Class Reference

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

`#include <inti/gdk/window.h>`

List of all members.

## Public Member Functions

Constructors

- Geometry ()
    Construct an empty geometry object.

Accessors

- GdkGeometry * gdk_geometry () const
    Get a pointer to the GdkGeometry structure.
- GdkWindowHints gdk_window_hints () const
    Returns the bit flags that indicate which values are currently set.
- int min_width () const
    Returns the minimum window width.
- int min_height () const
    Returns the minimum window height.
- int max_width () const
    Returns the maximum window width.
- int max_height () const
    Returns the maximum window height.
- int base_width () const
    Returns the base window width.
- int base_height () const
    Returns the base window height.
- int width_increment () const
    Returns the resize increment for the width.
- int height_increment () const
    Returns the resize increment for the height.
- double min_aspect_ratio () const
    Returns the minimum width/height ratio.
- double max_aspect_ratio () const
    Returns the maximum width/height ratio.
- bool min_size_set () const
    Returns true if the min size fields are set.
- bool max_size_set () const
    Returns true if the max size fields are set.
- bool base_size_set () const
    Returns true if the base size fields are set.
- bool aspect_range_set () const
    Returns true if the aspect ratio fields are set.
- bool resize_increments_set () const
    Returns true if the resize increment fields are set.

Methods

- void set_min_size (int width, int height)
    Sets the minimum window size.
- void unset_min_size ()
    Unsets the minimum size so that the minimum width and height fields will be ignored.
- void set_max_size (int width, int height)
    Sets the maximum window size.
- void unset_max_size ()
    Unsets the maximum size so that the maximum width and height fields will be ignored.
- void set_base_size (int width, int height)
    Sets the base window size.
- void unset_base_size ()
    Unsets the base size so that the base width and height fields will be ignored.
- void set_resize_increments (int width_inc, int height_inc)
    Sets the resize increments.
- void unset_resize_increments ()
    Unsets the resize increments so that the width_inc and height_inc fields will be ignored.
- void set_aspect_range (double min_aspect_ratio, double max_aspect_ratio)
    Sets the aspect range.
- void unset_aspect_range ()
    Unsets the aspect range so that the min_aspect_ratio and max_aspect_ratio fields will be ignored.
- void 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).

## 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 Inti::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).

Parameters:

  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.

void Inti::Gdk::Geometry::set_aspect_range | ( | double | min_aspect_ratio,
|  | double | max_aspect_ratio
| ) |

Sets the aspect range.

Parameters:

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

void Inti::Gdk::Geometry::set_base_size | ( | int | width,
|  | int | height
| ) |

Sets the base window size.

Parameters:

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

void Inti::Gdk::Geometry::set_max_size | ( | int | width,
|  | int | height
| ) |

Sets the maximum window size.

Parameters:

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

void Inti::Gdk::Geometry::set_min_size | ( | int | width,
|  | int | height
| ) |

Sets the minimum window size.

Parameters:

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

void Inti::Gdk::Geometry::set_resize_increments | ( | int | width_inc,
|  | int | height_inc
| ) |

Sets the resize increments.

Parameters:

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

The documentation for this class was generated from the following file:

- gdk/window.h

Main Page - Footer