Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Exported types
- Methods
- clicked
- enter
- getAlignment
- getAlwaysShowImage
- getEventWindow
- getFocusOnClick
- getImage
- getImagePosition
- getLabel
- getRelief
- getUseStock
- getUseUnderline
- leave
- new
- newFromIconName
- newFromStock
- newWithLabel
- newWithMnemonic
- pressed
- released
- setAlignment
- setAlwaysShowImage
- setFocusOnClick
- setImage
- setImagePosition
- setLabel
- setRelief
- setUseStock
- setUseUnderline
- Properties
- Signals
The Button
widget is generally used to trigger a callback function that is
called when the button is pressed. The various signals and how to use them
are outlined below.
The Button
widget can hold any valid child widget. That is, it can hold
almost any other standard Widget
. The most commonly used child is the
Label
.
CSS nodes
GtkButton has a single CSS node with name button. The node will get the style classes .image-button or .text-button, if the content is just an image or label, respectively. It may also receive the .flat style class.
Other style classes that are commonly used with GtkButton include .suggested-action and .destructive-action. In special cases, buttons can be made round by adding the .circular style class.
Button-like widgets like ToggleButton
, MenuButton
, VolumeButton
,
LockButton
, ColorButton
, FontButton
or FileChooserButton
use
style classes such as .toggle, .popup, .scale, .lock, .color, .font, .file
to differentiate themselves from a plain GtkButton.
Synopsis
- newtype Button = Button (ManagedPtr Button)
- class (GObject o, IsDescendantOf Button o) => IsButton o
- toButton :: (MonadIO m, IsButton o) => o -> m Button
- buttonClicked :: (HasCallStack, MonadIO m, IsButton a) => a -> m ()
- buttonEnter :: (HasCallStack, MonadIO m, IsButton a) => a -> m ()
- buttonGetAlignment :: (HasCallStack, MonadIO m, IsButton a) => a -> m (Float, Float)
- buttonGetAlwaysShowImage :: (HasCallStack, MonadIO m, IsButton a) => a -> m Bool
- buttonGetEventWindow :: (HasCallStack, MonadIO m, IsButton a) => a -> m Window
- buttonGetFocusOnClick :: (HasCallStack, MonadIO m, IsButton a) => a -> m Bool
- buttonGetImage :: (HasCallStack, MonadIO m, IsButton a) => a -> m (Maybe Widget)
- buttonGetImagePosition :: (HasCallStack, MonadIO m, IsButton a) => a -> m PositionType
- buttonGetLabel :: (HasCallStack, MonadIO m, IsButton a) => a -> m Text
- buttonGetRelief :: (HasCallStack, MonadIO m, IsButton a) => a -> m ReliefStyle
- buttonGetUseStock :: (HasCallStack, MonadIO m, IsButton a) => a -> m Bool
- buttonGetUseUnderline :: (HasCallStack, MonadIO m, IsButton a) => a -> m Bool
- buttonLeave :: (HasCallStack, MonadIO m, IsButton a) => a -> m ()
- buttonNew :: (HasCallStack, MonadIO m) => m Button
- buttonNewFromIconName :: (HasCallStack, MonadIO m) => Maybe Text -> Int32 -> m Button
- buttonNewFromStock :: (HasCallStack, MonadIO m) => Text -> m Button
- buttonNewWithLabel :: (HasCallStack, MonadIO m) => Text -> m Button
- buttonNewWithMnemonic :: (HasCallStack, MonadIO m) => Text -> m Button
- buttonPressed :: (HasCallStack, MonadIO m, IsButton a) => a -> m ()
- buttonReleased :: (HasCallStack, MonadIO m, IsButton a) => a -> m ()
- buttonSetAlignment :: (HasCallStack, MonadIO m, IsButton a) => a -> Float -> Float -> m ()
- buttonSetAlwaysShowImage :: (HasCallStack, MonadIO m, IsButton a) => a -> Bool -> m ()
- buttonSetFocusOnClick :: (HasCallStack, MonadIO m, IsButton a) => a -> Bool -> m ()
- buttonSetImage :: (HasCallStack, MonadIO m, IsButton a, IsWidget b) => a -> Maybe b -> m ()
- buttonSetImagePosition :: (HasCallStack, MonadIO m, IsButton a) => a -> PositionType -> m ()
- buttonSetLabel :: (HasCallStack, MonadIO m, IsButton a) => a -> Text -> m ()
- buttonSetRelief :: (HasCallStack, MonadIO m, IsButton a) => a -> ReliefStyle -> m ()
- buttonSetUseStock :: (HasCallStack, MonadIO m, IsButton a) => a -> Bool -> m ()
- buttonSetUseUnderline :: (HasCallStack, MonadIO m, IsButton a) => a -> Bool -> m ()
- constructButtonAlwaysShowImage :: (IsButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getButtonAlwaysShowImage :: (MonadIO m, IsButton o) => o -> m Bool
- setButtonAlwaysShowImage :: (MonadIO m, IsButton o) => o -> Bool -> m ()
- clearButtonImage :: (MonadIO m, IsButton o) => o -> m ()
- constructButtonImage :: (IsButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getButtonImage :: (MonadIO m, IsButton o) => o -> m (Maybe Widget)
- setButtonImage :: (MonadIO m, IsButton o, IsWidget a) => o -> a -> m ()
- constructButtonImagePosition :: (IsButton o, MonadIO m) => PositionType -> m (GValueConstruct o)
- getButtonImagePosition :: (MonadIO m, IsButton o) => o -> m PositionType
- setButtonImagePosition :: (MonadIO m, IsButton o) => o -> PositionType -> m ()
- constructButtonLabel :: (IsButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getButtonLabel :: (MonadIO m, IsButton o) => o -> m Text
- setButtonLabel :: (MonadIO m, IsButton o) => o -> Text -> m ()
- constructButtonRelief :: (IsButton o, MonadIO m) => ReliefStyle -> m (GValueConstruct o)
- getButtonRelief :: (MonadIO m, IsButton o) => o -> m ReliefStyle
- setButtonRelief :: (MonadIO m, IsButton o) => o -> ReliefStyle -> m ()
- constructButtonUseStock :: (IsButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getButtonUseStock :: (MonadIO m, IsButton o) => o -> m Bool
- setButtonUseStock :: (MonadIO m, IsButton o) => o -> Bool -> m ()
- constructButtonUseUnderline :: (IsButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getButtonUseUnderline :: (MonadIO m, IsButton o) => o -> m Bool
- setButtonUseUnderline :: (MonadIO m, IsButton o) => o -> Bool -> m ()
- constructButtonXalign :: (IsButton o, MonadIO m) => Float -> m (GValueConstruct o)
- getButtonXalign :: (MonadIO m, IsButton o) => o -> m Float
- setButtonXalign :: (MonadIO m, IsButton o) => o -> Float -> m ()
- constructButtonYalign :: (IsButton o, MonadIO m) => Float -> m (GValueConstruct o)
- getButtonYalign :: (MonadIO m, IsButton o) => o -> m Float
- setButtonYalign :: (MonadIO m, IsButton o) => o -> Float -> m ()
- type ButtonActivateCallback = IO ()
- type C_ButtonActivateCallback = Ptr () -> Ptr () -> IO ()
- afterButtonActivate :: (IsButton a, MonadIO m) => a -> ButtonActivateCallback -> m SignalHandlerId
- genClosure_ButtonActivate :: MonadIO m => ButtonActivateCallback -> m (GClosure C_ButtonActivateCallback)
- mk_ButtonActivateCallback :: C_ButtonActivateCallback -> IO (FunPtr C_ButtonActivateCallback)
- noButtonActivateCallback :: Maybe ButtonActivateCallback
- onButtonActivate :: (IsButton a, MonadIO m) => a -> ButtonActivateCallback -> m SignalHandlerId
- wrap_ButtonActivateCallback :: ButtonActivateCallback -> C_ButtonActivateCallback
- type ButtonClickedCallback = IO ()
- type C_ButtonClickedCallback = Ptr () -> Ptr () -> IO ()
- afterButtonClicked :: (IsButton a, MonadIO m) => a -> ButtonClickedCallback -> m SignalHandlerId
- genClosure_ButtonClicked :: MonadIO m => ButtonClickedCallback -> m (GClosure C_ButtonClickedCallback)
- mk_ButtonClickedCallback :: C_ButtonClickedCallback -> IO (FunPtr C_ButtonClickedCallback)
- noButtonClickedCallback :: Maybe ButtonClickedCallback
- onButtonClicked :: (IsButton a, MonadIO m) => a -> ButtonClickedCallback -> m SignalHandlerId
- wrap_ButtonClickedCallback :: ButtonClickedCallback -> C_ButtonClickedCallback
- type ButtonEnterCallback = IO ()
- type C_ButtonEnterCallback = Ptr () -> Ptr () -> IO ()
- afterButtonEnter :: (IsButton a, MonadIO m) => a -> ButtonEnterCallback -> m SignalHandlerId
- genClosure_ButtonEnter :: MonadIO m => ButtonEnterCallback -> m (GClosure C_ButtonEnterCallback)
- mk_ButtonEnterCallback :: C_ButtonEnterCallback -> IO (FunPtr C_ButtonEnterCallback)
- noButtonEnterCallback :: Maybe ButtonEnterCallback
- onButtonEnter :: (IsButton a, MonadIO m) => a -> ButtonEnterCallback -> m SignalHandlerId
- wrap_ButtonEnterCallback :: ButtonEnterCallback -> C_ButtonEnterCallback
- type ButtonLeaveCallback = IO ()
- type C_ButtonLeaveCallback = Ptr () -> Ptr () -> IO ()
- afterButtonLeave :: (IsButton a, MonadIO m) => a -> ButtonLeaveCallback -> m SignalHandlerId
- genClosure_ButtonLeave :: MonadIO m => ButtonLeaveCallback -> m (GClosure C_ButtonLeaveCallback)
- mk_ButtonLeaveCallback :: C_ButtonLeaveCallback -> IO (FunPtr C_ButtonLeaveCallback)
- noButtonLeaveCallback :: Maybe ButtonLeaveCallback
- onButtonLeave :: (IsButton a, MonadIO m) => a -> ButtonLeaveCallback -> m SignalHandlerId
- wrap_ButtonLeaveCallback :: ButtonLeaveCallback -> C_ButtonLeaveCallback
- type ButtonPressedCallback = IO ()
- type C_ButtonPressedCallback = Ptr () -> Ptr () -> IO ()
- afterButtonPressed :: (IsButton a, MonadIO m) => a -> ButtonPressedCallback -> m SignalHandlerId
- genClosure_ButtonPressed :: MonadIO m => ButtonPressedCallback -> m (GClosure C_ButtonPressedCallback)
- mk_ButtonPressedCallback :: C_ButtonPressedCallback -> IO (FunPtr C_ButtonPressedCallback)
- noButtonPressedCallback :: Maybe ButtonPressedCallback
- onButtonPressed :: (IsButton a, MonadIO m) => a -> ButtonPressedCallback -> m SignalHandlerId
- wrap_ButtonPressedCallback :: ButtonPressedCallback -> C_ButtonPressedCallback
- type ButtonReleasedCallback = IO ()
- type C_ButtonReleasedCallback = Ptr () -> Ptr () -> IO ()
- afterButtonReleased :: (IsButton a, MonadIO m) => a -> ButtonReleasedCallback -> m SignalHandlerId
- genClosure_ButtonReleased :: MonadIO m => ButtonReleasedCallback -> m (GClosure C_ButtonReleasedCallback)
- mk_ButtonReleasedCallback :: C_ButtonReleasedCallback -> IO (FunPtr C_ButtonReleasedCallback)
- noButtonReleasedCallback :: Maybe ButtonReleasedCallback
- onButtonReleased :: (IsButton a, MonadIO m) => a -> ButtonReleasedCallback -> m SignalHandlerId
- wrap_ButtonReleasedCallback :: ButtonReleasedCallback -> C_ButtonReleasedCallback
Exported types
Memory-managed wrapper type.
Instances
Eq Button Source # | |
GObject Button Source # | |
Defined in GI.Gtk.Objects.Button | |
ManagedPtrNewtype Button Source # | |
Defined in GI.Gtk.Objects.Button toManagedPtr :: Button -> ManagedPtr Button | |
TypedObject Button Source # | |
Defined in GI.Gtk.Objects.Button | |
HasParentTypes Button Source # | |
Defined in GI.Gtk.Objects.Button | |
IsGValue (Maybe Button) Source # | Convert |
Defined in GI.Gtk.Objects.Button gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Button -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Button) | |
type ParentTypes Button Source # | |
Defined in GI.Gtk.Objects.Button type ParentTypes Button = '[Bin, Container, Widget, Object, ImplementorIface, Actionable, Activatable, Buildable] |
class (GObject o, IsDescendantOf Button o) => IsButton o Source #
Instances
(GObject o, IsDescendantOf Button o) => IsButton o Source # | |
Defined in GI.Gtk.Objects.Button |
Methods
Click to display all available methods, including inherited ones
Methods
activate, add, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, 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, getAlwaysShowImage, getAncestor, getAppPaintable, getBorderWidth, getCanDefault, getCanFocus, getChild, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, 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, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getUseActionAppearance, getUseStock, getUseUnderline, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.
Setters
setAccelPath, setActionName, setActionTargetValue, setAlignment, setAllocation, setAlwaysShowImage, setAppPaintable, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, 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, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTooltipMarkup, setTooltipText, setTooltipWindow, setUseActionAppearance, setUseStock, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.
clicked
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m () |
enter
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m () |
Deprecated: (Since version 2.20)Use the enterNotifyEvent signal.
getAlignment
Deprecated: (Since version 3.14)Access the child widget directly if you need to controlits alignment.
Gets the alignment of the child in the button.
Since: 2.4
getAlwaysShowImage
buttonGetAlwaysShowImage Source #
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the button will ignore the Settings
:gtk-button-images
setting and always show the image, if available.
Since: 3.6
getEventWindow
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m Window | Returns: |
Returns the button’s event window if it is realized, Nothing
otherwise.
This function should be rarely needed.
Since: 2.22
getFocusOnClick
buttonGetFocusOnClick Source #
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m Bool | Returns: |
Deprecated: (Since version 3.20)Use widgetGetFocusOnClick
instead
Returns whether the button grabs focus when it is clicked with the mouse.
See buttonSetFocusOnClick
.
Since: 2.4
getImage
Gets the widget that is currenty set as the image of button
.
This may have been explicitly set by buttonSetImage
or constructed by buttonNewFromStock
.
Since: 2.6
getImagePosition
buttonGetImagePosition Source #
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m PositionType | Returns: the position |
Gets the position of the image relative to the text inside the button.
Since: 2.10
getLabel
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m Text | Returns: The text of the label widget. This string is owned by the widget and must not be modified or freed. |
Fetches the text from the label of the button, as set by
buttonSetLabel
. If the label text has not
been set the return value will be Nothing
. This will be the
case if you create an empty button with buttonNew
to
use as a container.
getRelief
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m ReliefStyle | Returns: The current |
Returns the current relief style of the given Button
.
getUseStock
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m Bool | Returns: |
Deprecated: (Since version 3.10)
Returns whether the button label is a stock item.
getUseUnderline
buttonGetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether an embedded underline in the button label indicates a mnemonic. See gtk_button_set_use_underline ().
leave
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m () |
Deprecated: (Since version 2.20)Use the leaveNotifyEvent signal.
new
:: (HasCallStack, MonadIO m) | |
=> m Button | Returns: The newly created |
Creates a new Button
widget. To add a child widget to the button,
use containerAdd
.
newFromIconName
buttonNewFromIconName Source #
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> Int32 |
|
-> m Button | Returns: a new |
Creates a new button containing an icon from the current icon theme.
If the icon name isn’t known, a “broken image” icon will be displayed instead. If the current icon theme is changed, the icon will be updated appropriately.
This function is a convenience wrapper around buttonNew
and
buttonSetImage
.
Since: 3.10
newFromStock
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Button | Returns: a new |
Deprecated: (Since version 3.10)Stock items are deprecated. Use buttonNewWithLabel
instead.
Creates a new Button
containing the image and text from a
[stock item][gtkstock].
Some stock ids have preprocessor macros like STOCK_OK
and
STOCK_APPLY
.
If stockId
is unknown, then it will be treated as a mnemonic
label (as for buttonNewWithMnemonic
).
newWithLabel
newWithMnemonic
buttonNewWithMnemonic Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Button | Returns: a new |
Creates a new Button
containing a label.
If characters in label
are preceded by an underscore, they are underlined.
If you need a literal underscore character in a label, use “__” (two
underscores). The first underlined character represents a keyboard
accelerator called a mnemonic.
Pressing Alt and that key activates the button.
pressed
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m () |
Deprecated: (Since version 2.20)Use the buttonPressEvent signal.
released
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> m () |
Deprecated: (Since version 2.20)Use the buttonReleaseEvent signal.
setAlignment
setAlwaysShowImage
setFocusOnClick
buttonSetFocusOnClick Source #
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> Bool |
|
-> m () |
Deprecated: (Since version 3.20)Use widgetSetFocusOnClick
instead
Sets whether the button will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.
Since: 2.4
setImage
:: (HasCallStack, MonadIO m, IsButton a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Set the image of button
to the given widget. The image will be
displayed if the label text is Nothing
or if
Button
:always-show-image
is True
. You don’t have to call
widgetShow
on image
yourself.
Since: 2.6
setImagePosition
buttonSetImagePosition Source #
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> PositionType |
|
-> m () |
Sets the position of the image relative to the text inside the button.
Since: 2.10
setLabel
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the text of the label of the button to str
. This text is
also used to select the stock item if buttonSetUseStock
is used.
This will also clear any previously set labels.
setRelief
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> ReliefStyle |
|
-> m () |
Sets the relief style of the edges of the given Button
widget.
Two styles exist, ReliefStyleNormal
and ReliefStyleNone
.
The default style is, as one can guess, ReliefStyleNormal
.
The deprecated value ReliefStyleHalf
behaves the same as
ReliefStyleNormal
.
setUseStock
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> Bool |
|
-> m () |
Deprecated: (Since version 3.10)
If True
, the label set on the button is used as a
stock id to select the stock item for the button.
setUseUnderline
buttonSetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsButton a) | |
=> a |
|
-> Bool |
|
-> m () |
If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.
Properties
alwaysShowImage
If True
, the button will ignore the Settings
:gtk-button-images
setting and always show the image, if available.
Use this property if the button would be useless or hard to use without the image.
Since: 3.6
constructButtonAlwaysShowImage :: (IsButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “always-show-image
” property. This is rarely needed directly, but it is used by new
.
getButtonAlwaysShowImage :: (MonadIO m, IsButton o) => o -> m Bool Source #
Get the value of the “always-show-image
” property.
When overloading is enabled, this is equivalent to
get
button #alwaysShowImage
setButtonAlwaysShowImage :: (MonadIO m, IsButton o) => o -> Bool -> m () Source #
Set the value of the “always-show-image
” property.
When overloading is enabled, this is equivalent to
set
button [ #alwaysShowImage:=
value ]
image
The child widget to appear next to the button text.
Since: 2.6
clearButtonImage :: (MonadIO m, IsButton o) => o -> m () Source #
Set the value of the “image
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#image
constructButtonImage :: (IsButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “image
” property. This is rarely needed directly, but it is used by new
.
getButtonImage :: (MonadIO m, IsButton o) => o -> m (Maybe Widget) Source #
Get the value of the “image
” property.
When overloading is enabled, this is equivalent to
get
button #image
setButtonImage :: (MonadIO m, IsButton o, IsWidget a) => o -> a -> m () Source #
Set the value of the “image
” property.
When overloading is enabled, this is equivalent to
set
button [ #image:=
value ]
imagePosition
The position of the image relative to the text inside the button.
Since: 2.10
constructButtonImagePosition :: (IsButton o, MonadIO m) => PositionType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “image-position
” property. This is rarely needed directly, but it is used by new
.
getButtonImagePosition :: (MonadIO m, IsButton o) => o -> m PositionType Source #
Get the value of the “image-position
” property.
When overloading is enabled, this is equivalent to
get
button #imagePosition
setButtonImagePosition :: (MonadIO m, IsButton o) => o -> PositionType -> m () Source #
Set the value of the “image-position
” property.
When overloading is enabled, this is equivalent to
set
button [ #imagePosition:=
value ]
label
No description available in the introspection data.
constructButtonLabel :: (IsButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “label
” property. This is rarely needed directly, but it is used by new
.
getButtonLabel :: (MonadIO m, IsButton o) => o -> m Text Source #
Get the value of the “label
” property.
When overloading is enabled, this is equivalent to
get
button #label
setButtonLabel :: (MonadIO m, IsButton o) => o -> Text -> m () Source #
Set the value of the “label
” property.
When overloading is enabled, this is equivalent to
set
button [ #label:=
value ]
relief
No description available in the introspection data.
constructButtonRelief :: (IsButton o, MonadIO m) => ReliefStyle -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “relief
” property. This is rarely needed directly, but it is used by new
.
getButtonRelief :: (MonadIO m, IsButton o) => o -> m ReliefStyle Source #
Get the value of the “relief
” property.
When overloading is enabled, this is equivalent to
get
button #relief
setButtonRelief :: (MonadIO m, IsButton o) => o -> ReliefStyle -> m () Source #
Set the value of the “relief
” property.
When overloading is enabled, this is equivalent to
set
button [ #relief:=
value ]
useStock
No description available in the introspection data.
constructButtonUseStock :: (IsButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-stock
” property. This is rarely needed directly, but it is used by new
.
getButtonUseStock :: (MonadIO m, IsButton o) => o -> m Bool Source #
Get the value of the “use-stock
” property.
When overloading is enabled, this is equivalent to
get
button #useStock
setButtonUseStock :: (MonadIO m, IsButton o) => o -> Bool -> m () Source #
Set the value of the “use-stock
” property.
When overloading is enabled, this is equivalent to
set
button [ #useStock:=
value ]
useUnderline
No description available in the introspection data.
constructButtonUseUnderline :: (IsButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-underline
” property. This is rarely needed directly, but it is used by new
.
getButtonUseUnderline :: (MonadIO m, IsButton o) => o -> m Bool Source #
Get the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
get
button #useUnderline
setButtonUseUnderline :: (MonadIO m, IsButton o) => o -> Bool -> m () Source #
Set the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
set
button [ #useUnderline:=
value ]
xalign
If the child of the button is a Misc
or Alignment
, this property
can be used to control its horizontal alignment. 0.0 is left aligned,
1.0 is right aligned.
Since: 2.4
constructButtonXalign :: (IsButton o, MonadIO m) => Float -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “xalign
” property. This is rarely needed directly, but it is used by new
.
getButtonXalign :: (MonadIO m, IsButton o) => o -> m Float Source #
Get the value of the “xalign
” property.
When overloading is enabled, this is equivalent to
get
button #xalign
setButtonXalign :: (MonadIO m, IsButton o) => o -> Float -> m () Source #
Set the value of the “xalign
” property.
When overloading is enabled, this is equivalent to
set
button [ #xalign:=
value ]
yalign
If the child of the button is a Misc
or Alignment
, this property
can be used to control its vertical alignment. 0.0 is top aligned,
1.0 is bottom aligned.
Since: 2.4
constructButtonYalign :: (IsButton o, MonadIO m) => Float -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “yalign
” property. This is rarely needed directly, but it is used by new
.
getButtonYalign :: (MonadIO m, IsButton o) => o -> m Float Source #
Get the value of the “yalign
” property.
When overloading is enabled, this is equivalent to
get
button #yalign
setButtonYalign :: (MonadIO m, IsButton o) => o -> Float -> m () Source #
Set the value of the “yalign
” property.
When overloading is enabled, this is equivalent to
set
button [ #yalign:=
value ]
Signals
activate
type ButtonActivateCallback = IO () Source #
type C_ButtonActivateCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
afterButtonActivate :: (IsButton a, MonadIO m) => a -> ButtonActivateCallback -> m SignalHandlerId Source #
Connect a signal handler for the activate signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
button #activate callback
genClosure_ButtonActivate :: MonadIO m => ButtonActivateCallback -> m (GClosure C_ButtonActivateCallback) Source #
Wrap the callback into a GClosure
.
mk_ButtonActivateCallback :: C_ButtonActivateCallback -> IO (FunPtr C_ButtonActivateCallback) Source #
Generate a function pointer callable from C code, from a C_ButtonActivateCallback
.
noButtonActivateCallback :: Maybe ButtonActivateCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ButtonActivateCallback
onButtonActivate :: (IsButton a, MonadIO m) => a -> ButtonActivateCallback -> m SignalHandlerId Source #
Connect a signal handler for the activate signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
button #activate callback
wrap_ButtonActivateCallback :: ButtonActivateCallback -> C_ButtonActivateCallback Source #
Wrap a ButtonActivateCallback
into a C_ButtonActivateCallback
.
clicked
type ButtonClickedCallback = IO () Source #
Emitted when the button has been activated (pressed and released).
type C_ButtonClickedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
afterButtonClicked :: (IsButton a, MonadIO m) => a -> ButtonClickedCallback -> m SignalHandlerId Source #
Connect a signal handler for the clicked signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
button #clicked callback
genClosure_ButtonClicked :: MonadIO m => ButtonClickedCallback -> m (GClosure C_ButtonClickedCallback) Source #
Wrap the callback into a GClosure
.
mk_ButtonClickedCallback :: C_ButtonClickedCallback -> IO (FunPtr C_ButtonClickedCallback) Source #
Generate a function pointer callable from C code, from a C_ButtonClickedCallback
.
noButtonClickedCallback :: Maybe ButtonClickedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ButtonClickedCallback
onButtonClicked :: (IsButton a, MonadIO m) => a -> ButtonClickedCallback -> m SignalHandlerId Source #
Connect a signal handler for the clicked signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
button #clicked callback
wrap_ButtonClickedCallback :: ButtonClickedCallback -> C_ButtonClickedCallback Source #
Wrap a ButtonClickedCallback
into a C_ButtonClickedCallback
.
enter
type ButtonEnterCallback = IO () Source #
Deprecated: (Since version 2.8)Use the enterNotifyEvent signal.
Emitted when the pointer enters the button.
type C_ButtonEnterCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
afterButtonEnter :: (IsButton a, MonadIO m) => a -> ButtonEnterCallback -> m SignalHandlerId Source #
Connect a signal handler for the enter signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
button #enter callback
genClosure_ButtonEnter :: MonadIO m => ButtonEnterCallback -> m (GClosure C_ButtonEnterCallback) Source #
Wrap the callback into a GClosure
.
mk_ButtonEnterCallback :: C_ButtonEnterCallback -> IO (FunPtr C_ButtonEnterCallback) Source #
Generate a function pointer callable from C code, from a C_ButtonEnterCallback
.
noButtonEnterCallback :: Maybe ButtonEnterCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ButtonEnterCallback
onButtonEnter :: (IsButton a, MonadIO m) => a -> ButtonEnterCallback -> m SignalHandlerId Source #
Connect a signal handler for the enter signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
button #enter callback
wrap_ButtonEnterCallback :: ButtonEnterCallback -> C_ButtonEnterCallback Source #
Wrap a ButtonEnterCallback
into a C_ButtonEnterCallback
.
leave
type ButtonLeaveCallback = IO () Source #
Deprecated: (Since version 2.8)Use the leaveNotifyEvent signal.
Emitted when the pointer leaves the button.
type C_ButtonLeaveCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
afterButtonLeave :: (IsButton a, MonadIO m) => a -> ButtonLeaveCallback -> m SignalHandlerId Source #
Connect a signal handler for the leave signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
button #leave callback
genClosure_ButtonLeave :: MonadIO m => ButtonLeaveCallback -> m (GClosure C_ButtonLeaveCallback) Source #
Wrap the callback into a GClosure
.
mk_ButtonLeaveCallback :: C_ButtonLeaveCallback -> IO (FunPtr C_ButtonLeaveCallback) Source #
Generate a function pointer callable from C code, from a C_ButtonLeaveCallback
.
noButtonLeaveCallback :: Maybe ButtonLeaveCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ButtonLeaveCallback
onButtonLeave :: (IsButton a, MonadIO m) => a -> ButtonLeaveCallback -> m SignalHandlerId Source #
Connect a signal handler for the leave signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
button #leave callback
wrap_ButtonLeaveCallback :: ButtonLeaveCallback -> C_ButtonLeaveCallback Source #
Wrap a ButtonLeaveCallback
into a C_ButtonLeaveCallback
.
pressed
type ButtonPressedCallback = IO () Source #
Deprecated: (Since version 2.8)Use the buttonPressEvent signal.
Emitted when the button is pressed.
type C_ButtonPressedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
afterButtonPressed :: (IsButton a, MonadIO m) => a -> ButtonPressedCallback -> m SignalHandlerId Source #
Connect a signal handler for the pressed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
button #pressed callback
genClosure_ButtonPressed :: MonadIO m => ButtonPressedCallback -> m (GClosure C_ButtonPressedCallback) Source #
Wrap the callback into a GClosure
.
mk_ButtonPressedCallback :: C_ButtonPressedCallback -> IO (FunPtr C_ButtonPressedCallback) Source #
Generate a function pointer callable from C code, from a C_ButtonPressedCallback
.
noButtonPressedCallback :: Maybe ButtonPressedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ButtonPressedCallback
onButtonPressed :: (IsButton a, MonadIO m) => a -> ButtonPressedCallback -> m SignalHandlerId Source #
Connect a signal handler for the pressed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
button #pressed callback
wrap_ButtonPressedCallback :: ButtonPressedCallback -> C_ButtonPressedCallback Source #
Wrap a ButtonPressedCallback
into a C_ButtonPressedCallback
.
released
type ButtonReleasedCallback = IO () Source #
Deprecated: (Since version 2.8)Use the buttonReleaseEvent signal.
Emitted when the button is released.
type C_ButtonReleasedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
afterButtonReleased :: (IsButton a, MonadIO m) => a -> ButtonReleasedCallback -> m SignalHandlerId Source #
Connect a signal handler for the released signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
button #released callback
genClosure_ButtonReleased :: MonadIO m => ButtonReleasedCallback -> m (GClosure C_ButtonReleasedCallback) Source #
Wrap the callback into a GClosure
.
mk_ButtonReleasedCallback :: C_ButtonReleasedCallback -> IO (FunPtr C_ButtonReleasedCallback) Source #
Generate a function pointer callable from C code, from a C_ButtonReleasedCallback
.
noButtonReleasedCallback :: Maybe ButtonReleasedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ButtonReleasedCallback
onButtonReleased :: (IsButton a, MonadIO m) => a -> ButtonReleasedCallback -> m SignalHandlerId Source #
Connect a signal handler for the released signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
button #released callback