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

Contents

- Exported types
- Methods
  - getModal
  - getTitle
  - new
  - newWithRgba
  - setModal
  - setTitle
- Properties
  - modal
  - showEditor
  - title
- Signals
  - activate
  - colorSet

Description

The `GtkColorButton` allows to open a color chooser dialog to change the color.

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

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

# CSS nodes

    colorbutton
    ╰── button.color
        ╰── [content]

`GtkColorButton` has a single CSS node with name colorbutton which contains a button node. To differentiate it from a plain `GtkButton`, it gets the .color style class.

Synopsis

- newtype ColorButton = ColorButton (ManagedPtr ColorButton)
- class (GObject o, IsDescendantOf ColorButton o) => IsColorButton o
- toColorButton :: (MonadIO m, IsColorButton o) => o -> m ColorButton
- colorButtonGetModal :: (HasCallStack, MonadIO m, IsColorButton a) => a -> m Bool
- colorButtonGetTitle :: (HasCallStack, MonadIO m, IsColorButton a) => a -> m Text
- colorButtonNew :: (HasCallStack, MonadIO m) => m ColorButton
- colorButtonNewWithRgba :: (HasCallStack, MonadIO m) => RGBA -> m ColorButton
- colorButtonSetModal :: (HasCallStack, MonadIO m, IsColorButton a) => a -> Bool -> m ()
- colorButtonSetTitle :: (HasCallStack, MonadIO m, IsColorButton a) => a -> Text -> m ()
- constructColorButtonModal :: (IsColorButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getColorButtonModal :: (MonadIO m, IsColorButton o) => o -> m Bool
- setColorButtonModal :: (MonadIO m, IsColorButton o) => o -> Bool -> m ()
- constructColorButtonShowEditor :: (IsColorButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getColorButtonShowEditor :: (MonadIO m, IsColorButton o) => o -> m Bool
- setColorButtonShowEditor :: (MonadIO m, IsColorButton o) => o -> Bool -> m ()
- constructColorButtonTitle :: (IsColorButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getColorButtonTitle :: (MonadIO m, IsColorButton o) => o -> m Text
- setColorButtonTitle :: (MonadIO m, IsColorButton o) => o -> Text -> m ()
- type ColorButtonActivateCallback = IO ()
- afterColorButtonActivate :: (IsColorButton a, MonadIO m) => a -> ((?self :: a) => ColorButtonActivateCallback) -> m SignalHandlerId
- onColorButtonActivate :: (IsColorButton a, MonadIO m) => a -> ((?self :: a) => ColorButtonActivateCallback) -> m SignalHandlerId
- type ColorButtonColorSetCallback = IO ()
- afterColorButtonColorSet :: (IsColorButton a, MonadIO m) => a -> ((?self :: a) => ColorButtonColorSetCallback) -> m SignalHandlerId
- onColorButtonColorSet :: (IsColorButton a, MonadIO m) => a -> ((?self :: a) => ColorButtonColorSetCallback) -> m SignalHandlerId

# Exported types

newtype ColorButton Source #

Memory-managed wrapper type.

Constructors

ColorButton (ManagedPtr ColorButton) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf ColorButton o) => IsColorButton o Source #

Type class for types which can be safely cast to `ColorButton`, for instance with `toColorButton`.

#### Instances

Instances details

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

toColorButton :: (MonadIO m, IsColorButton o) => o -> m ColorButton Source #

Cast to `ColorButton`, 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, addPalette, 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, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getModal, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRgba, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTitle, getTooltipMarkup, getTooltipText, getUseAlpha, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

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

## getModal

colorButtonGetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorButton a) |
=> a | `button`: a `GtkColorButton`
-> m Bool | Returns: `True` if the dialog is modal

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

Gets whether the dialog is modal.

## getTitle

colorButtonGetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorButton a) |
=> a | `button`: a `GtkColorButton`
-> m Text | Returns: An internal string, do not free the return value

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

Gets the title of the color chooser dialog.

## new

colorButtonNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m ColorButton | Returns: a new color button

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

Creates a new color button.

This returns a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a color chooser dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

## newWithRgba

colorButtonNewWithRgba Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RGBA | `rgba`: A `GdkRGBA` to set the current color with
-> m ColorButton | Returns: a new color button

Deprecated: (Since version 4.10)

Creates a new color button showing the given color.

## setModal

colorButtonSetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorButton a) |
=> a | `button`: a `GtkColorButton`
-> Bool | `modal`: `True` to make the dialog modal
-> m () |

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

Sets whether the dialog should be modal.

## setTitle

colorButtonSetTitle Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorButton a) |
=> a | `button`: a `GtkColorButton`
-> Text | `title`: String containing new window title
-> m () |

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

Sets the title for the color chooser dialog.

# Properties

## modal

Whether the color chooser dialog should be modal.

constructColorButtonModal :: (IsColorButton 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`.

getColorButtonModal :: (MonadIO m, IsColorButton o) => o -> m Bool Source #

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

    get colorButton #modal

setColorButtonModal :: (MonadIO m, IsColorButton o) => o -> Bool -> m () Source #

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

    set colorButton [ #modal := value ]

## showEditor

Whether the color chooser should open in editor mode.

This property should be used in cases where the palette in the editor would be redundant, such as when the color button is already part of a palette.

constructColorButtonShowEditor :: (IsColorButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getColorButtonShowEditor :: (MonadIO m, IsColorButton o) => o -> m Bool Source #

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

    get colorButton #showEditor

setColorButtonShowEditor :: (MonadIO m, IsColorButton o) => o -> Bool -> m () Source #

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

    set colorButton [ #showEditor := value ]

## title

The title of the color chooser dialog

constructColorButtonTitle :: (IsColorButton 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`.

getColorButtonTitle :: (MonadIO m, IsColorButton o) => o -> m Text Source #

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

    get colorButton #title

setColorButtonTitle :: (MonadIO m, IsColorButton o) => o -> Text -> m () Source #

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

    set colorButton [ #title := value ]

# Signals

## activate

type ColorButtonActivateCallback = IO () Source #

Emitted to when the color button is activated.

The `::activate` signal on `GtkMenuButton` is an action signal and emitting it causes the button to pop up its dialog.

Since: 4.4

afterColorButtonActivate :: (IsColorButton a, MonadIO m) => a -> ((?self :: a) => ColorButtonActivateCallback) -> 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 colorButton #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.

onColorButtonActivate :: (IsColorButton a, MonadIO m) => a -> ((?self :: a) => ColorButtonActivateCallback) -> 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 colorButton #activate callback

## colorSet

type ColorButtonColorSetCallback = IO () Source #

Emitted when the user selects a color.

When handling this signal, use `colorChooserGetRgba` to find out which color was just selected.

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

afterColorButtonColorSet :: (IsColorButton a, MonadIO m) => a -> ((?self :: a) => ColorButtonColorSetCallback) -> m SignalHandlerId Source #

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

    after colorButton #colorSet 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.

onColorButtonColorSet :: (IsColorButton a, MonadIO m) => a -> ((?self :: a) => ColorButtonColorSetCallback) -> m SignalHandlerId Source #

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

    on colorButton #colorSet callback