gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.Frame

Contents

- Exported types
- Methods
  - getChild
  - getLabel
  - getLabelAlign
  - getLabelWidget
  - new
  - setChild
  - setLabel
  - setLabelAlign
  - setLabelWidget
- Properties
  - child
  - label
  - labelWidget
  - labelXalign

Description

Surrounds its child with a decorative frame and an optional label.

<picture> <source srcset="frame-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkFrame" src="frame.png"> </picture>

If present, the label is drawn inside the top edge of the frame. The horizontal position of the label can be controlled with `frameSetLabelAlign`.

`GtkFrame` clips its child. You can use this to add rounded corners to widgets, but be aware that it also cuts off shadows.

# GtkFrame as GtkBuildable

An example of a UI definition fragment with GtkFrame:

### xml code

    <object class="GtkFrame">
      <property name="label-widget">
        <object class="GtkLabel" id="frame_label"/>
      </property>
      <property name="child">
        <object class="GtkEntry" id="frame_content"/>
      </property>
    </object>

# CSS nodes

    frame
    ├── <label widget>
    ╰── <child>

`GtkFrame` has a main CSS node with name “frame”, which is used to draw the visible border. You can set the appearance of the border using CSS properties like “border-style” on this node.

# Accessibility

`GtkFrame` uses the `AccessibleRoleGroup` role.

Synopsis

- newtype Frame = Frame (ManagedPtr Frame)
- class (GObject o, IsDescendantOf Frame o) => IsFrame o
- toFrame :: (MonadIO m, IsFrame o) => o -> m Frame
- frameGetChild :: (HasCallStack, MonadIO m, IsFrame a) => a -> m (Maybe Widget)
- frameGetLabel :: (HasCallStack, MonadIO m, IsFrame a) => a -> m (Maybe Text)
- frameGetLabelAlign :: (HasCallStack, MonadIO m, IsFrame a) => a -> m Float
- frameGetLabelWidget :: (HasCallStack, MonadIO m, IsFrame a) => a -> m (Maybe Widget)
- frameNew :: (HasCallStack, MonadIO m) => Maybe Text -> m Frame
- frameSetChild :: (HasCallStack, MonadIO m, IsFrame a, IsWidget b) => a -> Maybe b -> m ()
- frameSetLabel :: (HasCallStack, MonadIO m, IsFrame a) => a -> Maybe Text -> m ()
- frameSetLabelAlign :: (HasCallStack, MonadIO m, IsFrame a) => a -> Float -> m ()
- frameSetLabelWidget :: (HasCallStack, MonadIO m, IsFrame a, IsWidget b) => a -> Maybe b -> m ()
- clearFrameChild :: (MonadIO m, IsFrame o) => o -> m ()
- constructFrameChild :: (IsFrame o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getFrameChild :: (MonadIO m, IsFrame o) => o -> m (Maybe Widget)
- setFrameChild :: (MonadIO m, IsFrame o, IsWidget a) => o -> a -> m ()
- clearFrameLabel :: (MonadIO m, IsFrame o) => o -> m ()
- constructFrameLabel :: (IsFrame o, MonadIO m) => Text -> m (GValueConstruct o)
- getFrameLabel :: (MonadIO m, IsFrame o) => o -> m (Maybe Text)
- setFrameLabel :: (MonadIO m, IsFrame o) => o -> Text -> m ()
- clearFrameLabelWidget :: (MonadIO m, IsFrame o) => o -> m ()
- constructFrameLabelWidget :: (IsFrame o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getFrameLabelWidget :: (MonadIO m, IsFrame o) => o -> m (Maybe Widget)
- setFrameLabelWidget :: (MonadIO m, IsFrame o, IsWidget a) => o -> a -> m ()
- constructFrameLabelXalign :: (IsFrame o, MonadIO m) => Float -> m (GValueConstruct o)
- getFrameLabelXalign :: (MonadIO m, IsFrame o) => o -> m Float
- setFrameLabelXalign :: (MonadIO m, IsFrame o) => o -> Float -> m ()

# Exported types

newtype Frame Source #

Memory-managed wrapper type.

Constructors

Frame (ManagedPtr Frame) |

#### Instances

Instances details

Eq Frame Source # |
Instance details Defined in GI.Gtk.Objects.Frame Methods (==) :: Frame -> Frame -> Bool Source # (/=) :: Frame -> Frame -> Bool Source #
GObject Frame Source # |
Instance details Defined in GI.Gtk.Objects.Frame
ManagedPtrNewtype Frame Source # |
Instance details Defined in GI.Gtk.Objects.Frame Methods toManagedPtr :: Frame -> ManagedPtr Frame Source #
TypedObject Frame Source # |
Instance details Defined in GI.Gtk.Objects.Frame Methods glibType :: IO GType Source #
HasParentTypes Frame Source # |
Instance details Defined in GI.Gtk.Objects.Frame
IsGValue (Maybe Frame) Source # | Convert `Frame` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.Frame Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Frame -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Frame) Source #
type ParentTypes Frame Source # |
Instance details Defined in GI.Gtk.Objects.Frame type ParentTypes Frame = '[Widget, Object, Accessible, Buildable, ConstraintTarget]

class (GObject o, IsDescendantOf Frame o) => IsFrame o Source #

Type class for types which can be safely cast to `Frame`, for instance with `toFrame`.

#### Instances

Instances details

(GObject o, IsDescendantOf Frame o) => IsFrame o Source # |
Instance details Defined in GI.Gtk.Objects.Frame

toFrame :: (MonadIO m, IsFrame o) => o -> m Frame Source #

Cast to `Frame`, 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, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, 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, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChild, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLabel, getLabelAlign, getLabelWidget, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, 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

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

## getChild

frameGetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsFrame a) |
=> a | `frame`: a `GtkFrame`
-> m (Maybe Widget) | Returns: the child widget of `frame`

Gets the child widget of `frame`.

## getLabel

frameGetLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsFrame a) |
=> a | `frame`: a `GtkFrame`
-> m (Maybe Text) | Returns: the text in the label, or `Nothing` if there was no label widget or the label widget was not a `GtkLabel`. This string is owned by GTK and must not be modified or freed.

Returns the frame labels text.

If the frame's label widget is not a `GtkLabel`, `Nothing` is returned.

## getLabelAlign

frameGetLabelAlign Source #

Arguments

:: (HasCallStack, MonadIO m, IsFrame a) |
=> a | `frame`: a `GtkFrame`
-> m Float | Returns: the frames X alignment

Retrieves the X alignment of the frame’s label.

## getLabelWidget

frameGetLabelWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsFrame a) |
=> a | `frame`: a `GtkFrame`
-> m (Maybe Widget) | Returns: the label widget

Retrieves the label widget for the frame.

## new

frameNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe Text | `label`: the text to use as the label of the frame
-> m Frame | Returns: a new `GtkFrame` widget

Creates a new `GtkFrame`, with optional label `label`.

If `label` is `Nothing`, the label is omitted.

## setChild

frameSetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsFrame a, IsWidget b) |
=> a | `frame`: a `GtkFrame`
-> Maybe b | `child`: the child widget
-> m () |

Sets the child widget of `frame`.

## setLabel

frameSetLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsFrame a) |
=> a | `frame`: a `GtkFrame`
-> Maybe Text | `label`: the text to use as the label of the frame
-> m () |

Creates a new `GtkLabel` with the `label` and sets it as the frame's label widget.

## setLabelAlign

frameSetLabelAlign Source #

Arguments

:: (HasCallStack, MonadIO m, IsFrame a) |
=> a | `frame`: a `GtkFrame`
-> Float | `xalign`: The position of the label along the top edge of the widget. A value of 0.0 represents left alignment; 1.0 represents right alignment.
-> m () |

Sets the X alignment of the frame widget’s label.

The default value for a newly created frame is 0.0.

## setLabelWidget

frameSetLabelWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsFrame a, IsWidget b) |
=> a | `frame`: a `GtkFrame`
-> Maybe b | `labelWidget`: the new label widget
-> m () |

Sets the label widget for the frame.

This is the widget that will appear embedded in the top edge of the frame as a title.

# Properties

## child

The child widget.

clearFrameChild :: (MonadIO m, IsFrame o) => o -> m () Source #

Set the value of the “`child`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #child

constructFrameChild :: (IsFrame o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`child`” property. This is rarely needed directly, but it is used by `new`.

getFrameChild :: (MonadIO m, IsFrame o) => o -> m (Maybe Widget) Source #

Get the value of the “`child`” property. When overloading is enabled, this is equivalent to

    get frame #child

setFrameChild :: (MonadIO m, IsFrame o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`child`” property. When overloading is enabled, this is equivalent to

    set frame [ #child := value ]

## label

Text of the frame's label.

clearFrameLabel :: (MonadIO m, IsFrame o) => o -> m () Source #

Set the value of the “`label`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #label

constructFrameLabel :: (IsFrame o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`label`” property. This is rarely needed directly, but it is used by `new`.

getFrameLabel :: (MonadIO m, IsFrame o) => o -> m (Maybe Text) Source #

Get the value of the “`label`” property. When overloading is enabled, this is equivalent to

    get frame #label

setFrameLabel :: (MonadIO m, IsFrame o) => o -> Text -> m () Source #

Set the value of the “`label`” property. When overloading is enabled, this is equivalent to

    set frame [ #label := value ]

## labelWidget

Widget to display in place of the usual frame label.

clearFrameLabelWidget :: (MonadIO m, IsFrame o) => o -> m () Source #

Set the value of the “`label-widget`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #labelWidget

constructFrameLabelWidget :: (IsFrame o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`label-widget`” property. This is rarely needed directly, but it is used by `new`.

getFrameLabelWidget :: (MonadIO m, IsFrame o) => o -> m (Maybe Widget) Source #

Get the value of the “`label-widget`” property. When overloading is enabled, this is equivalent to

    get frame #labelWidget

setFrameLabelWidget :: (MonadIO m, IsFrame o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`label-widget`” property. When overloading is enabled, this is equivalent to

    set frame [ #labelWidget := value ]

## labelXalign

The horizontal alignment of the label.

constructFrameLabelXalign :: (IsFrame o, MonadIO m) => Float -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`label-xalign`” property. This is rarely needed directly, but it is used by `new`.

getFrameLabelXalign :: (MonadIO m, IsFrame o) => o -> m Float Source #

Get the value of the “`label-xalign`” property. When overloading is enabled, this is equivalent to

    get frame #labelXalign

setFrameLabelXalign :: (MonadIO m, IsFrame o) => o -> Float -> m () Source #

Set the value of the “`label-xalign`” property. When overloading is enabled, this is equivalent to

    set frame [ #labelXalign := value ]