gi-gtk-4.0.4: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.Fixed

Description

The Fixed widget is a container which can place child widgets at fixed positions and with fixed sizes, given in pixels. Fixed performs no automatic layout management.

For most applications, you should not use this container! It keeps you from having to learn about the other GTK+ containers, but it results in broken applications. With Fixed, the following things will result in truncated text, overlapping widgets, and other display bugs:

  • Themes, which may change widget sizes.
  • Fonts other than the one you used to write the app will of course change the size of widgets containing text; keep in mind that users may use a larger font because of difficulty reading the default, or they may be using a different OS that provides different fonts.
  • Translation of text into other languages changes its size. Also, display of non-English text will use a different font in many cases.

In addition, Fixed does not pay attention to text direction and thus may produce unwanted results if your app is run under right-to-left languages such as Hebrew or Arabic. That is: normally GTK will order containers appropriately for the text direction, e.g. to put labels to the right of the thing they label when using an RTL language, but it can’t do that with Fixed. So if you need to reorder widgets depending on the text direction, you would need to manually detect it and adjust child positions accordingly.

Finally, fixed positioning makes it kind of annoying to add/remove GUI elements, since you have to reposition all the other elements. This is a long-term maintenance problem for your application.

If you know none of these things are an issue for your application, and prefer the simplicity of Fixed, by all means use the widget. But you should be aware of the tradeoffs.

Synopsis

Exported types

newtype Fixed Source #

Memory-managed wrapper type.

Constructors

Fixed (ManagedPtr Fixed) 

Instances

Instances details
Eq Fixed Source # 
Instance details

Defined in GI.Gtk.Objects.Fixed

Methods

(==) :: Fixed -> Fixed -> Bool #

(/=) :: Fixed -> Fixed -> Bool #

GObject Fixed Source # 
Instance details

Defined in GI.Gtk.Objects.Fixed

ManagedPtrNewtype Fixed Source # 
Instance details

Defined in GI.Gtk.Objects.Fixed

Methods

toManagedPtr :: Fixed -> ManagedPtr Fixed

TypedObject Fixed Source # 
Instance details

Defined in GI.Gtk.Objects.Fixed

Methods

glibType :: IO GType

HasParentTypes Fixed Source # 
Instance details

Defined in GI.Gtk.Objects.Fixed

IsGValue (Maybe Fixed) Source #

Convert Fixed to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.Fixed

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Fixed -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Fixed)

type ParentTypes Fixed Source # 
Instance details

Defined in GI.Gtk.Objects.Fixed

class (GObject o, IsDescendantOf Fixed o) => IsFixed o Source #

Type class for types which can be safely cast to Fixed, for instance with toFixed.

Instances

Instances details
(GObject o, IsDescendantOf Fixed o) => IsFixed o Source # 
Instance details

Defined in GI.Gtk.Objects.Fixed

toFixed :: (MonadIO m, IsFixed o) => o -> m Fixed Source #

Cast to Fixed, for types for which this is known to be safe. For general casts, use castTo.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, move, notify, notifyByPspec, observeChildren, observeControllers, pick, put, queueAllocate, queueDraw, queueResize, realize, ref, refSink, remove, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateProperty, updateRelation, updateState, watchClosure.

Getters

getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBuildableId, getCanFocus, getCanTarget, getChildPosition, getChildTransform, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

Setters

setCanFocus, setCanTarget, setChildTransform, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

getChildPosition

fixedGetChildPosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsFixed a, IsWidget b) 
=> a

fixed: a Fixed

-> b

widget: a child of fixed

-> m (Double, Double) 

Retrieves the translation transformation of the given child Widget in the given Fixed container.

See also: fixedGetChildTransform.

getChildTransform

fixedGetChildTransform Source #

Arguments

:: (HasCallStack, MonadIO m, IsFixed a, IsWidget b) 
=> a

fixed: a Fixed

-> b

widget: a Widget, child of fixed

-> m (Maybe Transform)

Returns: a Transform or Nothing in case no transform has been set on widget

Retrieves the transformation for widget set using fixedSetChildTransform.

move

fixedMove Source #

Arguments

:: (HasCallStack, MonadIO m, IsFixed a, IsWidget b) 
=> a

fixed: a Fixed.

-> b

widget: the child widget.

-> Double

x: the horizontal position to move the widget to.

-> Double

y: the vertical position to move the widget to.

-> m () 

Sets a translation transformation to the given x and y coordinates to the child widget of the given Fixed container.

new

fixedNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Fixed

Returns: a new Fixed.

Creates a new Fixed.

put

fixedPut Source #

Arguments

:: (HasCallStack, MonadIO m, IsFixed a, IsWidget b) 
=> a

fixed: a Fixed.

-> b

widget: the widget to add.

-> Double

x: the horizontal position to place the widget at.

-> Double

y: the vertical position to place the widget at.

-> m () 

Adds a widget to a Fixed container and assigns a translation transformation to the given x and y coordinates to it.

remove

fixedRemove Source #

Arguments

:: (HasCallStack, MonadIO m, IsFixed a, IsWidget b) 
=> a

fixed: a Fixed

-> b

widget: the child widget to remove

-> m () 

Removes a child from fixed, after it has been added with fixedPut.

setChildTransform

fixedSetChildTransform Source #

Arguments

:: (HasCallStack, MonadIO m, IsFixed a, IsWidget b) 
=> a

fixed: a Fixed

-> b

widget: a Widget, child of fixed

-> Maybe Transform

transform: the transformation assigned to widget or Nothing to reset widget's transform

-> m () 

Sets the transformation for widget.

This is a convenience function that retrieves the FixedLayoutChild instance associated to widget and calls fixedLayoutChildSetTransform.