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.Interfaces.ColorChooser

Contents

- Exported types
- Methods
  - addPalette
  - getRgba
  - getUseAlpha
  - setRgba
  - setUseAlpha
- Properties
  - rgba
  - useAlpha
- Signals
  - colorActivated

Description

`GtkColorChooser` is an interface that is implemented by widgets for choosing colors.

Depending on the situation, colors may be allowed to have alpha (translucency).

In GTK, the main widgets that implement this interface are `ColorChooserWidget`, `ColorChooserDialog` and `ColorButton`.

Synopsis

- newtype ColorChooser = ColorChooser (ManagedPtr ColorChooser)
- class (GObject o, IsDescendantOf ColorChooser o) => IsColorChooser o
- toColorChooser :: (MonadIO m, IsColorChooser o) => o -> m ColorChooser
- colorChooserAddPalette :: (HasCallStack, MonadIO m, IsColorChooser a) => a -> Orientation -> Int32 -> Maybe [RGBA] -> m ()
- colorChooserGetRgba :: (HasCallStack, MonadIO m, IsColorChooser a) => a -> m RGBA
- colorChooserGetUseAlpha :: (HasCallStack, MonadIO m, IsColorChooser a) => a -> m Bool
- colorChooserSetRgba :: (HasCallStack, MonadIO m, IsColorChooser a) => a -> RGBA -> m ()
- colorChooserSetUseAlpha :: (HasCallStack, MonadIO m, IsColorChooser a) => a -> Bool -> m ()
- constructColorChooserRgba :: (IsColorChooser o, MonadIO m) => RGBA -> m (GValueConstruct o)
- getColorChooserRgba :: (MonadIO m, IsColorChooser o) => o -> m (Maybe RGBA)
- setColorChooserRgba :: (MonadIO m, IsColorChooser o) => o -> RGBA -> m ()
- constructColorChooserUseAlpha :: (IsColorChooser o, MonadIO m) => Bool -> m (GValueConstruct o)
- getColorChooserUseAlpha :: (MonadIO m, IsColorChooser o) => o -> m Bool
- setColorChooserUseAlpha :: (MonadIO m, IsColorChooser o) => o -> Bool -> m ()
- type ColorChooserColorActivatedCallback = RGBA -> IO ()
- afterColorChooserColorActivated :: (IsColorChooser a, MonadIO m) => a -> ((?self :: a) => ColorChooserColorActivatedCallback) -> m SignalHandlerId
- onColorChooserColorActivated :: (IsColorChooser a, MonadIO m) => a -> ((?self :: a) => ColorChooserColorActivatedCallback) -> m SignalHandlerId

# Exported types

newtype ColorChooser Source #

Deprecated: (Since version 4.10)Use `ColorDialog` and `ColorDialogButton`instead of widgets implementing `GtkColorChooser`

Memory-managed wrapper type.

Constructors

ColorChooser (ManagedPtr ColorChooser) | Deprecated: (Since version 4.10)Use `ColorDialog` and `ColorDialogButton`instead of widgets implementing `GtkColorChooser`

#### Instances

Instances details

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

class (GObject o, IsDescendantOf ColorChooser o) => IsColorChooser o Source #

Type class for types which can be safely cast to `ColorChooser`, for instance with `toColorChooser`.

#### Instances

Instances details

(GObject o, IsDescendantOf ColorChooser o) => IsColorChooser o Source # |
Instance details Defined in GI.Gtk.Interfaces.ColorChooser

toColorChooser :: (MonadIO m, IsColorChooser o) => o -> m ColorChooser Source #

Cast to `ColorChooser`, 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

addPalette, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getProperty, getQdata, getRgba, getUseAlpha.

#### Setters

setData, setDataFull, setProperty, setRgba, setUseAlpha.

## addPalette

colorChooserAddPalette Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) |
=> a | `chooser`: a `GtkColorChooser`
-> Orientation | `orientation`: `OrientationHorizontal` if the palette should be displayed in rows, `OrientationVertical` for columns
-> Int32 | `colorsPerLine`: the number of colors to show in each row/column
-> Maybe [RGBA] | `colors`: the colors of the palette
-> m () |

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

Adds a palette to the color chooser.

If `orientation` is horizontal, the colors are grouped in rows, with `colorsPerLine` colors in each row. If `horizontal` is `False`, the colors are grouped in columns instead.

The default color palette of `ColorChooserWidget` has 45 colors, organized in columns of 5 colors (this includes some grays).

The layout of the color chooser widget works best when the palettes have 9-10 columns.

Calling this function for the first time has the side effect of removing the default color palette from the color chooser.

If `colors` is `Nothing`, removes all previously added palettes.

## getRgba

colorChooserGetRgba Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) |
=> a | `chooser`: a `GtkColorChooser`
-> m RGBA |

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

Gets the currently-selected color.

## getUseAlpha

colorChooserGetUseAlpha Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) |
=> a | `chooser`: a `GtkColorChooser`
-> m Bool | Returns: `True` if the color chooser uses the alpha channel, `False` if not

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

Returns whether the color chooser shows the alpha channel.

## setRgba

colorChooserSetRgba Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) |
=> a | `chooser`: a `GtkColorChooser`
-> RGBA | `color`: the new color
-> m () |

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

Sets the color.

## setUseAlpha

colorChooserSetUseAlpha Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) |
=> a | `chooser`: a `GtkColorChooser`
-> Bool | `useAlpha`: `True` if color chooser should use alpha channel, `False` if not
-> m () |

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

Sets whether or not the color chooser should use the alpha channel.

# Properties

## rgba

The currently selected color, as a `GdkRGBA` struct.

The property can be set to change the current selection programmatically.

constructColorChooserRgba :: (IsColorChooser o, MonadIO m) => RGBA -> m (GValueConstruct o) Source #

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

getColorChooserRgba :: (MonadIO m, IsColorChooser o) => o -> m (Maybe RGBA) Source #

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

    get colorChooser #rgba

setColorChooserRgba :: (MonadIO m, IsColorChooser o) => o -> RGBA -> m () Source #

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

    set colorChooser [ #rgba := value ]

## useAlpha

Whether colors may have alpha (translucency).

When useAlpha is `False`, the `GdkRGBA` struct obtained via the ColorChooser:rgba property will be forced to have alpha == 1.

Implementations are expected to show alpha by rendering the color over a non-uniform background (like a checkerboard pattern).

constructColorChooserUseAlpha :: (IsColorChooser o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getColorChooserUseAlpha :: (MonadIO m, IsColorChooser o) => o -> m Bool Source #

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

    get colorChooser #useAlpha

setColorChooserUseAlpha :: (MonadIO m, IsColorChooser o) => o -> Bool -> m () Source #

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

    set colorChooser [ #useAlpha := value ]

# Signals

## colorActivated

type ColorChooserColorActivatedCallback Source #

Arguments

= RGBA | `color`: the color
-> IO () |

Deprecated: (Since version 4.10)Use `ColorDialog` and `ColorDialogButton`instead of widgets implementing `GtkColorChooser`

Emitted when a color is activated from the color chooser.

This usually happens when the user clicks a color swatch, or a color is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.

afterColorChooserColorActivated :: (IsColorChooser a, MonadIO m) => a -> ((?self :: a) => ColorChooserColorActivatedCallback) -> m SignalHandlerId Source #

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

    after colorChooser #colorActivated 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.

onColorChooserColorActivated :: (IsColorChooser a, MonadIO m) => a -> ((?self :: a) => ColorChooserColorActivatedCallback) -> m SignalHandlerId Source #

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

    on colorChooser #colorActivated callback