gi-gtk-3.0.31: Gtk bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Interfaces.ColorChooser

Contents

Description

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

Since: 3.4

Synopsis

Exported types

newtype ColorChooser Source #

Memory-managed wrapper type.

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
(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

addPalette

colorChooserAddPalette Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) 
=> a

chooser: a ColorChooser

-> 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, or Nothing

-> m () 

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 27 colors, organized in columns of 3 colors. The default gray palette has 9 grays in a single row.

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 and gray palettes from the color chooser.

If colors is Nothing, removes all previously added palettes.

Since: 3.4

getRgba

colorChooserGetRgba Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) 
=> a

chooser: a ColorChooser

-> m RGBA 

Gets the currently-selected color.

Since: 3.4

getUseAlpha

colorChooserGetUseAlpha Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) 
=> a

chooser: a ColorChooser

-> m Bool

Returns: True if the color chooser uses the alpha channel, False if not

Returns whether the color chooser shows the alpha channel.

Since: 3.4

setRgba

colorChooserSetRgba Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) 
=> a

chooser: a ColorChooser

-> RGBA

color: the new color

-> m () 

Sets the color.

Since: 3.4

setUseAlpha

colorChooserSetUseAlpha Source #

Arguments

:: (HasCallStack, MonadIO m, IsColorChooser a) 
=> a

chooser: a ColorChooser

-> Bool

useAlpha: True if color chooser should use alpha channel, False if not

-> m () 

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

Since: 3.4

Properties

rgba

The ::rgba property contains the currently selected color, as a RGBA struct. The property can be set to change the current selection programmatically.

Since: 3.4

constructColorChooserRgba :: IsColorChooser o => RGBA -> IO (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

When ::use-alpha is True, colors may have alpha (translucency) information. When it is False, the RGBA 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).

Since: 3.4

constructColorChooserUseAlpha :: IsColorChooser o => Bool -> IO (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 C_ColorChooserColorActivatedCallback = Ptr () -> Ptr RGBA -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ColorChooserColorActivatedCallback Source #

Arguments

 = RGBA

color: the color

-> IO () 

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.

Since: 3.4

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

Connect a signal handler for the “color-activated” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after colorChooser #colorActivated callback

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

Connect a signal handler for the “color-activated” signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on colorChooser #colorActivated callback