Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
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
- 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 ()
- clearColorButtonRgba :: (MonadIO m, IsColorButton o) => o -> m ()
- constructColorButtonRgba :: (IsColorButton o, MonadIO m) => RGBA -> m (GValueConstruct o)
- getColorButtonRgba :: (MonadIO m, IsColorButton o) => o -> m (Maybe RGBA)
- setColorButtonRgba :: (MonadIO m, IsColorButton o) => o -> RGBA -> 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 ()
- constructColorButtonUseAlpha :: (IsColorButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getColorButtonUseAlpha :: (MonadIO m, IsColorButton o) => o -> m Bool
- setColorButtonUseAlpha :: (MonadIO m, IsColorButton o) => o -> Bool -> m ()
- type C_ColorButtonColorSetCallback = Ptr () -> Ptr () -> IO ()
- type ColorButtonColorSetCallback = IO ()
- afterColorButtonColorSet :: (IsColorButton a, MonadIO m) => a -> ColorButtonColorSetCallback -> m SignalHandlerId
- genClosure_ColorButtonColorSet :: MonadIO m => ColorButtonColorSetCallback -> m (GClosure C_ColorButtonColorSetCallback)
- mk_ColorButtonColorSetCallback :: C_ColorButtonColorSetCallback -> IO (FunPtr C_ColorButtonColorSetCallback)
- noColorButtonColorSetCallback :: Maybe ColorButtonColorSetCallback
- onColorButtonColorSet :: (IsColorButton a, MonadIO m) => a -> ColorButtonColorSetCallback -> m SignalHandlerId
- wrap_ColorButtonColorSetCallback :: ColorButtonColorSetCallback -> C_ColorButtonColorSetCallback
Exported types
newtype ColorButton Source #
Memory-managed wrapper type.
Instances
Eq ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton (==) :: ColorButton -> ColorButton -> Bool # (/=) :: ColorButton -> ColorButton -> Bool # | |
IsGValue ColorButton Source # | Convert |
Defined in GI.Gtk.Objects.ColorButton toGValue :: ColorButton -> IO GValue # fromGValue :: GValue -> IO ColorButton # | |
ManagedPtrNewtype ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton | |
TypedObject ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton | |
GObject ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton | |
HasParentTypes ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton | |
type ParentTypes ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton type ParentTypes ColorButton = '[Widget, Object, ImplementorIface, 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
(GObject o, IsDescendantOf ColorButton o) => IsColorButton o Source # | |
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
Overloaded methods
getModal
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> m Bool | Returns: |
Gets whether the dialog is modal.
getTitle
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> m Text | Returns: An internal string, do not free the return value |
Gets the title of the color selection dialog.
new
:: (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.
newWithRgba
colorButtonNewWithRgba Source #
:: (HasCallStack, MonadIO m) | |
=> RGBA |
|
-> m ColorButton | Returns: a new color button |
Creates a new color button.
setModal
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the dialog should be modal.
setTitle
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the title for the color selection dialog.
Properties
modal
No description available in the introspection data.
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 ]
rgba
The RGBA color.
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, 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
.
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.
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 selection 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 ]
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.
constructColorButtonUseAlpha :: (IsColorButton 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
.
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 colorSet signal is 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 notify[color](#g:signal:color) signal.
afterColorButtonColorSet :: (IsColorButton a, MonadIO m) => 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
genClosure_ColorButtonColorSet :: MonadIO m => ColorButtonColorSetCallback -> m (GClosure C_ColorButtonColorSetCallback) Source #
Wrap the callback into a GClosure
.
mk_ColorButtonColorSetCallback :: C_ColorButtonColorSetCallback -> IO (FunPtr C_ColorButtonColorSetCallback) Source #
Generate a function pointer callable from C code, from a C_ColorButtonColorSetCallback
.
noColorButtonColorSetCallback :: Maybe ColorButtonColorSetCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ColorButtonColorSetCallback
onColorButtonColorSet :: (IsColorButton a, MonadIO m) => 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