Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
The #GdkGeometry 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(). #GtkWindow then sets the hints on the #GdkWindow 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,
#GtkWindow will apply the hints to the geometry widget instead of the
toplevel window, if you set a geometry widget. Also, the
min_width/
min_height@max_width@max_height fields may be set to -1, and
#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 gtk_window_set_geometry_hints() is to get a
terminal widget to resize properly. Here, the terminal text area should be
the geometry widget; #GtkWindow 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.
Here’s an example of how the terminal example would be implemented, assuming a terminal area widget called “terminal” and a toplevel window “toplevel”:
|[language="C" -- 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 min_aspect and
max_aspect 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 min_aspect and
max_aspect to the same value, thus forcing the window to keep a constant
aspect ratio.
- newtype Geometry = Geometry (ForeignPtr Geometry)
- newZeroGeometry :: MonadIO m => m Geometry
- noGeometry :: Maybe Geometry
- geometryBaseHeight :: AttrLabelProxy "baseHeight"
- geometryReadBaseHeight :: MonadIO m => Geometry -> m Int32
- geometryWriteBaseHeight :: MonadIO m => Geometry -> Int32 -> m ()
- geometryBaseWidth :: AttrLabelProxy "baseWidth"
- geometryReadBaseWidth :: MonadIO m => Geometry -> m Int32
- geometryWriteBaseWidth :: MonadIO m => Geometry -> Int32 -> m ()
- geometryHeightInc :: AttrLabelProxy "heightInc"
- geometryReadHeightInc :: MonadIO m => Geometry -> m Int32
- geometryWriteHeightInc :: MonadIO m => Geometry -> Int32 -> m ()
- geometryMaxAspect :: AttrLabelProxy "maxAspect"
- geometryReadMaxAspect :: MonadIO m => Geometry -> m Double
- geometryWriteMaxAspect :: MonadIO m => Geometry -> Double -> m ()
- geometryMaxHeight :: AttrLabelProxy "maxHeight"
- geometryReadMaxHeight :: MonadIO m => Geometry -> m Int32
- geometryWriteMaxHeight :: MonadIO m => Geometry -> Int32 -> m ()
- geometryMaxWidth :: AttrLabelProxy "maxWidth"
- geometryReadMaxWidth :: MonadIO m => Geometry -> m Int32
- geometryWriteMaxWidth :: MonadIO m => Geometry -> Int32 -> m ()
- geometryMinAspect :: AttrLabelProxy "minAspect"
- geometryReadMinAspect :: MonadIO m => Geometry -> m Double
- geometryWriteMinAspect :: MonadIO m => Geometry -> Double -> m ()
- geometryMinHeight :: AttrLabelProxy "minHeight"
- geometryReadMinHeight :: MonadIO m => Geometry -> m Int32
- geometryWriteMinHeight :: MonadIO m => Geometry -> Int32 -> m ()
- geometryMinWidth :: AttrLabelProxy "minWidth"
- geometryReadMinWidth :: MonadIO m => Geometry -> m Int32
- geometryWriteMinWidth :: MonadIO m => Geometry -> Int32 -> m ()
- geometryReadWidthInc :: MonadIO m => Geometry -> m Int32
- geometryWidthInc :: AttrLabelProxy "widthInc"
- geometryWriteWidthInc :: MonadIO m => Geometry -> Int32 -> m ()
- geometryReadWinGravity :: MonadIO m => Geometry -> m Gravity
- geometryWinGravity :: AttrLabelProxy "winGravity"
- geometryWriteWinGravity :: MonadIO m => Geometry -> Gravity -> m ()
Exported types
(~) AttrOpTag tag AttrSet => Constructible Geometry tag | |
((~) * info (ResolveGeometryMethod t Geometry), MethodInfo * info Geometry p) => IsLabelProxy t (Geometry -> p) | |
type AttributeList Geometry |
newZeroGeometry :: MonadIO m => m Geometry Source
Construct a Geometry
struct initialized to zero.
Properties
BaseHeight
geometryBaseHeight :: AttrLabelProxy "baseHeight" Source
geometryReadBaseHeight :: MonadIO m => Geometry -> m Int32 Source
geometryWriteBaseHeight :: MonadIO m => Geometry -> Int32 -> m () Source
BaseWidth
geometryBaseWidth :: AttrLabelProxy "baseWidth" Source
geometryReadBaseWidth :: MonadIO m => Geometry -> m Int32 Source
geometryWriteBaseWidth :: MonadIO m => Geometry -> Int32 -> m () Source
HeightInc
geometryHeightInc :: AttrLabelProxy "heightInc" Source
geometryReadHeightInc :: MonadIO m => Geometry -> m Int32 Source
geometryWriteHeightInc :: MonadIO m => Geometry -> Int32 -> m () Source
MaxAspect
geometryMaxAspect :: AttrLabelProxy "maxAspect" Source
geometryReadMaxAspect :: MonadIO m => Geometry -> m Double Source
geometryWriteMaxAspect :: MonadIO m => Geometry -> Double -> m () Source
MaxHeight
geometryMaxHeight :: AttrLabelProxy "maxHeight" Source
geometryReadMaxHeight :: MonadIO m => Geometry -> m Int32 Source
geometryWriteMaxHeight :: MonadIO m => Geometry -> Int32 -> m () Source
MaxWidth
geometryMaxWidth :: AttrLabelProxy "maxWidth" Source
geometryReadMaxWidth :: MonadIO m => Geometry -> m Int32 Source
geometryWriteMaxWidth :: MonadIO m => Geometry -> Int32 -> m () Source
MinAspect
geometryMinAspect :: AttrLabelProxy "minAspect" Source
geometryReadMinAspect :: MonadIO m => Geometry -> m Double Source
geometryWriteMinAspect :: MonadIO m => Geometry -> Double -> m () Source
MinHeight
geometryMinHeight :: AttrLabelProxy "minHeight" Source
geometryReadMinHeight :: MonadIO m => Geometry -> m Int32 Source
geometryWriteMinHeight :: MonadIO m => Geometry -> Int32 -> m () Source
MinWidth
geometryMinWidth :: AttrLabelProxy "minWidth" Source
geometryReadMinWidth :: MonadIO m => Geometry -> m Int32 Source
geometryWriteMinWidth :: MonadIO m => Geometry -> Int32 -> m () Source
WidthInc
geometryReadWidthInc :: MonadIO m => Geometry -> m Int32 Source
geometryWidthInc :: AttrLabelProxy "widthInc" Source
geometryWriteWidthInc :: MonadIO m => Geometry -> Int32 -> m () Source
WinGravity
geometryReadWinGravity :: MonadIO m => Geometry -> m Gravity Source
geometryWinGravity :: AttrLabelProxy "winGravity" Source
geometryWriteWinGravity :: MonadIO m => Geometry -> Gravity -> m () Source