Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
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
- colorButtonGetAlpha :: (HasCallStack, MonadIO m, IsColorButton a) => a -> m Word16
- colorButtonGetColor :: (HasCallStack, MonadIO m, IsColorButton a) => a -> m Color
- colorButtonGetTitle :: (HasCallStack, MonadIO m, IsColorButton a) => a -> m Text
- colorButtonGetUseAlpha :: (HasCallStack, MonadIO m, IsColorButton a) => a -> m Bool
- colorButtonNew :: (HasCallStack, MonadIO m) => m ColorButton
- colorButtonNewWithColor :: (HasCallStack, MonadIO m) => Color -> m ColorButton
- colorButtonNewWithRgba :: (HasCallStack, MonadIO m) => RGBA -> m ColorButton
- colorButtonSetAlpha :: (HasCallStack, MonadIO m, IsColorButton a) => a -> Word16 -> m ()
- colorButtonSetColor :: (HasCallStack, MonadIO m, IsColorButton a) => a -> Color -> m ()
- colorButtonSetTitle :: (HasCallStack, MonadIO m, IsColorButton a) => a -> Text -> m ()
- colorButtonSetUseAlpha :: (HasCallStack, MonadIO m, IsColorButton a) => a -> Bool -> m ()
- constructColorButtonAlpha :: (IsColorButton o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getColorButtonAlpha :: (MonadIO m, IsColorButton o) => o -> m Word32
- setColorButtonAlpha :: (MonadIO m, IsColorButton o) => o -> Word32 -> m ()
- constructColorButtonColor :: (IsColorButton o, MonadIO m) => Color -> m (GValueConstruct o)
- getColorButtonColor :: (MonadIO m, IsColorButton o) => o -> m (Maybe Color)
- setColorButtonColor :: (MonadIO m, IsColorButton o) => o -> Color -> 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 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.
ColorButton (ManagedPtr ColorButton) |
Instances
Eq ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton (==) :: ColorButton -> ColorButton -> Bool # (/=) :: ColorButton -> ColorButton -> Bool # | |
GObject ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton | |
ManagedPtrNewtype ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton toManagedPtr :: ColorButton -> ManagedPtr ColorButton | |
TypedObject ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton | |
HasParentTypes ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton | |
IsGValue (Maybe ColorButton) Source # | Convert |
Defined in GI.Gtk.Objects.ColorButton gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ColorButton -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ColorButton) | |
type ParentTypes ColorButton Source # | |
Defined in GI.Gtk.Objects.ColorButton type ParentTypes ColorButton = '[Button, Bin, Container, Widget, Object, ImplementorIface, Actionable, Activatable, Buildable, ColorChooser] |
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
Click to display all available methods, including inherited ones
Methods
activate, add, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addPalette, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, clicked, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, destroy, destroyed, deviceIsShadowed, doSetRelatedAction, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, ensureStyle, enter, errorBell, event, forall, forceFloating, foreach, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, leave, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, pressed, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, released, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, resizeChildren, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, syncActionProperties, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetStateFlags, watchClosure.
Getters
getAccessible, getActionGroup, getActionName, getActionTargetValue, getAlignment, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAlpha, getAlwaysShowImage, getAncestor, getAppPaintable, getBorderWidth, getCanDefault, getCanFocus, getChild, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getColor, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEventWindow, getEvents, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusVadjustment, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getImage, getImagePosition, getInternalChild, getLabel, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRelatedAction, getRelief, getRequestMode, getRequisition, getResizeMode, getRgba, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTitle, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getUseActionAppearance, getUseAlpha, getUseStock, getUseUnderline, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.
Setters
setAccelPath, setActionName, setActionTargetValue, setAlignment, setAllocation, setAlpha, setAlwaysShowImage, setAppPaintable, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setColor, setCompositeName, setData, setDataFull, setDetailedActionName, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEvents, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setImage, setImagePosition, setLabel, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setRelatedAction, setRelief, setResizeMode, setRgba, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTitle, setTooltipMarkup, setTooltipText, setTooltipWindow, setUseActionAppearance, setUseAlpha, setUseStock, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.
getAlpha
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> 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
:: (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.
Since: 2.4
getUseAlpha
colorButtonGetUseAlpha Source #
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> m Bool | Returns: |
Deprecated: (Since version 3.4)Use colorChooserGetUseAlpha
instead.
Does the color selection dialog use the alpha channel ?
Since: 2.4
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.
Since: 2.4
newWithColor
colorButtonNewWithColor Source #
:: (HasCallStack, MonadIO m) | |
=> Color |
|
-> 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 #
:: (HasCallStack, MonadIO m) | |
=> RGBA |
|
-> m ColorButton | Returns: a new color button |
Creates a new color button.
Since: 3.0
setAlpha
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> Word16 |
|
-> m () |
Deprecated: (Since version 3.4)Use colorChooserSetRgba
instead.
Sets the current opacity to be alpha
.
Since: 2.4
setColor
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> Color |
|
-> m () |
setTitle
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the title for the color selection dialog.
Since: 2.4
setUseAlpha
colorButtonSetUseAlpha Source #
:: (HasCallStack, MonadIO m, IsColorButton a) | |
=> a |
|
-> Bool |
|
-> 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, MonadIO m) => Word32 -> m (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, MonadIO m) => Color -> m (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, 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.
Since: 3.20
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
Since: 2.4
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.
Since: 2.4
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 ColorButtonColorSetCallback = IO () Source #
The colorSet 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 notifycolor signal.
Since: 2.4
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