gi-gtk-3.0.11: 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.Button

Contents

Description

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

Exported types

Methods

clicked

data ButtonClickedMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsButton a) => MethodInfo * ButtonClickedMethodInfo a signature Source # 

buttonClicked Source #

Arguments

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

button: The Button you want to send the signal to.

-> m () 

Emits a Button::clicked signal to the given Button.

enter

data ButtonEnterMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsButton a) => MethodInfo * ButtonEnterMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy ButtonEnterMethodInfo a -> signature -> s #

buttonEnter Source #

Arguments

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

button: The Button you want to send the signal to.

-> m () 

Deprecated: (Since version 2.20)Use the Widget::enter-notify-event signal.

Emits a Button::enter signal to the given Button.

getAlignment

buttonGetAlignment Source #

Arguments

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

button: a Button

-> m (Float, Float) 

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 #

Arguments

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

button: a Button

-> m Bool

Returns: True if the button will always show the image

Returns whether the button will ignore the Settings:gtk-button-images setting and always show the image, if available.

Since: 3.6

getEventWindow

buttonGetEventWindow Source #

Arguments

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

button: a Button

-> m Window

Returns: button’s event window.

Returns the button’s event window if it is realized, Nothing otherwise. This function should be rarely needed.

Since: 2.22

getFocusOnClick

buttonGetFocusOnClick Source #

Arguments

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

button: a Button

-> m Bool

Returns: True if the button grabs focus when it is clicked with the mouse.

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

data ButtonGetImageMethodInfo Source #

Instances

((~) * signature (m (Maybe Widget)), MonadIO m, IsButton a) => MethodInfo * ButtonGetImageMethodInfo a signature Source # 

buttonGetImage Source #

Arguments

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

button: a Button

-> m (Maybe Widget)

Returns: a Widget or Nothing in case there is no image

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 #

Arguments

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

button: a Button

-> m PositionType

Returns: the position

Gets the position of the image relative to the text inside the button.

Since: 2.10

getLabel

data ButtonGetLabelMethodInfo Source #

Instances

((~) * signature (m Text), MonadIO m, IsButton a) => MethodInfo * ButtonGetLabelMethodInfo a signature Source # 

buttonGetLabel Source #

Arguments

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

button: a Button

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

buttonGetRelief Source #

Arguments

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

button: The Button you want the ReliefStyle from.

-> m ReliefStyle

Returns: The current ReliefStyle

Returns the current relief style of the given Button.

getUseStock

buttonGetUseStock Source #

Arguments

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

button: a Button

-> m Bool

Returns: True if the button label is used to select a stock item instead of being used directly as the label text.

Deprecated: (Since version 3.10)

Returns whether the button label is a stock item.

getUseUnderline

buttonGetUseUnderline Source #

Arguments

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

button: a Button

-> m Bool

Returns: True if an embedded underline in the button label indicates the mnemonic accelerator keys.

Returns whether an embedded underline in the button label indicates a mnemonic. See gtk_button_set_use_underline ().

leave

data ButtonLeaveMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsButton a) => MethodInfo * ButtonLeaveMethodInfo a signature Source # 

Methods

overloadedMethod :: MethodProxy ButtonLeaveMethodInfo a -> signature -> s #

buttonLeave Source #

Arguments

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

button: The Button you want to send the signal to.

-> m () 

Deprecated: (Since version 2.20)Use the Widget::leave-notify-event signal.

Emits a Button::leave signal to the given Button.

new

buttonNew Source #

Arguments

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

Returns: The newly created Button widget.

Creates a new Button widget. To add a child widget to the button, use containerAdd.

newFromIconName

buttonNewFromIconName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

iconName: an icon name

-> Int32

size: an icon size (IconSize)

-> m Button

Returns: a new Button displaying the themed icon

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

buttonNewFromStock Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

stockId: the name of the stock item

-> m Button

Returns: a new Button

Deprecated: (Since version 3.10)Use buttonNewWithLabel instead.

Creates a new Button containing the image and text from a stock item. 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

buttonNewWithLabel Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

label: The text you want the Label to hold.

-> m Button

Returns: The newly created Button widget.

Creates a Button widget with a Label child containing the given text.

newWithMnemonic

buttonNewWithMnemonic Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

label: The text of the button, with an underscore in front of the mnemonic character

-> m Button

Returns: a new Button

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

data ButtonPressedMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsButton a) => MethodInfo * ButtonPressedMethodInfo a signature Source # 

buttonPressed Source #

Arguments

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

button: The Button you want to send the signal to.

-> m () 

Deprecated: (Since version 2.20)Use the Widget::button-press-event signal.

Emits a Button::pressed signal to the given Button.

released

data ButtonReleasedMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsButton a) => MethodInfo * ButtonReleasedMethodInfo a signature Source # 

buttonReleased Source #

Arguments

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

button: The Button you want to send the signal to.

-> m () 

Deprecated: (Since version 2.20)Use the Widget::button-release-event signal.

Emits a Button::released signal to the given Button.

setAlignment

data ButtonSetAlignmentMethodInfo Source #

Instances

((~) * signature (Float -> Float -> m ()), MonadIO m, IsButton a) => MethodInfo * ButtonSetAlignmentMethodInfo a signature Source # 

buttonSetAlignment Source #

Arguments

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

button: a Button

-> Float

xalign: the horizontal position of the child, 0.0 is left aligned, 1.0 is right aligned

-> Float

yalign: the vertical position of the child, 0.0 is top aligned, 1.0 is bottom aligned

-> m () 

Deprecated: (Since version 3.14)Access the child widget directly if you need to controlits alignment.

Sets the alignment of the child. This property has no effect unless the child is a Misc or a Alignment.

Since: 2.4

setAlwaysShowImage

buttonSetAlwaysShowImage Source #

Arguments

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

button: a Button

-> Bool

alwaysShow: True if the menuitem should always show the image

-> m () 

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

setFocusOnClick

buttonSetFocusOnClick Source #

Arguments

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

button: a Button

-> Bool

focusOnClick: whether the button grabs focus when clicked with the mouse

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

data ButtonSetImageMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsButton a, IsWidget b) => MethodInfo * ButtonSetImageMethodInfo a signature Source # 

buttonSetImage Source #

Arguments

:: (HasCallStack, MonadIO m, IsButton a, IsWidget b) 
=> a

button: a Button

-> b

image: a widget to set as the image for the button

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

Arguments

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

button: a Button

-> PositionType

position: the position

-> m () 

Sets the position of the image relative to the text inside the button.

Since: 2.10

setLabel

data ButtonSetLabelMethodInfo Source #

Instances

((~) * signature (Text -> m ()), MonadIO m, IsButton a) => MethodInfo * ButtonSetLabelMethodInfo a signature Source # 

buttonSetLabel Source #

Arguments

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

button: a Button

-> Text

label: a string

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

data ButtonSetReliefMethodInfo Source #

Instances

((~) * signature (ReliefStyle -> m ()), MonadIO m, IsButton a) => MethodInfo * ButtonSetReliefMethodInfo a signature Source # 

buttonSetRelief Source #

Arguments

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

button: The Button you want to set relief styles of

-> ReliefStyle

relief: The GtkReliefStyle as described above

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

data ButtonSetUseStockMethodInfo Source #

Instances

((~) * signature (Bool -> m ()), MonadIO m, IsButton a) => MethodInfo * ButtonSetUseStockMethodInfo a signature Source # 

buttonSetUseStock Source #

Arguments

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

button: a Button

-> Bool

useStock: True if the button should use a stock item

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

Arguments

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

button: a Button

-> Bool

useUnderline: True if underlines in the text indicate mnemonics

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

data ButtonAlwaysShowImagePropertyInfo Source #

Instances

AttrInfo ButtonAlwaysShowImagePropertyInfo Source # 
type AttrOrigin ButtonAlwaysShowImagePropertyInfo Source # 
type AttrLabel ButtonAlwaysShowImagePropertyInfo Source # 
type AttrLabel ButtonAlwaysShowImagePropertyInfo = "always-show-image"
type AttrGetType ButtonAlwaysShowImagePropertyInfo Source # 
type AttrBaseTypeConstraint ButtonAlwaysShowImagePropertyInfo Source # 
type AttrSetTypeConstraint ButtonAlwaysShowImagePropertyInfo Source # 
type AttrAllowedOps ButtonAlwaysShowImagePropertyInfo Source # 

image

data ButtonImagePropertyInfo Source #

Instances

AttrInfo ButtonImagePropertyInfo Source # 
type AttrOrigin ButtonImagePropertyInfo Source # 
type AttrLabel ButtonImagePropertyInfo Source # 
type AttrGetType ButtonImagePropertyInfo Source # 
type AttrBaseTypeConstraint ButtonImagePropertyInfo Source # 
type AttrSetTypeConstraint ButtonImagePropertyInfo Source # 
type AttrAllowedOps ButtonImagePropertyInfo Source # 

setButtonImage :: (MonadIO m, IsButton o, IsWidget a) => o -> a -> m () Source #

imagePosition

data ButtonImagePositionPropertyInfo Source #

Instances

AttrInfo ButtonImagePositionPropertyInfo Source # 
type AttrOrigin ButtonImagePositionPropertyInfo Source # 
type AttrLabel ButtonImagePositionPropertyInfo Source # 
type AttrGetType ButtonImagePositionPropertyInfo Source # 
type AttrBaseTypeConstraint ButtonImagePositionPropertyInfo Source # 
type AttrSetTypeConstraint ButtonImagePositionPropertyInfo Source # 
type AttrAllowedOps ButtonImagePositionPropertyInfo Source # 

label

data ButtonLabelPropertyInfo Source #

Instances

AttrInfo ButtonLabelPropertyInfo Source # 
type AttrOrigin ButtonLabelPropertyInfo Source # 
type AttrLabel ButtonLabelPropertyInfo Source # 
type AttrGetType ButtonLabelPropertyInfo Source # 
type AttrBaseTypeConstraint ButtonLabelPropertyInfo Source # 
type AttrSetTypeConstraint ButtonLabelPropertyInfo Source # 
type AttrAllowedOps ButtonLabelPropertyInfo Source # 

setButtonLabel :: (MonadIO m, IsButton o) => o -> Text -> m () Source #

relief

data ButtonReliefPropertyInfo Source #

Instances

AttrInfo ButtonReliefPropertyInfo Source # 
type AttrOrigin ButtonReliefPropertyInfo Source # 
type AttrLabel ButtonReliefPropertyInfo Source # 
type AttrGetType ButtonReliefPropertyInfo Source # 
type AttrBaseTypeConstraint ButtonReliefPropertyInfo Source # 
type AttrSetTypeConstraint ButtonReliefPropertyInfo Source # 
type AttrAllowedOps ButtonReliefPropertyInfo Source # 

useStock

data ButtonUseStockPropertyInfo Source #

Instances

AttrInfo ButtonUseStockPropertyInfo Source # 
type AttrOrigin ButtonUseStockPropertyInfo Source # 
type AttrLabel ButtonUseStockPropertyInfo Source # 
type AttrGetType ButtonUseStockPropertyInfo Source # 
type AttrBaseTypeConstraint ButtonUseStockPropertyInfo Source # 
type AttrSetTypeConstraint ButtonUseStockPropertyInfo Source # 
type AttrAllowedOps ButtonUseStockPropertyInfo Source # 

setButtonUseStock :: (MonadIO m, IsButton o) => o -> Bool -> m () Source #

useUnderline

data ButtonUseUnderlinePropertyInfo Source #

Instances

AttrInfo ButtonUseUnderlinePropertyInfo Source # 
type AttrOrigin ButtonUseUnderlinePropertyInfo Source # 
type AttrLabel ButtonUseUnderlinePropertyInfo Source # 
type AttrGetType ButtonUseUnderlinePropertyInfo Source # 
type AttrBaseTypeConstraint ButtonUseUnderlinePropertyInfo Source # 
type AttrSetTypeConstraint ButtonUseUnderlinePropertyInfo Source # 
type AttrAllowedOps ButtonUseUnderlinePropertyInfo Source # 

xalign

data ButtonXalignPropertyInfo Source #

Instances

AttrInfo ButtonXalignPropertyInfo Source # 
type AttrOrigin ButtonXalignPropertyInfo Source # 
type AttrLabel ButtonXalignPropertyInfo Source # 
type AttrGetType ButtonXalignPropertyInfo Source # 
type AttrBaseTypeConstraint ButtonXalignPropertyInfo Source # 
type AttrSetTypeConstraint ButtonXalignPropertyInfo Source # 
type AttrAllowedOps ButtonXalignPropertyInfo Source # 

setButtonXalign :: (MonadIO m, IsButton o) => o -> Float -> m () Source #

yalign

data ButtonYalignPropertyInfo Source #

Instances

AttrInfo ButtonYalignPropertyInfo Source # 
type AttrOrigin ButtonYalignPropertyInfo Source # 
type AttrLabel ButtonYalignPropertyInfo Source # 
type AttrGetType ButtonYalignPropertyInfo Source # 
type AttrBaseTypeConstraint ButtonYalignPropertyInfo Source # 
type AttrSetTypeConstraint ButtonYalignPropertyInfo Source # 
type AttrAllowedOps ButtonYalignPropertyInfo Source # 

setButtonYalign :: (MonadIO m, IsButton o) => o -> Float -> m () Source #

Signals

activate

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

clicked

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

enter

type ButtonEnterCallback = IO () Source #

Deprecated: (Since version 2.8)Use the Widget::enter-notify-event signal.

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

leave

type ButtonLeaveCallback = IO () Source #

Deprecated: (Since version 2.8)Use the Widget::leave-notify-event signal.

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

pressed

type ButtonPressedCallback = IO () Source #

Deprecated: (Since version 2.8)Use the Widget::button-press-event signal.

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

released

type ButtonReleasedCallback = IO () Source #

Deprecated: (Since version 2.8)Use the Widget::button-release-event signal.

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