Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|

License | LGPL-2.1 |

Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |

Safe Haskell | None |

Language | Haskell2010 |

The `Geometry`

struct gives the window manager information about
a window’s geometry constraints. Normally you would set these on
the GTK+ level using

. *gtk_window_set_geometry_hints()*

then sets the hints on the *GtkWindow*`Window`

it creates.

`windowSetGeometryHints`

expects the hints to be fully valid already
and simply passes them to the window manager; in contrast,

performs some interpretation. For example,
*gtk_window_set_geometry_hints()*

will apply the hints to the geometry widget instead of the
toplevel window, if you set a geometry widget. Also, the
*GtkWindow** minWidth*/

*/*

`minHeight`

*/*

`maxWidth`

*fields may be set to -1, and*

`maxHeight`

*GtkWindow*

will substitute the size request of the window or geometry widget.
If the minimum size hint is not provided, *GtkWindow*

will use its requisition
as the minimum size. If the minimum size is provided and a geometry widget is
set, *GtkWindow*

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

is to get a
terminal widget to resize properly. Here, the terminal text area should be
the geometry widget; *gtk_window_set_geometry_hints()*

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 *GtkWindow** widthInc* and

*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.*

`heightInc`

Here’s an example of how the terminal example would be implemented, assuming a terminal area widget called “terminal” and a toplevel window “toplevel”:

*C code*

GdkGeometry hints; hints.base_width = terminal->char_width; hints.base_height = terminal->char_height; hints.min_width = terminal->char_width; hints.min_height = terminal->char_height; hints.width_inc = terminal->char_width; hints.height_inc = terminal->char_height; gtk_window_set_geometry_hints (GTK_WINDOW (toplevel), GTK_WIDGET (terminal), &hints, GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE);

The other useful fields are the * minAspect* and

*fields; these contain a width/height ratio as a floating point number. If a geometry widget is set, the aspect applies to the geometry widget rather than the entire window. The most common use of these hints is probably to set*

`maxAspect`

*and*

`minAspect`

*to the same value, thus forcing the window to keep a constant aspect ratio.*

`maxAspect`

## Synopsis

- newtype Geometry = Geometry (ManagedPtr Geometry)
- newZeroGeometry :: MonadIO m => m Geometry
- noGeometry :: Maybe Geometry
- getGeometryBaseHeight :: MonadIO m => Geometry -> m Int32
- setGeometryBaseHeight :: MonadIO m => Geometry -> Int32 -> m ()
- getGeometryBaseWidth :: MonadIO m => Geometry -> m Int32
- setGeometryBaseWidth :: MonadIO m => Geometry -> Int32 -> m ()
- getGeometryHeightInc :: MonadIO m => Geometry -> m Int32
- setGeometryHeightInc :: MonadIO m => Geometry -> Int32 -> m ()
- getGeometryMaxAspect :: MonadIO m => Geometry -> m Double
- setGeometryMaxAspect :: MonadIO m => Geometry -> Double -> m ()
- getGeometryMaxHeight :: MonadIO m => Geometry -> m Int32
- setGeometryMaxHeight :: MonadIO m => Geometry -> Int32 -> m ()
- getGeometryMaxWidth :: MonadIO m => Geometry -> m Int32
- setGeometryMaxWidth :: MonadIO m => Geometry -> Int32 -> m ()
- getGeometryMinAspect :: MonadIO m => Geometry -> m Double
- setGeometryMinAspect :: MonadIO m => Geometry -> Double -> m ()
- getGeometryMinHeight :: MonadIO m => Geometry -> m Int32
- setGeometryMinHeight :: MonadIO m => Geometry -> Int32 -> m ()
- getGeometryMinWidth :: MonadIO m => Geometry -> m Int32
- setGeometryMinWidth :: MonadIO m => Geometry -> Int32 -> m ()
- getGeometryWidthInc :: MonadIO m => Geometry -> m Int32
- setGeometryWidthInc :: MonadIO m => Geometry -> Int32 -> m ()
- getGeometryWinGravity :: MonadIO m => Geometry -> m Gravity
- setGeometryWinGravity :: MonadIO m => Geometry -> Gravity -> m ()

# Exported types

Memory-managed wrapper type.

## Instances

WrappedPtr Geometry Source # | |

Defined in GI.Gdk.Structs.Geometry wrappedPtrCalloc :: IO (Ptr Geometry) # wrappedPtrCopy :: Geometry -> IO Geometry # | |

tag ~ AttrSet => Constructible Geometry tag Source # | |

Defined in GI.Gdk.Structs.Geometry |

# Properties

## baseHeight

allowed window widths are * baseHeight* +

** N where N is any integer (-1 allowed with*

`heightInc`

*GtkWindow*

)getGeometryBaseHeight :: MonadIO m => Geometry -> m Int32 Source #

Get the value of the “`base_height`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #baseHeight

setGeometryBaseHeight :: MonadIO m => Geometry -> Int32 -> m () Source #

Set the value of the “`base_height`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #baseHeight`:=`

value ]

## baseWidth

allowed window widths are * baseWidth* +

** N where N is any integer (-1 allowed with*

`widthInc`

*GtkWindow*

)getGeometryBaseWidth :: MonadIO m => Geometry -> m Int32 Source #

Get the value of the “`base_width`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #baseWidth

setGeometryBaseWidth :: MonadIO m => Geometry -> Int32 -> m () Source #

Set the value of the “`base_width`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #baseWidth`:=`

value ]

## heightInc

height resize increment

getGeometryHeightInc :: MonadIO m => Geometry -> m Int32 Source #

Get the value of the “`height_inc`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #heightInc

setGeometryHeightInc :: MonadIO m => Geometry -> Int32 -> m () Source #

Set the value of the “`height_inc`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #heightInc`:=`

value ]

## maxAspect

maximum width/height ratio

getGeometryMaxAspect :: MonadIO m => Geometry -> m Double Source #

Get the value of the “`max_aspect`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #maxAspect

setGeometryMaxAspect :: MonadIO m => Geometry -> Double -> m () Source #

Set the value of the “`max_aspect`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #maxAspect`:=`

value ]

## maxHeight

maximum height of window (or -1 to use requisition, with

only)*GtkWindow*

getGeometryMaxHeight :: MonadIO m => Geometry -> m Int32 Source #

Get the value of the “`max_height`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #maxHeight

setGeometryMaxHeight :: MonadIO m => Geometry -> Int32 -> m () Source #

Set the value of the “`max_height`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #maxHeight`:=`

value ]

## maxWidth

maximum width of window (or -1 to use requisition, with

only)*GtkWindow*

getGeometryMaxWidth :: MonadIO m => Geometry -> m Int32 Source #

Get the value of the “`max_width`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #maxWidth

setGeometryMaxWidth :: MonadIO m => Geometry -> Int32 -> m () Source #

Set the value of the “`max_width`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #maxWidth`:=`

value ]

## minAspect

minimum width/height ratio

getGeometryMinAspect :: MonadIO m => Geometry -> m Double Source #

Get the value of the “`min_aspect`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #minAspect

setGeometryMinAspect :: MonadIO m => Geometry -> Double -> m () Source #

Set the value of the “`min_aspect`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #minAspect`:=`

value ]

## minHeight

minimum height of window (or -1 to use requisition, with

only)*GtkWindow*

getGeometryMinHeight :: MonadIO m => Geometry -> m Int32 Source #

Get the value of the “`min_height`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #minHeight

setGeometryMinHeight :: MonadIO m => Geometry -> Int32 -> m () Source #

Set the value of the “`min_height`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #minHeight`:=`

value ]

## minWidth

minimum width of window (or -1 to use requisition, with

only)*GtkWindow*

getGeometryMinWidth :: MonadIO m => Geometry -> m Int32 Source #

Get the value of the “`min_width`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #minWidth

setGeometryMinWidth :: MonadIO m => Geometry -> Int32 -> m () Source #

Set the value of the “`min_width`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #minWidth`:=`

value ]

## widthInc

width resize increment

getGeometryWidthInc :: MonadIO m => Geometry -> m Int32 Source #

Get the value of the “`width_inc`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #widthInc

setGeometryWidthInc :: MonadIO m => Geometry -> Int32 -> m () Source #

Set the value of the “`width_inc`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #widthInc`:=`

value ]

## winGravity

window gravity, see *gtk_window_set_gravity()*

getGeometryWinGravity :: MonadIO m => Geometry -> m Gravity Source #

Get the value of the “`win_gravity`

” field.
When overloading is enabled, this is equivalent to

`get`

geometry #winGravity

setGeometryWinGravity :: MonadIO m => Geometry -> Gravity -> m () Source #

Set the value of the “`win_gravity`

” field.
When overloading is enabled, this is equivalent to

`set`

geometry [ #winGravity`:=`

value ]