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

Contents

- Exported types
- Methods
  - getModal
  - getTitle
  - getUseFont
  - getUseSize
  - new
  - newWithFont
  - setModal
  - setTitle
  - setUseFont
  - setUseSize
- Properties
  - modal
  - title
  - useFont
  - useSize
- Signals
  - activate
  - fontSet

Description

The `GtkFontButton` allows to open a font chooser dialog to change the font.

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

It is suitable widget for selecting a font in a preference dialog.

# CSS nodes

    fontbutton
    ╰── button.font
        ╰── [content]

`GtkFontButton` has a single CSS node with name fontbutton which contains a button node with the .font style class.

Synopsis

- newtype FontButton = FontButton (ManagedPtr FontButton)
- class (GObject o, IsDescendantOf FontButton o) => IsFontButton o
- toFontButton :: (MonadIO m, IsFontButton o) => o -> m FontButton
- fontButtonGetModal :: (HasCallStack, MonadIO m, IsFontButton a) => a -> m Bool
- fontButtonGetTitle :: (HasCallStack, MonadIO m, IsFontButton a) => a -> m Text
- fontButtonGetUseFont :: (HasCallStack, MonadIO m, IsFontButton a) => a -> m Bool
- fontButtonGetUseSize :: (HasCallStack, MonadIO m, IsFontButton a) => a -> m Bool
- fontButtonNew :: (HasCallStack, MonadIO m) => m FontButton
- fontButtonNewWithFont :: (HasCallStack, MonadIO m) => Text -> m FontButton
- fontButtonSetModal :: (HasCallStack, MonadIO m, IsFontButton a) => a -> Bool -> m ()
- fontButtonSetTitle :: (HasCallStack, MonadIO m, IsFontButton a) => a -> Text -> m ()
- fontButtonSetUseFont :: (HasCallStack, MonadIO m, IsFontButton a) => a -> Bool -> m ()
- fontButtonSetUseSize :: (HasCallStack, MonadIO m, IsFontButton a) => a -> Bool -> m ()
- constructFontButtonModal :: (IsFontButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getFontButtonModal :: (MonadIO m, IsFontButton o) => o -> m Bool
- setFontButtonModal :: (MonadIO m, IsFontButton o) => o -> Bool -> m ()
- constructFontButtonTitle :: (IsFontButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getFontButtonTitle :: (MonadIO m, IsFontButton o) => o -> m Text
- setFontButtonTitle :: (MonadIO m, IsFontButton o) => o -> Text -> m ()
- constructFontButtonUseFont :: (IsFontButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getFontButtonUseFont :: (MonadIO m, IsFontButton o) => o -> m Bool
- setFontButtonUseFont :: (MonadIO m, IsFontButton o) => o -> Bool -> m ()
- constructFontButtonUseSize :: (IsFontButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getFontButtonUseSize :: (MonadIO m, IsFontButton o) => o -> m Bool
- setFontButtonUseSize :: (MonadIO m, IsFontButton o) => o -> Bool -> m ()
- type FontButtonActivateCallback = IO ()
- afterFontButtonActivate :: (IsFontButton a, MonadIO m) => a -> ((?self :: a) => FontButtonActivateCallback) -> m SignalHandlerId
- onFontButtonActivate :: (IsFontButton a, MonadIO m) => a -> ((?self :: a) => FontButtonActivateCallback) -> m SignalHandlerId
- type FontButtonFontSetCallback = IO ()
- afterFontButtonFontSet :: (IsFontButton a, MonadIO m) => a -> ((?self :: a) => FontButtonFontSetCallback) -> m SignalHandlerId
- onFontButtonFontSet :: (IsFontButton a, MonadIO m) => a -> ((?self :: a) => FontButtonFontSetCallback) -> m SignalHandlerId

# Exported types

newtype FontButton Source #

Memory-managed wrapper type.

Constructors

FontButton (ManagedPtr FontButton) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf FontButton o) => IsFontButton o Source #

Type class for types which can be safely cast to `FontButton`, for instance with `toFontButton`.

#### Instances

Instances details

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

toFontButton :: (MonadIO m, IsFontButton o) => o -> m FontButton Source #

Cast to `FontButton`, 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, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFont, getFontDesc, getFontFace, getFontFamily, getFontFeatures, getFontMap, getFontOptions, getFontSize, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLanguage, getLastChild, getLayoutManager, getLevel, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getModal, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPreviewText, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getShowPreviewEntry, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTitle, getTooltipMarkup, getTooltipText, getUseFont, getUseSize, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFilterFunc, setFocusChild, setFocusOnClick, setFocusable, setFont, setFontDesc, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLanguage, setLayoutManager, setLevel, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setModal, setName, setOpacity, setOverflow, setParent, setPreviewText, setProperty, setReceivesDefault, setSensitive, setShowPreviewEntry, setSizeRequest, setStateFlags, setTitle, setTooltipMarkup, setTooltipText, setUseFont, setUseSize, setValign, setVexpand, setVexpandSet, setVisible.

## getModal

fontButtonGetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontButton a) |
=> a | `fontButton`: a `GtkFontButton`
-> m Bool | Returns: `True` if the dialog is modal

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

Gets whether the dialog is modal.

## getTitle

fontButtonGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontButton a) |
=> a | `fontButton`: a `GtkFontButton`
-> m Text | Returns: an internal copy of the title string which must not be freed.

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

Retrieves the title of the font chooser dialog.

## getUseFont

fontButtonGetUseFont Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontButton a) |
=> a | `fontButton`: a `GtkFontButton`
-> m Bool | Returns: whether the selected font is used in the label.

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

Returns whether the selected font is used in the label.

## getUseSize

fontButtonGetUseSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontButton a) |
=> a | `fontButton`: a `GtkFontButton`
-> m Bool | Returns: whether the selected size is used in the label.

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

Returns whether the selected size is used in the label.

## new

fontButtonNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m FontButton | Returns: a new font picker widget.

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

Creates a new font picker widget.

## newWithFont

fontButtonNewWithFont Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `fontname`: Name of font to display in font chooser dialog
-> m FontButton | Returns: a new font picker widget.

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

Creates a new font picker widget showing the given font.

## setModal

fontButtonSetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontButton a) |
=> a | `fontButton`: a `GtkFontButton`
-> Bool | `modal`: `True` to make the dialog modal
-> m () |

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

Sets whether the dialog should be modal.

## setTitle

fontButtonSetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontButton a) |
=> a | `fontButton`: a `GtkFontButton`
-> Text | `title`: a string containing the font chooser dialog title
-> m () |

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

Sets the title for the font chooser dialog.

## setUseFont

fontButtonSetUseFont Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontButton a) |
=> a | `fontButton`: a `GtkFontButton`
-> Bool | `useFont`: If `True`, font name will be written using font chosen.
-> m () |

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

If `useFont` is `True`, the font name will be written using the selected font.

## setUseSize

fontButtonSetUseSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontButton a) |
=> a | `fontButton`: a `GtkFontButton`
-> Bool | `useSize`: If `True`, font name will be written using the selected size.
-> m () |

Deprecated: (Since version 4.10)Use `FontDialogButton` instead

If `useSize` is `True`, the font name will be written using the selected size.

# Properties

## modal

Whether the font chooser dialog should be modal.

constructFontButtonModal :: (IsFontButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getFontButtonModal :: (MonadIO m, IsFontButton o) => o -> m Bool Source #

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

    get fontButton #modal

setFontButtonModal :: (MonadIO m, IsFontButton o) => o -> Bool -> m () Source #

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

    set fontButton [ #modal := value ]

## title

The title of the font chooser dialog.

constructFontButtonTitle :: (IsFontButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getFontButtonTitle :: (MonadIO m, IsFontButton o) => o -> m Text Source #

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

    get fontButton #title

setFontButtonTitle :: (MonadIO m, IsFontButton o) => o -> Text -> m () Source #

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

    set fontButton [ #title := value ]

## useFont

Whether the buttons label will be drawn in the selected font.

constructFontButtonUseFont :: (IsFontButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getFontButtonUseFont :: (MonadIO m, IsFontButton o) => o -> m Bool Source #

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

    get fontButton #useFont

setFontButtonUseFont :: (MonadIO m, IsFontButton o) => o -> Bool -> m () Source #

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

    set fontButton [ #useFont := value ]

## useSize

Whether the buttons label will use the selected font size.

constructFontButtonUseSize :: (IsFontButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getFontButtonUseSize :: (MonadIO m, IsFontButton o) => o -> m Bool Source #

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

    get fontButton #useSize

setFontButtonUseSize :: (MonadIO m, IsFontButton o) => o -> Bool -> m () Source #

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

    set fontButton [ #useSize := value ]

# Signals

## activate

type FontButtonActivateCallback = IO () Source #

Emitted to when the font button is activated.

The `::activate` signal on `GtkFontButton` is an action signal and emitting it causes the button to present its dialog.

Since: 4.4

afterFontButtonActivate :: (IsFontButton a, MonadIO m) => a -> ((?self :: a) => FontButtonActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the activate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after fontButton #activate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onFontButtonActivate :: (IsFontButton a, MonadIO m) => a -> ((?self :: a) => FontButtonActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the activate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on fontButton #activate callback

## fontSet

type FontButtonFontSetCallback = IO () Source #

Emitted when the user selects a font.

When handling this signal, use `fontChooserGetFont` to find out which font was just selected.

Note that this signal is only emitted when the user changes the font. If you need to react to programmatic font changes as well, use the notifyfont signal.

afterFontButtonFontSet :: (IsFontButton a, MonadIO m) => a -> ((?self :: a) => FontButtonFontSetCallback) -> m SignalHandlerId Source #

Connect a signal handler for the fontSet signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after fontButton #fontSet callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onFontButtonFontSet :: (IsFontButton a, MonadIO m) => a -> ((?self :: a) => FontButtonFontSetCallback) -> m SignalHandlerId Source #

Connect a signal handler for the fontSet signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on fontButton #fontSet callback