gi-gtk-3.0.26: Gtk bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.ColorButton

Contents

Description

The ColorButton is a button which displays the currently selected color and allows to open a color selection dialog to change the color. It is suitable widget for selecting a color in a preference dialog.

CSS nodes

GtkColorButton has a single CSS node with name button. To differentiate it from a plain Button, it gets the .color style class.

Synopsis

Exported types

class GObject o => IsColorButton o Source #

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

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

getAlpha

colorButtonGetAlpha Source #

Arguments

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

button: a ColorButton

-> m Word16

Returns: an integer between 0 and 65535

Deprecated: (Since version 3.4)Use colorChooserGetRgba instead.

Returns the current alpha value.

Since: 2.4

getColor

colorButtonGetColor Source #

Arguments

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

button: a ColorButton

-> m Color 

Deprecated: (Since version 3.4)Use colorChooserGetRgba instead.

Sets color to be the current color in the ColorButton widget.

Since: 2.4

getTitle

colorButtonGetTitle Source #

Arguments

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

button: a ColorButton

-> m Text

Returns: An internal string, do not free the return value

Gets the title of the color selection dialog.

Since: 2.4

getUseAlpha

colorButtonGetUseAlpha Source #

Arguments

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

button: a ColorButton

-> m Bool

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

Deprecated: (Since version 3.4)Use colorChooserGetUseAlpha instead.

Does the color selection dialog use the alpha channel ?

Since: 2.4

new

colorButtonNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ColorButton

Returns: a new color button

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-selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

Since: 2.4

newWithColor

colorButtonNewWithColor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: A Color to set the current color with

-> m ColorButton

Returns: a new color button

Deprecated: (Since version 3.4)Use colorButtonNewWithRgba instead.

Creates a new color button.

Since: 2.4

newWithRgba

colorButtonNewWithRgba Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RGBA

rgba: A RGBA to set the current color with

-> m ColorButton

Returns: a new color button

Creates a new color button.

Since: 3.0

setAlpha

colorButtonSetAlpha Source #

Arguments

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

button: a ColorButton

-> Word16

alpha: an integer between 0 and 65535

-> m () 

Deprecated: (Since version 3.4)Use colorChooserSetRgba instead.

Sets the current opacity to be alpha.

Since: 2.4

setColor

colorButtonSetColor Source #

Arguments

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

button: a ColorButton

-> Color

color: A Color to set the current color with

-> m () 

Deprecated: Use colorChooserSetRgba instead.

Sets the current color to be color.

Since: 2.4

setTitle

colorButtonSetTitle Source #

Arguments

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

button: a ColorButton

-> Text

title: String containing new window title

-> m () 

Sets the title for the color selection dialog.

Since: 2.4

setUseAlpha

colorButtonSetUseAlpha Source #

Arguments

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

button: a ColorButton

-> Bool

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

-> m () 

Deprecated: (Since version 3.4)Use colorChooserSetUseAlpha instead.

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

Since: 2.4

Properties

alpha

The selected opacity value (0 fully transparent, 65535 fully opaque).

Since: 2.4

constructColorButtonAlpha :: IsColorButton o => Word32 -> IO (GValueConstruct o) Source #

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

getColorButtonAlpha :: (MonadIO m, IsColorButton o) => o -> m Word32 Source #

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

get colorButton #alpha

setColorButtonAlpha :: (MonadIO m, IsColorButton o) => o -> Word32 -> m () Source #

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

set colorButton [ #alpha := value ]

color

The selected color.

Since: 2.4

constructColorButtonColor :: IsColorButton o => Color -> IO (GValueConstruct o) Source #

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

getColorButtonColor :: (MonadIO m, IsColorButton o) => o -> m (Maybe Color) Source #

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

get colorButton #color

setColorButtonColor :: (MonadIO m, IsColorButton o) => o -> Color -> m () Source #

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

set colorButton [ #color := value ]

rgba

The RGBA color.

Since: 3.0

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

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

clear #rgba

constructColorButtonRgba :: IsColorButton 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.

getColorButtonRgba :: (MonadIO m, IsColorButton o) => o -> m (Maybe RGBA) Source #

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

get colorButton #rgba

setColorButtonRgba :: (MonadIO m, IsColorButton o) => o -> RGBA -> m () Source #

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

set colorButton [ #rgba := value ]

showEditor

Set this property to True to skip the palette in the dialog and go directly to the color editor.

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.

Since: 3.20

constructColorButtonShowEditor :: IsColorButton o => Bool -> IO (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 selection dialog

Since: 2.4

constructColorButtonTitle :: IsColorButton o => Text -> IO (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 ]

useAlpha

If this property is set to True, the color swatch on the button is rendered against a checkerboard background to show its opacity and the opacity slider is displayed in the color selection dialog.

Since: 2.4

constructColorButtonUseAlpha :: IsColorButton 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.

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

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

get colorButton #useAlpha

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

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

set colorButton [ #useAlpha := value ]

Signals

colorSet

type C_ColorButtonColorSetCallback = Ptr () -> Ptr () -> IO () Source #

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

type ColorButtonColorSetCallback = IO () Source #

The ::color-set signal is emitted when the user selects a color. When handling this signal, use gtk_color_button_get_rgba() 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 notify::color signal.

Since: 2.4

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

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

after colorButton #colorSet callback

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

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

on colorButton #colorSet callback